MADNESS 0.10.1
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
madness::Molecule Class Reference

#include <molecule.h>

Collaboration diagram for madness::Molecule:
Collaboration graph
[legend]

Classes

struct  apply_c2
 Apply to (x,y,z) a C2 rotation about an axis thru the origin and (xaxis,yaxis,zaxis) More...
 
struct  apply_inverse
 
struct  apply_sigma
 Apply to (x,y,z) a reflection through a plane containing the origin with normal (xaxis,yaxis,zaxis) More...
 
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
 print out a Gaussian cubefile header
 
madness::Tensor< double > get_all_coords () const
 
std::vector< madness::Vector< double, 3 > > get_all_coords_vec () const
 
const Atomget_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
 
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 mol_nuclear_charge_density (double x, double y, double z) const
 
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) 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
 
void orient (bool verbose=false)
 Centers and orients the molecule in a standard manner.
 
void print () const
 
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)
 rotates the molecule and the external field
 
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
 
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
 

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< Atomatoms
 
CorePotentialManager core_pot
 
madness::Tensor< double > field
 
std::string pointgroup_ ="c1"
 The molecular point group is automatically assigned in the identify_pointgroup function.
 
std::vector< double > rcut
 

Constructor & Destructor Documentation

◆ Molecule() [1/3]

madness::Molecule::Molecule ( )
inline

Makes a molecule with zero atoms.

◆ Molecule() [2/3]

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

◆ 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

◆ 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.

Referenced by main().

◆ 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

◆ core_eval()

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

◆ 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

◆ 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().

◆ get_all_coords()

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

◆ get_all_coords_vec()

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

◆ get_atom()

const Atom & madness::Molecule::get_atom ( unsigned int  i) const

◆ get_atom_charge()

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

References atoms.

Referenced by madness::SCF::initial_guess().

◆ 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

◆ get_core_bc()

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

◆ get_core_l()

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

◆ 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(), and madness::SCF::initial_guess().

◆ get_rcut()

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

◆ get_structure()

void madness::Molecule::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

◆ hash()

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

◆ 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

◆ is_potential_defined_atom()

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

◆ 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 compute_frequencies(), madness::Nemo::compute_IR_intensities(), and compute_reduced_mass().

◆ mol_nuclear_charge_density()

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

◆ 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

◆ n_core_orb_all()

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

◆ natom()

size_t madness::Molecule::natom ( ) const
inline

◆ 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 sum.

Referenced by MolecularPotentialFunctor::operator()(), and madness::MolecularPotentialFunctor::operator()().

◆ 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().

Referenced by madchem::MolecularSecondDerivativeFunctor::operator()().

◆ nuclear_charge_density()

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

◆ 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::CorePotentialManager::is_defined(), MADNESS_EXCEPTION, madness::CorePotentialManager::n_core_orb(), and sum.

Referenced by madness::SCF::dipole().

◆ 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::CorePotentialManager::is_defined(), MADNESS_EXCEPTION, and sum.

Referenced by nuclear_repulsion_hessian().

◆ 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 ( ) const

◆ print_parameters()

void madness::Molecule::print_parameters ( )
static

◆ read()

void madness::Molecule::read ( std::istream &  f)

◆ 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()

void madness::Molecule::read_xyz ( const std::string  filename)

◆ rotate()

void madness::Molecule::rotate ( const Tensor< double > &  D)

rotates the molecule and the external field

Parameters
[in]Dthe rotation matrix

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

Referenced by madness::SCF::initial_guess(), and 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)

◆ 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)

References atoms, and rcut.

◆ smallest_length_scale()

double madness::Molecule::smallest_length_scale ( ) const

◆ 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

◆ total_nuclear_charge()

double madness::Molecule::total_nuclear_charge ( ) const

References atoms, and sum.

Referenced by MiniDFT::doit(), main(), and main().

◆ translate()

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

◆ 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

std::vector<Atom> madness::Molecule::atoms
private

◆ core_pot

CorePotentialManager madness::Molecule::core_pot
private

◆ field

madness::Tensor<double> madness::Molecule::field
private

◆ parameters

GeometryParameters madness::Molecule::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(), orient(), and serialize().

◆ rcut

std::vector<double> madness::Molecule::rcut
private

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