MADNESS 0.10.1
SCFOperators.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/// \file SCFOperators.h
33/// \brief Operators for the molecular HF and DFT code
34/// \defgroup chem The molecular density functional and Hartree-Fock code
35
36
37#ifndef MADNESS_CHEM_SCFOPERATORS_H_
38#define MADNESS_CHEM_SCFOPERATORS_H_
39
40#include <madness.h>
41#include <madness/mra/macrotaskq.h> // otherwise issues with install
42
43namespace madness {
44
45// forward declaration
46class SCF;
47class Nemo;
48class NemoBase;
49class OEP;
50class NuclearCorrelationFactor;
51class XCfunctional;
52class MacroTaskQ;
53class Molecule;
54
55typedef std::vector<real_function_3d> vecfuncT;
56
57template<typename T, std::size_t NDIM>
59
60public:
62 typedef std::vector<functionT> vecfuncT;
64 mutable nlohmann::json statistics;
65
66 SCFOperatorBase() = default;
67 SCFOperatorBase(std::shared_ptr<MacroTaskQ> taskq) : taskq(taskq) {}
68
69 virtual ~SCFOperatorBase() {}
70
71 std::shared_ptr<MacroTaskQ> taskq=0;
72
73 /// print some information about this operator
74 virtual std::string info() const = 0;
75
76 /// apply this operator on the argument function
77 ///
78 /// \param ket the argument function
79 /// \return op(ket)
80 virtual functionT operator()(const functionT& ket) const = 0;
81
82 /// apply this operator on the argument vector of functions
83
84 /// \param vket argument vector
85 /// \return op(vket)
86 virtual vecfuncT operator()(const vecfuncT& vket) const = 0;
87
88 /// compute the matrix element <bra | op | ket>
89
90 /// \param bra bra state
91 /// \param ket ket state
92 /// \return the matrix element <bra | op | ket>
93 virtual T operator()(const functionT& bra, const functionT& ket) const = 0;
94
95 /// compute the matrix <vbra | op | vket>
96
97 /// \param vbra vector of bra states
98 /// \param vket vector of ket states
99 /// \return the matrix <vbra | op | vket>
100 virtual tensorT operator()(const vecfuncT& vbra, const vecfuncT& vket) const = 0;
101
102};
103
104template<typename T, std::size_t NDIM>
105class Exchange : public SCFOperatorBase<T,NDIM> {
106public:
107
108 class ExchangeImpl;
109 using implT = std::shared_ptr<ExchangeImpl>;
111 typedef std::vector<functionT> vecfuncT;
113private:
115
116public:
120 // print out algorithm
121 friend std::ostream& operator<<(std::ostream& os, const ExchangeAlgorithm& alg) {
122 switch (alg) {
123 case small_memory:
124 os << "smallmem";
125 break;
126 case large_memory:
127 os << "largemem";
128 break;
130 os << "multiworld";
131 break;
133 os << "multiworld_row";
134 break;
135 case fetch_compute:
136 os << "fetch_compute";
137 break;
138 default:
139 os << "unknown algorithm";
140 }
141 return os;
142 }
143
144 static std::string to_string(const ExchangeAlgorithm alg) {
145 std::stringstream ss;
146 ss << alg;
147 return ss.str();
148 }
149
150 static ExchangeAlgorithm string2algorithm(const std::string& alg_string) {
153 if (alg_lc=="smallmem") alg=small_memory;
154 else if (alg_lc=="largemem") alg=large_memory;
155 else if (alg_lc=="multiworld") alg=multiworld_efficient;
156 else if (alg_lc=="multiworld_row") alg=multiworld_efficient_row;
157 else if (alg_lc=="fetch_compute") alg=fetch_compute;
158 else {
159 std::string msg="unknown Exchange algorithm: "+alg_string;
160 MADNESS_EXCEPTION(msg.c_str(),1);
161 }
162 return alg;
163 }
164
165 Exchange(World& world, const double lo, const double thresh=FunctionDefaults<NDIM>::get_thresh());
166
167 /// ctor with a conventional calculation
168 Exchange(World& world, const SCF *calc, const int ispin);
169
170 /// ctor with a nemo calculation
171 Exchange(World& world, const Nemo *nemo, const int ispin);
172
173 std::string info() const {return "K";}
174
175 bool is_symmetric() const;
176
177 Exchange& set_symmetric(const bool flag);
178
180
181 /// how the cloud will handle the data
183 Exchange& set_macro_task_info(const std::vector<std::string>& info) {
185 return *this;
186 }
187
188
189 Exchange& set_printlevel(const long& level);
190
191 /// batches per rank in the owner-pinned symmetric partition (>= 1)
192 Exchange& set_batch_granularity(const long level);
193
194 /// 1 = gather tile results per subworld, 2 = also gather per node first
195 Exchange& set_accumulation_mode(const int mode);
196
197 /// place tasks by their measured cost rather than by counting them
199
200 Exchange& set_taskq(std::shared_ptr<MacroTaskQ> taskq1) {
201 this->taskq=taskq1;
202 return *this;
203 }
204
205 Exchange& set_bra_and_ket(const vecfuncT& bra, const vecfuncT& ket);
206
208 vecfuncT vket(1, ket);
209 vecfuncT vKket = this->operator()(vket);
210 return vKket[0];
211 }
212
213 /// apply the exchange operator on a vector of functions
214
215 /// note that only one spin is used (either alpha or beta orbitals)
216 /// @param[in] vket the orbitals |i> that the operator is applied on
217 /// @return a vector of orbitals K| i>
219
220 /// compute the matrix element <bra | K | ket>
221
222 /// @param[in] bra real_function_3d, the bra state
223 /// @param[in] ket real_function_3d, the ket state
224 T operator()(const Function<T, NDIM>& bra, const Function<T, NDIM>& ket) const {
225 return inner(bra, this->operator()(ket));
226 }
227
228 /// compute the matrix < vbra | K | vket >
229
230 /// @param[in] vbra vector of real_function_3d, the set of bra states
231 /// @param[in] vket vector of real_function_3d, the set of ket states
232 /// @return K_ij
234 vecfuncT vKket = this->operator()(vket);
235 World& world=vket[0].world();
236 auto result = matrix_inner(world, vbra, vKket);
237 return result;
238 }
239
240
241};
242
243
244template<typename T, std::size_t NDIM>
245class Kinetic : public SCFOperatorBase<T,NDIM> {
248 typedef std::vector<functionT> vecfuncT;
250
251public:
255
256 std::string info() const {return "T";}
257
258 functionT operator()(const functionT& ket) const {
259 MADNESS_EXCEPTION("do not apply the kinetic energy operator on a function!",1);
260 return ket;
261 }
262
264 MADNESS_EXCEPTION("do not apply the kinetic energy operator on a function!",1);
265 return vket;
266 }
267
268 T operator()(const functionT& bra, const functionT& ket) const {
269 vecfuncT vbra(1,bra), vket(1,ket);
270 Tensor<T> tmat=this->operator()(vbra,vket);
271 return tmat(0l,0l);
272 }
273
274 tensorT operator()(const vecfuncT& vbra, const vecfuncT& vket) const {
276 if (&vbra==&vket) {
278 } else {
280 }
281 tensorT kinetic(vbra.size(),vket.size());
282 dkinetic.copy_to_replicated(kinetic);
283 return kinetic;
284 }
285
286private:
288 std::vector< std::shared_ptr<Derivative<T,NDIM> > > gradop;
289
292 const vecfuncT & vket) const;
293
294};
295
296
297template<typename T, std::size_t NDIM>
298class DerivativeOperator : public SCFOperatorBase<T,NDIM> {
300 typedef std::vector<functionT> vecfuncT;
302
303public:
304
308
309 std::string info() const {return "D";}
310
311 functionT operator()(const functionT& ket) const {
312 vecfuncT vket(1,ket);
313 return this->operator()(vket)[0];
314 }
315
318 world.gop.fence();
319 return dvket;
320 }
321
322 T operator()(const functionT& bra, const functionT& ket) const {
323 vecfuncT vbra(1,bra), vket(1,ket);
324 Tensor<T> tmat=this->operator()(vbra,vket);
325 return tmat(0l,0l);
326 }
327
328 tensorT operator()(const vecfuncT& vbra, const vecfuncT& vket) const {
329 const auto bra_equiv_ket = &vbra == &vket;
330 vecfuncT dvket=this->operator()(vket);
332 }
333
334private:
336 int axis;
338
339};
340
341
342/// the Laplacian operator: \sum_i \nabla^2_i
343
344/// note that the application of the Laplacian operator is in general
345/// unstable and very sensitive to noise and cusps in the argument.
346///
347/// !!! BE SURE YOU KNOW WHAT YOU ARE DOING !!!
348///
349/// For computing matrix elements, which is reasonably stable, we refer
350template<typename T, std::size_t NDIM>
351class Laplacian : public SCFOperatorBase<T,NDIM> {
353 typedef std::vector<functionT> vecfuncT;
355
356public:
357
358 Laplacian(World& world, const double e=0.0) : world(world), eps(e) {
360 }
361
362 std::string info() const {return "D^2";}
363
364 functionT operator()(const functionT& ket) const {
365 vecfuncT vket(1,ket);
366 return this->operator()(vket)[0];
367 }
368
370
371 T operator()(const functionT& bra, const functionT& ket) const {
372 vecfuncT vbra(1,bra), vket(1,ket);
373 Tensor<T> tmat=this->operator()(vbra,vket);
374 return tmat(0l,0l);
375 }
376
377 tensorT operator()(const vecfuncT& vbra, const vecfuncT& vket) const {
379 return -2.0*t(vbra,vket);
380 }
381
382private:
384 std::vector< std::shared_ptr< Derivative<T,NDIM> > > gradop;
385 double eps;
386};
387
388
389
390template<typename T, std::size_t NDIM>
391class Coulomb : public SCFOperatorBase<T,NDIM> {
392public:
393
395 public:
396 // you need to define the exact argument(s) of operator() as tuple
397 typedef std::tuple<const Function<double,NDIM>&, const std::vector<Function<T,NDIM>> &> argtupleT;
398
399 using resultT = std::vector<Function<T,NDIM>>;
400
402 public:
403 partitionT do_partitioning(const std::size_t& vsize1, const std::size_t& vsize2,
404 const std::string policy) const override {
405 partitionT p={std::pair(Batch(_,_),1.0)};
406 return p;
407 }
408 };
409
413
414 // you need to define an empty constructor for the result
415 // resultT must implement operator+=(const resultT&)
417 std::size_t n = std::get<1>(argtuple).size();
419 return result;
420 }
421
423 return truncate(vcoul * arg);
424 }
425 };
426
427 /// default empty ctor
429
430 /// default empty ctor
434
435 /// ctor with an SCF calculation providing the MOs and density
436 Coulomb(World& world, const SCF* calc);
437
438 /// ctor with a Nemo calculation providing the MOs and density
439 Coulomb(World& world, const Nemo* nemo);
440
441 std::string info() const {return "J";}
442
443 Coulomb& set_taskq(std::shared_ptr<MacroTaskQ> taskq1) {
444 this->taskq=taskq1;
445 return *this;
446 }
447
448 void reset_poisson_operator_ptr(const double lo, const double econv);
449
451 std::vector<Function<T,NDIM> > vket(1,ket);
452 return this->operator()(vket)[0];
453 }
454
455 std::vector<Function<T,NDIM> > operator()(const std::vector<Function<T,NDIM> >& vket) const {
457 World& world=vket.front().world();
458 MacroTask task(world, t, this->taskq);
459 auto result=task(vcoul,vket);
460 return result;
461 }
462
463 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
464 return inner(bra,vcoul*ket);
465 }
466
468 const std::vector<Function<T,NDIM> >& vket) const {
469 const auto bra_equiv_ket = &vbra == &vket;
470 std::vector<Function<T,NDIM> > vJket;
471 for (std::size_t i=0; i<vket.size(); ++i) {
472 vJket.push_back(this->operator()(vket[i]));
473 }
475 }
476
477 /// getter for the Coulomb potential
478 const real_function_3d& potential() const {return vcoul;}
479
480 /// setter for the Coulomb potential
482
483 real_function_3d compute_density(const SCF* calc) const;
484
485 /// given a density compute the Coulomb potential
486
487 /// this function uses a newly constructed Poisson operator. Note that
488 /// the accuracy parameters must be consistent with the exchange operator.
490 return (*poisson)(density).truncate();
491 }
492
493 /// given a set of MOs in an SCF calculation, compute the Coulomb potential
494
495 /// this function uses the Poisson operator of the SCF calculation
496 real_function_3d compute_potential(const SCF* calc) const;
497
498 /// given a set of MOs in an SCF calculation, compute the Coulomb potential
499
500 /// this function uses the Poisson operator of the SCF calculation
501 real_function_3d compute_potential(const Nemo* nemo) const;
502
503private:
505 std::shared_ptr<real_convolution_3d> poisson;
506 double lo=1.e-4;
507 real_function_3d vcoul; ///< the coulomb potential
508};
509
510
511template<typename T, std::size_t NDIM>
512class Nuclear : public SCFOperatorBase<T,NDIM> {
513public:
514
515 Nuclear(World& world, const SCF* calc);
516
517 Nuclear(World& world, const NemoBase* nemo);
518
519 /// simple constructor takes a molecule, no nuclear correlation factor or core potentials
521
522 Nuclear(World& world, std::shared_ptr<NuclearCorrelationFactor> ncf)
523 : world(world), ncf(ncf) {}
524
525 std::string info() const {return "Vnuc";}
526
528 std::vector<Function<T,NDIM> > vket(1,ket);
529 return this->operator()(vket)[0];
530 }
531
532 std::vector<Function<T,NDIM> > operator()(const std::vector<Function<T,NDIM> >& vket) const;
533
534 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
535 return inner(bra,this->operator()(ket));
536 }
537
539 const std::vector<Function<T,NDIM> >& vket) const {
540 const auto bra_equiv_ket = &vbra == &vket;
541 std::vector<Function<T,NDIM> > vVket=this->operator()(vket);
542 return matrix_inner(world,vbra,vVket,bra_equiv_ket);
543 }
544
545private:
547 std::shared_ptr<NuclearCorrelationFactor> ncf;
548
549};
550
551
552/// the z component of the angular momentum
553
554/// takes real and complex functions as input, will return complex functions
555template<typename T, std::size_t NDIM>
556class Lz : public SCFOperatorBase<T,NDIM> {
557private:
559public:
560
561 bool use_bsplines=true;
562
564
565 std::string info() const {return "Lz";}
566
567
569 std::vector<Function<T,NDIM> > vket(1,ket);
570 return this->operator()(vket)[0];
571 }
572
573 std::vector<Function<T,NDIM> > operator()(const std::vector<Function<T,NDIM> >& vket) const {
574
575 // the operator in cartesian components as
576 // L_z = - i (x del_y - y del_x)
577
578 if (vket.size()==0) return std::vector<complex_function_3d>(0);
579
580 real_function_3d x=real_factory_3d(world).functor([] (const coord_3d& r) {return r[0];});
581 real_function_3d y=real_factory_3d(world).functor([] (const coord_3d& r) {return r[1];});
582
585 if (use_bsplines) {
586 Dx.set_bspline1();
587 Dy.set_bspline1();
588 }
589
590 reconstruct(world,vket,true);
591 std::vector<Function<T,NDIM> > delx=apply(world,Dx,vket,false);
592 std::vector<Function<T,NDIM> > dely=apply(world,Dy,vket,true);
593
594 std::vector<Function<T,NDIM> > result1=x*dely - y*delx;
595 std::vector<complex_function_3d> cresult1=convert<T,double_complex,NDIM>(world,result1);
596 std::vector<complex_function_3d> result=double_complex(0.0,-1.0)*cresult1;
597 return result;
598 }
599
600 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
601 return inner(bra,this->operator()(ket));
602 }
603
605 const std::vector<Function<T,NDIM> >& vket) const {
606 const auto bra_equiv_ket = &vbra == &vket;
607 std::vector<complex_function_3d> vVket=this->operator()(vket);
608 return matrix_inner(world,vbra,vVket,bra_equiv_ket);
609 }
610
611};
612
613
614
615/// derivative of the (regularized) nuclear potential wrt nuclear displacements
616template<typename T, std::size_t NDIM>
617class DNuclear : public SCFOperatorBase<T,NDIM> {
618public:
619
620 DNuclear(World& world, const SCF* calc, const int iatom, const int iaxis);
621
622 DNuclear(World& world, const Nemo* nemo, const int iatom, const int iaxis);
623
624 DNuclear(World& world, std::shared_ptr<NuclearCorrelationFactor> ncf,
625 const int iatom, const int iaxis)
626 : world(world), ncf(ncf), iatom(iatom), iaxis(iaxis) {}
627
628 std::string info() const {return "DVnuc";}
629
631 std::vector<Function<T,NDIM>> vket(1,ket);
632 return this->operator()(vket)[0];
633 }
634
635 std::vector<Function<T,NDIM>> operator()(const std::vector<Function<T,NDIM>>& vket) const;
636
637 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
638 return inner(bra,this->operator()(ket));
639 }
640
641 Tensor<T> operator()(const std::vector<Function<T,NDIM>>& vbra, const std::vector<Function<T,NDIM>>& vket) const {
642 const auto bra_equiv_ket = &vbra == &vket;
643 std::vector<Function<T,NDIM>> vVket=this->operator()(vket);
644 return matrix_inner(world,vbra,vVket,bra_equiv_ket);
645 }
646
647private:
649 std::shared_ptr<NuclearCorrelationFactor> ncf;
650 int iatom; ///< index of the atom which is displaced
651 int iaxis; ///< x,y,z component of the atom
652
653};
654
655template<typename T, std::size_t NDIM>
657public:
661
662 std::string info() const {return info_str;}
663
664 void set_info(const std::string new_info) {
666 }
667
671
673 return (potential*ket).truncate();
674 }
675
676 std::vector<Function<T,NDIM> > operator()(const std::vector<Function<T,NDIM> >& vket) const {
677 return truncate(potential*vket);
678 }
679
680 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
681 return inner(bra,potential*ket);
682 }
683
685 const std::vector<Function<T,NDIM> >& vket) const {
686 const auto bra_equiv_ket = &vbra == &vket;
688 }
689
690private:
692 std::string info_str="Vlocal";
694};
695
696/// operator class for the handling of DFT exchange-correlation functionals
697template<typename T, std::size_t NDIM>
698class XCOperator : public SCFOperatorBase<T,NDIM> {
699public:
700
701 /// default ctor without information about the XC functional
703 extra_truncation(FunctionDefaults<3>::get_thresh()*0.01) {}
704
705 /// custom ctor with information about the XC functional
706 XCOperator(World& world, std::string xc_data, const bool spin_polarized,
708 std::string deriv="abgv");
709
710 /// custom ctor with the XC functional
711 XCOperator(World& world, std::shared_ptr<XCfunctional> xc,
712 const bool spin_polarized,
713 int ispin,
714 int nbeta,
716 std::string deriv="abgv");
717
718 /// ctor with an SCF calculation, will initialize the necessary intermediates
719 XCOperator(World& world, const SCF* scf, int ispin=0, std::string deriv="abgv");
720
721 /// ctor with a Nemo calculation, will initialize the necessary intermediates
722 XCOperator(World& world, const Nemo* nemo, int ispin=0);
723
724 /// ctor with an SCF calculation, will initialize the necessary intermediates
726 const real_function_3d& brho, int ispin=0, std::string deriv="abgv");
727
728 /// ctor with an Nemo calculation, will initialize the necessary intermediates
730 const real_function_3d& brho, int ispin=0);
731
732 std::string info() const {return "Vxc";}
733
734 XCOperator& set_extra_truncation(const double& fac) {
736 if (world.rank()==0)
737 print("set extra truncation in XCOperator to", extra_truncation);
738 return *this;
739 }
740
741 /// set the spin state this operator is acting on
742 void set_ispin(const int i) const {ispin=i;}
743
744 /// apply the xc potential on a set of orbitals
745 std::vector<Function<T,NDIM> > operator()(const std::vector<Function<T,NDIM> >& vket) const;
746
747 /// apply the xc potential on an orbitals
749 std::vector<Function<T,3> > vket(1,ket);
750 std::vector<Function<T,3> > vKket=this->operator()(vket);
751 return vKket[0];
752 }
753
754 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
755 MADNESS_EXCEPTION("no implementation of matrix elements of the xc operator",1);
756 };
757
758 Tensor<T> operator()(const std::vector<Function<T,NDIM>>& vbra, const std::vector<Function<T,NDIM>>& vket) const {
759 MADNESS_EXCEPTION("no implementation of matrix elements of the xc operator", 1);
760 }
761
762 /// compute the xc energy using the precomputed intermediates vf and delrho
763 double compute_xc_energy() const;
764
765 /// return the local xc potential
767
768 /// construct the xc kernel and apply it directly on the (response) density
769
770 /// the xc kernel is the second derivative of the xc functions wrt the density
771 /// @param[in] density the (response) density on which the kernel is applied
772 /// @return kernel * density
774 const vecfuncT grad_dens_pt=vecfuncT()) const;
775
776private:
777
778 /// the world
780
781 /// which derivative operator to use
782 std::string dft_deriv;
783
784public:
785 /// interface to the actual XC functionals
786 std::shared_ptr<XCfunctional> xc;
787
788private:
789 /// number of beta orbitals
790 int nbeta;
791
792 /// the XC functionals depend on the spin of the orbitals they act on
793 mutable int ispin;
794
795 /// additional truncation for the densities in the XC kernel
796
797 /// the densities in the DFT kernal are processed as their inverses,
798 /// so noise in the small density regions might amplify and lead to inaccurate
799 /// results. Extra truncation will tighten the truncation threshold by a
800 /// specified factor, default is 0.01.
802
803 /// the nuclear correlation factor, if it exists, for computing derivatives for GGA
804 std::shared_ptr<NuclearCorrelationFactor> ncf;
805
806 /// functions that are need for the computation of the XC operator
807
808 /// the ordering of the intermediates is fixed, but the code can handle
809 /// non-initialized functions, so if e.g. no GGA is requested, all the
810 /// corresponding vector components may be left empty.
811 /// For the ordering of the intermediates see xcfunctional::xc_arg
813
814 /// compute the intermediates for the XC functionals
815
816 /// @param[in] arho density of the alpha orbitals
817 /// @param[in] brho density of the beta orbitals (necessary only if spin-polarized)
818 /// @return xc_args vector of intermediates as described above
820
821 /// compute the intermediates for the XC functionals
822
823 /// @param[in] dens_pt perturbed densities from CPHF or TDDFT equations
824 /// @param[in,out] xc_args vector of intermediates as described above
825 /// @param[out] ddens_pt xyz-derivatives of dens_pt
828
829 /// check if the intermediates are initialized
830 bool is_initialized() const {
831 return (xc_args.size()>0);
832 }
833
834 /// simple structure to take the pointwise logarithm of a function, shifted by +14
835 struct logme{
836 typedef double resultT;
837 struct logme1 {
838 double operator()(const double& val) {return log(std::max(1.e-14,val))+14.0;}
839 };
840 Tensor<double> operator()(const Key<3>& key, const Tensor<double>& val) const {
841 Tensor<double> result=copy(val);
842 logme1 op;
843 return result.unaryop(op);
844 }
845
846 template <typename Archive>
847 void serialize(Archive& ar) {}
848 };
849
850 /// simple structure to take the pointwise exponential of a function, shifted by +14
851 struct expme{
852 typedef double resultT;
853 struct expme1 {
854 double operator()(const double& val) {return exp(val-14.0);}
855 };
856 Tensor<double> operator()(const Key<3>& key, const Tensor<double>& val) const {
857 Tensor<double> result=copy(val);
858 expme1 op;
859 return result.unaryop(op);
860 }
861
862 template <typename Archive>
863 void serialize(Archive& ar) {}
864
865 };
866};
867
868/// Computes matrix representation of the Fock operator
869template<typename T, std::size_t NDIM>
870class Fock : public SCFOperatorBase<T,NDIM> {
871public:
873
874 Fock(World& world, const Nemo* nemo);
875 Fock(World& world, const OEP* nemo);
876 Fock(World& world, const NemoBase* nemo);
877
878 /// pretty print what this is actually computing
879 std::string info() const {
880 std::string s;
881 for (auto& op : operators) {
882 double number=std::get<0>(op.second);
883 if (number==-1.0) {
884 s+=" - ";
885 } else if (number!=1.0) {
886 std::stringstream snumber;
887 snumber << std::fixed << std::setw(2) << number;
888 s+=" "+snumber.str()+ " ";
889 } else {
890 MADNESS_CHECK(number==1.0);
891 s+=" + ";
892 }
893 s+=op.first;
894 }
895 return s;
896 }
897
898 /// add an operator with default prefactor 1.0
899 void add_operator(std::string name, std::shared_ptr<SCFOperatorBase<T,NDIM>> new_op) {
900 operators.insert({name,valueT(1.0,new_op)});
901 }
902
903 /// add an operator with custom prefactor (e.g. -1.0 for the exchange, supposedly)
904 void add_operator(std::string name, std::tuple<double,std::shared_ptr<SCFOperatorBase<T,NDIM>>> new_op) {
905 operators.insert({name,new_op});
906 }
907
908 /// remove operator, returns 0 if no operator was found
909 int remove_operator(std::string name) {
910 return operators.erase(name);
911 }
912
914 MADNESS_EXCEPTION("Fock(ket) not yet implemented",1);
915 Function<T,NDIM> result;
916 return result;
917 }
918
919 std::vector<Function<T,NDIM>> operator()(const std::vector<Function<T,NDIM>>& vket) const {
920 // make sure T is not part of the Fock operator, it's numerically unstable!
921 MADNESS_CHECK(operators.count("T")==0);
922 std::vector<Function<T,NDIM>> result = zero_functions_compressed<T, NDIM>(world, vket.size());
923 for (const auto& op : operators) {
924 result+=std::get<0>(op.second) * (*std::get<1>(op.second))(vket);
925 }
926 return result;
927 }
928
929 T operator()(const Function<T,NDIM>& bra, const Function<T,NDIM>& ket) const {
930 std::vector<Function<T,NDIM>> vbra(1,bra), vket(1,ket);
931 return (*this)(vbra,vket)(0,0);
932 }
933
934 /// compute the Fock matrix by summing up all contributions
935 Tensor<T> operator()(const std::vector<Function<T,NDIM>>& vbra, const std::vector<Function<T,NDIM>>& vket) const {
936 return this->operator()(vbra,vket,false);
937 }
938
939 /// compute the Fock matrix by summing up all contributions
940 Tensor<T> operator()(const std::vector<Function<T,NDIM>>& vbra, const std::vector<Function<T,NDIM>>& vket,
941 const bool symmetric) const {
942 Tensor<T> fock(vbra.size(),vket.size());
943 for (const auto& op : operators) {
944 Tensor<T> tmp=std::get<0>(op.second) * (*std::get<1>(op.second))(vbra,vket);
945// print("Operator",std::get<1>(op.second)->info());
946// print(tmp);
947 fock+=tmp;
948 }
949 return fock;
950 }
951
952
953private:
954 /// the world
956
957 /// type defining Fock operator contribution including prefactor
958 typedef std::tuple<double,std::shared_ptr<SCFOperatorBase<T,NDIM> > > valueT;
959
960 /// all the Fock operator contribution
961 std::map<std::string,valueT> operators;
962};
963
964}
965#endif /* MADNESS_CHEM_SCFOPERATORS_H_ */
std::complex< double > double_complex
Definition cfft.h:14
partitionT do_partitioning(const std::size_t &vsize1, const std::size_t &vsize2, const std::string policy) const override
override this if you want your own partitioning
Definition SCFOperators.h:403
Definition SCFOperators.h:394
std::vector< Function< T, NDIM > > resultT
Definition SCFOperators.h:399
MacroTaskCoulomb()
Definition SCFOperators.h:410
resultT allocator(World &world, const argtupleT &argtuple) const
Definition SCFOperators.h:416
std::tuple< const Function< double, NDIM > &, const std::vector< Function< T, NDIM > > & > argtupleT
Definition SCFOperators.h:397
resultT operator()(const Function< double, NDIM > &vcoul, const std::vector< Function< T, NDIM > > &arg) const
Definition SCFOperators.h:422
Definition SCFOperators.h:391
Function< T, NDIM > compute_potential(const Function< T, NDIM > &density) const
given a density compute the Coulomb potential
Definition SCFOperators.h:489
real_function_3d compute_density(const SCF *calc) const
Definition SCFOperators.cc:204
Coulomb & set_taskq(std::shared_ptr< MacroTaskQ > taskq1)
Definition SCFOperators.h:443
real_function_3d & potential()
setter for the Coulomb potential
Definition SCFOperators.h:481
World & world
Definition SCFOperators.h:504
Coulomb(World &world)
default empty ctor
Definition SCFOperators.h:428
Coulomb(World &world, const double lo, const double thresh=FunctionDefaults< 3 >::get_thresh())
default empty ctor
Definition SCFOperators.h:431
const real_function_3d & potential() const
getter for the Coulomb potential
Definition SCFOperators.h:478
std::string info() const
print some information about this operator
Definition SCFOperators.h:441
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:455
std::shared_ptr< real_convolution_3d > poisson
Definition SCFOperators.h:505
real_function_3d vcoul
the coulomb potential
Definition SCFOperators.h:507
double lo
Definition SCFOperators.h:506
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:467
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:450
void reset_poisson_operator_ptr(const double lo, const double econv)
Definition SCFOperators.cc:199
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:463
derivative of the (regularized) nuclear potential wrt nuclear displacements
Definition SCFOperators.h:617
World & world
Definition SCFOperators.h:648
std::string info() const
print some information about this operator
Definition SCFOperators.h:628
DNuclear(World &world, std::shared_ptr< NuclearCorrelationFactor > ncf, const int iatom, const int iaxis)
Definition SCFOperators.h:624
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:637
std::shared_ptr< NuclearCorrelationFactor > ncf
Definition SCFOperators.h:649
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:641
int iatom
index of the atom which is displaced
Definition SCFOperators.h:650
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:630
int iaxis
x,y,z component of the atom
Definition SCFOperators.h:651
Definition SCFOperators.h:298
tensorT operator()(const vecfuncT &vbra, const vecfuncT &vket) const
compute the matrix <vbra | op | vket>
Definition SCFOperators.h:328
functionT operator()(const functionT &ket) const
Definition SCFOperators.h:311
int axis
Definition SCFOperators.h:336
DerivativeOperator(World &world, const int axis1)
Definition SCFOperators.h:305
T operator()(const functionT &bra, const functionT &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:322
std::string info() const
print some information about this operator
Definition SCFOperators.h:309
Derivative< T, NDIM > gradop
Definition SCFOperators.h:337
Tensor< T > tensorT
Definition SCFOperators.h:301
Function< T, NDIM > functionT
Definition SCFOperators.h:299
vecfuncT operator()(const vecfuncT &vket) const
apply this operator on the argument vector of functions
Definition SCFOperators.h:316
World & world
Definition SCFOperators.h:335
std::vector< functionT > vecfuncT
Definition SCFOperators.h:300
Implements derivatives operators with variety of boundary conditions on simulation domain.
Definition derivative.h:329
Manages data associated with a row/column/block distributed array.
Definition distributed_matrix.h:388
Definition exchangeoperator.h:601
Definition SCFOperators.h:105
Exchange & set_cost_aware_assignment(const bool flag)
place tasks by their measured cost rather than by counting them
Definition SCFOperators.cc:762
Function< T, NDIM > functionT
Definition SCFOperators.h:110
Exchange & set_taskq(std::shared_ptr< MacroTaskQ > taskq1)
Definition SCFOperators.h:200
Exchange & set_printlevel(const long &level)
Definition SCFOperators.cc:744
Exchange & set_batch_granularity(const long level)
batches per rank in the owner-pinned symmetric partition (>= 1)
Definition SCFOperators.cc:750
Exchange & set_macro_task_info(const std::vector< std::string > &info)
Definition SCFOperators.h:183
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | K | ket>
Definition SCFOperators.h:224
static std::string to_string(const ExchangeAlgorithm alg)
Definition SCFOperators.h:144
ExchangeAlgorithm
Definition SCFOperators.h:117
@ fetch_compute
Definition SCFOperators.h:118
@ multiworld_efficient_row
Definition SCFOperators.h:118
@ multiworld_efficient
Definition SCFOperators.h:118
@ small_memory
Definition SCFOperators.h:118
@ large_memory
Definition SCFOperators.h:118
static ExchangeAlgorithm string2algorithm(const std::string &alg_string)
Definition SCFOperators.h:150
Tensor< T > tensorT
Definition SCFOperators.h:112
bool is_symmetric() const
Definition SCFOperators.cc:721
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:207
Exchange & set_symmetric(const bool flag)
Definition SCFOperators.cc:726
implT impl
Definition SCFOperators.h:114
std::shared_ptr< ExchangeImpl > implT
Definition SCFOperators.h:109
Exchange & set_accumulation_mode(const int mode)
1 = gather tile results per subworld, 2 = also gather per node first
Definition SCFOperators.cc:756
Tensor< T > operator()(const vecfuncT &vbra, const vecfuncT &vket) const
compute the matrix < vbra | K | vket >
Definition SCFOperators.h:233
Exchange & set_bra_and_ket(const vecfuncT &bra, const vecfuncT &ket)
Definition SCFOperators.cc:714
std::vector< functionT > vecfuncT
Definition SCFOperators.h:111
vecfuncT operator()(const vecfuncT &vket) const
apply the exchange operator on a vector of functions
Exchange & set_macro_task_info(const MacroTaskInfo &info)
how the cloud will handle the data
Definition SCFOperators.cc:738
std::string info() const
print some information about this operator
Definition SCFOperators.h:173
friend std::ostream & operator<<(std::ostream &os, const ExchangeAlgorithm &alg)
Definition SCFOperators.h:121
Exchange & set_algorithm(const ExchangeAlgorithm &alg)
Definition SCFOperators.cc:732
Computes matrix representation of the Fock operator.
Definition SCFOperators.h:870
int remove_operator(std::string name)
remove operator, returns 0 if no operator was found
Definition SCFOperators.h:909
Fock(World &world)
Definition SCFOperators.h:872
World & world
the world
Definition SCFOperators.h:955
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
compute the Fock matrix by summing up all contributions
Definition SCFOperators.h:935
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket, const bool symmetric) const
compute the Fock matrix by summing up all contributions
Definition SCFOperators.h:940
Fock(World &world, const OEP *nemo)
Fock(World &world, const NemoBase *nemo)
Fock(World &world, const Nemo *nemo)
std::map< std::string, valueT > operators
all the Fock operator contribution
Definition SCFOperators.h:961
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:929
std::tuple< double, std::shared_ptr< SCFOperatorBase< T, NDIM > > > valueT
type defining Fock operator contribution including prefactor
Definition SCFOperators.h:958
void add_operator(std::string name, std::tuple< double, std::shared_ptr< SCFOperatorBase< T, NDIM > > > new_op)
add an operator with custom prefactor (e.g. -1.0 for the exchange, supposedly)
Definition SCFOperators.h:904
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:913
std::string info() const
pretty print what this is actually computing
Definition SCFOperators.h:879
void add_operator(std::string name, std::shared_ptr< SCFOperatorBase< T, NDIM > > new_op)
add an operator with default prefactor 1.0
Definition SCFOperators.h:899
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:919
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:100
A multiresolution adaptive numerical function.
Definition mra.h:144
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:70
Definition SCFOperators.h:245
Tensor< T > tensorT
Definition SCFOperators.h:249
std::vector< std::shared_ptr< Derivative< T, NDIM > > > gradop
Definition SCFOperators.h:288
tensorT operator()(const vecfuncT &vbra, const vecfuncT &vket) const
compute the matrix <vbra | op | vket>
Definition SCFOperators.h:274
World & world
Definition SCFOperators.h:287
Kinetic(World &world)
Definition SCFOperators.h:252
std::vector< functionT > vecfuncT
Definition SCFOperators.h:248
Function< T, NDIM > functionT
Definition SCFOperators.h:247
std::string info() const
print some information about this operator
Definition SCFOperators.h:256
distmatT kinetic_energy_matrix(World &world, const vecfuncT &v) const
Definition SCFOperators.cc:51
DistributedMatrix< T > distmatT
Definition SCFOperators.h:246
vecfuncT operator()(const vecfuncT &vket) const
apply this operator on the argument vector of functions
Definition SCFOperators.h:263
T operator()(const functionT &bra, const functionT &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:268
functionT operator()(const functionT &ket) const
Definition SCFOperators.h:258
the Laplacian operator: \sum_i \nabla^2_i
Definition SCFOperators.h:351
T operator()(const functionT &bra, const functionT &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:371
double eps
Definition SCFOperators.h:385
Tensor< T > tensorT
Definition SCFOperators.h:354
functionT operator()(const functionT &ket) const
Definition SCFOperators.h:364
Function< T, NDIM > functionT
Definition SCFOperators.h:352
std::string info() const
print some information about this operator
Definition SCFOperators.h:362
tensorT operator()(const vecfuncT &vbra, const vecfuncT &vket) const
compute the matrix <vbra | op | vket>
Definition SCFOperators.h:377
std::vector< functionT > vecfuncT
Definition SCFOperators.h:353
vecfuncT operator()(const vecfuncT &vket) const
apply this operator on the argument vector of functions
Laplacian(World &world, const double e=0.0)
Definition SCFOperators.h:358
std::vector< std::shared_ptr< Derivative< T, NDIM > > > gradop
Definition SCFOperators.h:384
World & world
Definition SCFOperators.h:383
Definition SCFOperators.h:656
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:684
std::string info() const
print some information about this operator
Definition SCFOperators.h:662
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:680
void set_info(const std::string new_info)
Definition SCFOperators.h:664
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:676
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:672
Function< T, NDIM > potential
Definition SCFOperators.h:693
LocalPotentialOperator(World &world)
Definition SCFOperators.h:658
World & world
Definition SCFOperators.h:691
std::string info_str
Definition SCFOperators.h:692
LocalPotentialOperator(World &world, const std::string info, const Function< T, NDIM > potential)
Definition SCFOperators.h:659
void set_potential(const Function< T, NDIM > &new_potential)
Definition SCFOperators.h:668
the z component of the angular momentum
Definition SCFOperators.h:556
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:600
Lz(World &world, bool use_bspline_derivative=true)
Definition SCFOperators.h:563
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:604
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:573
World & world
Definition SCFOperators.h:558
std::string info() const
print some information about this operator
Definition SCFOperators.h:565
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:568
bool use_bsplines
Definition SCFOperators.h:561
Definition macrotaskq.h:1604
std::shared_ptr< MacroTaskPartitioner > partitioner
Definition macrotaskq.h:1612
partition one (two) vectors into 1D (2D) batches.
Definition macrotaskpartitioner.h:182
std::string policy
how to partition the batches
Definition macrotaskpartitioner.h:190
std::list< std::pair< Batch, double > > partitionT
Definition macrotaskpartitioner.h:186
friend class Batch
Definition macrotaskpartitioner.h:183
Definition macrotaskq.h:991
Definition molecule.h:129
Definition nemo.h:70
The Nemo class.
Definition nemo.h:362
Definition SCFOperators.h:512
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
Definition SCFOperators.h:527
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:534
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:538
std::string info() const
print some information about this operator
Definition SCFOperators.h:525
World & world
Definition SCFOperators.h:546
Nuclear(World &world, std::shared_ptr< NuclearCorrelationFactor > ncf)
Definition SCFOperators.h:522
std::shared_ptr< NuclearCorrelationFactor > ncf
Definition SCFOperators.h:547
Definition oep.h:152
Definition SCFOperators.h:58
std::vector< functionT > vecfuncT
Definition SCFOperators.h:62
Tensor< T > tensorT
Definition SCFOperators.h:63
virtual std::string info() const =0
print some information about this operator
nlohmann::json statistics
Definition SCFOperators.h:64
std::shared_ptr< MacroTaskQ > taskq
Definition SCFOperators.h:71
Function< T, NDIM > functionT
Definition SCFOperators.h:61
SCFOperatorBase(std::shared_ptr< MacroTaskQ > taskq)
Definition SCFOperators.h:67
virtual ~SCFOperatorBase()
Definition SCFOperators.h:69
virtual tensorT operator()(const vecfuncT &vbra, const vecfuncT &vket) const =0
compute the matrix <vbra | op | vket>
virtual vecfuncT operator()(const vecfuncT &vket) const =0
apply this operator on the argument vector of functions
virtual functionT operator()(const functionT &ket) const =0
virtual T operator()(const functionT &bra, const functionT &ket) const =0
compute the matrix element <bra | op | ket>
Definition SCF.h:193
A tensor is a multidimensional array.
Definition tensor.h:318
Tensor< T > & unaryop(opT &op)
Inplace apply a unary function to each element of the tensor.
Definition tensor.h:1794
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:176
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:354
WorldGopInterface & gop
Global operations.
Definition world.h:216
operator class for the handling of DFT exchange-correlation functionals
Definition SCFOperators.h:698
XCOperator(World &world)
default ctor without information about the XC functional
Definition SCFOperators.h:702
vecfuncT xc_args
functions that are need for the computation of the XC operator
Definition SCFOperators.h:812
Tensor< T > operator()(const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const
Definition SCFOperators.h:758
bool is_initialized() const
check if the intermediates are initialized
Definition SCFOperators.h:830
double compute_xc_energy() const
compute the xc energy using the precomputed intermediates vf and delrho
Definition SCFOperators.cc:458
std::string info() const
print some information about this operator
Definition SCFOperators.h:732
real_function_3d make_xc_potential() const
return the local xc potential
Definition SCFOperators.cc:474
XCOperator & set_extra_truncation(const double &fac)
Definition SCFOperators.h:734
Function< T, NDIM > operator()(const Function< T, NDIM > &ket) const
apply the xc potential on an orbitals
Definition SCFOperators.h:748
void prep_xc_args_response(const real_function_3d &dens_pt, vecfuncT &xc_args, vecfuncT &ddens_pt) const
compute the intermediates for the XC functionals
Definition SCFOperators.cc:638
T operator()(const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const
compute the matrix element <bra | op | ket>
Definition SCFOperators.h:754
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &vket) const
apply the xc potential on a set of orbitals
Definition SCFOperators.cc:451
std::string dft_deriv
which derivative operator to use
Definition SCFOperators.h:782
std::shared_ptr< NuclearCorrelationFactor > ncf
the nuclear correlation factor, if it exists, for computing derivatives for GGA
Definition SCFOperators.h:804
void set_ispin(const int i) const
set the spin state this operator is acting on
Definition SCFOperators.h:742
double extra_truncation
additional truncation for the densities in the XC kernel
Definition SCFOperators.h:801
std::shared_ptr< XCfunctional > xc
interface to the actual XC functionals
Definition SCFOperators.h:786
vecfuncT prep_xc_args(const real_function_3d &arho, const real_function_3d &brho) const
compute the intermediates for the XC functionals
Definition SCFOperators.cc:588
World & world
the world
Definition SCFOperators.h:779
real_function_3d apply_xc_kernel(const real_function_3d &density, const vecfuncT grad_dens_pt=vecfuncT()) const
construct the xc kernel and apply it directly on the (response) density
Definition SCFOperators.cc:549
int ispin
the XC functionals depend on the spin of the orbitals they act on
Definition SCFOperators.h:793
int nbeta
number of beta orbitals
Definition SCFOperators.h:790
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
static double lo
Definition dirac-hatom.cc:23
Tensor< typename Tensor< T >::scalar_type > arg(const Tensor< T > &t)
Return a new tensor holding the argument of each element of t (complex types only)
Definition tensor.h:2643
static const double v
Definition hatom_sf_dirac.cc:20
Tensor< double > op(const Tensor< double > &x)
Definition kain.cc:508
Declares the macrotaskq and MacroTaskBase classes.
General header file for using MADNESS.
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:182
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
void truncate(World &world, std::vector< Function< T, NDIM > > &v, double tol=0.0, bool fence=true)
Truncates a vector of functions.
Definition vmra.h:335
const std::vector< Function< T, NDIM > > & reconstruct(const std::vector< Function< T, NDIM > > &v)
reconstruct a vector of functions
Definition vmra.h:162
static const Slice _(0,-1, 1)
FunctionFactory< double, 3 > real_factory_3d
Definition functypedefs.h:108
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:227
vector< functionT > vecfuncT
Definition corepotential.cc:58
CCPairFunction< T, NDIM > apply(const SeparatedConvolution< T, NDIM/2 > &op, const CCPairFunction< T, NDIM > &arg)
apply the operator to the argument
Definition ccpairfunction.h:896
Function< T, CCPairFunction< T, NDIM >::LDIM > inner(const CCPairFunction< T, NDIM > &c, const Function< T, CCPairFunction< T, NDIM >::LDIM > &f, const std::tuple< int, int, int > v1, const std::tuple< int, int, int > v2)
Definition ccpairfunction.h:993
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
void matrix_inner(DistributedMatrix< T > &A, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< T, NDIM > > &g, bool sym=false)
Definition distpm.cc:46
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:2187
static const double thresh
Definition rk.cc:45
Definition macrotaskq.h:280
Definition SCFOperators.h:853
double operator()(const double &val)
Definition SCFOperators.h:854
simple structure to take the pointwise exponential of a function, shifted by +14
Definition SCFOperators.h:851
Tensor< double > operator()(const Key< 3 > &key, const Tensor< double > &val) const
Definition SCFOperators.h:856
void serialize(Archive &ar)
Definition SCFOperators.h:863
double resultT
Definition SCFOperators.h:852
Definition SCFOperators.h:837
double operator()(const double &val)
Definition SCFOperators.h:838
simple structure to take the pointwise logarithm of a function, shifted by +14
Definition SCFOperators.h:835
Tensor< double > operator()(const Key< 3 > &key, const Tensor< double > &val) const
Definition SCFOperators.h:840
void serialize(Archive &ar)
Definition SCFOperators.h:847
double resultT
Definition SCFOperators.h:836
static std::string tolower(std::string s)
make lower case
Definition commandlineparser.h:128
Definition dirac-hatom.cc:112
int task(int i)
Definition test_runtime.cpp:4
void e()
Definition test_sig.cc:75
static Molecule molecule
Definition testperiodicdft.cc:39