32 #ifndef MADNESS_CHEM_MOLECULE_H__INCLUDED
33 #define MADNESS_CHEM_MOLECULE_H__INCLUDED
106 template <
typename Archive>
135 }
catch (std::exception&
e) {
136 print(
"geometry",
"end");
148 initialize<std::string>(
"source_type",
"inputfile",
"where to get the coordinates from",{
"inputfile",
"xyz",
"library"});
149 initialize<std::string>(
"source_name",
"TBD",
"name of the geometry from the library or the input file");
150 initialize<double>(
"eprec",1.e-4,
"smoothing for the nuclear potential");
151 initialize<std::string>(
"units",
"atomic",
"coordinate units",{
"atomic",
"angstrom",
"bohr",
"au"});
152 initialize<std::vector<double>>(
"field",{0.0,0.0,0.0},
"external electric field");
153 initialize<bool> (
"no_orient",
false,
"if true the molecule coordinates will not be reoriented and/or symmetrized");
154 initialize<double> (
"symtol",-1.e-2,
"distance threshold for determining the symmetry-equivalent atoms; negative: old algorithm");
156 initialize<std::string> (
"core_type",
"none",
"core potential type",{
"none",
"mcp"});
157 initialize<bool> (
"psp_calc",
false,
"pseudopotential calculation for all atoms");
158 initialize<bool> (
"pure_ae",
true,
"pure all electron calculation with no pseudo-atoms");
175 if (parser.
key_exists(
"no_orient") and parser.
value(
"no_orient")==
"true")
181 bool found_geometry_file=
f.good();
184 bool geometry_found_in_library=
true;
189 geometry_found_in_library=
false;
192 if (found_geometry_file and geometry_found_in_library) {
194 madness::print(
"geometry specification ambiguous: found geometry in the structure library and in a file\n");
197 madness::print(
"\nPlease specify the location of your geometry input by one of the two lines:\n");
225 std::string
source_type()
const {
return get<std::string>(
"source_type");}
226 std::string
source_name()
const {
return get<std::string>(
"source_name");}
227 std::vector<double>
field()
const {
return get<std::vector<double>>(
"field");}
228 double eprec()
const {
return get<double>(
"eprec");}
229 std::string
units()
const {
return get<std::string>(
"units");}
230 std::string
core_type()
const {
return get<std::string>(
"core_type");}
231 bool psp_calc()
const {
return get<bool>(
"psp_calc");}
232 bool pure_ae()
const {
return get<bool>(
"pure_ae");}
234 double symtol()
const {
return get<double>(
"symtol");}
238 if (
name==parser.
value(
"input"))
return "inputfile";
239 std::size_t pos =
name.find(
".xyz");
240 if (pos!=std::string::npos)
return "xyz";
267 template <
typename opT>
270 template <
typename opT>
273 template <
typename opT>
276 bool test_for_c2(
double xaxis,
double yaxis,
double zaxis,
const double symtol)
const;
278 bool test_for_sigma(
double xaxis,
double yaxis,
double zaxis,
const double symtol)
const;
332 Molecule(World& world,
const commandlineparser& parser);
349 void read(std::istream&
f);
375 double core_eval(
int atom,
unsigned int core,
int m,
double x,
double y,
double z)
const;
377 double core_derivative(
int atom,
int axis,
unsigned int core,
int m,
double x,
double y,
double z)
const;
383 void add_atom(
double x,
double y,
double z,
double q,
int atn);
385 void add_atom(
double x,
double y,
double z,
double q,
int atn,
bool psat);
451 int iaxis,
int jaxis)
const;
498 for (
size_t i=0; i<
natom(); i++) {
499 const double sqrtmass=1.0/sqrt(
get_atom(i).get_mass_in_au());
500 M(3*i ,3*i )=sqrtmass;
501 M(3*i+1,3*i+1)=sqrtmass;
502 M(3*i+2,3*i+2)=sqrtmass;
511 void orient(
bool verbose=
false);
528 int jaxis,
double x,
double y,
double z)
const;
530 template <
typename Archive>
double q(double t)
Definition: DKops.h:18
Declaration of utility class and functions for atom.
Definition: molecule.h:58
Atom(double x, double y, double z, double q, unsigned int atomic_number)
Definition: molecule.h:77
double y
Definition: molecule.h:60
unsigned int atomic_number
Atomic number.
Definition: molecule.h:61
int get_atomic_number() const
Definition: molecule.h:97
Atom(double x, double y, double z, double q, unsigned int atomic_number, bool pseudo_atom)
Definition: molecule.h:65
double x
Definition: molecule.h:60
double z
Definition: molecule.h:60
madness::Vector< double, 3 > get_coords() const
Definition: molecule.h:99
Atom(const Atom &a)
Definition: molecule.h:91
Atom()
Default construct makes a zero charge ghost atom at origin.
Definition: molecule.h:95
double mass
Mass.
Definition: molecule.h:62
double q
Coordinates and charge in atomic units.
Definition: molecule.h:60
void serialize(Archive &ar)
Definition: molecule.h:107
double get_mass_in_au() const
return the mass in atomic units (electron mass = 1 a.u.)
Definition: molecule.h:104
hashT hash() const
Definition: molecule.h:110
bool pseudo_atom
Indicates if this atom uses a pseudopotential.
Definition: molecule.h:63
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:124
void read_structure_from_library(const std::string &name)
Definition: molecule.cc:223
std::vector< madness::Vector< double, 3 > > get_all_coords_vec() const
Definition: molecule.cc:408
static std::string get_structure_library_path()
Definition: molecule.cc:196
void read_core_file(const std::string &filename)
Definition: molecule.cc:1146
double bounding_cube() const
Returns the half width of the bounding cube.
Definition: molecule.cc:942
std::vector< double > atomic_radii
Definition: molecule.h:407
void symmetrize_for_op(opT op, const double symtol)
Definition: molecule.cc:701
void update_rcut_with_eprec(double value)
updates rcuts with given eprec
Definition: molecule.cc:429
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:541
void set_all_coords(const madness::Tensor< double > &newcoords)
Definition: molecule.cc:419
std::string guess_file() const
Definition: molecule.h:356
double smallest_length_scale() const
Definition: molecule.cc:641
double get_core_bc(unsigned int atn, unsigned int c) const
Definition: molecule.h:371
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:995
double total_nuclear_charge() const
Definition: molecule.cc:952
double nuclear_dipole(int axis) const
compute the dipole moment of the nuclei
Definition: molecule.cc:520
std::vector< Atom > atoms
Definition: molecule.h:248
void translate(const Tensor< double > &translation)
translate the molecule
Definition: molecule.cc:670
void center()
Moves the center of nuclear charge to the origin.
Definition: molecule.cc:651
const Atom & get_atom(unsigned int i) const
Definition: molecule.cc:447
madness::Tensor< double > get_all_coords() const
Definition: molecule.cc:397
void orient(bool verbose=false)
Centers and orients the molecule in a standard manner.
Definition: molecule.cc:869
unsigned int get_atom_charge(unsigned int i) const
Definition: molecule.cc:370
double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const
Definition: molecule.cc:1103
int find_symmetry_equivalent_atom(int iatom, opT op, const double symtol) const
Definition: molecule.cc:690
double molecular_core_potential(double x, double y, double z) const
Definition: molecule.cc:1116
std::string get_pointgroup() const
Definition: molecule.h:261
bool get_pseudo_atom(unsigned int i) const
Definition: molecule.cc:385
double nuclear_attraction_potential(double x, double y, double z) const
nuclear attraction potential for the whole molecule
Definition: molecule.cc:971
std::string symmetrize_and_identify_point_group(const double symtol)
Definition: molecule.cc:757
void read_file(const std::string &filename)
Definition: molecule.cc:251
Tensor< double > center_of_mass() const
compute the center of mass
Definition: molecule.cc:839
std::string pointgroup_
The molecular point group is automatically assigned in the identify_pointgroup function.
Definition: molecule.h:254
hashT hash() const
Definition: molecule.h:535
static std::istream & position_stream_in_library(std::ifstream &f, const std::string &name)
Definition: molecule.cc:202
double mol_nuclear_charge_density(double x, double y, double z) const
Definition: molecule.cc:960
void set_atom_coords(unsigned int i, double x, double y, double z)
Definition: molecule.cc:390
double inter_atomic_distance(unsigned int i, unsigned int j) const
Definition: molecule.cc:492
bool test_for_inverse(const double symtol) const
Definition: molecule.cc:740
size_t natom() const
Definition: molecule.h:387
double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const
Definition: molecule.cc:1094
void print() const
Definition: molecule.cc:472
double nuclear_repulsion_derivative(size_t iatom, int axis) const
Definition: molecule.cc:548
std::vector< double > rcut
Definition: molecule.h:249
void set_rcut(double value)
Definition: molecule.cc:441
std::vector< std::string > cubefile_header() const
print out a Gaussian cubefile header
Definition: molecule.cc:236
void set_core_rcut(double value)
Definition: molecule.h:421
void set_core_eprec(double value)
Definition: molecule.h:417
bool is_potential_defined(unsigned int atn) const
Definition: molecule.h:379
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:1039
void serialize(Archive &ar)
Definition: molecule.h:531
double nuclear_repulsion_energy() const
Definition: molecule.cc:499
unsigned int get_atomic_number(unsigned int i) const
Definition: molecule.cc:375
void swapaxes(int ix, int iy)
Definition: molecule.cc:744
static void print_parameters()
Definition: molecule.cc:110
json to_json() const
Definition: molecule.cc:457
unsigned int get_core_l(unsigned int atn, unsigned int c) const
Definition: molecule.h:367
Tensor< double > nuclear_repulsion_hessian() const
return the hessian matrix of the second derivatives d^2/dxdy V
Definition: molecule.cc:568
void add_atom(double x, double y, double z, double q, int atn)
Definition: molecule.cc:346
Tensor< double > moment_of_inertia() const
Definition: molecule.cc:855
Molecule()
Makes a molecule with zero atoms.
Definition: molecule.h:326
void set_atom_charge(unsigned int i, double zeff)
Definition: molecule.cc:365
Tensor< double > massweights() const
compute the mass-weighting matrix for the hessian
Definition: molecule.h:495
double get_eprec() const
Definition: molecule.h:425
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:592
GeometryParameters parameters
Definition: molecule.h:257
double nuclear_charge_density(double x, double y, double z) const
Definition: molecule.cc:1068
unsigned int n_core_orb(unsigned int atn) const
Definition: molecule.h:360
madness::Tensor< double > field
Definition: molecule.h:251
unsigned int n_core_orb_all() const
Definition: molecule.cc:1082
const std::vector< Atom > & get_atoms() const
Definition: molecule.h:433
void set_pseudo_atom(unsigned int i, bool psat)
Definition: molecule.cc:380
CorePotentialManager core_pot
Definition: molecule.h:250
void get_structure()
Definition: molecule.cc:129
bool test_for_c2(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition: molecule.cc:732
double core_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition: molecule.cc:1131
void read_xyz(const std::string filename)
Definition: molecule.cc:301
bool test_for_op(opT op, const double symtol) const
Definition: molecule.cc:680
double nuclear_attraction_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition: molecule.cc:1008
bool is_potential_defined_atom(int i) const
Definition: molecule.h:381
void read(std::istream &f)
Definition: molecule.cc:260
std::vector< double > get_rcut() const
Definition: molecule.h:415
bool test_for_sigma(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition: molecule.cc:736
void rotate(const Tensor< double > &D)
rotates the molecule and the external field
Definition: molecule.cc:925
class for holding the parameters for calculation
Definition: QCCalculationParametersBase.h:290
virtual void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition: QCCalculationParametersBase.h:325
bool throw_if_datagroup_not_found
Definition: QCCalculationParametersBase.h:360
void set_user_defined_value(const std::string &key, const T &value)
Definition: QCCalculationParametersBase.h:533
void print(const std::string header="", const std::string footer="") const
print all parameters
Definition: QCCalculationParametersBase.cc:22
bool ignore_unknown_keys
Definition: QCCalculationParametersBase.h:358
bool ignore_unknown_keys_silently
Definition: QCCalculationParametersBase.h:359
bool is_user_defined(std::string key) const
Definition: QCCalculationParametersBase.h:308
void set_derived_value(const std::string &key, const T &value)
Definition: QCCalculationParametersBase.h:403
A parallel world class.
Definition: world.h:132
Declaration of core potential related class.
const double m
Definition: gfit.cc:199
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.
const double atomic_mass_in_au
Atomic mass in atomic units.
Definition: constants.h:269
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
void hash_range(hashT &seed, It first, It last)
Definition: worldhash.h:280
static const char * filename
Definition: legendre.cc:96
nlohmann::json json
Definition: QCCalculationParametersBase.h:27
void hash_combine(hashT &seed, const T &v)
Combine hash values.
Definition: worldhash.h:260
const AtomicData & get_atomic_data(unsigned int atomic_number)
Definition: atomutil.cc:167
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition: lowrankfunction.h:397
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:225
NDIM & f
Definition: mra.h:2416
std::size_t hashT
The hash value type.
Definition: worldhash.h:145
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
Definition: test_ar.cc:204
const double mass
the atomic mass
Definition: atomutil.h:64
Definition: molecule.h:126
bool psp_calc() const
Definition: molecule.h:231
std::string source_name() const
Definition: molecule.h:226
std::string core_type() const
Definition: molecule.h:230
void set_global_convenience_options(const commandlineparser &parser)
Definition: molecule.h:162
double symtol() const
Definition: molecule.h:234
bool no_orient() const
Definition: molecule.h:233
static std::string derive_source_type_from_name(const std::string name, const commandlineparser &parser)
Definition: molecule.h:236
bool pure_ae() const
Definition: molecule.h:232
GeometryParameters(const GeometryParameters &other)=default
GeometryParameters()
Definition: molecule.h:142
GeometryParameters(World &world, const commandlineparser &parser)
Definition: molecule.h:129
std::string units() const
Definition: molecule.h:229
std::vector< double > field() const
Definition: molecule.h:227
double eprec() const
Definition: molecule.h:228
std::string source_type() const
Definition: molecule.h:225
void set_derived_values(const commandlineparser &parser)
Definition: molecule.h:170
Apply to (x,y,z) a C2 rotation about an axis thru the origin and (xaxis,yaxis,zaxis)
Definition: molecule.h:283
double yaxis
Definition: molecule.h:284
void operator()(double &x, double &y, double &z) const
Definition: molecule.h:286
double xaxis
Definition: molecule.h:284
apply_c2(double xaxis, double yaxis, double zaxis)
Definition: molecule.h:285
double zaxis
Definition: molecule.h:284
Definition: molecule.h:313
double yaxis
Definition: molecule.h:314
void operator()(double &x, double &y, double &z) const
Definition: molecule.h:316
double zaxis
Definition: molecule.h:314
apply_inverse(double xaxis, double yaxis, double zaxis)
Definition: molecule.h:315
double xaxis
Definition: molecule.h:314
Apply to (x,y,z) a reflection through a plane containing the origin with normal (xaxis,...
Definition: molecule.h:298
void operator()(double &x, double &y, double &z) const
Definition: molecule.h:301
apply_sigma(double xaxis, double yaxis, double zaxis)
Definition: molecule.h:300
double xaxis
Definition: molecule.h:299
double yaxis
Definition: molecule.h:299
double zaxis
Definition: molecule.h:299
very simple command line parser
Definition: commandlineparser.h:15
std::string value(const std::string key) const
Definition: commandlineparser.h:59
bool key_exists(std::string key) const
Definition: commandlineparser.h:55
Defines and implements most of Tensor.
void e()
Definition: test_sig.cc:75
double h(const coord_1d &r)
Definition: testgconv.cc:68
std::size_t axis
Definition: testpdiff.cc:59
Implement the madness:Vector class, an extension of std::array that supports some mathematical operat...