AvogadroLibs  1.93.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Molecule Class Reference

The Molecule class represents a chemical molecule.

#include <avogadro/core/molecule.h>

Inheritance diagram for Molecule:
Molecule

Public Types

typedef Atom AtomType
 
typedef Bond BondType
 
typedef std::map< unsigned char, std::string > CustomElementMap
 

Public Member Functions

 Molecule ()
 
 Molecule (const Molecule &other)
 
 Molecule (Molecule &&other) noexcept
 
Moleculeoperator= (const Molecule &other)
 
Moleculeoperator= (Molecule &&other) noexcept
 
virtual ~Molecule ()
 
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 VariantMapdataMap () const
 
VariantMapdataMap ()
 
Array< unsigned char > & atomicNumbers ()
 
const Array< unsigned char > & atomicNumbers () const
 
unsigned char atomicNumber (Index atomId) const
 
bool setAtomicNumbers (const Core::Array< unsigned char > &nums)
 
bool setAtomicNumber (Index atomId, unsigned char atomicNumber)
 
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)
 
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)
 
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)
 
void setAtomSelected (Index atomId, bool selected)
 
bool atomSelected (Index atomId) const
 
bool isSelectionEmpty () const
 
Array< std::pair< Index, Index > > & bondPairs ()
 
const Array< std::pair< Index, Index > > & bondPairs () const
 
std::pair< Index, IndexbondPair (Index bondId) const
 
bool setBondPairs (const Array< std::pair< Index, Index >> &pairs)
 
bool setBondPair (Index bondId, const std::pair< Index, Index > &pair)
 
Array< unsigned char > & bondOrders ()
 
const Array< unsigned char > & bondOrders () const
 
unsigned char bondOrder (Index bondId) const
 
bool setBondOrders (const Array< unsigned char > &orders)
 
bool setBondOrder (Index bondId, unsigned char order)
 
Graphgraph ()
 
const Graphgraph () const
 
bool hasCustomElements () const
 
virtual AtomType addAtom (unsigned char atomicNumber)
 
virtual bool removeAtom (Index index)
 Remove the specified atom from the molecule. More...
 
virtual bool removeAtom (const AtomType &atom)
 Remove the specified atom from the molecule. More...
 
virtual void clearAtoms ()
 
AtomType atom (Index index) const
 
Index atomCount () const
 
Index atomCount (unsigned char atomicNumber) const
 Get the number of atoms in the molecule that match atomicNumber. More...
 
virtual bool removeBond (Index index)
 Remove the specified bond. More...
 
virtual bool removeBond (const BondType &bond)
 Remove the specified bond. More...
 
virtual void clearBonds ()
 
BondType bond (Index index) const
 
BondType bond (const AtomType &a, const AtomType &b) const
 
BondType bond (Index atomId1, Index atomId2) const
 
Index bondCount () const
 
MeshaddMesh ()
 Add a mesh to the molecule. More...
 
Meshmesh (Index index)
 
const Meshmesh (Index index) const
 
Index meshCount () const
 
void clearMeshes ()
 
CubeaddCube ()
 Add a cube to the molecule. More...
 
Cubecube (Index index)
 
const Cubecube (Index index) const
 
Index cubeCount () const
 
void clearCubes ()
 
std::vector< Cube * > cubes ()
 Get the cubes vector set (if present) for the molecule. More...
 
const std::vector< Cube * > cubes () const
 
std::string formula (const std::string &delimiter="", int showCountsOver=1) const
 
double mass () const
 
void setBasisSet (BasisSet *basis)
 
BasisSetbasisSet ()
 
const BasisSetbasisSet () const
 
Array< double > vibrationFrequencies () const
 
void setVibrationFrequencies (const Array< double > &freq)
 
Array< double > vibrationIntensities () const
 
void setVibrationIntensities (const Array< double > &intensities)
 
Array< Vector3 > vibrationLx (int mode) const
 
void setVibrationLx (const Array< Array< Vector3 >> &lx)
 
void perceiveBondsSimple (const double tolerance=0.45, const double minDistance=0.32)
 
void perceiveBondsFromResidueData ()
 
int coordinate3dCount ()
 
bool setCoordinate3d (int coord)
 
Array< Vector3 > coordinate3d (int index) const
 
bool setCoordinate3d (const Array< Vector3 > &coords, int index)
 
bool setTimeStep (double timestep, int index)
 
double timeStep (int index, bool &status)
 
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)
 
ResidueaddResidue (std::string &name, Index &number, char &id)
 
void addResidue (Residue &residue)
 
Residueresidue (int index)
 
const CustomElementMapcustomElementMap () 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. More...
 
virtual bool removeBond (const AtomType &atom1, const AtomType &atom2)
 Remove the specified bond. More...
 
Array< BondTypebonds (const AtomType &a)
 Get all bonds to a. More...
 
Array< BondTypebonds (Index a)
 Get all bonds to a. More...
 
void setUnitCell (UnitCell *uc)
 
UnitCellunitCell ()
 
const UnitCellunitCell () const
 

Protected Member Functions

void updateGraph () const
 

Protected Attributes

Graph m_graph
 
bool m_graphDirty
 
VariantMap m_data
 
CustomElementMap m_customElementMap
 
Array< unsigned char > m_atomicNumbers
 
Array< Vector2m_positions2d
 
Array< Vector3 > m_positions3d
 
Array< Array< Vector3 > > m_coordinates3d
 
Array< double > m_timesteps
 
Array< AtomHybridization > m_hybridizations
 
Array< signed char > m_formalCharges
 
Array< Vector3 > m_forceVectors
 
Array< Vector3ub > m_colors
 
Array< double > m_vibrationFrequencies
 
Array< double > m_vibrationIntensities
 
Array< Array< Vector3 > > m_vibrationLx
 
Array< std::pair< Index, Index > > m_bondPairs
 
Array< unsigned char > m_bondOrders
 
std::vector< bool > m_selectedAtoms
 
std::vector< Mesh * > m_meshes
 
std::vector< Cube * > m_cubes
 
BasisSetm_basisSet
 
UnitCellm_unitCell
 
Array< Residuem_residues
 

Member Typedef Documentation

◆ AtomType

typedef Atom AtomType

Typedef for Atom class.

◆ BondType

typedef Bond BondType

Typedef for Bond class.

◆ CustomElementMap

typedef std::map<unsigned char, std::string> CustomElementMap

Type for custom element map.

Constructor & Destructor Documentation

◆ Molecule() [1/3]

Molecule ( )

Creates a new, empty molecule.

◆ Molecule() [2/3]

Molecule ( const Molecule other)

Copy constructor

◆ Molecule() [3/3]

Molecule ( Molecule &&  other)
noexcept

Move constructor

◆ ~Molecule()

virtual ~Molecule ( )
virtual

Destroys the molecule object.

Reimplemented in Molecule.

Member Function Documentation

◆ operator=() [1/2]

Molecule& operator= ( const Molecule other)

Assignment operator

◆ operator=() [2/2]

Molecule& operator= ( Molecule &&  other)
noexcept

Move assignment operator

◆ setData()

void setData ( const std::string &  name,
const Variant value 
)

Sets the data value with name to value.

◆ data()

Variant data ( const std::string &  name) const

Returns the data value for name.

◆ hasData()

bool hasData ( const std::string &  name) const

Returns true if the molecule has data with the given key, false otherwise.

◆ setDataMap()

void setDataMap ( const VariantMap map)

Set the molecule's variant data to the entries in map.

◆ dataMap() [1/2]

const VariantMap& dataMap ( ) const

Return the molecule's variant data.

◆ dataMap() [2/2]

VariantMap& dataMap ( )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ atomicNumbers() [1/2]

Array<unsigned char>& atomicNumbers ( )

Returns a vector of atomic numbers for the atoms in the molecule.

◆ atomicNumbers() [2/2]

const Array<unsigned char>& atomicNumbers ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ atomicNumber()

unsigned char atomicNumber ( Index  atomId) const

Get the atomic number for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The atomic number of the atom indexed at atomId, or Avogadro::InvalidElement if atomId is invalid.

◆ setAtomicNumbers()

bool setAtomicNumbers ( const Core::Array< unsigned char > &  nums)

Replace the current array of atomic numbers.

Parameters
numsThe new atomic number array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setAtomicNumber()

bool setAtomicNumber ( Index  atomId,
unsigned char  atomicNumber 
)

Set the atomic number of a single atom.

Parameters
atomIdThe index of the atom to modify.
atomicNumberThe new atomic number.
Returns
True on success, false otherwise.

◆ hybridizations() [1/2]

Array<AtomHybridization>& hybridizations ( )

Returns a vector of hybridizations for the atoms in the molecule.

◆ hybridizations() [2/2]

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.

◆ hybridization()

AtomHybridization hybridization ( Index  atomId) const

Get the hybridization for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The hybridization of the atom indexed at atomId, or 0 if atomId is invalid.

◆ setHybridizations()

bool setHybridizations ( const Core::Array< AtomHybridization > &  hybs)

Replace the current array of hybridizations.

Parameters
hybsThe new hybridization array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setHybridization()

bool setHybridization ( Index  atomId,
AtomHybridization  hybridization 
)

Set the hybridization of a single atom.

Parameters
atomIdThe index of the atom to modify.
hybridizationThe new hybridization.
Returns
True on success, false otherwise.

◆ formalCharges() [1/2]

Array<signed char>& formalCharges ( )

Returns a vector of formal charges for the atoms in the molecule.

◆ formalCharges() [2/2]

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.

◆ formalCharge()

signed char formalCharge ( Index  atomId) const

Get the formal charge for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The formal charge of the atom indexed at atomId, or 0 if atomId is invalid.

◆ setFormalCharges()

bool setFormalCharges ( const Core::Array< signed char > &  charges)

Replace the current array of formal charges.

Parameters
chargesThe new formal charge array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setFormalCharge()

bool setFormalCharge ( Index  atomId,
signed char  charge 
)

Set the formal charge of a single atom.

Parameters
atomIdThe index of the atom to modify.
chargeThe new formal charge.
Returns
True on success, false otherwise.

◆ colors() [1/2]

Array<Vector3ub>& colors ( )

Returns a vector of colors for the atoms in the moleucle.

◆ colors() [2/2]

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.

◆ color()

Vector3ub color ( Index  atomId) const

Get the color for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The color of the atom indexed at atomId, or (0,0,0) if atomId is invalid. If no color is set for the given atomId, the default color for the atomic number of the atomId is returned.

◆ setColors()

bool setColors ( const Core::Array< Vector3ub > &  colors)

Replace the current array of colors.

Parameters
colorsThe new color array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setColor()

bool setColor ( Index  atomId,
Vector3ub  color 
)

Set the color of a single atom.

Parameters
atomIdThe index of the atom to modify.
colorThe new color.
Returns
True on success, false otherwise.

◆ atomPositions2d() [1/2]

const Array<Vector2>& atomPositions2d ( ) const

Returns a vector of 2d atom positions for the atoms in the molecule.

◆ atomPositions2d() [2/2]

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.

◆ atomPosition2d()

Vector2 atomPosition2d ( Index  atomId) const

Get the 2D position of a single atom.

Parameters
atomIdThe index of the atom.
Returns
The position of the atom, or Vector3::Zero() if no position information has been set.

◆ setAtomPositions2d()

bool setAtomPositions2d ( const Core::Array< Vector2 > &  pos)

Replace the current array of 2D atomic coordinates.

Parameters
posThe new coordinate array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setAtomPosition2d()

bool setAtomPosition2d ( Index  atomId,
const Vector2 pos 
)

Set the 2D position of a single atom.

Parameters
atomIdThe index of the atom to modify.
posThe new position of the atom.
Returns
True on success, false otherwise.

◆ atomPositions3d() [1/2]

const Array<Vector3>& atomPositions3d ( ) const

Returns a vector of 2d atom positions for the atoms in the molecule.

◆ atomPositions3d() [2/2]

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.

◆ atomPosition3d()

Vector3 atomPosition3d ( Index  atomId) const

Get the 3D position of a single atom.

Parameters
atomIdThe index of the atom.
Returns
The position of the atom, or Vector3::Zero() if no position information has been set.

◆ setAtomPositions3d()

bool setAtomPositions3d ( const Core::Array< Vector3 > &  pos)

Replace the current array of 3D atomic coordinates.

Parameters
posThe new coordinate array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setAtomPosition3d()

bool setAtomPosition3d ( Index  atomId,
const Vector3 &  pos 
)

Set the 3D position of a single atom.

Parameters
atomIdThe index of the atom to modify.
posThe new position of the atom.
Returns
True on success, false otherwise.

◆ setAtomSelected()

void setAtomSelected ( Index  atomId,
bool  selected 
)

Set whether the specified atom is selected or not.

◆ atomSelected()

bool atomSelected ( Index  atomId) const

Query whether the supplied atom index has been selected.

◆ isSelectionEmpty()

bool isSelectionEmpty ( ) const

Returns whether the selection is empty or not

◆ bondPairs() [1/2]

Array<std::pair<Index, Index> >& bondPairs ( )

Returns a vector of pairs of atom indices of the bonds in the molecule.

◆ bondPairs() [2/2]

const Array<std::pair<Index, Index> >& bondPairs ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ bondPair()

std::pair< Index, Index > bondPair ( Index  bondId) const

Get the set of bonded atoms corresponding to bondId.

Parameters
bondIdThe index of the requested bond.
Returns
The bonded atom pair, represented as a pair of atom indices.

◆ setBondPairs()

bool setBondPairs ( const Array< std::pair< Index, Index >> &  pairs)

Replace the current array of bonded atoms.

Parameters
pairsThe array.
Returns
True on success, false on failure.
Note
The bonded atoms are represented as a pair of bond indices.
If needed, the elements in pairs will be modified to ensure that the first atom index is less than the second.

◆ setBondPair()

bool setBondPair ( Index  bondId,
const std::pair< Index, Index > &  pair 
)

Set the bonded atoms for a bond.

Parameters
bondIdThe bond to modify.
pairThe new bond pair.
Returns
True on success, false otherwise.
Note
If needed, pair will be modified to ensure that the first atom index is less than the second.

◆ bondOrders() [1/2]

Array<unsigned char>& bondOrders ( )

Returns a vector of the bond orders for the bonds in the molecule.

◆ bondOrders() [2/2]

const Array<unsigned char>& bondOrders ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ bondOrder()

unsigned char bondOrder ( Index  bondId) const

Get the order of a bond.

Parameters
bondIdThe id of the bond.
Returns
The bond order.

◆ setBondOrders()

bool setBondOrders ( const Array< unsigned char > &  orders)

Replace the current array of bond orders.

Parameters
ordersThe new array.
Returns
True on success, false on failure.

◆ setBondOrder()

bool setBondOrder ( Index  bondId,
unsigned char  order 
)

Set the order of a bond in the molecule.

Parameters
bondIdThe bond's index.
orderThe new order of the bond.
Returns
True on success, false on failure.

◆ graph() [1/2]

Graph& graph ( )

Returns the graph for the molecule.

◆ graph() [2/2]

const Graph& graph ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ customElementMap()

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.

Note
Custom element atomic numbers lie between CustomElementMin and CustomElementMax.
See also
Avogadro::QtGui::CustomElementDialog
hasCustomElements

◆ setCustomElementMap()

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.

Note
Custom element atomic numbers lie between CustomElementMin and CustomElementMax.
See also
Avogadro::QtGui::CustomElementDialog
hasCustomElements

◆ hasCustomElements()

bool hasCustomElements ( ) const
Returns
True if custom elements exist in the molecule.
Note
Custom element atomic numbers lie between CustomElementMin and CustomElementMax.

◆ addAtom()

virtual AtomType addAtom ( unsigned char  atomicNumber)
virtual

Adds an atom to the molecule.

Reimplemented in Molecule.

◆ removeAtom() [1/2]

virtual bool removeAtom ( Index  index)
virtual
Parameters
indexThe index of the atom to be removed.
Returns
True on success, false if the atom was not found.

Reimplemented in Molecule.

◆ removeAtom() [2/2]

virtual bool removeAtom ( const AtomType atom)
virtual
Parameters
atomThe atom to be removed.
Returns
True on success, false if the atom was not found. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented in Molecule.

◆ clearAtoms()

virtual void clearAtoms ( )
virtual

Remove all atoms from the molecule.

◆ atom()

AtomType atom ( Index  index) const
Returns
the atom at index in the molecule.

◆ atomCount() [1/2]

Index atomCount ( ) const
Returns
The number of atoms in the molecule.

◆ atomCount() [2/2]

Index atomCount ( unsigned char  atomicNumber) const
Parameters
atomicNumberThe atomic number to match on.
Returns
The number of atoms with the supplied atomic number.

◆ addBond() [1/2]

virtual BondType addBond ( Index  atom1,
Index  atom2,
unsigned char  order = 1 
)
virtual

Create a new bond in the molecule.

Parameters
atom1The first atom in the bond.
atom2The second atom in the bond.
orderThe bond order.
Returns
The new bond object. Will be invalid if atom1 or atom2 does not exist.

Reimplemented in Molecule.

◆ addBond() [2/2]

virtual BondType addBond ( const AtomType atom1,
const AtomType atom2,
unsigned char  order = 1 
)
virtual

Create a new bond in the molecule.

Parameters
atom1The first atom in the bond.
atom2The second atom in the bond.
orderThe bond order.
Returns
The new bond object. Will be invalid if atom1 or atom2 does not exist.

Reimplemented in Molecule.

◆ removeBond() [1/4]

virtual bool removeBond ( Index  index)
virtual
Parameters
indexThe index of the bond to be removed.
Returns
True on success, false if the bond was not found.

Reimplemented in Molecule.

◆ removeBond() [2/4]

virtual bool removeBond ( const BondType bond)
virtual
Parameters
bondThe bond to be removed.
Returns
True on success, false if the bond was not found. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented in Molecule.

◆ removeBond() [3/4]

virtual bool removeBond ( Index  atom1,
Index  atom2 
)
virtual
Parameters
atom1One atom in the bond.
atom2The other atom in the bond.
Returns
True on success, false if the bond was not found. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented in Molecule.

◆ removeBond() [4/4]

virtual bool removeBond ( const AtomType atom1,
const AtomType atom2 
)
virtual
Parameters
atom1One atom in the bond.
atom2The other atom in the bond.
Returns
True on success, false if the bond was not found. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented in Molecule.

◆ clearBonds()

virtual void clearBonds ( )
virtual

Remove all bonds from the molecule.

◆ bond() [1/3]

BondType bond ( Index  index) const

Returns the bond at index in the molecule.

◆ bond() [2/3]

BondType bond ( const AtomType a,
const AtomType b 
) const

Returns the bond between atoms a and b.

◆ bond() [3/3]

BondType bond ( Index  atomId1,
Index  atomId2 
) const

Returns the bond between atomId1 and atomId2.

◆ bonds() [1/2]

Array<BondType> bonds ( const AtomType a)
Returns
A vector of bonds to the supplied atom a.

◆ bonds() [2/2]

Array<BondType> bonds ( Index  a)
Returns
A vector of bonds to the supplied atom a.

◆ bondCount()

Index bondCount ( ) const

Returns the number of bonds in the molecule.

◆ addMesh()

Mesh* addMesh ( )
Returns
The mesh object added to the molecule.

◆ addCube()

Cube* addCube ( )
Returns
The cube object added to the molecule.

◆ cubes()

std::vector<Cube*> cubes ( )
Returns
The cube vector for the molecule

◆ formula()

std::string formula ( const std::string &  delimiter = "",
int  showCountsOver = 1 
) const

Returns the chemical formula of the molecule.

Parameters
delimiterDelimiter to insert between tokens, defaults to none.
showCountsOverShow atom counts above this (defaults to 1).

◆ mass()

double mass ( ) const
Returns
The mass of the molecule obtained by summing constituent atomic masses.

◆ setBasisSet()

void setBasisSet ( BasisSet basis)

Set the basis set for the molecule, note that the molecule takes ownership of the object.

◆ basisSet()

BasisSet* basisSet ( )

Get the basis set (if present) for the molecule.

◆ setUnitCell()

void setUnitCell ( UnitCell uc)

The unit cell for this molecule. May be nullptr for non-periodic structures.

◆ unitCell() [1/2]

UnitCell* unitCell ( )

The unit cell for this molecule. May be nullptr for non-periodic structures.

◆ unitCell() [2/2]

const UnitCell* unitCell ( ) const

The unit cell for this molecule. May be nullptr for non-periodic structures.

◆ perceiveBondsSimple()

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.

Parameters
toleranceThe calculation tolerance.
minDistance= atoms closer than the square of this are ignored

◆ perceiveBondsFromResidueData()

void perceiveBondsFromResidueData ( )

Perceives bonds in the molecule based on preset residue data.

◆ setTimeStep()

bool setTimeStep ( double  timestep,
int  index 
)

Timestep property is used when molecular dynamics trajectories are read

◆ forceVectors() [1/2]

const Array<Vector3>& forceVectors ( ) const

Returns a vector of forces for the atoms in the molecule.

◆ forceVectors() [2/2]

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.

◆ forceVector()

Vector3 forceVector ( Index  atomId) const

Get the force of a single atom.

Parameters
atomIdThe index of the atom.
Returns
The force vector of the atom, or Vector3::Zero() if no force information has been set.

◆ setForceVectors()

bool setForceVectors ( const Core::Array< Vector3 > &  forces)

Replace the current array of force vectors.

Parameters
forcesThe new coordinate array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setForceVector()

bool setForceVector ( Index  atomId,
const Vector3 &  force 
)

Set the 3D position of a single atom.

Parameters
atomIdThe index of the atom to modify.
forceThe new position of the atom.
Returns
True on success, false otherwise.

◆ updateGraph()

void updateGraph ( ) const
protected

Update the graph to correspond to the current molecule.


The documentation for this class was generated from the following file: