Interactions

The Interaction object is intended to build a basic container that can be used in various scenarios. At the initialization a FuncType has to be defined. Whenever names, types or parameters are set, the number of parameters gets checked according to the FuncType. A name or type can also consist of a wildcard expressed as X.

The FuncType enum

Every Interaction is linked to one particular FuncType describing the types of interactions supported by OpenStructure. There are 15 possible values with Invalid defining an unknown interaction:

HarmonicBond, HarmonicAngle, UreyBradleyAngle, PeriodicDihedral, PeriodicImproper, HarmonicImproper, CMap, LJ, LJPair, GBSA, DistanceConstraint, Exclusion, HarmonicPositionRestraint, HarmonicDistanceRestraint, Invalid

The implementation guarantees that the parameter related to atom types, names, parameters are checked regarding their dimension (e.g. 3 atoms and 2 parameters for a harmonic angle)

Interaction Parametrization

  • HarmonicBond, Interacting Particles: 2, Num Parameters: 2

    1. float bond length in nm

    2. float force constant in kJ/mol/nm^2

  • HarmonicAngle, Interacting Particles: 3, Num Parameters: 2

    1. float angle in radians

    2. float force constant in kJ/mol/radian^2

  • UreyBradleyAngle, Interacting Particles: 3, Num Parameters: 4

    1. float angle in radians

    2. float angle force constant in kJ/mol/radian^2

    3. float bond length in nm

    4. float bond force constant in kJ/mol/nm^2

  • PeriodicDihedral, Interacting Particles: 4, Num Parameters: 3

    1. int multiplicity

    2. float phase in radians

    3. float force constant in kJ/mol/radian^2

  • PeriodicImproper, Interacting Particles: 4, Num Parameters: 3

    1. int multiplicity

    2. float phase in radians

    3. float force constant in kJ/mol/radian^2

  • HarmonicImproper, Interacting Particles: 4, Num Parameters: 2

    1. float angle in radians

    2. float force constant in kJ/mol/radian^2

  • CMap, Interacting Particles: 5, Num Parameters: n*n+1

    1. list of float of size n*n+1, first value describes the dimension n of the cmap, the other n*n values describe the correction map in kJ/mol in the ordering (phi1,psi1),(phi1,psi2)… and torsion angles in [-pi,pi] (will be converted to the format OpenMM prefers)

  • LJ, Interacting Particles: 1, Num Parameters: 2

    1. float sigma in nm

    2. float epsilon in kJ/mol

  • LJPair, Interacting Particles: 2, Num Parameters: 2

    1. float sigma in nm

    2. float epsilon in kJ/mol

  • GBSA, Interacting Particles: 1, Num Parameters: 2

    1. float GBSA radius in nm

    2. float OBC scaling factor

  • DistanceConstraint, Interacting Particles: 2, Num Parameters: 1

    1. float constraint distance

  • Exclusion, Interacting Particles: 2, Num Parameters: 0

  • HarmonicPositionRestraint, Interacting Particles: 1, Num Parameters: 7

    1. float ref pos x

    2. float ref pos y

    3. float ref pos z

    4. float force constant

    5. float x_scale

    6. float y_scale

    7. float z_scale

  • HarmonicDistanceRestraint, Interacting Particles: 2, Num Parameters: 2

    1. float restraint length

    2. float force constant

The Interaction Class

class Interaction(func_type)
Parameters:

func_typeFuncType defining a particular interaction

SetTypes(types)

Sets the forcefield specific atom types.

Parameters:

types (list) – Strings describing the force field specific atom types.

Raises:

RuntimeError when size of input is not consistent with the interactions functype

SetNames(names)

Sets atom names

Parameters:

names (list) – Strings describing the atom names

Raises:

RuntimeError when size of input is not consistent with the interactions functype

SetParam(param)

Sets interaction specific parameters.

Parameters:

param (list) – Float values .

Raises:

RuntimeError when size of input is not consistent with the interactions functype

GetTypes()

Get previously set types

Returns:

list

GetNames()

Get previously set names

Returns:

list

GetParam()

Get previously set parameters

Returns:

list

GetAtoms(residue)

Returns an AtomHandleList containing the atoms in residue matching the atom names of the interaction

Parameters:

residue (ResidueHandle) – Residue from which atoms are extracted

Returns:

AtomHandleList

Raises:

RuntimeError when an atom cannot be found in residue

GetFuncType()

Returns the functype enum of the interaction

Returns:

FuncType

ReplaceAtom(name, new_name, new_type)

Searches for given atom name. If found, this particular atom name gets changed to new_name. If the atom types are set as well, the associated atom type gets also reset to new_type.

Parameters:
  • name (str) – Name of atom to be replaces

  • new_name (str) – Its new name

  • new_type (str) – Its new type

Returns:

bool whether replacement was successful or not

MatchTypes(atom_types)

Checks, whether the given types match the internal types. The match can be “as is” or in reversed order

Parameters:

atom_types (list) – Atom types to be matched

Returns:

bool

MatchNames(atom_names)

Checks, whether the given names match the internal names. The match can be “as is” or in reversed order

Parameters:

atom_names (list) – Atom names to be matched

Returns:

bool

HasName(name)

Checks, whether the given name is present in the internal names

Parameters:

name (str) – Name to be checked

Returns:

bool

HasType(type)

Checks, whether the given type is present in the internal types

Parameters:

type (str) – Type to be checked

Returns:

bool

IsParametrized()

Checks, whether the parameters have been set

Returns:

bool

HasTypeWildcard()

Checks, whether one of the types is a wildcard (‘X’)

Returns:

bool

HasNameWildcard()

Checks, whether one of the names is a wildcard (‘X’)

Returns:

bool

Search

Enter search terms or a module, class or function name.

Contents

Documentation is available for the following OpenStructure versions:

(Currently viewing dev) / 2.9.0 / 2.8 / 2.7 / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.