GromacsTopFile

class openmm.app.gromacstopfile.GromacsTopFile(file, periodicBoxVectors=None, unitCellDimensions=None, includeDir=None, defines=None)

GromacsTopFile parses a Gromacs top file and constructs a Topology and (optionally) an OpenMM System from it.

__init__(file, periodicBoxVectors=None, unitCellDimensions=None, includeDir=None, defines=None)

Load a top file.

Parameters
  • file (str) – the name of the file to load

  • periodicBoxVectors (tuple of Vec3=None) – the vectors defining the periodic box

  • unitCellDimensions (Vec3=None) – the dimensions of the crystallographic unit cell. For non-rectangular unit cells, specify periodicBoxVectors instead.

  • includeDir (string=None) – A directory in which to look for other files included from the top file. If not specified, we will attempt to locate a gromacs installation on your system. When gromacs is installed in /usr/local, this will resolve to /usr/local/gromacs/share/gromacs/top

  • defines (dict={}) – preprocessor definitions that should be predefined when parsing the file

Methods

__init__(file[, periodicBoxVectors, …])

Load a top file.

createSystem([nonbondedMethod, …])

Construct an OpenMM System representing the topology described by this top file.

createSystem(nonbondedMethod=NoCutoff, nonbondedCutoff=Quantity(value=1.0, unit=nanometer), constraints=None, rigidWater=True, ewaldErrorTolerance=0.0005, removeCMMotion=True, hydrogenMass=None, switchDistance=None)

Construct an OpenMM System representing the topology described by this top file.

Parameters
  • nonbondedMethod (object=NoCutoff) – The method to use for nonbonded interactions. Allowed values are NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, PME, or LJPME.

  • nonbondedCutoff (distance=1*nanometer) – The cutoff distance to use for nonbonded interactions

  • constraints (object=None) – Specifies which bonds and angles should be implemented with constraints. Allowed values are None, HBonds, AllBonds, or HAngles. Regardless of this value, constraints that are explicitly specified in the top file will always be included.

  • rigidWater (boolean=True) – If true, water molecules will be fully rigid regardless of the value passed for the constraints argument

  • ewaldErrorTolerance (float=0.0005) – The error tolerance to use if nonbondedMethod is Ewald, PME or LJPME.

  • removeCMMotion (boolean=True) – If true, a CMMotionRemover will be added to the System

  • hydrogenMass (mass=None) – The mass to use for hydrogen atoms bound to heavy atoms. Any mass added to a hydrogen is subtracted from the heavy atom to keep their total mass the same. If rigidWater is used to make water molecules rigid, then water hydrogens are not altered.

  • switchDistance (float=None) – The distance at which the potential energy switching function is turned on for Lennard-Jones interactions. If this is None, no switching function will be used.

Returns

the newly created System

Return type

System