Slab, cylindrical, spherical and mixed confinement
[1]:
def shape(confinement):
if confinement == "slab":
shape = """Slab dimension 2 bound0 -1 bound1 1"""
elif confinement == "cylinder":
shape = """Cylinder radius 4 first_point f f0 0 f1 0 f2 0 \
second_point s s0 0 s1 0 s2 1"""
elif confinement == "sphere":
shape = """Sphere radius 4"""
elif confinement == "union":
shape = """Sphere radius 2.5
union Slab dimension 2 bound0 -1 bound1 1"""
elif confinement == "network":
shape = """Sphere radius 5
union Cylinder radius 2 first_point f f0 0 f1 0 f2 0 second_point s s0 1 s1 0 s2 0
union Cylinder radius 2 first_point f f0 0 f1 0 f2 0 second_point s s0 0 s1 1 s2 0
union Cylinder radius 2 first_point f f0 0 f1 0 f2 0 second_point s s0 0 s1 0 s2 1"""
else:
assert False # unrecognized
with open(confinement+'.txt', 'w') as file: file.write(shape)
for confinement in ["slab", "cylinder", "sphere", "union", "network"]:
shape(confinement)
params={"confinement": confinement, "cubic_side_length": 8, "num_particles": 50}
if confinement == 'network':
params["cubic_side_length"]=20
params["num_particles"]=500
script="""
MonteCarlo
Configuration cubic_side_length {cubic_side_length} particle_type0 /feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file {confinement}.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate weight 1 tunable_param 2
TrialAdd particle_type 0
Run until_num_particles {num_particles}
RemoveTrial name TrialAdd
Log trials_per_write 1e4 output_file {confinement}.log
Movie trials_per_write 1e4 output_file {confinement}.xyz
CheckEnergy trials_per_update 1e4
Tune
Run num_trials 1e5
""".format(**params)
with open('script.txt', 'w') as file: file.write(script)
import subprocess
syscode = subprocess.call("../../../build/bin/fst < script.txt > script.log", shell=True, executable='/bin/bash')
with open('script.log', 'r') as file: print(file.read(), '\n', 'exit:', syscode)
# FEASST version: v0.19.0-95-g62bcb048ca-dirty-user/newtutorials
Configuration cubic_side_length 8 particle_type0 /home/user/feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file slab.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate tunable_param 2 weight 1
TrialAdd particle_type 0
Run until_num_particles 50
# initializing random number generator with seed: 1653487009
RemoveTrial name TrialAdd
Log output_file slab.log trials_per 1e4
Movie output_file slab.xyz trials_per 1e4
CheckEnergy trials_per 1e4
Tune
Run num_trials 1e5
exit: 0
# FEASST version: v0.19.0-95-g62bcb048ca-dirty-user/newtutorials
Configuration cubic_side_length 8 particle_type0 /home/user/feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file cylinder.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate tunable_param 2 weight 1
TrialAdd particle_type 0
Run until_num_particles 50
# initializing random number generator with seed: 1653487010
RemoveTrial name TrialAdd
Log output_file cylinder.log trials_per 1e4
Movie output_file cylinder.xyz trials_per 1e4
CheckEnergy trials_per 1e4
Tune
Run num_trials 1e5
exit: 0
# FEASST version: v0.19.0-95-g62bcb048ca-dirty-user/newtutorials
Configuration cubic_side_length 8 particle_type0 /home/user/feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file sphere.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate tunable_param 2 weight 1
TrialAdd particle_type 0
Run until_num_particles 50
# initializing random number generator with seed: 1653487011
RemoveTrial name TrialAdd
Log output_file sphere.log trials_per 1e4
Movie output_file sphere.xyz trials_per 1e4
CheckEnergy trials_per 1e4
Tune
Run num_trials 1e5
exit: 0
# FEASST version: v0.19.0-95-g62bcb048ca-dirty-user/newtutorials
Configuration cubic_side_length 8 particle_type0 /home/user/feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file union.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate tunable_param 2 weight 1
TrialAdd particle_type 0
Run until_num_particles 50
# initializing random number generator with seed: 1653487012
RemoveTrial name TrialAdd
Log output_file union.log trials_per 1e4
Movie output_file union.xyz trials_per 1e4
CheckEnergy trials_per 1e4
Tune
Run num_trials 1e5
exit: 0
# FEASST version: v0.19.0-95-g62bcb048ca-dirty-user/newtutorials
Configuration cubic_side_length 20 particle_type0 /home/user/feasst/particle/lj.fstprt
Potential Model LennardJones
Potential VisitModel LongRangeCorrections
Potential Model ModelHardShape shape_file network.txt
ThermoParams beta 1.5 chemical_potential0 1
Metropolis
TrialTranslate tunable_param 2 weight 1
TrialAdd particle_type 0
Run until_num_particles 500
# initializing random number generator with seed: 1653487013
RemoveTrial name TrialAdd
Log output_file network.log trials_per 1e4
Movie output_file network.xyz trials_per 1e4
CheckEnergy trials_per 1e4
Tune
Run num_trials 1e5
exit: 0
Did this tutorial work as expected? Did you find any inconsistencies or have any comments? Please contact us. Any feedback is appreciated!