def monte_carlo( proc=0, # processor number criteria=criteria_flathist(), # flat histogram criteria steps_per=1e5, # steps per analysis system=lj_system.system( lj_system.configuration(box_length=8, forcefield="data.lj")), run=True # run the simulation ): """Create, run and return a flat histogram grand canonical Monte Carlo simulation""" monte_carlo0 = fst.MonteCarlo() monte_carlo0.set(system) # add the minimum number of particles monte_carlo0.set( fst.MakeMetropolis(fst.args({ "beta": "0.1", "chemical_potential": "1" }))) monte_carlo0.add( fst.MakeTrialTranslate( fst.args({ "weight": "0.375", "tunable_param": "2." }))) if monte_carlo0.system().configuration().particle_type(0).num_sites() > 1: monte_carlo0.add( fst.MakeTrialRotate( fst.args({ "weight": "0.375", "tunable_param": "2." }))) fst.add_trial_transfer(monte_carlo0, fst.args({ "weight": "0.125", "particle_type": "0" })) min_macro = int(criteria.macrostate().histogram().center_of_bin(0)) # print("seeking", min_macro) fst.SeekNumParticles(min_macro).run(monte_carlo0) # replace the acceptance criteria with flat histogram monte_carlo0.set(criteria) analyze.add(monte_carlo0, steps_per, proc=proc, log="log" + str(proc) + ".txt") # periodically write the status of the flat histogram criteria monte_carlo0.add( fst.MakeCriteriaUpdater(fst.args({"steps_per": str(steps_per)}))) monte_carlo0.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": str(steps_per), "file_name": "crit" + str(proc) + ".txt" }))) # periodically write a checkpoint file monte_carlo0.add( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(proc) + ".txt", "num_hours": "0.01" }))) # periodically write the energy of the macrostates monte_carlo0.add( fst.MakeEnergy( fst.args({ "file_name": "energy" + str(proc) + ".txt", "steps_per_update": "1", "steps_per_write": str(steps_per), "multistate": "true" }))) if run: monte_carlo0.run_until_complete() #print(monte_carlo0.criteria().write()) return monte_carlo0
def mc(thread, mn, mx, trials_per=str(int(1e6))): mc = fst.MakeMonteCarlo() mc.add(config()) mc.add(fst.MakePotential(fst.MakeLennardJonesForceShift())) mc.set( fst.MakeThermoParams( fst.args({ "beta": str(1. / args.temperature), "chemical_potential": str(args.mu) }))) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), # fst.MakeTransitionMatrix(fst.args({"min_sweeps": str(args.min_sweeps)})), fst.MakeWLTM( fst.args({ "collect_flatness": "18", "min_flatness": "22", "min_sweeps": str(args.min_sweeps) })))) mc.add( fst.MakeTrialTranslate( fst.args({ "weight": "1.", "tunable_param": "1." }))) mc.add( fst.MakeTrialRotate(fst.args({ "weight": "1.", "tunable_param": "20." }))) mc.add( fst.MakeTrialTransfer(fst.args({ "weight": "4", "particle_type": "0" }))) mc.add( fst.MakeCheckEnergy( fst.args({ "trials_per": trials_per, "tolerance": "0.0001" }))) mc.add(fst.MakeTune(fst.args({"stop_after_phase": "0"}))) mc.add( fst.MakeLogAndMovie( fst.args({ "trials_per": trials_per, "file_name": "clones" + str(thread), "file_name_append_phase": "True" }))) mc.add( fst.MakeEnergy( fst.args({ "trials_per_write": trials_per, "file_name": "en" + str(thread) + ".txt", "file_name_append_phase": "True", "start_after_phase": "0", "multistate": "True" }))) mc.add(fst.MakeCriteriaUpdater(fst.args({"trials_per": trials_per}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "trials_per": trials_per, "file_name": "clones" + str(thread) + "_crit.txt", "file_name_append_phase": "True" }))) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours": str(0.1 * args.num_procs * args.num_hours), "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc
def mc(thread, mn, mx): mc = fst.MakeMonteCarlo() mc.set(fst.MakeRandomMT19937(fst.args({"seed": "123"}))) mc.add( fst.MakeConfiguration( fst.args({ "side_length0": str(args.lx), "side_length1": str(args.ly), "side_length2": str(args.lz), "particle_type0": args.particle }))) for site_type in range(mc.configuration().num_site_types()): mc.get_system().get_configuration().set_model_param( "cutoff", site_type, args.cutoff) mc.add(fst.MakePotential(fst.MakeLennardJones())) mc.add( fst.MakePotential(fst.MakeLennardJones(), fst.MakeVisitModelIntra(fst.args({"cutoff": "4"})))) mc.add(fst.MakePotential(fst.MakeLongRangeCorrections())) if mx > args.dccb_begin: reference = fst.Potential( fst.MakeLennardJones(), fst.MakeVisitModelCell( fst.args({"min_length": str(args.dccb_cutoff)}))) reference.set_model_params(mc.configuration()) for site_type in range(mc.configuration().num_site_types()): reference.set_model_param("cutoff", site_type, args.dccb_cutoff) mc.add_to_reference(reference) #mc.add_to_reference(fst.MakePotential(fst.MakeLennardJones(), # fst.MakeVisitModelIntra(fst.args({"cutoff": "4"})))) stage_args = {"reference_index": "0", "num_steps": "4"} else: mc.add_to_reference(fst.MakePotential(fst.DontVisitModel())) stage_args = {"reference_index": "0", "num_steps": "1"} beta = 1. / fst.kelvin2kJpermol(args.temperature) mc.set( fst.MakeThermoParams( fst.args({ "beta": str(beta), "chemical_potential0": str(args.beta_mu / beta) }))) mc.set(fst.MakeMetropolis()) mc.add(fst.MakeTrialTranslate(fst.args({"weight": "0.5"}))) mc.add(fst.MakeTrialRotate(fst.args({"weight": "0.5"}))) print('thread', thread, 'mn', mn, 'mx', mx) if thread == 0 and mn > 0: mc.add(fst.MakeTrialAdd(fst.args({"particle_type": "0"}))) mc.run(fst.MakeRun(fst.args({"until_num_particles": str(mn)}))) mc.run(fst.RemoveTrial(fst.args({"name": "TrialAdd"}))) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), # fst.MakeTransitionMatrix(fst.args({"min_sweeps": str(args.sweeps)})), fst.MakeWLTM( fst.args({ "collect_flatness": str(args.collect_flatness), "min_flatness": str(args.min_flatness), "min_sweeps": "1000" })))) # configurational bias with TrialGrow: full and partial regrows from 0-site, and reverse num_sites = mc.configuration().particle_type(0).num_sites() for site in range(num_sites): for g in gen_grow(num_sites, reptate=False): mc.add( fst.MakeTrialGrow( fst.ArgsVector(add_particle_type_weight( site, num_sites, g)), fst.args(stage_args))) # reptation if num_sites > 3: for g in gen_grow(num_sites, reptate=True): mc.add( fst.MakeTrialGrow( fst.ArgsVector(add_particle_type_weight(0, num_sites, g)), fst.args(stage_args))) # these moves may not take bond energies into consideration properly. Instead, should implement a dihedral rotation. #mc.add(fst.MakeTrialCrankshaft(fst.args(dict({"weight": "0.25", "tunable_param": "25.", "max_length": "5."}, **stage_args)))) #mc.add(fst.MakeTrialPivot(fst.args(dict({"weight": "0.25", "tunable_param": "25.", "max_length": "5."}, **stage_args)))) mc.add( fst.MakeCheckEnergy( fst.args({ "steps_per": str(args.steps_per), "tolerance": "0.0001" }))) mc.add( fst.MakeTune( fst.args({ "steps_per": str(args.steps_per), "stop_after_phase": "0" }))) mc.add( fst.MakeLogAndMovie( fst.args({ "steps_per": str(args.steps_per), "file_name": "clones" + str(thread), "file_name_append_phase": "True" }))) mc.add( fst.MakeEnergy( fst.args({ "file_name": "en" + str(thread) + '.txt', "file_name_append_phase": "True", "start_after_phase": "0", "steps_per_write": str(args.steps_per), "steps_per_update": "1", "multistate": "True" }))) mc.add( fst.MakeCriteriaUpdater(fst.args({"steps_per": str(args.steps_per)}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": str(args.steps_per), "file_name": "clones" + str(thread) + "_crit.txt", "file_name_append_phase": "True" }))) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc
def mc(thread, mn, mx): steps_per = int(1e5) avb, dccb = avb_or_dccb(mx) mc = fst.MakeMonteCarlo() mc.add( fst.MakeConfiguration( fst.args({ "cubic_box_length": "20", "physical_constants": "CODATA2010", "particle_type0": fst.install_dir() + "/forcefield/spce.fstprt" }))) mc.add( fst.MakePotential( fst.MakeEwald( fst.args({ "alpha": str(5.6 / 20), "kmax_squared": "38" })))) mc.add( fst.MakePotential( fst.MakeModelTwoBodyFactory(fst.MakeLennardJones(), fst.MakeChargeScreened()), fst.args({"table_size": "1e6"}))) mc.add( fst.MakePotential(fst.MakeChargeScreenedIntra(), fst.MakeVisitModelBond())) mc.add(fst.MakePotential(fst.MakeChargeSelf())) mc.add(fst.MakePotential(fst.MakeLongRangeCorrections())) if dccb or avb: mc.run( fst.MakeAddReference( fst.args({ "potential_index": "1", "cutoff": "3.16555789", "use_cell": "true" }))) if avb: initialize_neighbor_list(mc) beta = 1. / fst.kelvin2kJpermol(525, mc.configuration()) mc.set( fst.MakeThermoParams( fst.args({ "beta": str(beta), "chemical_potential": str(-8.14 / beta) }))) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), fst.MakeTransitionMatrix(fst.args({"min_sweeps": "10"})))) mc.add( fst.MakeTrialTranslate( fst.args({ "weight": "1.", "tunable_param": "1.", }))) mc.add( fst.MakeTrialRotate(fst.args({ "weight": "1.", "tunable_param": "1." }))) mc.add( fst.MakeTrialTransfer(fst.args({ "particle_type": "0", "weight": "4" }))) regrow1 = [{ "angle": "true", "mobile_site": "1", "anchor_site": "0", "anchor_site2": "2" }] regrow2 = [{ "angle": "true", "mobile_site": "2", "anchor_site": "0", "anchor_site2": "1" }] regrow12 = [{ "bond": "true", "mobile_site": "1", "anchor_site": "0" }] + copy.deepcopy(regrow2) regrow21 = [{ "bond": "true", "mobile_site": "2", "anchor_site": "0" }] + copy.deepcopy(regrow1) if dccb: grow012 = [{ "transfer": "true", "site": "0", "weight": "4" }] + copy.deepcopy(regrow12) grow021 = [{ "transfer": "true", "site": "0", "weight": "4" }] + copy.deepcopy(regrow21) for grow in [regrow1, regrow2]: grow[0]["weight"] = "0.3" for grow in [regrow12, regrow21]: grow[0]["weight"] = "0.2" for grow in [grow012, grow021, regrow12, regrow21, regrow1, regrow2]: grow[0]["particle_type"] = "0" mc.add( fst.MakeTrialGrow( fst.ArgsVector(grow), fst.args({ "reference_index": "0", "num_steps": "4" }))) if avb: for avbtype in ["transfer_avb", "regrow_avb2", "regrow_avb4"]: avb = [{ avbtype: "true", "site": "0", "neighbor_index": "0", "target_particle_type": "0", "target_site": "0" }] avb_012 = copy.deepcopy(avb) + copy.deepcopy(regrow12) avb_021 = copy.deepcopy(avb) + copy.deepcopy(regrow21) for grow in [avb_012, avb_021]: grow[0]["weight"] = "0.5" grow[0]["particle_type"] = "0" mc.add( fst.MakeTrialGrow( fst.ArgsVector(grow), fst.args({ "num_steps": "4", "reference_index": "0" }))) mc.add( fst.MakeCheckEnergyAndTune( fst.args({ "steps_per": str(steps_per), "tolerance": "0.0001" }))) mc.add( fst.MakeLogAndMovie( fst.args({ "steps_per": str(steps_per), "file_name": "clones" + str(thread) }))) mc.add(fst.MakeCriteriaUpdater(fst.args({"steps_per": str(steps_per)}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": str(steps_per), "file_name": "clones" + str(thread) + "_crit.txt" }))) mc.add( fst.MakeEnergy( fst.args({ "steps_per_write": str(steps_per), "file_name": "en" + str(thread), "multistate": "true" }))) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc
def mc(thread, mn, mx): mc = fst.MakeMonteCarlo() #mc.set(fst.MakeRandomMT19937(fst.args({"seed": "123"}))) mc.add( fst.MakeConfiguration( fst.args({ "cubic_box_length": str(args.cubic_box_length), "physical_constants": "CODATA2010", "particle_type0": args.molecule }))) mc.add( fst.MakePotential( fst.MakeEwald( fst.args({ "alpha": str(5.6 / args.cubic_box_length), "kmax_squared": "38" })))) mc.add( fst.MakePotential( fst.MakeModelTwoBodyFactory(fst.MakeLennardJones(), fst.MakeChargeScreened()), fst.args({"table_size": "1e6"}))) mc.add( fst.MakePotential(fst.MakeChargeScreenedIntra(), fst.MakeVisitModelBond())) mc.add(fst.MakePotential(fst.MakeChargeSelf())) mc.add(fst.MakePotential(fst.MakeLongRangeCorrections())) if mx > args.dccb_begin: mc.run( fst.MakeAddReference( fst.args({ "potential_index": "1", "cutoff": "3.16555789", "use_cell": "true" }))) beta = 1. / fst.kelvin2kJpermol(args.temperature, mc.configuration()) mc.set( fst.MakeThermoParams( fst.args({ "beta": str(beta), "chemical_potential": str(args.beta_mu / beta) }))) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), fst.MakeTransitionMatrix(fst.args({"min_sweeps": "10"})))) mc.add( fst.MakeTrialTranslate( fst.args({ "weight": "1.", "tunable_param": "1.", }))) if mx > args.dccb_begin: regrow1 = [{ "angle": "true", "mobile_site": "1", "anchor_site": "0", "anchor_site2": "2" }] regrow2 = [{ "angle": "true", "mobile_site": "2", "anchor_site": "0", "anchor_site2": "1" }] regrow12 = [{ "bond": "true", "mobile_site": "1", "anchor_site": "0" }] + copy.deepcopy(regrow2) regrow21 = [{ "bond": "true", "mobile_site": "2", "anchor_site": "0" }] + copy.deepcopy(regrow1) grow012 = [{ "transfer": "true", "site": "0", "weight": "4" }] + copy.deepcopy(regrow12) grow021 = [{ "transfer": "true", "site": "0", "weight": "4" }] + copy.deepcopy(regrow21) for grow in [regrow1, regrow2]: grow[0]["weight"] = "0.3" for grow in [regrow12, regrow21]: grow[0]["weight"] = "0.2" for grow in [grow012, grow021, regrow12, regrow21, regrow1, regrow2]: grow[0]["particle_type"] = "0" mc.add( fst.MakeTrialGrow( fst.ArgsVector(grow), fst.args({ "reference_index": "0", "num_steps": "4" }))) else: mc.add( fst.MakeTrialRotate( fst.args({ "weight": "1.", "tunable_param": "1." }))) mc.add( fst.MakeTrialTransfer( fst.args({ "particle_type": "0", "weight": "4" }))) mc.add( fst.MakeCheckEnergyAndTune( fst.args({ "steps_per": str(args.steps_per), "tolerance": "0.0001" }))) mc.add( fst.MakeLogAndMovie( fst.args({ "steps_per": str(args.steps_per), "file_name": "clones" + str(thread) }))) mc.add( fst.MakeCriteriaUpdater(fst.args({"steps_per": str(args.steps_per)}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": str(args.steps_per), "file_name": "clones" + str(thread) + "_crit.txt" }))) mc.add( fst.MakeEnergy( fst.args({ "steps_per_write": str(args.steps_per), "file_name": "en" + str(thread), "multistate": "true" }))) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc
def mc(thread, mn, mx): steps_per = str(int(1e5)) mc = fst.MakeMonteCarlo() #mc.set(fst.MakeRandomMT19937(fst.args({"seed": "12345"}))) #mc.set(fst.MakeRandomMT19937(fst.args({"seed": "1634926410"}))) chi = 0.7 # patch coverage patch_angle = 2 * math.asin(math.sqrt(chi / 2)) * 180 / math.pi print('patch_angle', patch_angle) mc = fst.MonteCarlo() config = fst.MakeConfiguration( fst.args({ "cubic_box_length": "8", "particle_type0": fst.install_dir() + "/plugin/patch/forcefield/two_patch_linear.fstprt" })) config.add(fst.MakeGroup(fst.args({"site_type0": "0"}))) mc.add(config) mc.add( fst.MakePotential( fst.MakeHardSphere(), fst.MakeVisitModelCell( fst.args({ "min_length": "1", "cell_group": "1" })), fst.args({"group_index": "1"}))) patch = fst.MakeVisitModelInnerPatch( fst.args({"patch_degrees_of_type1": str(patch_angle)})) mc.add( fst.MakePotential( fst.MakeSquareWell(), fst.MakeVisitModel(patch), #fst.MakeVisitModelCell(patch, fst.args({"min_length": "1.5", "cell_group": "1"})), fst.args({"group_index": "1"}))) mc.set( fst.MakeThermoParams( fst.args({ "beta": str(1. / args.temperature), "chemical_potential": str(args.mu) }))) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), # fst.MakeTransitionMatrix(fst.args({"min_sweeps": str(args.min_sweeps)})), fst.MakeWLTM( fst.args({ "collect_flatness": "18", "min_flatness": "22", "min_sweeps": str(args.min_sweeps) })))) mc.add( fst.MakeTrialTranslate( fst.args({ "weight": "0.5", "tunable_param": "0.1" }))) mc.add( fst.MakeTrialRotate(fst.args({ "weight": "0.5", "tunable_param": "20." }))) mc.add( fst.MakeTrialTransfer(fst.args({ "weight": "4", "particle_type": "0" }))) # mc.add(fst.MakeTrialGrow(fst.ArgsVector([{"translate": "true", "site": "0", "tunable_param": "1"}]), # {"reference_index": ref, "num_steps": num_steps})) # mc.add(fst.MakeTrialGrow(fst.ArgsVector([{"transfer": "true", "site": "0", "weight": "4"}]), # {"reference_index": ref, "num_steps": num_steps})) mc.add( fst.MakeCheckEnergy( fst.args({ "steps_per": steps_per, "tolerance": "0.0001" }))) mc.add( fst.MakeTune( fst.args({ "steps_per": steps_per, "stop_after_phase": "0" }))) mc.add( fst.MakeLog( fst.args({ "steps_per": steps_per, "file_name": "clones" + str(thread) + ".txt", "file_name_append_phase": "True" }))) mc.add( fst.MakeMoviePatch( fst.args({ "steps_per": steps_per, "file_name": "clones" + str(thread) + ".xyz", "file_name_append_phase": "True" }))) mc.add( fst.MakeEnergy( fst.args({ "steps_per_write": steps_per, "file_name": "en" + str(thread) + ".txt", "file_name_append_phase": "True", "start_after_phase": "0", "multistate": "True" }))) mc.add(fst.MakeCriteriaUpdater(fst.args({"steps_per": steps_per}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": steps_per, "file_name": "clones" + str(thread) + "_crit.txt", "file_name_append_phase": "True" }))) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours": str(0.1 * args.num_procs * args.num_hours), "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc
def mc(thread, mn, mx): steps_per = int(1e4) mc = fst.MakeMonteCarlo() if mx > args.dccb_begin: ref = "0" num = "4" else: ref = "-1" num = "1" config_args = dict() index = 0 thermo_params = {"beta": str(1. / args.temperature)} for part in args.particles: config_args["particle_type" + str(index)] = part thermo_params["chemical_potential" + str(index)] = str( args.beta_mu * args.temperature) index += 1 thermo_params["chemical_potential0"] = str( (args.delta_betamu_0 + args.beta_mu) * args.temperature) mc.add( fst.MakeConfiguration( fst.args( dict( { "side_length0": str(args.lx), "side_length1": str(args.ly), "side_length2": str(args.lz) }, **config_args)))) mc.add(fst.MakePotential(fst.MakeLennardJones())) mc.add(fst.MakePotential(fst.MakeLongRangeCorrections())) if mx > args.dccb_begin: reference = fst.Potential( fst.MakeLennardJones(), fst.MakeVisitModelCell( fst.args({"min_length": str(args.dccb_cutoff)}))) reference.set_model_params(mc.configuration()) for site_type in range(mc.configuration().num_site_types()): reference.set_model_param("cutoff", site_type, args.dccb_cutoff) mc.add_to_reference(reference) mc.set(fst.MakeThermoParams(thermo_params)) mc.set( fst.MakeFlatHistogram( fst.MakeMacrostateNumParticles( fst.Histogram( fst.args({ "width": "1", "max": str(mx), "min": str(mn) }))), # fst.MakeTransitionMatrix(fst.args({"min_sweeps": str(args.sweeps)})), fst.MakeWLTM( fst.args({ "collect_flatness": str(args.collect_flatness), "min_flatness": str(args.min_flatness), "min_sweeps": "1000" })))) for particle_type in range(mc.configuration().num_particle_types()): mc.add( fst.MakeTrialTranslate( fst.args({ "particle_type": str(particle_type), "weight": "1.", "tunable_param": "1." }))) if mx > args.dccb_begin and mc.configuration().particle_type( particle_type).num_sites() == 2: mc.add( fst.MakeTrialGrow( fst.ArgsVector([ { "transfer": "true", # "regrow": "true", # regrow isn't very efficient "particle_type": str(particle_type), "site": "0", "weight": "4" }, { "bond": "true", "mobile_site": "1", "anchor_site": "0" } ]), fst.args({ "reference_index": ref, "num_steps": num }))) mc.add( fst.MakeTrialGrow( fst.ArgsVector([{ "particle_type": str(particle_type), "weight": "0.5", "bond": "true", "mobile_site": "1", "anchor_site": "0", "reference_index": ref, "num_steps": num }]))) mc.add( fst.MakeTrialGrow( fst.ArgsVector([{ "particle_type": str(particle_type), "weight": "0.5", "bond": "true", "mobile_site": "0", "anchor_site": "1", "reference_index": ref, "num_steps": num }]))) else: mc.add( fst.MakeTrialRotate( fst.args({ "particle_type": str(particle_type), "weight": "1.", "tunable_param": "1." }))) mc.add( fst.MakeTrialTransfer( fst.args({ "particle_type": str(particle_type), "weight": "4" }))) mc.add( fst.MakeCheckEnergy( fst.args({ "steps_per": str(steps_per), "tolerance": "0.0001" }))) mc.add( fst.MakeTune( fst.args({ "steps_per": str(steps_per), "stop_after_phase": "0" }))) mc.add( fst.MakeLogAndMovie( fst.args({ "steps_per": str(steps_per), "file_name": "clones" + str(thread), "file_name_append_phase": "True" }))) mc.add( fst.MakeEnergy( fst.args({ "file_name": "en" + str(thread) + '.txt', "file_name_append_phase": "True", "start_after_phase": "0", "steps_per_write": str(steps_per), "steps_per_update": "1", "multistate": "True" }))) if mc.configuration().num_particle_types() > 1: mc.add( fst.MakeNumParticles( fst.args({ "particle_type": "0", "file_name": "num" + str(thread) + '.txt', "file_name_append_phase": "True", "start_after_phase": "0", "steps_per_write": str(steps_per), "steps_per_update": "1", "multistate": "True" }))) mc.add( fst.MakeExtensiveMoments( fst.args({ "steps_per_write": str(steps_per), "file_name": "extmom" + str(thread) + ".txt", "file_name_append_phase": "True", "start_after_phase": "0", # do not update until equilibration complete (phase 1) "max_order": "3", "multistate": "True" }))) mc.add(fst.MakeCriteriaUpdater(fst.args({"steps_per": str(steps_per)}))) mc.add( fst.MakeCriteriaWriter( fst.args({ "steps_per": str(steps_per), "file_name": "clones" + str(thread) + "_crit.txt", "file_name_append_phase": "True" }))) print(0.9 * args.num_procs * args.num_hours) mc.set( fst.MakeCheckpoint( fst.args({ "file_name": "checkpoint" + str(thread) + ".fst", "num_hours_terminate": str(0.9 * args.num_procs * args.num_hours) }))) return mc