Table Of Contents

Previous topic

Analysis core modules

Next topic

Analysis plugins

This Page

Support modules

Support modules contain code that simplifies working with Simulation instances. It also uses routines from numkit.

analysis.collections – Handling of groups of simulation instances

This module contains classes and functions that combine multiple gromacs.analysis.core.Simulation objects. In this way the same kind of analysis or plotting task can be carried out simultaneously for all simulations in the collection.

class gromacs.analysis.collections.Collection

Multiple objects (organized as a list).

Methods are applied to all objects in the Collection and returned as new Collection:

>>> from gromacs.analysis.collections import Collection
>>> animals = Collection(['ant', 'boar', 'ape', 'gnu'])
>>> animals.startswith('a')
Collection([True, False, True, False])

Similarly, attributes are returned as a Collection.

Using Collection.save() one can save the whole collection to disk and restore it later with the Collection.load() method

>>> animals.save('zoo')
>>> arc = Collection()
>>> arc.load('zoo')
>>> arc.load('zoo', append=True)
>>> arc
['ant', 'boar', 'ape', 'gnu', 'ant', 'boar', 'ape', 'gnu']