Collaboration diagram for mpqc::Molecule:

Documentation

Molecule is a class which contains a vector of AtomBasedClusterables.

Molecule is a recursively-clustered collection of atoms.

Public Member Functions

 Molecule ()=default
 
 Molecule (const Molecule &)=default
 
 Molecule (Molecule &&)=default
 
Moleculeoperator= (Molecule &&)=default
 
Moleculeoperator= (const Molecule &)=default
 
 Molecule (const KeyVal &kv)
 The KeyVal constructor. More...
 
 Molecule (std::istream &file_stream, bool sort_input=true, Vector3d const &sort_origin=Vector3d::Zero(), std::array< Vector3d, 3 > frame={ {Vector3d{1, 0, 0}, Vector3d{0, 1, 0}, Vector3d{0, 0, 1}}})
 Constructs Molecule from an XYZ-format stream. More...
 
 Molecule (std::vector< AtomBasedClusterable > c, bool sort_input=true)
 Constructor to build Molecule from a vector of clusterables. More...
 
 Molecule (const std::vector< Atom > &atoms)
 
virtual ~Molecule ()=default
 
virtual void in_units_of (const std::string &units)
 Reinterprets coordinates of atoms as having different units. More...
 
void sort_from_point (Vector3d const &point)
 A function to sort the clusters from a given point. More...
 
void set_mass (double mass)
 Function to set the mass of the Molecule. More...
 
int64_t total_atomic_number () const
 
double mass () const
 Mass of the Molecule. More...
 
std::vector< AtomBasedClusterable >::const_iterator begin () const
 Iterator to the first clusterable in the Molecule. More...
 
std::vector< AtomBasedClusterable >::const_iterator end () const
 Iterator to one past the final clusterable in the Molecule. More...
 
int64_t nclusters () const
 Number of clusters in the Molecule. More...
 
std::vector< AtomBasedClusterable > const & clusterables () const
 Vector containing the Clusterable that make up the Molecule. More...
 
int64_t core_electrons () const
 Computes the number of core electrons in the Molecule. More...
 
double nuclear_repulsion_energy () const
 
std::vector< Atomatoms () const
 A vector of all atoms in the Molecule. More...
 
size_t natoms () const
 
Vector3d const & com () const
 Center of mass of the Molecule. More...
 
- Public Member Functions inherited from mpqc::DescribedClass
 DescribedClass ()=default
 
virtual ~DescribedClass ()
 
std::string class_key () const
 
- Public Member Functions inherited from mpqc::enable_shared_from_this< DescribedClass >
virtual ~enable_shared_from_this ()=default
 
std::shared_ptr< DescribedClassshared_from_this ()
 returns the pointer to this object More...
 
std::shared_ptr< std::add_const_t< DescribedClass > > shared_from_this () const
 returns the pointer to this object More...
 
- Public Member Functions inherited from mpqc::detail::virt_base_of_enable_shared_from_this
virtual ~virt_base_of_enable_shared_from_this ()=default
 
bool shared_from_this_possible () const
 
template<typename Target , typename = std::enable_if_t<!std::is_const_v<Target>>>
std::shared_ptr< Target > cast_shared_from_this_to ()
 returns the pointer to this cast to a particular type More...
 
template<typename Target >
std::shared_ptr< std::add_const_t< Target > > cast_shared_from_this_to () const
 returns the pointer to this cast to a particular type More...
 
- Public Member Functions inherited from mpqc::utility::Observable< Molecule >
std::shared_ptr< void *const > register_message (Observer *observer, std::function< void()> message) const
 
- Public Member Functions inherited from mpqc::enable_shared_from_this< Molecule >
virtual ~enable_shared_from_this ()=default
 
std::shared_ptr< Moleculeshared_from_this ()
 returns the pointer to this object More...
 
std::shared_ptr< std::add_const_t< Molecule > > shared_from_this () const
 returns the pointer to this object More...
 

Static Public Member Functions

static std::vector< AtomBasedClusterableread_xyz (std::istream &file, const std::array< Vector3d, 3 > &frame={ {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}})
 Reads atoms from an XYZ file. More...
 
- Static Public Member Functions inherited from mpqc::DescribedClass
static keyval_ctor_wrapper_type type_to_keyval_ctor (const std::string &type_name)
 
template<typename T >
static void register_keyval_ctor ()
 
template<typename T >
static bool is_registered ()
 
template<typename T >
static std::string class_key ()
 
static const keyval_ctor_registry_type & keyval_ctor_registry ()
 returns const ref to the keyval ctor registry More...
 

Friends

class MolecularCoordinates
 the only way to mutate coordinates is via MolecularCoordinates More...
 

Additional Inherited Members

- Public Types inherited from mpqc::DescribedClass
typedef std::shared_ptr< DescribedClass >(* keyval_ctor_wrapper_type) (const KeyVal &)
 
- Public Types inherited from mpqc::utility::Observable< Molecule >
typedef std::map< void *, std::function< void()> > messages_type
 
- Protected Member Functions inherited from mpqc::utility::Observable< Molecule >
void message ()
 

Constructor & Destructor Documentation

◆ Molecule() [1/7]

mpqc::Molecule::Molecule ( )
default

◆ Molecule() [2/7]

mpqc::Molecule::Molecule ( const Molecule )
default

◆ Molecule() [3/7]

mpqc::Molecule::Molecule ( Molecule &&  )
default

◆ Molecule() [4/7]

mpqc::Molecule::Molecule ( const KeyVal kv)
explicit

The KeyVal constructor.

Parameters
kvthe KeyVal object. The following keywords will be queried in kv :
Keyword Type Default Description
file_name string none This gives the name of a XYZ file, from which the nuclear coordinates will be read (the XYZ format is described here). Only rank 0 in the current madness::World will read the file.
atoms array none Will query this if file_name not given. Each element of the array must specify an Atom object (see the KeyVal ctor of Atom for more info).
units string angstrom If atoms given, will use this to determine the units in which the coordinates are given. Valid choices are "angstrom" and "bohr" See UnitFactory for more information.
sort_input boolean true If true, sort atoms in the order of increasing distance from the center of mass
n_cluster int 0 If nonzero, divide the Molecule into n_cluster clusters
attach_hydrogen boolean true use attach_hydrogen_kmeans when clustering
"$:world" pointer the value returned by mpqc::get_default_world() the default madness::World object to use

example input 1:

"molecule": {
"file_name": "water20.xyz",
"n_cluster": 20
}

example input 2:

"molecule": {
"atoms" : [
{ "element" : "O", "xyz" : [0.0, 0.0, 0.0] },
{ "element" : "H", "xyz" : [0.0, 1.0, 1.0] },
{ "element" : "H", "xyz" : [0.0, -1.0, 1.0] }
]
"n_cluster": 1
}

◆ Molecule() [5/7]

mpqc::Molecule::Molecule ( std::istream &  file_stream,
bool  sort_input = true,
Vector3d const &  sort_origin = Vector3d::Zero(),
std::array< Vector3d, 3 >  frame = { {Vector3d{1, 0, 0}, Vector3d{0, 1, 0}, Vector3d{0, 0, 1}}} 
)

Constructs Molecule from an XYZ-format stream.

Parameters
file_streamthe XYZ-format stream
sort_inputif true, will resort atoms in the order of increasing distance from the point given by sort_origin@param sort_origin the reference point to use for sorting the atoms
framecoordinate frame basis (in Angstroms) used to compute atomic coordinates.
Note
This is a non-clustering ctor, i.e. produces a Molecule consisting of 1 cluster.

◆ Molecule() [6/7]

mpqc::Molecule::Molecule ( std::vector< AtomBasedClusterable c,
bool  sort_input = true 
)

Constructor to build Molecule from a vector of clusterables.

This constructor takes a vector of AtomBasedClusterables and uses it to initialize the Molecule's Clusterables. If sort_input is true the Clusterables are sorted based on distance from the center of mass.

◆ Molecule() [7/7]

mpqc::Molecule::Molecule ( const std::vector< Atom > &  atoms)
explicit

Constructs a Molecule from a sequence of Atom objects atoms

Parameters
[in]atomsa sequence of atoms
Note
does not resort atoms, use Molecule::sort_from_point if needed

◆ ~Molecule()

virtual mpqc::Molecule::~Molecule ( )
virtualdefault

Member Function Documentation

◆ atoms()

std::vector< Atom > mpqc::Molecule::atoms ( ) const

A vector of all atoms in the Molecule.

This function will loop over the clusterables and extract their atoms in the depth-first order.

Note
Returns copies of the atoms, not a reference to the atoms stored in the Clusterables of the Molecule.

◆ begin()

std::vector<AtomBasedClusterable>::const_iterator mpqc::Molecule::begin ( ) const
inline

Iterator to the first clusterable in the Molecule.

◆ clusterables()

std::vector<AtomBasedClusterable> const& mpqc::Molecule::clusterables ( ) const
inline

Vector containing the Clusterable that make up the Molecule.

◆ com()

Vector3d const& mpqc::Molecule::com ( ) const
inline

Center of mass of the Molecule.

Necessary to satisfy the AtomBasedClusterable interface so Molecules are also clusterable.

◆ core_electrons()

int64_t mpqc::Molecule::core_electrons ( ) const

Computes the number of core electrons in the Molecule.

◆ end()

std::vector<AtomBasedClusterable>::const_iterator mpqc::Molecule::end ( ) const
inline

Iterator to one past the final clusterable in the Molecule.

◆ in_units_of()

void mpqc::Molecule::in_units_of ( const std::string &  units)
virtual

Reinterprets coordinates of atoms as having different units.

Converts current coordinates of atoms to atomic units assuming that they are currently given in units

Parameters
[in]unitsthe units that the current Atom objects use; see UnitsFactory::make_unit

Reimplemented in mpqc::UnitCell.

◆ mass()

double mpqc::Molecule::mass ( ) const
inline

Mass of the Molecule.

◆ natoms()

size_t mpqc::Molecule::natoms ( ) const
Returns
the number of atoms returned by atoms()

◆ nclusters()

int64_t mpqc::Molecule::nclusters ( ) const
inline

Number of clusters in the Molecule.

◆ nuclear_repulsion_energy()

double mpqc::Molecule::nuclear_repulsion_energy ( ) const
Returns
the nuclear repulsion energy of the Molecule.

◆ operator=() [1/2]

Molecule& mpqc::Molecule::operator= ( const Molecule )
default

◆ operator=() [2/2]

Molecule& mpqc::Molecule::operator= ( Molecule &&  )
default

◆ read_xyz()

std::vector< AtomBasedClusterable > mpqc::Molecule::read_xyz ( std::istream &  file,
const std::array< Vector3d, 3 > &  frame = { {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}} 
)
static

Reads atoms from an XYZ file.

Parameters
filethe XYZ-format stream
framecoordinate frame basis (in Angstroms) used to compute atomic coordinates.
Returns
the vector of Atom objects opaqued as AtomBasedClusterable objects

◆ set_mass()

void mpqc::Molecule::set_mass ( double  mass)
inline

Function to set the mass of the Molecule.

◆ sort_from_point()

void mpqc::Molecule::sort_from_point ( Vector3d const &  point)

A function to sort the clusters from a given point.

◆ total_atomic_number()

int64_t mpqc::Molecule::total_atomic_number ( ) const
inline
Returns
the sum of atomic numbers of all atoms
See also
Atom::atomic_number()

Friends And Related Function Documentation

◆ MolecularCoordinates

friend class MolecularCoordinates
friend

the only way to mutate coordinates is via MolecularCoordinates


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