Skip to content
Snippets Groups Projects
Commit 9e9d9d5a authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

update bundled version of moltemplate to v1.40

parent 4b51719e
No related branches found
No related tags found
No related merge requests found
Showing
with 101 additions and 396 deletions
This is an example of how to use the OPLSAA force-field in LAMMPS
(using moltemplate.sh and Jason Lambert's oplsaa_moltemplate.py conversion tool)
This example also shows how to use moltemplate in combination with PACKMOL.
(PACKMOL is a useful program for generating atomic coordinates. In this example,
moltemplate.sh is only used to create the topology, force-field and charges,
and PACKMOL generates the coordinates, which moltemplate reads (in "step 1").
Moltemplate can also be used for generating atomic coordinates, especially
for mixing many small molecules together, as we do in this example. However
I wanted to demonstrate how to combine PACKMOL with moltemplate.sh.
In some other scenarios, such as protein solvation, PACKMOL does a much
better job than moltemplate.)
As of 2014-4-06, this code has not been tested for accuracy.
(See the WARNING.TXT file.)
step 1)
To build the files which LAMMPS needs, follow the instructions in:
README_setup.sh
step 2)
To run LAMMPS with these files, follow these instructions:
README_run.sh
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
This is an example of how to use the OPLSAA force-field in LAMMPS
(using moltemplate.sh and Jason Lambert's oplsaa_moltemplate.py conversion tool)
This example also shows how to use moltemplate in combination with PACKMOL.
(PACKMOL is a useful program for generating atomic coordinates. In this example,
moltemplate.sh is only used to create the topology, force-field and charges,
and PACKMOL generates the coordinates, which moltemplate reads (in "step 1").
Moltemplate can also be used for generating atomic coordinates, especially
for mixing many small molecules together, as we do in this example. However
I wanted to demonstrate how to combine PACKMOL with moltemplate.sh.
In some other scenarios, such as protein solvation, PACKMOL does a much
better job than moltemplate.)
As of 2014-12-19, this code has not been tested for accuracy.
(See the WARNING.TXT file.)
step 1)
To build the files which LAMMPS needs, follow the instructions in:
README_setup.sh
step 2)
To run LAMMPS with these files, follow these instructions:
README_run.sh
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create the coordinates of the atoms using PACKMOL
cd packmol_files
packmol < mix_ethylene+benzene.inp
mv -f system.xyz ../moltemplate_files/
cd ..
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh -xyz system.xyz system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
# --- Running LAMMPS ---
# -------- REQUIREMENTS: ---------
# 1) This example requires building LAMMPS with the "USER-MISC" package.
# (because it makes use of "gaff.lt" which uses dihedral_style fourier)
# To do this, type "make yes-user-misc" before compiling LAMMPS.
# http://lammps.sandia.gov/doc/Section_start.html#start_3
# -------- PREREQUISITES: --------
# The 2 files "run.in.npt", and "run.in.nvt" are LAMMPS
# input scripts which link to the input scripts and data files
# you hopefully have created earlier with moltemplate.sh:
# system.in.init, system.in.settings, system.data
# If not, carry out the instructions in "README_setup.sh".
#
# -- Instructions: --
# If "lmp_mpi" is the name of the command you use to invoke lammps,
# then you would run lammps on these files this way:
lmp_mpi -i run.in.npt # minimization and simulation at constant pressure
lmp_mpi -i run.in.nvt # minimization and simulation at constant volume
#(Note: The constant volume simulation lacks pressure equilibration. These are
# completely separate simulations. The results of the constant pressure
# simulation might be ignored when beginning the simulation at constant
# volume. (This is because restart files in LAMMPS don't always work,
# and I was spending a lot of time trying to convince people it was a
# LAMMPS bug, instead of a moltemplate bug, so I disabled restart files.)
# Read the "run.in.nvt" file to find out how to use the "read_restart"
# command to load the results of the pressure-equilibration simulation,
# before beginning a constant-volume run.
# If you have compiled the MPI version of lammps, you can run lammps in parallel
#mpirun -np 4 lmp_mpi -i run.in.npt
#mpirun -np 4 lmp_mpi -i run.in.nvt
# (assuming you have 4 processors available)
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
# --- Running LAMMPS ---
# -------- REQUIREMENTS: ---------
# 1) This example requires building LAMMPS with the "USER-MISC" package.
# (because it makes use of "gaff.lt" which uses dihedral_style fourier)
# To do this, type "make yes-user-misc" before compiling LAMMPS.
# http://lammps.sandia.gov/doc/Section_start.html#start_3
# -------- PREREQUISITES: --------
# The 2 files "run.in.npt", and "run.in.nvt" are LAMMPS
# input scripts which link to the input scripts and data files
# you hopefully have created earlier with moltemplate.sh:
# system.in.init, system.in.settings, system.data
# If not, carry out the instructions in "README_setup.sh".
#
# -- Instructions: --
# If "lmp_mpi" is the name of the command you use to invoke lammps,
# then you would run lammps on these files this way:
lmp_mpi -i run.in.npt # minimization and simulation at constant pressure
lmp_mpi -i run.in.nvt # minimization and simulation at constant volume
#(Note: The constant volume simulation lacks pressure equilibration. These are
# completely separate simulations. The results of the constant pressure
# simulation might be ignored when beginning the simulation at constant
# volume. (This is because restart files in LAMMPS don't always work,
# and I was spending a lot of time trying to convince people it was a
# LAMMPS bug, instead of a moltemplate bug, so I disabled restart files.)
# Read the "run.in.nvt" file to find out how to use the "read_restart"
# command to load the results of the pressure-equilibration simulation,
# before beginning a constant-volume run.
# If you have compiled the MPI version of lammps, you can run lammps in parallel
#mpirun -np 4 lmp_mpi -i run.in.npt
#mpirun -np 4 lmp_mpi -i run.in.nvt
# (assuming you have 4 processors available)
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
# Create the "oplsaa.lt" file which moltemplate will need
cd oplsaa_lt_generator/
oplsaa_moltemplate.py oplsaa_subset.prm
mv -f oplsaa.lt ..
cd ..
# run moltemplate
moltemplate.sh system.lt
# This will generate various files with names ending in *.in* and *.data.
# Move them to the directory where you plan to run LAMMPS (in this case "../")
mv -f system.data system.in* ../
# Optional:
# The "./output_ttree/" directory is full of temporary files generated by
# moltemplate. They can be useful for debugging, but are usually thrown away.
rm -rf output_ttree/
# Optional:
# Delete the "oplsaa.lt" file:
rm -f oplsaa.lt
cd ../
OPLSAA force-field conversion tools provided by Jason Lambert.
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create the coordinates of the atoms using PACKMOL
cd packmol_files
......
......@@ -24,7 +24,7 @@ write_once("In Init") {
write_once("Data Boundary") {
0.0 36.0 xlo xhi
0.0 36.0 ylo yhi
0.0 36.0 zlo zhi
-18.0 18.0 zlo zhi
}
......
# -- Init Section --
# THIS EXAMPLE HAS NOT BEEN RIGOROUSLY TESTED.
# (This simulation may fail.
# However the "run.in.nvt" example in this directory should work.)
#
# Requirements:
# To run this system at constant pressure, it might help to compile LAMMPS with
# the optional RIGID package, and use "fix rigid" on the carbon. (Optional.)
# The use of fix rigid is controversial. This method is demonstrated below.
# ------------------------------- Initialization Section --------------------
include system.in.init
# -- Atom Definition Section --
# ------------------------------- Atom Definition Section -------------------
read_data system.data
# -- Settings Section --
# ------------------------------- Settings Section --------------------------
include system.in.settings
# -- Run Section --
# ------------------------------- Run Section -------------------------------
timestep 1.0
dump 1 all custom 500 traj_npt.lammpstrj id mol type x y z ix iy iz
# Only the groupB atoms are immobile.
group mobile subtract all groupB
thermo_style custom step temp pe etotal press vol epair ebond eangle edihed
thermo 500 # time interval for printing out "thermo" data
# Unfortunately you can not use the LAMMPS "minimize" command on this system
# because there is no way to immobilize the wall atoms during minimization.
# Instead, we can use langevin dynamics with a fast
# damping parameter and a small timestep.
print "--------- beginning minimization (using fix langevin) ---------"
velocity groupB zero angular
velocity groupB zero linear
# (I'm not sure if the two lines above are necessary, but they don't hurt.)
timestep 0.1
fix fxlan mobile langevin 1.0 1.0 100.0 48279
fix fxnve mobile nve # <-- needed by fix langevin (see lammps documentation)
thermo 100
run 2500
# Only the groupB atoms are immobile.
unfix fxlan
unfix fxnve
group mobile subtract all groupB
# -- simulation protocol --
# ------------------------- NPT ---------------------------
print "--------- beginning simulation (using fix nvt) ---------"
dump 1 all custom 1000 traj_npt.lammpstrj id mol type x y z ix iy iz
thermo_style custom step temp pe etotal press vol epair ebond eangle edihed
thermo 200 # time interval for printing out "thermo" data
# Set temp=300K, pressure=500bar, and equilibrate volume only in the z direction
fix fMoveStuff mobile npt temp 300 300 100 z 500 500 1000.0 dilate mobile
# ------------------------- NPT ---------------------------
# ------ QUESTIONABLE (see below): ------
fix Ffreezestuff groupB rigid/npt single temp 300 300 100 z 500 500 1000.0 force * off off off torque * off off off dilate mobile
fix Ffreezestuff groupB rigid single force * off off off torque * off off off
# -- Alternate npt rigid method --
# I'm not sure which way is more correct, however
# this also seems to behave in a reasonable-looking way:
#fix Ffreezestuff groupB rigid single force * off off off torque * off off off dilate mobile
#
# The use of either "fix rigid" or "fix rigid/npt" to immobilize
# an object is somewhat controversial. Feel free to omit it.
#(Neither Trung or Steve Plimpton use rigid or rigid/npt for immobilizing
#molecules, but I noticed that at NPT, it does a better job of maintaining
# the correct volume. However "fix rigid" has changed since then (2011),
# so this may no longer be true. Please use this example with caution.)
# ----------------------------------------
# Comment:
# The use of "fix rigid" to immobilize an object is somewhat controversial.
# Feel free to omit it.
# (Neither Trung or Steve Plimpton use fix rigid for immobilizing
# molecules, but I noticed that at NPT, it does a better job of maintaining
# the correct volume. However "fix rigid" has changed since then (2011),
# so this may no longer be true. Please use this example with caution.)
# Thermostat+Barostat
# Set temp=300K, pressure=200bar, and equilibrate volume only in the z direction
# IMPORTANT for NPT: You must use "neigh_modify" to turn off calculation of the
# forces between immobilized atoms.
neigh_modify exclude group groupB groupB
fix fxMoveStuff mobile npt temp 300 300 100 z 200 200 1000.0 dilate mobile drag 2.0
# The next two lines recalculate the temperature
# using only the mobile degrees of freedom:
# ----------------------------------------
# The next two lines recalculate the temperature using
# only the mobile degrees of freedom (ie. water atom velocities):
compute tempMobile mobile temp
compute pressMobile all pressure tempMobile
thermo_style custom step c_tempMobile c_pressMobile temp press vol
fix_modify fMoveStuff temp tempMobile
fix_modify fxMoveStuff temp tempMobile
reset_timestep 0
timestep 0.5
run 100000
timestep 1.0
run 100000
run 60000
write_data system_after_npt.data
# (The "write_restart" and "read_restart" commands were buggy in 2012,
# but they should work also.)
# ----- Comment: Avoid using fix rigid/npt on large single rigid objects -----
#
# Use of the following is not recommended:
#
# fix Ffreezestuff groupB rigid/npt single temp 300 300 100 z 200 200 1000.0 force * off off off torque * off off off dilate mobile
# (temp=300K, pressure=200bar, and equilibrate volume only in the z direction)
#
# In my experience, the system becomes unstable when applying "fix rigid/npt"
# to the immobile atoms, while also applying "fix npt" on the solvent atoms.
# (It is probably a bad idea to use two barostats simultaneously.)
# ----------------------------------------------------------------------------
......@@ -16,6 +16,10 @@ read_data system.data
include system.in.settings
# Use "neigh_modify" to turn off calculation of interactions between immobilized
# atoms. (Note: The "groupB" group was defined in the file "system.insettings")
neigh_modify exclude group groupB groupB
# -- Run Section --
......
This example shows how to build a box of benzene molecules using the
AMBER/GAFF force-field.
step 1)
To build the files which LAMMPS needs, follow the instructions in:
README_setup.sh
step 2)
To run LAMMPS with these files, follow these instructions:
README_run.sh
# -------- REQUIREMENTS: ---------
# You must define your MOLTEMPLATE_PATH environment variable
# and set it to the "common" subdirectory of your moltemplate distribution.
# (See the "Installation" section in the moltemplate manual.)
# Create LAMMPS input files this way:
cd moltemplate_files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment