|
AvogadroLibs 2.1.0-20261111
|
The Molecule class represents a chemical molecule.
#include <avogadro/core/molecule.h>
Classes | |
| struct | VibrationData |
Public Types | |
| using | AtomType = Atom |
| using | BondType = Bond |
| using | CustomElementMap = std::map<unsigned char, std::string> |
| using | ElementMask = std::bitset<element_count> |
Public Member Functions | |
| Molecule () | |
| Molecule (const Molecule &other) | |
| Molecule (Molecule &&other) noexcept | |
| Molecule & | operator= (const Molecule &other) |
| Molecule & | operator= (Molecule &&other) noexcept |
| virtual | ~Molecule () |
| void | readProperties (const Molecule &other) |
| void | setData (const std::string &name, const Variant &value) |
| Variant | data (const std::string &name) const |
| bool | hasData (const std::string &name) const |
| void | setDataMap (const VariantMap &map) |
| const VariantMap & | dataMap () const |
| VariantMap & | dataMap () |
| MatrixX | spectra (const std::string &name) const |
| void | setSpectra (const std::string &name, const MatrixX &value) |
| std::set< std::string > | spectraTypes () const |
| void | setPartialCharges (const std::string &type, const MatrixX &value) |
| void | removePartialCharges (const std::string &type) |
| MatrixX | partialCharges (const std::string &type) const |
| std::set< std::string > | partialChargeTypes () const |
| PropertyMap & | atomProperties () |
| const PropertyMap & | atomProperties () const |
| PropertyMap & | bondProperties () |
| const PropertyMap & | bondProperties () const |
| PropertyMap & | residueProperties () |
| const PropertyMap & | residueProperties () const |
| PropertyMap & | conformerProperties () |
| const PropertyMap & | conformerProperties () const |
| Array< AtomHybridization > & | hybridizations () |
| const Array< AtomHybridization > & | hybridizations () const |
| AtomHybridization | hybridization (Index atomId) const |
| bool | setHybridizations (const Core::Array< AtomHybridization > &hybs) |
| bool | setHybridization (Index atomId, AtomHybridization hybridization) |
| Array< signed char > & | formalCharges () |
| const Array< signed char > & | formalCharges () const |
| signed char | formalCharge (Index atomId) const |
| bool | setFormalCharges (const Core::Array< signed char > &charges) |
| bool | setFormalCharge (Index atomId, signed char charge) |
| signed char | totalCharge () const |
| char | totalSpinMultiplicity () const |
| Array< unsigned short > & | isotopes () |
| const Array< unsigned short > & | isotopes () const |
| unsigned short | isotope (Index atomId) const |
| bool | setIsotopes (const Core::Array< unsigned short > &isotopes) |
| bool | setIsotope (Index atomId, unsigned short isotope) |
| Array< Vector3ub > & | colors () |
| const Array< Vector3ub > & | colors () const |
| Vector3ub | color (Index atomId) const |
| bool | setColors (const Core::Array< Vector3ub > &colors) |
| bool | setColor (Index atomId, Vector3ub color) |
| bool | setLayer (Index atomId, size_t layer) |
| size_t | layer (Index atomId) const |
| const Array< Vector2 > & | atomPositions2d () const |
| Array< Vector2 > & | atomPositions2d () |
| Vector2 | atomPosition2d (Index atomId) const |
| bool | setAtomPositions2d (const Core::Array< Vector2 > &pos) |
| bool | setAtomPosition2d (Index atomId, const Vector2 &pos) |
| const Array< Vector3 > & | atomPositions3d () const |
| Array< Vector3 > & | atomPositions3d () |
| Vector3 | atomPosition3d (Index atomId) const |
| bool | setAtomPositions3d (const Core::Array< Vector3 > &pos) |
| bool | setAtomPosition3d (Index atomId, const Vector3 &pos) |
| std::string | atomLabel (Index atomId) const |
| bool | setAtomLabel (Index atomId, const std::string &label) |
| const Core::Array< std::string > | atomLabels () const |
| bool | setAtomLabels (const Core::Array< std::string > &label) |
| void | setAtomSelected (Index atomId, bool selected) |
| bool | atomSelected (Index atomId) const |
| bool | isSelectionEmpty () const |
| const ElementMask | elements () const |
| virtual AtomType | addAtom (unsigned char atomicNumber) |
| AtomType | addAtom (unsigned char atomicNumber, Vector3 position3d) |
| virtual bool | removeAtom (Index index) |
| Remove the specified atom from the molecule. | |
| virtual bool | removeAtom (const AtomType &atom) |
| Remove the specified atom from the molecule. | |
| virtual void | clearAtoms () |
| AtomType | atom (Index index) const |
| virtual bool | removeBond (Index index) |
| Remove the specified bond. | |
| virtual bool | removeBond (const BondType &bond) |
| Remove the specified bond. | |
| virtual void | clearBonds () |
| BondType | bond (Index index) const |
| BondType | bond (const AtomType &a, const AtomType &b) const |
| BondType | bond (Index atomId1, Index atomId2) const |
| std::string | bondLabel (Index bondIndex) const |
| bool | setBondLabel (Index bondIndex, const std::string &label) |
| const Core::Array< std::string > | bondLabels () const |
| bool | setBondLabels (const Core::Array< std::string > &label) |
| Mesh * | addMesh () |
| Add a mesh to the molecule. | |
| Mesh * | mesh (Index index) |
| const Mesh * | mesh (Index index) const |
| Index | meshCount () const |
| void | clearMeshes () |
| Cube * | addCube () |
| Add a cube to the molecule. | |
| Cube * | cube (Index index) |
| const Cube * | cube (Index index) const |
| Index | cubeCount () const |
| void | clearCubes () |
| bool | setActiveCubeIndex (Index index) |
| Set the active cube index for volume rendering. | |
| Index | activeCubeIndex () const |
| Get the index of the active cube. | |
| Cube * | activeCube () |
| Get the active cube for volume rendering. | |
| const Cube * | activeCube () const |
| std::vector< Cube * > | cubes () |
| Get the cubes vector set (if present) for the molecule. | |
| const std::vector< Cube * > | cubes () const |
| std::string | formula (const std::string &delimiter="", int showCountsOver=1) const |
| double | mass () const |
| double | monoisotopicMass () const |
| Vector3 | centerOfGeometry () const |
| Vector3 | centerOfMass () const |
| double | radius () const |
| std::pair< Vector3, Vector3 > | bestFitPlane () const |
| void | setBasisSet (BasisSet *basis) |
| BasisSet * | basisSet () |
| const BasisSet * | basisSet () const |
| bool | hasVibrations (size_t conformerIndex) const |
| bool | hasVibrations () const |
| size_t | vibrationConformerCount () const |
| Array< size_t > | vibrationConformers () const |
| void | clearVibrations () |
| const VibrationData * | vibrationData (size_t conformerIndex) const |
| void | setVibrationData (const VibrationData &data, size_t conformerIndex) |
| void | perceiveBondsSimple (const double tolerance=0.45, const double minDistance=0.32) |
| void | perceiveBondsFromResidueData () |
| BondOrderResult | perceiveBondOrders (const BondOrderOptions &options) |
| void | perceiveBondOrders () |
| void | perceiveSubstitutedCations () |
| size_t | coordinate3dCount () const |
| bool | setCoordinate3d (int coord) |
| int | coordinate3d () const |
| Array< Vector3 > | coordinate3d (size_t index) const |
| const Array< Vector3 > & | coordinate3dRef (size_t index) const |
| bool | setCoordinate3d (const Array< Vector3 > &coords, size_t index) |
| void | clearCoordinate3d () |
| void | estimateVelocities () |
| void | estimateVelocities (double timeStep) |
| Array< Vector3 > | velocities (int index) const |
| bool | setVelocities (const Array< Vector3 > &velocities, int index) |
| void | updateVelocityProperties () |
| void | clearVelocities () |
| bool | setTimeStep (double timestep, int index) |
| double | timeStep (int index, bool &status) const |
| const Array< Vector3 > & | forceVectors () const |
| Array< Vector3 > & | forceVectors () |
| Vector3 | forceVector (Index atomId) const |
| bool | setForceVectors (const Core::Array< Vector3 > &forces) |
| bool | setForceVector (Index atomId, const Vector3 &force) |
| Residue & | addResidue (std::string &name, Index &number, char &id) |
| void | addResidue (Residue &residue) |
| Residue & | residue (Index index) |
| const Residue & | residue (Index index) const |
| Array< Residue > & | residues () |
| const Array< Residue > & | residues () const |
| Index | residueCount () const |
| std::string | residueLabel (Index residueIndex) const |
| bool | setResidueLabel (Index residueIndex, const std::string &label) |
| const Core::Array< std::string > | residueLabels () const |
| bool | setResidueLabels (const Core::Array< std::string > &label) |
| Index | atomCount () const |
| Index | atomCount (unsigned char atomicNumber) const |
| Get the number of atoms in the molecule that match atomicNumber. | |
| Index | bondCount () const |
| std::pair< Index, Index > | bondPair (Index bondId) const |
| bool | setBondPairs (const Array< std::pair< Index, Index > > &pairs) |
| const Array< std::pair< Index, Index > > & | bondPairs () const |
| const Array< unsigned char > & | bondOrders () const |
| const Graph & | graph () const |
| const Array< unsigned char > & | atomicNumbers () const |
| unsigned char | atomicNumber (Index atomId) const |
| bool | setBondOrders (const Array< unsigned char > &orders) |
| bool | setBondOrder (Index bondId, unsigned char order) |
| bool | hasCustomElements () const |
| bool | setBondPair (Index bondId, const std::pair< Index, Index > &pair) |
| unsigned char | bondOrder (Index bondId) const |
| bool | setAtomicNumbers (const Core::Array< unsigned char > &nums) |
| bool | setAtomicNumber (Index atomId, unsigned char atomicNumber) |
| std::map< unsigned char, size_t > | composition () const |
| std::map< std::string, size_t > | formulaComposition () const |
| Array< std::pair< Index, Index > > | getAtomBonds (Index index) const |
| Array< unsigned char > | getAtomOrders (Index index) const |
| bool | removeBonds (Index atom) |
| void | addBonds (const Array< std::pair< Index, Index > > &bonds, const Array< unsigned char > &orders) |
| void | swapBond (Index a, Index b) |
| void | swapAtom (Index a, Index b) |
| void | clearCalculatedResults () |
| std::list< Index > | getAtomsAtLayer (size_t layer) |
| Layer & | layer () |
| const Layer & | layer () const |
| void | copyDisplayStateFrom (const Molecule &other) |
| std::shared_ptr< MoleculeInfo > | layerInfo () const |
| void | boundingBox (Vector3 &boxMin, Vector3 &boxMax, const double radius=1.0) const |
| const CustomElementMap & | customElementMap () const |
| void | setCustomElementMap (const CustomElementMap &map) |
| virtual BondType | addBond (Index atom1, Index atom2, unsigned char order=1) |
| virtual BondType | addBond (const AtomType &atom1, const AtomType &atom2, unsigned char order=1) |
| virtual bool | removeBond (Index atom1, Index atom2) |
| Remove the specified bond. | |
| virtual bool | removeBond (const AtomType &atom1, const AtomType &atom2) |
| Remove the specified bond. | |
| Array< BondType > | bonds (const AtomType &a) |
Get all bonds to a. | |
| Array< BondType > | bonds (Index a) |
Get all bonds to a. | |
| Array< const BondType * > | bonds (Index a) const |
Get all bonds to a. | |
| void | setUnitCell (UnitCell *uc) |
| UnitCell * | unitCell () |
| const UnitCell * | unitCell () const |
| void | setHallNumber (unsigned short hallNumber) |
| unsigned short | hallNumber () const |
| Array< double > | vibrationFrequencies () const |
| void | setVibrationFrequencies (const Array< double > &freq) |
| Array< double > | vibrationIRIntensities () const |
| void | setVibrationIRIntensities (const Array< double > &intensities) |
| Array< double > | vibrationRamanIntensities () const |
| void | setVibrationRamanIntensities (const Array< double > &intensities) |
| Array< Vector3 > | vibrationLx (int mode) const |
| void | setVibrationLx (const Array< Array< Vector3 > > &lx) |
| Array< double > | vibrationFrequencies (size_t conformerIndex) const |
| void | setVibrationFrequencies (const Array< double > &freq, size_t conformerIndex) |
| Array< double > | vibrationIRIntensities (size_t conformerIndex) const |
| void | setVibrationIRIntensities (const Array< double > &intensities, size_t conformerIndex) |
| Array< double > | vibrationRamanIntensities (size_t conformerIndex) const |
| void | setVibrationRamanIntensities (const Array< double > &intensities, size_t conformerIndex) |
| Array< Vector3 > | vibrationLx (int mode, size_t conformerIndex) const |
| void | setVibrationLx (const Array< Array< Vector3 > > &lx, size_t conformerIndex) |
Constraints | |
Methods for distance, angle, torsion, etc. constraints | |
| void | addConstraint (Real Value, Index a, Index b, Index c=MaxIndex, Index d=MaxIndex) |
| void | addConstraint (Constraint &c) |
| void | removeConstraint (Index a, Index b, Index c=MaxIndex, Index d=MaxIndex) |
| void | clearConstraints () |
| void | setConstraints (const std::vector< Core::Constraint > &constraints) |
| std::vector< Core::Constraint > & | constraints () |
| const std::vector< Core::Constraint > & | constraints () const |
| void | setFrozenAtom (Index atomId, bool frozen) |
| bool | frozenAtom (Index atomId) const |
| bool | frozenAtomAxis (Index atomId, int axis) const |
| void | setFrozenAtomAxis (Index atomId, int axis, bool frozen) |
| Eigen::VectorXd | frozenAtomMask () const |
Scan coordinates | |
Distances, angles and torsions worth following across the coordinate sets, such as the coordinate a relaxed scan stepped through. Unlike constraints these are only ever measured, never enforced, so an optimizer ignores them. They live in the property map, which already travels through CJSON, rather than in a member of their own. | |
| std::vector< Constraint > | scanCoordinates () const |
| void | setScanCoordinates (const std::vector< Constraint > &coordinates) |
| void | addScanCoordinate (const Constraint &coordinate) |
Static Public Member Functions | |
| static std::pair< Vector3, Vector3 > | bestFitPlane (const Array< Vector3 > &pos) |
| static std::pair< Index, Index > | makeBondPair (const Index &a, const Index &b) |
Protected Attributes | |
| VariantMap | m_data |
| std::map< std::string, MatrixX > | m_partialCharges |
| Sets of atomic partial charges. | |
| std::map< std::string, MatrixX > | m_spectra |
| Sets of spectra. | |
| PropertyMap | m_atomProperties |
| Custom per-atom properties. | |
| PropertyMap | m_bondProperties |
| Custom per-bond properties. | |
| PropertyMap | m_residueProperties |
| Custom per-residue properties. | |
| PropertyMap | m_conformerProperties |
| Custom per-conformer properties. | |
| CustomElementMap | m_customElementMap |
| ElementMask | m_elements |
| Array< Vector2 > | m_positions2d |
| Array< Vector3 > | m_positions3d |
| Array< std::string > | m_atomLabels |
| Array< std::string > | m_bondLabels |
| Array< std::string > | m_residueLabels |
| Array< Array< Vector3 > > | m_coordinates3d |
| Store conformers/trajectories. | |
| int | m_coordinate3dIndex = 0 |
| Active coordinate set index. | |
| Array< Array< Vector3 > > | m_velocities |
| Store velocities. | |
| Array< double > | m_timesteps |
| Array< AtomHybridization > | m_hybridizations |
| Array< signed char > | m_formalCharges |
| Array< unsigned short > | m_isotopes |
| Store isotopes of the atoms. | |
| Array< Vector3 > | m_forceVectors |
| Array< Vector3ub > | m_colors |
| std::map< size_t, VibrationData > | m_vibrations |
| std::vector< bool > | m_selectedAtoms |
| std::vector< Mesh * > | m_meshes |
| std::vector< Cube * > | m_cubes |
| Index | m_activeCubeIndex = 0 |
| BasisSet * | m_basisSet |
| UnitCell * | m_unitCell |
| Array< Residue > | m_residues |
| unsigned short | m_hallNumber = 0 |
| std::vector< Core::Constraint > | m_constraints |
| Eigen::VectorXd | m_frozenAtomMask |
| using CustomElementMap = std::map<unsigned char, std::string> |
Type for custom element map.
| using ElementMask = std::bitset<element_count> |
Type for element masks (e.g., does this molecule contain certain elements)
| Molecule | ( | ) |
Creates a new, empty molecule.
| Molecule | ( | const Molecule & | other | ) |
Copy constructor
|
noexcept |
Move constructor.
Takes every member from other and leaves it equivalent to a default-constructed Molecule. The layer state is a shared_ptr whose handle is transferred, not rebuilt. noexcept, but not allocation-free: leaving the source empty allocates small empty containers, and the graph's edge list may be copied. An allocation failure here terminates the program.
Move assignment operator. noexcept but may allocate, as the move constructor does; an allocation failure terminates the program.
| void readProperties | ( | const Molecule & | other | ) |
Adds the properties from the supplied molecule to this molecule. Does not otherwise modify atoms / bonds / residues, etc.
| void setData | ( | const std::string & | name, |
| const Variant & | value ) |
Sets the data value with name to value.
| Variant data | ( | const std::string & | name | ) | const |
name. | bool hasData | ( | const std::string & | name | ) | const |
| void setDataMap | ( | const VariantMap & | map | ) |
Set the molecule's variant data to the entries in map.
| const VariantMap & dataMap | ( | ) | const |
| VariantMap & dataMap | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| MatrixX spectra | ( | const std::string & | name | ) | const |
| void setSpectra | ( | const std::string & | name, |
| const MatrixX & | value ) |
Sets the spectra value with name to value.
| std::set< std::string > spectraTypes | ( | ) | const |
| void setPartialCharges | ( | const std::string & | type, |
| const MatrixX & | value ) |
Sets atomic partial charges with type to value.
| void removePartialCharges | ( | const std::string & | type | ) |
Discards the stored partial charges of type type, if any. Other charge types are left alone.
| MatrixX partialCharges | ( | const std::string & | type | ) | const |
type | std::set< std::string > partialChargeTypes | ( | ) | const |
| PropertyMap & atomProperties | ( | ) |
| const PropertyMap & atomProperties | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| PropertyMap & bondProperties | ( | ) |
| const PropertyMap & bondProperties | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| PropertyMap & residueProperties | ( | ) |
| const PropertyMap & residueProperties | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| PropertyMap & conformerProperties | ( | ) |
| const PropertyMap & conformerProperties | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Array< AtomHybridization > & hybridizations | ( | ) |
| const Array< AtomHybridization > & hybridizations | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| AtomHybridization hybridization | ( | Index | atomId | ) | const |
Get the hybridization for the requested atom.
| atomId | The index of the atom. |
| bool setHybridizations | ( | const Core::Array< AtomHybridization > & | hybs | ) |
Replace the current array of hybridizations.
| hybs | The new hybridization array. Must be of length atomCount(). |
| bool setHybridization | ( | Index | atomId, |
| AtomHybridization | hybridization ) |
Set the hybridization of a single atom.
| atomId | The index of the atom to modify. |
| hybridization | The new hybridization. |
| Array< signed char > & formalCharges | ( | ) |
| const Array< signed char > & formalCharges | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| signed char formalCharge | ( | Index | atomId | ) | const |
Get the formal charge for the requested atom.
| atomId | The index of the atom. |
| bool setFormalCharges | ( | const Core::Array< signed char > & | charges | ) |
Replace the current array of formal charges.
| charges | The new formal charge array. Must be of length atomCount(). |
| bool setFormalCharge | ( | Index | atomId, |
| signed char | charge ) |
Set the formal charge of a single atom.
| atomId | The index of the atom to modify. |
| charge | The new formal charge. |
| signed char totalCharge | ( | ) | const |
Get the total charge on the molecule. The method will first check to see if a total charge has been set. If not, it will calculate the total charge from the formal charges (if set). If neither has been set, it will assume the total charge is zero.
| char totalSpinMultiplicity | ( | ) | const |
Get the total spin multiplicity of the molecule. The method will first check to see if a total spin has been set. If not, it will either suggest a singlet if an even number of electrons are present, or a doublet if an odd number of electrons are present.
| Array< unsigned short > & isotopes | ( | ) |
| const Array< unsigned short > & isotopes | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| unsigned short isotope | ( | Index | atomId | ) | const |
Get the isotope for the requested atom.
| atomId | The index of the atom. |
| bool setIsotopes | ( | const Core::Array< unsigned short > & | isotopes | ) |
Replace the current array of isotopes.
| charges | The new isotope array. Must be of length atomCount(). |
| bool setIsotope | ( | Index | atomId, |
| unsigned short | isotope ) |
Set the isotope of a single atom.
| atomId | The index of the atom to modify. |
| isotope | The new isotope (or zero for most common) |
| Array< Vector3ub > & colors | ( | ) |
| const Array< Vector3ub > & colors | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Vector3ub color | ( | Index | atomId | ) | const |
Get the color for the requested atom.
| atomId | The index of the atom. |
| bool setColors | ( | const Core::Array< Vector3ub > & | colors | ) |
Replace the current array of colors.
| colors | The new color array. Must be of length atomCount(). |
| bool setColor | ( | Index | atomId, |
| Vector3ub | color ) |
Set the color of a single atom.
| atomId | The index of the atom to modify. |
| color | The new color. |
| const Array< Vector2 > & atomPositions2d | ( | ) | const |
| Array< Vector2 > & atomPositions2d | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Vector2 atomPosition2d | ( | Index | atomId | ) | const |
Get the 2D position of a single atom.
| atomId | The index of the atom. |
| bool setAtomPositions2d | ( | const Core::Array< Vector2 > & | pos | ) |
Replace the current array of 2D atomic coordinates.
| pos | The new coordinate array. Must be of length atomCount(). |
| bool setAtomPosition2d | ( | Index | atomId, |
| const Vector2 & | pos ) |
Set the 2D position of a single atom.
| atomId | The index of the atom to modify. |
| pos | The new position of the atom. |
| const Array< Vector3 > & atomPositions3d | ( | ) | const |
| Array< Vector3 > & atomPositions3d | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Vector3 atomPosition3d | ( | Index | atomId | ) | const |
Get the 3D position of a single atom.
| atomId | The index of the atom. |
| bool setAtomPositions3d | ( | const Core::Array< Vector3 > & | pos | ) |
Replace the current array of 3D atomic coordinates.
| pos | The new coordinate array. Must be of length atomCount(). |
| bool setAtomPosition3d | ( | Index | atomId, |
| const Vector3 & | pos ) |
Set the 3D position of a single atom.
| atomId | The index of the atom to modify. |
| pos | The new position of the atom. |
| std::string atomLabel | ( | Index | atomId | ) | const |
| atomId | The index of the atom. |
| bool setAtomLabel | ( | Index | atomId, |
| const std::string & | label ) |
Set the custom label of a single atom.
| atomId | The index of the atom to modify. |
| label | The new label of the atom. |
| bool setAtomLabels | ( | const Core::Array< std::string > & | label | ) |
Set all the atom labels in the molecule.
| label | The new label array. Must be of length atomCount(). |
| void setAtomSelected | ( | Index | atomId, |
| bool | selected ) |
Set whether the specified atom is selected or not.
| bool atomSelected | ( | Index | atomId | ) | const |
Query whether the supplied atom index has been selected.
| bool isSelectionEmpty | ( | ) | const |
| const CustomElementMap & customElementMap | ( | ) | const |
A map of custom element atomic numbers to string identifiers. These ids can be used to override the generic custom element names returned by the Elements class, and should be somewhat meaningful to the user.
| void setCustomElementMap | ( | const CustomElementMap & | map | ) |
A map of custom element atomic numbers to string identifiers. These ids can be used to override the generic custom element names returned by the Elements class, and should be somewhat meaningful to the user.
| const Molecule::ElementMask elements | ( | ) | const |
|
virtual |
Adds an atom to the molecule.
Reimplemented in Molecule.
|
virtual |
| index | The index of the atom to be removed. |
Reimplemented in Molecule.
|
virtual |
| atom | The atom to be removed. |
Reimplemented in Molecule.
|
virtual |
Remove all atoms from the molecule.
| AtomType atom | ( | Index | index | ) | const |
index in the molecule.
|
virtual |
Create a new bond in the molecule.
| atom1 | The first atom in the bond. |
| atom2 | The second atom in the bond. |
| order | The bond order. |
Reimplemented in Molecule.
|
virtual |
Create a new bond in the molecule.
| atom1 | The first atom in the bond. |
| atom2 | The second atom in the bond. |
| order | The bond order. |
Reimplemented in Molecule.
|
virtual |
| index | The index of the bond to be removed. |
Reimplemented in Molecule.
|
virtual |
| bond | The bond to be removed. |
Reimplemented in Molecule.
|
virtual |
| atom1 | One atom in the bond. |
| atom2 | The other atom in the bond. |
Reimplemented in Molecule.
| atom1 | One atom in the bond. |
| atom2 | The other atom in the bond. |
Reimplemented in Molecule.
|
virtual |
Remove all bonds from the molecule.
| BondType bond | ( | Index | index | ) | const |
index in the molecule. a and b. | BondType bond | ( | Index | atomId1, |
| Index | atomId2 ) const |
| std::string bondLabel | ( | Index | bondIndex | ) | const |
| bondIndex | The index of the bond. |
| bool setBondLabel | ( | Index | bondIndex, |
| const std::string & | label ) |
Set the custom label of a single bond.
| bondIndex | The index of the bond to modify. |
| label | The new label of the bond. |
| bool setBondLabels | ( | const Core::Array< std::string > & | label | ) |
Set all the bond labels in the molecule.
| label | The new label array. Must be of length bondCount(). |
| Mesh * addMesh | ( | ) |
| Cube * addCube | ( | ) |
| bool setActiveCubeIndex | ( | Index | index | ) |
| index | The index of the cube to make active. |
| Index activeCubeIndex | ( | ) | const |
| Cube * activeCube | ( | ) |
| std::vector< Cube * > cubes | ( | ) |
| std::string formula | ( | const std::string & | delimiter = "", |
| int | showCountsOver = 1 ) const |
| delimiter | Delimiter to insert between tokens, defaults to none. |
| showCountsOver | Show atom counts above this (defaults to 1). |
| double mass | ( | ) | const |
| double monoisotopicMass | ( | ) | const |
| Vector3 centerOfGeometry | ( | ) | const |
| Vector3 centerOfMass | ( | ) | const |
| double radius | ( | ) | const |
| std::pair< Vector3, Vector3 > bestFitPlane | ( | ) | const |
|
static |
| void setBasisSet | ( | BasisSet * | basis | ) |
Set the basis set for the molecule. The molecule takes ownership of basis and deletes the basis set it replaces. Passing the current basis set is a no-op. Passing nullptr removes (and deletes) the current one.
| BasisSet * basisSet | ( | ) |
| void setUnitCell | ( | UnitCell * | uc | ) |
The unit cell for this molecule. May be nullptr for non-periodic structures.
| UnitCell * unitCell | ( | ) |
The unit cell for this molecule. May be nullptr for non-periodic structures.
| const UnitCell * unitCell | ( | ) | const |
The unit cell for this molecule. May be nullptr for non-periodic structures.
| void setHallNumber | ( | unsigned short | hallNumber | ) |
The space group for this molecule. It is updated after every space group operation.
Setting a Hall number other than 0 removes the entry that file readers keep in the data map when they only know the international table number of the space group (SpaceGroups::internationalNumberKey()): it is superseded. Setting 0 leaves the data map alone.
| unsigned short hallNumber | ( | ) | const |
The space group for this molecule. It is updated after every space group operation.
Setting a Hall number other than 0 removes the entry that file readers keep in the data map when they only know the international table number of the space group (SpaceGroups::internationalNumberKey()): it is superseded. Setting 0 leaves the data map alone.
| Array< double > vibrationFrequencies | ( | ) | const |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| void setVibrationFrequencies | ( | const Array< double > & | freq | ) |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| Array< double > vibrationIRIntensities | ( | ) | const |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| void setVibrationIRIntensities | ( | const Array< double > & | intensities | ) |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| Array< double > vibrationRamanIntensities | ( | ) | const |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| void setVibrationRamanIntensities | ( | const Array< double > & | intensities | ) |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| Array< Vector3 > vibrationLx | ( | int | mode | ) | const |
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
Vibrational data for the active conformer (see coordinate3d()). Molecules with no coordinate sets store their single set of vibrations under the default active index, so these behave exactly as before for the common one-geometry-one-Hessian case.
Each getter returns an empty Array when the active conformer has no vibrational data, or when mode is out of range.
| Array< double > vibrationFrequencies | ( | size_t | conformerIndex | ) | const |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| void setVibrationFrequencies | ( | const Array< double > & | freq, |
| size_t | conformerIndex ) |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| Array< double > vibrationIRIntensities | ( | size_t | conformerIndex | ) | const |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| void setVibrationIRIntensities | ( | const Array< double > & | intensities, |
| size_t | conformerIndex ) |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| Array< double > vibrationRamanIntensities | ( | size_t | conformerIndex | ) | const |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| void setVibrationRamanIntensities | ( | const Array< double > & | intensities, |
| size_t | conformerIndex ) |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| Array< Vector3 > vibrationLx | ( | int | mode, |
| size_t | conformerIndex ) const |
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
Vibrational data for a specific conformer, for files that carry a Hessian at more than one geometry.
| bool hasVibrations | ( | size_t | conformerIndex | ) | const |
conformerIndex has vibrational data. | bool hasVibrations | ( | ) | const |
| size_t vibrationConformerCount | ( | ) | const |
| Array< size_t > vibrationConformers | ( | ) | const |
| void clearVibrations | ( | ) |
Remove all vibrational data from every conformer.
| const VibrationData * vibrationData | ( | size_t | conformerIndex | ) | const |
conformerIndex, or nullptr when that conformer has none. The per-field accessors above are thin wrappers over this; new code that wants several fields at once should prefer it. | void setVibrationData | ( | const VibrationData & | data, |
| size_t | conformerIndex ) |
Store a whole set of vibrational data against conformerIndex, replacing anything already there. Parsers that assemble a complete Hessian should prefer this to the per-field setters: it is one lookup, and a new field added to VibrationData needs no new call.
| void perceiveBondsSimple | ( | const double | tolerance = 0.45, |
| const double | minDistance = 0.32 ) |
Perceives bonds in the molecule based on the 3D coordinates of the atoms. atoms are considered bonded if within the sum of radii plus a small tolerance.
| tolerance | The calculation tolerance. |
| minDistance | = atoms closer than the square of this are ignored |
| void perceiveBondsFromResidueData | ( | ) |
Perceives bonds in the molecule based on preset residue data.
Use this if you have residue data available (e.g., reading PDB or MMTF files) Otherwise consider
| BondOrderResult perceiveBondOrders | ( | const BondOrderOptions & | options | ) |
Perceives bond orders from the connectivity (and, optionally, the geometry) of the molecule. Bonds are assumed to be present already; only bonds currently of order 1 are ever raised.
Every non-metal atom has one target valence, from atomValence() for its element, formal charge and current bond order sum. The atom's unsaturation is that target minus the bond order sum it already has. The task is then to give each candidate bond (a single bond between two unsaturated atoms) an extra order of 0, 1 or 2 so that the extras at every atom add up to exactly its unsaturation. This is a degree-constrained subgraph problem; it is solved exactly by constraint propagation with bounded backtracking, separately for each connected group of candidate bonds. A group that can be solved is written back; a group that cannot is left exactly as it was, and its unsaturated atoms are reported.
Rules, all of them chemistry judgements for a reviewer to check:
options asks for it, bond lengths decide which of several valid assignments is tried first. For a bond of length d the order k nearest to d, among the AtomUtilities::idealBondLength() values for k = 1, 2, 3, is the one preferred, and bonds that look most strongly multiple are branched on first. This only steers the search: the first valid assignment found is taken, with no attempt to find the best one overall.Limits: there is one fixed valence per atom, chosen by the sum of its existing bond orders. Atoms whose valence depends on the answer (hypervalent S and P, nitro groups, N-oxides), charged or radical atoms, and heavy-atom-only structures with missing hydrogens will be reported as failures instead of being assigned charges or implicit hydrogens.
| void perceiveBondOrders | ( | ) |
Perceives bond orders with default options, ignoring the result.
| void perceiveSubstitutedCations | ( | ) |
Perceives all-carbon-substituted onium ions of nitrogen, oxygen, phosphorus, sulfur, arsenic and selenium.
| int coordinate3d | ( | ) | const |
| const Array< Vector3 > & coordinate3dRef | ( | size_t | index | ) | const |
index without copying it, or an empty array if there is no such set.coordinate3d() hands back a copy of every atom position in the set, which is what reading a whole trajectory one set at a time should not pay for.
| void clearCoordinate3d | ( | ) |
Clear coordinate sets (except the default set)
| void estimateVelocities | ( | ) |
Estimate velocities from the coordinate sets and timesteps.
Does nothing unless there is one timestep per coordinate set. The timesteps are taken as they are stored, so a conventional dynamics trajectory – coordinates in Angstrom, timesteps in picoseconds – gives velocities in Angstrom per picosecond, which is what the derived properties below assume.
Alongside the per-atom velocities this fills three per-coordinate-set properties, next to "energies" and "forces" in the data map:
| void estimateVelocities | ( | double | timeStep | ) |
Estimate velocities taking the coordinate sets to be timeStep apart, rather than reading the stored timesteps.
Most trajectory files do not record when each frame was written, so the spacing has to come from the caller instead. The stored timesteps are left untouched; everything else behaves as the overload above.
| timeStep | the interval between consecutive coordinate sets, in picoseconds. |
| Array< Vector3 > velocities | ( | int | index | ) | const |
Get the velocities for the specified index.
| bool setVelocities | ( | const Array< Vector3 > & | velocities, |
| int | index ) |
Set the velocities for the specified index.
Call updateVelocityProperties() once the last set is in to bring the derived per-coordinate-set properties up to date with them.
| void updateVelocityProperties | ( | ) |
Fill the per-coordinate-set properties derived from the velocities – "velocities", "velocityDeviations" and "temperatures", described under estimateVelocities() above.
estimateVelocities() does this for the velocities it works out itself. Anything that supplies velocities of its own, through setVelocities(), should call this afterwards.
| void clearVelocities | ( | ) |
Clear all velocity sets.
| bool setTimeStep | ( | double | timestep, |
| int | index ) |
Timestep property is used when molecular dynamics trajectories are read
| const Array< Vector3 > & forceVectors | ( | ) | const |
| Array< Vector3 > & forceVectors | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Vector3 forceVector | ( | Index | atomId | ) | const |
Get the force of a single atom.
| atomId | The index of the atom. |
| bool setForceVectors | ( | const Core::Array< Vector3 > & | forces | ) |
Replace the current array of force vectors.
| forces | The new coordinate array. Must be of length atomCount(). |
| bool setForceVector | ( | Index | atomId, |
| const Vector3 & | force ) |
Set the 3D position of a single atom.
| atomId | The index of the atom to modify. |
| force | The new position of the atom. |
| Index residueCount | ( | ) | const |
| std::string residueLabel | ( | Index | residueIndex | ) | const |
| residueIndex | The index of the residue. |
| bool setResidueLabel | ( | Index | residueIndex, |
| const std::string & | label ) |
Set the custom label of a single residue.
| residueIndex | The index of the residue to modify. |
| label | The new label of the residue. |
| bool setResidueLabels | ( | const Core::Array< std::string > & | label | ) |
Set all the residue labels in the molecule.
| label | The new label array. Must be of length residueCount(). |
| Index atomCount | ( | ) | const |
| Index atomCount | ( | unsigned char | atomicNumber | ) | const |
| atomicNumber | The atomic number to match on. |
| Index bondCount | ( | ) | const |
| std::pair< Index, Index > bondPair | ( | Index | bondId | ) | const |
Get the set of bonded atoms corresponding to bondId.
| bondId | The index of the requested bond. |
| bool setBondPairs | ( | const Array< std::pair< Index, Index > > & | pairs | ) |
Replace the current array of bonded atoms.
| pairs | The array. |
| const Array< std::pair< Index, Index > > & bondPairs | ( | ) | const |
| const Array< unsigned char > & bondOrders | ( | ) | const |
| const Graph & graph | ( | ) | const |
| const Array< unsigned char > & atomicNumbers | ( | ) | const |
| unsigned char atomicNumber | ( | Index | atomId | ) | const |
Get the atomic number for the requested atom.
| atomId | The index of the atom. |
| bool setBondOrders | ( | const Array< unsigned char > & | orders | ) |
Replace the current array of bond orders.
| orders | The new array. |
| bool setBondOrder | ( | Index | bondId, |
| unsigned char | order ) |
Set the order of a bond in the molecule.
| bondId | The bond's index. |
| order | The new order of the bond. |
| bool hasCustomElements | ( | ) | const |
| bool setBondPair | ( | Index | bondId, |
| const std::pair< Index, Index > & | pair ) |
Set the bonded atoms for a bond.
| bondId | The bond to modify. |
| pair | The new bond pair. |
| unsigned char bondOrder | ( | Index | bondId | ) | const |
Get the order of a bond.
| bondId | The id of the bond. |
| bool setAtomicNumbers | ( | const Core::Array< unsigned char > & | nums | ) |
Replace the current array of atomic numbers.
| nums | The new atomic number array. Must be of length atomCount(). |
| bool setAtomicNumber | ( | Index | atomId, |
| unsigned char | atomicNumber ) |
Set the atomic number of a single atom.
| atomId | The index of the atom to modify. |
| atomicNumber | The new atomic number. |
| void addConstraint | ( | Real | Value, |
| Index | a, | ||
| Index | b, | ||
| Index | c = MaxIndex, | ||
| Index | d = MaxIndex ) |
Freeze or unfreeze an atom for optimization
| void addConstraint | ( | Constraint & | c | ) |
Freeze or unfreeze an atom for optimization
| void removeConstraint | ( | Index | a, |
| Index | b, | ||
| Index | c = MaxIndex, | ||
| Index | d = MaxIndex ) |
Freeze or unfreeze an atom for optimization
| void clearConstraints | ( | ) |
Freeze or unfreeze an atom for optimization
| void setConstraints | ( | const std::vector< Core::Constraint > & | constraints | ) |
Freeze or unfreeze an atom for optimization
| std::vector< Core::Constraint > & constraints | ( | ) |
Freeze or unfreeze an atom for optimization
| const std::vector< Core::Constraint > & constraints | ( | ) | const |
Freeze or unfreeze an atom for optimization
| void setFrozenAtom | ( | Index | atomId, |
| bool | frozen ) |
Freeze or unfreeze an atom for optimization
| bool frozenAtom | ( | Index | atomId | ) | const |
| bool frozenAtomAxis | ( | Index | atomId, |
| int | axis ) const |
| atomId | The index of the atom to check |
| axis | The axis to check (0 = x, 1 = y, 2 = z) |
| void setFrozenAtomAxis | ( | Index | atomId, |
| int | axis, | ||
| bool | frozen ) |
Freeze or unfreeze X, Y, or Z coordinate of an atom for optimization
| atomId | The index of the atom to modify. |
| axis | The axis to freeze (0, 1, or 2 for X, Y, or Z) |
| frozen | True to freeze, false to unfreeze |
| Eigen::VectorXd frozenAtomMask | ( | ) | const |
| std::vector< Constraint > scanCoordinates | ( | ) | const |
| void setScanCoordinates | ( | const std::vector< Constraint > & | coordinates | ) |
Replace the scan coordinates.
| coordinates | The coordinates to store. Only the atom indices are kept: a scan coordinate has no target value or force constant. |
| void addScanCoordinate | ( | const Constraint & | coordinate | ) |
Add one scan coordinate, ignoring it if an equivalent one is already stored.
| coordinate | The coordinate to add |
| std::map< unsigned char, size_t > composition | ( | ) | const |
| std::map< std::string, size_t > formulaComposition | ( | ) | const |
| Array< std::pair< Index, Index > > getAtomBonds | ( | Index | index | ) | const |
| Array< unsigned char > getAtomOrders | ( | Index | index | ) | const |
| bool removeBonds | ( | Index | atom | ) |
Remove bonds to atom
| void clearCalculatedResults | ( | ) |
Drop everything that was calculated from the structure – partial charges, forces, velocities, normal modes and spectra. Call this from any edit that changes which atoms or bonds exist: those results describe the molecule as it was, and after such an edit it is not that molecule.
Reindexing them instead would keep the arrays the right length while the numbers went on describing something that no longer exists, which is the worse failure because nothing looks wrong.
| void copyDisplayStateFrom | ( | const Molecule & | other | ) |
Copy which display types are on (and their settings) from other, e.g. to keep Ball and Stick showing when this molecule is replaced by one freshly read from a file or script that has no display state of its own.
Copies the per-plugin enable flags, settings and loaded set, cloning the settings as the copy constructor does. The per-layer vectors are then fitted to this molecule's layer count: extra layers are dropped, and missing ones take the first layer's value so that every layer shows what the user had switched on. Layer assignment, visibility and locks are not touched.
| std::shared_ptr< MoleculeInfo > layerInfo | ( | ) | const |
| void boundingBox | ( | Vector3 & | boxMin, |
| Vector3 & | boxMax, | ||
| const double | radius = 1.0 ) const |
Calculate and return bounding box of the whole molecule or selected atoms only.
| boxMin | [out] the minimum corner (first end of the box diagonal) |
| boxMax | [out] the maximum corner (second end of the box diagonal) |
| radius | [in] radius of a single sphere |
|
protected |
Which elements this molecule contains (e.g., for force fields)