indigoX
|
#include <indigox/classes/molecule.hpp>
Classes | |
struct | Impl |
Public Types | |
using | MoleculeAngles = std::vector< Angle > |
Container for storing IXAngle instances. More... | |
using | MoleculeAtoms = std::vector< Atom > |
Container for storing IXAtom instances. More... | |
using | MoleculeBonds = std::vector< Bond > |
Container for storing IXBond instances. More... | |
using | MoleculeDihedrals = std::vector< Dihedral > |
Container for storing IXDihedral instances. More... | |
using | MoleculeResidues = std::vector< Residue > |
Public Member Functions | |
Molecule (std::string name) | |
Default constructor. More... | |
Molecule ()=default | |
Molecule (Molecule &&)=default | |
Molecule (const Molecule &)=default | |
~ Molecule ()=default | |
Angle | GetAngle (uint32_t pos) |
Get the angle at position pos . More... | |
Angle | GetAngle (const Atom &a, const Atom &b, const Atom &c) |
Get the angle between three atoms, if it exists. More... | |
Angle | GetAngleID (int64_t id) const |
Get the angle with the given id. More... | |
const MoleculeAngles & | GetAngles () |
Angle | GetAngleTag (int64_t tag) const |
Get the first angle with the given tag. More... | |
Atom | GetAtom (uint32_t pos) const |
Get the atom at position pos . More... | |
Atom | GetAtomID (int64_t id) const |
Get the atom with the given id. More... | |
const MoleculeAtoms & | GetAtoms () const |
Atom | GetAtomTag (int64_t tag) const |
Get the first atom with the given tag. More... | |
Bond | GetBond (uint32_t pos) const |
Get the bond at position pos . More... | |
Bond | GetBond (const Atom &a, const Atom &b) const |
Get the bond between two atoms, if it exists. More... | |
Bond | GetBondID (int64_t id) const |
Get the bond with the given id. More... | |
const MoleculeBonds & | GetBonds () const |
Bond | GetBondTag (int64_t tag) const |
Get the first bond with the given tag. More... | |
const graph::CondensedMolecularGraph & | GetCondensedGraph () const |
Dihedral | GetDihedral (uint32_t pos) |
Get the angle at position pos . More... | |
Dihedral | GetDihedral (const Atom &a, const Atom &b, const Atom &c, const Atom &d) |
Get the dihedral between four atoms, it if exists. More... | |
Dihedral | GetDihedralID (int64_t id) const |
Get the dihedral with the given id. More... | |
const MoleculeDihedrals & | GetDihedrals () |
Dihedral | GetDihedralTag (int64_t tag) const |
Get the first dihedral with the given tag. More... | |
const Forcefield & | GetForcefield () const |
std::string | GetFormula () |
Get the molecular formula of the molecule. More... | |
const graph::MolecularGraph & | GetGraph () const |
Get the molecular graph for this molecule. More... | |
int32_t | GetMolecularCharge () const |
Get the molecular charge of the molecule. More... | |
const std::string & | GetName () const |
Get the name of the molecule. More... | |
Residue | GetResidueID (int32_t id) |
const MoleculeResidues & | GetResidues () |
bool | HasAngle (const Angle &angle) const |
Check if the angle is owned by this molecule. More... | |
bool | HasAngle (const Atom &a, const Atom &b, const Atom &c) |
Check if an angle between three atoms exists in this molecule. More... | |
bool | HasAtom (const Atom &atom) const |
Check if the atom is owned by this molecule. More... | |
bool | HasBond (const Bond &bond) const |
Check if the bond is owned by this molecule. More... | |
bool | HasBond (const Atom &a, const Atom &b) const |
Check if a bond between two atoms exists in this molecule. More... | |
bool | HasDihedral (const Dihedral &dihedral) const |
Check if the dihedral is owned by this molecule. More... | |
bool | HasDihedral (const Atom &a, const Atom &b, const Atom &c, const Atom &d) |
Check if a dihedral between four atoms exists in this molecule. More... | |
bool | HasForcefield () const |
void | ModificationMade () |
Atom | NewAtom () |
Create a new atom owned by the molecule. More... | |
Atom | NewAtom (const Element &element) |
Create a new atom of the given element for the molecule. More... | |
Atom | NewAtom (const Element &element, double x, double y, double z) |
Create a new named atom of the given element for the molecule. More... | |
Bond | NewBond (const Atom &a, const Atom &b) |
Create a bond between two atoms. More... | |
Dihedral | NewDihedral (const Atom &a, const Atom &b, const Atom &c, const Atom &d) |
Create a dihedral between four atoms. More... | |
int64_t | NumAngles () |
Get the number of angles in the molecule. More... | |
int64_t | NumAtoms () const |
Get the number of atoms in the molecule. More... | |
int64_t | NumBonds () const |
Get the number of bonds in the molecule. More... | |
int64_t | NumDihedrals () |
Get the number of dihedrals in the molecule. More... | |
operator bool () const | |
bool | operator!= (const Molecule &mol) const |
bool | operator< (const Molecule &mol) const |
bool | operator<= (const Molecule &mol) const |
Molecule & | operator= (Molecule &&)=default |
Molecule & | operator= (const Molecule &)=default |
bool | operator== (const Molecule &mol) const |
bool | operator> (const Molecule &mol) const |
bool | operator>= (const Molecule &mol) const |
void | OptimiseChargeGroups () |
int64_t | PerceiveAngles () |
Determine angles in the molecule. More... | |
int64_t | PerceiveDihedrals () |
Determine dihedrals in the molecule. More... | |
int32_t | PerceiveResidues () |
bool | RemoveAtom (const Atom &atom) |
Remove an atom from the molecule. More... | |
bool | RemoveBond (const Bond &bond) |
Remove a bond from the molecule. More... | |
bool | RemoveBond (const Atom &a, const Atom &b) |
Remove a bond between two atoms. More... | |
void | ReorderAtoms (MoleculeAtoms &new_order) |
void | ReserveAtoms (int64_t num) |
Reserve storage space for atoms. More... | |
void | ReserveBonds (int64_t num) |
Reserve storage space for bonds. More... | |
void | ResetForcefield (const Forcefield &ff) |
void | SetForcefield (const Forcefield &ff) |
void | SetMolecularCharge (int32_t q) |
Set the molecular charge of the molecule. More... | |
void | SetName (std::string name) |
Set the name of the molecule. More... | |
Friends | |
class | cereal::access |
Friendship allows serialisation. More... | |
std::ostream & | operator<< (std::ostream &os, const Molecule &mol) |
using MoleculeAngles = std::vector<Angle> |
Container for storing IXAngle instances.
A molecule takes ownership of all angles it contains.
using MoleculeAtoms = std::vector<Atom> |
Container for storing IXAtom instances.
A molecule takes ownership of all atoms it contains.
using MoleculeBonds = std::vector<Bond> |
Container for storing IXBond instances.
A molecule takes ownership of all bonds it contains.
using MoleculeDihedrals = std::vector<Dihedral> |
Container for storing IXDihedral instances.
A molecule takes ownership of all dihedrals it contains.
using MoleculeResidues = std::vector<Residue> |
Molecule | ( | std::string | name | ) |
Default constructor.
Is private to enforce that IXMolecules should only be used via the Molecule shared_ptr.
|
default |
|
default |
Angle GetAngle | ( | uint32_t | pos | ) |
Get the angle at position pos
.
Returns the angle at pos
after a range check. If pos
is not a valid index, returns an empty shared_ptr. Positioning of angles may change during normal operations. Angles are not re-percieved prior to retrieving the angle.
pos | the position of the angle to get. |
Get the angle between three atoms, if it exists.
Searches for an angle between the three atoms and returns it. If no angle is found, the returned shared_ptr is empty. Angles are re-perceived prior to searching.
a,b,c | the atoms to get the angle between. b is the central atom. |
a
and c
centred on b
. Angle GetAngleID | ( | int64_t | id | ) | const |
Get the angle with the given id.
Returns the angle with the given unique id. If no such angle is found returns an empty shared_ptr. As the unique id of any created angles will be unknown, angles are not re-percieved prior to searching.
id | the unique id of the angle to retrieve. |
const MoleculeAngles& GetAngles | ( | ) |
Angle GetAngleTag | ( | int64_t | tag | ) | const |
Get the first angle with the given tag.
Returns the first angle with a tag matching that given. If no such angle is found, returns an empty shared_ptr. As tags are not set on creation of angles, angles are not re-percieved prior to searching.
tag | the angle tag to search for. |
Atom GetAtom | ( | uint32_t | pos | ) | const |
Get the atom at position pos
.
Returns that atom at pos
after a range check. If pos
is not a valid index, returns an empty shared_ptr. Positioning of atoms may change during normal operations.
pos | the position of the atom to get. |
Atom GetAtomID | ( | int64_t | id | ) | const |
Get the atom with the given id.
Returns the atom with the given unique id. If no such atom is found returns an empty shared_ptr.
id | the unique id of the atom to retrieve. |
const MoleculeAtoms& GetAtoms | ( | ) | const |
Atom GetAtomTag | ( | int64_t | tag | ) | const |
Get the first atom with the given tag.
Returns the first atom with a tag matching that given. If no such atom is found, returns an empty shared_ptr.
tag | the atom tag to search for. |
Bond GetBond | ( | uint32_t | pos | ) | const |
Get the bond at position pos
.
Returns that bond at pos
after a range check. If pos
is not a valid index, returns an empty shared_ptr. Positioning of bonds may change during normal operations.
pos | the position of the bond to get. |
Get the bond between two atoms, if it exists.
Searches for a bond between a
and b
and returns it. If no bond is found, returns an empty shared_ptr.
a,b | the atoms to get the bond between. |
a
and b
or an empty shared_ptr. Bond GetBondID | ( | int64_t | id | ) | const |
Get the bond with the given id.
Returns the bond with the given unique id. If no such bond is found returns an empty shared_ptr.
id | the unique id of the bond to retrieve. |
const MoleculeBonds& GetBonds | ( | ) | const |
Bond GetBondTag | ( | int64_t | tag | ) | const |
Get the first bond with the given tag.
Returns the first bond with a tag matching that given. If no such bond is found, returns an empty shared_ptr.
tag | the bond tag to search for. |
const graph::CondensedMolecularGraph& GetCondensedGraph | ( | ) | const |
Dihedral GetDihedral | ( | uint32_t | pos | ) |
Get the angle at position pos
.
Returns the dihedral at pos
after a range check. If pos
is not a valid index, returns an empty shared_ptr. Positioning of dihedrals may change during normal operations. Dihedrals are not re-perceived prior to retrieving the dihedral.
pos | the position of the dihedral to get. |
Get the dihedral between four atoms, it if exists.
Searches for a dihedral between the four atoms and returns it. If no dihedral is found, the returned shared_ptr is empty. Dihedrals are re-perceived prior to searching.
a,b,c,d | the atoms to get the dihedral between. |
a
, b
, c
and d
. Dihedral GetDihedralID | ( | int64_t | id | ) | const |
Get the dihedral with the given id.
Returns the dihedral with the given unique id. If no such dihedral is found returns an empty shared_ptr. As the unique id of any created dihedrals will be unknown, dihedrals are not re-perceived prior to searching.
id | the unique id of the dihedral to retrieve. |
const MoleculeDihedrals& GetDihedrals | ( | ) |
Dihedral GetDihedralTag | ( | int64_t | tag | ) | const |
Get the first dihedral with the given tag.
Returns the first dihedral with a tag matching that given. If no such dihedral is found, returns an empty shared_ptr. As tags are not set on creation of dihedrals, dihedrals are not re-perceived prior to searching.
tag | the dihedral tag to search for. |
const Forcefield& GetForcefield | ( | ) | const |
std::string GetFormula | ( | ) |
Get the molecular formula of the molecule.
Determines the molecular formula of the molecule. The elements of the formula are arranged in the order: carbon, hydrogen and then alphabetically by atomic symbol. The resultant formula is cached and recalculated only when the IXMolecule::ATOM_ELEMENTS property has been modified.
const graph::MolecularGraph& GetGraph | ( | ) | const |
Get the molecular graph for this molecule.
int32_t GetMolecularCharge | ( | ) | const |
Get the molecular charge of the molecule.
const std::string& GetName | ( | ) | const |
Get the name of the molecule.
Residue GetResidueID | ( | int32_t | id | ) |
const MoleculeResidues& GetResidues | ( | ) |
bool HasAngle | ( | const Angle & | angle | ) | const |
Check if the angle is owned by this molecule.
angle | the angle to check for. |
Check if an angle between three atoms exists in this molecule.
If the Emergent::ANGLE_PERCEPTION property is set, angles are re-percieved prior to check for the existance of the angle. b
is the central atom of the angle.
a,b,c | the atoms the angle should be between. |
bool HasAtom | ( | const Atom & | atom | ) | const |
Check if the atom is owned by this molecule.
atom | the atom to check for. |
bool HasBond | ( | const Bond & | bond | ) | const |
Check if the bond is owned by this molecule.
bond | the bond to check for. |
Check if a bond between two atoms exists in this molecule.
a,b | the atoms the bond should be between. |
bool HasDihedral | ( | const Dihedral & | dihedral | ) | const |
Check if the dihedral is owned by this molecule.
dihedral | the dihedral to check for. |
Check if a dihedral between four atoms exists in this molecule.
If the Emergent::DIHEDRAL_PERCEPTION property is set, dihedrals are re-perceived prior to checking for the existance of the dihedral.
a,b,c,d | the atoms the dihedral should be between. |
bool HasForcefield | ( | ) | const |
void ModificationMade | ( | ) |
Atom NewAtom | ( | ) |
Create a new atom owned by the molecule.
Create a new atom of the given element for the molecule.
element | the element of the new atom. |
Create a new named atom of the given element for the molecule.
name | the name of the new atom. |
element | the element of the new atom. |
Create a bond between two atoms.
To create a bond, both atoms need to be owned by the molecule and there cannot be an existing bond between the atoms. If either condition is not met, the returned shared_ptr is empty.
a,b | the atoms to create a bond between. |
Create a dihedral between four atoms.
a,b,c,d | the atoms to create the dihedral between. |
int64_t NumAngles | ( | ) |
Get the number of angles in the molecule.
If the Emergent::ANGLE_PERCEPTION property is set, angles are re-calculated prior to determining how many there are in the molecule.
int64_t NumAtoms | ( | ) | const |
Get the number of atoms in the molecule.
int64_t NumBonds | ( | ) | const |
Get the number of bonds in the molecule.
int64_t NumDihedrals | ( | ) |
Get the number of dihedrals in the molecule.
If the CONNECTIVITY property has been modified, dihedrals are re-calculated prior to determining how many there are in the molecule.
|
inline |
|
inline |
bool operator< | ( | const Molecule & | mol | ) | const |
|
inline |
bool operator== | ( | const Molecule & | mol | ) | const |
bool operator> | ( | const Molecule & | mol | ) | const |
|
inline |
void OptimiseChargeGroups | ( | ) |
int64_t PerceiveAngles | ( | ) |
Determine angles in the molecule.
An angle is defined for each group of three connected atoms within a molecule. Subsequent calls to this method will only generate angles which have not been previously generated. Additionally, angles can only be removed by removing an atom or a bond.
int64_t PerceiveDihedrals | ( | ) |
Determine dihedrals in the molecule.
A dihedral is defined for each group of four connected atoms within a molecule. Subsequent calls to this method will only generate dihedrals which have not been previously generated. Additionally, dihedrals can only be removed by removing an atom or bond.
int32_t PerceiveResidues | ( | ) |
bool RemoveAtom | ( | const Atom & | atom | ) |
Remove an atom from the molecule.
In addition to removing the atom, any bonds to the atom are also removed. A removal will not occur if the atom is not owned by the molecule it is being removed from.
atom | the atom to remove. |
bool RemoveBond | ( | const Bond & | bond | ) |
Remove a bond from the molecule.
A removal will not occur if the bond is not owned by the molecule it is being removed from. Reference to the bond is removed from both of the atoms of the bond.
bond | the bond to remove. |
Remove a bond between two atoms.
a,b | the atoms to remove a bond between. |
void ReorderAtoms | ( | MoleculeAtoms & | new_order | ) |
void ReserveAtoms | ( | int64_t | num | ) |
Reserve storage space for atoms.
Reserves storage space for a minimum of num
IXAtom instances. This is more efficient when building large molecules as the vector will not need to grow as more atoms are added.
num | the number of IXAtoms to reserve space for. |
void ReserveBonds | ( | int64_t | num | ) |
Reserve storage space for bonds.
Reserves storage space for a minimum of num
IXBond instances. This is more efficient when building large molecules as the vector will not need to grow as more bonds are added.
num | the number of IXBonds to reserve space for. |
void ResetForcefield | ( | const Forcefield & | ff | ) |
void SetForcefield | ( | const Forcefield & | ff | ) |
void SetMolecularCharge | ( | int32_t | q | ) |
Set the molecular charge of the molecule.
Sets the IXMolecule::ELECTRON_COUNT property as modified.
q | the new charge to set. |
void SetName | ( | std::string | name | ) |
Set the name of the molecule.
name | the new to set. |
|
friend |
Friendship allows serialisation.
|
friend |