Generate Gromacs .mdp Files

Classes

class genmdp.SimulationMdp(gro, title='MD Simulation', T=300, em_steps=-1, time_step=0.002, length=1000, p_coupling='semiisotropic', barostat='berendsen', genvel='yes', restraints=False, xlink=False, bcc=False, tau_p=20, tau_t=0.1, nstxout=5000, nstvout=5000, nstfout=5000, nstenergy=5000, frames=None)
__init__(gro, title='MD Simulation', T=300, em_steps=-1, time_step=0.002, length=1000, p_coupling='semiisotropic', barostat='berendsen', genvel='yes', restraints=False, xlink=False, bcc=False, tau_p=20, tau_t=0.1, nstxout=5000, nstvout=5000, nstfout=5000, nstenergy=5000, frames=None)
Parameters:
  • gro – (str) coordinate file which will be simulated
  • title – (str) name of simulation
  • T – (float) simulation temperature
  • em_steps – (int) number of steps to take during energy minimization
  • ensemble – (str) thermodynamic ensemble to simulate system in
  • time_step – (float) simulation time step (fs)
  • length – (int) simulation length, picoseconds
  • p_coupling – (str) type of pressure coupling (None, semiisotropic, isotropic etc.)
  • barostat – (str) barostat to use for pressure control
  • genvel – (bool) True if velocities should be generated for initial configuration. if you want to use velocities already present in coordinate file
  • restraints – (bool) whether or not the system has been restrained (meaning a special topology file has been created
  • xlink – (bool) whether the system is being run through the crosslinking algorithm
  • bcc – (bool) if we are simulating the bicontinous cubic system
  • tau_p – (int) time constant for pressure coupling
  • tau_t – (int) time constant for temperature coupling
  • nstxout – frequency of outputting coordinates to trajectory file
  • nstvout – frequency of outputting velocity to trajectory file
  • nstfout – frequency of outputting forces to trajectory file
  • nstenergy – frequency of outputting energy to energy file
  • frames – number of frames to output. If not None, nstxout, nstvout, nstfou and nstenergy will be adjusted accordingly
add_pull_groups(ref_groups, coord_groups, k, rate, mdp, geometry='distance', type='umbrella', dim='z')

Add pull groups

NOTE: This assumes all options apply to all pull coords (for now)

Parameters:
write_em_mdp(out='em')
Parameters:out – (str) name of output file
write_npt_mdp(out='npt', length=None)

Write an .mdp file for an NPT simulation (constant number of particles, pressure and temperature)

Parameters:
  • out (str) – name of output file
  • length (int) – simulation length (ps). Only need to specify this if you are changing the simulation length from how it was initialized
write_nve_mdp(out='nve')
Parameters:out – (str) name of output file
write_nvt_mdp(out='nvt', length=None)

Write an .mdp file for an NVT simulation (constant number of particles, volume and temperature)

Parameters:
  • out (str) – name of output file
  • length (int) – simulation length (ps). Only need to specify this if you are changing the simulation length from how it was initialized

Command Line Functionality

One can run this as a script from the command line as follows. However, in most cases it is probably more convenient to use input.py

Generate .mdp file for simulation of choice

usage: genmdp.py [-h] [-T TITLE] [-g GRO] [-t ITP] [-s EM_STEPS] [-e ENSEMBLE]
                 [-d DT] [-l LENGTH] [-f FRAMES] [-p PCOUPLTYPE]
                 [--restraints] [-x] [-S] [--temp TEMP] [--mdp]
                 [--barostat BAROSTAT] [--genvel GENVEL] [--bcc]
                 [--solvent SOLVENT] [--tau_t TAU_T] [--tau_p TAU_P]
                 [-nx NSTXOUT] [-nv NSTVOUT] [-nf NSTFOUT] [-ne NSTENERGY]

Named Arguments

-T, --title

Simulation Title

Default: “MD Simulation”

-g, --gro

coordinate file of system to be simulated

Default: “initial.gro”

-t, --itp

Name of .itp describing monomers

Default: “dipole.itp”

-s, --em_steps

Steps to take during energy minimization.Default is to go forever until convergence.

Default: -1

-e, --ensemble

Thermodynamic ensemble to put system in

Default: “npt”

-d, --dt

time step (ps)

Default: 0.002

-l, --length

simulation length (ps)

Default: 1000

-f, --frames

number of frames

Default: 50

-p, --pcoupltype
 

Pressure Couple Type

Default: “semiisotropic”

--restraints

If restraints are on, another mdp option needs to be turned on, so specify this flag

Default: False

-x, --xlink

Turn this to “on” if the the system is crosslinked

Default: False

-S, --solvate

Specify this if the system has water so an extra line can be added to the topology

Default: False

--temp

Specify temperature at which to run simulation

Default: 300

--mdp

Only the .mdp will be written if this option is specified

Default: False

--barostat

pressure coupling scheme to use

Default: “berendsen”

--genvel

generate velocities according to a maxwelldistribution

Default: True

--bcc

Generate input files using bicontinuous cubic files

Default: False

--solvent

Name of solvent

Default: “water”

--tau_t

Temperature coupling time constant

Default: 0.1

--tau_p

Pressure coupling time constant

Default: 20

-nx, --nstxout Frequency to output coordinates to trajectory file
-nv, --nstvout Frequency to output velocities to trajectory file
-nf, --nstfout Frequency to output forces to trajectory file
-ne, --nstenergy
 Frequency to output energy to energy file