MADNESS  0.10.1
AC.h
Go to the documentation of this file.
1 /*
2  * AC.h
3  *
4  * Created on: Dec 13, 2016
5  * Author: msahre
6  */
7 
8 #ifndef SRC_APPS_CHEM_AC_H_
9 #define SRC_APPS_CHEM_AC_H_
10 
11 #include <madness/world/MADworld.h>
12 #include <madness/mra/mra.h>
13 #include <madness/mra/funcplot.h>
14 #include <exception>
15 #include <iterator>
16 #include <list>
17 #include<madness/chem/SCF.h>
18 
19 namespace madness {
20 
21 
22 
23 /// Needed information about atom to compute asymptotic correction
24 template<unsigned long int NDIM>
26 
27  /// Coordinates of nucleus
29 
30  /// Interval boundaries, in which exchange correlation potential (<R1) and 1/r potential (>R2) are used
31  double R1;
32  double R2;
33 
34  /// Nuclear charge
35  int charge;
36 
37  /// Computes the distance between electron and nucleus
38  /// @param[in] elec: position of electron
39  /// @param[in] nuc: position of nucleus
40  /// @param[out] distance: distance between electron and nucleus
42  double distance = 0.0;
43  for(unsigned i = 0; i < NDIM; i++){
44  distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
45  }
46  distance = sqrt(distance);
47 
48  return distance;
49  }
50 
51  template <typename Archive>
52  void serialize(Archive& ar) {
53  ar & coord& R1& R2& charge;
54  }
55 
56 };
57 
58 /// Creates vector of atom_information for the given molecule
59 /// @param[in] molecule: the molecule
60 /// @param[out] : the vector containing the atom_information for each atom in the molecule
61 std::vector<atom_information<3> > make_atom_vec(const Molecule& molecule, double R1_,double R2_);
62 
63 /// collection of slater radii needed to calculate R1 and R2; The Journal of Chemical Physics 41, 3199 (1964); doi: 10.1063/1.1725697
64 /// @param[in] atomic_number: atomic_number of atom
65 /// @param[out] : slater radius corresponding to atomic_number
66 double slater_radius(int atomic_number);
67 
68 
69 
70 
71 /// Contains all the parameters for the asymptotic correction
72 template<unsigned long int NDIM>
73 struct ACParameters{
74  std::vector< atom_information<NDIM> > atoms_;
75  bool use_mult_; /// set true to use multipole approximation
76  double e_ion_; /// ionisation energy of corresponding ion without ac
77  double eh_; /// energy of the homo without ac
78  double R1_; /// lower boundary interpolation area
79  double R2_; /// upper boundary for interpolation area
80  double dft_coefficient_; /// dft coefficient for hybrid functionals (=1.0 for non hybrid)
81  int num_elec_; /// number of electrons
82  std::string interpolation_scheme_; /// scheme for interpolation between xc-functional and 1/r-potential
83 
84 
85  template <typename Archive>
86  void serialize(Archive& ar) {
88  }
89 
91  use_mult_ = false;
92  e_ion_ = 0.0;
93  eh_ = 0.0;
94  R1_ = 3.0;
95  R2_ = 4.0;
96  interpolation_scheme_ = "linear";
97  num_elec_=-1;
98  dft_coefficient_=0.0;
99  }
100 
101  bool initialize(Molecule molecule, std::string ac_data, double dft_coeff, double tot_charge){
102  if(ac_data=="none"){
103  return false;
104  }else{
105  dft_coefficient_ = dft_coeff;
106 
107  std::stringstream sac_data(ac_data);
108  std::string word;
109 
110  while (sac_data >> word) {
111  std::transform(word.begin(), word.end(), word.begin(), ::toupper);
112  if(word=="MULT"){
113  use_mult_ = true;
114  } else if(word == "EION") {
115  sac_data >> e_ion_;
116  } else if(word == "EHOMO"){
117  sac_data >> eh_;
118  } else if(word == "R1"){
119  sac_data >> R1_;
120  } else if(word == "R2"){
121  sac_data >> R2_;
122  } else if(word == "INTERPOL"){
123  sac_data >> interpolation_scheme_;
124  } else {
125  std::cout << "Invalid entry in ac line\n";
126  //MADNESS_ASSERT("Invalid ac_data!\n", 1);
127  }
128  }
130  num_elec_ = molecule.total_nuclear_charge() - tot_charge;
131  return true;
132  }
133  }
134 
136  : atoms_(other.atoms_), use_mult_(other.use_mult_), e_ion_(other.e_ion_),
137  eh_(other.eh_), R1_(other.R1_), R2_(other.R2_), dft_coefficient_(other.dft_coefficient_),
139 
140  void print(World& world){
141  if(world.rank()==0){
142  std::cout << "\nAsymptotic correction parameters\n";
143  std::cout << "---------------------------------------\n";
144  std::cout << "Atom vector is not empty: " << !atoms_.empty() << "\n";
145  std::cout << "Using multipole approximation: " << use_mult_ << "\n";
146  std::cout << "Number of electrons = " << num_elec_ << "\n";
147  std::cout << "Ionisation energy = " << e_ion_ << "\n";
148  std::cout << "E(HOMO) = " << eh_ << "\n";
149  std::cout << "R1 = " << R1_ << "\n";
150  std::cout << "R2 = " << R2_ << "\n";
151  std::cout << "DFT coefficient = " << dft_coefficient_ << "\n";
152  std::cout << "Interpolation scheme = " << interpolation_scheme_ << "\n";
153  }
154  }
155 
156  void check(World& world){
157  if(atoms_.empty()) { MADNESS_EXCEPTION("Failed to initialize AC object!",1); }
158  else if(num_elec_ <0) { MADNESS_EXCEPTION("Negative number of electrons!",1); }
159  else if(e_ion_ < 0) { MADNESS_EXCEPTION("Ionisation energy is negative!",1); }
160  else if(eh_>0) { MADNESS_EXCEPTION("Energy of homo is positive!",1); }
161  else if(R1_ == 0.0 or R2_ == 0.0) std::cout << "\n\nWARNING: R1 or R2 is zero!\n\n";
162  else if(interpolation_scheme_ != "linear" and interpolation_scheme_ != "constant") std::cout << "\n\nWARNING: Unknown interpolation scheme, using linear interpolation instead\n\n!";
163  else if(world.rank()==0) std::cout << "AC object was initialized succesfully!\n\n";
164  }
165 
166 };
167 
168 /// Functor for the correction factor, which is multiplied with the exchange correlation potential
169 template<unsigned long int NDIM>
170 class int_factor_functor : public FunctionFunctorInterface<double,NDIM>{
171 
172 public:
174  //int_factor_functor(std::vector<atom_information<NDIM> > atoms, std::string interpolation): atoms(atoms), intpol_scheme(interpolation){}
175 
176  int_factor_functor(const ACParameters<NDIM>& ac_param) : ac_param_(ac_param) {}
177 
178  //int_factor_functor(std::string interpolation) : intpol_scheme(interpolation) {}
179 
180 
181 
182  /// Computes correction factor for exchange correlation potential
183  /// @param[in] r: position of the electron
184  /// @param[out] : correction factor for exchange correlation potential at position r
185  double operator ()(const Vector<double, NDIM> &r)const{
186 
187  // distance between electron and nuclues
188  double d = 0.0;
189 
190  bool inside_R1 = false;
191  std::vector<atom_information<NDIM> > between;
192 
193  // get position of electron relative to nuclei, to compute right correction factor
194  for(const auto& x:ac_param_.atoms_){
195  d = get_distance(r, x.coord);
196  // check if d<R1 for at least one nucleus
197  if(d<x.R1) {
198  inside_R1 = true;
199  break;
200  }
201  // push_back index of nucleus for which electron is inbetween
202  if(x.R1 < d and d < x.R2) {
203  between.push_back(x);
204  }
205  }
206 
207  // compute correction factor
208  // at least for one nucleus r<R1
209  if(inside_R1){
210  return 1.0;}
211  // all nuclei r>R2
212  else if(between.empty()){
213  return 0.0;}
214  // for N nuclei R1<r<R2
215  else {
216  return int_factor(r, between);
217  }
218  }
219 
220  /// Computes correction factor for the exchange correlation potential if electron position is between R1 and R2
221  /// @param[in] r: position of electron
222  /// @param[in] between: vector of the atom_information of all atoms for that electron position is between R1 and R2
223  /// @param[out] int_factor: correction factor
224  double int_factor(const Vector<double, NDIM> &r, std::vector<atom_information<NDIM> > between) const{
225  // Do not forget to add interpolation scheme to ACparameters check()
226  if(ac_param_.interpolation_scheme_=="constant"){
227  return 0.5;
228  }
229  else{
230  double int_factor = 0.0;
231  for(const auto& x:between){
232  // linear interpolation scheme between R1 and R2
233  int_factor += (- get_distance(r,x.coord) + x.R2)/(x.R2-x.R1);
234  //int_factor += 0.5*(erf(-(get_distance(r, x.coord)-5.0))+1.0);
235  }
236  int_factor = int_factor/(double(between.size()));
237  return int_factor;
238  }
239  }
240 
241 private:
242  /// Computes the distance between electron and nucleus
243  /// @param[in] elec: position of electron
244  /// @param[in] nuc: position of nucleus
245  /// @param[out] distance: distance between electron and nucleus
247  double distance = 0.0;
248  for(unsigned i = 0; i < NDIM; i++){
249  distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
250  }
251  distance = sqrt(distance);
252 
253  return distance;
254  }
255 
256  /// Parameter for the asymtotic correction
258 
259 };
260 
261 /// Functor for the 1/r potential to induce the correct asymptotic behaviour of the exchange correlation potential
262 template<unsigned long int NDIM>
263 class lr_pot_functor : public FunctionFunctorInterface<double,NDIM>{
264 
265 public:
267  //lr_pot_functor(std::vector<atom_information<NDIM> > atoms, double dft_coeff_, std::string interpolation): atoms(atoms), dft_coeff(dft_coeff_), intpol_scheme(interpolation){}
268 
269  lr_pot_functor(const ACParameters<NDIM> & ac_param): ac_param_(ac_param){}
270 
271  /// Computes 1/r potential weighted by a correction factor
272  /// @param[in] r: position of the electron (density)
273  /// @param[out]: 1/r potential weighted by a correction factor
274  double operator ()(const Vector<double, NDIM> &r)const{
275  // distance between electron and nuclues
276  double d = 0.0;
277  bool inside_R1 = false;
278  std::vector<atom_information<NDIM> > between;
279 
280  // get position of electron relative to nuclei, to compute right correction factor
281  for(const auto& x:ac_param_.atoms_){
282 
283  d = get_distance(r, x.coord);
284  // check if d<R1 for at least one nucleus
285  if(d<x.R1) {
286  inside_R1 = true;
287  break;
288  }
289 
290  // push_back index of nucleus for which electron is inbetween
291  if(x.R1 < d and d < x.R2) {
292  between.push_back(x);
293  }
294 
295  }
296 
297  // compute correction factor
298  // at least for one nucleus r<R1
299  if(inside_R1){return 0.0;} // return 0.0;
300 
301  // all nuclei r>R2
302  else if(between.empty()){return 1.0*potential(r);} // 1.0*potential(r)+E_ion+E_homo
303 
304  // for N nuclei R1<r<R2
305  else {return (int_factor(r, between))*potential(r);}
306  }
307 
308 private:
309  /// Computes the distance between electron and nucleus
310  /// @param[in] elec: position of electron
311  /// @param[in] nuc: position of nucleus
312  /// @param[out] distance: distance between electron and nucleus
314  double distance = 0.0;
315  for(unsigned i = 0; i < NDIM; i++){
316  distance += (elec[i]-nuc[i])*(elec[i]-nuc[i]);
317  }
318  distance = sqrt(distance);
319 
320  return distance;
321  }
322 
323  /// Multipole approximation of the 1/r potential for electron coordinate > R1 for all nuclei
324  /// @param[in] r: coordinate of the electron
325  /// @param[out] : potential at given coordinate r
326  double potential(const Vector<double, NDIM> &r) const{
327  double pot = 0.0;
328  for(const auto& x:ac_param_.atoms_){
329  pot += double(x.charge)/get_distance(r, x.coord);
330  }
331  return (-ac_param_.dft_coefficient_*pot/ac_param_.num_elec_);
332  }
333 
334  /// Computes correction factor for the 1/r potential if electron position is between R1 and R2
335  /// @param[in] r: position of electron
336  /// @param[in] between: vector of the atom_information of all atoms for that electron position is between R1 and R2
337  /// @param[out] int_factor: correction factor
338  double int_factor(const Vector<double, NDIM> &r, std::vector<atom_information<NDIM> > between) const{
339  int_factor_functor<NDIM> interpolation(ac_param_);
340  double int_factor = interpolation.int_factor(r, between);
341  return (1.0 - int_factor);
342  }
343 
344  /// Parameter for the asymtotic correction
346 };
347 
348 /// computes the corrected exchange correlation potential using the multipole approximation
349 
350 template<unsigned long int NDIM>
352 
353  UnaryOpStructure(const std::shared_ptr<FunctionFunctorInterface<double,NDIM> > f_, const std::shared_ptr<FunctionFunctorInterface<double,NDIM> > f2_) :
354  f(f_), f2(f2_),
355  cdata(FunctionCommonData<double,NDIM>::get(FunctionDefaults<NDIM>::get_k())){};
356 
357  /// computes the corrected potential (weighting with correction factor and adding of 1/r potential)
358  /// @param[in] t: uncorrected exchange correlation potential
359  /// @param[out] t: corrected exchange correlation potential
360  void operator()(const Key<NDIM>& key, Tensor<double>& t) const {
361  Tensor<double> intpol(t.ndim(),t.dims());//madness::copy(t);
362  Tensor<double> lrpot(t.ndim(),t.dims());
363  const Tensor<double>& qp =cdata.quad_x;
364  fcube(key,(*f),qp,intpol);
365  fcube(key,(*f2),qp,lrpot);
366 
367  // multiply xc-functional with interpolation factor
368  t.emul(intpol);
369  // add 1/r correction to xc-functional
370  t= t + lrpot;
371  }
372  /// shared pointer to object of int_factor_functor
373  std::shared_ptr<FunctionFunctorInterface<double,NDIM> > f;
374  /// shared pointer to object of lr_pot_functor
375  std::shared_ptr<FunctionFunctorInterface<double,NDIM> > f2;
377  template <typename Archive> void serialize(Archive& ar) {}
378 };
379 
380 /// computes the corrected exchange correlation potential using the hartree potential
381 
382 template<unsigned long int NDIM>
384  /// necessary to compile the program without getting a strange error i dont understand
385  BinaryOpStructure(): f(NULL), cdata(FunctionCommonData<double,NDIM>::get(FunctionDefaults<NDIM>::get_k())) {}
386 
388  f(f_),
389  cdata(FunctionCommonData<double,NDIM>::get(FunctionDefaults<NDIM>::get_k())){};
390 
391  BinaryOpStructure(const BinaryOpStructure<NDIM> &other) : f(other.f), cdata(other.cdata) {}
392 
393  /// computes the corrected potential (weighting with correction factor and adding of 1/r potential)
394  /// @param[in] t: uncorrected exchange correlation potential
395  /// @param[out] t: corrected exchange correlation potential
396  void operator()(const Key<NDIM>& key, Tensor<double>& result, const Tensor<double>& vxc, const Tensor<double>& vhartree) const {
397 
398  if(f.get()==NULL) MADNESS_EXCEPTION("NULL Pointer in BinaryOpStructure of AC",1);
399 
400  Tensor<double> intpol(result.ndim(),result.dims());//madness::copy(t);
401  Tensor<double> lrpot(result.ndim(),result.dims());
402  const Tensor<double>& qp =cdata.quad_x;
403  fcube(key,(*f),qp,intpol);
404 
405  // exchange correlation potential weighted by correction factor
406  Tensor<double> tmp1 = madness::copy(vxc).emul(intpol);
407  // hartree potential pot weighted by correction factor
408  Tensor<double> tmp2 = madness::copy(vhartree).emul(intpol);
409  Tensor<double> tmp3 = madness::copy(vhartree);
410  // corrected potential
411  result = tmp1 - tmp2 + tmp3;
412  }
413 
414  /// shared pointer to object of int_factor_functor
415  std::shared_ptr<FunctionFunctorInterface<double,NDIM> > f;
417  template <typename Archive> void serialize(Archive& ar) {}
418 };
419 
420 /// Asymptotic correction for DFT. In the correction the xc-potential is replaced by an 1/r term far away from the nuclei
421 /// to give the correct asymptotic behavior. Close to the nuclei the standard xc-potential is used. The transition between
422 /// the different potentials is achieved via a linear interpolation.
423 /// for more information see: Molecular Physics, Vol. 103, No. 2–3, 20 January–10 February 2005, 413–424;
424 /// The Journal of Chemical Physics 109, 10180 (1998); doi: 10.1063/1.477711;
425 /// Molecular Physics, 1999, VOL.97, No. 7, 859-868
426 template<unsigned long int NDIM>
427 class AC{
428 private:
429 
430  /// Parameter for the asymtotic correction
432  bool initialized_=false;
433  double shift()const{return (-ac_param_.e_ion_-ac_param_.eh_);}
434 
435 public:
436  bool initialized()const{return initialized_;}
437  AC() = default;
438 
439  AC(const ACParameters<NDIM>& ac_param): ac_param_(ac_param) {}
440 
441  AC(World &world, std::shared_ptr<SCF> calc){
442  if(world.rank()==0){
443  initialized_=ac_param_.initialize(calc->molecule, calc->param.ac_data(), 1.0-calc->xc.hf_exchange_coefficient(), calc->param.charge());
444  }
447 // ac_param_.print(world);
448  if(calc->param.ac_data()!="none") ac_param_.check(world);
449  }
450 
451  AC(const AC& other): ac_param_(other.ac_param_){}
452 
453  /// /// correction of the exchange correlation potential using the multipole approximation to describe asymptotic behaviour
454  /// @param[in] xc_functional: uncorrected (standard) exchange correlation potential
455  /// @param[out] : corrected exchange correlation potential
458  std::cout << "Apply AC Scheme with multipole approximation\n";
459  // fast return
460  if(ac_param_.atoms_.empty()){
461  std::cout << "OR NOT -- EMPTY VECTOR ATOMS!!!\n";
462  return xc_functional;
463  }
464 
465  if(ac_param_.dft_coefficient_ < 0.0) { MADNESS_EXCEPTION("DFT coefficient is negative!",1); }
466  if(ac_param_.dft_coefficient_ == 0.0) { MADNESS_EXCEPTION("DFT coefficient is zero. This is no DFT calculation!\n",1); }
467 
468  // shift of the exchange correlation potential to get the correct asymptotic behaviour
470  // pointer on interpolation factor and long range potential (1/r pot)
471  std::shared_ptr<FunctionFunctorInterface<double, NDIM> > int_ptr(new int_factor_functor<NDIM>(ac_param_));
472  std::shared_ptr<FunctionFunctorInterface<double, NDIM> > lr_pot_ptr(new lr_pot_functor<NDIM>(ac_param_));
473 
474  // compute interpolation and long range potential
475  UnaryOpStructure<NDIM> U_total(int_ptr,lr_pot_ptr);
476 
477  // apply correction on xc functional
478  xc_functional.template unaryop<UnaryOpStructure<NDIM> >(U_total);
479  //plot_plane( xc_functional, "test_total");
480  return xc_functional;
481  }
482 
483  /// correction of the exchange correlation potential using the hartree potential to describe asymptotic behaviour
484  /// @param[in] xc_functional: uncorrected (standard) exchange correlation potential
485  /// @param[in] v_hartree: potential to describe asymptotic behaviour
486  /// @param[out] : corrected exchange correlation potential
489  if(ac_param_.use_mult_) return apply(xc_functional);
490  //else return apply_potential(xc_functional, v_hartree);
491  std::cout << "Apply AC Scheme with hartree potential\n";
492  // fast return
493  if(ac_param_.atoms_.empty()){
494  std::cout << "OR NOT -- EMPTY VECTOR ATOMS!!!\n";
495  return xc_functional;
496  }
497  // shift of the exchange correlation potential to get the correct asymptotic behaviour
499 
500  // pointer on interpolation factor and long range potential
501  std::shared_ptr<FunctionFunctorInterface<double, NDIM> > int_ptr(new int_factor_functor<NDIM>(ac_param_));
502 
503  // compute interpolation and long range potential
504  BinaryOpStructure<NDIM> U_total(int_ptr);
505  xc_functional = binary_op<double,double,BinaryOpStructure<NDIM>,NDIM >(xc_functional, v_hartree, U_total);
506 
507  return xc_functional;
508  }
509 
510 };
511 
512 }// end namespace
513 
514 #endif /* SRC_APPS_CHEM_AC_H_ */
This header should include pretty much everything needed for the parallel runtime.
Definition: AC.h:427
ACParameters< NDIM > ac_param_
Parameter for the asymtotic correction.
Definition: AC.h:431
AC()=default
Function< double, NDIM > apply(Function< double, NDIM > xc_functional) const
Definition: AC.h:456
double shift() const
Definition: AC.h:433
bool initialized_
Definition: AC.h:432
bool initialized() const
Definition: AC.h:436
AC(const ACParameters< NDIM > &ac_param)
Definition: AC.h:439
Function< double, NDIM > apply(Function< double, NDIM > xc_functional, const Function< double, NDIM > v_hartree) const
Definition: AC.h:487
AC(const AC &other)
Definition: AC.h:451
AC(World &world, std::shared_ptr< SCF > calc)
Definition: AC.h:441
const long * dims() const
Returns the array of tensor dimensions.
Definition: basetensor.h:153
long ndim() const
Returns the number of dimensions in the tensor.
Definition: basetensor.h:144
FunctionCommonData holds all Function data common for given k.
Definition: function_common_data.h:52
Tensor< double > quad_x
quadrature points
Definition: function_common_data.h:99
FunctionDefaults holds default paramaters as static class members.
Definition: funcdefaults.h:204
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:68
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:66
Definition: molecule.h:124
Tensor< T > & emul(const Tensor< T > &t)
Inplace multiply by corresponding elements of argument Tensor.
Definition: tensor.h:1798
void broadcast_serializable(objT &obj, ProcessID root)
Broadcast a serializable object.
Definition: worldgop.h:754
A parallel world class.
Definition: world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition: world.h:318
WorldGopInterface & gop
Global operations.
Definition: world.h:205
Functor for the correction factor, which is multiplied with the exchange correlation potential.
Definition: AC.h:170
int_factor_functor()
Definition: AC.h:173
double operator()(const Vector< double, NDIM > &r) const
Definition: AC.h:185
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition: AC.h:224
int_factor_functor(const ACParameters< NDIM > &ac_param)
Definition: AC.h:176
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition: AC.h:246
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition: AC.h:257
Functor for the 1/r potential to induce the correct asymptotic behaviour of the exchange correlation ...
Definition: AC.h:263
double operator()(const Vector< double, NDIM > &r) const
Definition: AC.h:274
lr_pot_functor()
Definition: AC.h:266
lr_pot_functor(const ACParameters< NDIM > &ac_param)
Definition: AC.h:269
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition: AC.h:313
const ACParameters< NDIM > & ac_param_
Parameter for the asymtotic correction.
Definition: AC.h:345
double int_factor(const Vector< double, NDIM > &r, std::vector< atom_information< NDIM > > between) const
Definition: AC.h:338
double potential(const Vector< double, NDIM > &r) const
Definition: AC.h:326
std::vector< Fcwf > transform(World &world, std::vector< Fcwf > &a, Tensor< std::complex< double >> U)
Definition: fcwf.cc:477
Defines/implements plotting interface for functions.
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition: madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition: madness_exception.h:134
Main include file for MADNESS and defines Function interface.
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
double slater_radius(int atomic_number)
Definition: AC.cc:11
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition: mra.h:2002
double distance(double a, double b)
Default function for computing the distance between two doubles.
Definition: spectralprop.h:95
Tensor< T > fcube(const Key< NDIM > &, T(*f)(const Vector< double, NDIM > &), const Tensor< double > &)
Definition: mraimpl.h:2163
std::vector< atom_information< 3 > > make_atom_vec(const Molecule &molecule, double R1_, double R2_)
Definition: AC.cc:38
Contains all the parameters for the asymptotic correction.
Definition: AC.h:73
std::vector< atom_information< NDIM > > atoms_
Definition: AC.h:74
double dft_coefficient_
upper boundary for interpolation area
Definition: AC.h:80
int num_elec_
dft coefficient for hybrid functionals (=1.0 for non hybrid)
Definition: AC.h:81
double R1_
energy of the homo without ac
Definition: AC.h:78
double e_ion_
set true to use multipole approximation
Definition: AC.h:76
double eh_
ionisation energy of corresponding ion without ac
Definition: AC.h:77
ACParameters(const ACParameters &other)
Definition: AC.h:135
ACParameters()
Definition: AC.h:90
double R2_
lower boundary interpolation area
Definition: AC.h:79
std::string interpolation_scheme_
number of electrons
Definition: AC.h:82
void check(World &world)
Definition: AC.h:156
void print(World &world)
Definition: AC.h:140
void serialize(Archive &ar)
scheme for interpolation between xc-functional and 1/r-potential
Definition: AC.h:86
bool use_mult_
Definition: AC.h:75
bool initialize(Molecule molecule, std::string ac_data, double dft_coeff, double tot_charge)
Definition: AC.h:101
computes the corrected exchange correlation potential using the hartree potential
Definition: AC.h:383
void operator()(const Key< NDIM > &key, Tensor< double > &result, const Tensor< double > &vxc, const Tensor< double > &vhartree) const
Definition: AC.h:396
FunctionCommonData< double, NDIM > cdata
Definition: AC.h:416
BinaryOpStructure()
necessary to compile the program without getting a strange error i dont understand
Definition: AC.h:385
void serialize(Archive &ar)
Definition: AC.h:417
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition: AC.h:415
BinaryOpStructure(const BinaryOpStructure< NDIM > &other)
Definition: AC.h:391
BinaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_)
Definition: AC.h:387
computes the corrected exchange correlation potential using the multipole approximation
Definition: AC.h:351
FunctionCommonData< double, NDIM > cdata
Definition: AC.h:376
void serialize(Archive &ar)
Definition: AC.h:377
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2
shared pointer to object of lr_pot_functor
Definition: AC.h:375
void operator()(const Key< NDIM > &key, Tensor< double > &t) const
Definition: AC.h:360
std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f
shared pointer to object of int_factor_functor
Definition: AC.h:373
UnaryOpStructure(const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f_, const std::shared_ptr< FunctionFunctorInterface< double, NDIM > > f2_)
Definition: AC.h:353
Needed information about atom to compute asymptotic correction.
Definition: AC.h:25
int charge
Nuclear charge.
Definition: AC.h:35
Vector< double, NDIM > coord
Coordinates of nucleus.
Definition: AC.h:28
double get_distance(Vector< double, NDIM > elec, Vector< double, NDIM > nuc) const
Definition: AC.h:41
void serialize(Archive &ar)
Definition: AC.h:52
double R1
Interval boundaries, in which exchange correlation potential (<R1) and 1/r potential (>R2) are used.
Definition: AC.h:31
double R2
Definition: AC.h:32
Class to compute the energy functional.
Definition: xcfunctional.h:360
void d()
Definition: test_sig.cc:79
static const std::size_t NDIM
Definition: testpdiff.cc:42
static Molecule molecule
Definition: testperiodicdft.cc:38