Package gromacs :: Package analysis :: Module core :: Class Plugin
[hide private]
[frames] | no frames]

Class Plugin

source code

object --+
         |
        Plugin

Plugin class that can be added to a :class:`Simulation` instance.

All analysis plugins must be derived from this base class.

If a :class:`Simulation` instance is provided to the constructore in the
*simulation* keyword argument then the plugin instantiates and registers a
worker class in :attr:`Simulation.plugins` and adds the :class:`Simulation`
instance to the worker.

Otherwise the :meth:`Plugin.register` method must be called explicitly with
a :class:`Simulation` instance.

The plugin class handles the administrative tasks of interfacing with the
:class:`Simulation` class. The worker runs the analysis.

.. Note:: If multiple Plugin instances are added to a Simulation one *must*
          set the *name* keyword argument to distinguish the
          instances. Plugins are referred to by this name in all further
          interactions with the user. There are no sanity checks:
          A newer plugin with the same *name* simply replaces the
          previous one.

Instance Methods [hide private]
 
__init__(self, name=None, simulation=None, **kwargs)
Registers the plugin with the simulation class.
source code
 
register(self, simulation)
Register the plugin with the :class:`Simulation` instance.
source code

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

Class Variables [hide private]
  worker_class = None
actual plugin :class:`gromacs.analysis.core.Worker` class (name with leading underscore)
Instance Variables [hide private]
  plugin_name
Name of the plugin; this must be a **unique** identifier across all plugins of a :class:`Simulation` object.
  worker
The :class:`Worker` instance of the plugin.
  simulation
The :class:`Simulation` instance who owns the plugin.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name=None, simulation=None, **kwargs)
(Constructor)

source code 
Registers the plugin with the simulation class.

Specific keyword arguments are listed below, all other kwargs
are passed through.

:Arguments:
   *name* : string
        Name of the plugin. Should differ for different
        instances. Defaults to the class name.
   *simulation* : Simulation instance
        The :class:`Simulation` instance that owns this plugin instance. Can be
        ``None`` but then the :meth:`register` method has to be called manually
        with a simulation instance later.
   *kwargs*
        All other keyword arguments are passed to the Worker.

Overrides: object.__init__

register(self, simulation)

source code 
Register the plugin with the :class:`Simulation` instance.

This method also ensures that the worker class knows the simulation
instance. This is typically required for its :meth:`~Worker.run`,
:meth:`~Worker.analyze`, and :meth:`~Worker.plot` methods.


Instance Variable Details [hide private]

plugin_name

Name of the plugin; this must be a **unique** identifier across all
plugins of a :class:`Simulation` object. It should also be human
understandable and must be a valid python identifier as it is used
as a dict key.

simulation

The :class:`Simulation` instance who owns the plugin. Can be ``None``
until a successful call to :meth:`~Plugin.register`.