occ
Loading...
Searching...
No Matches
occ::core::Dimer Class Reference

Storage class for relevant information of a dimer (pair) of Molecule objects. More...

#include <dimer.h>

Public Types

enum class  MoleculeOrder : bool { AB = true , BA = false }
 An enum to clarify the order of information presented when for merged arrays e.g. More...
 

Public Member Functions

 Dimer ()=default
 
 Dimer (const Molecule &mol_A, const Molecule &mol_B)
 Constructor from two Molecule objects.
 
 Dimer (const std::vector< occ::core::Atom > &atoms_A, const std::vector< occ::core::Atom > &atoms_B)
 Constructor from two std::vector<Atom> objects.
 
Vec3 centroid () const
 
const Moleculea () const
 Convenience wrapper to access the Molecule instance for Molecule A.
 
const Moleculeb () const
 Convenience wrapper to access the Molecule instance for Molecule B.
 
double centroid_distance () const
 Calculate the centroid - centroid distance between A & B.
 
double center_of_mass_distance () const
 Calculate the distance between centre of mass of Molecules A & B.
 
double nearest_distance () const
 Calculate the distance between closest pair of Atoms in Molecules A & B.
 
std::optional< occ::Mat4symmetry_relation () const
 The symmetry operation to transform from Molecule A to Molecule B, if there is one.
 
Vec3 v_ab () const
 The vector from centroid of Molecule A to the centroid of Molecule B.
 
Vec vdw_radii (MoleculeOrder order=MoleculeOrder::AB) const
 Vector of van der Waals radii for the atoms in this Dimer.
 
IVec atomic_numbers (MoleculeOrder order=MoleculeOrder::AB) const
 Vector of atomic numbers for the atoms in this Dimer.
 
Mat3N positions (MoleculeOrder order=MoleculeOrder::AB) const
 The positions of all atoms in this Dimer.
 
int num_electrons () const
 The total number of electrons in this Dimer.
 
int charge () const
 The net charge of this Dimer.
 
int multiplicity () const
 The net spin multiplicity of this Dimer.
 
void set_interaction_id (size_t i)
 Set the index or identifier for which interaction this Dimer represents.
 
size_t interaction_id () const
 Get the index or identifier for which interaction this Dimer represents.
 
void set_interaction_energy (double e, const std::string &key="Total")
 Set the value of the interaction energy for this Dimer.
 
double interaction_energy (const std::string &key="Total") const
 Get the stored interaction energy for this Dimer.
 
void set_interaction_energies (const ankerl::unordered_dense::map< std::string, double > &e)
 
const auto & interaction_energies () const
 Get the stored interaction energy components for this Dimer.
 
bool same_asymmetric_molecule_idxs (const Dimer &rhs) const
 Check if two dimers have the same asymmetric molecul indexes.
 
bool operator== (const Dimer &rhs) const
 Check if two dimers are identical under some transformation.
 
bool operator!= (const Dimer &rhs) const
 Check if two dimers are not identical under some transformation.
 
bool equivalent_in_opposite_frame (const Dimer &b, const Mat3 &rot=Mat3::Identity()) const
 Check if two dimers are identical in the opposite reference frame.
 
bool equivalent (const Dimer &b, const Mat3 &rot=Mat3::Identity()) const
 Check if two dimers are identical in the same reference frame.
 
const auto & name () const
 
void set_name (const std::string &name)
 
std::string xyz_string () const
 
void set_property (const std::string &key, const std::string &value)
 Set the value of a property for this Dimer.
 
const auto & properties () const
 
void set_properties (const ankerl::unordered_dense::map< std::string, std::string > &p)
 

Detailed Description

Storage class for relevant information of a dimer (pair) of Molecule objects.

The role of the Dimer class is to store information about a pair of molecules which represents a dimer, and to calculate relevant properties.

Member Enumeration Documentation

◆ MoleculeOrder

enum class occ::core::Dimer::MoleculeOrder : bool
strong

An enum to clarify the order of information presented when for merged arrays e.g.

atomic_numbers(), positions() etc.

Enumerator
AB 

The A molecule data is first, then B.

BA 

The B molecule data is first, then A.

Constructor & Destructor Documentation

◆ Dimer() [1/3]

occ::core::Dimer::Dimer ( )
default

◆ Dimer() [2/3]

occ::core::Dimer::Dimer ( const Molecule mol_A,
const Molecule mol_B 
)

Constructor from two Molecule objects.

Parameters
mol_AMolecule A
mol_BMolecule B

A copy of these two molecules is kept internally, so they need not exist outside this Dimer. Further, any changes to those Molecule objects after Dimer construction will not appear here.

◆ Dimer() [3/3]

occ::core::Dimer::Dimer ( const std::vector< occ::core::Atom > &  atoms_A,
const std::vector< occ::core::Atom > &  atoms_B 
)

Constructor from two std::vector<Atom> objects.

Parameters
atoms_Aatoms representing/constituting Molecule A
atoms_Batoms representing/constituting Molecule B

The data from these two vectors is copied internally, so they need not exist outside this Dimer. Further, any changes to those Atom objects after Dimer construction will not appear here.

Member Function Documentation

◆ a()

const Molecule & occ::core::Dimer::a ( ) const
inline

Convenience wrapper to access the Molecule instance for Molecule A.

Returns
Molecule A

◆ atomic_numbers()

IVec occ::core::Dimer::atomic_numbers ( MoleculeOrder  order = MoleculeOrder::AB) const

Vector of atomic numbers for the atoms in this Dimer.

Parameters
orderspecify whether the atomic numbers of the atoms in Molecule A should be first, or those in Molecule B.
Returns
an IVec object representing the atomic numbers of atoms in the Dimer in the specified (AB or BA) order.

◆ b()

const Molecule & occ::core::Dimer::b ( ) const
inline

Convenience wrapper to access the Molecule instance for Molecule B.

Returns
Molecule A

◆ center_of_mass_distance()

double occ::core::Dimer::center_of_mass_distance ( ) const

Calculate the distance between centre of mass of Molecules A & B.

Returns
a double representing the distance (in Angstroms) between the centre of mass of Molecule A and centre of mass of Molecule B.

◆ centroid()

Vec3 occ::core::Dimer::centroid ( ) const

◆ centroid_distance()

double occ::core::Dimer::centroid_distance ( ) const

Calculate the centroid - centroid distance between A & B.

Returns
a double representing the distance (in Angstroms) between the centroid of Molecule A and Molecule B. The centroid is the geometric average positions (it is not the centre of mass).

◆ charge()

int occ::core::Dimer::charge ( ) const
inline

The net charge of this Dimer.

Returns
an integer with value equal to the sum of the net charge of Molecule A and the net charge of Molecule B.

◆ equivalent()

bool occ::core::Dimer::equivalent ( const Dimer b,
const Mat3 rot = Mat3::Identity() 
) const

Check if two dimers are identical in the same reference frame.

Parameters
banother Dimer object
rota Matrix representing a rotation, applied to A.
Returns
True if the Dimer objects are found to be equivalent.

This is defined such that that Dimer b will be equivalent if Molecule B from the reference frame of Molecule A is equivalent to Molecule rhs.B in the reference frame of rhs.A

◆ equivalent_in_opposite_frame()

bool occ::core::Dimer::equivalent_in_opposite_frame ( const Dimer b,
const Mat3 rot = Mat3::Identity() 
) const

Check if two dimers are identical in the opposite reference frame.

Parameters
banother Dimer object
rota Matrix representing a rotation, applied to A.
Returns
True if the Dimer objects are found to be equivalent.

The opposite reference frame here is that Dimer b will be equivalent if Molecule B from the reference frame of Molecule A is equivalent to Molecule rhs.A in the reference frame of rhs.B

◆ interaction_energies()

const auto & occ::core::Dimer::interaction_energies ( ) const
inline

Get the stored interaction energy components for this Dimer.

Returns
a map representing the interaction energies, index by string identifiers

◆ interaction_energy()

double occ::core::Dimer::interaction_energy ( const std::string &  key = "Total") const

Get the stored interaction energy for this Dimer.

Parameters
keya string labelling the component of the interaction energy.
Returns
a double representing the interaction energy (default = 0.0)

◆ interaction_id()

size_t occ::core::Dimer::interaction_id ( ) const
inline

Get the index or identifier for which interaction this Dimer represents.

Returns
a size_t representing the interaction index (default = 0)

◆ multiplicity()

int occ::core::Dimer::multiplicity ( ) const
inline

The net spin multiplicity of this Dimer.

Returns
an integer with value equal to net spin multiplicity when combining Molecule A and Molecule B.

◆ name()

const auto & occ::core::Dimer::name ( ) const
inline

◆ nearest_distance()

double occ::core::Dimer::nearest_distance ( ) const

Calculate the distance between closest pair of Atoms in Molecules A & B.

Returns
a double representing the distance (in Angstroms) between the nearest pair of Atoms (one from Molecule A & one from Molecule B).
Note
This will be significantly more expensive and scale as O(Na * Nb) for the number of atoms Na in Molecule A and Nb for the number of atoms in Molecule B

◆ num_electrons()

int occ::core::Dimer::num_electrons ( ) const
inline

The total number of electrons in this Dimer.

Returns
an integer with value equal to the sum of the number of electrons in Molecule A and the number of electrons in Molecule B.

◆ operator!=()

bool occ::core::Dimer::operator!= ( const Dimer rhs) const
inline

Check if two dimers are not identical under some transformation.

Parameters
rhsanother Dimer object
Returns
True if the dimers are not found to be identical.

Uses Dimer::operator== to find the result.

◆ operator==()

bool occ::core::Dimer::operator== ( const Dimer rhs) const

Check if two dimers are identical under some transformation.

Parameters
rhsanother Dimer object
Returns
True if the dimers are found to be identical.

The working definition of equality here is such that all the following must be true:

  1. The asymmetric molecule indices must be the same i.e. calling same_asymmetric_molecule_idxs yields true.
  2. Both Dimers have the same centroid_distance, center_of_mass_distance and nearest_atom_distance
  3. Either this.a is equivalent to rhs.a and this.b is equivalent to rhs.b, or this.a is equivalent to rhs.b and rhs.a is equivalent to this.b. See Molecule::equivalent_to

◆ positions()

Mat3N occ::core::Dimer::positions ( MoleculeOrder  order = MoleculeOrder::AB) const

The positions of all atoms in this Dimer.

Parameters
orderspecify whether the positions of the atoms in Molecule A should be first, or those in Molecule B.
Returns
A (3, N) matrix of atomic positions for the atoms in this dimer, in Angstroms

◆ properties()

const auto & occ::core::Dimer::properties ( ) const
inline

◆ same_asymmetric_molecule_idxs()

bool occ::core::Dimer::same_asymmetric_molecule_idxs ( const Dimer rhs) const

Check if two dimers have the same asymmetric molecul indexes.

Parameters
rhsanother Dimer object
Returns
True if all the asymmetric Molecule indices of all Molecules have been set, and they are equal (ignoring ordering of AB in either Dimer).

◆ set_interaction_energies()

void occ::core::Dimer::set_interaction_energies ( const ankerl::unordered_dense::map< std::string, double > &  e)
inline

◆ set_interaction_energy()

void occ::core::Dimer::set_interaction_energy ( double  e,
const std::string &  key = "Total" 
)

Set the value of the interaction energy for this Dimer.

Parameters
ea double representing the interaction energy.
keya string labelling the component of the interaction energy.

◆ set_interaction_id()

void occ::core::Dimer::set_interaction_id ( size_t  i)
inline

Set the index or identifier for which interaction this Dimer represents.

Parameters
ithe interaction index.

◆ set_name()

void occ::core::Dimer::set_name ( const std::string &  name)
inline

◆ set_properties()

void occ::core::Dimer::set_properties ( const ankerl::unordered_dense::map< std::string, std::string > &  p)
inline

◆ set_property()

void occ::core::Dimer::set_property ( const std::string &  key,
const std::string &  value 
)
inline

Set the value of a property for this Dimer.

Parameters
keya string labelling the property.
valuea string containing the value of the property

◆ symmetry_relation()

std::optional< occ::Mat4 > occ::core::Dimer::symmetry_relation ( ) const

The symmetry operation to transform from Molecule A to Molecule B, if there is one.

Returns
either std::nullopt if Molecule A and Molecule B are not symmetry related, or a Mat4 object containing the rotation and translation to transform Molecule A to Molecule B.

Under the hood, this uses the Kabsch algorithm

◆ v_ab()

Vec3 occ::core::Dimer::v_ab ( ) const

The vector from centroid of Molecule A to the centroid of Molecule B.

Returns
a Vec3 representing the vector between the centroid of A and the centroid of B.

◆ vdw_radii()

Vec occ::core::Dimer::vdw_radii ( MoleculeOrder  order = MoleculeOrder::AB) const

Vector of van der Waals radii for the atoms in this Dimer.

Parameters
orderspecify whether the radii of the atoms in Molecule A should be first, or those in Molecule B.
Returns
a Vec object representing the van der Waals radii of atoms in the Dimer in the specified (AB or BA) order, in Angstroms.

◆ xyz_string()

std::string occ::core::Dimer::xyz_string ( ) const

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