amep.reader.GROMACSReader#
- class amep.reader.GROMACSReader(directory: str, savedir: str, start: float = 0.0, stop: float = 1.0, nth: int = 1, filename: str = 'traj.trr', topology: str = 'topol.tpr', maxmss: int = 20, dt: float = 1.0, trajfile: str = 'traj.h5amep', deleteold: bool = False, verbose: bool = False)#
Bases:
BaseReaderReads GROMACS files and writes the containing data to an hdf5 file.
Necessary files: The trajectory (or one frame) in the file format of .trr or .gro or similar (see chemfiles documentation https://chemfiles.org/ ) as well as a topology in the format of .tpr or similar are needed.
- Note: The molecule identification uses the bonds and a maximum molecule
search size maxmss with a default value of 20. If the molecules are not identified correctly, try increasing this value (up to the number of atoms of the larges molecule for example).
For very small trajectory files (such as the example file), the h5amep format is larger than the GROMACS files. This evens out for larger simulations.
- __init__(directory: str, savedir: str, start: float = 0.0, stop: float = 1.0, nth: int = 1, filename: str = 'traj.trr', topology: str = 'topol.tpr', maxmss: int = 20, dt: float = 1.0, trajfile: str = 'traj.h5amep', deleteold: bool = False, verbose: bool = False) None#
Reader for simulation data from GROMACS molecular dynamics simulations.
TODO in progress
- Parameters:
directory (str) – Simulation directory.
savedir (str) – Directory in which the trajectory file will be stored.
start (float, optional) – Start reading data from this fraction of the whole trajectory. Must be in [0,1). The default is 0.
stop (float, optional) – Stop reading data from this fraction of the whole trajectory. Must be in (0,1]. The default is 1.
nth (int, optional) – Read each nth dump file. The default is None.
filename (str, optional) – File name of the GROMACS trajectory file. The default is ‘traj.trr’.
topology (str, optional) – File name of the GROMACS topology file. The default is ‘topol.tpr’.
maxmss (int) – Maximum molecule search size. If the molecules are not identified correctly, try increasing this value up to the number of atoms of the larges molecule for example. Because GROMACS is storing connected atoms in proximity to each other, smaller values most often work as well. The default is 20.
dt (float, optional) – Timestep of the simulation. The GSD file format does only save the simulation step number but not the (physical) time. The default is 1.
trajfile (str, optional) – Name of the hdf5 trajectory file that is created when an object of this class is initialized. The default is TRAJFILENAME.
deleteold (bool, optional) – If True, an existing old h5amep trajectory file #<trajfile> will be removed. The default is False.
verbose (bool, optional) – If True, runtime information is printed. The default is False.
- Return type:
None.
Methods
__init__(directory, savedir[, start, stop, ...])Reader for simulation data from GROMACS molecular dynamics simulations.
Attributes
ddtThe path to the HDF5-file that contains the writers data.
nthsavedirstartThe array of simulation steps for each saved frame.
stopThe array of physical times for each saved frame.
- property filename: Path#
The path to the HDF5-file that contains the writers data.
- property steps: ndarray#
The array of simulation steps for each saved frame.
The simulation steps are also used to index the frame data in the HDF5-File.
- property times#
The array of physical times for each saved frame.