Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).
https://gromacswrapper.readthedocs.org
GNU General Public License v3.0
169 stars 53 forks source link

docs for how to use plugins #16

Closed orbeckst closed 7 years ago

orbeckst commented 10 years ago

Question: I just started using your gromacswrapper and I'm stucked with the energy plugin in gromacs.analysis. Could you sent me an example how it should work?

Answer: very briefly: follow the plugin example in spirit but using the energy plugin:

from gromacs.analysis import Simulation
from gromacs.analysis.plugins import Energy

S = Simulation(tpr="md.tpr", xtc="md.xtc", edr="md.edr", plugins=[Energy])
S.set_plugin("Energy")
S.run()
S.analyze()
S.plot()

If you set the current plugin then you don't have to provide the plugin name for run(), analyze(), and plot().

All data is stored with the plugin; you can get the actual object with

p = S.get_plugin('energy') 

or as the Simulation.current_plugin

p = S.current_plugin

Then look into the dict S.current_plugin.results — all plugins store their data in this place. In the case of Energy plugin it only contains a single item with key "Energy" that consists of an instance of the XVG class, which makes the contents of the xvg file available that is produced by g_energy.

In general, I suggest you play around in ipython and use the introspection feature (e.g. try TAB completion S.<TAB> to learn more.)

orbeckst commented 10 years ago

See also the Wiki page on analysis plugins.

Feel free to add to the wiki!

orbeckst commented 8 years ago

Just FYI: I don't think that the analysis plugins will see much further development and might become deprecated and eventually removed.

orbeckst commented 8 years ago

This issue will become moot with #82 (removal of plugins into a separate repo) and can then be handled there (depending on demand).

orbeckst commented 7 years ago

The plugins were removed in #82 so docs are now a problem in Becksteinlab/gromacswrapper.analysis#2