topology.topology
topology.topology
Classes
Name | Description |
---|---|
MoleculeType | One moleculetype in the topology |
Topology | Smart container for parsed topology data. |
MoleculeType
self, header, atomics, radicals=None) topology.topology.MoleculeType(
One moleculetype in the topology
Attributes
Name | Type | Description |
---|---|---|
atoms | dict[str, Atom] | |
bonds | dict[tuple[str, str], Bond] | |
pairs | dict[tuple[str, str], Pair] | |
angles | dict[tuple[str, str, str], Angle] | |
proper_dihedrals | dict[tuple[str, str, str, str], MultipleDihedrals] | |
improper_dihedrals | dict[tuple[str, str, str, str], Dihedral] | |
position_restraints | dict[str, PositionRestraint] | |
dihedral_restraints | dict[tuple[str, str, str, str], DihedralRestraint] | |
radicals | dict[str, Atom] | dict mapping atom indices to atom objects for storing all radical atoms |
Methods
Name | Description |
---|---|
find_radicals | Find atoms that are radicals and update self.radicals. |
reindex_atomnrs | Reindex atom numbers in topology. |
find_radicals
topology.topology.MoleculeType.find_radicals()
Find atoms that are radicals and update self.radicals.
Iterate over all atoms and designate them as radicals if they have fewer bounds than their natural bond order.
reindex_atomnrs
topology.topology.MoleculeType.reindex_atomnrs()
Reindex atom numbers in topology.
Starts at index 1. This also updates the numbers for bonds, angles, dihedrals and pairs. Returns a dict, mapping of old atom number strings to new ones
Topology
topology.topology.Topology(self
top=BasicParameterizer()
parametrizer=is_not_solvent_or_ion
is_reactive_predicate_f=None
radicals=None
residuetypes_path=None
reactive_nrexcl )
Smart container for parsed topology data.
A topology keeps track of connections when bonds are broken or formed. Reparametrization is triggerd automatically if to_dict
is called after bonds have changed.
Assumptions:
- the topology of interest (the Reactive moleculetype) consists of the first moleculetypes (non-solvent).
Parameters
Name | Type | Description | Default |
---|---|---|---|
top | TopologyDict | A dictionary containing the parsed topology data, produced by kimmdy.parsing.read_top |
required |
parametrizer | Parameterizer |
The parametrizer to use when reparametrizing the topology. | BasicParameterizer() |
is_reactive_predicate_f | Callable[[str], bool] | A function that takes a moleculetype name and returns True if the moleculetype should be merged into the reactive moleculetype. | is_not_solvent_or_ion |
radicals | Optional[str] | A string of atom numbers that are radicals. | None |
residuetypes_path | Optional[Path] | Path to the residue types file. | None |
reactive_nrexcl | Optional[str] | Overwrite nrexcl value for the reactive moleculetype. Otherwise takes the nrexcl of the first reactive moleculetype. | None |
Methods
Name | Description |
---|---|
bind_bond | Add a bond in topology. |
break_bond | Break bonds in topology homolytically. |
del_atom | Deletes atom |
reindex_atomnrs | Reindex atom numbers in topology. |
update_partial_charges | Update the topology atom partial charges. |
validate_bond | Validates bond consistency between both atoms and top |
bind_bond
topology.topology.Topology.bind_bond(atompair_addresses)
Add a bond in topology.
Modifies the topology dictionary in place. It keeps track of affected terms in the topology via a graph representation of the topology and applies the necessary changes to bonds, angles and dihedrals (proper and improper). Furthermore, it modifies to function types in the topology to account for radicals.
Parameters
Name | Type | Description | Default |
---|---|---|---|
atompair_addresses | tuple[TopologyAtomAddress, TopologyAtomAddress] | Atoms to bind together. | required |
break_bond
topology.topology.Topology.break_bond(atompair_addresses)
Break bonds in topology homolytically.
Removes bond, angles and dihedrals where atompair was involved. Modifies the topology dictionary in place. Atom pairs become radicals.
Parameters
Name | Type | Description | Default |
---|---|---|---|
atompair_addresses | tuple[TopologyAtomAddress, TopologyAtomAddress] | Between which atoms to break the bond. | required |
del_atom
=True) topology.topology.Topology.del_atom(atom_nr, parameterize
Deletes atom
Deletes atom and all attached bonds. Reindexes the top and updates the parameters if requested. Also moves charges to first bound_nrs atom.
Parameters
Name | Type | Description | Default |
---|---|---|---|
atom_nr | Union[list[str], str] | 1-based atom number as string to delete | required |
parameterize | bool | If true and bonds are removed triggers reparameterization, by default True | True |
Returns
Name | Type | Description |
---|---|---|
update_map |
Dict, mapping of old atom number strings to new ones. |
reindex_atomnrs
topology.topology.Topology.reindex_atomnrs()
Reindex atom numbers in topology.
Starts at index 1. This also updates the numbers for bonds, angles, dihedrals and pairs. Returns a dict of all moleculetypes to their update maps (old -> new).
update_partial_charges
topology.topology.Topology.update_partial_charges(recipe_steps)
Update the topology atom partial charges.
This function must be called after the recipe_steps are applied. Changes are based on the recipe_steps. Update rules follow a simple assignment scheme that works well with grappa. If fragments are created, their partial charges are kept integers. If previously broken bonds are formed again, the original partial charges are restored.
validate_bond
topology.topology.Topology.validate_bond(atm1, atm2)
Validates bond consistency between both atoms and top Returns True if bond exists, False if not. Raises RuntimeError if bond is not consistent.