MADNESS 0.10.1
molecule.h
Go to the documentation of this file.
1/*
2 This file is part of MADNESS.
3
4 Copyright (C) 2007,2010 Oak Ridge National Laboratory
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 For more information please contact:
21
22 Robert J. Harrison
23 Oak Ridge National Laboratory
24 One Bethel Valley Road
25 P.O. Box 2008, MS-6367
26
27 email: harrisonrj@ornl.gov
28 tel: 865-241-3937
29 fax: 865-572-0680
30*/
31
32#ifndef MADNESS_CHEM_MOLECULE_H__INCLUDED
33#define MADNESS_CHEM_MOLECULE_H__INCLUDED
34
35/// \file moldft/molecule.h
36/// \brief Declaration of molecule related classes and functions
37
38#include <ctype.h>
41#include <madness/misc/misc.h>
44
45#include <algorithm>
46#include <cmath>
47#include <fstream>
48#include <iostream>
49#include <sstream>
50#include <string>
51#include <vector>
52
55
56namespace madness {
57
58class World;
59
60class Atom {
61 public:
62 double x, y, z, q; ///< Coordinates and charge in atomic units
63 unsigned int atomic_number; ///< Atomic number
64 double mass; ///< Mass
65 bool pseudo_atom; ///< Indicates if this atom uses a pseudopotential
66
67 explicit Atom(double x, double y, double z, double q, unsigned int atomic_number, bool pseudo_atom)
70
71 if (mass == -1.0) MADNESS_EXCEPTION("faulty element in Atom", 1);
72
73 // unstable elements are indicated by negative masses, the mass
74 // is taken from the longest-living element
75 if (mass < 0.0) mass *= -1.0;
76 }
77
78 explicit Atom(double x, double y, double z, double q, unsigned int atomic_number) : x(x), y(y), z(z), q(q), atomic_number(atomic_number) {
80
81 if (mass == -1.0) MADNESS_EXCEPTION("faulty element in Atom", 1);
82
83 // unstable elements are indicated by negative masses, the mass
84 // is taken from the longest-living element
85 if (mass < 0.0) mass *= -1.0;
86
87 pseudo_atom = false;
88 }
89
91
92 /// Default construct makes a zero charge ghost atom at origin
93 Atom() : x(0), y(0), z(0), q(0), atomic_number(0), mass(0.0), pseudo_atom(false) {}
94
95 bool operator==(const Atom &other) const {
96 double thresh=1.e-10;
97 auto displacement=Vector<double, 3>({x, y, z})-(Vector<double, 3>({other.x, other.y, other.z}));
98 double err = displacement.normf();
99 return ((err<thresh) && q == other.q &&
100 atomic_number == other.atomic_number && mass == other.mass &&
101 pseudo_atom == other.pseudo_atom);
102 }
103
104 int get_atomic_number() const { return atomic_number; }
105
107
108 /// return the mass in atomic units (electron mass = 1 a.u.)
110
111 template <typename Archive>
112 void serialize(Archive &ar) {
113 ar & x & y & z & q & atomic_number & mass & pseudo_atom;
114 }
115 hashT hash() const {
116 hashT h = hash_value(x);
117 hash_combine(h, y);
118 hash_combine(h, z);
119 hash_combine(h, q);
123 return h;
124 }
125};
126
127std::ostream &operator<<(std::ostream &s, const Atom &atom);
128
129class Molecule {
130 public:
131 // Needed for ParameterManager
132 static constexpr char const *tag = "molecule";
133 [[nodiscard]] json to_json_if_precedence(std::string const &precedence) const {
134 json mol_schema = to_json();
135 mol_schema["parameters"] = parameters.to_json_if_precedence(precedence);
136 insert_symbols_and_geometry(mol_schema);
137 return mol_schema;
138 }
139
141 GeometryParameters(const GeometryParameters &other) = default;
142
144 try {
146 read_input_and_commandline_options(world, parser, "geometry");
147 set_derived_values(parser);
148
149 } catch (std::exception &e) {
150 print(tag, "end");
151 throw;
152 // MADNESS_EXCEPTION("faulty geometry input",1);
153 }
154 }
155
157 ignore_unknown_keys = true;
160
161 // initialize<std::vector<std::string>>("source",{"inputfile"},"where
162 // to get the coordinates from: ({inputfile}, {library,xxx},
163 // {xyz,xxx.xyz})");
164 initialize<std::string>("source_type", "inputfile", "where to get the coordinates from", {"inputfile", "xyz", "library"});
165 initialize<std::string>("source_name", "TBD", "name of the geometry from the library or the input file");
166 initialize<double>("eprec", 1.e-4, "smoothing for the nuclear potential");
167 initialize<std::string>("units", "atomic", "coordinate units", {"atomic", "angstrom", "bohr", "au"});
168 initialize<std::vector<double>>("field", {0.0, 0.0, 0.0}, "external electric field");
169 initialize<bool>("no_orient", false,
170 "if true the molecule coordinates will not be "
171 "reoriented and/or symmetrized");
172 initialize<double>("symtol", -1.e-2,
173 "distance threshold for determining the "
174 "symmetry-equivalent atoms; negative: old algorithm");
175
176 initialize<std::string>("core_type", "none", "core potential type", {"none", "mcp"});
177 initialize<bool>("psp_calc", false, "pseudopotential calculation for all atoms");
178 initialize<bool>("pure_ae", true, "pure all electron calculation with no pseudo-atoms");
179 }
180
182 if (parser.key_exists("geometry")) {
183 set_user_defined_value("source_name", parser.value("geometry"));
184 }
185 }
186
188 // check if we use an xyz file, the structure library or the input file
189 set_derived_value("source_name",
190 parser.value("input")); // will not override user input
191 std::string src_type = derive_source_type_from_name(source_name(), parser);
192 set_derived_value("source_type", src_type);
193 if (parser.key_exists("no_orient") and parser.value("no_orient") == "true") set_derived_value("no_orient", true);
194
195 // check for ambiguities in the derived source type
196 if (not is_user_defined("source_type")) {
197 std::ifstream f(source_name().c_str());
198 bool found_geometry_file = f.good();
199 // bool
200 // found_geometry_file=std::filesystem::exists(source_name());
201
202 bool geometry_found_in_library = true;
203 try { // check for existence of file and structure in the library
204 std::ifstream f;
206 } catch (...) {
207 geometry_found_in_library = false;
208 }
209
210 if (found_geometry_file and geometry_found_in_library) {
211 madness::print("\n\n");
213 "geometry specification ambiguous: found geometry in "
214 "the structure library and in a file\n");
218 "\nPlease specify the location of your geometry input "
219 "by one of the two lines:\n");
220 madness::print(" source_type xyz");
221 madness::print(" source_type library\n\n");
222 MADNESS_EXCEPTION("faulty input\n\n", 1);
223 }
224 }
225
226 // std::vector<std::string> src=source();
227 //
228 // // some convenience for the user
229 //
230 // // if source is the input file provide the name of the input
231 // file if (src.size()==1 and src[0]=="inputfile")
232 // set_derived_value("source",std::vector<std::string>({src[0],parser.value("input")}));
233 // // if source is not "inputfile" or "library" assume an xyz
234 // file if (src.size()==1 and src[0]!="inputfile") {
235 // std::size_t found=src[0].find("xyz");
236 // if (found==src[0].size()-3) { // check input file ends
237 // with xyz
238 // set_user_defined_value("source",
239 // std::vector<std::string>({"xyz", src[0]}));
240 // } else {
241 // throw std::runtime_error("error in deriving geometry
242 // parameters");
243 // }
244 // }
245
246 if (source_type() == "xyz") set_derived_value("units", std::string("angstrom"));
247 if (units() == "bohr" or units() == "au") set_derived_value("units", std::string("atomic"));
248 }
249
250 std::string source_type() const { return get<std::string>("source_type"); }
251 std::string source_name() const { return get<std::string>("source_name"); }
252 std::vector<double> field() const { return get<std::vector<double>>("field"); }
253 double eprec() const { return get<double>("eprec"); }
254 std::string units() const { return get<std::string>("units"); }
255 std::string core_type() const { return get<std::string>("core_type"); }
256 bool psp_calc() const { return get<bool>("psp_calc"); }
257 bool pure_ae() const { return get<bool>("pure_ae"); }
258 bool no_orient() const { return get<bool>("no_orient"); }
259 double symtol() const { return get<double>("symtol"); }
260
261 static std::string derive_source_type_from_name(const std::string name, const commandlineparser &parser) {
262 if (name == parser.value("input")) return "inputfile";
263 std::size_t pos = name.find(".xyz");
264 if (pos != std::string::npos) return "xyz";
265 return "library";
266 }
267 };
268
269 private:
270 // If you add more fields don't forget to serialize them
271 std::vector<Atom> atoms;
272 std::vector<double> rcut; // Reciprocal of the smoothing radius
275
276 /// The molecular point group is automatically assigned in the
277 /// identify_pointgroup function
278 std::string pointgroup_ = "c1";
279
280 public:
282
283 static void print_parameters();
284
285 std::string get_pointgroup() const { return pointgroup_; }
286
287 private:
288 void swapaxes(int ix, int iy);
289
290 template <typename opT>
291 bool test_for_op(opT op, const double symtol) const;
292
293 template <typename opT>
294 void symmetrize_for_op(opT op, const double symtol);
295
296 template <typename opT>
297 int find_symmetry_equivalent_atom(int iatom, opT op, const double symtol) const;
298
299 bool test_for_c2(double xaxis, double yaxis, double zaxis, const double symtol) const;
300
301 bool test_for_sigma(double xaxis, double yaxis, double zaxis, const double symtol) const;
302
303 bool test_for_inverse(const double symtol) const;
304
305 /// Apply to (x,y,z) a C2 rotation about an axis thru the origin and
306 /// (xaxis,yaxis,zaxis)
307 struct apply_c2 {
308 double xaxis, yaxis, zaxis;
309 apply_c2(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
310 void operator()(double &x, double &y, double &z) const {
311 double raxissq = xaxis * xaxis + yaxis * yaxis + zaxis * zaxis;
312 double dx = x * xaxis * xaxis / raxissq;
313 double dy = y * yaxis * yaxis / raxissq;
314 double dz = z * zaxis * zaxis / raxissq;
315 x = 2.0 * dx - x;
316 y = 2.0 * dy - y;
317 z = 2.0 * dz - z;
318 }
319 };
320
321 /// Apply to (x,y,z) a reflection through a plane containing the origin with
322 /// normal (xaxis,yaxis,zaxis)
323 struct apply_sigma {
324 double xaxis, yaxis, zaxis;
325 apply_sigma(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
326 void operator()(double &x, double &y, double &z) const {
327 double raxissq = xaxis * xaxis + yaxis * yaxis + zaxis * zaxis;
328 double dx = x * xaxis * xaxis / raxissq;
329 double dy = y * yaxis * yaxis / raxissq;
330 double dz = z * zaxis * zaxis / raxissq;
331
332 x = x - 2.0 * dx;
333 y = y - 2.0 * dy;
334 z = z - 2.0 * dz;
335 }
336 };
337
339 double xaxis, yaxis, zaxis;
340 apply_inverse(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
341 void operator()(double &x, double &y, double &z) const {
342 x = -x;
343 y = -y;
344 z = -z;
345 }
346 };
347
348 public:
349 /// Makes a molecule with zero atoms
350 Molecule() : atoms(), rcut(), core_pot(), field(3L){};
351
352 /// makes a molecule from a list of atoms
354
355 /// makes a molecule using contents of \p parser
356 Molecule(World &world, const commandlineparser &parser);
357
358 void get_structure();
359
360 void read_structure_from_library(const std::string &name);
361
362 static std::istream &position_stream_in_library(std::ifstream &f, const std::string &name);
363
364 static std::string get_structure_library_path();
365
366 /// print out a Gaussian cubefile header
367
368 /// @param[in] offset the offset to be subtracted from the coordinates
369 std::vector<std::string> cubefile_header(const Vector<double, 3> offset = Vector<double, 3>(0.0)) const;
370
371 // initializes Molecule using the contents of file \c filename
372 void read_file(const std::string &filename);
373
374 // initializes Molecule using the contents of stream \c f
375 void read(std::istream &f);
376
377 // initializes Molecule using the contents of file \c filenam assuming an xyz
378 // file
379 void read_xyz(const std::string filename);
380
381 void read_core_file(const std::string &filename);
382
383 std::string guess_file() const { return core_pot.guess_file(); };
384
385 unsigned int n_core_orb_all() const;
386
387 unsigned int n_core_orb(unsigned int atn) const {
388 if (core_pot.is_defined(atn))
389 return core_pot.n_core_orb_base(atn);
390 else
391 return 0;
392 };
393
394 unsigned int get_core_l(unsigned int atn, unsigned int c) const { return core_pot.get_core_l(atn, c); }
395
396 double get_core_bc(unsigned int atn, unsigned int c) const { return core_pot.get_core_bc(atn, c); }
397
398 double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const;
399
400 double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const;
401
402 bool is_potential_defined(unsigned int atn) const { return core_pot.is_defined(atn); };
403
404 bool is_potential_defined_atom(int i) const { return core_pot.is_defined(atoms[i].atomic_number); };
405
406 void add_atom(double x, double y, double z, double q, int atn);
407
408 void add_atom(double x, double y, double z, double q, int atn, bool psat);
409
410 size_t natom() const { return atoms.size(); };
411
412 void set_atom_charge(unsigned int i, double zeff);
413
414 unsigned int get_atom_charge(unsigned int i) const;
415
416 unsigned int get_atomic_number(unsigned int i) const;
417
418 void set_pseudo_atom(unsigned int i, bool psat);
419
420 bool get_pseudo_atom(unsigned int i) const;
421
422 void set_atom_coords(unsigned int i, double x, double y, double z);
423
425
426 std::vector<madness::Vector<double, 3>> get_all_coords_vec() const;
427
428 std::vector<double> atomic_radii;
429
430 void set_all_coords(const madness::Tensor<double> &newcoords);
431
432 void update_rcut_with_eprec(double value);
433
434 void set_rcut(double value);
435
436 std::vector<double> get_rcut() const { return rcut; }
437
438 void set_core_eprec(double value) { core_pot.set_eprec(value); }
439
440 void set_core_rcut(double value) { core_pot.set_rcut(value); }
441
442 double get_eprec() const { return parameters.eprec(); }
443
444 double bounding_cube() const;
445
446 const Atom &get_atom(unsigned int i) const;
447
448 const std::vector<Atom> &get_atoms() const { return atoms; }
449
450 void print() const;
451
452 double inter_atomic_distance(unsigned int i, unsigned int j) const;
453
454 double nuclear_repulsion_energy() const;
455
456 double nuclear_repulsion_derivative(size_t iatom, int axis) const;
457
458 /// compute the nuclear-nuclear contribution to the second derivatives
459
460 /// @param[in] iatom the i-th atom (row of the hessian)
461 /// @param[in] jatom the j-th atom (column of the hessian)
462 /// @param[in] iaxis the xyz axis of the i-th atom
463 /// @param[in] jaxis the xyz axis of the j-th atom
464 /// return the (3*iatom + iaxis, 3*jatom + jaxis) matix element of the hessian
465 double nuclear_repulsion_second_derivative(int iatom, int jatom, int iaxis, int jaxis) const;
466
467 /// return the hessian matrix of the second derivatives d^2/dxdy V
468
469 /// no factor 0.5 included
471
472 /// compute the dipole moment of the nuclei
473
474 /// @param[in] axis the axis (x, y, z)
475 double nuclear_dipole(int axis) const;
476
477 /// compute the derivative of the nuclear dipole wrt a nuclear displacement
478
479 /// @param[in] atom the atom which will be displaced
480 /// @param[in] axis the axis where the atom will be displaced
481 /// @return a vector which all 3 components of the dipole derivative
482 Tensor<double> nuclear_dipole_derivative(const int atom, const int axis) const;
483
484 /// evaluate the nuclear charge density at point `{x,y,z}` using the default
485 /// MADNESS nuclear model. See smoothed_density() for the description
486 /// of the default nuclear model.
487 /// \param x,y,z the point at which the nuclear charge density is evaluated
488 /// \param rscale setting `rscale>1` will make a nucleus larger by a factor of
489 /// \p rscale (in other words, `rcut` is multiplied by the inverse of by this)
490 /// \return the nuclear charge density at point `{x,y,z}`
491 /// \sa smoothed_density()
492 double nuclear_charge_density(double x, double y, double z, double rscale = 1.) const;
493
494 double smallest_length_scale() const;
495
496 std::string symmetrize_and_identify_point_group(const double symtol);
497
498 /// Moves the center of nuclear charge to the origin
499 void center();
500
501 /// rotates the molecule and the external field
502
503 void fix_phase();
504
505 /// @param[in] D the rotation matrix
506 void rotate(const Tensor<double> &D);
507
508 /// translate the molecule
509 void translate(const Tensor<double> &translation);
510
512
513 /// compute the mass-weighting matrix for the hessian
514
515 /// use as
516 /// mass_weighted_hessian=inner(massweights,inner(hessian,massweights));
518 Tensor<double> M(3 * natom(), 3 * natom());
519 for (size_t i = 0; i < natom(); i++) {
520 const double sqrtmass = 1.0 / sqrt(get_atom(i).get_mass_in_au());
521 M(3 * i, 3 * i) = sqrtmass;
522 M(3 * i + 1, 3 * i + 1) = sqrtmass;
523 M(3 * i + 2, 3 * i + 2) = sqrtmass;
524 }
525 return M;
526 }
527
529
530 void orient(bool verbose = false);
531
532 double total_nuclear_charge() const;
533
534 /// nuclear attraction potential for the whole molecule
535 double nuclear_attraction_potential(double x, double y, double z) const;
536
537 /// nuclear attraction potential for a specific atom in the molecule
538 double atomic_attraction_potential(int iatom, double x, double y, double z) const;
539
540 double molecular_core_potential(double x, double y, double z) const;
541
542 double core_potential_derivative(int atom, int axis, double x, double y, double z) const;
543
544 double nuclear_attraction_potential_derivative(int atom, int axis, double x, double y, double z) const;
545
546 double nuclear_attraction_potential_second_derivative(int atom, int iaxis, int jaxis, double x, double y, double z) const;
547
548 bool operator==(const Molecule& other) const {
549 if (atoms.size() != other.atoms.size() || rcut.size() != other.rcut.size() || pointgroup_ != other.pointgroup_) return false;
550 for (size_t i = 0; i < atoms.size(); ++i) {
551 if (not (atoms[i] == other.atoms[i])) return false;
552 }
553 for (size_t i = 0; i < rcut.size(); ++i) {
554 if (rcut[i] != other.rcut[i]) return false;
555 }
556
557 return (field-other.field).normf()<1.e-13 && parameters == other.parameters;
558 }
559
560 template <typename Archive>
561 void serialize(Archive &ar) {
563 }
564
565 hashT hash() const {
566 hashT h = hash_range(atoms.begin(), atoms.end());
567 hash_combine(h, hash_range(rcut.begin(), rcut.end()));
569 return h;
570 }
571 [[nodiscard]] json to_json() const;
572 void insert_symbols_and_geometry(json &mol_json) const;
573 void from_json(const json &mol_json);
574};
575
576} // namespace madness
577
578#endif
double q(double t)
Definition DKops.h:18
Declaration of utility class and functions for atom.
Definition mentity.h:71
Definition molecule.h:60
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:228
std::vector< madness::Vector< double, 3 > > get_all_coords_vec() const
Definition molecule.cc:413
static std::string get_structure_library_path()
Definition molecule.cc:201
std::vector< double > get_rcut() const
Definition molecule.h:436
void read_core_file(const std::string &filename)
Definition molecule.cc:1194
double bounding_cube() const
Returns the half width of the bounding cube.
Definition molecule.cc:999
std::vector< double > atomic_radii
Definition molecule.h:428
void symmetrize_for_op(opT op, const double symtol)
Definition molecule.cc:739
void update_rcut_with_eprec(double value)
updates rcuts with given eprec
Definition molecule.cc:434
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:579
void set_all_coords(const madness::Tensor< double > &newcoords)
Definition molecule.cc:424
std::string guess_file() const
Definition molecule.h:383
double smallest_length_scale() const
Definition molecule.cc:679
double get_core_bc(unsigned int atn, unsigned int c) const
Definition molecule.h:396
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:1041
double total_nuclear_charge() const
Definition molecule.cc:1009
double nuclear_dipole(int axis) const
compute the dipole moment of the nuclei
Definition molecule.cc:558
const std::vector< Atom > & get_atoms() const
Definition molecule.h:448
std::vector< Atom > atoms
Definition molecule.h:271
void translate(const Tensor< double > &translation)
translate the molecule
Definition molecule.cc:708
void center()
Moves the center of nuclear charge to the origin.
Definition molecule.cc:689
const Atom & get_atom(unsigned int i) const
Definition molecule.cc:452
bool operator==(const Molecule &other) const
Definition molecule.h:548
madness::Tensor< double > get_all_coords() const
Definition molecule.cc:402
void orient(bool verbose=false)
Centers and orients the molecule in a standard manner.
Definition molecule.cc:907
unsigned int get_atom_charge(unsigned int i) const
Definition molecule.cc:375
double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1151
int find_symmetry_equivalent_atom(int iatom, opT op, const double symtol) const
Definition molecule.cc:728
double molecular_core_potential(double x, double y, double z) const
Definition molecule.cc:1164
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:241
std::string get_pointgroup() const
Definition molecule.h:285
bool get_pseudo_atom(unsigned int i) const
Definition molecule.cc:390
double nuclear_attraction_potential(double x, double y, double z) const
nuclear attraction potential for the whole molecule
Definition molecule.cc:1017
std::string symmetrize_and_identify_point_group(const double symtol)
Definition molecule.cc:795
void read_file(const std::string &filename)
Definition molecule.cc:256
Tensor< double > center_of_mass() const
compute the center of mass
Definition molecule.cc:877
std::string pointgroup_
Definition molecule.h:278
hashT hash() const
Definition molecule.h:565
void fix_phase()
rotates the molecule and the external field
Definition molecule.cc:953
static std::istream & position_stream_in_library(std::ifstream &f, const std::string &name)
Definition molecule.cc:207
void set_atom_coords(unsigned int i, double x, double y, double z)
Definition molecule.cc:395
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:530
bool test_for_inverse(const double symtol) const
Definition molecule.cc:778
size_t natom() const
Definition molecule.h:410
double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const
Definition molecule.cc:1142
void print() const
Definition molecule.cc:510
double nuclear_repulsion_derivative(size_t iatom, int axis) const
Definition molecule.cc:586
std::vector< double > rcut
Definition molecule.h:272
void set_rcut(double value)
Definition molecule.cc:446
void set_core_rcut(double value)
Definition molecule.h:440
void set_core_eprec(double value)
Definition molecule.h:438
bool is_potential_defined(unsigned int atn) const
Definition molecule.h:402
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:1085
void serialize(Archive &ar)
Definition molecule.h:561
double nuclear_repulsion_energy() const
Definition molecule.cc:537
unsigned int get_atomic_number(unsigned int i) const
Definition molecule.cc:380
void swapaxes(int ix, int iy)
Definition molecule.cc:782
static constexpr char const * tag
Definition molecule.h:132
static void print_parameters()
Definition molecule.cc:115
json to_json() const
Definition molecule.cc:462
unsigned int get_core_l(unsigned int atn, unsigned int c) const
Definition molecule.h:394
Tensor< double > nuclear_repulsion_hessian() const
return the hessian matrix of the second derivatives d^2/dxdy V
Definition molecule.cc:606
void add_atom(double x, double y, double z, double q, int atn)
Definition molecule.cc:351
Tensor< double > moment_of_inertia() const
Definition molecule.cc:893
Molecule()
Makes a molecule with zero atoms.
Definition molecule.h:350
double nuclear_charge_density(double x, double y, double z, double rscale=1.) const
Definition molecule.cc:1113
void set_atom_charge(unsigned int i, double zeff)
Definition molecule.cc:370
double get_eprec() const
Definition molecule.h:442
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:630
GeometryParameters parameters
Definition molecule.h:281
void from_json(const json &mol_json)
Definition molecule.cc:483
unsigned int n_core_orb(unsigned int atn) const
Definition molecule.h:387
madness::Tensor< double > field
Definition molecule.h:274
unsigned int n_core_orb_all() const
Definition molecule.cc:1130
void set_pseudo_atom(unsigned int i, bool psat)
Definition molecule.cc:385
void insert_symbols_and_geometry(json &mol_json) const
Definition molecule.cc:473
CorePotentialManager core_pot
Definition molecule.h:273
Tensor< double > massweights() const
compute the mass-weighting matrix for the hessian
Definition molecule.h:517
void get_structure()
Definition molecule.cc:134
bool test_for_c2(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition molecule.cc:770
double core_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition molecule.cc:1179
void read_xyz(const std::string filename)
Definition molecule.cc:306
bool test_for_op(opT op, const double symtol) const
Definition molecule.cc:718
double nuclear_attraction_potential_derivative(int atom, int axis, double x, double y, double z) const
Definition molecule.cc:1054
bool is_potential_defined_atom(int i) const
Definition molecule.h:404
void read(std::istream &f)
Definition molecule.cc:265
bool test_for_sigma(double xaxis, double yaxis, double zaxis, const double symtol) const
Definition molecule.cc:774
void rotate(const Tensor< double > &D)
Definition molecule.cc:982
class for holding the parameters for calculation
Definition QCCalculationParametersBase.h:294
virtual void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition QCCalculationParametersBase.h:328
bool throw_if_datagroup_not_found
Definition QCCalculationParametersBase.h:365
void set_user_defined_value(const std::string &key, const T &value)
Definition QCCalculationParametersBase.h:524
bool ignore_unknown_keys
Definition QCCalculationParametersBase.h:363
bool ignore_unknown_keys_silently
Definition QCCalculationParametersBase.h:364
bool is_user_defined(std::string key) const
Definition QCCalculationParametersBase.h:311
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 QCCalculationParametersBase.h:507
void set_derived_value(const std::string &key, const T &value)
Definition QCCalculationParametersBase.h:406
A tensor is a multidimensional array.
Definition tensor.h:317
A simple, fixed dimension vector.
Definition vector.h:64
A parallel world class.
Definition world.h:132
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:270
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:397
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:28
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:451
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:225
NDIM & f
Definition mra.h:2481
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
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:140
bool psp_calc() const
Definition molecule.h:256
std::string source_name() const
Definition molecule.h:251
std::string core_type() const
Definition molecule.h:255
void set_global_convenience_options(const commandlineparser &parser)
Definition molecule.h:181
double symtol() const
Definition molecule.h:259
bool no_orient() const
Definition molecule.h:258
static std::string derive_source_type_from_name(const std::string name, const commandlineparser &parser)
Definition molecule.h:261
bool pure_ae() const
Definition molecule.h:257
GeometryParameters(const GeometryParameters &other)=default
GeometryParameters()
Definition molecule.h:156
GeometryParameters(World &world, const commandlineparser &parser)
Definition molecule.h:143
std::string units() const
Definition molecule.h:254
std::vector< double > field() const
Definition molecule.h:252
double eprec() const
Definition molecule.h:253
std::string source_type() const
Definition molecule.h:250
void set_derived_values(const commandlineparser &parser)
Definition molecule.h:187
Definition molecule.h:307
double yaxis
Definition molecule.h:308
void operator()(double &x, double &y, double &z) const
Definition molecule.h:310
double xaxis
Definition molecule.h:308
apply_c2(double xaxis, double yaxis, double zaxis)
Definition molecule.h:309
double zaxis
Definition molecule.h:308
Definition molecule.h:338
double yaxis
Definition molecule.h:339
void operator()(double &x, double &y, double &z) const
Definition molecule.h:341
double zaxis
Definition molecule.h:339
apply_inverse(double xaxis, double yaxis, double zaxis)
Definition molecule.h:340
double xaxis
Definition molecule.h:339
Definition molecule.h:323
void operator()(double &x, double &y, double &z) const
Definition molecule.h:326
apply_sigma(double xaxis, double yaxis, double zaxis)
Definition molecule.h:325
double xaxis
Definition molecule.h:324
double yaxis
Definition molecule.h:324
double zaxis
Definition molecule.h:324
very simple command line parser
Definition commandlineparser.h:15
std::string value(const std::string key) const
Definition commandlineparser.h:62
bool key_exists(std::string key) const
Definition commandlineparser.h:58
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...