2 =======================
3 This section discusses features in :ref:`gmx mdrun` that don't fit well
6 .. _single-point energy:
8 Re-running a simulation
9 -----------------------
10 The rerun feature allows you to take any trajectory file ``traj.trr``
11 and compute quantities based upon the coordinates in that file using
12 the model physics supplied in the ``topol.tpr`` file. It can be used
13 with command lines like ``mdrun -s topol -rerun traj.trr``. That :ref:`tpr`
14 could be different from the one that generated the trajectory. This
15 can be used to compute the energy or forces for exactly the
16 coordinates supplied as input, or to extract quantities based on
17 subsets of the molecular system (see :ref:`gmx convert-tpr` and
18 :ref:`gmx trjconv`). It is easier to do a correct "single-point" energy
19 evaluation with this feature than a 0-step simulation.
21 Neighbor searching is performed for every frame in the trajectory
22 independently of the value in :mdp:`nstlist`, since
23 :ref:`gmx mdrun` can no longer assume anything about how the
24 structures were generated. Naturally, no update or constraint
25 algorithms are ever used.
27 The rerun feature cannot, in general, compute many of the quantities
28 reported during full simulations. It does only take positions as input
29 (ignoring potentially present velocities), and does only report potential
30 energies, volume and density, dH/dl terms, and restraint information.
31 It does notably not report kinetic, total or conserved energy, temperature,
34 Running a simulation in reproducible mode
35 -----------------------------------------
36 It is generally difficult to run an efficient parallel MD simulation
37 that is based primarily on floating-point arithmetic and is fully
38 reproducible. By default, :ref:`gmx mdrun` will observe how things are going
39 and vary how the simulation is conducted in order to optimize
40 throughput. However, there is a "reproducible mode" available with
41 ``mdrun -reprod`` that will systematically eliminate all sources of
42 variation within that run; repeated invocations on the same input and
43 hardware will be binary identical. However, running in this mode on
44 different hardware, or with a different compiler, etc. will not be
45 reproducible. This should normally only be used when investigating
48 Running multi-simulations
49 -------------------------
50 There are numerous situations where running a related set of
51 simulations within the same invocation of mdrun are necessary or
52 useful. Running a replica-exchange simulation requires it, as do
53 simulations using ensemble-based distance or orientation restraints.
54 Running a related series of lambda points for a free-energy
55 computation is also convenient to do this way.
58 :ref:`configuring |Gromacs| with an external MPI library <mpi-support>`
60 simulations can communicate. The ``n`` simulations within the set can
61 use internal MPI parallelism also, so that ``mpirun -np x mdrun_mpi``
62 for ``x`` a multiple of ``n`` will use ``x/n`` ranks per simulation.
64 There are two ways of organizing files when running such
65 simulations. All of the normal mechanisms work in either case,
66 including ``-deffnm``.
69 You must create a set of ``n`` directories for the ``n`` simulations,
70 place all the relevant input files in those directories (e.g. named
71 ``topol.tpr``), and run with
72 ``mpirun -np x gmx_mpi mdrun -s topol -multidir <names-of-directories>``.
73 If the order of the simulations
74 within the multi-simulation is significant, then you are responsible
75 for ordering their names when you provide them to ``-multidir``. Be
76 careful with shells that do filename globbing dictionary-style, e.g.
77 ``dir1 dir10 dir11 ... dir2 ...``. This option is generally the
78 most convenient to use. ``gmx mdrun -table`` for the group cutoff-scheme
79 works only in this mode.
81 Examples running multi-simulations
82 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86 mpirun -np 32 gmx_mpi mdrun -multidir a b c d
88 Starts a multi-simulation on 32 ranks with 4 simulations. The input
89 and output files are found in directories ``a``, ``b``, ``c``, and ``d``.
93 mpirun -np 32 gmx_mpi mdrun -multidir a b c d -gputasks 0000000011111111
95 Starts the same multi-simulation as before. On a machine with two
96 physical nodes and two GPUs per node, there will be 16 MPI ranks per
97 node, and 8 MPI ranks per simulation. The 16 MPI ranks doing PP work
98 on a node are mapped to the GPUs with IDs 0 and 1, even though they
99 come from more than one simulation. They are mapped in the order
100 indicated, so that the PP ranks from each simulation use a single
101 GPU. However, the order ``0101010101010101`` could run faster.
103 Running replica-exchange simulations
104 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106 When running a multi-simulation, using ``gmx mdrun -replex n`` means that a
107 replica exchange is attempted every given number of steps. The number
108 of replicas is set with ``-multidir`` option, described
109 above. All run input files should use a different value for the
110 coupling parameter (e.g. temperature), which ascends over the set of
111 input files. The random seed for replica exchange is set with
112 ``-reseed``. After every exchange, the velocities are scaled and
113 neighbor searching is performed. See the Reference Manual for more
114 details on how replica exchange functions in |Gromacs|.
116 Controlling the length of the simulation
117 ----------------------------------------
119 Normally, the length of an MD simulation is best managed through the
120 :ref:`mdp` option :mdp:`nsteps`, however there are situations where
121 more control is useful. :samp:`gmx mdrun -nsteps 100` overrides the :ref:`mdp`
122 file and executes 100 steps. :samp:`gmx mdrun -maxh 2.5` will terminate the
123 simulation shortly before 2.5 hours elapse, which can be useful when
124 running under cluster queues (as long as the queuing system does not
125 ever suspend the simulation).
127 Running a membrane protein embedding simulation
128 -----------------------------------------------
130 This is a module to help embed a membrane protein into an equilibrated
131 lipid bilayer at a position and orientation specified by the user.
133 This method was initially described as a ProtSqueeze technique
134 (`Yesylevskyy S.O., J Chem Inf Model 47(5) (2007) 1986-94`_) and
135 later implemented in |Gromacs| as g_membed tool (`Wolf et al, J Comp Chem 31 (2010) 2169-2174`_).
136 Currently the functionality of g_membed is available in mdrun if
137 ``-membed`` option is specified (see below). This approach is
138 unsuitable, and may be deprecated and replaced in future, e.g. with
141 .. _Yesylevskyy S.O., J Chem Inf Model 47(5) (2007) 1986-94: https://dx.doi.org/10.1021/ci600553y
142 .. _Wolf et al, J Comp Chem 31 (2010) 2169-2174: http://onlinelibrary.wiley.com/doi/10.1002/jcc.21507/full
144 The main advantage is that it is possible to use very complex lipid bilayers
145 with a number of different components that have been relaxed for a
146 long time in a previous simulation. In theory that could be accomplished
147 with a procedure similar to :ref:`gmx solvate`, but since lipids are much larger
148 than water molecules it will lead to a large vacuum layer between the
149 protein and membrane if we remove all molecules where any atom is
150 overlapping. Instead, this module works by first artificially shrinking
151 the protein in the xy-plane, then it removes lipids that overlap with
152 a much smaller core, after which we gradually push the protein atoms
153 back to their initial positions, while using normal dynamics for the
154 rest of the system so lipids adapt to the protein.
156 To use membrane embedding, start by building a lipid bilayer that is
157 just-so-slightly larger in the xy-plane than what you expect to need
158 in the end, and make sure you have enough water outside the membrane
159 to accommodate globular domains. Place the protein in the same coordinate
160 file (and topology) as your lipid bilayer, and make sure it is in the
161 orientation and position you want right in the middle of the bilayer.
163 The first settings have to be entered in the mdp file that controls
164 your simulation. You need an energy group corresponding to your
165 protein, this group should be frozen (all dimensions), and we should
166 exclude all interactions inside the protein to avoid problems when it
167 is distorted. For instance:
175 energygrp_excl = Protein Protein
177 You will also need a number of settings for the actual membrane
178 embedding process. These are entered as similar name and value pairs,
179 but in the separate text data file ``embed.dat`` that you provide as
180 the argument to the ``-membed`` option (we refer to the below
181 when explaining the process). The embedding works in for stages:
183 1. The protein is resized around its center of mass by a factor
184 ``xy`` in the xy-plane (the bilayer plane), and a factor ``z``
185 along the z-axis (normal to the bilayer). If the height of the
186 protein is the same or smaller than the thickness of the
187 membrane, a z-fraction larger than 1.0 can prevent the protein
188 from being enveloped by the lipids.
190 2. All lipid and solvent molecules overlapping with the resized
191 protein are removed. All interactions inside the protein are
192 turned off to prevent numerical issues for small values of the
195 3. A single md step is performed, where atoms in the rest of the
198 4. The resize factors are adjusted by the small amounts
199 (1-xy)/nxy and (1-z)/nz, where ``nxy`` and ``nz`` are the
200 number of iterations to use. The resize factor for the xy-plane
201 is adjusted first. The resize factor for the z-direction is not
202 changed until the xy factor is 1.0 (after ``nxy`` iterations).
204 5. Steps 3 and 4 are repeated until the protein has again reached
205 its original size, i.e. after nxy+nz iterations. After the
206 embedding you might still want to perform a short relaxation.
208 Parameters that can be specified in ``embed.dat``, with default
209 values that will be used if the setting is omitted:
211 - ``xyinit`` (0.5) Resize factor for the protein in the xy
212 dimension before starting embedding.
214 - ``xyend`` (1.0) Final resize factor in the xy dimension.
216 - ``zinit`` (1.0) Resize factor for the protein in the z
217 dimension before starting embedding.
219 - ``zend`` (1.0) Final resize faction in the z dimension.
221 - ``nxy`` (1000) Number of iteration for the xy dimension.
223 - ``nz`` (0) Number of iterations for the z dimension.
225 - ``rad`` (0.22) Probe radius to check for overlap between
226 the group to embed and the membrane.
228 - ``pieces`` (1) Perform piecewise resize. Select parts of the group
229 to insert and resize these with respect to their own geometrical center.
231 - ``asymmetry`` (no) Allow asymmetric insertion, i.e. the number of
232 lipids removed from the upper and lower leaflet will not be checked.
234 - ``ndiff`` (0) Number of lipids that will additionally be removed
235 from the lower (negative number) or upper (positive number)
238 - ``maxwarn`` (0) Largest number of membed warnings allowed.