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 
42 #include <madness/world/vector.h>
43 #include <vector>
44 #include <string>
45 #include <iostream>
46 #include <fstream>
47 #include <sstream>
48 #include <algorithm>
49 #include <ctype.h>
50 #include <cmath>
51 #include <madness/tensor/tensor.h>
52 #include <madness/misc/misc.h>
53 
54 namespace madness {
55 
56 class World;
57 
58 class Atom {
59 public:
60  double x, y, z, q; ///< Coordinates and charge in atomic units
61  unsigned int atomic_number; ///< Atomic number
62  double mass; ///< Mass
63  bool pseudo_atom; ///< Indicates if this atom uses a pseudopotential
64 
65  explicit Atom(double x, double y, double z, double q, unsigned int atomic_number, bool pseudo_atom)
68 
69  if (mass==-1.0) MADNESS_EXCEPTION("faulty element in Atom",1);
70 
71  // unstable elements are indicated by negative masses, the mass
72  // is taken from the longest-living element
73  if (mass<0.0) mass*=-1.0;
74 
75  }
76 
77  explicit Atom(double x, double y, double z, double q, unsigned int atomic_number)
78  : 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  }
90 
91  Atom(const Atom& a) : x(a.x), y(a.y), z(a.z), q(a.q),
93 
94  /// Default construct makes a zero charge ghost atom at origin
95  Atom() : x(0), y(0), z(0), q(0), atomic_number(0), mass(0.0), pseudo_atom(false) {}
96 
97  int get_atomic_number() const {return atomic_number;}
98 
100  return madness::Vector<double,3>{x, y, z};
101  }
102 
103  /// return the mass in atomic units (electron mass = 1 a.u.)
105 
106  template <typename Archive>
107  void serialize(Archive& ar) {
108  ar & x & y & z & q & atomic_number & mass & pseudo_atom;
109  }
110  hashT hash() const {
111  hashT h=hash_value(x);
112  hash_combine(h,y);
113  hash_combine(h,z);
114  hash_combine(h,q);
118  return h;
119  }
120 };
121 
122 std::ostream& operator<<(std::ostream& s, const Atom& atom);
123 
124 class Molecule {
125 public:
127  GeometryParameters(const GeometryParameters& other) = default;
128 
130  try {
132  read_input_and_commandline_options(world, parser, "geometry");
133  set_derived_values(parser);
134 
135  } catch (std::exception& e) {
136  print("geometry","end");
137  throw;
138 // MADNESS_EXCEPTION("faulty geometry input",1);
139  }
140  }
141 
143  ignore_unknown_keys=true;
146 
147 // initialize<std::vector<std::string>>("source",{"inputfile"},"where to get the coordinates from: ({inputfile}, {library,xxx}, {xyz,xxx.xyz})");
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");
155 
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");
159 
160  }
161 
163 
164  if (parser.key_exists("geometry")) {
165  set_user_defined_value("source_name",parser.value("geometry"));
166  }
167 
168  }
169 
170  void set_derived_values(const commandlineparser& parser) {
171  // check if we use an xyz file, the structure library or the input file
172  set_derived_value("source_name",parser.value("input")); // will not override user input
173  std::string src_type= derive_source_type_from_name(source_name(), parser);
174  set_derived_value("source_type",src_type);
175  if (parser.key_exists("no_orient") and parser.value("no_orient")=="true")
176  set_derived_value("no_orient",true);
177 
178  // check for ambiguities in the derived source type
179  if (not is_user_defined("source_type")) {
180  std::ifstream f(source_name().c_str());
181  bool found_geometry_file=f.good();
182 // bool found_geometry_file=std::filesystem::exists(source_name());
183 
184  bool geometry_found_in_library=true;
185  try { // check for existence of file and structure in the library
186  std::ifstream f;
188  } catch(...){
189  geometry_found_in_library=false;
190  }
191 
192  if (found_geometry_file and geometry_found_in_library) {
193  madness::print("\n\n");
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");
198  madness::print(" source_type xyz");
199  madness::print(" source_type library\n\n");
200  MADNESS_EXCEPTION("faulty input\n\n",1);
201  }
202  }
203 
204 // std::vector<std::string> src=source();
205 //
206 // // some convenience for the user
207 //
208 // // if source is the input file provide the name of the input file
209 // if (src.size()==1 and src[0]=="inputfile")
210 // set_derived_value("source",std::vector<std::string>({src[0],parser.value("input")}));
211 // // if source is not "inputfile" or "library" assume an xyz file
212 // if (src.size()==1 and src[0]!="inputfile") {
213 // std::size_t found=src[0].find("xyz");
214 // if (found==src[0].size()-3) { // check input file ends with xyz
215 // set_user_defined_value("source", std::vector<std::string>({"xyz", src[0]}));
216 // } else {
217 // throw std::runtime_error("error in deriving geometry parameters");
218 // }
219 // }
220 
221  if (source_type()=="xyz") set_derived_value("units",std::string("angstrom"));
222  if (units()=="bohr" or units()=="au") set_derived_value("units","atomic");
223  }
224 
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");}
233  bool no_orient() const {return get<bool>("no_orient");}
234  double symtol() const {return get<double>("symtol");}
235 
236  static std::string derive_source_type_from_name(const std::string name,
237  const commandlineparser& parser) {
238  if (name==parser.value("input")) return "inputfile";
239  std::size_t pos = name.find(".xyz");
240  if (pos!=std::string::npos) return "xyz";
241  return "library";
242  }
243 
244  };
245 
246 private:
247  // If you add more fields don't forget to serialize them
248  std::vector<Atom> atoms;
249  std::vector<double> rcut; // Reciprocal of the smoothing radius
252 
253  /// The molecular point group is automatically assigned in the identify_pointgroup function
254  std::string pointgroup_="c1";
255 
256 public:
258 
259  static void print_parameters();
260 
261  std::string get_pointgroup() const {return pointgroup_;}
262 
263 private:
264 
265  void swapaxes(int ix, int iy);
266 
267  template <typename opT>
268  bool test_for_op(opT op, const double symtol) const;
269 
270  template <typename opT>
271  void symmetrize_for_op(opT op, const double symtol);
272 
273  template <typename opT>
274  int find_symmetry_equivalent_atom(int iatom, opT op, const double symtol) const;
275 
276  bool test_for_c2(double xaxis, double yaxis, double zaxis, const double symtol) const;
277 
278  bool test_for_sigma(double xaxis, double yaxis, double zaxis, const double symtol) const;
279 
280  bool test_for_inverse(const double symtol) const;
281 
282  /// Apply to (x,y,z) a C2 rotation about an axis thru the origin and (xaxis,yaxis,zaxis)
283  struct apply_c2{
284  double xaxis, yaxis, zaxis;
285  apply_c2(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
286  void operator()(double& x, double& y, double& z) const {
287  double raxissq = xaxis*xaxis + yaxis*yaxis + zaxis*zaxis;
288  double dx = x*xaxis*xaxis/raxissq;
289  double dy = y*yaxis*yaxis/raxissq;
290  double dz = z*zaxis*zaxis/raxissq;
291  x = 2.0*dx - x;
292  y = 2.0*dy - y;
293  z = 2.0*dz - z;
294  }
295  };
296 
297  /// Apply to (x,y,z) a reflection through a plane containing the origin with normal (xaxis,yaxis,zaxis)
298  struct apply_sigma{
299  double xaxis, yaxis, zaxis;
300  apply_sigma(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
301  void operator()(double& x, double& y, double& z) const {
302  double raxissq = xaxis * xaxis + yaxis * yaxis + zaxis * zaxis;
303  double dx = x * xaxis * xaxis / raxissq;
304  double dy = y * yaxis * yaxis / raxissq;
305  double dz = z * zaxis * zaxis / raxissq;
306 
307  x = x - 2.0 * dx;
308  y = y - 2.0 * dy;
309  z = z - 2.0 * dz;
310  }
311  };
312 
314  double xaxis, yaxis, zaxis;
315  apply_inverse(double xaxis, double yaxis, double zaxis) : xaxis(xaxis), yaxis(yaxis), zaxis(zaxis) {}
316  void operator()(double& x, double& y, double& z) const {
317  x = -x;
318  y = -y;
319  z = -z;
320  }
321  };
322 
323 public:
324 
325  /// Makes a molecule with zero atoms
326  Molecule() : atoms(), rcut(), core_pot(), field(3L) {};
327 
328  /// makes a molecule from a list of atoms
330 
331  /// makes a molecule using contents of \p parser
332  Molecule(World& world, const commandlineparser& parser);
333 
334  void get_structure();
335 
336  void read_structure_from_library(const std::string& name);
337 
338  static std::istream& position_stream_in_library(std::ifstream& f, const std::string& name);
339 
340  static std::string get_structure_library_path();
341 
342  /// print out a Gaussian cubefile header
343  std::vector<std::string> cubefile_header() const;
344 
345  // initializes Molecule using the contents of file \c filename
346  void read_file(const std::string& filename);
347 
348  // initializes Molecule using the contents of stream \c f
349  void read(std::istream& f);
350 
351  // initializes Molecule using the contents of file \c filenam assuming an xyz file
352  void read_xyz(const std::string filename);
353 
354  void read_core_file(const std::string& filename);
355 
356  std::string guess_file() const { return core_pot.guess_file(); };
357 
358  unsigned int n_core_orb_all() const ;
359 
360  unsigned int n_core_orb(unsigned int atn) const {
361  if (core_pot.is_defined(atn))
362  return core_pot.n_core_orb_base(atn);
363  else
364  return 0;
365  };
366 
367  unsigned int get_core_l(unsigned int atn, unsigned int c) const {
368  return core_pot.get_core_l(atn, c);
369  }
370 
371  double get_core_bc(unsigned int atn, unsigned int c) const {
372  return core_pot.get_core_bc(atn, c);
373  }
374 
375  double core_eval(int atom, unsigned int core, int m, double x, double y, double z) const;
376 
377  double core_derivative(int atom, int axis, unsigned int core, int m, double x, double y, double z) const;
378 
379  bool is_potential_defined(unsigned int atn) const { return core_pot.is_defined(atn); };
380 
381  bool is_potential_defined_atom(int i) const { return core_pot.is_defined(atoms[i].atomic_number); };
382 
383  void add_atom(double x, double y, double z, double q, int atn);
384 
385  void add_atom(double x, double y, double z, double q, int atn, bool psat);
386 
387  size_t natom() const {
388  return atoms.size();
389  };
390 
391  void set_atom_charge(unsigned int i, double zeff);
392 
393  unsigned int get_atom_charge(unsigned int i) const;
394 
395  unsigned int get_atomic_number(unsigned int i) const;
396 
397  void set_pseudo_atom(unsigned int i, bool psat);
398 
399  bool get_pseudo_atom(unsigned int i) const;
400 
401  void set_atom_coords(unsigned int i, double x, double y, double z);
402 
404 
405  std::vector< madness::Vector<double,3> > get_all_coords_vec() const;
406 
407  std::vector<double> atomic_radii;
408 
409  void set_all_coords(const madness::Tensor<double>& newcoords);
410 
411  void update_rcut_with_eprec(double value);
412 
413  void set_rcut(double value);
414 
415  std::vector<double> get_rcut() const {return rcut;}
416 
417  void set_core_eprec(double value) {
418  core_pot.set_eprec(value);
419  }
420 
421  void set_core_rcut(double value) {
422  core_pot.set_rcut(value);
423  }
424 
425  double get_eprec() const {
426  return parameters.eprec();
427  }
428 
429  double bounding_cube() const;
430 
431  const Atom& get_atom(unsigned int i) const;
432 
433  const std::vector<Atom> & get_atoms()const{return atoms;}
434 
435  void print() const;
436 
437  double inter_atomic_distance(unsigned int i,unsigned int j) const;
438 
439  double nuclear_repulsion_energy() const;
440 
441  double nuclear_repulsion_derivative(size_t iatom, int axis) const;
442 
443  /// compute the nuclear-nuclear contribution to the second derivatives
444 
445  /// @param[in] iatom the i-th atom (row of the hessian)
446  /// @param[in] jatom the j-th atom (column of the hessian)
447  /// @param[in] iaxis the xyz axis of the i-th atom
448  /// @param[in] jaxis the xyz axis of the j-th atom
449  /// return the (3*iatom + iaxis, 3*jatom + jaxis) matix element of the hessian
450  double nuclear_repulsion_second_derivative(int iatom, int jatom,
451  int iaxis, int jaxis) const;
452 
453  /// return the hessian matrix of the second derivatives d^2/dxdy V
454 
455  /// no factor 0.5 included
457 
458  /// compute the dipole moment of the nuclei
459 
460  /// @param[in] axis the axis (x, y, z)
461  double nuclear_dipole(int axis) const;
462 
463  /// compute the derivative of the nuclear dipole wrt a nuclear displacement
464 
465  /// @param[in] atom the atom which will be displaced
466  /// @param[in] axis the axis where the atom will be displaced
467  /// @return a vector which all 3 components of the dipole derivative
468  Tensor<double> nuclear_dipole_derivative(const int atom, const int axis) const;
469 
470  double nuclear_charge_density(double x, double y, double z) const;
471 
472  double mol_nuclear_charge_density(double x, double y, double z) const;
473 
474  double smallest_length_scale() const;
475 
476  std::string symmetrize_and_identify_point_group(const double symtol);
477 
478  /// Moves the center of nuclear charge to the origin
479  void center();
480 
481  /// rotates the molecule and the external field
482 
483  /// @param[in] D the rotation matrix
484  void rotate(const Tensor<double>& D);
485 
486  /// translate the molecule
487  void translate(const Tensor<double>& translation);
488 
490 
491  /// compute the mass-weighting matrix for the hessian
492 
493  /// use as
494  /// mass_weighted_hessian=inner(massweights,inner(hessian,massweights));
496 
497  Tensor<double> M(3*natom(),3*natom());
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;
503  }
504  return M;
505  }
506 
507 
508 
510 
511  void orient(bool verbose=false);
512 
513  double total_nuclear_charge() const;
514 
515  /// nuclear attraction potential for the whole molecule
516  double nuclear_attraction_potential(double x, double y, double z) const;
517 
518  /// nuclear attraction potential for a specific atom in the molecule
519  double atomic_attraction_potential(int iatom, double x, double y, double z) const;
520 
521  double molecular_core_potential(double x, double y, double z) const;
522 
523  double core_potential_derivative(int atom, int axis, double x, double y, double z) const;
524 
525  double nuclear_attraction_potential_derivative(int atom, int axis, double x, double y, double z) const;
526 
527  double nuclear_attraction_potential_second_derivative(int atom, int iaxis,
528  int jaxis, double x, double y, double z) const;
529 
530  template <typename Archive>
531  void serialize(Archive& ar) {
533  }
534 
535  hashT hash() const {
536  hashT h= hash_range(atoms.begin(),atoms.end());
537  hash_combine(h,hash_range(rcut.begin(),rcut.end()));
539  return h;
540  }
541  [[nodiscard]] json to_json() const;
542 };
543 
544 }
545 
546 #endif
double q(double t)
Definition: DKops.h:18
Declaration of utility class and functions for atom.
Definition: mentity.h:71
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...