Deduplicate gmxapi documentation.
[gromacs.git] / docs / how-to / special.rst
blob70a070144e8e2c44ec685d20b68a2cd1010b3d35
1 .. _reference manual: gmx-manual-parent-dir_
3 .. _gmx-membrane:
5 Running membrane simulations in |Gromacs|
6 -----------------------------------------
8 Running Membrane Simulations
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 Users frequently encounter problems when running simulations of lipid bilayers, especially
12 when a protein is involved. Users seeking to simulate membrane proteins may find this
13 `tutorial <http://www.mdtutorials.com/gmx/membrane_protein/index.html>`__ useful.
15 One protocol for the simulation of membrane proteins consists of the following steps:
17 #. Choose a force field for which you have parameters for the protein and lipids.
18 #. Insert the protein into the membrane. (For instance, use g_membed on a pre-formed bilayer or do a
19    coarse-grained self-assembly simulation and then convert back to the atomistic representation.)
20 #. Solvate the system and add ions to neutralize excess charges and adjust the final ion concentration.
21 #. Energy minimize.
22 #. Let the membrane adjust to the protein. Typically run MD for ~5-10ns with restraints (1000 kJ/(mol nm2) on all protein heavy atoms.
23 #. Equilibrate without restraints.
24 #. Run production MD.
26 Adding waters with genbox
27 ^^^^^^^^^^^^^^^^^^^^^^^^^
29 When generating waters around a pre-formed lipid membrane with :ref:`solvate <gmx solvate>` you may find that
30 water molecules get introduced into interstices in the membrane. There are several approaches to removing these, including
32 * a short MD run to get the hydrophobic effect to exclude these waters. In general this
33   is sufficient to reach a water-free hydrophobic phase, as the molecules are usually
34   expelled quickly and without disrupting the general structure. If your setup relies
35   on a completely water-free hydrophobic phase at the start, you can try to follow
36   the advice below:
37 * Set the ``-radius`` option in :ref:`gmx solvate` to change the water exclusion radius,
38 * copy ``vdwradii.dat`` from your ``$GMXLIB`` location to the working directory, and edit it to
39   increase the radii of your lipid atoms (between 0.35 and 0.5nm is suggested for carbon) to
40   prevent :ref:`solvate <gmx solvate>` from seeing interstices large enough for water insertion,
41 * editing your structure by hand to delete them (remembering to adjust your atom count for :ref:`gro` files
42   and to account for any changes in the :ref:`topology <top>`), or
43 * use a script someone wrote to remove them.
45 External material
46 ^^^^^^^^^^^^^^^^^
48 * `Membrane simulations slides <https://extras.csc.fi/chem/courses/gmx2007/Erik_Talks/membrane_simulations.pdf>`_ ,
49   `membrane simulations video <http://tv.funet.fi/medar/showRecordingInfo.do?id=/metadata/fi/csc/courses/gromacs_workshop_2007/SpeedingupSimulationsAlgorithmsApplications.xml>`_ - (Erik Lindahl).
50 * |Gromacs| `tutorial for membrane protein simulations
51   <http://www.mdtutorials.com/gmx/membrane_protein/index.html>`__ - designed to demonstrate what sorts of
52   questions and problems occur when simulating proteins that are embedded within a lipid bilayer.
53 * `Combining the OPLS-AA forcefield with the Berger lipids <http://www.pomeslab.com/files/lipidCombinationRules.pdf>`_
54   A detailed description of the motivation, method, and testing.
56 * Several Topologies for membrane proteins with different force fields gaff, charmm berger
57   Shirley W. I. Siu, Robert Vacha, Pavel Jungwirth, Rainer A. Böckmann: Biomolecular simulations of membranes:
58   `Physical properties from different force fields <https://doi.org/10.1063/1.2897760>`_.
59 * `Lipidbook <https://lipidbook.bioch.ox.ac.uk/>`_ is a public repository for force-field parameters of lipids,
60   detergents and other molecules that are used in
61   the simulation of membranes and membrane proteins. It is described in: J. Domański, P. Stansfeld, M.S.P. Sansom,
62   and O. Beckstein. J. Membrane Biol. 236 (2010), 255—258. `doi:10.1007/s00232-010-9296-8 <http://dx.doi.org/10.1007/s00232-010-9296-8>`_.
65 Parameterization of novel molecules
66 -----------------------------------
68 Most of your parametrization questions/problems can be resolved very simply, by remembering the following two rules:
70 * **You should not mix and match force fields**. :ref:`Force fields <gmx-force-field>` are (at best) designed to be self-consistent,
71   and will not typically work well with other force fields. If you simulate part of your system with one
72   force field and another part with a different force field which is not parametrized with the first force
73   field in mind, your results will probably be questionable, and hopefully reviewers will be concerned.
74   Pick a force field. Use that force field.
75 * If you need to develop new parameters, derive them in a manner consistent with how the rest of the force field
76   was originally derived, which means that you will need to review the original literature. There isn't a single
77   right way to derive force field parameters; what you need is to derive parameters that are consistent with the rest
78   of the force field. How you go about doing this depends on which force field you want to use. For example, with
79   AMBER force fields, deriving parameters for a non-standard amino acid would probably involve doing a number of
80   different quantum calculations, while deriving GROMOS or OPLS parameters might involve more (a) fitting various fluid
81   and liquid-state properties, and (b) adjusting parameters based on experience/chemical intuition/analogy. Some
82   suggestions for automated approaches can be found :doc:`here <../user-guide/system-preparation>`.
84 It would be wise to have a reasonable amount of simulation experience with |Gromacs| before
85 attempting to parametrize new force fields, or new molecules for existing force fields.
86 These are expert topics, and not suitable for giving to (say) undergraduate students for
87 a research project, unless you like expensive quasi-random number generators. A very thorough knowledge
88 of :ref:`Chapter 5 <ff>` of the |Gromacs| Reference Manual will be required. If you haven't been warned
89 strongly enough, please read below about parametrization for exotic species.
91 Another bit of advice: Don't be more haphazard in obtaining parameters than you would be buying
92 fine jewellery. Just because the guy on the street offers to sell you a *diamond* necklace for $10
93 doesn't mean that's where you should buy one. Similarly, it isn't necessarily the best strategy
94 to just download parameters for your molecule of interest from the website of someone you've
95 never heard of, especially if they don't explain how they got the parameters.
97 Be forewarned about using `PRODRG <http://davapc1.bioch.dundee.ac.uk/cgi-bin/prodrg>`_ topologies
98 without verifying their contents: the artifacts of doing so are now `published <http://pubs.acs.org/doi/abs/10.1021/ci100335w>`_,
99 along with some tips for properly deriving parameters for the GROMOS family of force fields.
101 Exotic Species
102 ^^^^^^^^^^^^^^
104 So, you want to simulate a protein/nucleic acid system, but it binds various exotic metal
105 ions (ruthenium?), or there is an iron-sulfur cluster essential for its functionality, or similar.
106 But, (unfortunately?) there aren't parameters available for these in the force field you want
107 to use. What should you do? You shoot an e-mail to the |Gromacs| users emailing list, and get referred to the FAQs.
109 If you really insist on simulating these in molecular dynamics, you'll need to obtain parameters
110 for them, either from the literature, or by doing your own parametrization. But before doing so,
111 it's probably important to stop and think, as sometimes there is a reason there may not already
112 be parameters for such atoms/clusters. In particular, here are a couple of basic questions you
113 can ask yourself to see whether it's reasonable to develop/obtain standard parameters for these and use them in molecular dynamics:
115 * Are quantum effects (i.e. charge transfer) likely to be important? (i.e., if you have a
116   divalent metal ion in an enzyme active site and are interested in studying enzyme
117   functionality, this is probably a huge issue).
118 * Are standard force field parametrization techniques used for my force field of choice
119   likely to fail for an atom/cluster of this type? (i.e. because Hartree-Fock 6-31G* can't
120   adequately describe transition metals, for example)
122 If the answer to either of these questions is "Yes", you may want to consider doing your
123 simulations with something other than classical molecular dynamics.
125 Even if the answer to both of these is "No", you probably want to consult with someone who
126 is an expert on the compounds you're interested in, before attempting your own parametrization.
127 Further, you probably want to try parametrizing something more straightforward before you embark on one of these.
130 Potential of Mean Force
131 -----------------------
133 The potential of mean force (PMF) is defined as the potential that gives an average force over all the
134 configurations of a given system.  There are several ways to calculate the PMF in |Gromacs|, probably
135 the most common of which is to make use of the pull code. The steps for obtaining a PMF using umbrella
136 sampling, which allows for sampling of statistically-improbable states, are:
138 * Generate a series of configurations along a reaction coordinate (from a steered MD simulation,
139   a normal MD simulation, or from some arbitrarily-created configurations)
140 * Use umbrella sampling to restrain these configurations within sampling windows.
141 * Use :ref:`gmx wham` to make use of the WHAM algorithm to reconstruct a PMF curve.
143 A more detailed tutorial is linked `here for umbrella
144 sampling <http://www.mdtutorials.com/gmx/umbrella/index.html>`__.
147 Single-Point Energy
148 -------------------
150 Computing the energy of a single configuration is an operation that is sometimes useful. The best
151 way to do this with |Gromacs| is with the :ref:`mdrun <gmx mdrun>` ``-rerun`` mechanism, which
152 applies the model physics in the :ref:`tpr` to the configuration in the trajectory or coordinate file supplied to mdrun.
156     mdrun -s input.tpr -rerun configuration.pdb
158 Note that the configuration supplied must match the topology you used when generating the :ref:`tpr`
159 file with :ref:`grompp <gmx grompp>`. The configuration you supplied to :ref:`grompp <gmx grompp>`
160 is irrelevant, except perhaps for atom names. You can also use this feature with energy groups
161 (see the `Reference manual`_), or with a trajectory of multiple configurations (and in this case,
162 by default :ref:`mdrun <gmx mdrun>` will do neighbour searching for each configuration, because
163 it can make no assumptions about the inputs being similar).
165 A zero-step energy minimization does a step before reporting the energy, and a zero-step MD run
166 has (avoidable) complications related to catering to possible restarts in the presence of
167 constraints, so neither of those procedures are recommended.
170 Carbon Nanotube
171 ---------------
173 Robert Johnson's Tips
174 ^^^^^^^^^^^^^^^^^^^^^
176 Taken from Robert Johnson's posts on the gmx-users mailing list.
178 * Be absolutely sure that the "terminal" carbon atoms are sharing a bond in the topology file.
179 * Use ``periodic_molecules = yes`` in your :ref:`mdp` file for input in :ref:`gmx grompp`.
180 * Even if the topology is correct, crumpling may occur if you place the nanotube in a box of wrong
181   dimension, so use `VMD`_ to visualize the nanotube and its periodic images and make sure that the
182   space between images is correct. If the spacing is too small or too big, there will be a large amount
183   of stress induced in the tube which will lead to crumpling or stretching.
184 * Don't apply pressure coupling along the axis of the nanotube. In fact, for debugging purposes,
185   it might be better to turn off pressure coupling altogether until you figure out if anything
186   is going wrong, and if so, what.
187 * When using :ref:`x2top <gmx x2top>` with a specific force field, things are assumed about the
188   connectivity of the molecule. The terminal carbon atoms of your nanotube will only be bonded to,
189   at most, 2 other carbons, if periodic, or one if non-periodic and capped with hydrogens.
190 * You can generate an "infinite" nanotube with the ``-pbc`` option to :ref:`x2top <gmx x2top>`.
191   Here, :ref:`x2top <gmx x2top>` will recognize that the terminal C atoms actually share a
192   chemical bond. Thus, when you use :ref:`grompp <gmx grompp>` you won't get an error
193   about a single bonded C.
196 Andrea Minoia's tutorial
197 ^^^^^^^^^^^^^^^^^^^^^^^^
199 Modeling Carbon Nanotubes with |Gromacs| (also archived
200 as http://www.webcitation.org/66u2xJJ3O) contains
201 everything to set up simple simulations of a CNT using OPLS-AA
202 parameters. Structures of simple CNTs can
203 be easily generated e.g. by `buildCstruct`_ (Python script that also adds
204 terminal hydrogens) or `TubeGen Online`_ (just copy and paste the
205 PDB output into a file and name it cnt.pdb).
207 To make it work with modern |Gromacs| you'll probably want to do the following:
209 * make a directory cnt_oplsaa.ff
210 * In this directory, create the following files, using the data from the tutorial page:
212   * forcefield.itp from the file in section :ref:`itp`
213   * atomnames2types.n2t from the file in section :ref:`n2t`
214   * aminoacids.rtp from the file in section :ref:`rtp`
216 * generate a topology with the custom forcefield (the cnt_oplsaa.ff directory must be in the same directory as where the :ref:`gmx x2top`
217   command is run or it must be found on the GMXLIB path), ``-noparam`` instructs :ref:`gmx x2top` to not use
218   bond/angle/dihedral force constants from the command line (-kb, -ka, -kd) but rely on the force field files;
219   however, this necessitates the next step (fixing the dihedral functions)
223     gmx x2top -f cnt.gro -o cnt.top -ff cnt_oplsaa -name CNT -noparam
225 The function type for the dihedrals is set to '1' by :ref:`gmx x2top` but the force field file specifies type '3'.
226 Therefore, replace func type  '1' with '3' in the ``[ dihedrals ]`` section of the topology file. A quick way
227 is to use sed (but you might have to adapt this to your operating system; also manually look at the top file
228 and check that you only changed the dihedral func types):
232     sed -i~ '/\[ dihedrals \]/,/\[ system \]/s/1 *$/3/' cnt.top
234 Once you have the topology you can set up your system. For instance, a simple in-vacuo simulation (using your
235 favourite parameters in em.\ :ref:`mdp` and md.\ :ref:`mdp`):
237 Put into a slightly bigger box:
241     gmx editconf -f cnt.gro -o boxed.gro -bt dodecahedron -d 1
243 Energy minimise in vacuuo:
247     gmx grompp -f em.mdp -c boxed.gro -p cnt.top -o em.tpr
248     gmx mdrun -v -deffnm em
250 MD in vacuuo:
254     gmx grompp -f md.mdp -c em.gro -p cnt.top -o md.tpr
255     gmx mdrun -v -deffnm md
257 Look at trajectory:
261     gmx trjconv -f md.xtc -s md.tpr -o md_centered.xtc -pbc mol -center
262     gmx trjconv -s md.tpr -f md_centered.xtc -o md_fit.xtc -fit rot+trans
263     vmd em.gro md_fit.xtc
265 .. _buildCstruct: http://chembytes.wikidot.com/buildcstruct
266 .. _TubeGen Online: http://turin.nss.udel.edu/research/tubegenonline.html