mdpow.equil
— Setting up and running equilibrium MD¶
The mdpow.equil
module facilitates the setup of equilibrium
molecular dynamics simulations of a compound molecule in a simulation
box of water or other solvent such as octanol.
It requires as input
- the itp file for the compound
- a coordinate (structure) file (in pdb or gro format)
By default it uses the OPLS/AA forcefield and the TIP4P water model.
Warning
Other forcefields than OPLS/AA are currently not officially supported; it is not hard to do but requires tedious changes to a few paths in template scripts.
-
class
mdpow.equil.
Simulation
(molecule=None, **kwargs)¶ Simple MD simulation of a single compound molecule in water.
Typical use
S = Simulation(molecule='DRUG') S.topology(itp='drug.itp') S.solvate(struct='DRUG-H.pdb') S.energy_minimize() S.MD_relaxed() S.MD()
Note
The OPLS/AA force field and the TIP4P water molecule is the default; changing this is possible but will require provision of customized itp, mdp and template top files at various stages.
Set up Simulation instance.
The molecule of the compound molecule should be supplied. Existing files (which have been generated in previous runs) can also be supplied.
Keywords: - molecule
Identifier for the compound molecule. This is the same as the entry in the
[ molecule ]
section of the itp file. [“DRUG”]- filename
If provided and molecule is
None
then load the instance from the pickle file filename, which was generated withsave()
.- dirname
base directory; all other directories are created under it
- solvent
‘water’ or ‘octanol’ or ‘cyclohexane’
- solventmodel
None
chooses the default (e.g,mdpow.forcefields.DEFAULT_WATER_MODEL
forsolvent == "water"
. Other options are the models defined inmdpow.forcefields.GROMACS_WATER_MODELS
. At the moment, there are no alternative parameterizations included for other solvents.- mdp
dict with keys corresponding to the stages
energy_minimize
,MD_restrained
,MD_relaxed
,MD_NPT
and values mdp file names (if no entry then the package defaults are used)- kwargs
advanced keywords for short-circuiting; see
mdpow.equil.Simulation.filekeys
.
-
MD
(**kwargs)¶ Short NPT MD simulation.
See documentation of
gromacs.setup.MD()
for details such as runtime or specific queuing system options. The following keywords can not be changed: top, mdp, ndx, mainselection.Note
If the system crashes (with LINCS errors), try initial equilibration with timestep dt = 0.0001 ps (0.1 fs instead of 2 fs) and runtime = 5 ps as done in
MD_relaxed()
Keywords: - struct
starting conformation; by default, the struct is the last frame from the position restraints run, or, if this file cannot be found (e.g. because
Simulation.MD_restrained()
was not run) it falls back to the relaxed and then the solvated system.- mdp
MDP run parameter file for Gromacs
- runtime
total run time in ps
- qscript
list of queuing system scripts to prepare; available values are in
gromacs.config.templates
or you can provide your own filename(s) in the current directory (seegromacs.qsub
for the format of the templates)- qname
name of the job as shown in the queuing system
- startdir
advanced uses: path of the directory on a remote system, which will be hard-coded into the queuing system script(s); see
gromacs.setup.MD()
andgromacs.manager.Manager
-
MD_NPT
(**kwargs)¶ Short NPT MD simulation.
See documentation of
gromacs.setup.MD()
for details such as runtime or specific queuing system options. The following keywords can not be changed: top, mdp, ndx, mainselection.Note
If the system crashes (with LINCS errors), try initial equilibration with timestep dt = 0.0001 ps (0.1 fs instead of 2 fs) and runtime = 5 ps as done in
MD_relaxed()
Keywords: - struct
starting conformation; by default, the struct is the last frame from the position restraints run, or, if this file cannot be found (e.g. because
Simulation.MD_restrained()
was not run) it falls back to the relaxed and then the solvated system.- mdp
MDP run parameter file for Gromacs
- runtime
total run time in ps
- qscript
list of queuing system scripts to prepare; available values are in
gromacs.config.templates
or you can provide your own filename(s) in the current directory (seegromacs.qsub
for the format of the templates)- qname
name of the job as shown in the queuing system
- startdir
advanced uses: path of the directory on a remote system, which will be hard-coded into the queuing system script(s); see
gromacs.setup.MD()
andgromacs.manager.Manager
-
MD_relaxed
(**kwargs)¶ Short MD simulation with timestep = 0.1 fs to relax strain.
Energy minimization does not always remove all problems and LINCS constraint errors occur. A very short runtime = 5 ps MD with very short integration time step dt tends to solve these problems.
Keywords: - struct
starting coordinates (typically guessed)
- mdp
MDP run parameter file for Gromacs
- qscript
list of queuing system submission scripts; probably a good idea to always include the default “local.sh” even if you have your own [“local.sh”]
- qname
name of the job as shown in the queuing system
- startdir
advanced uses: path of the directory on a remote system, which will be hard-coded into the queuing system script(s); see
gromacs.setup.MD()
andgromacs.manager.Manager
-
MD_restrained
(**kwargs)¶ Short MD simulation with position restraints on compound.
See documentation of
gromacs.setup.MD_restrained()
for details. The following keywords can not be changed: top, mdp, ndx, mainselectionNote
Position restraints are activated with
-DPOSRES
directives forgromacs.grompp()
. Hence this will only work if the compound itp file does indeed contain a[ posres ]
section that is protected by a#ifdef POSRES
clause.Keywords: - struct
starting coordinates (leave empty for inspired guess of file name)
- mdp
MDP run parameter file for Gromacs
- qscript
list of queuing system submission scripts; probably a good idea to always include the default “local.sh” even if you have your own [“local.sh”]
- qname
name of the job as shown in the queuing system
- startdir
advanced uses: path of the directory on a remote system, which will be hard-coded into the queuing system script(s); see
gromacs.setup.MD()
andgromacs.manager.Manager
-
energy_minimize
(**kwargs)¶ Energy minimize the solvated structure on the local machine.
kwargs are passed to
gromacs.setup.energ_minimize()
but ifsolvate()
step has been carried out previously all the defaults should just work.
-
get_last_checkpoint
()¶ Returns the checkpoint of the most advanced step in the protocol. Relies on md.gro being present from previous simulation, assumes that checkpoint is then present.
-
get_last_structure
()¶ Returns the coordinates of the most advanced step in the protocol.
-
load
(filename=None)¶ Re-instantiate class from pickled file.
-
make_paths_relative
(prefix='.')¶ Hack to be able to copy directories around: prune basedir from paths.
Warning
This is not guaranteed to work for all paths. In particular, check :attrib:`mdpow.equil.Simulation.dirs.includes` and adjust manually if necessary.
-
processed_topology
(**kwargs)¶ Create a portable topology file from the topology and the solvated system.
-
save
(filename=None)¶ Save instance to a pickle file.
The default filename is the name of the file that was last loaded from or saved to.
-
solvate
(struct=None, **kwargs)¶ Solvate structure struct in a box of solvent.
The solvent is determined with the solvent keyword to the constructor.
Keywords: - struct
pdb or gro coordinate file (if not supplied, the value is used that was supplied to the constructor of
Simulation
)- kwargs
All other arguments are passed on to
gromacs.setup.solvate()
, but set to sensible default values. top and water are always fixed.
-
topology
(itp='drug.itp', **kwargs)¶ Generate a topology for compound molecule.
Keywords: - itp
Gromacs itp file; will be copied to topology dir and included in topology
- dirname
name of the topology directory [“top”]
- kwargs
see source for top_template, topol
-
class
mdpow.equil.
WaterSimulation
(molecule=None, **kwargs)¶ Equilibrium MD of a solute in a box of water.
Set up Simulation instance.
The molecule of the compound molecule should be supplied. Existing files (which have been generated in previous runs) can also be supplied.
Keywords: - molecule
Identifier for the compound molecule. This is the same as the entry in the
[ molecule ]
section of the itp file. [“DRUG”]- filename
If provided and molecule is
None
then load the instance from the pickle file filename, which was generated withsave()
.- dirname
base directory; all other directories are created under it
- solvent
‘water’ or ‘octanol’ or ‘cyclohexane’
- solventmodel
None
chooses the default (e.g,mdpow.forcefields.DEFAULT_WATER_MODEL
forsolvent == "water"
. Other options are the models defined inmdpow.forcefields.GROMACS_WATER_MODELS
. At the moment, there are no alternative parameterizations included for other solvents.- mdp
dict with keys corresponding to the stages
energy_minimize
,MD_restrained
,MD_relaxed
,MD_NPT
and values mdp file names (if no entry then the package defaults are used)- kwargs
advanced keywords for short-circuiting; see
mdpow.equil.Simulation.filekeys
.
-
class
mdpow.equil.
OctanolSimulation
(molecule=None, **kwargs)¶ Equilibrium MD of a solute in a box of octanol.
Set up Simulation instance.
The molecule of the compound molecule should be supplied. Existing files (which have been generated in previous runs) can also be supplied.
Keywords: - molecule
Identifier for the compound molecule. This is the same as the entry in the
[ molecule ]
section of the itp file. [“DRUG”]- filename
If provided and molecule is
None
then load the instance from the pickle file filename, which was generated withsave()
.- dirname
base directory; all other directories are created under it
- solvent
‘water’ or ‘octanol’ or ‘cyclohexane’
- solventmodel
None
chooses the default (e.g,mdpow.forcefields.DEFAULT_WATER_MODEL
forsolvent == "water"
. Other options are the models defined inmdpow.forcefields.GROMACS_WATER_MODELS
. At the moment, there are no alternative parameterizations included for other solvents.- mdp
dict with keys corresponding to the stages
energy_minimize
,MD_restrained
,MD_relaxed
,MD_NPT
and values mdp file names (if no entry then the package defaults are used)- kwargs
advanced keywords for short-circuiting; see
mdpow.equil.Simulation.filekeys
.
-
mdpow.equil.
DIST
= {'cyclohexane': 1.5, 'octanol': 1.5, 'water': 1.0}¶ dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v- dict(**kwargs) -> new dictionary initialized with the name=value pairs
- in the keyword argument list. For example: dict(one=1, two=2)