occ
|
Storage class for relevant information of a Molecule. More...
#include <molecule.h>
Public Types | |
enum | Origin { Cartesian , Centroid , CenterOfMass } |
An enum to specify the origin used in some calculations on the Molecule object. More... | |
Public Member Functions | |
Molecule () | |
Molecule (const IVec &nums, const Mat3N &pos) | |
Construct a Molecule from a vector of atomic numbers and positions. | |
Molecule (const std::vector< core::Atom > &atoms) | |
Construct a Molecule from a vector of Atom objects. | |
Molecule (const std::vector< Element > &els, const std::vector< std::array< double, 3 > > &pos) | |
Construct a Molecule from a vector of Element objects, and std::array<double, 3> positions. | |
template<typename N , typename D > | |
Molecule (const std::vector< N > &nums, const std::vector< std::array< D, 3 > > &pos) | |
Construct a Molecule from a vector of atomic numbers a vector arrays of positions. | |
size_t | size () const |
The number of atoms in this molecule. | |
void | set_name (const std::string &name) |
Set the name for this molecule. | |
const std::string & | name () const |
Get the name for this molecule. | |
Vec | interatomic_distances () const |
A vector representing the compressed distance matrix for this Molecule. | |
const auto & | elements () const |
The Element objects for the atoms in this Molecule. | |
const Mat3N & | positions () const |
The positions of the atoms in this Molecule. | |
const IVec & | atomic_numbers () const |
The atomic numbers for the atoms in this Molecule. | |
Vec | vdw_radii () const |
The van der Waals radii for the atoms in this Molecule. | |
Vec | covalent_radii () const |
The van der Waals radii for the atoms in this Molecule. | |
Vec | atomic_masses () const |
The atomic masses of the atoms in this Molecule. | |
double | molar_mass () const |
The total molecular mass. | |
std::vector< core::Atom > | atoms () const |
Convert the atoms represented by this molecule to a std:vector<Atom> | |
void | set_cell_shift (const IVec3 &shift, bool update_atoms=true) |
Set the unit cell offset for this Molecule (default 000) | |
const IVec3 & | cell_shift () const |
Get the unit cell offset for this Molecule (default 000) | |
Vec3 | centroid () const |
The geometric centre of this molecule. | |
Vec3 | center_of_mass () const |
The mass-weighted geometric centre of this molecule. | |
Mat3 | inertia_tensor () const |
The tensor of inertia (in matrix form). | |
Vec3 | principal_moments_of_inertia () const |
The principal moments of inertia, derived from the intertia tensor. | |
Vec3 | rotational_constants () const |
The rotational constants of this Molecule in GHz. | |
double | rotational_free_energy (double T) const |
The rotational component of the entropic free energy of this Molecule (rigid molecule, ideal gas approximation), units are kJ/mol. | |
double | translational_free_energy (double T) const |
The translational component of the entropic free energy of this Molecule (rigid molecule, ideal gas approximation), units are kJ/mol. | |
std::tuple< size_t, size_t, double > | nearest_atom (const Molecule &rhs) const |
The nearest atom-atom pair between atoms in this Molecule and atoms in another. | |
void | add_bond (size_t l, size_t r) |
Manually add a bond connection between two atoms in this Molecule. | |
void | set_bonds (const std::vector< std::pair< size_t, size_t > > &bonds) |
Set the known bond connections in this Molecule. | |
const std::vector< std::pair< size_t, size_t > > & | bonds () const |
Get the list of bonds in this Molecule. | |
int | charge () const |
The net charge of this Molecule. | |
void | set_charge (int c) |
Set the net charge of this Molecule. | |
int | multiplicity () const |
Get the spin multiplicity of this molecule. | |
void | set_multiplicity (int m) |
Set the spin multiplicity of this molecule. | |
int | num_electrons () const |
The number of electrons in this molecule. | |
int | asymmetric_molecule_idx () const |
Get the index into Crystal::symmetry_unique_molecules for this Molecule. | |
void | set_asymmetric_molecule_idx (size_t idx) |
Set the index into Crystal::symmetry_unique_molecules for this Molecule. | |
int | unit_cell_molecule_idx () const |
Get the index into Crystal::unit_cell_molecules for this Molecule. | |
void | set_unit_cell_molecule_idx (size_t idx) |
Set the index into Crystal::unit_cell_molecules for this Molecule. | |
void | set_asymmetric_unit_transformation (const Mat3 &rot, const Vec3 &trans) |
Set the transformation from the corresponding molecule in the asymmetric unit of a Crystal to this geometry. | |
std::pair< Mat3, Vec3 > | asymmetric_unit_transformation () const |
Get the transformation from the corresponding molecule in the asymmetric unit of a Crystal to this geometry. | |
void | set_unit_cell_idx (const IVec &idx) |
Set the unit cell atom indices for all atoms in this Molecule. | |
void | set_unit_cell_shift (const IMat3N &shifts) |
Set the unit cell atom shifts for all atoms in this Molecule. | |
void | set_asymmetric_unit_idx (const IVec &idx) |
Set the asymmetric unit atom indices for all atoms in this Molecule. | |
void | set_asymmetric_unit_symop (const IVec &symop) |
Set the associated SymmetryOperation for all all atoms in from their asymmetric unit counterpart (encoded as an int). | |
const auto & | unit_cell_idx () const |
Get the unit cell atom indices for all atoms in this Molecule. | |
const auto & | unit_cell_shift () const |
Get the unit cell atom shifts for all atoms in this Molecule. | |
const auto & | asymmetric_unit_idx () const |
Get the asymmetric unit atom indices for all atoms in this Molecule. | |
const auto & | asymmetric_unit_symop () const |
Get the set of SymmetryOperation for all atoms in this Molecule (i.e. | |
void | rotate (const Eigen::Affine3d &r, Origin o=Cartesian) |
Rotate this Molecule by the given rotation, about the specified origin. | |
void | rotate (const Mat3 &r, Origin o=Cartesian) |
Rotate this Molecule by the given rotation, about the specified origin. | |
void | rotate (const Mat3 &r, const Vec3 &o) |
Rotate this Molecule by the given rotation, about the specified origin. | |
void | transform (const Mat4 &t, Origin o=Cartesian) |
Transform this Molecule by the given homogeneous transformation matrix, with rotation performed about the specified origin. | |
void | transform (const Mat4 &t, const Vec3 &o) |
Transform this Molecule by the given homogeneous transformation matrix, with rotation performed about the specified origin. | |
void | translate (const Vec3 &t) |
Translate this Molecule by the given vector. | |
Molecule | rotated (const Eigen::Affine3d &r, Origin o=Cartesian) const |
A copy of this Molecule transformed by the given rotation, about the specified origin. | |
Molecule | rotated (const Mat3 &r, Origin o=Cartesian) const |
A copy of this Molecule transformed by the given rotation, about the specified origin. | |
Molecule | rotated (const Mat3 &r, const Vec3 &o) const |
A copy of this Molecule transformed by the given rotation, about the specified origin. | |
Molecule | transformed (const Mat4 &t, Origin o=Cartesian) const |
A copy of this Molecule transformed by the given homogeneous transformation matrix, with rotation performed about the specified origin. | |
Molecule | transformed (const Mat4 &t, const Vec3 &o) const |
A copy of this Molecule transformed by the given homogeneous transformation matrix, with rotation performed about the specified origin. | |
Molecule | translated (const Vec3 &t) const |
A copy of this Molecule translated by the given vector. | |
bool | is_comparable_to (const Molecule &rhs) const |
Determine whether this Molecule and another can be sensibly compared. | |
bool | is_equivalent_to (const Molecule &rhs) const |
Determine whether this Molecule and another are equivalent. | |
void | set_partial_charges (const Vec &v) |
const auto & | partial_charges () |
Vec | esp_partial_charges (const occ::Mat3N &positions) const |
Storage class for relevant information of a Molecule.
The role of the Molecule class is to store basic information about atoms which are bonded, and to facilitate convenient calculations of properties of these atoms.
An enum to specify the origin used in some calculations on the Molecule object.
|
inlineexplicit |
occ::core::Molecule::Molecule | ( | const IVec & | nums, |
const Mat3N & | pos | ||
) |
Construct a Molecule from a vector of atomic numbers and positions.
nums | Vector of length N atomic numbers |
pos | Matrix (3, N) of atomic positions (Angstroms) |
occ::core::Molecule::Molecule | ( | const std::vector< core::Atom > & | atoms | ) |
occ::core::Molecule::Molecule | ( | const std::vector< Element > & | els, |
const std::vector< std::array< double, 3 > > & | pos | ||
) |
|
inline |
Construct a Molecule from a vector of atomic numbers a vector arrays of positions.
nums | std::vector<N> of atomic numbers, convertible to int |
pos | std::vector<std::array<D, 3> > of atomic positions, convertible to double. |
Positions are assumed to be in Angstroms.
|
inline |
|
inline |
Get the index into Crystal::symmetry_unique_molecules for this Molecule.
|
inline |
Get the asymmetric unit atom indices for all atoms in this Molecule.
See also Molecule::asymmetric_molecule_idx if you wish to get the mapping for the molecule index rather than atom indices.
|
inline |
Get the set of SymmetryOperation for all atoms in this Molecule (i.e.
mapping from their corresponding asymmetric unit atom to their position here).
See also Molecule::asymmetric_unit_transformation if you wish to get the mapping for the molecule index rather than atom indices.
Get the transformation from the corresponding molecule in the asymmetric unit of a Crystal to this geometry.
By default the rotation is the identity matrix, and the translation is the zero vector.
See also Molecule::asymmetric_molecule_idx
Vec occ::core::Molecule::atomic_masses | ( | ) | const |
|
inline |
The atomic numbers for the atoms in this Molecule.
std::vector< core::Atom > occ::core::Molecule::atoms | ( | ) | const |
Convert the atoms represented by this molecule to a std:vector<Atom>
|
inline |
const IVec3 & occ::core::Molecule::cell_shift | ( | ) | const |
Vec3 occ::core::Molecule::center_of_mass | ( | ) | const |
The mass-weighted geometric centre of this molecule.
See Molecule::centroid if you don't need to incorporate masses
Vec3 occ::core::Molecule::centroid | ( | ) | const |
The geometric centre of this molecule.
See Molecule::center_of_mass if you need to incorporate masses
|
inline |
The net charge of this Molecule.
Vec occ::core::Molecule::covalent_radii | ( | ) | const |
|
inline |
Vec occ::core::Molecule::esp_partial_charges | ( | const occ::Mat3N & | positions | ) | const |
Mat3 occ::core::Molecule::inertia_tensor | ( | ) | const |
The tensor of inertia (in matrix form).
Vec occ::core::Molecule::interatomic_distances | ( | ) | const |
A vector representing the compressed distance matrix for this Molecule.
Since the NxN distance matrix for all atoms in this molecule is by definition symmetric, and the diagonals would be 0, this will return a N * (N - 1) / 2
length vector where the distance for atom i to atom j can be calculated in the following loop:
bool occ::core::Molecule::is_comparable_to | ( | const Molecule & | rhs | ) | const |
Determine whether this Molecule and another can be sensibly compared.
The working definition here of whether two molecules are comparable is whether they have the exact same IVec of atomic numbers, in the same order (i.e. the same chemical composition, and the order of atoms is not permuted.
bool occ::core::Molecule::is_equivalent_to | ( | const Molecule & | rhs | ) | const |
Determine whether this Molecule and another are equivalent.
rhs | The other Molecule object to check equivalence |
The working definition here of whether two molecules are equivalent if a) they are comparable (i.e. all atomic numbers are the same) and b) all interatomic distances are the same.
double occ::core::Molecule::molar_mass | ( | ) | const |
The total molecular mass.
|
inline |
Get the spin multiplicity of this molecule.
|
inline |
Get the name for this molecule.
std::tuple< size_t, size_t, double > occ::core::Molecule::nearest_atom | ( | const Molecule & | rhs | ) | const |
The nearest atom-atom pair between atoms in this Molecule and atoms in another.
rhs | The other Molecule object to find distances. |
See Molecule::nearest_atom_distance if you only need the distance
|
inline |
The number of electrons in this molecule.
Molecule::charge is incorporated, so the result should be the sum of atomic numbers - net charge (as electrons have -ve charge).
|
inline |
|
inline |
The positions of the atoms in this Molecule.
Vec3 occ::core::Molecule::principal_moments_of_inertia | ( | ) | const |
The principal moments of inertia, derived from the intertia tensor.
Rotate this Molecule by the given rotation, about the specified origin.
r | The rotation. |
o | The desired Origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::rotated if you wish to return a copy of this Molecule.
Rotate this Molecule by the given rotation, about the specified origin.
Overload for any Mat3.
r | The rotation. |
o | The desired position about which to rotate (Angstroms). |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin).
See Molecule::rotated if you wish to return a copy of this Molecule.
Rotate this Molecule by the given rotation, about the specified origin.
Overload for any Mat3.
r | The rotation. |
o | The desired Origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin).
See Molecule::rotated if you wish to return a copy of this Molecule.
A copy of this Molecule transformed by the given rotation, about the specified origin.
r | The rotation. |
o | The desired Origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::rotate if you wish to modify this Molecule.
A copy of this Molecule transformed by the given rotation, about the specified origin.
r | The rotation. |
o | The desired position about which to rotate (Angstroms). |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::rotate if you wish to modify this Molecule.
A copy of this Molecule transformed by the given rotation, about the specified origin.
r | The rotation. |
o | The desired Origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::rotate if you wish to modify this Molecule.
Vec3 occ::core::Molecule::rotational_constants | ( | ) | const |
The rotational constants of this Molecule in GHz.
double occ::core::Molecule::rotational_free_energy | ( | double | T | ) | const |
|
inline |
Set the index into Crystal::symmetry_unique_molecules for this Molecule.
idx | an integer representing the index. |
|
inline |
Set the asymmetric unit atom indices for all atoms in this Molecule.
idx | an IVec containing the relevant indices into the set of asymmetric unit atoms for the Crystal associated with this Molecule. |
See also Molecule::set_asymmetric_molecule_idx if you wish to set the molecule index rather than atom indices.
void occ::core::Molecule::set_asymmetric_unit_symop | ( | const IVec & | symop | ) |
Set the associated SymmetryOperation for all all atoms in from their asymmetric unit counterpart (encoded as an int).
symop | an IVec containing the integer encoded SymmetryOperation from the corresponding asymmetric unit atoms in the Crystal for all atoms in. |
See also Molecule::set_asymmetric_unit_transformation if you wish to set the transformation from the molecule. And note that these are not the same thing.
|
inline |
Set the transformation from the corresponding molecule in the asymmetric unit of a Crystal to this geometry.
rot | A Mat3 representing the rotation part of the transform. |
trans | A Vec3 representing the translation part of the transform. |
By default the rotation is the identity matrix, and the translation is the zero vector. Molecule::set_asymmetric_molecule_index should also be set for this to make sense. It is the responsibility of the caller to ensure these values correspond.
|
inline |
void occ::core::Molecule::set_cell_shift | ( | const IVec3 & | shift, |
bool | update_atoms = true |
||
) |
Set the unit cell offset for this Molecule (default 000)
shift | the desired CellShift |
|
inline |
Set the net charge of this Molecule.
c | an integer representing the net charge. |
No checks are performed to ensure this charge is sensible.
|
inline |
Set the spin multiplicity of this molecule.
m | an integer representing the spin multiplicity of this molecule. |
No checks are performed to ensure this is a sensible value.
|
inline |
Set the name for this molecule.
name | std::string representing the name/identifier for this Molecule. |
See Molecule::name
|
inline |
|
inline |
Set the unit cell atom indices for all atoms in this Molecule.
idx | an IVec containing the relevant indices into the set of unit cell atoms for the Crystal associated with this Molecule. |
See also Molecule::set_unit_cell_molecule_idx if you wish to set the molecule index rather than atom indices.
|
inline |
Set the index into Crystal::unit_cell_molecules for this Molecule.
idx | an integer representing the index. |
|
inline |
Set the unit cell atom shifts for all atoms in this Molecule.
shifts | an IMat3N containing the relevant shifts to generate the atoms of this molecule from the unit cell atoms of the Crystal associated with this Molecule. |
See also Molecule::set_cell_shift if you wish to set the unit cell molecule shift rather than atom indices.
|
inline |
The number of atoms in this molecule.
Calculated based on the internal IVec of atomic numbers.
Transform this Molecule by the given homogeneous transformation matrix, with rotation performed about the specified origin.
t | The homogeneous transformation matrix. |
o | The desired position about which to rotate (Angstroms). |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::transformed if you wish to return a copy of this Molecule.
Transform this Molecule by the given homogeneous transformation matrix, with rotation performed about the specified origin.
t | The homogeneous transformation matrix. |
o | The desired Origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::transformed if you wish to return a copy of this Molecule.
A copy of this Molecule transformed by the given homogeneous transformation matrix, with rotation performed about the specified origin.
t | The homogeneous transformation matrix. |
o | The desired position about which to rotate (Angstroms). |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::transforme if you wish to modify this Molecule.
A copy of this Molecule transformed by the given homogeneous transformation matrix, with rotation performed about the specified origin.
t | The homogeneous transformation matrix. |
o | The desired origin about which to rotate. |
All rotations will be in the Cartesian axis frame (though not necessarily about the Cartesian origin)
See Molecule::transform if you wish to modify this Molecule.
void occ::core::Molecule::translate | ( | const Vec3 & | t | ) |
Translate this Molecule by the given vector.
t | translation vector (Angstroms). |
See Molecule::translated if you wish to return a copy of this Molecule.
A copy of this Molecule translated by the given vector.
t | translation vector (Angstroms). |
See Molecule::translate if you wish to modify this Molecule.
double occ::core::Molecule::translational_free_energy | ( | double | T | ) | const |
|
inline |
Get the unit cell atom indices for all atoms in this Molecule.
See also Molecule::unit_cell_molecule_idx if you wish to get the mapping for the molecule index rather than atom indices.
|
inline |
Get the index into Crystal::unit_cell_molecules for this Molecule.
|
inline |
Get the unit cell atom shifts for all atoms in this Molecule.
See also Molecule::cell_shift if you wish to get the unit cell molecule shift rather than atom indices.
Vec occ::core::Molecule::vdw_radii | ( | ) | const |