OpenMM
 All Classes Namespaces Functions Variables Pages
GromacsGroFile Class Reference

GromacsGroFile parses a Gromacs .gro file and constructs a set of atom positions from it. More...

+ Inheritance diagram for GromacsGroFile:

Public Member Functions

def __init__
 Load a .gro file. More...
 
def getNumFrames
 Get the number of frames stored in the file. More...
 
def getPositions
 Get the atomic positions. More...
 
def getPeriodicBoxVectors
 Get the vectors defining the periodic box. More...
 
def getUnitCellDimensions
 Get the dimensions of the crystallographic unit cell. More...
 

Public Attributes

 positions
 The atom positions read from the file. More...
 
 elements
 A list containing the element of each atom stored in the file. More...
 
 atomNames
 A list containing the name of each atom stored in the file. More...
 
 residueIds
 A list containing the ID of the residue that each atom belongs to. More...
 
 residueNames
 A list containing the name of the residue that each atom belongs to. More...
 

Detailed Description

GromacsGroFile parses a Gromacs .gro file and constructs a set of atom positions from it.

A .gro file also contains some topological information, such as elements and residue names, but not enough to construct a full Topology object. This information is recorded and stored in the object's public fields.

Constructor & Destructor Documentation

def __init__ (   self,
  file 
)

Load a .gro file.

The atom positions can be retrieved by calling getPositions().

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

Member Function Documentation

def getNumFrames (   self)

Get the number of frames stored in the file.

References GromacsGroFile._positions.

def getPeriodicBoxVectors (   self,
  frame = 0 
)

Get the vectors defining the periodic box.

Parameters
frame(int=0) the index of the frame for which to get the box vectors

References GromacsGroFile._periodicBoxVectors.

def getPositions (   self,
  asNumpy = False,
  frame = 0 
)

Get the atomic positions.

Parameters
asNumpy(boolean=False) if true, the values are returned as a numpy array instead of a list of Vec3s
frame(int=0) the index of the frame for which to get positions

References AmberInpcrdFile._numpyPositions, GromacsGroFile._numpyPositions, and GromacsGroFile._positions.

def getUnitCellDimensions (   self,
  frame = 0 
)

Get the dimensions of the crystallographic unit cell.

Parameters
frame(int=0) the index of the frame for which to get the unit cell dimensions

References GromacsGroFile._periodicBoxVectors.

Member Data Documentation

atomNames

A list containing the name of each atom stored in the file.

elements

A list containing the element of each atom stored in the file.

positions

The atom positions read from the file.

If the file contains multiple frames, these are the positions in the first frame.

Referenced by Modeller.add(), Modeller.addExtraParticles(), Modeller.addHydrogens(), Modeller.addSolvent(), Modeller.convertWater(), Modeller.delete(), Modeller.getPositions(), and AmberInpcrdFile.getPositions().

residueIds

A list containing the ID of the residue that each atom belongs to.

residueNames

A list containing the name of the residue that each atom belongs to.


The documentation for this class was generated from the following file: