32#ifndef MADNESS_CHEM_MOLECULE_H__INCLUDED
33#define MADNESS_CHEM_MOLECULE_H__INCLUDED
99 return ((err<
thresh) &&
q == other.
q &&
111 template <
typename Archive>
132 static constexpr char const *
tag =
"molecule";
155 }
catch (std::exception &
e) {
170 initialize<std::string>(
"source_type",
"inputfile",
"where to get the coordinates from", {
"inputfile",
"xyz",
"library"});
176 "if true the coordinates will not be reoriented and/or symmetrized");
178 "distance threshold");
181 initialize<bool>(
"psp_calc",
false,
"pseudopotential calculation for all atoms");
182 initialize<bool>(
"pure_ae",
true,
"pure all electron calculation with no pseudo-atoms");
186 return std::string(
"molecule");
191 return {
"source_name"};
198 for (
const std::string &key : {
"geometry",
"molecule"}) {
217 parser.
value(
"input"));
240 "geometry specification ambiguous: found geometry in "
241 "the structure library and in a file\n");
245 "\nPlease specify the location of your geometry input "
246 "by one of the two lines:\n");
309 if (
name == parser.
value(
"input"))
return "inputfile";
310 std::size_t
pos =
name.find(
".xyz");
311 if (
pos != std::string::npos)
return "xyz";
337 template <
typename opT>
340 template <
typename opT>
343 template <
typename opT>
346 bool test_for_c2(
double xaxis,
double yaxis,
double zaxis,
const double symtol)
const;
348 bool test_for_sigma(
double xaxis,
double yaxis,
double zaxis,
const double symtol)
const;
416 std::vector<std::string>
cubefile_header(
const Vector<double, 3>
offset = Vector<double, 3>(0.0))
const;
422 void read(std::istream &
f);
445 double core_eval(
int atom,
unsigned int core,
int m,
double x,
double y,
double z)
const;
447 double core_derivative(
int atom,
int axis,
unsigned int core,
int m,
double x,
double y,
double z)
const;
453 void add_atom(
double x,
double y,
double z,
double q,
int atn);
455 void add_atom(
double x,
double y,
double z,
double q,
int atn,
bool psat);
502 this->
print(os,
true);
572 for (
size_t i = 0; i <
natom(); i++) {
603 for (
size_t i = 0; i <
atoms.size(); ++i) {
606 for (
size_t i = 0; i <
rcut.size(); ++i) {
607 if (
rcut[i] != other.
rcut[i])
return false;
613 template <
typename Archive>
double q(double t)
Definition DKops.h:18
Declaration of utility class and functions for atom.
Atom(double x, double y, double z, double q, unsigned int atomic_number)
Definition molecule.h:78
double y
Definition molecule.h:62
unsigned int atomic_number
Atomic number.
Definition molecule.h:63
int get_atomic_number() const
Definition molecule.h:104
Atom(double x, double y, double z, double q, unsigned int atomic_number, bool pseudo_atom)
Definition molecule.h:67
double x
Definition molecule.h:62
double z
Definition molecule.h:62
Atom(const Atom &a)
Definition molecule.h:90
bool operator==(const Atom &other) const
Definition molecule.h:95
madness::Vector< double, 3 > get_coords() const
Definition molecule.h:106
Atom()
Default construct makes a zero charge ghost atom at origin.
Definition molecule.h:93
double mass
Mass.
Definition molecule.h:64
double q
Coordinates and charge in atomic units.
Definition molecule.h:62
void serialize(Archive &ar)
Definition molecule.h:112
double get_mass_in_au() const
return the mass in atomic units (electron mass = 1 a.u.)
Definition molecule.h:109
hashT hash() const
Definition molecule.h:115
bool pseudo_atom
Indicates if this atom uses a pseudopotential.
Definition molecule.h:65
Definition corepotential.h:148
unsigned int n_core_orb_base(const unsigned int atn) const
Definition corepotential.h:173
std::string guess_file() const
Definition corepotential.h:177
bool is_defined(const unsigned int atn) const
Definition corepotential.h:165
unsigned int get_core_l(unsigned int atn, unsigned int core) const
Definition corepotential.h:187
void set_eprec(double value)
Definition corepotential.cc:369
void set_rcut(double value)
Definition corepotential.cc:379
double get_core_bc(unsigned int atn, unsigned int core) const
Definition corepotential.h:191
Definition molecule.h:129
void read_structure_from_library(const std::string &name)
Definition molecule.cc:251
std::vector< madness::Vector< double, 3 > > get_all_coords_vec() const
Definition molecule.cc:463
static std::string get_structure_library_path()
Definition molecule.cc:224
std::vector< double > get_rcut() const
Definition molecule.h:483
void read_core_file(const std::string &filename)
Definition molecule.cc:1265
double bounding_cube() const
Returns the half width of the bounding cube.
Definition molecule.cc:1070
std::vector< double > atomic_radii
Definition molecule.h:475
void symmetrize_for_op(opT op, const double symtol)
Definition molecule.cc:810
void update_rcut_with_eprec(double value)
updates rcuts with given eprec
Definition molecule.cc:484
Tensor< double > nuclear_dipole_derivative(const int atom, const int axis) const
compute the derivative of the nuclear dipole wrt a nuclear displacement
Definition molecule.cc:650
void set_all_coords(const madness::Tensor< double > &newcoords)
Definition molecule.cc:474
std::string guess_file() const
Definition molecule.h:430
double smallest_length_scale() const
Definition molecule.cc:750
double get_core_bc(unsigned int atn, unsigned int c) const
Definition molecule.h:443
double atomic_attraction_potential(int iatom, double x, double y, double z) const
nuclear attraction potential for a specific atom in the molecule
Definition molecule.cc:1112
double total_nuclear_charge() const
Definition molecule.cc:1080
double nuclear_dipole(int axis) const
compute the dipole moment of the nuclei
Definition molecule.cc:620
const std::vector< Atom > & get_atoms() const
Definition molecule.h:495
std::vector< Atom > atoms
Definition molecule.h:318
void translate(const Tensor< double > &translation)
translate the molecule
Definition molecule.cc:779
void center()
Moves the center of nuclear charge to the origin.
Definition molecule.cc:760
const Atom & get_atom(unsigned int i) const
Definition molecule.cc:502
bool operator==(const Molecule &other) const
Definition molecule.h:601
madness::Tensor< double > get_all_coords() const
Definition molecule.cc:452
void orient(bool verbose=false)
Centers and orients the molecule in a standard manner.
Definition molecule.cc:978
unsigned int get_atom_charge(unsigned int i) const
Definition molecule.cc:425
double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1222
int find_symmetry_equivalent_atom(int iatom, opT op, const double symtol) const
Definition molecule.cc:799
double molecular_core_potential(double x, double y, double z) const
Definition molecule.cc:1235
void print_defined_only(std::ostream &os=std::cout) const
print user-defined parameters and the molecular geometry
Definition molecule.h:501
std::vector< std::string > cubefile_header(const Vector< double, 3 > offset=Vector< double, 3 >(0.0)) const
print out a Gaussian cubefile header
Definition molecule.cc:264
std::string get_pointgroup() const
Definition molecule.h:332
bool get_pseudo_atom(unsigned int i) const
Definition molecule.cc:440
double nuclear_attraction_potential(double x, double y, double z) const
nuclear attraction potential for the whole molecule
Definition molecule.cc:1088
std::string symmetrize_and_identify_point_group(const double symtol)
Definition molecule.cc:866
void read_file(const std::string &filename)
Definition molecule.cc:279
Tensor< double > center_of_mass() const
compute the center of mass
Definition molecule.cc:948
std::string pointgroup_
Definition molecule.h:325
hashT hash() const
Definition molecule.h:618
void fix_phase()
rotates the molecule and the external field
Definition molecule.cc:1024
static std::istream & position_stream_in_library(std::ifstream &f, const std::string &name)
Definition molecule.cc:230
void set_atom_coords(unsigned int i, double x, double y, double z)
Definition molecule.cc:445
json to_json_if_precedence(std::string const &precedence) const
Definition molecule.h:133
double inter_atomic_distance(unsigned int i, unsigned int j) const
Definition molecule.cc:588
bool test_for_inverse(const double symtol) const
Definition molecule.cc:849
size_t natom() const
Definition molecule.h:457
double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1213
double nuclear_repulsion_derivative(size_t iatom, int axis) const
Definition molecule.cc:657
std::vector< double > rcut
Definition molecule.h:319
void set_rcut(double value)
Definition molecule.cc:496
void set_core_rcut(double value)
Definition molecule.h:487
void set_core_eprec(double value)
Definition molecule.h:485
bool is_potential_defined(unsigned int atn) const
Definition molecule.h:449
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
Definition molecule.cc:1156
void serialize(Archive &ar)
Definition molecule.h:614
double nuclear_repulsion_energy() const
Definition molecule.cc:595
unsigned int get_atomic_number(unsigned int i) const
Definition molecule.cc:430
void swapaxes(int ix, int iy)
Definition molecule.cc:853
static constexpr char const * tag
Definition molecule.h:132
static void print_parameters()
Definition molecule.cc:120
json to_json() const
Definition molecule.cc:512
unsigned int get_core_l(unsigned int atn, unsigned int c) const
Definition molecule.h:441
Tensor< double > nuclear_repulsion_hessian() const
return the hessian matrix of the second derivatives d^2/dxdy V
Definition molecule.cc:677
void add_atom(double x, double y, double z, double q, int atn)
Definition molecule.cc:401
Tensor< double > moment_of_inertia() const
Definition molecule.cc:964
Molecule()
Makes a molecule with zero atoms.
Definition molecule.h:397
double nuclear_charge_density(double x, double y, double z, double rscale=1.) const
Definition molecule.cc:1184
void set_atom_charge(unsigned int i, double zeff)
Definition molecule.cc:420
double get_eprec() const
Definition molecule.h:489
double nuclear_repulsion_second_derivative(int iatom, int jatom, int iaxis, int jaxis) const
compute the nuclear-nuclear contribution to the second derivatives
Definition molecule.cc:701
GeometryParameters parameters
Definition molecule.h:328
void from_json(const json &mol_json)
Definition molecule.cc:537
void print(std::ostream &os=std::cout, const bool defined_only=false) const
print all parameters and the molecular geometry
Definition molecule.cc:568
unsigned int n_core_orb(unsigned int atn) const
Definition molecule.h:434
madness::Tensor< double > field
Definition molecule.h:321
unsigned int n_core_orb_all() const
Definition molecule.cc:1201
void set_pseudo_atom(unsigned int i, bool psat)
Definition molecule.cc:435
void insert_symbols_and_geometry(json &mol_json) const
Definition molecule.cc:523
CorePotentialManager core_pot
Definition molecule.h:320
Tensor< double > massweights() const
compute the mass-weighting matrix for the hessian
Definition molecule.h:570
void get_structure()
Definition molecule.cc:158
bool test_for_c2(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition molecule.cc:841
double core_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition molecule.cc:1250
void read_xyz(const std::string filename)
Definition molecule.cc:356
bool test_for_op(opT op, const double symtol) const
Definition molecule.cc:789
double nuclear_attraction_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition molecule.cc:1125
bool is_potential_defined_atom(int i) const
Definition molecule.h:451
void read(std::istream &f)
Definition molecule.cc:307
bool test_for_sigma(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition molecule.cc:845
void rotate(const Tensor< double > &D)
Definition molecule.cc:1053
class for holding the parameters for calculation
Definition chem/QCCalculationParametersBase.h:296
void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition chem/QCCalculationParametersBase.h:332
bool throw_if_datagroup_not_found
Definition chem/QCCalculationParametersBase.h:373
void set_user_defined_value(const std::string &key, const T &value)
Definition chem/QCCalculationParametersBase.h:542
void read_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
read the parameters from the command line and broadcast
Definition QCCalculationParametersBase.cc:121
void print(const std::string header="", const std::string footer="") const
print all parameters
Definition QCCalculationParametersBase.cc:32
bool ignore_unknown_keys
Definition chem/QCCalculationParametersBase.h:371
bool ignore_unknown_keys_silently
Definition chem/QCCalculationParametersBase.h:372
bool is_user_defined(std::string key) const
Definition chem/QCCalculationParametersBase.h:315
json to_json_if_precedence(const std::string &precedence) const
convert all parameters to a json object, but only those with a given precedence
Definition chem/QCCalculationParametersBase.h:530
void set_derived_value(const std::string &key, const T &value)
Definition chem/QCCalculationParametersBase.h:429
A tensor is a multidimensional array.
Definition tensor.h:318
A simple, fixed dimension vector.
Definition vector.h:64
A parallel world class.
Definition world.h:134
Declaration of core potential related class.
static const double eprec
Definition hatom_sf_dirac.cc:18
Tensor< double > op(const Tensor< double > &x)
Definition kain.cc:508
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
Header to declare stuff which has not yet found a home.
constexpr double atomic_mass_in_au
Atomic mass in atomic units.
Definition constants.h:269
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:401
void hash_range(hashT &seed, It first, It last)
Definition worldhash.h:280
static const char * filename
Definition legendre.cc:96
double abs(double x)
Definition complexfun.h:48
void hash_combine(hashT &seed, const T &v)
Combine hash values.
Definition worldhash.h:260
Key< NDIM > displacement(const Key< NDIM > &source, const Key< NDIM > &target)
given a source and a target, return the displacement in translation
Definition key.h:533
const AtomicData & get_atomic_data(unsigned int atomic_number)
Definition atomutil.cc:167
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:227
nlohmann::json json
Definition chem/QCCalculationParametersBase.h:30
NDIM & f
Definition mra.h:2622
std::size_t hashT
The hash value type.
Definition worldhash.h:145
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
madness::hashT hash_value(const std::array< T, N > &a)
Hash std::array with madness hash.
Definition array_addons.h:78
static const double a
Definition nonlinschro.cc:118
static const double c
Definition relops.cc:10
static const double m
Definition relops.cc:9
static const double thresh
Definition rk.cc:45
Definition test_ar.cc:204
const double mass
the atomic mass
Definition atomutil.h:64
Definition molecule.h:141
bool psp_calc() const
Definition molecule.h:303
std::string source_name() const
Definition molecule.h:298
std::string core_type() const
Definition molecule.h:302
void set_global_convenience_options(const commandlineparser &parser)
Definition molecule.h:194
std::set< std::string > case_sensitive_keys() const override
source_name is a path (xyz file / input file) – never case-fold it
Definition molecule.h:190
double symtol() const
Definition molecule.h:306
bool no_orient() const
Definition molecule.h:305
static std::string derive_source_type_from_name(const std::string name, const commandlineparser &parser)
Definition molecule.h:308
static std::string input_tag(const commandlineparser &parser)
name of the data group carrying the geometry in the input file
Definition molecule.cc:145
bool pure_ae() const
Definition molecule.h:304
GeometryParameters(const GeometryParameters &other)=default
std::string get_tag() const override
Definition molecule.h:185
GeometryParameters()
Definition molecule.h:162
static std::string absolute_path(const std::string &path)
make a relative path absolute, relative to the current working directory
Definition molecule.cc:138
GeometryParameters(World &world, const commandlineparser &parser)
Definition molecule.h:144
std::string units() const
Definition molecule.h:301
std::vector< double > field() const
Definition molecule.h:299
double eprec() const
Definition molecule.h:300
std::string source_type() const
Definition molecule.h:297
void set_derived_values(const commandlineparser &parser)
Definition molecule.h:214
Definition molecule.h:354
double yaxis
Definition molecule.h:355
void operator()(double &x, double &y, double &z) const
Definition molecule.h:357
double xaxis
Definition molecule.h:355
apply_c2(double xaxis, double yaxis, double zaxis)
Definition molecule.h:356
double zaxis
Definition molecule.h:355
Definition molecule.h:385
double yaxis
Definition molecule.h:386
void operator()(double &x, double &y, double &z) const
Definition molecule.h:388
double zaxis
Definition molecule.h:386
apply_inverse(double xaxis, double yaxis, double zaxis)
Definition molecule.h:387
double xaxis
Definition molecule.h:386
Definition molecule.h:370
void operator()(double &x, double &y, double &z) const
Definition molecule.h:373
apply_sigma(double xaxis, double yaxis, double zaxis)
Definition molecule.h:372
double xaxis
Definition molecule.h:371
double yaxis
Definition molecule.h:371
double zaxis
Definition molecule.h:371
very simple command line parser
Definition commandlineparser.h:28
std::string value(const std::string key) const
Definition commandlineparser.h:84
bool key_exists(std::string key) const
Definition commandlineparser.h:80
std::string value_raw(const std::string key) const
Definition commandlineparser.h:93
Defines and implements most of Tensor.
void e()
Definition test_sig.cc:75
const double offset
Definition testfuns.cc:143
double h(const coord_1d &r)
Definition testgconv.cc:175
std::size_t axis
Definition testpdiff.cc:59
Implement the madness:Vector class, an extension of std::array that supports some mathematical operat...