MADNESS 0.10.1
madness::Molecule Class Reference

#include <molecule.h>

Collaboration diagram for madness::Molecule:

Classes

struct  apply_c2
struct  apply_inverse
struct  apply_sigma
struct  GeometryParameters

Public Member Functions

 Molecule ()
 Makes a molecule with zero atoms.
 Molecule (std::vector< Atom > atoms, double eprec, CorePotentialManager core_pot={}, madness::Tensor< double > field=madness::Tensor< double >(3L))
 makes a molecule from a list of atoms
 Molecule (World &world, const commandlineparser &parser)
 makes a molecule using contents of parser
void add_atom (double x, double y, double z, double q, int atn)
void add_atom (double x, double y, double z, double q, int atn, bool psat)
double atomic_attraction_potential (int iatom, double x, double y, double z) const
 nuclear attraction potential for a specific atom in the molecule
double bounding_cube () const
 Returns the half width of the bounding cube.
void center ()
 Moves the center of nuclear charge to the origin.
Tensor< double > center_of_mass () const
 compute the center of mass
double core_derivative (int atom, int axis, unsigned int core, int m, double x, double y, double z) const
double core_eval (int atom, unsigned int core, int m, double x, double y, double z) const
double core_potential_derivative (int atom, int axis, double x, double y, double z) const
std::vector< std::string > cubefile_header (const Vector< double, 3 > offset=Vector< double, 3 >(0.0)) const
 print out a Gaussian cubefile header
void fix_phase ()
 rotates the molecule and the external field
void from_json (const json &mol_json)
madness::Tensor< double > get_all_coords () const
std::vector< madness::Vector< double, 3 > > get_all_coords_vec () const
const Atom & get_atom (unsigned int i) const
unsigned int get_atom_charge (unsigned int i) const
unsigned int get_atomic_number (unsigned int i) const
const std::vector< Atom > & get_atoms () const
double get_core_bc (unsigned int atn, unsigned int c) const
unsigned int get_core_l (unsigned int atn, unsigned int c) const
double get_eprec () const
std::string get_pointgroup () const
bool get_pseudo_atom (unsigned int i) const
std::vector< double > get_rcut () const
void get_structure ()
std::string guess_file () const
hashT hash () const
void insert_symbols_and_geometry (json &mol_json) const
double inter_atomic_distance (unsigned int i, unsigned int j) const
bool is_potential_defined (unsigned int atn) const
bool is_potential_defined_atom (int i) const
Tensor< double > massweights () const
 compute the mass-weighting matrix for the hessian
double molecular_core_potential (double x, double y, double z) const
Tensor< double > moment_of_inertia () const
unsigned int n_core_orb (unsigned int atn) const
unsigned int n_core_orb_all () const
size_t natom () const
double nuclear_attraction_potential (double x, double y, double z) const
 nuclear attraction potential for the whole molecule
double nuclear_attraction_potential_derivative (int atom, int axis, double x, double y, double z) const
double nuclear_attraction_potential_second_derivative (int atom, int iaxis, int jaxis, double x, double y, double z) const
 the second derivative of the (smoothed) nuclear potential Z/r
double nuclear_charge_density (double x, double y, double z, double rscale=1.) const
double nuclear_dipole (int axis) const
 compute the dipole moment of the nuclei
Tensor< double > nuclear_dipole_derivative (const int atom, const int axis) const
 compute the derivative of the nuclear dipole wrt a nuclear displacement
double nuclear_repulsion_derivative (size_t iatom, int axis) const
double nuclear_repulsion_energy () const
Tensor< double > nuclear_repulsion_hessian () const
 return the hessian matrix of the second derivatives d^2/dxdy V
double nuclear_repulsion_second_derivative (int iatom, int jatom, int iaxis, int jaxis) const
 compute the nuclear-nuclear contribution to the second derivatives
bool operator== (const Molecule &other) const
void orient (bool verbose=false)
 Centers and orients the molecule in a standard manner.
void print (std::ostream &os=std::cout, const bool defined_only=false) const
 print all parameters and the molecular geometry
void print_defined_only (std::ostream &os=std::cout) const
 print user-defined parameters and the molecular geometry
void read (std::istream &f)
void read_core_file (const std::string &filename)
void read_file (const std::string &filename)
void read_structure_from_library (const std::string &name)
void read_xyz (const std::string filename)
void rotate (const Tensor< double > &D)
template<typename Archive>
void serialize (Archive &ar)
void set_all_coords (const madness::Tensor< double > &newcoords)
void set_atom_charge (unsigned int i, double zeff)
void set_atom_coords (unsigned int i, double x, double y, double z)
void set_core_eprec (double value)
void set_core_rcut (double value)
void set_pseudo_atom (unsigned int i, bool psat)
void set_rcut (double value)
double smallest_length_scale () const
std::string symmetrize_and_identify_point_group (const double symtol)
json to_json () const
json to_json_if_precedence (std::string const &precedence) const
double total_nuclear_charge () const
void translate (const Tensor< double > &translation)
 translate the molecule
void update_rcut_with_eprec (double value)
 updates rcuts with given eprec

Static Public Member Functions

static std::string get_structure_library_path ()
static std::istream & position_stream_in_library (std::ifstream &f, const std::string &name)
static void print_parameters ()

Public Attributes

std::vector< double > atomic_radii
GeometryParameters parameters

Static Public Attributes

static constexpr char const * tag = "molecule"

Private Member Functions

template<typename opT>
int find_symmetry_equivalent_atom (int iatom, opT op, const double symtol) const
void swapaxes (int ix, int iy)
template<typename opT>
void symmetrize_for_op (opT op, const double symtol)
bool test_for_c2 (double xaxis, double yaxis, double zaxis, const double symtol) const
bool test_for_inverse (const double symtol) const
template<typename opT>
bool test_for_op (opT op, const double symtol) const
bool test_for_sigma (double xaxis, double yaxis, double zaxis, const double symtol) const

Private Attributes

std::vector< Atom > atoms
CorePotentialManager core_pot
madness::Tensor< double > field
std::string pointgroup_ = "c1"
std::vector< double > rcut

Constructor & Destructor Documentation

◆ Molecule() [1/3]

madness::Molecule::Molecule ( )
inline

Makes a molecule with zero atoms.

References atoms, core_pot, field, and rcut.

Referenced by operator==().

◆ Molecule() [2/3]

madness::Molecule::Molecule ( std::vector< Atom > atoms,
double eprec,
CorePotentialManager core_pot = {},
madness::Tensor< double > field = madness::Tensor<double>(3L) )

makes a molecule from a list of atoms

References atomic_radii, atoms, core_pot, eprec, and field.

◆ Molecule() [3/3]

madness::Molecule::Molecule ( World & world,
const commandlineparser & parser )

Member Function Documentation

◆ add_atom() [1/2]

void madness::Molecule::add_atom ( double x,
double y,
double z,
double q,
int atn )

◆ add_atom() [2/2]

void madness::Molecule::add_atom ( double x,
double y,
double z,
double q,
int atn,
bool psat )

◆ atomic_attraction_potential()

double madness::Molecule::atomic_attraction_potential ( int iatom,
double x,
double y,
double z ) const

nuclear attraction potential for a specific atom in the molecule

References atoms, madness::distance(), rcut, madness::smoothed_potential(), and madness::sum().

◆ bounding_cube()

double madness::Molecule::bounding_cube ( ) const

Returns the half width of the bounding cube.

The molecule will be contained in the cube [-L,+L].

References atoms, and L.

◆ center()

void madness::Molecule::center ( )

Moves the center of nuclear charge to the origin.

References atoms, and translate().

Referenced by orient().

◆ center_of_mass()

Tensor< double > madness::Molecule::center_of_mass ( ) const

◆ core_derivative()

double madness::Molecule::core_derivative ( int atom,
int axis,
unsigned int core,
int m,
double x,
double y,
double z ) const

References atoms, axis, core_pot, m, and xi.

◆ core_eval()

double madness::Molecule::core_eval ( int atom,
unsigned int core,
int m,
double x,
double y,
double z ) const

References atoms, core_pot, and m.

◆ core_potential_derivative()

double madness::Molecule::core_potential_derivative ( int atom,
int axis,
double x,
double y,
double z ) const

◆ cubefile_header()

std::vector< std::string > madness::Molecule::cubefile_header ( const Vector< double, 3 > offset = Vector<double, 3>(0.0)) const

print out a Gaussian cubefile header

Parameters
[in]offsetthe offset to be subtracted from the coordinates

References get_atom(), madness::Atom::get_atomic_number(), madness::Atom::get_coords(), natom(), and offset.

◆ find_symmetry_equivalent_atom()

template<typename opT>
int madness::Molecule::find_symmetry_equivalent_atom ( int iatom,
opT op,
const double symtol ) const
private

References atoms, madness::distance(), and op().

Referenced by symmetrize_for_op(), and test_for_op().

◆ fix_phase()

void madness::Molecule::fix_phase ( )

rotates the molecule and the external field

References atoms, and e().

Referenced by orient().

◆ from_json()

◆ get_all_coords()

◆ get_all_coords_vec()

std::vector< madness::Vector< double, 3 > > madness::Molecule::get_all_coords_vec ( ) const

◆ get_atom()

◆ get_atom_charge()

unsigned int madness::Molecule::get_atom_charge ( unsigned int i) const

References atoms.

◆ get_atomic_number()

unsigned int madness::Molecule::get_atomic_number ( unsigned int i) const

◆ get_atoms()

const std::vector< Atom > & madness::Molecule::get_atoms ( ) const
inline

References atoms.

Referenced by madness::Znemo::custom_guess().

◆ get_core_bc()

double madness::Molecule::get_core_bc ( unsigned int atn,
unsigned int c ) const
inline

References c, and core_pot.

◆ get_core_l()

unsigned int madness::Molecule::get_core_l ( unsigned int atn,
unsigned int c ) const
inline

References c, and core_pot.

◆ get_eprec()

double madness::Molecule::get_eprec ( ) const
inline

◆ get_pointgroup()

std::string madness::Molecule::get_pointgroup ( ) const
inline

References pointgroup_.

◆ get_pseudo_atom()

bool madness::Molecule::get_pseudo_atom ( unsigned int i) const

References atoms.

Referenced by get_structure().

◆ get_rcut()

std::vector< double > madness::Molecule::get_rcut ( ) const
inline

References rcut.

◆ get_structure()

◆ get_structure_library_path()

std::string madness::Molecule::get_structure_library_path ( )
static

◆ guess_file()

std::string madness::Molecule::guess_file ( ) const
inline

References core_pot.

◆ hash()

hashT madness::Molecule::hash ( ) const
inline

◆ insert_symbols_and_geometry()

void madness::Molecule::insert_symbols_and_geometry ( json & mol_json) const

◆ inter_atomic_distance()

double madness::Molecule::inter_atomic_distance ( unsigned int i,
unsigned int j ) const

◆ is_potential_defined()

bool madness::Molecule::is_potential_defined ( unsigned int atn) const
inline

References core_pot.

◆ is_potential_defined_atom()

bool madness::Molecule::is_potential_defined_atom ( int i) const
inline

References atoms, and core_pot.

◆ massweights()

Tensor< double > madness::Molecule::massweights ( ) const
inline

compute the mass-weighting matrix for the hessian

use as mass_weighted_hessian=inner(massweights,inner(hessian,massweights));

References get_atom(), and natom().

Referenced by madness::Nemo::compute_IR_intensities().

◆ molecular_core_potential()

double madness::Molecule::molecular_core_potential ( double x,
double y,
double z ) const

◆ moment_of_inertia()

Tensor< double > madness::Molecule::moment_of_inertia ( ) const

◆ n_core_orb()

unsigned int madness::Molecule::n_core_orb ( unsigned int atn) const
inline

References core_pot.

◆ n_core_orb_all()

unsigned int madness::Molecule::n_core_orb_all ( ) const

References atoms, core_pot, natom(), and madness::sum().

◆ natom()

◆ nuclear_attraction_potential()

double madness::Molecule::nuclear_attraction_potential ( double x,
double y,
double z ) const

nuclear attraction potential for the whole molecule

References atoms, madness::distance(), field, rcut, madness::smoothed_potential(), and madness::sum().

◆ nuclear_attraction_potential_derivative()

double madness::Molecule::nuclear_attraction_potential_derivative ( int atom,
int axis,
double x,
double y,
double z ) const

◆ nuclear_attraction_potential_second_derivative()

double madness::Molecule::nuclear_attraction_potential_second_derivative ( int atom,
int iaxis,
int jaxis,
double x,
double y,
double z ) const

the second derivative of the (smoothed) nuclear potential Z/r

\‍[V(R,r_{el}) -V(r) =\frac{Z}{|R-r_{el}|} \approx Z u(r) \‍]

with

\‍[\frac{\partial^2 V}{\partial X_i\partial X_j}
  =  Z \left(\frac{\partial^2 u(r)}{\partial r^2} \frac{\partial r}{\partial X_i}
     \frac{\partial r}{\partial X_j} + \frac{\partial u}{\partial r}
     \frac{\partial^2 r}{\partial X_i \partial X_j}\right)
\‍]

References atoms, madness::d2smoothed_potential(), madness::Vector< T, N >::normf(), rcut, madness::smoothed_potential(), and u().

◆ nuclear_charge_density()

double madness::Molecule::nuclear_charge_density ( double x,
double y,
double z,
double rscale = 1. ) const

evaluate the nuclear charge density at point {x,y,z} using the default MADNESS nuclear model. See smoothed_density() for the description of the default nuclear model.

Parameters
x,y,zthe point at which the nuclear charge density is evaluated
rscalesetting rscale>1 will make a nucleus larger by a factor of rscale (in other words, rcut is multiplied by the inverse of by this)
Returns
the nuclear charge density at point {x,y,z}
See also
smoothed_density()

References atoms, madness::distance_sq(), MADNESS_ASSERT, rcut, and madness::smoothed_density().

◆ nuclear_dipole()

double madness::Molecule::nuclear_dipole ( int axis) const

compute the dipole moment of the nuclei

Parameters
[in]axisthe axis (x, y, z)

References atoms, axis, core_pot, MADNESS_EXCEPTION, and madness::sum().

◆ nuclear_dipole_derivative()

Tensor< double > madness::Molecule::nuclear_dipole_derivative ( const int atom,
const int axis ) const

compute the derivative of the nuclear dipole wrt a nuclear displacement

Parameters
[in]atomthe atom which will be displaced
[in]axisthe axis where the atom will be displaced
Returns
a vector which all 3 components of the dipole derivative

References atoms, and axis.

Referenced by madness::Nemo::compute_IR_intensities().

◆ nuclear_repulsion_derivative()

double madness::Molecule::nuclear_repulsion_derivative ( size_t iatom,
int axis ) const

◆ nuclear_repulsion_energy()

double madness::Molecule::nuclear_repulsion_energy ( ) const

◆ nuclear_repulsion_hessian()

Tensor< double > madness::Molecule::nuclear_repulsion_hessian ( ) const

return the hessian matrix of the second derivatives d^2/dxdy V

compute the nuclear-nuclear contribution to the molecular hessian

no factor 0.5 included

References natom(), and nuclear_repulsion_second_derivative().

Referenced by madness::Nemo::hessian(), and madness::Nemo::make_incomplete_hessian().

◆ nuclear_repulsion_second_derivative()

double madness::Molecule::nuclear_repulsion_second_derivative ( int iatom,
int jatom,
int iaxis,
int jaxis ) const

compute the nuclear-nuclear contribution to the second derivatives

Parameters
[in]iatomthe i-th atom (row of the hessian)
[in]jatomthe j-th atom (column of the hessian)
[in]iaxisthe xyz axis of the i-th atom
[in]jaxisthe xyz axis of the j-th atom return the (3*iatom + iaxis, 3*jatom + jaxis) matix element of the hessian
[in]iatomthe i-th atom (row of the hessian)
[in]jatomthe j-th atom (column of the hessian)
[in]iaxisthe xyz axis of the i-th atom
[in]jaxisthe xyz axis of the j-th atom return the (3*iatom + iaxis, 3*jatom + jaxis) matix element

References atoms, core_pot, inter_atomic_distance(), MADNESS_EXCEPTION, and madness::sum().

Referenced by nuclear_repulsion_hessian().

◆ operator==()

bool madness::Molecule::operator== ( const Molecule & other) const
inline

◆ orient()

void madness::Molecule::orient ( bool verbose = false)

◆ position_stream_in_library()

std::istream & madness::Molecule::position_stream_in_library ( std::ifstream & f,
const std::string & name )
static

◆ print()

void madness::Molecule::print ( std::ostream & os = std::cout,
const bool defined_only = false ) const

print all parameters and the molecular geometry

References atoms, madness::get_atomic_data(), natom(), p(), parameters, and madness::AtomicData::symbol.

Referenced by madness::SCF::load_mos(), main(), print_defined_only(), and test_ethylene().

◆ print_defined_only()

void madness::Molecule::print_defined_only ( std::ostream & os = std::cout) const
inline

print user-defined parameters and the molecular geometry

References print().

◆ print_parameters()

◆ read()

◆ read_core_file()

void madness::Molecule::read_core_file ( const std::string & filename)

◆ read_file()

void madness::Molecule::read_file ( const std::string & filename)

◆ read_structure_from_library()

void madness::Molecule::read_structure_from_library ( const std::string & name)

◆ read_xyz()

◆ rotate()

void madness::Molecule::rotate ( const Tensor< double > & D)
Parameters
[in]Dthe rotation matrix

References atoms, field, and madness::inner().

Referenced by orient().

◆ serialize()

template<typename Archive>
void madness::Molecule::serialize ( Archive & ar)
inline

◆ set_all_coords()

void madness::Molecule::set_all_coords ( const madness::Tensor< double > & newcoords)

References atoms, c, MADNESS_ASSERT, and natom().

Referenced by test_gradient().

◆ set_atom_charge()

void madness::Molecule::set_atom_charge ( unsigned int i,
double zeff )

References atoms.

Referenced by get_structure().

◆ set_atom_coords()

void madness::Molecule::set_atom_coords ( unsigned int i,
double x,
double y,
double z )

References atoms.

◆ set_core_eprec()

void madness::Molecule::set_core_eprec ( double value)
inline

◆ set_core_rcut()

void madness::Molecule::set_core_rcut ( double value)
inline

◆ set_pseudo_atom()

void madness::Molecule::set_pseudo_atom ( unsigned int i,
bool psat )

References atoms.

Referenced by get_structure().

◆ set_rcut()

void madness::Molecule::set_rcut ( double value)

◆ smallest_length_scale()

double madness::Molecule::smallest_length_scale ( ) const

References atoms, and rcut.

◆ swapaxes()

void madness::Molecule::swapaxes ( int ix,
int iy )
private

References atoms, and field.

Referenced by symmetrize_and_identify_point_group().

◆ symmetrize_and_identify_point_group()

std::string madness::Molecule::symmetrize_and_identify_point_group ( const double symtol)

◆ symmetrize_for_op()

template<typename opT>
void madness::Molecule::symmetrize_for_op ( opT op,
const double symtol )
private

◆ test_for_c2()

bool madness::Molecule::test_for_c2 ( double xaxis,
double yaxis,
double zaxis,
const double symtol ) const
private

◆ test_for_inverse()

bool madness::Molecule::test_for_inverse ( const double symtol) const
private

◆ test_for_op()

template<typename opT>
bool madness::Molecule::test_for_op ( opT op,
const double symtol ) const
private

◆ test_for_sigma()

bool madness::Molecule::test_for_sigma ( double xaxis,
double yaxis,
double zaxis,
const double symtol ) const
private

◆ to_json()

nlohmann::json madness::Molecule::to_json ( ) const
nodiscard

◆ to_json_if_precedence()

json madness::Molecule::to_json_if_precedence ( std::string const & precedence) const
inlinenodiscard

◆ total_nuclear_charge()

double madness::Molecule::total_nuclear_charge ( ) const

References atoms, and madness::sum().

◆ translate()

void madness::Molecule::translate ( const Tensor< double > & translation)

translate the molecule

References atoms.

Referenced by center(), madness::MolecularOptimizer::projector_external_dof(), and projector_external_dof().

◆ update_rcut_with_eprec()

void madness::Molecule::update_rcut_with_eprec ( double value)

Member Data Documentation

◆ atomic_radii

std::vector<double> madness::Molecule::atomic_radii

Referenced by Molecule(), add_atom(), and add_atom().

◆ atoms

◆ core_pot

◆ field

◆ parameters

◆ pointgroup_

std::string madness::Molecule::pointgroup_ = "c1"
private

The molecular point group is automatically assigned in the identify_pointgroup function

Referenced by get_pointgroup(), hash(), operator==(), orient(), and serialize().

◆ rcut

◆ tag

char const* madness::Molecule::tag = "molecule"
staticconstexpr

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