1
2 """
3 ``analysis`` -- Analysis Package Overview
4 =========================================
5
6 The :mod:`gromacs.analysis` package is a framework for analyzing Gromacs MD
7 trajectories. The basic object is the :class:`Simulation` class. For a
8 particular project one has to derive a class from :class:`Simulation` and add
9 analysis plugin classes (from :mod:`gromacs.analysis.plugins`) for specific
10 analysis tasks. This is slightly cumbersome but flexible.
11
12 New analysis plugins should follow the API sketched out in
13 :mod:`gromacs.analysis.core`; see an example for use there.
14
15 Right now the number of plugins is limited and simply demonstrates how to use
16 the framework in principle. If you would like to contribute your own plugins
17 feel free to send then to the `package author`_. If they have been written
18 according to the API they will be added to the distribution and of course you
19 will be acknowledged in the list of plugin authors in
20 :mod:`gromacs.analysis.plugins`.
21
22 .. _`package author`: oliver.beckstein@bioch.ox.ac.uk
23
24
25 Simulation class
26 ----------------
27
28 The :class:`Simulation` class is central for doing analysis. The user can
29 derive a custom analysis class that pre-defines values for plugins as seen in
30 the `Example`_.
31
32 .. autoclass:: Simulation
33 :members: add_plugin, set_plugin, run, analyze, plot
34
35 Example
36 -------
37
38 Here we analyze a protein, which has three Cysteines (C96, C243, C372). We
39 will use the :class:`plugins.CysAccessibility` and the
40 :class:`plugins.Distances` plugin (arguments for ``Distances`` omitted)::
41
42 from gromacs.analysis import Simulation
43 from gromacs.analysis.plugins import CysAccessibility, Distances
44
45 S = Simulation(tpr=..., xtc=..., analysisdir=...,
46 plugins=[('CysAccessibility', {'cysteines': [96, 243, 372]}),
47 Distances(...),
48 ])
49 S.set_plugin('CysAccessibility') # do CysAccessibility analysis
50 S.run() # analyze trajectory and write files
51 S.analyze() # analyze output files
52 S.plot(figure=True) # plot and save the figure
53
54 The plugins can be supplied when the ``Simulation`` object is
55 constructed, or they can be later added, e.g. ::
56
57 S.add_plugin(Distances(name='Dist2', ...))
58
59 This second ``Distances`` analysis would be available with ::
60
61 S.set_plugin('Dist2')
62
63 Other plugins might require no or a very different initialization. See the
64 plugin documentation for what is required.
65 """
66
67 __docformat__ = "restructuredtext en"
68 __all__ = ['Simulation', 'plugins']
69
70 from core import Simulation
71 import plugins
72