MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
functional.h
1//
2// functional.h --- definition of the dft functional
3//
4// Copyright (C) 1997 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_qc_dft_functional_h
29#define _chemistry_qc_dft_functional_h
30
31#include <util/state/state.h>
32#include <math/scmat/vector3.h>
33#include <chemistry/qc/wfn/wfn.h>
34#include <chemistry/qc/wfn/density.h>
35
36namespace sc {
37
40 enum {X=BatchElectronDensity::X,
41 Y=BatchElectronDensity::Y,
42 Z=BatchElectronDensity::Z};
43 enum {XX=BatchElectronDensity::XX,
44 YX=BatchElectronDensity::YX,
45 YY=BatchElectronDensity::YY,
46 ZX=BatchElectronDensity::ZX,
47 ZY=BatchElectronDensity::ZY,
48 ZZ=BatchElectronDensity::ZZ};
49 struct SpinData {
50 double rho;
51 // rho^(1/3)
52 double rho_13;
53
54 double del_rho[3];
55 // gamma = (del rho).(del rho)
56 double gamma;
57
58 // hessian of rho
59 double hes_rho[6];
60 // del^2 rho
61 double lap_rho;
62 };
63 SpinData a, b;
64
65 // gamma_ab = (del rho_a).(del rho_b)
66 double gamma_ab;
67
68 const SCVector3 &r;
69
70 // fill in derived quantities
71 void compute_derived(int spin_polarized,
72 int need_gradient,
73 int need_hessian);
74
75 PointInputData(const SCVector3& r_): r(r_) {}
76};
77
80 // energy at r
81 double energy;
82
83 // derivative of functional wrt density
84 double df_drho_a;
85 double df_drho_b;
86
87 // derivative of functional wrt density gradient
88 double df_dgamma_aa;
89 double df_dgamma_bb;
90 double df_dgamma_ab;
91
92 void zero(){energy=df_drho_a=df_drho_b=df_dgamma_aa=df_dgamma_bb=df_dgamma_ab=0.0;}
93
94};
95
97class DenFunctional: virtual public SavableState {
98 protected:
99 int spin_polarized_;
100 int compute_potential_;
101 double a0_; // for ACM functionals
102
103 void do_fd_point(PointInputData&id,double&in,double&out,
104 double lower_bound, double upper_bound);
105 public:
107 DenFunctional(const Ref<KeyVal> &);
109 virtual ~DenFunctional();
111
112 // Set to zero if dens_alpha == dens_beta everywhere.
113 // The default is false.
114 virtual void set_spin_polarized(int i);
115 // Set to nonzero if the potential should be computed.
116 // The default is false.
117 virtual void set_compute_potential(int i);
118
119 // Must return 1 if the density gradient must also be provided.
120 // The default implementation returns 0.
121 virtual int need_density_gradient();
122 // Must return 1 if the density hessian must also be provided.
123 // The default implementation returns 0.
124 virtual int need_density_hessian();
125
126 virtual void point(const PointInputData&, PointOutputData&) = 0;
127 void gradient(const PointInputData&, PointOutputData&,
128 double *gradient, int acenter,
129 GaussianBasisSet *basis,
130 const double *dmat_a, const double *dmat_b,
131 int ncontrib, const int *contrib,
132 int ncontrib_bf, const int *contrib_bf,
133 const double *bs_values, const double *bsg_values,
134 const double *bsh_values);
135
137 virtual double a0() const;
138
139 void fd_point(const PointInputData&, PointOutputData&);
140 int test(const PointInputData &);
141 int test();
142};
143
144
148 public:
150 NElFunctional(const Ref<KeyVal> &);
154
155 void point(const PointInputData&, PointOutputData&);
156};
157
161 protected:
162 int n_;
163 Ref<DenFunctional> *funcs_;
164 double *coefs_;
165 public:
198
199 void set_spin_polarized(int);
200 void set_compute_potential(int);
201 int need_density_gradient();
202
203 void point(const PointInputData&, PointOutputData&);
204
205 void print(std::ostream& =ExEnv::out0()) const;
206
209 double a0() const;
210};
211
285 protected:
286 std::string name_;
287 void init_arrays(int n);
288 public:
298
299 void print(std::ostream& =ExEnv::out0()) const;
300};
301
304 protected:
305 public:
311
312 void point(const PointInputData&, PointOutputData&);
313 virtual
314 void point_lc(const PointInputData&, PointOutputData&,
315 double &ec_local, double &decrs, double &deczeta) = 0;
316
317};
318
319
329 protected:
331 double gamma;
332 double beta;
333 void init_constants();
334 double rho_deriv(double rho_a, double rho_b, double mdr,
335 double ec_local, double ec_local_dra);
336 double gab_deriv(double rho, double phi, double mdr, double ec_local);
337 public:
343 int need_density_gradient();
344 void point(const PointInputData&, PointOutputData&);
345 void set_spin_polarized(int);
346
347};
348
360 protected:
362 double a;
363 double b;
364 double c;
365 double d;
366 double alpha;
367 double c_c0;
368 double c_x;
369 double nu;
370 void init_constants();
371 double limit_df_drhoa(double rhoa, double gamma,
372 double ec, double decdrhoa);
373
374 public:
380 int need_density_gradient();
381
382 void point(const PointInputData&, PointOutputData&);
383 void set_spin_polarized(int);
384
385};
386
394 protected:
395 double a_;
396 double C1_;
397 double C2_;
398 double C3_;
399 double C4_;
400 double C5_;
401 double C6_;
402 double C7_;
403 void init_constants();
404 public:
410 int need_density_gradient();
411 void point(const PointInputData&, PointOutputData&);
412
413};
414
415
416// The Perdew 1986 (P86) Correlation Functional computes energies and densities
417// using the designated local correlation functional.
419 protected:
420 double a_;
421 double C1_;
422 double C2_;
423 double C3_;
424 double C4_;
425 double C5_;
426 double C6_;
427 double C7_;
428 void init_constants();
429 double rho_deriv(double rho_a, double rho_b, double mdr);
430 double gab_deriv(double rho_a, double rho_b, double mdr);
431
432 public:
438 int need_density_gradient();
439 void point(const PointInputData&, PointOutputData&);
440};
441
446 protected:
447 public:
453 void point(const PointInputData&, PointOutputData&);
454};
455
464 protected:
465 double Ap_, Af_, A_alpha_;
466 double x0p_mc_, bp_mc_, cp_mc_, x0f_mc_, bf_mc_, cf_mc_;
467 double x0p_rpa_, bp_rpa_, cp_rpa_, x0f_rpa_, bf_rpa_, cf_rpa_;
468 double x0_alpha_mc_, b_alpha_mc_, c_alpha_mc_;
469 double x0_alpha_rpa_, b_alpha_rpa_, c_alpha_rpa_;
470 void init_constants();
471
472 double F(double x, double A, double x0, double b, double c);
473 double dFdr_s(double x, double A, double x0, double b, double c);
474 public:
480
481 virtual
482 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
483};
484
488 protected:
489 double x0p_, bp_, cp_, x0f_, bf_, cf_;
490 public:
494 VWN1LCFunctional(int use_rpa);
504
505 void point_lc(const PointInputData&, PointOutputData&,
506 double &, double &, double &);
507};
508
512 protected:
513 public:
521
522 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
523};
524
525
529 protected:
530 int monte_carlo_prefactor_;
531 int monte_carlo_e0_;
532 public:
533 VWN3LCFunctional(int mcp = 1, int mce0 = 1);
538
539 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
540};
541
545 protected:
546 int monte_carlo_prefactor_;
547 public:
553
554 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
555};
556
560 protected:
561 public:
567
568 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
569};
570
577 protected:
578 double F(double x, double A, double alpha_1, double beta_1, double beta_2,
579 double beta_3, double beta_4, double p);
580 double dFdr_s(double x, double A, double alpha_1, double beta_1, double beta_2,
581 double beta_3, double beta_4, double p);
582 public:
588
589 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
590};
591
598 protected:
599 double Fec_rsgt1(double rs, double beta_1, double beta_2, double gamma);
600 double dFec_rsgt1_drho(double rs, double beta_1, double beta_2, double gamma,
601 double &dec_drs);
602 double Fec_rslt1(double rs, double A, double B, double C, double D);
603 double dFec_rslt1_drho(double rs, double A, double B, double C, double D,
604 double &dec_drs);
605 public:
611
612 void point_lc(const PointInputData&, PointOutputData&, double &, double &, double &);
613};
614
617 protected:
618 double alpha_;
619 double factor_;
620 public:
626
627 void point(const PointInputData&, PointOutputData&);
628
629 void print(std::ostream& =ExEnv::out0()) const;
630};
631
637 protected:
638 double beta_;
639 double beta6_;
640 public:
646
647 int need_density_gradient();
648
649 void point(const PointInputData&, PointOutputData&);
650};
651
661 protected:
662 double a_;
663 double b_;
664 double c_;
665 double d_;
666 void init_constants();
667 public:
673
674 int need_density_gradient();
675
676 void point(const PointInputData&, PointOutputData&);
677};
678
684 protected:
685 double a_;
686 double b_;
687 double c_;
688 double m_;
689 void init_constants();
690 public:
696
697 int need_density_gradient();
698
699 void point(const PointInputData&, PointOutputData&);
700};
701
718 protected:
719 double mu;
720 double kappa;
721 void spin_contrib(const PointInputData::SpinData &,
722 double &mpw, double &dmpw_dr, double &dmpw_dg);
723 void init_constants();
724 public:
730
731 int need_density_gradient();
732
733 void point(const PointInputData&, PointOutputData&);
734};
735
747 protected:
748 double a;
749 double b;
750 double c;
751 double d;
752 double a_x;
753 void spin_contrib(const PointInputData::SpinData &,
754 double &mpw, double &dmpw_dr, double &dmpw_dg);
755 void init_constants();
756 public:
762
763 int need_density_gradient();
764
765 void point(const PointInputData&, PointOutputData&);
766};
767
773 protected:
774 double b;
775 double beta;
776 double c;
777 double d;
778 double a_x;
779 double x_d_coef;
780
781 void spin_contrib(const PointInputData::SpinData &,
782 double &mpw, double &dmpw_dr, double &dmpw_dg);
783 public:
784 enum Func { B88, PW91, mPW91 };
785
790 mPW91XFunctional(Func variant);
813
814 int need_density_gradient();
815
816 void point(const PointInputData&, PointOutputData&);
817
818 void init_constants(Func);
819};
820
826 protected:
827 double b_;
828 void init_constants();
829 public:
835
836 int need_density_gradient();
837
838 void point(const PointInputData&, PointOutputData&);
839};
840
841}
842
843#endif
844
845// Local Variables:
846// mode: c++
847// c-file-style: "CLJ"
848// End:
Implements Becke's 1988 exchange functional.
Definition functional.h:636
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
An abstract base class for density functionals.
Definition functional.h:97
virtual double a0() const
Returns the fraction of Hartee-Fock exchange to be included.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
static std::ostream & out0()
Return an ostream that writes from node 0.
Implements the Gill 1996 (G96) exchange functional.
Definition functional.h:825
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The GaussianBasisSet class is used describe a basis set composed of atomic gaussian orbitals.
Definition gaussbas.h:145
An abstract base class for local correlation functionals.
Definition functional.h:303
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the Lee, Yang, and Parr functional.
Definition functional.h:660
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The NElFunctional computes the number of electrons.
Definition functional.h:147
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition functional.h:418
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the Perdew 1986 (P86) correlation functional.
Definition functional.h:393
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the Perdew-Burke-Ernzerhof (PBE) correlation functional.
Definition functional.h:328
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the Perdew-Burke-Ernzerhof (PBE) exchange functional.
Definition functional.h:717
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the Perdew-Wang 1986 (PW86) Exchange functional.
Definition functional.h:683
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The Perdew-Wang 1991 correlation functional computes energies and densities using the designated loca...
Definition functional.h:359
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The Perdew-Wang 1991 exchange functional computes energies and densities using the designated local c...
Definition functional.h:746
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the PW92 local (LSDA) correlation term.
Definition functional.h:576
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Implements the PZ81 local (LSDA) correlation functional.
Definition functional.h:597
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
A template class that maintains references counts.
Definition ref.h:361
a 3-element version of SCVector
Definition vector3.h:44
Base class for objects that can save/restore state.
Definition state.h:45
Implements the Slater exchange functional.
Definition functional.h:445
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
The StdDenFunctional class is used to construct the standard density functionals.
Definition functional.h:284
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void print(std::ostream &=ExEnv::out0()) const
Print the object.
StdDenFunctional(const Ref< KeyVal > &)
The name keyword is read from the input and is used to initialize the functional.
The SumDenFunctional computes energies and densities using the a sum of energy density functions meth...
Definition functional.h:160
double a0() const
Override the DenFunctional::a0() member, so that a0's in contributing functionals can be added in as ...
void print(std::ostream &=ExEnv::out0()) const
Print the object.
SumDenFunctional(const Ref< KeyVal > &)
This KeyVal constructor reads the following keywords:
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The VWN1LCFunctional computes energies and densities using the VWN1 local correlation term (from Vosk...
Definition functional.h:487
VWN1LCFunctional(int use_rpa)
Construct a VWN1 functional using the RPA parameters.
VWN1LCFunctional()
Construct a VWN1 functional using Monte-Carlo parameters.
VWN1LCFunctional(const Ref< KeyVal > &)
Construct a VWN1 functional using the Monte-Carlo parameters by default.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The VWN2LCFunctional computes energies and densities using the VWN2 local correlation term (from Vosk...
Definition functional.h:511
VWN2LCFunctional(const Ref< KeyVal > &)
Construct a VWN2 functional.
VWN2LCFunctional()
Construct a VWN2 functional.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The VWN3LCFunctional computes energies and densities using the VWN3 local correlation term (from Vosk...
Definition functional.h:528
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The VWN4LCFunctional computes energies and densities using the VWN4 local correlation term (from Vosk...
Definition functional.h:544
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The VWN5LCFunctional computes energies and densities using the VWN5 local correlation term (from Vosk...
Definition functional.h:559
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
An abstract base class from which the various VWN (Vosko, Wilk and Nusair) local correlation function...
Definition functional.h:463
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition reftestx.h:32
Implements the Xalpha exchange functional.
Definition functional.h:616
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void print(std::ostream &=ExEnv::out0()) const
Print the object.
Definition reftestx.h:41
Implements a modified 1991 Perdew-Wang exchange functional.
Definition functional.h:772
mPW91XFunctional(Func variant)
Construct an mPW form exchange functional using the given functional variant.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
mPW91XFunctional(const Ref< KeyVal > &)
Construct an mPW form exchange functional.
mPW91XFunctional()
Construct an mPW exchange functional.
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
bool in(const std::pair< I, I > &r, const std::pair< I, I > &range)
return true if r is contained in range defined as pair<start,fence>, i.e. [start, fence)
Definition mtensor.h:58
Definition functional.h:49
Contains data needed at each point by a DenFunctional.
Definition functional.h:39
Contains data generated at each point by a DenFunctional.
Definition functional.h:79

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.