Package gromacs :: Package analysis :: Package plugins :: Module mindistances :: Class MinDistances
[hide private]
[frames] | no frames]

Class MinDistances

source code

 object --+    
          |    
core.Plugin --+
              |
             MinDistances

*MinDistances* plugin.

The minimum distances between the members of at least two index
groups and the number of contacts are calculated for each time
step and written to files.

.. class:: Distances(groups, ndx, [cutoff, [, name[, simulation]]])

:Arguments:
    name : string
        plugin name (used to access it)
    simulation : instance
        The :class:`gromacs.analysis.Simulation` instance that owns the plugin.
    groups : list of index group names
        The first entry is the *primary group*. All other entries
        are *secondary groups* and the plugin calculates the minimum distance
        between members of the primary group and the members of each
        secondary group.
    ndx : index filename or list
        All index files that contain the listed groups.
    cutoff : float
        A contact is recorded if the distance is <cutoff [0.6 nm]

Example:

Generate index files with the groups of interest, for instance
with :class:`gromacs.cbook.IndexBuilder`::

  from gromacs.cbook import IndexBuilder
  A_grp, A_ndx = IndexBuilder(tpr, ['@a 62549 & r NA'], names=['Na1_ion'], offset=-9, 
                              out_ndx='Na1.ndx', name_all="Na1").combine()
  B = IndexBuilder(tpr, ['S312:OG','T313:OG1','A38:O','I41:O','A309:O'], offset=-9, 
                        out_ndx='Na1_site.ndx', name_all="Na1_site")
  B_grp, B_ndx = B.combine()                            
  all_ndx_files = [A_ndx, B_ndx]

To calculate the distance between "Na1" and the "Na1_site", create an instance with
the appropriate parameters and add them to a :class:`gromacs.analysis.Simulation` instance::

  dist_Na1_site = Distances(name='Dsite', groups=['Na1', 'Na1_site'], ndx=all_ndx_files)
  S.add_plugin(dist_Na1_site)

To calculate the individual distances::

  dist_Na1_res = Distances(name='Dres', groups=['Na1']+B.names, ndx=all_ndx_files)
  S.add_plugin(dist_Na1_res)

(Keeping the second IndexBuilder instance ``B`` allows us to directly
use all groups without typing them, ``B.names = ['A309_O', 'S312_OG', 'I41_O',
'T313_OG1', 'A38_O']``.)

Nested Classes [hide private]
  worker_class
actual plugin :class:`gromacs.analysis.core.Worker` class (name with leading underscore)
Instance Methods [hide private]

Inherited from core.Plugin: __init__, register

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables [hide private]

Inherited from core.Plugin: plugin_name, simulation, worker

Properties [hide private]

Inherited from object: __class__