Topology

This class stores the information about your system’s topology, similarly to the topology file in Gromacs.

API Reference

class pmx.forcefield.Topology(filename, is_itp=None, ff=None, assign_types=True, self_contained=False, version='new')

Topology class.

Parameters
  • filename (str) – topology file

  • is_itp (bool) – whether the topology provided is an itp file. If not provided, this is automatically determined by the file extension (.itp vs .top).

  • assign_types (bool) – whether to assign types for the atoms in the Topology. Default is True.

  • self_contained (bool) – Whether the file contains all bonded and non-bonded parameters needed to simulate the system. This can be the case for some small-molecule topologies. If this is set to true, atomtypes are assigned to each atom without looking for a forcefield file.

  • ff (str, optional) – force field to use. If not provided, it is determined based on the forcefield.itp include statement in the top file. If you are providing an itp file without a reference to the force field, assign_types is True, and self_contained is False, then you have to provide a force field name, so that pmx will know where to look to assign atom and bond types.

  • version (str?) – what is version? is it still needed?

filename

name of the input topology file

Type

str

forcefield

forcefield included in the topology file, if present

Type

str

is_itp

whether the Topology is an itp file rather than top

Type

bool

include_itps

list of itp files included in the topology file, if present

Type

list

nrexcl

number of bonds between atoms from which to exclude interactions. See Gromacs manual.

Type

int

atoms

list of atoms

Type

list

residues

list of residues

Type

list

bonds

list of bonds

Type

list

have_constraints

whether constraints are present

Type

bool

constrains

list of constraints

Type

list

pairs

list of pairs

Type

list

cmap

list of cmap

Type

list

angles

list of angles

Type

list

dihedrals

list of dihedrals

Type

list

has_vsites2

whether vsites2 are present

Type

bool

has_vsites3

whether vsites3 are present

Type

bool

has_vsites4

whether vsites4 are present

Type

bool

virtual_sites2

list of vsites2

Type

list

virtual_sites3

list of vsites3

Type

list

virtual_sites4

list of vsites4

Type

list

has_posre

whether position restraints are present

Type

bool

posre

list of position restraints

Type

list

molecules

list of molecules

Type

list

system

name of system

Type

str

qA

net charge of state A

Type

float

qB

net charge of state B

Type

float

Methods

write(outfile[, stateBonded, stateTypes, …])

Writes the Topology to file.

get_qA()

Returns the total charge of state A.

get_qB()

Returns the total charge of state B.

get_hybrid_qA()

Returns the charge of state A for hybrid residues only.

get_hybrid_qB()

Returns the charge of state B for hybrid residues only.