This document is for OpenStructure version 1.5, the latest version is 2.9.0 !

Forcefields

The forcefields are a dump for interactions with their parameters, but also for atom specific information or residue definitions in the form of a BuildingBlock. Objects for modifying residues can be set in form of BlockModifier or HydrogenConstructor. They’re also involved in dealing with the naming mess we’re observing in the molecular mechanics community and contain definable renaming rules that can be applied on an EntityHandle for renaming from e.g. PDB standard to the forcefield specific standard. The standard forcefields in OpenStructure are loaded from the files provided by Gromacs and the “standard” naming is therefore the same. This has implications for controlling the protonation states for histidine. If you e.g. want to enforce a d-protonated histidine you have to name it HISD. Further reading can be found in the Gromacs Manual

Loading the standard forcefields provided by OpenStructure

LoadCHARMMForcefield()

Loads the CHARMM27 forcefield read from Gromacs

Returns:The loaded Forcefield
LoadAMBERForcefield()

Loads the AMBER03 forcefield read from Gromacs

Returns:The loaded Forcefield

Reading forcefields

The FFReader object is rather experimental. It has nevertheless been thoroughly tested for loading the CHARMM and AMBER forcefields in the Gromacs format. The reader is capable of resolving the preprocessor statements as they are used in Gromacs.

class FFReader(base_dir)
Parameters:base_dir (str) – Base path of the reader. All loaded files must be defined relative to this base path.

The FFReader builds up a Forcefield, that gets updated with every call to the read functions. If the read files contain preprocessor statements as they are used in Gromacs, they will be applied to all subsequent lines read in. Parsed preprocessor statements are: #include, #define, #ifdef, #ifndef, #else and #endif

ReadGromacsForcefield()

Searches and reads the forcefield.itp and atomtypes.atp files in the base_dir given at initialization. All atom specific informations and bonded as well as nonbonded forces are read this way.

ReadResidueDatabase(basename)

Searches and reads all files belonging the the residue database defined by basename. With basename=aminoacids this function searches and reads all files in the base_dir matching aminoacids.x where x is .rtp .arn .hdb .n.tdb .c.tdb .vsd .r2b. Only the rtp file is mandatory, all others are neglected if not present.

Parameters:basename (str) – Basename of residue database to be loaded
ReadITP(basename)

Searches and reads the itp file in the base_dir. basename=amazing_ion would therefore load the file amazing_ion.itp

Parameters:basename (str) – Basename of itp file to be loaded
SetForcefield(forcefield)

Resets reader internal forcefield. Everything read so far is lost, except the already read preprocessor statements.

Parameters:forcefield (Forcefield) – Forcefield to be set
GetForcefield()

Get the forcefield with everything read so far.

Returns:The reader internal Forcefield
path = "path_to_gromacs/share/top/charmm27.ff"
reader = FFReader(path)

#read in the data given in forcefield.itp and atomtypes.atp
reader.ReadGromacsForcefield()

#we also want to read several residue databases
reader.Read("aminoacids")
reader.Read("rna")
reader.Read("dna")

#ions and water are also nice to have, they're stored in itp files
reader.ReadITP("tip3p")
reader.ReadITP("ions")

#let's finally get the reader internal forcefield out
ff = reader.GetForcefield()

#there is also an amazing ion definition in some other directory
new_reader = FFReader("path/to/directory/with/itp/files")

#we want to modify the previously read forcefield
new_reader.SetForcefield(ff)

#and read the amazing ion definition from an itp file
#note, that any previously defined preprocessor statements
#from the previous reader are lost
new_reader.ReadITP("amazing_ion")

#the new forcefield finally contains everything we need, lets
#extract it and save it down
ff = new_reader.GetForcefield()
ff.Save("charmm_forcefield.dat")

The Forcefield Class

class Forcefield
Save(filename)

Dumps forcefield into a binary file on disk

Parameters:filename (str) – Filename of the saved forcefield
Load(filename)

reads in binary forcefield file

Parameters:filename (str) – Filename of the forcefield to be loaded
Returns:loaded Forcefield
Raises:RuntimeError when filename can’t be found
AddBond(bond)
Parameters:bond (Interaction) – Bond to be added
Raises:RuntimeError when given interaction has no bond specific FuncType
AddAngle(angle)
Parameters:angle (Interaction) – Angle to be added
Raises:RuntimeError when given interaction has no angle specific FuncType
AddDihedral(dihedral)
Parameters:dihedral (Interaction) – Dihedral to be added
Raises:RuntimeError when given interaction has no dihedral specific FuncType
AddImproper(improper)
Parameters:improper (Interaction) – Improper to be added
Raises:RuntimeError when given interaction has no improper specific FuncType
AddCMap(cmap)
Parameters:cmap (Interaction) – CMap to be added
Raises:RuntimeError when given interaction has no cmap specific FuncType
AddImplicitGenborn(gb)
Parameters:gb (Interaction) – GB to be added
Raises:RuntimeError when given interaction has no gb specific FuncType
AddLJ(lj)
Parameters:lj (Interaction) – LJ to be added
Raises:RuntimeError when given interaction has no lj specific FuncType
AddLJPair(lj_pair)
Parameters:lj_pair (Interaction) – LJPair to be added
Raises:RuntimeError when given interaction has no lj_pair specific FuncType
AddConstraint(constraint)
Parameters:constraint (Interaction) – Constraint to be added
Raises:RuntimeError when given interaction has no constraint specific FuncType
AddMass(type, mass)
Parameters:
  • type (str) – Type of atom
  • mass (float) – Its mass
SetFudgeLJ(factor)
Parameters:factor (float) – Factor with which the 1,4 Lennard Jones term should be dampened
SetFudgeQQ(factor)
Parameters:factor (float) – Factor with which the 1,4 electrostatic term should be dampened
SetGenPairs(gen_pairs)
Parameters:gen_pairs (bool) – If set to false, all 1,4 interactions must be set with AddLJPair. The Lorentz-Berthelot rule gets used otherwise.
AddResidueRenamingRule(name, ff_main_name, ff_n_ter_name, ff_c_ter_name, ff_two_ter_name)
Parameters:
  • name (str) – Original name of the residue (e.g. PDB/Gromacs standard)
  • ff_main_name (str) – Forcefield specific residue name
  • ff_n_ter_name (str) – Forcefield specific name if the residue is N-Terminal
  • ff_c_ter_name (str) – Forcefield specific name if the residue is C-Terminal
  • ff_two_ter_name (str) – Forcefield specific name if the residue is N- and C-Terminal
AddAtomRenamingRule(res_name, old_atom_name, new_atom_name)
Parameters:
  • res_name (str) – Forcefield specific name of the residue the atom belongs to
  • old_atom_name (str) – Atom name in PDB/Gromacs standard
  • new_atom_name (str) – FF specific atom name
AddBuildingBlock(name, block)
Parameters:
  • name (str) – Name of residue this BuildingBlock is supposed to be related to
  • block (BuildingBlock) – BuildingBlock to be added
AddHydrogenConstructor(name, h_constructor)
Parameters:
AddBlockModifier(name, modifier)
Parameters:
  • name (str) – Name of residue this BlockModifier is supposed to be related to
  • modifier (BlockModifier) – BlockModifier to be added
SetStandardCTer(res_name, ter_name)

Setting a standard CTer influences the behaviour of the GetCTerModifier function. If no specific block modifier is defined there, this is the one that gets returned.

Parameters:
  • res_name (str) – Forcefield specific residue name this block modifier is supposed to be related to
  • ter_name (str) – Name of the default c-terminal block modifier for this residue
SetStandardNTer(res_name, ter_name)

Setting a standard NTer incluences the behaviour of the GetNTerModifier function. If no specific block modifier is defined there, this is the one that gets returned.

Parameters:
  • res_name (str) – Forcefield specific residue name this block modifier is supposed to be related to
  • ter_name (str) – Name of the default n-terminal block modifier for this residue
AssignFFSpecificNames(ent[, reverse = False])

This function does the forcefield specific renaming magic. It takes the given EntityHandle and applies the rules set in AddResidueRenamingRule and AddAtomRenamingRule.

Parameters:
  • ent (EntityHandle) – Entity to be renamed
  • reverse (bool) – If False, the function does the renaming from PDB/Gromacs naming to the forcefield specific naming. If True, the opposite happens.
GetBond(type1, type2)
Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
Returns:

an Interaction with a bond FuncType

Raises:

RuntimeError when no Interaction matching given types can be found

GetAngle(type1, type2, type3)
Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
  • type3 (str) – Type of interacting particle 3
Returns:

an Interaction with a angle FuncType

Raises:

RuntimeError when no Interaction matching given types can be found

GetDihedrals(type1, type2, type3, type4)

Several dihedral definitions can be merged to one dihedral function. This function therefore returns a list. In a first step all dihedrals matching the given types are gathered and returned. If no dihedrals can be found, the search continues by including wildcard characters in the atom types (X). All found dihedrals matching with all possible combinations of wildcards are then gathered and returned.

Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
  • type3 (str) – Type of interacting particle 3
  • type4 (str) – Type of interacting particle 4
Returns:

a list of Interaction objects with dihedral FuncType matching given types

Raises:

RuntimeError when no Interaction matching given types can be found

GetImpropers(type1, type2, type3, type4)

The same search strategy as in GetDihedrals is used to extract the impropers.

Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
  • type3 (str) – Type of interacting particle 3
  • type4 (str) – Type of interacting particle 4
Returns:

a list of Interaction objects with improper FuncType matching given types

Raises:

RuntimeError when no Interaction matching given types can be found

GetCMap(type1, type2, type3, type4, type5)
Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
  • type3 (str) – Type of interacting particle 3
  • type4 (str) – Type of interacting particle 4
  • type5 (str) – Type of interacting particle 5
Returns:

an Interaction with a cmap FuncType

Raises:

RuntimeError when no Interaction matching given types can be found

GetImplicitGenborn(type)
Parameters:type (str) – Type of particle
Returns:an Interaction with a gb FuncType
Raises:RuntimeError when no Interaction matching given type can be found
GetLJ(type)
Parameters:type (str) – Type of particle
Returns:an Interaction with a lj FuncType
Raises:RuntimeError when no Interaction matching given type can be found
GetLJ(type1, type2[, pair=False])
Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
  • pair (bool) – If set to true, the interaction is assumed to be a 1,4-interaction and the set lj_pairs are first searched for matches. In case of no success, the function uses the Lorentz-Berthelot rule to combine the sigma and epsilon parameters. If set to false, the Lorentz-Berthelot rule is applied directly.
Raises:

RuntimeError when no Interaction matching given types can be found or when pair is true and no appropriate lj_pair is set despite gen_pair flag being false.

GetConstraint(type1, type2)
Parameters:
  • type1 (str) – Type of interacting particle 1
  • type2 (str) – Type of interacting particle 2
Returns:

an Interaction with a constraint FuncType

Raises:

RuntimeError when no Interaction matching given types can be found

GetMass(type)
Parameters:type (str) – Type of particle
Returns:float - the mass
Raises:RuntimeError if no mass has been set for this atom type
GetFudgeLJ()
Returns:float - Factor with which the 1,4 Lennard Jones term should be dampened
GetFudgeQQ()
Returns:float - Factor with which the 1,4 electrostatic term should be dampened
GetAtomType(res_name, atom_name)
Parameters:
  • res_name (str) – Forcefield specific residue name
  • atom_name (str) – Forcefield specific atom name belonging to that residue
Returns:

str - atom type

Raises:

RuntimeError if forcefield has no such BuildingBlock or when atom is not present in that BuildingBlock

GetHydrogenConstructor(res_name)
Parameters:res_name (str) – Name of residue
Returns:HydrogenConstructor for this name, invalid if it can’t be found
GetBuildingBlock(res_name)
Parameters:res_name (str) – Name of residue
Returns:BuildingBlock for this name, invalid if it can’t be found
GetBlockModifier(res_name)
Parameters:res_name (str) – Name of residue
Returns:BlockModifier for this name, invalid if it can’t be found
GetNTerModifier(res_name[, ter_name=""])
Parameters:
  • res_name (str) – Name of residue
  • ter_name (str) – If not set, the ter_name defined by SetStandardNTer gets used
Returns:

BlockModifier for this name, invalid if it can’t be found

GetCTerModifier(name[, ter_name=""])
Parameters:
  • res_name (str) – Name of residue
  • ter_name (str) – If not set, the ter_name defined by SetStandardCTer gets used
Returns:

BlockModifier for this name, invalid if it can’t be found

Search

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

Contents

Documentation is available for the following OpenStructure versions:

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 / (Currently viewing 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.