Document tool changes in 5.1
[alexxy/gromacs.git] / docs / user-guide / cmdline.rst
1 Command-line reference
2 ======================
3
4 .. toctree::
5    :hidden:
6    :glob:
7
8    /onlinehelp/gmx
9    /onlinehelp/gmx-*
10
11 |Gromacs| includes many tools for preparing, running and analysing
12 molecular dynamics simulations. These are all structured as part of a single
13 :command:`gmx` wrapper binary, and invoked with commands like :command:`gmx grompp`.
14 :ref:`mdrun <gmx mdrun>` is the only other binary that
15 :ref:`can be built <building just the mdrun binary>`; in the normal
16 build it can be run with :command:`gmx mdrun`. Documentation for these can
17 be found at the respective sections below, as well as on man pages (e.g.,
18 :manpage:`gmx-grompp(1)`) and with :samp:`gmx help {command}` or
19 :samp:`gmx {command} -h`.
20
21 If you've installed an MPI version of |Gromacs|, by default the
22 :command:`gmx` binary is called :command:`gmx_mpi` and you should adapt
23 accordingly.
24
25 Command-line interface and conventions
26 --------------------------------------
27
28 All |Gromacs| commands require an option before any arguments (i.e., all
29 command-line arguments need to be preceded by an argument starting with a
30 dash, and values not starting with a dash are arguments to the preceding
31 option).  Most options, except for boolean flags, expect an argument (or
32 multiple in some cases) after the option name.
33 The argument must be a separate command-line argument, i.e., separated by
34 space, as in ``-f traj.xtc``.  If more than one argument needs to be given to
35 an option, they should be similarly separated from each other.
36 Some options also have default arguments, i.e., just specifying the option
37 without any argument uses the default argument.
38 If an option is not specified at all, a default value is used; in the case of
39 optional files, the default might be not to use that file (see below).
40
41 All |Gromacs| command options start with a single dash, whether they are
42 single- or multiple-letter options.  However, two dashes are also recognized
43 (starting from 5.1).
44
45 In addition to command-specific options, some options are handled by the
46 :command:`gmx` wrapper, and can be specified for any command.  See
47 :doc:`wrapper binary help </onlinehelp/gmx>` for the list of such options.
48 These options are recognized both before the command name (e.g.,
49 :command:`gmx -quiet grompp`) as well as after the command name (e.g.,
50 :command:`gmx grompp -quiet`).
51 There is also a ``-hidden`` option that can be specified in combination with
52 ``-h`` to show help for advanced/developer-targeted options.
53
54 Most analysis commands can process a trajectory with fewer atoms than the
55 run input or structure file, but only if the trajectory consists of the
56 first *n* atoms of the run input or structure file.
57
58 Handling specific types of command-line options
59 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60
61 boolean options
62   Boolean flags can be specified like ``-pbc`` and negated like ``-nopbc``.
63   It is also possible to use an explicit value like ``-pbc no`` and
64   ``-pbc yes``.
65 file name options
66   Options that accept files names have features that support using default file
67   names (where the default file name is specific to that option):
68
69   * If a required option is not set, the default is used.
70   * If an option is marked optional, the file is not used unless the option
71     is set (or other conditions make the file required).
72   * If an option is set, and no file name is provided, the default is used.
73
74   All such options will accept file names without a file extension.
75   The extension is automatically appended in such a case.
76   When multiple input formats are accepted, such as a generic structure format,
77   the directory will be searched for files of each type with the supplied or
78   default name. When no file with a recognized extension is found, an error is given.
79   For output files with multiple formats, a default file type will be used.
80
81   Some file formats can also be read from compressed (:file:`.Z` or
82   :file:`.gz`) formats.
83 enum options
84   Enumerated options (enum) should be used with one of the arguments listed in
85   the option description. The argument may be abbreviated, and the first match
86   to the shortest argument in the list will be selected.
87 vector options
88   Some options accept a vector of values.  Either 1 or 3 parameters can be
89   supplied; when only one parameter is supplied the two other values are also
90   set to this value.
91 selection options
92   See :doc:`/onlinehelp/selections`.
93
94 Commands by name
95 ----------------
96
97 .. include:: /fragments/byname.rst
98
99 Commands by topic
100 -----------------
101
102 .. include:: /fragments/bytopic.rst
103
104 Special topics
105 --------------
106
107 The information in these topics is also accessible through
108 :samp:`gmx help {topic}` on the command line.
109
110 .. toctree::
111
112    /onlinehelp/selections
113
114 .. _command-changes:
115
116 Command changes between versions
117 --------------------------------
118
119 Starting from |Gromacs| 5.0, some of the analysis commands (and a few other
120 commands as well) have changed significantly.
121
122 One main driver for this has been that many new tools mentioned below now
123 accept selections through one or more command-line options instead of prompting
124 for a static index group.  To take full advantage of selections, the interface
125 to the commands has changed somewhat, and some previous command-line options
126 are no longer present as the same effect can be achieved with suitable
127 selections.
128 Please see :doc:`/onlinehelp/selections` additional information on how to use
129 selections.
130
131 In the process, some old analysis commands have been removed in favor of more
132 powerful functionality that is available through an alternative tool.
133 For removed or replaced commands, this page documents how to perform the same
134 tasks with new tools.
135 For new commands, a brief note on the available features is given.  See the
136 linked help for the new commands for a full description.
137
138 This section lists only major changes; minor changes like additional/removed
139 options or bug fixes are not typically included.
140
141 Version 5.1
142 ^^^^^^^^^^^
143
144 General
145 .......
146
147 Symbolic links from 5.0 are no longer supported.  The only way to invoke a
148 command is through :samp:`gmx {<command>}`.
149
150 gmx pairdist
151 ............
152
153 **new**
154
155 :ref:`gmx pairdist` has been introduced as a selection-enabled replacement for
156 :ref:`gmx mindist` (``gmx mindist`` still exists unchanged).  It can calculate
157 min/max pairwise distances between a pair of selections, including, e.g.,
158 per-residue minimum distances or distances from a single point to a set of
159 residue-centers-of-mass.
160
161 gmx rdf
162 .......
163
164 **rewritten**
165
166 :ref:`gmx rdf` has been rewritten for 5.1 to use selections for specifying the
167 points from which the RDFs are calculated.  The interface is mostly the same,
168 except that there are new command-line options to specify the selections.
169 The following additional changes have been made:
170
171 * ``-com`` and ``-rdf`` options have been removed.  Equivalent functionality is
172   available through selections:
173
174   * ``-com`` can be replaced with a :samp:`com of {<selection>}` as the
175     reference selection.
176   * ``-rdf`` can be replaced with a suitable set of selections (e.g.,
177     :samp:`res_com of {<selection>}`) and/or using ``-seltype``.
178
179 * ``-rmax`` option is added to specify a cutoff for the RDFs.  If set to a
180   value that is significantly smaller than half the box size, it can speed up
181   the calculation significantly if a grid-based neighborhood search can be
182   used.
183 * ``-hq`` and ``-fade`` options have been removed, as they are simply
184   postprocessing steps on the raw numbers that can be easily done after the
185   analysis.
186
187 Version 5.0
188 ^^^^^^^^^^^
189
190 General
191 .......
192
193 Version 5.0 introduced the :command:`gmx` wrapper binary.
194 For backwards compatibility, this version still creates symbolic links by default for
195 old tools: e.g., ``g_order <options>`` is equivalent to ``gmx order <options>``, and
196 ``g_order`` is simply a symbolic link on the file system.
197
198 g_bond
199 ......
200
201 **replaced**
202
203 This tool has been removed in 5.0. A replacement is :ref:`gmx distance`.
204
205 You can provide your existing index file to :ref:`gmx distance`, and it will
206 calculate the same distances.  The differences are:
207
208 * ``-blen`` and ``-tol`` options have different default values.
209 * You can control the output histogram with ``-binw``.
210 * ``-aver`` and ``-averdist`` options are not present.  Instead, you can choose
211   between the different things to calculate using ``-oav`` (corresponds to
212   ``-d`` with ``-averdist``), ``-oall`` (corresponds to ``-d`` without
213   ``-averdist``), ``-oh`` (corresponds to ``-o`` with ``-aver``), and
214   ``-oallstat`` (corresponds to ``-l`` without ``-aver``).
215
216 You can produce any combination of output files.  Compared to ``g_bond``,
217 ``gmx distance -oall`` is currently missing labels for the output columns.
218
219 g_dist
220 ......
221
222 **replaced**
223
224 This tool has been removed in 5.0.  A replacement is :ref:`gmx distance` (for
225 most options) or :ref:`gmx select` (for ``-dist`` or ``-lt``).
226
227 If you had index groups A and B in :file:`index.ndx` for ``g_dist``, you can use the
228 following command to compute the same distance with ``gmx distance``::
229
230   gmx distance -n index.ndx -select 'com of group "A" plus com of group "B"' -oxyz -oall
231
232 The ``-intra`` switch is replaced with ``-nopbc``.
233
234 If you used ``-dist D``, you can do the same calculation with ``gmx select``::
235
236   gmx select -n index.ndx -select 'group "B" and within D of com of group "A"' -on/-oi/-os/-olt
237
238 You can select the output option that best suits your post-processing needs
239 (``-olt`` is a replacement for ``g_dist -dist -lt``)
240
241 gmx distance
242 ............
243
244 **new**
245
246 :ref:`gmx distance` has been introduced as a selection-enabled replacement for
247 various tools that computed distances between fixed pairs of atoms (or
248 centers-of-mass of groups).  It has a combination of the features of ``g_bond``
249 and ``g_dist``, allowing computation of one or multiple distances, either
250 between atom-atom pairs or centers-of-mass of groups, and providing a
251 combination of output options that were available in one of the tools.
252
253 gmx gangle
254 ..........
255
256 **new**
257
258 :ref:`gmx gangle` has been introduced as a selection-enabled replacement for
259 ``g_sgangle``.  In addition to supporting atom-atom vectors, centers-of-mass
260 can be used as endpoints of the vectors, and there are a few additional angle
261 types that can be calculated.  The command also has basic support for
262 calculating normal angles between three atoms and/or centers-of-mass, making it
263 a partial replacement for :ref:`gmx angle` as well.
264
265 gmx freevolume
266 ..............
267
268 **new**
269
270 This tool has been introduced in 5.0.  It uses a Monte Carlo sampling method to
271 calculate the fraction of free volume within the box (using a probe of a given
272 size).
273
274 g_sas
275 .....
276
277 **rewritten**
278
279 This tool has been rewritten in 5.0, and renamed to :ref:`gmx sasa` (the
280 underlying surface area calculation algorithm is still the same).
281
282 The main difference in the new tool is support for selections.  Instead of
283 prompting for an index group, a (potentially dynamic) selection for the
284 calculation can be given with ``-surface``.  Any number of output groups can be
285 given with ``-output``, allowing multiple parts of the surface area to be
286 computed in a single run.  The total area of the ``-surface`` group is now
287 always calculated.
288
289 The tool no longer automatically divides the surface into hydrophobic and
290 hydrophilic areas, and there is no ``-f_index`` option.  The same effects can
291 be obtained by defining suitable selections for ``-output``.  If you want
292 output that contains the same numbers as with the old tool for a calculation
293 group ``A`` and output group ``B``, you can use ::
294
295   gmx sasa -surface 'group "A"' -output '"Hydrophobic" group "A" and charge {-0.2 to 0.2}; "Hydrophilic" group "B" and not charge {-0.2 to 0.2}; "Total" group "B"'
296
297 Solvation free energy estimates are now calculated only if separately requested
298 with ``-odg``, and are written into a separate file.
299
300 Output option ``-i`` for a position restraint file is not currently implemented
301 in the new tool, but would not be very difficult to add if requested.
302
303 g_sgangle
304 .........
305
306 **replaced**
307
308 This tool has been removed in 5.0.  A replacement is :ref:`gmx gangle` (for
309 angle calculation) and :ref:`gmx distance` (for ``-od``, ``-od1``, ``-od2``).
310
311 If you had index groups A and B in index.ndx for ``g_sgangle``, you can use the
312 following command to compute the same angle with ``gmx gangle``::
313
314   gmx gangle -n index.ndx -g1 vector/plane -group1 'group "A"' -g2 vector/plane -group2 'group "B"' -oav
315
316 You need to select either ``vector`` or ``plane`` for the ``-g1`` and ``-g2``
317 options depending on which one your index groups specify.
318
319 If you only had a single index group A in index.ndx and you used ``g_sgangle``
320 ``-z`` or ``-one``, you can use::
321
322   gmx gangle -n index.ndx -g1 vector/plane -group1 'group "A"' -g2 z/t0 -oav
323
324 For the distances, you can use :ref:`gmx distance` to compute one or more
325 distances as you want.  Both distances between centers of groups or individual
326 atoms are supported using the new selection syntax.
327
328 genbox
329 ......
330
331 This tool has been split to :ref:`gmx solvate` and :ref:`gmx insert-molecules`.
332
333 tpbconv
334 .......
335
336 This tool has been renamed :ref:`gmx convert-tpr`.