Package gromacs :: Package analysis
[hide private]
[frames] | no frames]

Source Code for Package gromacs.analysis

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