MADNESS  version 0.9
mp2.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  $Id$
32 */
46 #ifndef MP2_H_
47 #define MP2_H_
48 
49 //#define WORLD_INSTANTIATE_STATIC_TEMPLATES
50 #include <madness/mra/mra.h>
51 #include <madness/mra/lbdeux.h>
52 #include <chem/SCF.h>
53 #include <examples/nonlinsol.h>
54 #include <chem/projector.h>
55 #include <chem/correlationfactor.h>
56 #include <chem/nemo.h>
57 
58 #include <iostream>
59 
60 
61 using namespace madness;
62 
63 namespace madness {
64 
65 
66  struct LBCost {
67  double leaf_value;
68  double parent_value;
69  LBCost(double leaf_value=1.0, double parent_value=1.0)
70  : leaf_value(leaf_value)
71  , parent_value(parent_value)
72  {}
73 
74  double operator()(const Key<6>& key, const FunctionNode<double,6>& node) const {
75  return node.coeff().rank();
76 // if (node.is_leaf()) {
77 // return leaf_value;
78 // } else {
79 // return parent_value;
80 // }
81  }
82  };
83 
84 
85  class HartreeFock {
86  World& world;
88  mutable double coords_sum; // sum of square of coords at last solved geometry
89 
90  // save the Coulomb potential
91  mutable real_function_3d coulomb;
92 
94  std::vector<real_function_3d> orbitals_;
95 
98  std::vector<real_function_3d> R2orbitals_;
99 
100  public:
101 
103 
105  world(world), calc(calc1), coords_sum(-1.0), nemo_calc(world,calc1) {
106  }
107 
108  bool provides_gradient() const {return true;}
109 
110  double value() {
111  return value(calc->molecule.get_all_coords());
112  }
113 
114  double value(const Tensor<double>& x) {
115 
116  // fast return if the reference is already solved at this geometry
117  double xsq = x.sumsq();
118  if (xsq == coords_sum) return calc->current_energy;
119 
120  calc->molecule.set_all_coords(x.reshape(calc->molecule.natom(),3));
121  coords_sum = xsq;
122 
123  // some extra steps if we have a nuclear correlation factor
124  if (1) {
125 // if (nemo_calc.nuclear_correlation->type()==NuclearCorrelationFactor::GaussSlater) {
126  // converge the nemo equations
127  nemo_calc.value(x);
128 
129  } else {
130  // Make the nuclear potential, initial orbitals, etc.
131  calc->make_nuclear_potential(world);
132  calc->potentialmanager->vnuclear().print_size("vnuc");
133  calc->project_ao_basis(world);
134 
135  // read converged wave function from disk if there is one
136  if (calc->param.no_compute) {
137  calc->load_mos(world);
138  return calc->current_energy;
139  }
140 
141  if (calc->param.restart) {
142  calc->load_mos(world);
143  } else {
144  calc->initial_guess(world);
145  calc->param.restart = true;
146  }
147 
148  // If the basis for the inital guess was not sto-3g
149  // switch to sto-3g since this is needed for analysis
150  // of the MOs and orbital localization
151  if (calc->param.aobasis != "sto-3g") {
152  calc->param.aobasis = "sto-3g";
153  calc->project_ao_basis(world);
154  }
155 
156 
157  calc->solve(world);
158  calc->save_mos(world);
159 
160  // successively tighten threshold
161  if (calc->param.econv<1.1e-6) {
162  calc->set_protocol<3>(world,1e-6);
163  calc->make_nuclear_potential(world);
164  calc->project_ao_basis(world);
165  calc->project(world);
166  calc->solve(world);
167  calc->save_mos(world);
168  }
169 
170  calc->save_mos(world);
171  }
172 
173  // compute the full, reconstructed orbitals from nemo
174  orbitals_=mul(world,nemo_calc.R,nemo_calc.get_calc()->amo);
175  real_function_3d R2=nemo_calc.nuclear_correlation->square();
176  R2orbitals_=mul(world,R2,nemo_calc.get_calc()->amo);
177 
178  return calc->current_energy;
179  }
180 
181  Tensor<double> gradient(const Tensor<double>& x) {
182 
183  value(x); // Ensures DFT equations are solved at this geometry
184  return calc->derivatives(world);
185  }
186 
187  double coord_chksum() const {return coords_sum;}
188 
189  const SCF& get_calc() const {return *calc;}
190  SCF& get_calc() {return *calc;}
191 
193 
196  real_function_3d orbital(const int i) const {
197  MADNESS_ASSERT(calc->param.spin_restricted);
198  return orbitals_[i];
199  }
200 
202 
205  std::vector<real_function_3d> orbitals() const {
206  MADNESS_ASSERT(calc->param.spin_restricted);
207  return orbitals_;
208  }
209 
211 
214  std::vector<real_function_3d> R2orbitals() const {
215  MADNESS_ASSERT(calc->param.spin_restricted);
216  return R2orbitals_;
217  }
218 
220 
223  real_function_3d R2orbital(const int i) const {
224  MADNESS_ASSERT(calc->param.spin_restricted);
225  return R2orbitals_[i];
226  }
227 
229 
232  real_function_3d nemo(const int i) const {
233  MADNESS_ASSERT(calc->param.spin_restricted);
234  return calc->amo[i];
235  }
236 
238 
241  std::vector<real_function_3d> nemos() const {
242  MADNESS_ASSERT(calc->param.spin_restricted);
243  return calc->amo;
244  }
245 
247  double orbital_energy(const int i) const {
248  MADNESS_ASSERT(calc->param.spin_restricted);
249  return calc->aeps[i];
250  }
251 
254  MADNESS_ASSERT(calc->param.spin_restricted);
255  if (coulomb.is_initialized()) return copy(coulomb);
256  functionT rho = calc->make_density(world, calc->aocc, orbitals()).scale(2.0);
257  coulomb=calc->make_coulomb_potential(rho);
258  return copy(coulomb);
259  }
260 
263  return calc->potentialmanager->vnuclear();
264  }
265 
267  int nocc() const {
268  MADNESS_ASSERT(calc->param.spin_restricted);
269  return calc->param.nalpha;
270  }
271  };
272 
273 
276 
277  public:
280  : i(-1), j(-1), e_singlet(uninitialized()), e_triplet(uninitialized()),
282  }
283 
285  ElectronPair(const int i, const int j)
286  : i(i), j(j), e_singlet(uninitialized()), e_triplet(uninitialized()),
288  }
289 
291  void print_energy() const {
292  if (function.world().rank()==0) {
293  printf("final correlation energy %2d %2d %12.8f %12.8f\n",
295  }
296  }
297 
298  static double uninitialized() {return 1.e10;}
299 
300  int i, j;
301  real_function_6d function;
304 
307  std::vector<real_function_3d> phi_k_UK_phi0;
308  std::vector<real_function_3d> phi_l_UK_phi0;
309 
310  double e_singlet;
311  double e_triplet;
312 
313  double ij_gQf_ij;
314  double ji_gQf_ij;
315 
316  int iteration;
317  bool converged;
318 
320 
324  template <typename Archive> void serialize (Archive& ar) {
325  bool fexist=function.is_initialized();
326  bool cexist=constant_term.is_initialized();
327  ar & ij_gQf_ij & ji_gQf_ij & e_singlet & e_triplet & converged
328  & iteration & fexist & cexist;
329  if (fexist) ar & function;
330  if (cexist) ar & constant_term;
331  }
332 
333  bool load_pair(World& world) {
334  std::string name="pair_"+stringify(i)+stringify(j);
335  bool exists=archive::ParallelInputArchive::exists(world,name.c_str());
336  if (exists) {
337  if (world.rank()==0) printf("loading matrix elements %s",name.c_str());
338  archive::ParallelInputArchive ar(world, name.c_str(), 1);
339  ar & *this;
340  if (world.rank()==0) printf(" %s\n",(converged)?" converged":" not converged");
341  } else {
342  if (world.rank()==0) print("could not find pair ",i,j," on disk");
343  }
344  return exists;
345  }
346 
347  void store_pair(World& world) {
348  std::string name="pair_"+stringify(i)+stringify(j);
349  if (world.rank()==0) printf("storing matrix elements %s\n",name.c_str());
350  archive::ParallelOutputArchive ar(world, name.c_str(), 1);
351  ar & *this;
352  }
353  };
354 
355 
358 
360  struct Parameters {
361  double thresh_;
362  double dconv_;
363  int i;
364  int j;
365 
371  int freeze;
372 
374 
379  bool restart;
380 
382  int maxsub;
383 
385  int maxiter;
386 
388  Parameters(const std::string& input) : thresh_(-1.0), dconv_(-1.0),
389  i(-1), j(-1), freeze(0), restart(false), maxsub(2), maxiter(20) {
390 
391  // get the parameters from the input file
392  std::ifstream f(input.c_str());
393  position_stream(f, "mp2");
394  std::string s;
395 
396  while (f >> s) {
397  if (s == "end") break;
398  else if (s == "econv") f >> thresh_;
399  else if (s == "dconv") f >> dconv_;
400  else if (s == "pair") f >> i >> j;
401  else if (s == "maxsub") f >> maxsub;
402  else if (s == "freeze") f >> freeze;
403  else if (s == "restart") restart=true;
404  else continue;
405  }
406  // set default for dconv if not explicitly given
407  if (dconv_<0.0) dconv_=sqrt(thresh_)*0.1;
408  }
409 
411  void check_input(const std::shared_ptr<HartreeFock> hf) const {
412  if (freeze>hf->nocc()) MADNESS_EXCEPTION("you froze more orbitals than you have",1);
413  if (i>=hf->nocc()) MADNESS_EXCEPTION("there is no i-th orbital",1);
414  if (j>=hf->nocc()) MADNESS_EXCEPTION("there is no j-th orbital",1);
415  if (thresh_<0.0) MADNESS_EXCEPTION("please provide the accuracy threshold for MP2",1);
416  }
417  };
418 
419 
420  World& world;
421  Parameters param;
423  CorrelationFactor corrfac;
425 
426  std::map<std::pair<int,int>,ElectronPair> pairs;
427  double correlation_energy;
428  double coords_sum;
429  bool do_coupling;
430 
432 
433  private:
434  struct Intermediates {
435  std::string function;
436  std::string r12phi;
437  std::string Kfphi0;
438  std::string Uphi0;
439  std::string KffKphi0;
440  std::string OUKphi0;
441 
442  Intermediates() : r12phi(), Kfphi0(), Uphi0(), KffKphi0() {};
443 
444  Intermediates(World& world, const std::string& filename) : function(), r12phi(),
445  Kfphi0(), Uphi0(), KffKphi0() {
446  std::ifstream f(filename.c_str());
447  position_stream(f, "mp2");
448  std::string s;
449 
450  while (f >> s) {
451  if (s == "end") break;
452  else if (s == "function") f >> function;
453  else if (s == "r12phi") f >> r12phi;
454  else if (s == "Kfphi0") f >> Kfphi0;
455  else if (s == "Uphi0") f >> Uphi0;
456  else if (s == "KffKphi0") f >> KffKphi0;
457  else {continue;
458  }
459  if (world.rank()==0) print("found intermediate in control file: ",s);
460  }
461  }
462 
463  template <typename Archive> void serialize (Archive& ar) {
464  ar & function & r12phi & Kfphi0 & Uphi0 & KffKphi0;
465  }
466 
467  };
468 
469 
470  Intermediates intermediates;
472 
473  public:
474 
476  MP2(World& world, const std::string& input);
477 
479 
483  ElectronPair& pair(const int i, const int j) {
484  // since we return a reference the keyval must already exist in the map
485  MADNESS_ASSERT(pairs.find(std::make_pair(i, j)) != pairs.end());
486  return pairs[std::make_pair(i, j)];
487  }
488 
490 
494  const ElectronPair& pair(const int i, const int j) const {
495  // since we return a reference the keyval must already exist in the map
496  MADNESS_ASSERT(pairs.find(std::make_pair(i, j)) != pairs.end());
497  return pairs.find(std::make_pair(i, j))->second;
498  }
499 
501  double coord_chksum() const {return coords_sum;}
502 
504  double value();
505 
507  double value(const Tensor<double>& x);
508 
510  void print_info(World& world) const;
511 
513  HartreeFock& get_hf() {return *hf;}
514 
516  double thresh() const {return param.thresh_;}
517 
519  double zeroth_order_energy(const int i, const int j) const {
520  return hf->orbital_energy(i)+hf->orbital_energy(j);
521  }
522 
525 
527 
529 
535 
537 
541 
542  double asymmetry(const real_function_6d& f, const std::string s) const;
543 
544  void test(const std::string filename);
545 
547 
552  double compute_gQf(const int i, const int j, ElectronPair& pair) const;
553 
554  private:
555 
557  template<typename T, size_t NDIM>
558  void save_function(const Function<T,NDIM>& f, const std::string name) const;
559 
561  template<typename T, size_t NDIM>
562  void load_function(Function<T,NDIM>& f, const std::string name) const;
563 
565  real_function_6d make_Uphi0(ElectronPair& pair) const;
566 
568  real_function_6d make_KffKphi0(const ElectronPair& pair) const;
569 
571  ElectronPair make_pair(const int i, const int j) const;
572 
574  void guess_mp1_3(ElectronPair& pair) const;
575 
577 
579  double compute_energy(ElectronPair& pair) const;
580 
582 
586  real_function_3d K(const real_function_3d& phi, const bool hc=false) const;
587 
589 
593  real_function_6d K(const real_function_6d& phi, const bool is_symmetric=false) const;
594 
596 
599  real_function_3d J(const real_function_3d& phi) const;
600 
602 
610  real_function_6d apply_exchange(const real_function_6d& f,
611  const real_function_3d& orbital_ket,
612  const real_function_3d& orbital_bra, const int particle) const;
613 
615 
624  std::vector<real_function_3d> make_chi(const real_function_3d& phi,
625  const real_convolution_3d& op,
626  const bool hc=false) const;
627 
629 
638  std::vector<real_function_3d> make_xi(const real_function_3d& phi_i,
639  const real_function_3d& phi_j, const real_convolution_3d& op,
640  const bool hc=false) const;
641 
643  void OUKphi0(ElectronPair& pair) const;
644 
646 
650  real_function_6d make_fKphi0(const int i, const int j) const;
651 
653 
655  real_function_6d JK1phi0_on_demand(const int i, const int j,
656  const bool hc=false) const;
657 
659  real_function_6d JK2phi0_on_demand(const int i, const int j,
660  const bool hc=false) const;
661 
663  real_function_6d phi0_on_demand(const int i, const int j) const;
664 
666  real_function_6d nemo0_on_demand(const int i, const int j) const;
667 
668 
670 
673  real_function_6d multiply_with_0th_order_Hamiltonian(const real_function_6d& f,
674  const int i, const int j) const;
675 
677 
680  real_function_6d add_local_coupling(const int i, const int j) const;
681 
682  };
683 };
684 
685 #endif /* MP2_H_ */
686 
Nemo nemo_calc
Definition: mp2.h:102
double value()
return the molecular correlation energy energy (without the HF energy)
Definition: apps/chem/mp2.cc:151
double thresh() const
return the accuracy
Definition: mp2.h:516
real_function_6d constant_term
the first order contribution to the MP1 wave function
Definition: mp2.h:303
std::shared_ptr< PotentialManager > potentialmanager
Definition: chem/SCF.h:714
enhanced POD for the pair functions
Definition: mp2.h:275
Molecule molecule
Definition: chem/SCF.h:716
bool is_initialized() const
Returns true if the function is initialized.
Definition: mra.h:146
Definition: shared_ptr_bits.h:38
bool provides_gradient() const
Definition: mp2.h:108
The Nemo class.
Definition: nemo.h:138
double asymmetry(const real_function_6d &f, const std::string s) const
Definition: apps/chem/mp2.cc:425
real_function_3d R
the nuclear correlation factor
Definition: nemo.h:187
Main include file for MADNESS and defines Function interface.
std::vector< real_function_3d > orbitals() const
return full orbitals, multiplied with the nuclear correlation factor
Definition: mp2.h:205
real_function_3d R2orbital(const int i) const
return orbital i, multiplied with the square nuclear correlation factor
Definition: mp2.h:223
real_function_6d swap_particles(const real_function_6d &f) const
swap particles 1 and 2
Definition: apps/chem/mp2.cc:412
An archive for storing local or parallel data wrapping BinaryFstreamOutputArchive.
Definition: parar.h:241
double econv
Energy convergence.
Definition: chem/SCF.h:271
void print_energy() const
print the pair's energy
Definition: mp2.h:291
real_function_6d r12phi
orbital product multiplied with the correlation factor
Definition: mp2.h:302
SCF & get_calc()
Definition: mp2.h:190
void increment(ElectronPair &pair, real_convolution_6d &green)
compute increments: psi^1 = C + GV C + GVGV C + GVGVGV C + ..
Definition: apps/chem/mp2.cc:371
std::istream & position_stream(std::istream &f, const std::string &tag)
Definition: position_stream.cc:37
const ElectronPair & pair(const int i, const int j) const
return a reference to the electron pair for electrons i and j
Definition: mp2.h:494
double operator()(const Key< 6 > &key, const FunctionNode< double, 6 > &node) const
Definition: mp2.h:74
HartreeFock & get_hf()
return the underlying HF reference
Definition: mp2.h:513
coeffT & coeff()
Returns a non-const reference to the tensor containing the coeffs.
Definition: funcimpl.h:216
tensorT aeps
orbital energies for alpha and beta orbitals
Definition: chem/SCF.h:745
ElectronPair & pair(const int i, const int j)
return a reference to the electron pair for electrons i and j
Definition: mp2.h:483
void print_info(World &world) const
print the SCF parameters
Definition: apps/chem/mp2.cc:235
::std::string string
Definition: gtest-port.h:872
functionT make_coulomb_potential(const functionT &rho) const
make the Coulomb potential given the total density
Definition: chem/SCF.h:909
bool load_pair(World &world)
Definition: mp2.h:333
Convolutions in separated form (including Gaussian)
Definition: operator.h:117
real_function_6d Uphi0
the function U |phi^0> (U being Kutzelnigg's potential)
Definition: mp2.h:305
real_function_6d make_Rpsi(const ElectronPair &pair) const
Definition: apps/chem/mp2.cc:354
double coord_chksum() const
return a checksum for the geometry
Definition: mp2.h:501
void load_mos(World &world)
Definition: chem/SCF.cc:277
real_function_3d nemo(const int i) const
return nemo i, which is the regularized orbital
Definition: mp2.h:232
Definition: chem/SCF.h:712
Objects that implement their own parallel archive interface should derive from this.
Definition: parar.h:52
std::shared_ptr< SCF > get_calc() const
Definition: nemo.h:169
void test(const std::string filename)
Definition: apps/chem/mp2.cc:435
NDIM & f
Definition: mra.h:2179
void initial_guess(World &world)
Definition: chem/SCF.cc:788
std::shared_ptr< NuclearCorrelationFactor > nuclear_correlation
the nuclear correlation factor
Definition: nemo.h:184
MP2(World &world, const std::string &input)
ctor
Definition: apps/chem/mp2.cc:78
double e_singlet
the energy of the singlet pair ij
Definition: mp2.h:310
Function< T, NDIM > & scale(const Q q, bool fence=true)
Inplace, scale the function by a constant. No communication except for optional fence.
Definition: mra.h:896
void solve(World &world)
Definition: chem/SCF.cc:2072
void set_all_coords(const madness::Tensor< double > &newcoords)
Definition: chem/molecule.cc:199
vecfuncT amo
alpha and beta molecular orbitals
Definition: chem/SCF.h:729
a class for computing the first order wave function and MP2 pair energies
Definition: mp2.h:357
int natom() const
Definition: chem/molecule.h:148
double ij_gQf_ij
Definition: mp2.h:313
LBCost(double leaf_value=1.0, double parent_value=1.0)
Definition: mp2.h:69
double zeroth_order_energy(const int i, const int j) const
return the 0th order energy of pair ij (= sum of orbital energies)
Definition: mp2.h:519
madness::Tensor< double > get_all_coords() const
Definition: chem/molecule.cc:177
bool no_compute
If true use orbitals on disk, set value to computed.
Definition: chem/SCF.h:288
int i
Definition: mp2.h:300
CalculationParameters param
Definition: chem/SCF.h:717
The interface to be provided by functions to be optimized.
Definition: solvers.h:176
std::vector< real_function_3d > R2orbitals() const
return orbitals, multiplied with the square nuclear correlation factor
Definition: mp2.h:214
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:1835
int j
orbitals i and j
Definition: mp2.h:300
static double uninitialized()
Definition: mp2.h:298
Example implementation of Krylov-subspace nonlinear equation solver.
void make_nuclear_potential(World &world)
Definition: chem/SCF.cc:448
real_function_3d orbital(const int i) const
return full orbital i, multiplied with the nuclear correlation factor
Definition: mp2.h:196
HartreeFock(World &world, std::shared_ptr< SCF > calc1)
Definition: mp2.h:104
tensorT aocc
occupation numbers for alpha and beta orbitals
Definition: chem/SCF.h:742
ElectronPair(const int i, const int j)
ctor; initialize energies with a large number
Definition: mp2.h:285
void save_mos(World &world)
Definition: chem/SCF.cc:260
double ji_gQf_ij
Definition: mp2.h:314
double parent_value
Definition: mp2.h:68
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
real_function_3d get_nuclear_potential() const
return the nuclear potential
Definition: mp2.h:262
std::vector< real_function_3d > nemos() const
return nemo, which are the regularized orbitals
Definition: mp2.h:241
enable_if_c< is_serializable< T >::value &&is_output_archive< Archive >::value >::type serialize(const Archive &ar, const T *t, unsigned int n)
Definition: archive.h:615
const int maxiter
Definition: gygi_soltion.cc:69
bool converged
is the pair function converged
Definition: mp2.h:317
double value(const Tensor< double > &x)
Definition: mp2.h:114
ElectronPair()
default ctor; initialize energies with a large number
Definition: mp2.h:279
FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree.
Definition: derivative.h:58
ProcessID rank() const
Returns the process rank in this world (same as MPI_Comm_rank()))
Definition: worldfwd.h:526
int nocc() const
return the number of occupied orbitals
Definition: mp2.h:267
Definition: mp2.h:85
std::vector< real_function_3d > phi_l_UK_phi0
< l(2) | U-K | phi^0(1,2)>
Definition: mp2.h:308
bool restart
If true restart from orbitals on disk.
Definition: chem/SCF.h:287
real_function_6d KffKphi0
the function [K,f12] |phi^0>
Definition: mp2.h:306
double orbital_energy(const int i) const
return orbital energy i
Definition: mp2.h:247
std::string aobasis
AO basis used for initial guess (6-31g or sto-3g)
Definition: chem/SCF.h:295
void store_pair(World &world)
Definition: mp2.h:347
Implements (2nd generation) static load/data balancing for functions.
void solve_residual_equations(ElectronPair &pair) const
solve the residual equation for electron pair (i,j)
Definition: apps/chem/mp2.cc:271
Tensor< double > gradient(const Tensor< double > &x)
Definition: mp2.h:181
double coord_chksum() const
Definition: mp2.h:187
void project(World &world)
Definition: chem/SCF.cc:427
double value()
Definition: nemo.h:161
functionT make_density(World &world, const tensorT &occ, const vecfuncT &v) const
Definition: chem/SCF.cc:999
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
const SCF & get_calc() const
Definition: mp2.h:189
void print(const A &a)
Print a single item to std::cout terminating with new line.
Definition: print.h:122
tensorT derivatives(World &world)
Definition: chem/SCF.cc:1255
void serialize(Archive &ar)
serialize this ElectronPair
Definition: mp2.h:324
double value()
Definition: mp2.h:110
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
void project_ao_basis(World &world)
Definition: chem/SCF.cc:459
real_function_3d get_coulomb_potential() const
return the Coulomb potential
Definition: mp2.h:253
double leaf_value
Definition: mp2.h:67
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
std::vector< real_function_3d > phi_k_UK_phi0
< k(1) | U-K | phi^0(1,2)>
Definition: mp2.h:307
void set_protocol(World &world, double thresh)
Definition: chem/SCF.h:757
double e_triplet
the energy of the triplet pair ij
Definition: mp2.h:311
const double R2
Definition: vnucso.cc:89
int nalpha
Number of alpha spin electrons.
Definition: chem/SCF.h:301
An archive for storing local or parallel data wrapping BinaryFstreamInputArchive. ...
Definition: parar.h:266
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:69
static bool exists(World &world, const char *filename)
Returns true if the named, unopened archive exists on disk with read access ... collective.
Definition: parar.h:165
Definition: mp2.h:66
int iteration
current iteration for restart
Definition: mp2.h:316
Function< TENSOR_RESULT_TYPE(Q, T), NDIM > mul(const Q alpha, const Function< T, NDIM > &f, bool fence=true)
Returns new function equal to alpha*f(x) with optional fence.
Definition: mra.h:1528
double compute_gQf(const int i, const int j, ElectronPair &pair) const
compute the matrix element
Definition: apps/chem/mp2.cc:476
long rank() const
Definition: gentensor.h:189
double current_energy
Definition: chem/SCF.h:749
bool spin_restricted
True if spin restricted.
Definition: chem/SCF.h:281