MADNESS 0.10.1
xcfunctional.h
Go to the documentation of this file.
1#ifndef MADNESS_CHEM_XCFUNCTIONAL_H__INCLUDED
2#define MADNESS_CHEM_XCFUNCTIONAL_H__INCLUDED
3
5
6MADNESS_PRAGMA_GCC(diagnostic push)
7MADNESS_PRAGMA_GCC(diagnostic ignored "-Wcomment")
8MADNESS_PRAGMA_CLANG(diagnostic push)
9MADNESS_PRAGMA_CLANG(diagnostic ignored "-Wcomment")
10
11/// \file moldft/xcfunctional.h
12/// \brief Defines interface for DFT XC functionals
13/// \ingroup chemistry
14
15#include <madness/tensor/tensor.h>
16#include <vector>
17#include <algorithm>
18#include <utility>
19#include <madness/mra/key.h>
22
23#ifdef MADNESS_HAS_LIBXC
24#include <xc.h>
25#endif
26
27namespace madness {
28/// Compute the spin-restricted LDA potential using unaryop (only for the initial guess)
31
32 void operator()(const Key<3> & key, Tensor<double>& t) const
33 {
34 int x_rks_s__(const double *r__, double *f, double * dfdra);
35 int c_rks_vwn5__(const double *r__, double *f, double * dfdra);
36 double* rho = t.ptr();
37 for (int i=0; i<t.size(); i++) {
38 double r = std::max(rho[i],1e-12);
39 double q, dq1, dq2;
40 x_rks_s__(&r, &q, &dq1);
41 c_rks_vwn5__(&r, &q, &dq2);
42 rho[i] = dq1 + dq2;
43 }
44 }
45};
46
47/// Simplified interface to XC functionals
49public:
50
51 /// The ordering of the intermediates is fixed, but the code can handle
52 /// non-initialized functions, so if e.g. no GGA is requested, all the
53 /// corresponding vector components may be left empty.
54 ///
55 /// Note the additional quantities \f$ \zeta \f$ and \f$ \chi \f$, which are defined as
56 /// \f[
57 /// \rho = \exp(\zeta)
58 /// \f]
59 /// and thus the derivative of rho is given by
60 /// \f[
61 /// \nabla_x\rho = \exp(\zeta)\nabla_x\zeta = \rho \nabla_x\zeta
62 /// \f]
63 /// The reduced gradients \sigma may then be expressed as
64 /// \f[
65 /// \sigma = |\nabla\rho|^2 = |\rho|^2 |\nabla\zeta|^2 = |\rho|^2 \chi
66 /// \f]
67 enum xc_arg {
68 enum_rhoa=0, ///< alpha density \f$ \rho_\alpha \f$
69 enum_rhob=1, ///< beta density \f$ \rho_\beta \f$
70 enum_rho_pt=2, ///< perturbed density (CPHF, TDKS) \f$ \rho_{pt} \f$
71 enum_saa=10, ///< \f$ \sigma_{aa} = \nabla \rho_{\alpha}.\nabla \rho_{\alpha} \f$
72 enum_sab=11, ///< \f$ \sigma_{ab} = \nabla \rho_{\alpha}.\nabla \rho_{\beta} \f$
73 enum_sbb=12, ///< \f$ \sigma_{bb} = \nabla \rho_{\beta}.\nabla \rho_{\beta} \f$
74 enum_sigtot=13, ///< \f$ \sigma = \nabla \rho.\nabla \rho \f$
75 enum_sigma_pta_div_rho=14, ///< \f$ \zeta_{\alpha}.\nabla\rho_{pt} \f$
76 enum_sigma_ptb_div_rho=15, ///< \f$ \zeta_{\beta}.\nabla\rho_{pt} \f$
77 enum_zetaa_x=16, ///< \f$ \zeta_{a,x}=\partial/{\partial x} \ln(\rho_a) \f$
78 enum_zetaa_y=17, ///< \f$ \zeta_{a,y}=\partial/{\partial y} \ln(\rho_a) \f$
79 enum_zetaa_z=18, ///< \f$ \zeta_{a,z}=\partial/{\partial z} \ln(\rho_a) \f$
80 enum_zetab_x=19, ///< \f$ \zeta_{b,x} = \partial/{\partial x} \ln(\rho_b) \f$
81 enum_zetab_y=20, ///< \f$ \zeta_{b,y} = \partial/{\partial y} \ln(\rho_b) \f$
82 enum_zetab_z=21, ///< \f$ \zeta_{b,z} = \partial/{\partial z} \ln(\rho_b) \f$
83 enum_chi_aa=22, ///< \f$ \chi_{aa} = \nabla \zeta_{\alpha}.\nabla \zeta_{\alpha} \f$
84 enum_chi_ab=23, ///< \f$ \chi_{ab} = \nabla \zeta_{\alpha}.\nabla \zeta_{\beta} \f$
85 enum_chi_bb=24, ///< \f$ \chi_{bb} = \nabla \zeta_{\beta}.\nabla \zeta_{\beta} \f$
86 enum_ddens_ptx=25, ///< \f$ \nabla\rho_{pt}\f$
87 enum_ddens_pty=26, ///< \f$ \nabla\rho_{pt}\f$
88 enum_ddens_ptz=27 ///< \f$ \nabla\rho_{pt}\f$
89 };
90 const static int number_xc_args=28; ///< max number of intermediates
91
92 /// return the munging threshold for the density
93 double get_rhotol() const {return rhotol;}
94
95 /// return the binary munging threshold for the final result in the GGA potential/kernel
96
97 /// the GGA potential will be munged based on the smallness of the original
98 /// density, which we call binary munging
99 double get_ggatol() const {return ggatol;}
100
101protected:
102
103 bool spin_polarized; ///< True if the functional is spin polarized
104 double hf_coeff; ///< Factor multiplying HF exchange (+1.0 gives HF)
105 double rhomin, rhotol; ///< See initialize and munge*
106 double ggatol; ///< See initialize and munge*
107
108#ifdef MADNESS_HAS_LIBXC
109 std::vector< std::pair<xc_func_type*,double> > funcs;
110#endif
111
112 /// convert the raw density (gradient) data to be used by the xc operators
113
114 /// Involves mainly munging of the densities and multiplying with 2
115 /// if the calculation is spin-restricted.
116 /// Response densities and density gradients are munged based on the
117 /// value of the ground state density, since they may become negative
118 /// and may also be much more diffuse.
119 /// dimensions of the output tensors are for spin-restricted and unrestricted
120 /// (with np the number of grid points in the box):
121 /// rho(np) or rho(2*np)
122 /// sigma(np) sigma(3*np)
123 /// rho_pt(np)
124 /// sigma_pt(2*np)
125 /// @param[in] t input density (gradients)
126 /// @param[out] rho ground state (spin) density, properly munged
127 /// @param[out] sigma ground state (spin) density gradients, properly munged
128 /// @param[out] rho_pt response density, properly munged (no spin)
129 /// @param[out] sigma_pt response (spin) density gradients, properly munged
130 /// @param[out] drho density derivative, constructed from rho and zeta
131 /// @param[out] drho_pt response density derivative directly from xc_args
132 /// @param[in] need_response flag if rho_pt and sigma_pt need to be calculated
133 void make_libxc_args(const std::vector< madness::Tensor<double> >& t,
138 std::vector<madness::Tensor<double> >& drho,
139 std::vector<madness::Tensor<double> >& drho_pt,
140 const bool need_response) const;
141
142 /// the number of xc kernel derivatives (lda: 0, gga: 1, etc)
144
145
146 /// Smoothly switches between constant (x<xmin) and linear function (x>xmax)
147
148 /// \f[
149 /// f(x,x_{\mathrm{min}},x_{\mathrm{max}}) = \left\{
150 /// \begin{array}{ll}
151 /// x_{\mathrm{min}} & x < x_{\mathrm{min}} \\
152 /// p(x,x_{\mathrm{min}},x_{\mathrm{max}}) & x_{\mathrm{min}} \leq x_{\mathrm{max}} \\
153 /// x & x_{\mathrm{max}} < x
154 /// \end{array}
155 /// \right.
156 /// \f]
157 /// where \f$p(x)\f$ is the unique quintic polynomial that
158 /// satisfies \f$p(x_{min})=x_{min}\f$, \f$p(x_{max})=x_{max}\f$,
159 /// \f$dp(x_{max})/dx=1\f$, and
160 /// \f$dp(x_{min})/dx=d^2p(x_{min})/dx^2=d^2p(x_{max})/dx^2=0\f$.
161 static void polyn(const double x, double& p, double& dpdx) {
162 // All of the static const stuff is evaluated at compile time
163
164 static const double xmin = 1.e-6; // <<<< MINIMUM VALUE OF DENSITY
165 static const double xmax = 5.e-5; // <<<< DENSITY SMOOTHLY MODIFIED BELOW THIS VALUE
166
167 static const double xmax2 = xmax*xmax;
168 static const double xmax3 = xmax2*xmax;
169 static const double xmin2 = xmin*xmin;
170 static const double xmin3 = xmin2*xmin;
171 static const double r = 1.0/((xmax-xmin)*(-xmin3+(3.0*xmin2+(-3.0*xmin+xmax)*xmax)*xmax));
172 static const double a0 = xmax3*xmin*(xmax-4.0*xmin)*r;
173 static const double a = xmin2*(xmin2+(-4.0*xmin+18.0*xmax)*xmax)*r;
174 static const double b = -6.0*xmin*xmax*(3.0*xmax+2.0*xmin)*r;
175 static const double c = (4.0*xmin2+(20.0*xmin+6.0*xmax)*xmax)*r;
176 static const double d = -(8.0*xmax+7.0*xmin)*r;
177 static const double e = 3.0*r;
178
179 if (x > xmax) {
180 p = x;
181 dpdx = 1.0;
182 }
183 else if (x < xmin) {
184 p = xmin;
185 dpdx = 0.0;
186 }
187 else {
188 p = a0+(a+(b+(c+(d+e*x)*x)*x)*x)*x;
189 dpdx = a+(2.0*b+(3.0*c+(4.0*d+5.0*e*x)*x)*x)*x;
190 }
191 }
192public:
193 static double munge_old(double rho) {
194 double p, dpdx;
195 polyn(rho, p, dpdx);
196 return p;
197 }
198
199private:
200
201 /// simple munging for the density only (LDA)
202 double munge(double rho) const {
203 if (rho <= rhotol) rho=rhomin;
204 return rho;
205 }
206
207 /// munge rho if refrho is small
208
209 /// special case for perturbed densities, which might be negative and diffuse.
210 /// Munge rho (e.g. the perturbed density) if the reference density refrho
211 /// e.g. the ground state density is small. Only where the reference density
212 /// is large enough DFT is numerically well-defined.
213 /// @param[in] rho number to be munged
214 /// @param[in] refrho reference value for munging
215 /// @param[in] thresh threshold for munging
216 double binary_munge(double rho, double refrho, const double thresh) const {
217 if (refrho<thresh) rho=rhomin;
218 return rho;
219 }
220
221public:
222 /// Default constructor is required
223 XCfunctional();
224
225 /// Initialize the object from the user input data
226
227 /// @param[in] input_line User input line (without beginning XC keyword)
228 /// @param[in] polarized Boolean flag indicating if the calculation is spin-polarized
229 void initialize(const std::string& input_line, bool polarized, World& world,
230 const bool verbose=false);
231
232 /// Destructor
234
235 /// Returns true if the potential is lda
236 bool is_lda() const;
237
238 /// Returns true if the potential is gga (needs first derivatives)
239 bool is_gga() const;
240
241 /// Returns true if the potential is meta gga (needs second derivatives ... not yet supported)
242 bool is_meta() const;
243
244 /// Returns true if there is a DFT functional (false probably means Hatree-Fock exchange only)
245 bool is_dft() const;
246
247 /// Returns true if the functional is spin_polarized
248 bool is_spin_polarized() const
249 {
250 return spin_polarized;
251 }
252
253 /// Returns true if the second derivative of the functional is available (not yet supported)
254 bool has_fxc() const;
255
256 /// Returns true if the third derivative of the functional is available (not yet supported)
257 bool has_kxc() const;
258
259 /// Returns the value of the hf exact exchange coefficient
261 {
262 return hf_coeff;
263 }
264
265 /// Computes the energy functional at given points
266
267 /// This uses the convention that the total energy is
268 /// \f$ E[\rho] = \int \epsilon[\rho(x)] dx\f$
269 /// Any HF exchange contribution must be separately computed. Items in the
270 /// vector argument \c t are interpreted similarly to the xc_arg enum.
271 /// @param[in] t The input densities and derivatives as required by the functional
272 /// @return The exchange-correlation energy functional
273 madness::Tensor<double> exc(const std::vector< madness::Tensor<double> >& t) const;
274
275 /// Computes components of the potential (derivative of the energy functional) at np points
276
277 /// Any HF exchange contribution must be separately computed. Items in the
278 /// vector argument \c t are interpreted similarly to the xc_arg enum.
279 ///
280 /// We define \f$ \sigma_{\mu \nu} = \nabla \rho_{\mu} . \nabla \rho_{\nu} \f$
281 /// with \f$ \mu, \nu = \alpha\f$ or \f$ \beta \f$.
282 ///
283 /// For unpolarized GGA, matrix elements of the potential are
284 /// \f[
285 /// < \phi | \hat V | \psi > = \int \left( \frac{\partial \epsilon}{\partial \rho} \phi \psi
286 /// + \left( 2 \frac{\partial \epsilon}{\partial \sigma} \right)
287 /// \nabla \rho \cdot \nabla \left( \phi \psi \right) \right) dx
288 /// \f]
289 ///
290 /// For polarized GGA, matrix elements of the potential are
291 /// \f[
292 /// < \phi_{\alpha} | \hat V | \psi_{\alpha} > = \int \left( \frac{\partial \epsilon}{\partial \rho_{\alpha}} \phi \psi
293 /// + \left( 2 \frac{\partial \epsilon}{\partial \sigma_{\alpha \alpha}} \nabla \rho_{\alpha}
294 /// + \frac{\partial \epsilon}{\partial \sigma_{\alpha \beta}} \nabla \rho_{\beta} \right) . \nabla \left( \phi \psi \right) \right) dx
295 /// \f]
296 ///
297 /// Integrating the above by parts and assuming free-space or periodic boundary conditions
298 /// we obtain that the local multiplicative form of the GGA potential is
299 /// \f[
300 /// V_{\alpha} = \frac{\partial \epsilon}{\partial \rho_{\alpha}}
301 /// - \left(\nabla . \left(2 \frac{\partial \epsilon}{\partial \sigma_{\alpha \alpha}} \nabla \rho_{\alpha}
302 /// + \frac{\partial \epsilon}{\partial \sigma_{\alpha \beta}} \nabla \rho_{\beta} \right) \right)
303 /// \f]
304 ///
305 /// Return the following quantities for RHF: (see Yanai2005, Eq. (12))
306 /// \f{eqnarray*}{
307 /// \mbox{result[0]} &:& \qquad \frac{\partial \epsilon}{\partial \rho} \\
308 /// \mbox{result[1-3]} &:& \qquad 2 \rho \frac{\partial \epsilon}{\partial \sigma} \nabla\rho
309 /// \f}
310 /// and for UHF same-spin and other-spin quantities
311 /// \f{eqnarray*}{
312 /// \mbox{result[0]} &:& \qquad \frac{\partial \epsilon}{\partial \rho_{\alpha}} \\
313 /// \mbox{result[1-3]} &:& \qquad \rho_\alpha \frac{\partial \epsilon}{\partial \sigma_{\alpha \alpha}} \nabla\rho_\alpha\\
314 /// \mbox{result[4-6]} &:& \qquad \rho_\alpha \frac{\partial \epsilon}{\partial \sigma_{\alpha \beta}} \nabla\rho_\beta
315 /// \f}
316 /// @param[in] t The input densities and derivatives as required by the functional
317 /// @param[in] ispin Specifies which component of the potential is to be computed as described above
318 /// @return the requested quantity, based on ispin (0: same spin, 1: other spin)
319 std::vector<madness::Tensor<double> > vxc(const std::vector< madness::Tensor<double> >& t,
320 const int ispin) const;
321
322
323 /// compute the second derivative of the XC energy wrt the density and apply
324
325 /// Return the following quantities (RHF only) (see Yanai2005, Eq. (13))
326 /// \f{eqnarray*}{
327 /// \mbox{result[0]} &:& \qquad \frac{\partial^2 \epsilon}{\partial \rho^2} \rho_\mathrm{pt}
328 /// + 2.0 * \frac{\partial^2 \epsilon}{\partial \rho\partial\sigma}\sigma_\mathrm{pt}\\
329 /// \mbox{result[1-3]} &:& \qquad 2.0 * \frac{\partial\epsilon}{\partial\sigma}\nabla\rho_\mathrm{pt}
330 /// + 2.0 * \frac{\partial^2\epsilon}{\partial\rho\partial\sigma} \rho_\mathrm{pt}\nabla\rho
331 /// + 4.0 * \frac{\partial^2\epsilon}{\partial^2\sigma} \sigma_\mathrm{pt}\nabla\rho
332 /// \f}
333 /// @param[in] t The input densities and derivatives as required by the functional,
334 /// as in the xc_arg enum
335 /// @param[in] ispin not referenced since only RHF is implemented, always 0
336 /// @return a vector of Functions containing the contributions to the kernel apply
337 std::vector<madness::Tensor<double> > fxc_apply(
338 const std::vector< madness::Tensor<double> >& t, const int ispin) const;
339
340
341 /// Crude function to plot the energy and potential functionals
342 void plot() const {
343 long npt = 1001;
344 double lo=1e-6, hi=1e+1, s=std::pow(hi/lo, 1.0/(npt-1));
345
347 for (int i=0; i<npt; i++) {
348 rho[i] = lo;
349 lo *= s;
350 }
351 std::vector< madness::Tensor<double> > t(13);
352 t[enum_rhoa]=(rho);
353 if (is_spin_polarized()) t[enum_rhob]=(rho);
354// if (is_gga()) t[enum_saa]=madness::Tensor<double>(npt); // sigma_aa=0
355 if (is_gga()) t[enum_saa]=0.5*rho; // sigma_aa=0
356 madness::Tensor<double> f = exc(t); //pending UGHHHHH
357 std::vector<madness::Tensor<double> > va = vxc(t,0);
358 for (long i=0; i<npt; i++) {
359 printf("%.3e %.3e %.3e\n", rho[i], f[i], va[0][i]);
360 }
361 }
362};
363
364/// Class to compute the energy functional
367
369
371 const std::vector< madness::Tensor<double> >& t) const {
373 return xc->exc(t);
374 }
375};
376
377
378/// Class to compute terms of the potential
381 const int ispin;
382
384 {}
385
386 std::size_t get_result_size() const {
387 // local terms, same spin
388 if (xc->is_lda()) return 1;
389 // local terms, 3x semilocal terms (x,y,z)
390 if (xc->is_gga() and (not xc->is_spin_polarized())) return 4;
391 // local terms, 3x semilocal terms (x,y,z) for same spin and opposite spin
392 if (xc->is_gga() and (xc->is_spin_polarized())) return 7;
393
394 MADNESS_EXCEPTION("only lda and gga in xc_potential_multi",1);
395 return 0;
396 }
397
398 std::vector<madness::Tensor<double> > operator()(const madness::Key<3> & key,
399 const std::vector< madness::Tensor<double> >& t) const {
401 std::vector<madness::Tensor<double> > r = xc->vxc(t, ispin);
402 return r;
403 }
404};
405
406
407/// Class to compute terms of the kernel
410 const int ispin;
412
414 cdata(FunctionCommonData<double,3>::get(FunctionDefaults<3>::get_k())) {
415 MADNESS_ASSERT(ispin==0); // closed shell only!
416 }
417
418 std::size_t get_result_size() const {
419 // all spin-restricted
420 if (xc->is_gga()) return 4; // local terms, 3x semilocal terms (x,y,z)
421 return 1; // local terms only
422 }
423
424 std::vector<madness::Tensor<double> > operator()(const madness::Key<3> & key,
425 const std::vector< madness::Tensor<double> >& t) const {
427 std::vector<madness::Tensor<double> > r = xc->fxc_apply(t, ispin);
428 return r;
429 }
430};
431
432}
433
434MADNESS_PRAGMA_CLANG(diagnostic pop)
435MADNESS_PRAGMA_GCC(diagnostic pop)
436
437#endif
double q(double t)
Definition DKops.h:18
This header should include pretty much everything needed for the parallel runtime.
long size() const
Returns the number of elements in the tensor.
Definition basetensor.h:138
FunctionCommonData holds all Function data common for given k.
Definition function_common_data.h:52
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:100
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:69
A tensor is a multidimensional array.
Definition tensor.h:317
T * ptr()
Returns a pointer to the internal data.
Definition tensor.h:1840
A parallel world class.
Definition world.h:132
Simplified interface to XC functionals.
Definition xcfunctional.h:48
bool has_fxc() const
Returns true if the second derivative of the functional is available (not yet supported)
Definition xcfunctional_ldaonly.cc:71
bool is_dft() const
Returns true if there is a DFT functional (false probably means Hatree-Fock exchange only)
Definition xcfunctional_ldaonly.cc:67
double rhomin
Definition xcfunctional.h:105
std::vector< madness::Tensor< double > > vxc(const std::vector< madness::Tensor< double > > &t, const int ispin) const
Computes components of the potential (derivative of the energy functional) at np points.
Definition xcfunctional_ldaonly.cc:123
bool is_lda() const
Returns true if the potential is lda.
Definition xcfunctional_ldaonly.cc:55
double get_ggatol() const
return the binary munging threshold for the final result in the GGA potential/kernel
Definition xcfunctional.h:99
double get_rhotol() const
return the munging threshold for the density
Definition xcfunctional.h:93
static const int number_xc_args
max number of intermediates
Definition xcfunctional.h:90
void plot() const
Crude function to plot the energy and potential functionals.
Definition xcfunctional.h:342
madness::Tensor< double > exc(const std::vector< madness::Tensor< double > > &t) const
Computes the energy functional at given points.
Definition xcfunctional_ldaonly.cc:81
bool is_spin_polarized() const
Returns true if the functional is spin_polarized.
Definition xcfunctional.h:248
xc_arg
Definition xcfunctional.h:67
@ enum_zetab_y
Definition xcfunctional.h:81
@ enum_zetab_z
Definition xcfunctional.h:82
@ enum_ddens_pty
Definition xcfunctional.h:87
@ enum_zetaa_y
Definition xcfunctional.h:78
@ enum_sigtot
Definition xcfunctional.h:74
@ enum_zetab_x
Definition xcfunctional.h:80
@ enum_rho_pt
perturbed density (CPHF, TDKS)
Definition xcfunctional.h:70
@ enum_chi_aa
Definition xcfunctional.h:83
@ enum_sbb
Definition xcfunctional.h:73
@ enum_saa
Definition xcfunctional.h:71
@ enum_rhob
beta density
Definition xcfunctional.h:69
@ enum_zetaa_x
Definition xcfunctional.h:77
@ enum_sab
Definition xcfunctional.h:72
@ enum_zetaa_z
Definition xcfunctional.h:79
@ enum_sigma_pta_div_rho
Definition xcfunctional.h:75
@ enum_chi_ab
Definition xcfunctional.h:84
@ enum_chi_bb
Definition xcfunctional.h:85
@ enum_sigma_ptb_div_rho
Definition xcfunctional.h:76
@ enum_ddens_ptx
Definition xcfunctional.h:86
@ enum_rhoa
alpha density
Definition xcfunctional.h:68
@ enum_ddens_ptz
Definition xcfunctional.h:88
bool is_meta() const
Returns true if the potential is meta gga (needs second derivatives ... not yet supported)
Definition xcfunctional_ldaonly.cc:63
static double munge_old(double rho)
Definition xcfunctional.h:193
bool is_gga() const
Returns true if the potential is gga (needs first derivatives)
Definition xcfunctional_ldaonly.cc:59
std::vector< madness::Tensor< double > > fxc_apply(const std::vector< madness::Tensor< double > > &t, const int ispin) const
compute the second derivative of the XC energy wrt the density and apply
Definition xcfunctional_ldaonly.cc:171
~XCfunctional()
Destructor.
Definition xcfunctional_ldaonly.cc:53
double hf_exchange_coefficient() const
Returns the value of the hf exact exchange coefficient.
Definition xcfunctional.h:260
double hf_coeff
Factor multiplying HF exchange (+1.0 gives HF)
Definition xcfunctional.h:104
void make_libxc_args(const std::vector< madness::Tensor< double > > &t, madness::Tensor< double > &rho, madness::Tensor< double > &sigma, madness::Tensor< double > &rho_pt, madness::Tensor< double > &sigma_pt, std::vector< madness::Tensor< double > > &drho, std::vector< madness::Tensor< double > > &drho_pt, const bool need_response) const
convert the raw density (gradient) data to be used by the xc operators
Definition xcfunctional_ldaonly.cc:176
double ggatol
See initialize and munge*.
Definition xcfunctional.h:106
static void polyn(const double x, double &p, double &dpdx)
Smoothly switches between constant (x<xmin) and linear function (x>xmax)
Definition xcfunctional.h:161
bool has_kxc() const
Returns true if the third derivative of the functional is available (not yet supported)
Definition xcfunctional_ldaonly.cc:76
bool spin_polarized
True if the functional is spin polarized.
Definition xcfunctional.h:103
void initialize(const std::string &input_line, bool polarized, World &world, const bool verbose=false)
Initialize the object from the user input data.
Definition xcfunctional_ldaonly.cc:23
XCfunctional()
Default constructor is required.
Definition xcfunctional_ldaonly.cc:19
double binary_munge(double rho, double refrho, const double thresh) const
munge rho if refrho is small
Definition xcfunctional.h:216
int nderiv
the number of xc kernel derivatives (lda: 0, gga: 1, etc)
Definition xcfunctional.h:143
double munge(double rho) const
simple munging for the density only (LDA)
Definition xcfunctional.h:202
double rhotol
See initialize and munge*.
Definition xcfunctional.h:105
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
const double sigma
Definition dielectric.cc:185
static double lo
Definition dirac-hatom.cc:23
Multidimension Key for MRA tree and associated iterators.
Macros and tools pertaining to the configuration of MADNESS.
#define MADNESS_PRAGMA_CLANG(x)
Definition madness_config.h:200
#define MADNESS_PRAGMA_GCC(x)
Definition madness_config.h:205
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
NDIM & f
Definition mra.h:2528
int x_rks_s__(const double *r__, double *f, double *dfdra)
Definition lda.cc:58
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
int c_rks_vwn5__(const double *r__, double *f, double *dfdra)
Definition lda.cc:116
static const double b
Definition nonlinschro.cc:119
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
static const double c
Definition relops.cc:10
static const double thresh
Definition rk.cc:45
Class to compute the energy functional.
Definition xcfunctional.h:365
xc_functional(const XCfunctional &xc)
Definition xcfunctional.h:368
madness::Tensor< double > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition xcfunctional.h:370
const XCfunctional * xc
Definition xcfunctional.h:366
Class to compute terms of the kernel.
Definition xcfunctional.h:408
const FunctionCommonData< double, 3 > & cdata
Definition xcfunctional.h:411
const int ispin
Definition xcfunctional.h:410
std::size_t get_result_size() const
Definition xcfunctional.h:418
std::vector< madness::Tensor< double > > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition xcfunctional.h:424
const XCfunctional * xc
Definition xcfunctional.h:409
xc_kernel_apply(const XCfunctional &xc, int ispin)
Definition xcfunctional.h:413
Compute the spin-restricted LDA potential using unaryop (only for the initial guess)
Definition xcfunctional.h:29
void operator()(const Key< 3 > &key, Tensor< double > &t) const
Definition xcfunctional.h:32
xc_lda_potential()
Definition xcfunctional.h:30
Class to compute terms of the potential.
Definition xcfunctional.h:379
xc_potential(const XCfunctional &xc, int ispin)
Definition xcfunctional.h:383
std::size_t get_result_size() const
Definition xcfunctional.h:386
const XCfunctional * xc
Definition xcfunctional.h:380
std::vector< madness::Tensor< double > > operator()(const madness::Key< 3 > &key, const std::vector< madness::Tensor< double > > &t) const
Definition xcfunctional.h:398
const int ispin
Definition xcfunctional.h:381
void e()
Definition test_sig.cc:75