mstk.ommhelper.GroFile

class mstk.ommhelper.GroFile(file)

GroFile is a parser and writer for Gromacs .gro file.

GroFile extends GromacsGroFile from OpenMM python API by adding writing ability.

Parameters:

file (string) – the name of the file to load

Methods

__init__(file)

Load a .gro file.

getNumFrames()

Get the number of frames stored in the file.

getPeriodicBoxVectors([frame])

Get the vectors defining the periodic box.

getPositions([asNumpy, frame])

Get the atomic positions.

getUnitCellDimensions([frame])

Get the dimensions of the crystallographic unit cell.

writeFile(topology, positions, vectors, file)

Write positions (and optionally velocities) of atoms into a GRO file

static writeFile(topology, positions, vectors, file, time=None, subset=None, velocities=None)

Write positions (and optionally velocities) of atoms into a GRO file

It is possible to write a subset of atoms into the GRO file by providing subset argument.

Parameters:
  • topology (openmm.app.Topology) –

  • positions (array_like of shape (n_atom, 3)) – The length of positions should equal to the number of atoms in the topology, even when subset is provided.

  • vectors (array_like of shape (3, 3)) – The full box vectors.

  • file (str or FileIO) –

  • time (float) –

  • subset (list of int, optional) – If not provided, then all atoms will be written.

  • (n_atom (velocities array_like of shape) – The length of velocities should equal to the number of atoms in the topology, even when subset is provided. If not provided, then velocities information will not be written.

  • 3) – The length of velocities should equal to the number of atoms in the topology, even when subset is provided. If not provided, then velocities information will not be written.

  • optional – The length of velocities should equal to the number of atoms in the topology, even when subset is provided. If not provided, then velocities information will not be written.