parmed.parameters module

This module contains classes for parsing and processing CHARMM parameter, topology, and stream files. It only extracts atom properties from the topology files and extracts all parameters from the parameter files

Author: Jason M. Swails

class parmed.parameters.ParameterSet[source]

Bases: object

Stores a parameter set defining a force field

Attributes
atom_typesdict(str:AtomType)

Dictionary mapping the names of the atom types to the corresponding AtomType instances

atom_types_intdict(int:AtomType)

Dictionary mapping the serial indexes of the atom types to the corresponding AtomType instances

atom_types_tupledict((str,int):AtomType)

Dictionary mapping the (name,number) tuple of the atom types to the corresponding AtomType instances

bond_typesdict((str,str):AtomType)

Dictionary mapping the 2-element tuple of the names of the two atom types involved in the bond to the BondType instances

angle_typesdict((str,str,str):AngleType)

Dictionary mapping the 3-element tuple of the names of the three atom types involved in the angle to the AngleType instances

urey_bradley_typesdict((str,str,str):BondType)

Dictionary mapping the 3-element tuple of the names of the three atom types involved in the angle to the BondType instances of the Urey-Bradley terms

dihedral_typesdict((str,str,str,str):list(DihedralType))

Dictionary mapping the 4-element tuple of the names of the four atom types involved in the dihedral to the DihedralType instances. Since each torsion term can be a multiterm expansion, each item corresponding to a key in this dict is a list of `DihedralType`s for each term in the expansion

improper_typesdict((str,str,str,str):ImproperType)

Dictionary mapping the 4-element tuple of the names of the four atom types involved in the improper torsion to the ImproperType instances

improper_periodic_typesdict((str,str,str,str):DihedralType)

Dictionary mapping the 4-element tuple of the names of the four atom types involved in the improper torsion (modeled as a Fourier series) to the DihedralType instances. Note, the central atom should always be put in the third position of the key

rb_torsion_typesdict((str,str,str,str):RBTorsionType)

Dictionary mapping the 4-element tuple of the names of the four atom types involved in the Ryckaert-Bellemans torsion to the RBTorsionType instances

cmap_typesdict((str,str,str,str,str,str,str,str):CmapType)

Dictionary mapping the 5-element tuple of the names of the five atom types involved in the correction map to the CmapType instances

nbfix_typesdict((str,str):(float,float))

Dictionary mapping the 2-element tuple of the names of the two atom types whose LJ terms are modified to the tuple of the (epsilon,rmin) terms for that off-diagonal term

pair_typesdict((str,str):NonbondedExceptionType)

Dictionary mapping the 2-element tuple of atom type names for which explicit exclusion rules should be applied

parametersetslist(str)

List of parameter set names processed in the current ParameterSet

residuesdict(str:ResidueTemplate|ResidueTemplateContainer)

A library of ResidueTemplate objects mapped to the residue name defined in the force field library files

Methods

condense([do_dihedrals])

This function goes through each of the parameter type dicts and eliminates duplicate types.

from_structure(struct[, …])

Extracts known parameters from a Structure instance

typeify_templates()

Assign atom types to atom names in templates

property combining_rule
condense(do_dihedrals=True)[source]

This function goes through each of the parameter type dicts and eliminates duplicate types. After calling this function, every unique bond, angle, dihedral, improper, or cmap type will pair with EVERY key in the type mapping dictionaries that points to the equivalent type

Parameters
do_dihedralsbool=True

Dihedrals can take the longest time to compress since testing their equality takes the longest (this is complicated by the existence of multi-term torsions). This flag will allow you to skip condensing the dihedral parameter types (for large parameter sets, this can cut the compression time in half)

Returns
self

The instance that is being condensed

Notes

The return value allows you to condense the types at construction time.

classmethod from_structure(struct, allow_unequal_duplicates=True)[source]

Extracts known parameters from a Structure instance

Parameters
structparmed.structure.Structure

The parametrized Structure instance from which to extract parameters into a ParameterSet

allow_unequal_duplicatesbool, optional

If True, if two or more unequal parameter types are defined by the same atom types, the last one encountered will be assigned. If False, an exception will be raised. Default is True

Returns
paramsParameterSet

The parameter set with all parameters defined in the Structure

Raises
parmed.exceptions.ParameterError if allow_unequal_duplicates is
False and 2+ unequal parameters are defined between the same atom types.
NotImplementedError if any AMOEBA potential terms are defined in the
input structure

Notes

The parameters here are copies of the ones in the Structure, so modifying the generated ParameterSet will have no effect on struct. Furthermore, the first occurrence of each parameter will be used. If future ones differ, they will be silently ignored, since this is expected behavior in some instances (like with Gromacs topologies in the ff99sb-ildn force field) unless allow_unequal_duplicates is set to False

Dihedrals are a little trickier. They can be multi-term, which can be represented either as a single entry in dihedrals with a type of DihedralTypeList or multiple entries in dihedrals with a DihedralType parameter type. In this case, the parameter is constructed from either the first DihedralTypeList found or the first DihedralType of each periodicity found if no matching DihedralTypeList is found.

typeify_templates()[source]

Assign atom types to atom names in templates