parmed.topologyobjects module¶
This module contains objects that deal with system topology and parameters, such as atoms, residues, bonds, angles, etc.
by Jason Swails
-
class
parmed.topologyobjects.
AcceptorDonor
(atom1, atom2)[source]¶ Bases:
object
Just a holder for donors and acceptors in CHARMM speak
-
class
parmed.topologyobjects.
AmoebaNonbondedExceptionType
(vdw_weight, multipole_weight, direct_weight, polar_weight, mutual_weight, list=None)[source]¶ Bases:
parmed.topologyobjects.NonbondedExceptionType
A parameter describing how the various nonbonded interactions between a particular pair of atoms is scaled in the AMOEBA force field
- Parameters
- vdw_weight
float
The scaling factor by which van der Waals interactions are multiplied
- multipole_weight
float
The scaling factor by which multipole interactions are multiplied
- direct_weight
float
The scaling factor by which direct-space interactions are multiplied
- polar_weight
float
The scaling factor by which polarization interactions are multiplied
- mutual_weight
float
The scaling factor by which mutual interactions are multiplied
- list
TrackedList
The list containing this nonbonded exception
- vdw_weight
- Attributes
- idx
- sigma
- uepsilon
- urmin
- usigma
-
class
parmed.topologyobjects.
Angle
(atom1, atom2, atom3, type=None)[source]¶ Bases:
object
A valence angle between 3 atoms separated by two covalent bonds.
- Parameters
Notes
An Angle can contain bonds or atoms. A bond is contained if it exists between atoms 1 and 2 or atoms 2 and 3.
Examples
>>> a1, a2, a3 = Atom(), Atom(), Atom() >>> angle = Angle(a1, a2, a3) >>> Bond(a1, a2) in angle and Bond(a3, a2) in angle True >>> a1 in angle and a2 in angle and a3 in angle True >>> Bond(a1, a3) in angle # this is not part of the angle definition False
Methods
delete
()Deletes this angle from the atoms that make it up.
energy
()Measures the current angle energy
measure
()Measures the current angle
uenergy
()Same as energy(), but with units
umeasure
()Same as measure(), but with units
-
delete
()[source]¶ Deletes this angle from the atoms that make it up. This method removes this angle from the angles list for atom1, atom2, and atom3 as well as removing each atom form each others’ angle partner lists
-
energy
()[source]¶ Measures the current angle energy
- Returns
- energyfloat or None
Angle strain energy in kcal/mol. Return value is None if either the coordinates of either atom is not set or the angle type is not set
-
class
parmed.topologyobjects.
AngleType
(k, theteq, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
An angle type with a set of angle parameters
- Parameters
- k
float
Force constant in kcal/mol/radians^2
- theteq
float
Equilibrium angle in Degrees
- list
TrackedList
A list of `AngleType`s in which this is a member
- k
Notes
Two AngleType`s are equal if their `k and theteq attributes are equal
Examples
>>> at1 = AngleType(10.0, 180.0) >>> at2 = AngleType(10.0, 180.0) >>> at1 is at2 False >>> at1 == at2 True >>> at1.idx # not part of any list or iterable -1
As part of a list, they can be indexed
>>> angle_list = [] >>> angle_list.append(AngleType(10.0, 180.0, list=angle_list)) >>> angle_list.append(AngleType(10.0, 180.0, list=angle_list)) >>> angle_list[0].idx 0 >>> angle_list[1].idx 1
- Attributes
- idx
- uk
- utheteq
-
property
uk
¶
-
property
utheteq
¶
-
class
parmed.topologyobjects.
Atom
(list=None, atomic_number=0, name='', type='', charge=None, mass=0.0, nb_idx=0, solvent_radius=0.0, screen=0.0, tree='BLA', join=0.0, irotat=0.0, occupancy=0.0, bfactor=0.0, altloc='', number=- 1, rmin=None, epsilon=None, rmin14=None, epsilon14=None)[source]¶ Bases:
parmed.topologyobjects._ListItem
An atom. Only use these as elements in AtomList instances, since AtomList will keep track of when indexes and other stuff needs to be updated. All parameters are optional.
- Parameters
- atomic_number
int
The atomic number of this atom
- name
str
The name of this atom
- type
str
The type name of this atom
- charge
float
The partial atomic charge of this atom in fractions of an electron
- mass
float
The atomic mass of this atom in daltons
- nb_idx
int
The nonbonded index. This is a pointer that is relevant in the context of an Amber topology file and identifies its Lennard-Jones atom type
- solvent_radius
float
The intrinsic solvation radius of this atom.
- screen
float
The Generalized Born screening factor for this atom.
- occupancy
float
The occupancy of the atom (see PDB file)
- bfactor
float
The B-factor of the atom (see PDB file)
- altloc
str
Alternate location indicator (see PDB file)
- atomic_number
- Other Parameters
- list
AtomList
The AtomList that this atom belongs to. If None, this atom does not belong to any list. This can be any iterable, but should typically be an AtomList or None
- tree
str
The tree chain identifier assigned to this atom. Relevant in the context of an Amber topology file, and not used for very much.
- join
int
The ‘join` property of atoms stored in the Amber topology file. At the time of writing this class, join is unused, but still oddly required. Add support for future-proofing
- irotat
int
The irotat property of atoms stored in the Amber topology file. Unused, but included for future-proofing.
- number
int
The serial number given to the atom (see PDB file)
- rmin
float
The Rmin/2 Lennard-Jones parameter for this atom. Default evaluates to 0
- epsilon
float
The epsilon (well depth) Lennard-Jones parameter for this atom. Default evaluates to 0
- rmin14
float
The Rmin/2 Lennard-Jones parameter for this atom in 1-4 interactions. Default evaluates to 0
- epsilon14
float
The epsilon (well depth) Lennard-Jones parameter for this atom in 1-4 interactions. Default evaluates to 0
- list
Notes
The bond_partners, angle_partners, dihedral_partners, and exclusion_partners arrays are actually generated as properties by taking differences of sets and sorting them. As a result, accessing this attribute constantly can be less efficient than you would expect. Iterating over them in a loop requires minimal overhead. But if frequent access is needed and these sets are guaranteed not to change, you should save a reference to the object and use that instead.
Binary comparisons are done by atom index and are used primarily for sorting sublists of atoms. The == operator is not defined, so Atom equality should be done using the is operator. This allows Atom instances to be hashable (and so used as dict keys and put in `set`s)
Examples
>>> a1 = Atom(name='CO', type='C', charge=0.5, mass=12.01) >>> a2 = Atom(name='OC', type='O', charge=-0.5, mass=12.01) >>> a1.bond_to(a2) >>> a1 in a2.bond_partners and a2 in a1.bond_partners True >>> a1.idx # Not part of a container -1
This object also supports automatic indexing when it is part of a container
>>> atom_list = [] >>> atom_list.append(Atom(list=atom_list, name='CO', charge=0.5)) >>> atom_list.append(Atom(list=atom_list, name='OC', charge=-0.5)) >>> atom_list[0].idx 0 >>> atom_list[1].idx 1
- Attributes
angle_partners
List of all angle partners that are NOT bond partners
bond_partners
Go through all bonded partners
- charge
dihedral_partners
List of all dihedral partners that are NOT angle or bond partners
- element
- element_name
epsilon
Lennard-Jones epsilon parameter (the Lennard-Jones well depth)
epsilon_14
The 1-4 Lennard-Jones epsilon parameter
exclusion_partners
List of all exclusions not otherwise excluded by bonds/angles/torsions
- idx
rmin
Lennard-Jones Rmin/2 parameter (the Lennard-Jones radius)
rmin_14
The 1-4 Lennard-Jones Rmin/2 parameter
sigma
Lennard-Jones sigma parameter – directly related to Rmin
sigma_14
Lennard-Jones sigma parameter – directly related to Rmin
tortor_partners
List of all 1-5 partners that are NOT in angle or bond partners.
ucharge
Charge with units
uepsilon
Lennard-Jones epsilon parameter with units
uepsilon_14
The 1-4 Lennard-Jones epsilon parameter
- umass
urmin
Lennard-Jones Rmin/2 parameter with units
urmin_14
The 1-4 Lennard-Jones Rmin/2 parameter with units
usigma
Lennard-Jones sigma parameter with units
usigma_14
The 1-4 Lennard-Jones sigma parameter with units
usolvent_radius
Solvation radius with units attached
Methods
angle_to
(other)Log this atom as angled to another atom.
bond_to
(other)Log this atom as bonded to another atom.
dihedral_to
(other)Log this atom as dihedral-ed to another atom.
exclude
(other)Add one atom to my arbitrary exclusion list
nonbonded_exclusions
([only_greater, index_from])Returns the total number of nonbonded atom exclusions for this atom.
For extra points, the exclusion partners may be filled before the bond, angle, dihedral, and tortor partners.
tortor_to
(other)Log this atom as 1-5 partners to another atom
-
property
angle_partners
¶ List of all angle partners that are NOT bond partners
-
angle_to
(other)[source]¶ Log this atom as angled to another atom.
- Parameters
- other
Atom
An atom that will be added to angle_partners
- other
Notes
This action adds self to other.angle_partners. Raises
MoleculeError
if other is self
-
property
bond_partners
¶ Go through all bonded partners
-
bond_to
(other)[source]¶ Log this atom as bonded to another atom.
- Parameters
- other
Atom
An atom that will be added to bond_partners
- other
Notes
This action adds self to other.bond_partners. Raises
MoleculeError
if other is self
-
property
charge
¶
-
property
dihedral_partners
¶ List of all dihedral partners that are NOT angle or bond partners
-
dihedral_to
(other)[source]¶ Log this atom as dihedral-ed to another atom.
- Parameters
- other
Atom
An atom that will be added to dihedral_partners
- other
Notes
This action adds self to other.dihedral_partners. Raises
MoleculeError
if other is self
-
property
element
¶
-
property
element_name
¶
-
property
epsilon
¶ Lennard-Jones epsilon parameter (the Lennard-Jones well depth)
-
property
epsilon_14
¶ The 1-4 Lennard-Jones epsilon parameter
-
exclude
(other)[source]¶ Add one atom to my arbitrary exclusion list
- Parameters
- other
Atom
An atom that will be added to exclusion_partners.
- other
Notes
This action adds self to other.exclusion_partners. Raises
MoleculeError
if other is self
-
property
exclusion_partners
¶ List of all exclusions not otherwise excluded by bonds/angles/torsions
-
nonbonded_exclusions
(only_greater=True, index_from=0)[source]¶ Returns the total number of nonbonded atom exclusions for this atom. The general rules for building the exclusion list is to include both exceptions AND exclusions (i.e., the Amber scaling of 1-4 interactions means that the 1-4 terms are excluded and a special pairlist is built to handle those exceptions).
All atoms in the _partners arrays are nonbonded exclusions.
- Parameters
- only_greater
bool
, optional If True (default), only atoms whose idx value is greater than this Atom`s `idx will be counted as an exclusion (to avoid double- counting exclusions). If False, all exclusions will be counted.
- index_from
int
, optional This is the index of the first atom, and is intended to be 0 (for C- and Python-style numbering, default) or 1 (for Fortran-style numbering, such as that used in the Amber and CHARMM topology files)
- only_greater
- Returns
list of int
The returned list will be the atom indexes of the exclusion partners for this atom (indexing starts from
index_from
)
Notes
If this instance’s idx attribute evaluates to -1 – meaning it is not in an AtomList – a IndexError will be raised. If you have two extra points (i.e., those with atomic numbers of 0) bonded to each other, this routine may raise a
RuntimeError
if the recursion depth is exceeded.
-
prune_exclusions
()[source]¶ For extra points, the exclusion partners may be filled before the bond, angle, dihedral, and tortor partners. Since we don’t want memory of these exclusions if any of those topological features were to break, we want to remove those from the exclusion list. This function makes sure that nothing in the bond, angle, dihedral, and tortor lists appears in the exclusion list.
-
property
rmin
¶ Lennard-Jones Rmin/2 parameter (the Lennard-Jones radius)
-
property
rmin_14
¶ The 1-4 Lennard-Jones Rmin/2 parameter
-
property
sigma
¶ Lennard-Jones sigma parameter – directly related to Rmin
-
property
sigma_14
¶ Lennard-Jones sigma parameter – directly related to Rmin
-
property
tortor_partners
¶ List of all 1-5 partners that are NOT in angle or bond partners. This is only used in the Amoeba force field
-
tortor_to
(other)[source]¶ Log this atom as 1-5 partners to another atom
- Parameters
- other
Atom
An atom that will be added to tortor_partners
- other
Notes
This action adds self to other.tortor_partners. Raises
MoleculeError
if other is self
-
property
ucharge
¶ Charge with units
-
property
uepsilon
¶ Lennard-Jones epsilon parameter with units
-
property
uepsilon_14
¶ The 1-4 Lennard-Jones epsilon parameter
-
property
umass
¶
-
property
urmin
¶ Lennard-Jones Rmin/2 parameter with units
-
property
urmin_14
¶ The 1-4 Lennard-Jones Rmin/2 parameter with units
-
property
usigma
¶ Lennard-Jones sigma parameter with units
-
property
usigma_14
¶ The 1-4 Lennard-Jones sigma parameter with units
-
property
usolvent_radius
¶ Solvation radius with units attached
-
class
parmed.topologyobjects.
AtomList
(*args)[source]¶ Bases:
parmed.topologyobjects.TrackedList
Array of Atoms
Notes
Deleting an atom from the AtomList also deletes that atom from the residue it belongs to.
Methods
Assigns the nb_idx attribute of every atom inside here from the atom_type definition.
claim
()This method causes this list to “claim” all of the items it contains and subsequently indexes all of its items.
clear
(/)Remove all items from list.
copy
(/)Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
find_original_index
(idx)Finds an atom with the given original index.
index
(value[, start, stop])Return first index of value.
index_members
()Assigns the idx variable for every member of this list to its place in the list, if the members of this list permit
prune_unused
()This method inspects the used attribute of all of its members, if it has one, and deletes any item in which it is set to False
reverse
(/)Reverse IN PLACE.
sort
(*[, key, reverse])Stable sort IN PLACE.
unmark
()Unmark all atoms in this list
append
extend
insert
pop
remove
-
assign_nbidx_from_types
()[source]¶ Assigns the nb_idx attribute of every atom inside here from the atom_type definition. If the atom_type is not assigned, RuntimeError is raised.
- Returns
list of dict
Each element is a set of the nb_idx indices for which NBFIX alterations are defined for the type with that given that index (minus 1, to adjust for indexing from 0 and nb_idx starting from 1)
-
find_original_index
(idx)[source]¶ Finds an atom with the given original index. Cannot assume that the original indexes are in order, since reordering may have been necessary. As a result, the complexity of this algorithm is O(N)
- Parameters
- idxint
The integer corresponding to the original index
- Returns
- atom
Atom
The atom with the original index
idx
- atom
- Raises
- IndexError
If no atom has the original index
idx
-
pop
(*args, **kwargs)[source]¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
-
class
parmed.topologyobjects.
AtomType
(name, number, mass, atomic_number=- 1, bond_type=None, charge=0.0)[source]¶ Bases:
object
Atom types can either be compared by indexes or names. Can be assigned with a string, integer, (string is not automatically cast) or with both.
- Parameters
- name
str
The name of the atom type
- number
int
The serial index of the atom type
- mass
float
The mass of the atom type
- atomic_number
int
, optional The atomic number of the element of the atom type. Default -1
- bond_type
str
, optional If defined, this is the type name used to look up bonded parameters. Default is None (which falls back to
name
)- charge
float
, optional If defined, this is the partial atomic charge in elementary charge units. Default is None
- name
Notes
This object is primarily used to build parameter databases from parameter files. Also, sigma is related to Rmin, but rmin is Rmin/2, so there is an extra factor of 2 in the sigma for this reason.
Examples
>>> at = AtomType('HA', 1, 1.008, 1) >>> at.name, at.number ('HA', 1) >>> at2 = AtomType('CA', 2, 12.01, 6) >>> at2.name, at2.number ('CA', 2) >>> print("%s: %d" % (str(at), int(at))) HA: 1
- Attributes
Methods
add_nbfix
(typename, rmin, epsilon[, rmin14, …])Adds a new NBFIX exclusion for this atom type
set_lj_params
(eps, rmin[, eps14, rmin14])Sets Lennard-Jones parameters on this atom type
-
add_nbfix
(typename, rmin, epsilon, rmin14=None, epsilon14=None)[source]¶ Adds a new NBFIX exclusion for this atom type
- Parameters
- typenamestr
The name of the other type with which this NBFIX is defined
- rminfloat
The combined Rmin value for this NBFIXed pair. If no units, assumed to be in Angstroms
- epsilonfloat
The combined epsilon value for this NBFIXed pair. If no units, assumed to be in kcal/mol
- rmin14float, optional
Same as rmin, but for 1-4 interactions. If None (default), it is given the same value as rmin
- epsilon14float, optional
Same as epsilon, but for 1-4 interactions. If None (default), it is given the same value as rmin
-
property
bond_type
¶
-
set_lj_params
(eps, rmin, eps14=None, rmin14=None)[source]¶ Sets Lennard-Jones parameters on this atom type
-
property
sigma
¶ Sigma is Rmin / 2^(1/6)
-
property
sigma_14
¶ Sigma is Rmin / 2^(1/6)
-
property
uepsilon
¶
-
property
uepsilon_14
¶
-
property
urmin
¶
-
property
urmin_14
¶
-
property
usigma
¶
-
property
usigma_14
¶
-
class
parmed.topologyobjects.
Bond
(atom1, atom2, type=None, order=1.0)[source]¶ Bases:
object
A covalent bond connecting two atoms.
- Parameters
- atom1
Atom
The first atom involved in the bond
- atom2
Atom
The other atom involved in the bond
- type
BondType
or None, optional The bond type that defines the parameters for this bond. Default is None
- orderfloat, optional
- The bond order of this bond. Bonds are classified as follows:
1.0 – single bond 2.0 – double bond 3.0 – triple bond 1.5 – aromatic bond 1.25 – amide bond
Default is 1.0
- atom1
Notes
You can test whether an
Atom
is contained within the bond using the in operator. A MoleculeError is raised if atom1 and atom2 are identical. This bond instance is append`ed to the `bonds list for both atom1 and atom2 and is automatically removed from those lists upon garbage collectionExamples
>>> a1, a2 = Atom(), Atom() >>> bond = Bond(a1, a2) >>> a1 in bond and a2 in bond True
- Attributes
order
Bond order.
Methods
delete
()Deletes this bond from the atoms that make it up.
energy
()Measures the current bond energy
measure
()Measures the current bond
uenergy
()Same as energy(), but with units
umeasure
()Same as “measure”, but with units
-
delete
()[source]¶ Deletes this bond from the atoms that make it up. This method removes this bond from the bonds list for both atom1 and atom2 as well as removing atom1 from atom2.bond_partners and vice versa.
-
energy
()[source]¶ Measures the current bond energy
- Returns
- energyfloat or None
Bond strain energy in kcal/mol. Return value is None if either the coordinates of either atom is not set or the bond type is not set
-
class
parmed.topologyobjects.
BondType
(k, req, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A bond type with a set of bond parameters
- Parameters
- k
float
Force constant in kcal/mol/Angstrom^2
- req
float
Equilibrium bond distance in Angstroms
- list
TrackedList
A list of :class:`BondType`s in which this is a member
- k
Notes
Two BondType`s are equal if their `k and req attributes are equal
Examples
>>> bt1 = BondType(10.0, 1.0) >>> bt2 = BondType(10.0, 1.0) >>> bt1 is bt2 False >>> bt1 == bt2 True >>> bt1.idx # Not in a list or container -1
As part of a list, they can be indexed
>>> bond_list = [] >>> bond_list.append(BondType(10.0, 1.0, list=bond_list)) >>> bond_list.append(BondType(10.0, 1.0, list=bond_list)) >>> bond_list[0].idx 0 >>> bond_list[1].idx 1
- Attributes
- idx
- uk
- ureq
-
property
uk
¶
-
property
ureq
¶
-
class
parmed.topologyobjects.
ChiralFrame
(atom1, atom2, chirality)[source]¶ Bases:
object
A chiral frame as defined in the AMOEBA force field. It defines the frame of reference for a chiral center
- Parameters
Notes
A chiral frame can only contain atoms.
-
class
parmed.topologyobjects.
Cmap
(atom1, atom2, atom3, atom4, atom5, type=None)[source]¶ Bases:
object
A coupled-torsion correction map term defined between 5 atoms connected by four covalent bonds. This is a coupled-torsion potential in which the torsions are consecutive.
- Parameters
- atom1
Atom
An atom on one end of the valence coupled-torsion bonded to atom2
- atom2
Atom
An atom in the middle of the CMAP bonded to atoms 1 and 3
- atom3
Atom
An atom in the middle of the CMAP bonded to atoms 2 and 4
- atom4
Atom
An atom in the middle of the CMAP bonded to atoms 3 and 5
- atom5
Atom
An atom in the middle of the CMAP bonded to atom 4
- type
CmapType
The CmapType object containing the parameter map for this term
- atom1
Notes
A CMAP can contain bonds or atoms. A bond is contained if it exists between atoms 1 and 2, between atoms 2 and 3, between atoms 3 and 4, or between atoms 4 and 5.
Examples
>>> a1, a2, a3, a4, a5 = Atom(), Atom(), Atom(), Atom(), Atom() >>> cmap = Cmap(a1, a2, a3, a4, a5) >>> Bond(a1, a2) in cmap and Bond(a2, a3) in cmap True >>> Bond(a1, a3) in cmap False
Methods
delete
()Deletes this Cmap from the atoms that make it up.
extended
(atom1, atom2, atom3, atom4, atom5, …)Alternative constructor for correction maps defined with 8 atoms (each torsion being separately specified).
same_atoms
(thing)A coupled-torsion is equivalent if the 5 atoms are in the same or reverse order Allow comparison with another type of cmap or with a sequence of 5 indexes
-
delete
()[source]¶ Deletes this Cmap from the atoms that make it up. This method removes the Cmap from the cmaps list for atom1, atom2, atom3, atom4, and atom5
-
classmethod
extended
(atom1, atom2, atom3, atom4, atom5, atom6, atom7, atom8, type=None)[source]¶ Alternative constructor for correction maps defined with 8 atoms (each torsion being separately specified). Correction maps are, to the best of my knowledge, used to parametrized “consecutive” torsions (i.e., atoms 2, 3, and 4 are common to both torsions). However, the CHARMM definition specifies the torsions separately.
If the torsions are _not_ consecutive (i.e., if atoms 2, 3, and 4 are not the same as atoms 5, 6, and 7), NotImplementedError is raised.
- Parameters
- atom1
Atom
The first atom of the first torsion
- atom2
Atom
The second atom of the first torsion
- atom3
Atom
The third atom of the first torsion
- atom4
Atom
The fourth atom of the first torsion
- atom5
Atom
The first atom of the second torsion
- atom6
Atom
The second atom of the second torsion
- atom7
Atom
The third atom of the second torsion
- atom8
Atom
The fourth atom of the second torsion
- type
CmapType
The CmapType object containing the parameter map for this term
- atom1
-
class
parmed.topologyobjects.
CmapType
(resolution, grid, comments=None, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A CMAP type with a potential energy interpoloation grid mapping out the 2-D potential of coupled torsions.
- Parameters
- resolution
int
The number of grid points in the correction map potential in both torsion dimensions
- grid
iterable of floats
This must be a 1-dimensional list of grid values. The dimension must be resolution*resolution, and must be row-major (i.e., the second dimension changes the fastest) when indexed with 2 indices.
- list
TrackedList
A list of `CmapType`s in which this is a member
- resolution
- Raises
- TypeError is raised if the grid does not have the correct number of elements
- for the given resolution
Notes
Two `CmapType`s are equal if their resolution is the same and each grid point is the same to within 1E-8
See the docs for _CmapGrid for information on how to access the interpolating grid data if necessary.
Examples
>>> ct = CmapType(2, [0, 1, 2, 3]) >>> ct.grid[0,0], ct.grid[0] (0, 0) >>> ct.grid[0,1], ct.grid[1] (1, 1) >>> ct.grid[1,0], ct.grid[2] (2, 2) >>> ct.grid[1,1], ct.grid[3] (3, 3) >>> ct.idx # not part of a list or iterable -1
- Attributes
- resolution
int
Potential grid resolution (see description in Parameters)
- grid
_CmapGrid
A _CmapGrid object defining the interpolating potential energy grid, with each point having the units kcal/mol
- comments
list(str)
List of strings that represent comments about this parameter type
- list
TrackedList
If not None, this is a list in which this instance _may_ be a member
- idx
int
The index of this CmapType inside its containing list
- resolution
-
class
parmed.topologyobjects.
Dihedral
(atom1, atom2, atom3, atom4, improper=False, ignore_end=False, type=None)[source]¶ Bases:
parmed.topologyobjects._FourAtomTerm
A valence dihedral between 4 atoms separated by three covalent bonds.
- Parameters
- atom1
Atom
An atom on one end of the valence dihedral bonded to atom 2
- atom2
Atom
An atom in the middle of the valence dihedral bonded to atom1 and atom3
- atom3
Atom
An atom in the middle of the valence dihedral bonded to atom2 and atom4
- atom4
Atom
An atom on the other end of the valence dihedral bonded to atom 3
- improper
bool
If True, this is an Amber-style improper torsion, where atom3 is the “central” atom bonded to atoms 1, 2, and 4 (atoms 1, 2, and 4 are only bonded to atom 3 in this instance)
- ignore_end
bool
If True, the end-group interactions for this torsion are ignored, either because it is involved in a ring where the end-group atoms are excluded or because it is one term in a multi-term dihedral expansion
- type
DihedralType
The DihedralType object containing the parameters for this dihedral
- atom1
Notes
A Dihedral can contain bonds or atoms. A bond is contained if it exists between atoms 1 and 2, between atoms 2 and 3, or between atoms 3 and 4.
Examples
>>> a1, a2, a3, a4 = Atom(), Atom(), Atom(), Atom() >>> dihed = Dihedral(a1, a2, a3, a4) >>> Bond(a1,a2) in dihed and Bond(a3,a2) in dihed and Bond(a3,a4) in dihed True >>> a1 in dihed and a2 in dihed and a3 in dihed and a4 in dihed True >>> Bond(a1, a4) in dihed # this is not part of the angle definition False
For improper torsions, the bond pattern is different
>>> a1, a2, a3, a4 = Atom(), Atom(), Atom(), Atom() >>> dihed = Dihedral(a1, a2, a3, a4, improper=True) >>> Bond(a1,a3) in dihed and Bond(a2,a3) in dihed and Bond(a3,a4) in dihed True >>> Bond(a1,a2) in dihed # Not like a normal dihedral! False >>> a1 in dihed and a2 in dihed and a3 in dihed and a4 in dihed True
- Attributes
- funct
Methods
delete
()Deletes this dihedral from the atoms that make it up.
energy
()Measures the current dihedral angle energy
measure
()Measures the current dihedral angle
same_atoms
(thing)Determines if this dihedral has the same atoms (or atom indexes) as another object
uenergy
()Same as energy(), but with units
umeasure
()Same as measure(), but with units
-
delete
()[source]¶ Deletes this dihedral from the atoms that make it up. This method removes this dihedral from the dihedrals list for atom1, atom2, atom3, and atom4 as well as removing each atom form each others’ dihedral partner lists
-
energy
()[source]¶ Measures the current dihedral angle energy
- Returns
- energyfloat or None
Dihedral angle energy in kcal/mol. Return value is None if either the coordinates of either atom is not set or the angle type is not set
-
property
funct
¶
-
measure
()[source]¶ Measures the current dihedral angle
- Returns
- measurementfloat or None
If the atoms have coordinates, returns the dihedral angle between the four atoms in degrees. If any coordinates are missing, returns None
-
same_atoms
(thing)[source]¶ Determines if this dihedral has the same atoms (or atom indexes) as another object
- Parameters
- thing
Dihedral
or otheriterable
A Dihedral or an iterable with 4 indexes that will be used to identify whether this torsion has the same atoms
- thing
- Returns
- is_same
bool
True if
thing
andself
have the same atoms.False
otherwise
- is_same
- Raises
- TypeError
Notes
This raises a
TypeError
if thing is not a Dihedral and is not iterable
-
class
parmed.topologyobjects.
DihedralType
(phi_k, per, phase, scee=1.0, scnb=1.0, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A dihedral type with a set of dihedral parameters
- Parameters
- phi_k
float
The force constant in kcal/mol
- per
int
The dihedral periodicity
- phase
float
The dihedral phase in degrees
- scee
float
, optional 1-4 electrostatic scaling factor. Default is 1.0
- scnb
float
, optional 1-4 Lennard-Jones scaling factor. Default is 1.0
- list
TrackedList
A list of `DihedralType`s in which this is a member
- phi_k
Notes
Two
DihedralType`s are equal if their `phi_k
, per, phase, scee, and scnb attributes are equalExamples
>>> dt1 = DihedralType(10.0, 2, 180.0, 1.2, 2.0) >>> dt2 = DihedralType(10.0, 2, 180.0, 1.2, 2.0) >>> dt1 is dt2 False >>> dt1 == dt2 True >>> dt1.idx # not part of any list or iterable -1
As part of a list, they can be indexed
>>> dihedral_list = [] >>> dihedral_list.append(DihedralType(10.0, 2, 180.0, 1.2, 2.0, ... list=dihedral_list)) >>> dihedral_list.append(DihedralType(10.0, 2, 180.0, 1.2, 2.0, ... list=dihedral_list)) >>> dihedral_list[0].idx 0 >>> dihedral_list[1].idx 1
- Attributes
- idx
- uphase
- uphi_k
-
property
uphase
¶
-
property
uphi_k
¶
-
class
parmed.topologyobjects.
DihedralTypeList
(*args, **kwargs)[source]¶ Bases:
list
,parmed.topologyobjects._ListItem
Dihedral types are a Fourier expansion of terms. In some cases, they are stored in a list like this one inside another TrackedList. In other cases, each term is a separate entry in the
TrackedList
.In cases where DihedralType`s are stored with every term in the same container, this object supports list assignment and indexing like :class:`DihedralType.
- Parameters
- *argsobjects
Any arguments that
list
would take.- listTrackedList, optional
A list that “contains” this DihedralTypeList instance. This is a keyword-only argument. Default is
None
(i.e., belonging to no list)- **kwargskeyword argument list
All other keyword arguments passed directly to the
list
constructor
- Attributes
- idx
- penalty
Methods
append
(other[, override])Adds a DihedralType to the DihedralTypeList
clear
(/)Remove all items from list.
copy
(/)Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
extend
(iterable, /)Extend list by appending elements from the iterable.
from_rbtorsion
(rbtorsion)Creates a Fourier series of proper torsions from a Ryckaerts-Bellemans torsion.
index
(value[, start, stop])Return first index of value.
insert
(index, object, /)Insert object before index.
pop
([index])Remove and return item at index (default last).
remove
(value, /)Remove first occurrence of value.
reverse
(/)Reverse IN PLACE.
sort
(*[, key, reverse])Stable sort IN PLACE.
-
append
(other, override=False)[source]¶ Adds a DihedralType to the DihedralTypeList
- Parameters
- other
DihedralType
The DihedralType instance to add to this list. It cannot have the same periodicity as any other DihedralType in the list
- overridebool, optional, default=False
If True, this will override an existing torsion, but will raise a warning if it does so
- other
- Raises
- TypeError if other is not an instance of
DihedralTypeList
- ParameterError if other has the same periodicity as another member in
- this list and override is False
- ParameterWarning if other has same periodicit as another member in this
- list and override is True
- TypeError if other is not an instance of
-
classmethod
from_rbtorsion
(rbtorsion)[source]¶ Creates a Fourier series of proper torsions from a Ryckaerts-Bellemans torsion.
- Parameters
- rbtorsionRBTorsionType
The R-B torsion type to convert to a series of proper torsions
- Raises
- ValueError if all terms in rbtorsion are zero except for c0
-
property
penalty
¶
-
class
parmed.topologyobjects.
DrudeAnisotropy
(atom1, atom2, atom3, atom4, a11, a22)[source]¶ Bases:
parmed.topologyobjects._FourAtomTerm
A description of an anisotropically polarizable atom.
Atom 1 is a
DrudeAtom
whose polarizability is anisotropic. The other three atoms define the coordinate frame.- Parameters
- atom1
DrudeAtom
the polarizable atom
- atom2
Atom
the second atom defining the coordinate frame
- atom3
Atom
the third atom defining the coordinate frame
- atom4
Atom
the fourth atom defining the coordinate frame
- a11
float
the scale factor for the polarizability along the direction defined by atom1 and atom2
- a22
float
the scale factor for the polarizability along the direction defined by atom3 and atom4
- atom1
Methods
delete
()Sets all atoms in this term to None, and its type if it exists
-
class
parmed.topologyobjects.
DrudeAtom
(alpha=0.0, thole=1.3, drude_type='DRUD', **kwargs)[source]¶ Bases:
parmed.topologyobjects.Atom
An Atom that has a Drude particle attached to it. This is a subclass of Atom, so it also has all the properties defined for regular Atoms.
- Parameters
- alpha
float
the atomic polarizability
- thole
float
the Thole damping facior
- drude_type
str
the atom type to use for the Drude particle.
- alpha
- Attributes
angle_partners
List of all angle partners that are NOT bond partners
bond_partners
Go through all bonded partners
- charge
dihedral_partners
List of all dihedral partners that are NOT angle or bond partners
- drude_charge
- element
- element_name
epsilon
Lennard-Jones epsilon parameter (the Lennard-Jones well depth)
epsilon_14
The 1-4 Lennard-Jones epsilon parameter
exclusion_partners
List of all exclusions not otherwise excluded by bonds/angles/torsions
- idx
rmin
Lennard-Jones Rmin/2 parameter (the Lennard-Jones radius)
rmin_14
The 1-4 Lennard-Jones Rmin/2 parameter
sigma
Lennard-Jones sigma parameter – directly related to Rmin
sigma_14
Lennard-Jones sigma parameter – directly related to Rmin
tortor_partners
List of all 1-5 partners that are NOT in angle or bond partners.
ucharge
Charge with units
uepsilon
Lennard-Jones epsilon parameter with units
uepsilon_14
The 1-4 Lennard-Jones epsilon parameter
- umass
urmin
Lennard-Jones Rmin/2 parameter with units
urmin_14
The 1-4 Lennard-Jones Rmin/2 parameter with units
usigma
Lennard-Jones sigma parameter with units
usigma_14
The 1-4 Lennard-Jones sigma parameter with units
usolvent_radius
Solvation radius with units attached
Methods
angle_to
(other)Log this atom as angled to another atom.
bond_to
(other)Log this atom as bonded to another atom.
dihedral_to
(other)Log this atom as dihedral-ed to another atom.
exclude
(other)Add one atom to my arbitrary exclusion list
nonbonded_exclusions
([only_greater, index_from])Returns the total number of nonbonded atom exclusions for this atom.
prune_exclusions
()For extra points, the exclusion partners may be filled before the bond, angle, dihedral, and tortor partners.
tortor_to
(other)Log this atom as 1-5 partners to another atom
-
property
drude_charge
¶
-
class
parmed.topologyobjects.
ExtraPoint
(*args, **kwargs)[source]¶ Bases:
parmed.topologyobjects.Atom
An extra point is a massless, virtual site that is used to extend the flexibility of partial atomic charge fitting. They can be used to, for instance, give atoms permanent multipoles in a fixed-charge format.
However, virtual sites are massless particles whose position is fixed with respect to a particular frame of reference. As a result, they must be treated specially when running dynamics. This class extends the Atom class with extra functionality specific to these “Extra points” or “virtual sites”. See the documentation for the
Atom
class for more information.- Parameters
- weightslist of float, optional, keyword-only
This is the list of weights defining its frame.
See also
Atom
The ExtraPoint constructor also takes all Atom arguments as well, and shares all of the same properties
- Attributes
angle_partners
List of all atoms angled to this atom and its parent
bond_partners
List of all atoms bonded to this atom and its parent
- charge
dihedral_partners
List of all dihedral partners that are NOT angle or bond partners
- element
- element_name
epsilon
Lennard-Jones epsilon parameter (the Lennard-Jones well depth)
epsilon_14
The 1-4 Lennard-Jones epsilon parameter
exclusion_partners
List of all exclusions not otherwise excluded by bonds/angles/torsions
frame_type
The type of frame used for this extra point.
- idx
parent
The parent atom of this extra point is the atom it is bonded to (there
- radii
rmin
Lennard-Jones Rmin/2 parameter (the Lennard-Jones radius)
rmin_14
The 1-4 Lennard-Jones Rmin/2 parameter
sigma
Lennard-Jones sigma parameter – directly related to Rmin
sigma_14
Lennard-Jones sigma parameter – directly related to Rmin
tortor_partners
List of all 1-5 partners that are NOT in angle or bond partners.
ucharge
Charge with units
uepsilon
Lennard-Jones epsilon parameter with units
uepsilon_14
The 1-4 Lennard-Jones epsilon parameter
- umass
urmin
Lennard-Jones Rmin/2 parameter with units
urmin_14
The 1-4 Lennard-Jones Rmin/2 parameter with units
usigma
Lennard-Jones sigma parameter with units
usigma_14
The 1-4 Lennard-Jones sigma parameter with units
usolvent_radius
Solvation radius with units attached
Methods
angle_to
(other)Log this atom as angled to another atom.
bond_to
(other)Log this atom as bonded to another atom.
dihedral_to
(other)Log this atom as dihedral-ed to another atom.
exclude
(other)Add one atom to my arbitrary exclusion list
nonbonded_exclusions
([only_greater, index_from])Returns the total number of nonbonded atom exclusions for this atom.
prune_exclusions
()For extra points, the exclusion partners may be filled before the bond, angle, dihedral, and tortor partners.
tortor_to
(other)Log this atom as 1-5 partners to another atom
-
property
angle_partners
¶ List of all atoms angled to this atom and its parent
-
property
bond_partners
¶ List of all atoms bonded to this atom and its parent
-
property
dihedral_partners
¶ List of all dihedral partners that are NOT angle or bond partners
-
property
exclusion_partners
¶ List of all exclusions not otherwise excluded by bonds/angles/torsions
-
property
frame_type
¶ The type of frame used for this extra point. Whether the EP lies beyond (outside) or between (inside) the is determined from the positions of each atom in the frame and the extra point. If those are not set, the EP is assumed to be between the two points in the frame
-
property
parent
¶ The parent atom of this extra point is the atom it is bonded to (there should only be 1 bond partner, but the parent is defined as its first)
-
property
radii
¶
-
property
tortor_partners
¶ List of all 1-5 partners that are NOT in angle or bond partners. This is only used in the Amoeba force field
-
class
parmed.topologyobjects.
Group
(atom, type, move)[source]¶ Bases:
object
An ‘interacting’ group defined by CHARMM PSF files
- Parameters
- atom
Atom
The first atom within a group
- type
int
Flag for group information; 0 when all atoms have zero charge, 1 when group has a net zero charge but at least one atom has a non-zero partial charge, 2 when the net charge of the group is not zero
- move
int
0 if the atoms are not fixed, 1 when they are
- atom
Notes
See the discussion on Github for the source of the meanings of these variables: https://github.com/ParmEd/ParmEd/pull/307#issuecomment-128244134
-
class
parmed.topologyobjects.
Improper
(atom1, atom2, atom3, atom4, type=None)[source]¶ Bases:
parmed.topologyobjects._FourAtomTerm
A CHARMM-style improper torsion between 4 atoms. The first atom must be the central atom, as shown in the schematic below
A3 | |
A4 —– A1 —– A2
- Parameters
- atom1
Atom
The central atom A1 in the schematic above
- atom2
Atom
An atom in the improper, A2 in the schematic above
- atom3
Atom
An atom in the improper, A3 in the schematic above
- atom4
Atom
An atom in the improper, A4 in the schematic above
- type
ImproperType
The ImproperType object containing the parameters for this improper torsion
- atom1
Notes
An Improper torsion can contain bonds or atoms. A bond is contained if it exists between atom 1 and any other atom. Raises
MoleculeError
if any of the atoms are duplicates.Examples
>>> a1, a2, a3, a4 = Atom(), Atom(), Atom(), Atom() >>> imp = Improper(a1, a2, a3, a4) >>> Bond(a1, a2) in imp and Bond(a1, a3) in imp and Bond(a1, a4) in imp True >>> Bond(a2, a3) in imp False
Methods
delete
()Deletes this Improper from the atoms that make it up.
energy
()Measures the current dihedral angle energy
measure
()Measures the current torsional angle
same_atoms
(thing)An improper has the same 4 atoms if atom1 is the same for both and the other 3 can be in any order
uenergy
()Same as energy(), but with units
umeasure
()Same as measure(), but with units
-
delete
()[source]¶ Deletes this Improper from the atoms that make it up. This method removes this Improper from the impropers list for atom1, atom2, atom3, and atom4
-
energy
()[source]¶ Measures the current dihedral angle energy
- Returns
- energyfloat or None
Dihedral angle energy in kcal/mol. Return value is None if either the coordinates of either atom is not set or the angle type is not set
-
measure
()[source]¶ Measures the current torsional angle
- Returns
- measurementfloat or None
If the atoms have coordinates, returns the torsional angle between the four atoms. If any coordinates are missing, returns None
-
class
parmed.topologyobjects.
ImproperType
(psi_k, psi_eq, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
An improper type with a set of improper torsion parameters
- Parameters
- psi_k
float
Force constant in kcal/mol/radians^2
- psi_eq
float
Equilibrium torsion angle in Degrees
- list
TrackedList
A list of `ImproperType`s in which this is a member
- psi_k
Notes
Two ImproperType`s are equal if their `psi_k and psi_eq attributes are equal
Examples
>>> it1 = ImproperType(10.0, 180.0) >>> it2 = ImproperType(10.0, 180.0) >>> it1 is it2 False >>> it1 == it2 True >>> it1.idx # Not part of any list or iterable -1
As part of a list, they can be indexed
>>> improper_list = [] >>> improper_list.append(ImproperType(10.0, 180.0, list=improper_list)) >>> improper_list.append(ImproperType(10.0, 180.0, list=improper_list)) >>> improper_list[0].idx 0 >>> improper_list[1].idx 1
- Attributes
- idx
- upsi_eq
- upsi_k
-
property
upsi_eq
¶
-
property
upsi_k
¶
-
class
parmed.topologyobjects.
Link
(atom1, atom2, length, symmetry_op1='1555', symmetry_op2='1555')[source]¶ Bases:
object
An intra-residue “Link” as defined by the PDB standard:
See http://www.wwpdb.org/documentation/file-format-content/format33/sect6.html#LINK for more information
-
class
parmed.topologyobjects.
MultipoleFrame
(atom, frame_pt_num, vectail, vechead, nvec)[source]¶ Bases:
object
This defines the frame of reference for computing multipole interactions in the AMOEBA force field.
- Parameters
- atom
Atom
The atom for which the frame of reference is defined
- frame_pt_num
int
The frame point number
- vectail
int
The vector tail index
- vechead
int
The vector head index
- nvec
int
The number of vectors
- atom
Examples
>>> atom = Atom() >>> mf = MultipoleFrame(atom, 0, 1, 2, 3) >>> atom in mf True >>> mf.frame_pt_num 0 >>> mf.vectail 1 >>> mf.vechead 2 >>> mf.nvec 3
-
class
parmed.topologyobjects.
NonbondedException
(atom1, atom2, type=None)[source]¶ Bases:
object
The AMOEBA force field has complex exclusion and exception rules (referred to as “adjustments” in the Amber-converted files). This class stores per-particle exceptions.
- Parameters
- atom1
Atom
One of the atoms in the exclusion pair
- atom2
Atom
The other atom in the exclusion pair
- type
NonbondedExceptionType
The nonbonded exception type that describes how the various nonbonded interactions between these two atoms should work
- atom1
Notes
NonbondedException objects “contain” two atoms and will return True when used with the binary in operator
-
class
parmed.topologyobjects.
NonbondedExceptionType
(rmin, epsilon, chgscale=1.0, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A parameter describing how the various nonbonded interactions between a particular pair of atoms behaves in a specified nonbonded exception (e.g., in 1-4 interacting terms)
- Parameters
- rminfloat
The combined Rmin value for this particular pair of atom types (dimension length, default units are Angstroms)
- epsilonfloat
The combined well-depth value for this particular pair of atom types (dimension energy, default units are kcal/mol)
- chgscalefloat, optional
The scaling factor by which to multiply the product of the charges for this pair. Default is 1.0.
- list
TrackedList
The list containing this nonbonded exception
- Attributes
- idx
- sigma
- uepsilon
- urmin
- usigma
-
property
sigma
¶
-
property
uepsilon
¶
-
property
urmin
¶
-
property
usigma
¶
-
class
parmed.topologyobjects.
OutOfPlaneBend
(atom1, atom2, atom3, atom4, type=None)[source]¶ Bases:
parmed.topologyobjects._FourAtomTerm
Out-of-plane bending term in the AMOEBA force field. The bond pattern is the same as
TrigonalAngle
- Parameters
- atom1
Atom
The first atom involved in the trigonal angle
- atom2
Atom
The central atom involved in the trigonal angle
- atom3
Atom
The third atom involved in the trigonal angle
- atom4
Atom
The fourth atom involved in the trigonal angle
- type
OutOfPlaneBendType
The angle type containing the parameters
- atom1
Notes
Either `Atom`s or `Bond`s can be contained within this trigonal angle
Methods
delete
()Sets all atoms in this term to None, and its type if it exists
-
class
parmed.topologyobjects.
OutOfPlaneBendType
(k, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
An angle type with a set of angle parameters
- Parameters
- k
float
Force constant in kcal/mol/radians^2
- list
TrackedList
A list of `OutOfPlaneBendType`s in which this is a member
- k
Notes
Two OutOfPlaneBendType`s are equal if their `k attribute is equal
Examples
>>> ot1 = OutOfPlaneBendType(10.0) >>> ot2 = OutOfPlaneBendType(10.0) >>> ot1 is ot2 False >>> ot1 == ot2 True >>> ot1.idx # not part of any list or iterable -1
As part of a list, they can be indexed
>>> oopbend_list = [] >>> oopbend_list.append(OutOfPlaneBendType(10.0, list=oopbend_list)) >>> oopbend_list.append(OutOfPlaneBendType(10.0, list=oopbend_list)) >>> oopbend_list[0].idx 0 >>> oopbend_list[1].idx 1
- Attributes
- idx
- uk
-
property
uk
¶
-
class
parmed.topologyobjects.
OutOfPlaneExtraPointFrame
(ep, angle=54.735)[source]¶ Bases:
object
This class defines a frame of reference for a given extra point with a frame of reference defined by 3 particles, but with the virtual site out of the plane of those 3 particles. For example, TIP5P
- Parameters
- ep
ExtraPoint
The extra point defined by this frame
- angle
float
The angle out-of-plane that the extra point is. By default, it is half of the angle of a tetrahedron. Given in degrees
- ep
Methods
Returns the particles involved in the frame
Returns the weights for the three particles
-
class
parmed.topologyobjects.
PiTorsion
(atom1, atom2, atom3, atom4, atom5, atom6, type=None)[source]¶ Bases:
object
Defines a pi-torsion term in the AMOEBA force field. The Pi-torsion is defined around a sp2-hybridized pi-delocalized orbital (like an amide) by 6 atoms, as shown in the schematic below.
- A2 A5-AAA
- /
- /
A3—A4
/
/
AAA-A1 A6
In the above schematic, A3 and A4 are sp2-hybridized, and atoms A2 and A6 are bonded only to A3 and A4, respectively. Atoms A1 and A5 are each bonded to 3 other atoms.
- Parameters
Notes
Both :class:`Bond`s and :class:`Atom`s can be contained in a pi-torsion
-
class
parmed.topologyobjects.
RBTorsionType
(c0, c1, c2, c3, c4, c5, scee=1.0, scnb=1.0, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A Ryckaert-Bellemans type with a set of dihedral parameters
Notes
Two `RBTorsionType`s are equal if their coefficients are all equal
Examples
>>> dt1 = RBTorsionType(10.0, 20.0, 30.0, 40.0, 50.0, 60.0) >>> dt2 = RBTorsionType(10.0, 20.0, 30.0, 40.0, 50.0, 60.0) >>> dt1 is dt2 False >>> dt1 == dt2 True >>> dt1.idx # not part of any list or iterable -1
As part of a list, they can be indexed
>>> rb_torsion_list = [] >>> rb_torsion_list.append(RBTorsionType(10.0, 20.0, 30.0, 40.0, 50.0, 60.0, ... list=rb_torsion_list)) >>> rb_torsion_list.append(RBTorsionType(10.0, 20.0, 30.0, 40.0, 50.0, 60.0, ... list=rb_torsion_list)) >>> rb_torsion_list[0].idx 0 >>> rb_torsion_list[1].idx 1
- Attributes
- idx
- uc0
- uc1
- uc2
- uc3
- uc4
- uc5
-
property
uc0
¶
-
property
uc1
¶
-
property
uc2
¶
-
property
uc3
¶
-
property
uc4
¶
-
property
uc5
¶
-
class
parmed.topologyobjects.
Residue
(name, number=- 1, chain='', insertion_code='', segid='', list=None)[source]¶ Bases:
parmed.topologyobjects._ListItem
A single residue that is composed of a small number of atoms
- Parameters
- name
str
Name of the residue. Typical convention is to choose a name that is 4 characters or shorter
- number
int
, optional Residue number assigned in the input structure. Default is -1
- chain
str
, optional The 1-letter chain identifier for this residue. Default is empty string
- insertion_code
str
, optional The insertion code (used in PDB files) for this residue. Default is empty string
- segid
str
, optional The segment identifier, used by CHARMM in a way similar to chain. Dfault is empty string
- list
TrackedList
List of residues in which this residue is a member
- name
Notes
Iterating over a residue will iterate over the atoms. It is exactly equivalent to iterating over the atoms attribute
Supports testing if an Atom instance is contained in this residue
len() returns the number of atoms in this residue
- Attributes
- name
str
The name of this residue
- number
int
The number of this residue in the input structure
- idx
int
The index of this residue inside the container. If this residue has no container, or it is not present in the container, idx is -1
- chain
str
The 1-letter chain identifier for this residue
- insertion_code
str
The insertion code (used in PDB files) for this residue
- ter
bool
If True, there is a TER card directly after this residue (i.e., a molecule or chain ends). By default, it is False
- list
TrackedList
The container that _may_ have this residue contained inside
- atoms
list of
:class`Atominstances
This is the list of `Atom`s that make up this residue
- name
Methods
add_atom
(atom)Adds an atom to this residue
delete_atom
(atom)If an atom is present in this residue, delete it from the list of atoms.
is_empty
()Determines if there are any atoms in this residue
sort
()Sorts the atoms in this list by atom index
-
add_atom
(atom)[source]¶ Adds an atom to this residue
- Parameters
- atom
Atom
The atom to add to this residue
- atom
Notes
This action assigns the residue attribute to atom
-
delete_atom
(atom)[source]¶ If an atom is present in this residue, delete it from the list of atoms. No change if an atom is not present in this residue.
-
class
parmed.topologyobjects.
ResidueList
(*args)[source]¶ Bases:
parmed.topologyobjects.TrackedList
Array of Residue instances
Methods
add_atom
(atom, resname, resnum[, chain, …])Adds a new atom to the ResidueList, adding a new residue to this list if it has a different name or number as the last residue
claim
()This method causes this list to “claim” all of the items it contains and subsequently indexes all of its items.
clear
(/)Remove all items from list.
copy
(/)Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
index
(value[, start, stop])Return first index of value.
index_members
()Assigns the idx variable for every member of this list to its place in the list, if the members of this list permit
prune
()This function goes through the residue list and removes all empty residues from the list.
prune_unused
()This method inspects the used attribute of all of its members, if it has one, and deletes any item in which it is set to False
reverse
(/)Reverse IN PLACE.
sort
(*[, key, reverse])Stable sort IN PLACE.
append
extend
insert
pop
remove
-
add_atom
(atom, resname, resnum, chain='', inscode='', segid='')[source]¶ Adds a new atom to the ResidueList, adding a new residue to this list if it has a different name or number as the last residue
- Parameters
- atom
Atom
The atom to add to this residue list
- resname
str
The name of the residue this atom belongs to
- resnum
int
The number of the residue this atom belongs to
- chain
str
The chain ID character for this residue
- inscode
str
The insertion code ID character for this residue (it is stripped)
- segid
str
The segment identifier for this residue (it is stripped)
- atom
Notes
If the residue name and number differ from the last residue in this list, a new residue is added and the atom is added to that residue
-
-
class
parmed.topologyobjects.
StretchBend
(atom1, atom2, atom3, type=None)[source]¶ Bases:
object
This term models the stretching and bending of a standard valence angle, and is used in the AMOEBA force field
- Parameters
- atom1
Atom
The first atom on one end of the angle
- atom2
Atom
The central atom in the angle
- atom3
Atom
The atom on the other end of the angle
- type
StretchBendType
The type containing the stretch-bend parameters
- atom1
Notes
Both :class:`Bond`s and :class:`Atom`s can be contained in a stretch-bend term
-
class
parmed.topologyobjects.
StretchBendType
(k1, k2, req1, req2, theteq, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
A stretch-bend type with two distances and an angle in AMOEBA
- Parameters
- k1
float
First force constant in kcal/mol/(radians*angstroms)
- k2
float
Second force constant in kcal/mol/(radians*angstroms)
- req1
float
Equilibrium bond distance for bond between the first and second atoms in Angstroms
- req2
float
Equilibrium bond distance for bond between the second and third atoms in Angstroms
- theteq
float
Equilibrium angle in degrees
- list
TrackedList
A list of `StretchBendType`s in which this is a member
- k1
Notes
Two StretchBendType`s are equal if their `req1, req2, theteq, and k attributes are equal
Examples
>>> sbt1 = StretchBendType(10.0, 10.0, 1.0, 1.0, 180.0) >>> sbt2 = StretchBendType(10.0, 10.0, 1.0, 1.0, 180.0) >>> sbt1 is sbt2 False >>> sbt1 == sbt2 True >>> sbt1.idx # Not part of any list or iterable -1
As part of a list, they can be indexed
>>> strbnd_list = [] >>> strbnd_list.append(StretchBendType(10.0, 10.0, 1.0, 1.0, 180.0, strbnd_list)) >>> strbnd_list.append(StretchBendType(10.0, 10.0, 1.0, 1.0, 180.0, strbnd_list)) >>> strbnd_list[0].idx 0 >>> strbnd_list[1].idx 1
- Attributes
- idx
- uk1
- uk2
- ureq1
- ureq2
- utheteq
-
property
uk1
¶
-
property
uk2
¶
-
property
ureq1
¶
-
property
ureq2
¶
-
property
utheteq
¶
-
class
parmed.topologyobjects.
ThreeParticleExtraPointFrame
(ep, inside=True)[source]¶ Bases:
object
This class defines a frame of reference for a given extra point with a frame of reference defined by 3 particles
- Parameters
- ep
ExtraPoint
The extra point defined by this frame
- inside
bool
If True, the extra point is contained inside the curve connecting all points in the frame of reference. If False, the point is outside that curve. See figures below for example
- ep
Methods
from_weights
(parent, a1, a2, w1, w2[, dp1, …])This function determines the necessary bond length between an ExtraPoint and its parent atom from the weights that are calculated in
get_weights
.Returns the particles involved in the frame
Returns the weights for the three particles
-
static
from_weights
(parent, a1, a2, w1, w2, dp1=None, dp2=None, theteq=None, d12=None)[source]¶ This function determines the necessary bond length between an ExtraPoint and its parent atom from the weights that are calculated in
get_weights
.- Parameters
- parent
Atom
The parent atom to the ExtraPoint
- a1
Atom
The first atom in the frame bonded to the parent
- a2
Atom
The second atom in the frame bonded to the parent
- w1float
The first weight defining the ExtraPoint position wrt
a1
- w2float
The second weight defining the ExtraPoint position wrt
a2
- dp1float, optional
Equilibrium distance between parent and a1. If None, a bond with a bond type must be defined between parent and a1, and the distance will be taken from there. Units must be Angstroms. Default is None
- dp2float, optional
Same as dp1 above, but between atoms parent and a2. Either both dp1 and dp2 should be None or neither should be. If one is None, the other will be ignored if not None.
- theteqfloat, optional
Angle between bonds parent-a1 and parent-a2. If None, d12 (below) will be used to calculate the angle. If both are None, the angle or d12 distance will be calculated from parametrized bonds or angles between a1, parent, and a2. Units of degrees. Default None.
- d12float, optional
Distance between a1 and a2 as an alternative way to specify theteq. Default is None.
- parent
- Returns
- distfloat
The distance between the ExtraPoint and its parent atom that satisfies the weights
- Raises
- ValueError if the necessary geometry requirements are not set or if the
- two weights are different
Notes
parent must form a Bond with both a1 and a2. Then, if a1-parent-a2 forms an angle and it has an assigned type, that equilibrium value is used. Otherwise, the a1-a2 bond distance is used. If neither of those are defined, a ValueError is raised.
-
class
parmed.topologyobjects.
TorsionTorsion
(atom1, atom2, atom3, atom4, atom5, type=None)[source]¶ Bases:
parmed.topologyobjects.Cmap
This is a coupled-torsion map used in the AMOEBA force field similar to the correction-map (CMAP) potential used by the CHARMM force field
- Parameters
- atom1
Atom
An atom on one end of the valence torsion-torsion bonded to atom2
- atom2
Atom
An atom in the middle of the torsion-torsion bonded to atoms 1 and 3
- atom3
Atom
An atom in the middle of the torsion-torsion bonded to atoms 2 and 4
- atom4
Atom
An atom in the middle of the torsion-torsion bonded to atoms 3 and 5
- atom5
Atom
An atom in the middle of the torsion-torsion bonded to atom 4
- type
TorsionTorsionType
The TorsionTorsionType object containing the parameter map for this term
- atom1
Notes
A TorsionTorsion can contain bonds or atoms. A bond is contained if it exists between atoms 1 and 2, between atoms 2 and 3, between atoms 3 and 4, or between atoms 4 and 5.
Examples
>>> a1, a2, a3, a4, a5 = Atom(), Atom(), Atom(), Atom(), Atom() >>> tortor = TorsionTorsion(a1, a2, a3, a4, a5) >>> Bond(a1, a2) in tortor and Bond(a2, a3) in tortor True >>> Bond(a1, a3) in tortor False
Methods
delete
()Deletes this TorsionTorsion from the atoms that make it up.
extended
(atom1, atom2, atom3, atom4, atom5, …)Alternative constructor for correction maps defined with 8 atoms (each torsion being separately specified).
same_atoms
(thing)A coupled-torsion is equivalent if the 5 atoms are in the same or reverse order Allow comparison with another type of cmap or with a sequence of 5 indexes
-
class
parmed.topologyobjects.
TorsionTorsionType
(dims, ang1, ang2, f, dfda1=None, dfda2=None, d2fda1da2=None, list=None)[source]¶ Bases:
parmed.topologyobjects._ParameterType
,parmed.topologyobjects._ListItem
The type containing the parameter maps for the Amoeba torsion-torsion potentials. It contains the original potential as well as interpolated first and second derivatives for the AMOEBA force field.
- Parameters
- dims
tuple of 2 ints
The table dimensions
- ang1
list of floats
The list of angles in the first dimension
- ang2
list of floats
The list of angles in the second dimension
- f
list of floats
The interpolation table for the energy
- dfda1
list of floats
The interpolation table of the gradient w.r.t. angle 1
- dfda2
list of floats
The interpolation table of the gradient w.r.t. angle 2
- d2fda1da2
list of floats
The interpolation table of the 2nd derivative w.r.t. both angles
- list
TrackedList
The list containing this coupled torsion-torsion map
- dims
- Attributes
- dims
tuple of 2 ints
The table dimensions
- ang1
list of floats
The list of angles in the first dimension
- ang2
list of floats
The list of angles in the second dimension
- f
_TorTorTable
The interpolation table for the energy as a _TorTorTable
- dfda1
_TorTorTable
The interpolation table for the first gradient as a _TorTorTable
- dfda2
_TorTorTable
The interpolation table for the second gradient as a _TorTorTable
- d2fda1da2
_TorTorTable
The interpolation table for the second derivative as a _TorTorTable
- list
TrackedList
The list that may, or may not, contain this TorsionTorsionType
- idx
int
The index of this item in the list or iterable defined by list
- dims
-
class
parmed.topologyobjects.
TrackedList
(*args)[source]¶ Bases:
list
This creates a list type that allows you to see if anything has changed
Examples
>>> tl = TrackedList() >>> tl.append(Atom()) >>> tl.append(Atom()) >>> tl.append(Atom()) >>> tl.needs_indexing, tl.changed (True, True) >>> tl.index_members() >>> tl.needs_indexing, tl.changed (False, True) >>> tl.changed = False # Must do when changes have been incorporated >>> tl.needs_indexing, tl.changed (False, False)
- Attributes
- changed
bool
Determines if something has been done to fundamentally change the underlying topology defined by this list such that the topology needs to be rebuilt
- needs_indexing
bool
A flag to determine whether or not the items in a tracked list need to be indexed or not.
- changed
Methods
claim
()This method causes this list to “claim” all of the items it contains and subsequently indexes all of its items.
clear
(/)Remove all items from list.
copy
(/)Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
index
(value[, start, stop])Return first index of value.
Assigns the idx variable for every member of this list to its place in the list, if the members of this list permit
This method inspects the used attribute of all of its members, if it has one, and deletes any item in which it is set to False
reverse
(/)Reverse IN PLACE.
sort
(*[, key, reverse])Stable sort IN PLACE.
append
extend
insert
pop
remove
-
append
(*args, **kwargs)¶ Append object to the end of the list.
-
claim
()[source]¶ This method causes this list to “claim” all of the items it contains and subsequently indexes all of its items.
-
extend
(*args, **kwargs)¶ Extend list by appending elements from the iterable.
-
index_members
()[source]¶ Assigns the idx variable for every member of this list to its place in the list, if the members of this list permit
-
insert
(*args, **kwargs)¶ Insert object before index.
-
pop
(*args, **kwargs)[source]¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
class
parmed.topologyobjects.
TrigonalAngle
(atom1, atom2, atom3, atom4, type=None)[source]¶ Bases:
parmed.topologyobjects._FourAtomTerm
A trigonal-angle term in the AMOEBA force field. It exists in a pattern like the one shown below
A1 | |
A4—-A2—-A3
- Parameters
Notes
Either `Atom`s or `Bond`s can be contained within this trigonal angle
Methods
delete
()Sets all atoms in this term to None, and its type if it exists
-
class
parmed.topologyobjects.
TwoParticleExtraPointFrame
(ep, inside=False)[source]¶ Bases:
object
This class defines a frame of reference for a given extra point with a frame of reference defined by 2 particles
- Parameters
- ep
ExtraPoint
The extra point defined by this frame
- inside
bool
If True, the extra point is contained inside the curve connecting all points in the frame of reference. If False, the point is outside that curve. See figures below for example
- ep
Methods
Returns the particles involved in the frame
Returns the weights for the two particles
-
class
parmed.topologyobjects.
UreyBradley
(atom1, atom2, type=None)[source]¶ Bases:
parmed.topologyobjects.Bond
A Urey-Bradley angle type with a set of parameters. It has the same functional form as a bond, but it is defined between two atoms forming a valence angle separated by two bonds.
- Parameters
Notes
You can test whether an
Atom
is contained within the bond using the in operator. AMoleculeError
is raised if atom1 and atom2 are identical. You can also test that aBond
is contained in this Urey-Bradley valence angleExamples
>>> a1, a2, a3 = Atom(), Atom(), Atom() >>> b1 = Bond(a1, a2) >>> b2 = Bond(a2, a3) >>> angle = Angle(a1, a2, a3) >>> urey = UreyBradley(a1, a3) >>> a1 in urey and a3 in urey True >>> b1 in urey and b2 in urey True
- Attributes
order
Bond order.
Methods
delete
()Deletes this Urey-Bradley from the atoms that make it up.
energy
()Measures the current bond energy
measure
()Measures the current bond
uenergy
()Same as energy(), but with units
umeasure
()Same as “measure”, but with units