Split up analysis chapter in reference manual
[alexxy/gromacs.git] / docs / reference-manual / special / vmd-imd.rst
1
2 .. this really does not belong here in my opinion
3
4 Using VMD plug-ins for trajectory file I/O
5 ------------------------------------------
6
7 |Gromacs|
8 tools are able to use the plug-ins found in an existing installation of
9 `VMD`_ in order to read and write
10 trajectory files in formats that are not native to |Gromacs|. You will be
11 able to supply an AMBER DCD-format trajectory filename directly to
12 |Gromacs| tools, for example.
13
14 This requires a VMD installation not older than version 1.8, that your
15 system provides the dlopen function so that programs can determine at
16 run time what plug-ins exist, and that you build shared libraries when
17 building |Gromacs|. CMake will find the vmd executable in your path, and
18 from it, or the environment variable ``VMDDIR`` at
19 configuration or run time, locate the plug-ins. Alternatively, the
20 ``VMD_PLUGIN_PATH`` can be used at run time to specify a
21 path where these plug-ins can be found. Note that these plug-ins are in
22 a binary format, and that format must match the architecture of the
23 machine attempting to use them.
24
25 Interactive Molecular Dynamics
26 ------------------------------
27
28 |Gromacs| supports the interactive molecular dynamics (IMD) protocol as
29 implemented by `VMD`_ to control
30 a running simulation in NAMD. IMD allows to monitor a running |Gromacs|
31 simulation from a VMD client. In addition, the user can interact with
32 the simulation by pulling on atoms, residues or fragments with a mouse
33 or a force-feedback device. Additional information about the |Gromacs|
34 implementation and an exemplary |Gromacs| IMD system can be found `on this
35 homepage <http://www.mpibpc.mpg.de/grubmueller/interactivemd>`__.
36
37 Simulation input preparation
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
40 The |Gromacs| implementation allows transmission and interaction with a
41 part of the running simulation only, e.g. in cases where no water
42 molecules should be transmitted or pulled. The group is specified via
43 the :ref:`mdp` option ``IMD-group``. When
44 ``IMD-group`` is empty, the IMD protocol is disabled and
45 cannot be enabled via the switches in :ref:`mdrun <gmx mdrun>`. To interact
46 with the entire system, ``IMD-group`` can be set to
47 ``System``. When using :ref:`grompp <gmx grompp>`, a
48 :ref:`gro` file to be used as VMD input is written out
49 (``-imd`` switch of :ref:`grompp <gmx grompp>`).
50
51 Starting the simulation
52 ^^^^^^^^^^^^^^^^^^^^^^^
53
54 Communication between VMD and |Gromacs| is achieved via TCP sockets and
55 thus enables controlling an :ref:`mdrun <gmx mdrun>` running locally or on
56 a remote cluster. The port for the connection can be specified with the
57 ``-imdport`` switch of :ref:`mdrun <gmx mdrun>`, 8888 is the
58 default. If a port number of 0 or smaller is provided, |Gromacs|
59 automatically assigns a free port to use with IMD.
60
61 Every :math:`N` steps, the :ref:`mdrun <gmx mdrun>` client receives the
62 applied forces from VMD and sends the new positions to the client. VMD
63 permits increasing or decreasing the communication frequency
64 interactively. By default, the simulation starts and runs even if no IMD
65 client is connected. This behavior is changed by the
66 ``-imdwait`` switch of :ref:`mdrun <gmx mdrun>`. After startup
67 and whenever the client has disconnected, the integration stops until
68 reconnection of the client. When the ``-imdterm`` switch is
69 used, the simulation can be terminated by pressing the stop button in
70 VMD. This is disabled by default. Finally, to allow interacting with the
71 simulation (i.e. pulling from VMD) the ``-imdpull`` switch
72 has to be used. Therefore, a simulation can only be monitored but not
73 influenced from the VMD client when none of ``-imdwait``,
74 ``-imdterm`` or ``-imdpull`` are set. However,
75 since the IMD protocol requires no authentication, it is not advisable
76 to run simulations on a host directly reachable from an insecure
77 environment. Secure shell forwarding of TCP can be used to connect to
78 running simulations not directly reachable from the interacting host.
79 Note that the IMD command line switches of :ref:`mdrun <gmx mdrun>` are
80 hidden by default and show up in the help text only with
81 :ref:`gmx mdrun` ``-h -hidden``.
82
83 Connecting from VMD
84 ^^^^^^^^^^^^^^^^^^^
85
86 In VMD, first the structure corresponding to the IMD group has to be
87 loaded (*File* :math:`\rightarrow` *New Molecule*). Then the IMD
88 connection window has to be used (*Extensions* :math:`\rightarrow`
89 *Simulation* :math:`\rightarrow` *IMD Connect (NAMD)*). In the IMD
90 connection window, hostname and port have to be specified and followed
91 by pressing *Connect*. *Detach Sim* allows disconnecting without
92 terminating the simulation, while *Stop Sim* ends the simulation on the
93 next neighbor searching step (if allowed by ``-imdterm``).
94
95 The timestep transfer rate allows adjusting the communication frequency
96 between simulation and IMD client. Setting the keep rate loads every
97 :math:`N^\mathrm{th}` frame into VMD instead of discarding them when a
98 new one is received. The displayed energies are in SI units in contrast
99 to energies displayed from NAMD simulations.s