def lj_system(box_length): system = feasst.System() config = feasst.Configuration( feasst.Domain(feasst.args({"cubic_box_length": str(box_length)})), feasst.args({"particle_type": feasst.install_dir() + "/forcefield/lj.fstprt"})) config.set_model_param("cutoff", 0, args.cutoff) system.add(config) system.add(feasst.Potential(feasst.MakeLennardJones())) return system
def lj_system(box_length, cutoff): system = feasst.System() config = feasst.Configuration( feasst.MakeDomain(feasst.args({"cubic_box_length": str(box_length)})), feasst.args( {"particle_type": feasst.install_dir() + "/forcefield/lj.fstprt"})) config.set_model_param("cutoff", 0, cutoff) system.add(config) system.add(feasst.Potential(feasst.MakeLennardJones())) if system.configuration().domain().is_cell_enabled(): #system.add_to_optimized(feasst.Potential(feasst.MakeLennardJones(), feasst.MakeVisitModelCell())) system.add_to_reference( feasst.Potential(feasst.MakeHardSphere(), feasst.MakeVisitModelCell())) return system
def configuration(box_length=8, forcefield='data.lj', num=0): """Return an LJ configuration with cubic box and (optionally) cell list. box_length -- the length of the cubic peroidic boundary conditions forcefield -- the file describing the particle num -- the number of particles of the first type to add. """ config = feasst.Configuration( feasst.MakeDomain( feasst.args({ "cubic_box_length": str(box_length), "init_cells": "3" })), # optionally attempt to create a cell list feasst.args({ "particle_type": feasst.install_dir() + '/forcefield/' + forcefield })) for _ in range(num): config.add_particle_of_type(0) return config
def system(config=None, box_length=8.109613, alphaL=6.870983963962610000, kmax_squared=38, rcut=4.891304347826090): if not config: config = feasst.Configuration( feasst.MakeDomain( feasst.args({"cubic_box_length": str(box_length)})), feasst.args({ "particle_type0": feasst.install_dir() + "/plugin/ewald/forcefield/data.rpm_plus", "particle_type1": feasst.install_dir() + "/plugin/ewald/forcefield/data.rpm_minus" })) config.set_model_param("cutoff", 0, rcut) config.set_model_param("cutoff", 1, rcut) system = feasst.System() system.add(config) system.add( feasst.Potential( feasst.MakeEwald( feasst.args({ "kmax_squared": str(kmax_squared), "alpha": str(alphaL / system.configuration().domain().min_side_length()) })))) # Unfortunatley, swig isn't accepting the below method of constructing a two body factory # system.add(feasst.Potential(feasst.MakeModelTwoBodyFactory( # feasst.ModelTwoBodyVector([feasst.MakeLennardJones(), feasst.MakeChargeScreened()])))) two = feasst.MakeModelTwoBodyFactory() two.add(feasst.MakeHardSphere()) two.add(feasst.MakeChargeScreened()) system.add(feasst.Potential(two)) system.add(feasst.Potential(feasst.MakeChargeSelf())) # system.precompute() return system
type=float, help="number of hours before restart", default=1.) args = parser.parse_args() print("args:", args) mc = fst.MonteCarlo() if args.task > 0: mc = fst.MakeMonteCarlo("checkpoint.fst") mc.attempt(args.trials - mc.trials().num_attempts()) quit() mc.set(fst.MakeRandomMT19937(fst.args({"seed": args.seed}))) mc.add( fst.Configuration( fst.MakeDomain( fst.args({ "cubic_box_length": str((args.num / args.density)**(1. / 3.)) })), fst.args({"particle_type": args.data}))) mc.add(fst.MakePotential(fst.MakeLennardJones())) mc.add(fst.MakePotential(fst.MakeLongRangeCorrections())) mc.set(fst.MakeThermoParams(fst.args({"beta": str(args.beta)}))) mc.set(fst.MakeMetropolis()) mc.add( fst.MakeTrialTranslate( fst.args({ "tunable_param": "0.2", "tunable_target_acceptance": "0.2" }))) mc.add(fst.MakeTrialAdd(fst.args({"particle_type": "0"}))) mc.run(fst.MakeRun(fst.args({"until_num_particles": str(args.num)}))) mc.run(fst.MakeRemoveTrial(fst.args({"name": "TrialAdd"})))
import feasst monte_carlo = feasst.MonteCarlo() monte_carlo.set(feasst.MakeRandomMT19937(feasst.args({"seed": "time"}))) monte_carlo.add( feasst.Configuration( feasst.MakeDomain(feasst.args({"cubic_box_length": "8"})), feasst.args( {"particle_type": feasst.install_dir() + "/forcefield/data.lj"}))) monte_carlo.add(feasst.Potential(feasst.MakeLennardJones())) monte_carlo.add(feasst.Potential(feasst.MakeLongRangeCorrections())) monte_carlo.add(feasst.MakeMetropolis(feasst.args({"beta": "1.5"}))) monte_carlo.add( feasst.MakeTrialTranslate( feasst.args({ "tunable_param": "2.", "tunable_target_acceptance": "0.2" }))) steps_per = int(1e3) monte_carlo.add(feasst.MakeTuner(feasst.args({"steps_per": str(steps_per)}))) feasst.SeekNumParticles(50)\ .with_metropolis(feasst.args({"beta": "0.1", "chemical_potential": "10"}))\ .with_trial_add().run(monte_carlo) monte_carlo.add(feasst.MakeLog(feasst.args({"steps_per": str(steps_per)}))) monte_carlo.add( feasst.MakeMovie( feasst.args({ "steps_per": str(steps_per), "file_name": "movie.xyz" }))) monte_carlo.add(