Gromacs is a free classical molecular dynamics package. It is mainly used in modeling of biological systems. It is part of the ubuntu-linux distribution. http://www.gromacs.org/
Warning
Warning
This ASE-interface is a preliminary one and it is VERY SLOW so do not use it for production runs. It is here because of we’ll have a QM/MM calculator which is using gromacs as the MM part.
For example: (setting for the MM part of a QM/MM run, parameter ‘-nt 1’ for serial run):
CALC_MM = Gromacs(doing_qmmm = True)
CALC_MM.set_own_params_runs('extra_mdrun_parameters', ' -nt 1 ')
The description of the parameters can be found in the Gromacs manual: http://www.gromacs.org/Documentation/Manual
and extra (ie. non-gromacs) parameter:
- GMXCMD the name of the main gromacs executable (usually ‘mdrun’). If GMXCMD is not set gromacs test is not run, but in the calculator works using ‘mdrun’.
- GMXCMD_PREF prefix for all gromacs commands (default ‘’)
- GMXCMD_POST postfix (ie suffix) for all gromacs commands (default ‘’)
THIS IS NOT A PROPER WAY TO SETUP YOUR MD SIMULATION. THIS IS JUST A DEMO THAT DOES NOT CRASH. (the box size should be iterated by md-NTP, total charge should be 0).
Initial pdb coordinates (file his.pdb):
COMPND HIS HISTIDINE
REMARK HIS Part of HIC-Up: http://xray.bmc.uu.se/hicup
REMARK HIS Extracted from PDB file pdb1wpu.ent
HETATM 1 N HIS 4234 0.999 -1.683 -0.097 1.00 20.00
HETATM 2 CA HIS 4234 1.191 -0.222 -0.309 1.00 20.00
HETATM 3 C HIS 4234 2.641 0.213 -0.105 1.00 20.00
HETATM 4 O HIS 4234 3.529 -0.651 -0.222 1.00 20.00
HETATM 5 CB HIS 4234 0.245 0.546 0.619 1.00 20.00
HETATM 6 CG HIS 4234 -1.200 0.349 0.280 1.00 20.00
HETATM 7 ND1 HIS 4234 -1.854 -0.849 0.470 1.00 20.00
HETATM 8 CD2 HIS 4234 -2.095 1.176 -0.310 1.00 20.00
HETATM 9 CE1 HIS 4234 -3.087 -0.752 0.006 1.00 20.00
HETATM 10 NE2 HIS 4234 -3.258 0.467 -0.474 1.00 20.00
HETATM 11 OXT HIS 4234 2.889 1.404 0.141 1.00 20.00
REMARK HIS ENDHET
The sample file for relaxation:
""" An example for using gromacs calculator in ase.
Atom positions are relaxed.
A sample call:
python ./gromacs_example_mm_relax.py his.pdb
"""
from ase.calculators.gromacs import Gromacs
import sys
from ase.io import read
infile_name = sys.argv[1]
CALC_MM_RELAX = Gromacs(clean=True)
CALC_MM_RELAX.set_own_params_runs(
'extra_pdb2gmx_parameters','-ignh')
CALC_MM_RELAX.set_own_params_runs(
'init_structure',infile_name)
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.write_input()
CALC_MM_RELAX.set_own_params_runs(
'extra_editconf_parameters','-bt cubic -c -d 0.8')
CALC_MM_RELAX.run_editconf()
CALC_MM_RELAX.set_own_params_runs(
'extra_genbox_parameters','-cs spc216.gro')
CALC_MM_RELAX.run_genbox()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()