|
MADNESS 0.10.1
|
operator class for the handling of DFT exchange-correlation functionals More...
#include <SCFOperators.h>


Classes | |
| struct | expme |
| simple structure to take the pointwise exponential of a function, shifted by +14 More... | |
| struct | logme |
| simple structure to take the pointwise logarithm of a function, shifted by +14 More... | |
Public Types | |
| enum class | TauU1 { mra , pointwise } |
| compute the kinetic energy density and add it to the intermediates More... | |
| Public Types inherited from madness::SCFOperatorBase< T, NDIM > | |
| typedef Function< T, NDIM > | functionT |
| typedef Tensor< T > | tensorT |
| typedef std::vector< functionT > | vecfuncT |
Public Member Functions | |
| XCOperator (World &world) | |
| default ctor without information about the XC functional | |
| XCOperator (World &world, const Nemo *nemo, int ispin=0) | |
| ctor with a Nemo calculation, will initialize the necessary intermediates | |
| XCOperator (World &world, const Nemo *scf, const real_function_3d &arho, const real_function_3d &brho, int ispin=0) | |
| ctor with an Nemo calculation, will initialize the necessary intermediates | |
| XCOperator (World &world, const SCF *scf, const real_function_3d &arho, const real_function_3d &brho, int ispin=0, std::string deriv="abgv") | |
| ctor with an SCF calculation, will initialize the necessary intermediates | |
| XCOperator (World &world, const SCF *scf, int ispin=0, std::string deriv="abgv") | |
| ctor with an SCF calculation, will initialize the necessary intermediates | |
| XCOperator (World &world, std::shared_ptr< XCfunctional > xc, const bool spin_polarized, int ispin, int nbeta, const real_function_3d &arho, const real_function_3d &brho, std::string deriv="abgv") | |
| custom ctor with the XC functional | |
| XCOperator (World &world, std::string xc_data, const bool spin_polarized, const real_function_3d &arho, const real_function_3d &brho, std::shared_ptr< NuclearCorrelationFactor > ncf_, const real_function_3d &arho_reg_, const real_function_3d &brho_reg_, std::string deriv="abgv") | |
| ctor for the regularized (nemo) path, without a Nemo object | |
| XCOperator (World &world, std::string xc_data, const bool spin_polarized, const real_function_3d &arho, const real_function_3d &brho, std::string deriv="abgv") | |
| custom ctor with information about the XC functional | |
| XCOperator & | allow_weak_form () |
| opt in to the weak form, if the xc_weak_gga parameter asks for it | |
| std::vector< Function< T, NDIM > > | apply_tau_term (const std::vector< Function< T, NDIM > > &vket) const |
| apply the non-multiplicative meta-gga term on a set of orbitals | |
| 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 | |
| double | compute_xc_energy () const |
| compute the xc energy using the precomputed intermediates vf and delrho | |
| const vecfuncT & | get_semilocal_flux () const |
| the semilocal flux X = 2 (de/dsigma_ss) grad(rho_s) + (de/dsigma_ab) grad(rho_s') | |
| real_function_3d | get_tau (const int spin=0) const |
| the kinetic energy density of one spin channel, as set by set_tau() | |
| real_function_3d | get_vlocal () const |
| the multiplicative part of the potential, as make_xc_potential() returned it | |
| real_function_3d | get_vtau () const |
| de/dtau, as computed by make_xc_potential() | |
| bool | has_tau_term () const |
| true if the functional contributes a non-multiplicative (meta-gga) term | |
| std::string | info () const |
| print some information about this operator | |
| bool | is_weak_form () const |
| real_function_3d | make_xc_potential () const |
| return the local xc potential | |
| T | operator() (const Function< T, NDIM > &bra, const Function< T, NDIM > &ket) const |
| the xc contribution to the Fock matrix, as a matrix element | |
| Function< T, NDIM > | operator() (const Function< T, NDIM > &ket) const |
| apply the xc potential on an orbitals | |
| Tensor< T > | operator() (const std::vector< Function< T, NDIM > > &vbra, const std::vector< Function< T, NDIM > > &vket) const |
| the xc contribution to the Fock matrix | |
| std::vector< Function< T, NDIM > > | operator() (const std::vector< Function< T, NDIM > > &vket) const |
| apply the xc potential on a set of orbitals | |
| XCOperator & | set_extra_truncation (const double &fac) |
| void | set_ispin (const int i) const |
| set the spin state this operator is acting on | |
| XCOperator & | set_print_level (const int p) |
| print the meta-gga de/dtau range each time the operator is applied | |
| void | set_tau (const vecfuncT &amo, const Tensor< double > &aocc, const vecfuncT &bmo=vecfuncT(), const Tensor< double > &bocc=Tensor< double >(), const TauU1 u1mode=TauU1::pointwise) const |
| compute tau = 1/2 sum_i |grad psi_i|^2 and store it in the intermediates | |
| XCOperator & | set_weak_gga (const bool flag) |
| override CalculationParameters::xc_weak_gga(), for callers without one | |
| void | weak_xc_terms (const std::vector< Function< T, NDIM > > &vket, std::vector< Function< T, NDIM > > &mult, std::vector< std::vector< Function< T, NDIM > > > &flux) const |
| weak-form split of the non-multiplicative xc terms | |
| Public Member Functions inherited from madness::SCFOperatorBase< T, NDIM > | |
| SCFOperatorBase ()=default | |
| SCFOperatorBase (std::shared_ptr< MacroTaskQ > taskq) | |
| virtual | ~SCFOperatorBase () |
| 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 | |
Public Attributes | |
| std::shared_ptr< XCfunctional > | xc |
| interface to the actual XC functionals | |
| Public Attributes inherited from madness::SCFOperatorBase< T, NDIM > | |
| nlohmann::json | statistics |
| std::shared_ptr< MacroTaskQ > | taskq =0 |
Private Member Functions | |
| real_function_3d | div_dft_deriv (const vecfuncT &v) const |
| divergence of a vector field, honouring dft_deriv | |
| bool | has_tau_args () const |
| true once set_tau() has supplied tau, by either route | |
| bool | is_initialized () const |
| check if the intermediates are initialized | |
| std::shared_ptr< Derivative< T, NDIM > > | make_derivative (const int axis) const |
| gradient operator honouring dft_deriv, for the meta-gga term | |
| nemo_u1_functors | make_u1_functors () const |
| the four analytic U1 quantities the xc ops evaluate pointwise | |
| real_function_3d | make_xc_potential_impl () const |
| the body of make_xc_potential(); the wrapper only stashes vlocal | |
| vecfuncT | prep_xc_args (const real_function_3d &arho, const real_function_3d &brho, const real_function_3d &arho_reg=real_function_3d(), const real_function_3d &brho_reg=real_function_3d()) const |
| compute the intermediates for the XC functionals | |
| 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 | |
Private Attributes | |
| std::string | dft_deriv |
| which derivative operator to use | |
| double | extra_truncation |
| additional truncation for the densities in the XC kernel | |
| int | ispin |
| the XC functionals depend on the spin of the orbitals they act on | |
| int | nbeta |
| number of beta orbitals | |
| std::shared_ptr< NuclearCorrelationFactor > | ncf |
| the nuclear correlation factor, if it exists, for computing derivatives for GGA | |
| int | print_level =0 |
| print level; >=2 logs the meta-gga de/dtau range | |
| vecfuncT | semilocal_flux |
| the semilocal flux, assigned by make_xc_potential() in weak form only | |
| real_function_3d | vlocal |
| the multiplicative potential, stashed by make_xc_potential() | |
| real_function_3d | vtau |
| de/dtau, the prefactor of the non-multiplicative meta-gga term | |
| bool | weak_form_ok =false |
| caller has opted in to the weak form, see allow_weak_form() | |
| bool | weak_gga =false |
| the user asked for the weak form: CalculationParameters::xc_weak_gga() | |
| World & | world |
| the world | |
| vecfuncT | xc_args |
| functions that are need for the computation of the XC operator | |
operator class for the handling of DFT exchange-correlation functionals
|
strong |
compute the kinetic energy density and add it to the intermediates
tau is orbital-dependent, so unlike the density it cannot be recovered from what the ctors are given – it has to be supplied separately. Call this after construction and before make_xc_potential() whenever has_tau_term() is true; make_xc_potential() throws otherwise. The occupation numbers are required, not optional: amo/bmo may carry virtual orbitals (occupation zero), which contribute nothing to the density but would inflate an unweighted sum of |grad psi|^2, and occupations may be fractional.
| [in] | amo | alpha orbitals (nemos if a nuclear correlation factor is set) |
| [in] | aocc | occupation numbers of amo |
| [in] | bmo | beta orbitals, ignored if the calculation is spin-restricted |
| [in] | bocc | occupation numbers of bmo how the two U1 terms of tau's product rule are evaluated U1 = -grad(R)/R is analytic but componentwise non-smooth at each nucleus (U1_x ~ x/r), so carrying it as an MRA Function costs depth ~18 and every product with it inherits that depth – which refine_to_common_level then imposes on every xc intermediate. |
| Enumerator | |
|---|---|
| mra | U1 and |U1|^2 projected into Functions and multiplied. |
| pointwise | U1 evaluated from its functor at the orbital tree's quadrature points; nothing involving it is projected |
|
inline |
default ctor without information about the XC functional
References extra_truncation, ispin, nbeta, and world.
Referenced by allow_weak_form(), set_extra_truncation(), set_print_level(), and set_weak_gga().
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| std::string | xc_data, | ||
| const bool | spin_polarized, | ||
| const real_function_3d & | arho, | ||
| const real_function_3d & | brho, | ||
| std::string | deriv = "abgv" ) |
custom ctor with information about the XC functional
References dft_deriv, extra_truncation, ispin, nbeta, madness::Function< T, NDIM >::norm2(), prep_xc_args(), world, xc, and xc_args.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| std::shared_ptr< XCfunctional > | xc, | ||
| const bool | spin_polarized, | ||
| int | ispin, | ||
| int | nbeta, | ||
| const real_function_3d & | arho, | ||
| const real_function_3d & | brho, | ||
| std::string | deriv = "abgv" ) |
custom ctor with the XC functional
References dft_deriv, extra_truncation, ispin, nbeta, prep_xc_args(), world, xc, and xc_args.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| const SCF * | scf, | ||
| int | ispin = 0, | ||
| std::string | deriv = "abgv" ) |
ctor with an SCF calculation, will initialize the necessary intermediates
References madness::SCF::amo, madness::SCF::aocc, madness::SCF::bmo, madness::SCF::bocc, dft_deriv, extra_truncation, ispin, madness::SCF::make_density(), madness::CalculationParameters::nbeta(), nbeta, madness::SCF::param, prep_xc_args(), madness::CalculationParameters::spin_restricted(), world, madness::CalculationParameters::xc(), xc, and xc_args.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| const Nemo * | nemo, | ||
| int | ispin = 0 ) |
ctor with a Nemo calculation, will initialize the necessary intermediates
References dft_deriv, extra_truncation, ispin, madness::nemo, param, weak_gga, world, and xc.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| std::string | xc_data, | ||
| const bool | spin_polarized, | ||
| const real_function_3d & | arho, | ||
| const real_function_3d & | brho, | ||
| std::shared_ptr< NuclearCorrelationFactor > | ncf_, | ||
| const real_function_3d & | arho_reg_, | ||
| const real_function_3d & | brho_reg_, | ||
| std::string | deriv = "abgv" ) |
ctor for the regularized (nemo) path, without a Nemo object
custom ctor for the regularized (nemo) path, without a Nemo object
| [in] | arho,brho | the physical densities rho_s |
| [in] | ncf_ | the nuclear correlation factor |
| [in] | arho_reg,brho_reg | the regularized densities rho_s/R^2, which let prep_xc_args build zeta without putting the nuclear cusp under a numerical derivative |
References dft_deriv, extra_truncation, ispin, nbeta, ncf, madness::Function< T, NDIM >::norm2(), prep_xc_args(), world, xc, and xc_args.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| const SCF * | scf, | ||
| const real_function_3d & | arho, | ||
| const real_function_3d & | brho, | ||
| int | ispin = 0, | ||
| std::string | deriv = "abgv" ) |
ctor with an SCF calculation, will initialize the necessary intermediates
References dft_deriv, extra_truncation, ispin, nbeta, madness::SCF::param, param, prep_xc_args(), madness::CalculationParameters::spin_restricted(), world, madness::CalculationParameters::xc(), xc, and xc_args.
| madness::XCOperator< T, NDIM >::XCOperator | ( | World & | world, |
| const Nemo * | scf, | ||
| const real_function_3d & | arho, | ||
| const real_function_3d & | brho, | ||
| int | ispin = 0 ) |
ctor with an Nemo calculation, will initialize the necessary intermediates
|
inline |
opt in to the weak form, if the xc_weak_gga parameter asks for it
Load-bearing: in weak form make_xc_potential() returns only de/drho, so a caller that does not also apply weak_xc_terms() and add the matrix form's contribution (operator()(vbra,vket)) would silently drop the whole semilocal contribution and return a plausible but wrong energy. Only Nemo::compute_nemo_potentials implements the split, so only it opts in; SCF, OEP, TDHF and the response kernels keep the multiplicative potential.
References XCOperator(), and weak_form_ok.
Referenced by madness::Nemo::compute_nemo_potentials_impl(), and test_XCOperator_matrix().
| std::vector< Function< T, NDIM > > madness::XCOperator< T, NDIM >::apply_tau_term | ( | const std::vector< Function< T, NDIM > > & | vket | ) | const |
apply the non-multiplicative meta-gga term on a set of orbitals
apply the non-multiplicative meta-gga term, -1/2 sum_x D_x(vtau D_x psi_i)
![\[ \hat v_\tau \psi_i = -\frac{1}{2}\nabla\cdot
\left(\frac{\partial e_{xc}}{\partial\tau_\sigma}\nabla\psi_i\right)
\]](form_354.png)
evaluated as 




References madness::add(), madness::apply(), axis, madness::FunctionDefaults< NDIM >::refine, madness::FunctionDefaults< NDIM >::get_cell_width(), madness::FunctionDefaults< NDIM >::get_thresh(), has_tau_term(), L, lo, MADNESS_CHECK_THROW, make_derivative(), madness::Tensor< T >::max(), madness::mul(), madness::mul_sparse(), ncf, madness::print(), print_level, madness::scale(), madness::sub(), madness::truncate(), v, vtau, world, and madness::zero_functions_compressed().
Referenced by madness::Nemo::compute_nemo_potentials_impl(), operator()(), and operator()().
| real_function_3d madness::XCOperator< T, NDIM >::apply_xc_kernel | ( | const real_function_3d & | dens_pt, |
| const vecfuncT | grad_dens_pt = vecfuncT() ) const |
construct the xc kernel and apply it directly on the (response) density
apply the xc kernel on a perturbed density
the xc kernel is the second derivative of the xc functions wrt the density
| [in] | density | the (response) density on which the kernel is applied |
cf Eq. (13) of T. Yanai, R. J. Harrison, and N. Handy, “Multiresolution quantum chemistry in multiwavelet bases: time-dependent density functional theory with asymptotically corrected potentials in local density and generalized gradient approximations,” Mol. Phys., vol. 103, no. 2, pp. 413–424, 2005.
the application of the xc kernel is (RHF only)
![\[ \frac{\partial^2E_{xc}}{\partial \rho_\alpha^2}\circ\tilde\rho
= second_{local} + second_{semilocal} + first_{semilocal}
\]](form_350.png)
where the second partial derivatives are
![\[ second_{local} = \frac{\partial^2 f_{xc}}{\partial \rho_\alpha^2}\tilde \rho
+ 2\frac{\partial^2 f_{xc}}{\partial \rho_\alpha\sigma_{\alpha\alpha}}
\left(\vec\nabla \rho_a\cdot \vec \nabla\tilde\rho\right)
\]](form_351.png)
the second partial derivatives that need to be multiplied with the density gradients
![\[ second_{semilocal} = -\vec\nabla\cdot\left((\vec\nabla\rho)
\left[2\frac{\partial^2 f_{xc}}{\partial\rho_\alpha\partial\sigma_{\alpha\alpha}}\tilde\rho
+ 4\frac{\partial^2 f_{xc}}{\partial\sigma_{\alpha\alpha}^2}
\left(\vec\nabla\rho_\alpha\cdot\vec\nabla\tilde\rho\right)\right]\right)
\]](form_352.png)
and the first derivatives that need to be multiplied with the density gradients
![\[ first_{semilocal} =
-\vec\nabla\cdot\left(2\frac{\partial f_{xc}}{\partial\sigma_{\alpha\alpha}}\vec\nabla\tilde\rho\right)
\]](form_353.png)
References div_dft_deriv(), is_initialized(), ispin, MADNESS_ASSERT, MADNESS_EXCEPTION, madness::multi_to_multi_op_values(), op(), prep_xc_args_response(), madness::refine_to_common_level(), madness::Function< T, NDIM >::truncate(), madness::truncate(), world, xc, and xc_args.
| double madness::XCOperator< T, NDIM >::compute_xc_energy | ( | ) | const |
compute the xc energy using the precomputed intermediates vf and delrho
References has_tau_args(), has_tau_term(), is_initialized(), MADNESS_EXCEPTION, make_u1_functors(), madness::multiop_values(), madness::refine_to_common_level(), madness::Function< T, NDIM >::trace(), madness::truncate(), world, xc, and xc_args.
Referenced by madness::Nemo::compute_energy_regularized(), and test_XCOperator().
|
private |
divergence of a vector field, honouring dft_deriv
divergence of a real vector field, honouring dft_deriv
vmra.h's div() is div_abgv(), so a caller that has selected dft_deriv bspline/ble has to name the matching derivative explicitly.
References madness::abgv, madness::ble, madness::bspline, dft_deriv, madness::div_deriv(), and v.
Referenced by apply_xc_kernel(), and make_xc_potential_impl().
|
inline |
the semilocal flux X = 2 (de/dsigma_ss) grad(rho_s) + (de/dsigma_ab) grad(rho_s')
Only assigned in weak form, by make_xc_potential(). Same-spin and cross-spin contributions are summed: they enter as a single divergence.
References semilocal_flux.
| real_function_3d madness::XCOperator< T, NDIM >::get_tau | ( | const int | spin = 0 | ) | const |
the kinetic energy density of one spin channel, as set by set_tau()
exposed for diagnostics and for the exact check int(tau) == T
References madness::XCfunctional::enum_taua, madness::XCfunctional::enum_taub, and xc_args.
Referenced by test_meta_gga().
|
inline |
the multiplicative part of the potential, as make_xc_potential() returned it
References vlocal.
|
inline |
de/dtau, as computed by make_xc_potential()
References vtau.
|
private |
true once set_tau() has supplied tau, by either route
References madness::XCfunctional::enum_gradfa, madness::XCfunctional::enum_nemo_R2, madness::XCfunctional::enum_taua, is_initialized(), and xc_args.
Referenced by compute_xc_energy(), and make_xc_potential_impl().
| bool madness::XCOperator< T, NDIM >::has_tau_term | ( | ) | const |
true if the functional contributes a non-multiplicative (meta-gga) term
References xc.
Referenced by apply_tau_term(), madness::Nemo::compute_energy_regularized(), madness::Nemo::compute_nemo_potentials_impl(), compute_xc_energy(), madness::Nemo::make_fock_operator(), make_xc_potential_impl(), operator()(), operator()(), and weak_xc_terms().
|
inlinevirtual |
print some information about this operator
Implements madness::SCFOperatorBase< T, NDIM >.
|
inlineprivate |
check if the intermediates are initialized
References xc_args.
Referenced by apply_xc_kernel(), compute_xc_energy(), has_tau_args(), make_u1_functors(), make_xc_potential_impl(), and set_tau().
| bool madness::XCOperator< T, NDIM >::is_weak_form | ( | ) | const |
true if this operator is running in weak form, i.e. make_xc_potential() returns only de/drho and the flux is carried separately Requires both the caller's allow_weak_form() opt-in and the user's xc_weak_gga parameter. A functional with no sigma dependence has no flux, so it is never in weak form either.
Why it exists: the semilocal potential is -div(X) with X = 2 de/dsigma grad(rho), and X has a jump at every nucleus (zeta = grad log rho -> -2Z r_hat, whose Cartesian components flip sign across the origin). Differentiating that jump is what produces the +-8e4 excursions, and no rearrangement of the multiplicative form avoids it, because div(X) is a derivative of X.
The weak form never differentiates X: <phi|v|psi> = int (df/drho) phi psi + int X . grad(phi psi) and in a Green's-function code the same holds for the orbital update, because a radial convolution commutes with the gradient: G * (psi div X) = div(G * (X psi)) - G * (X . grad psi) so the divergence acts on G*(X psi), which is C^1, and the jump is only ever convolved. Same for the meta-gga term -1/2 div(v_tau grad psi).
References weak_form_ok, weak_gga, and xc.
Referenced by madness::Nemo::compute_nemo_potentials_impl(), make_xc_potential_impl(), operator()(), test_XCOperator_matrix(), and weak_xc_terms().
|
private |
gradient operator honouring dft_deriv, for the meta-gga term
gradient operator for the meta-gga term, honouring dft_deriv
References axis, dft_deriv, and world.
Referenced by apply_tau_term(), operator()(), and weak_xc_terms().
|
private |
the four analytic U1 quantities the xc ops evaluate pointwise
Empty unless the pointwise route is in use. They are handed to the op rather than projected into xc_args precisely because a projected product with U1 is what rings; see nemo_u1_functors.
References axis, madness::XCfunctional::enum_gradfa, madness::f, is_initialized(), ncf, and xc_args.
Referenced by compute_xc_energy(), and make_xc_potential_impl().
| real_function_3d madness::XCOperator< T, NDIM >::make_xc_potential | ( | ) | const |
return the local xc potential
A thin wrapper whose only job is to stash the result: operator()(vbra,vket) needs whatever the caller got, with no argument to receive it through.
References make_xc_potential_impl(), and vlocal.
Referenced by madness::Nemo::compute_nemo_potentials_impl(), madness::Nemo::make_fock_operator(), operator()(), and test_XCOperator().
|
private |
the body of make_xc_potential(); the wrapper only stashes vlocal
References madness::copy(), div_dft_deriv(), has_tau_args(), has_tau_term(), is_initialized(), is_weak_form(), ispin, MADNESS_EXCEPTION, make_u1_functors(), madness::multi_to_multi_op_values(), nbeta, op(), madness::refine_to_common_level(), semilocal_flux, madness::Function< T, NDIM >::truncate(), madness::truncate(), vtau, world, xc, and xc_args.
Referenced by make_xc_potential().
|
inlinevirtual |
the xc contribution to the Fock matrix, as a matrix element
The 1x1 case of the vector form below; the same bra convention applies.
Implements madness::SCFOperatorBase< T, NDIM >.
References operator()().
|
inlinevirtual |
apply the xc potential on an orbitals
Implements madness::SCFOperatorBase< T, NDIM >.
References operator()().
| Tensor< T > madness::XCOperator< T, NDIM >::operator() | ( | const std::vector< Function< T, NDIM > > & | vbra, |
| const std::vector< Function< T, NDIM > > & | vket ) const |
the xc contribution to the Fock matrix
With a nuclear correlation factor the bra must carry R^2 – call it as xcoperator(R2nemo, nemo), the way Kinetic is called in Nemo::compute_fock_matrix. Without one, bra and ket are the same orbitals.
See the declaration for the bra convention – vbra carries R^2, vket does not.
References madness::apply(), apply_tau_term(), axis, madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), has_tau_term(), is_weak_form(), MADNESS_CHECK_THROW, make_derivative(), madness::matrix_inner(), madness::mul_sparse(), ncf, madness::norm2(), one(), semilocal_flux, madness::transpose(), vlocal, weak_xc_terms(), and world.
| std::vector< Function< T, NDIM > > madness::XCOperator< T, NDIM >::operator() | ( | const std::vector< Function< T, NDIM > > & | vket | ) | const |
apply the xc potential on a set of orbitals
References apply_tau_term(), madness::FunctionDefaults< NDIM >::get_thresh(), has_tau_term(), make_xc_potential(), madness::mul_sparse(), and world.
Referenced by operator()(), and operator()().
|
private |
compute the intermediates for the XC functionals
prepare xc args
| [in] | arho | density of the alpha orbitals |
| [in] | brho | density of the beta orbitals (necessary only if spin-polarized) |
References axis, madness::copy(), dft_deriv, madness::XCfunctional::enum_rhoa, madness::XCfunctional::enum_rhob, madness::XCfunctional::enum_zetaa_x, madness::XCfunctional::enum_zetaa_y, madness::XCfunctional::enum_zetaa_z, madness::XCfunctional::enum_zetab_x, madness::XCfunctional::enum_zetab_y, madness::XCfunctional::enum_zetab_z, extra_truncation, madness::f, madness::grad(), madness::grad_ble_one(), madness::grad_bspline_one(), nbeta, ncf, madness::XCfunctional::number_xc_args, madness::Function< T, NDIM >::reconstruct(), madness::truncate(), madness::unary_op(), madness::Function< T, NDIM >::world(), world, xc, and zeta.
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), and XCOperator().
|
private |
compute the intermediates for the XC functionals
add intermediates for the response kernels to xc_args
| [in] | dens_pt | perturbed densities from CPHF or TDDFT equations |
| [in,out] | xc_args | vector of intermediates as described above |
| [out] | ddens_pt | xyz-derivatives of dens_pt |
References madness::dot(), madness::XCfunctional::enum_ddens_ptx, madness::XCfunctional::enum_ddens_pty, madness::XCfunctional::enum_ddens_ptz, madness::XCfunctional::enum_rho_pt, madness::XCfunctional::enum_sigma_pta_div_rho, madness::XCfunctional::enum_sigma_ptb_div_rho, madness::XCfunctional::enum_zetaa_x, madness::XCfunctional::enum_zetaa_y, madness::XCfunctional::enum_zetaa_z, madness::XCfunctional::enum_zetab_x, madness::XCfunctional::enum_zetab_y, madness::XCfunctional::enum_zetab_z, extra_truncation, madness::grad(), nbeta, madness::print(), madness::truncate(), madness::Function< T, NDIM >::world(), world, xc, xc_args, and zeta.
Referenced by apply_xc_kernel().
|
inline |
References XCOperator(), extra_truncation, madness::print(), and world.
|
inline |
|
inline |
print the meta-gga de/dtau range each time the operator is applied
References XCOperator(), p(), and print_level.
| void madness::XCOperator< T, NDIM >::set_tau | ( | const vecfuncT & | amo, |
| const Tensor< double > & | aocc, | ||
| const vecfuncT & | bmo = vecfuncT(), | ||
| const Tensor< double > & | bocc = Tensor<double>(), | ||
| const TauU1 | u1mode = TauU1::pointwise ) const |
compute tau = 1/2 sum_i |grad psi_i|^2 and store it in the intermediates
< sum_i w_i |grad F_i|^2
< sum_i w_i F_i^2
< sum_i w_i F_i dF_i/dx_a = 1/2 grad(n)
References madness::apply(), axis, beta, madness::FunctionFactory< T, NDIM >::compressed(), madness::copy(), D, dft_deriv, madness::dot(), madness::XCfunctional::enum_Ga_x, madness::XCfunctional::enum_Ga_y, madness::XCfunctional::enum_Ga_z, madness::XCfunctional::enum_Gb_x, madness::XCfunctional::enum_Gb_y, madness::XCfunctional::enum_Gb_z, madness::XCfunctional::enum_gradfa, madness::XCfunctional::enum_gradfb, madness::XCfunctional::enum_na, madness::XCfunctional::enum_nb, madness::XCfunctional::enum_nemo_R2, madness::XCfunctional::enum_taua, madness::XCfunctional::enum_taub, extra_truncation, madness::FunctionFactory< T, NDIM >::functor(), is_initialized(), MADNESS_CHECK_THROW, madness::mo, mra, nbeta, ncf, p(), pointwise, madness::Function< T, NDIM >::truncate(), madness::FunctionFactory< T, NDIM >::truncate_on_project(), w(), world, xc, and xc_args.
Referenced by madness::Nemo::compute_energy_regularized(), madness::Nemo::compute_nemo_potentials_impl(), and test_meta_gga().
|
inline |
override CalculationParameters::xc_weak_gga(), for callers without one
References XCOperator(), and weak_gga.
Referenced by test_XCOperator_matrix().
| void madness::XCOperator< T, NDIM >::weak_xc_terms | ( | const std::vector< Function< T, NDIM > > & | vket, |
| std::vector< Function< T, NDIM > > & | mult, | ||
| std::vector< std::vector< Function< T, NDIM > > > & | flux ) const |
weak-form split of the non-multiplicative xc terms
Writes the decomposition v_xc^{semilocal+tau} psi_i = mult_i - div(Y_i) with (nemo kets F_i, W_i = v_tau (grad F_i - U1 F_i)) mult_i = X.grad(F_i) + 1/2 U1.W_i, Y_i = X F_i + 1/2 W_i. mult goes into V psi; flux is what the caller pushes through the Green's function, as 2 div(G*Y_i), so that neither X nor v_tau is ever differentiated. Requires make_xc_potential() first.
References madness::apply(), axis, madness::FunctionDefaults< NDIM >::get_thresh(), has_tau_term(), is_weak_form(), MADNESS_CHECK_THROW, make_derivative(), madness::mul(), madness::mul_sparse(), ncf, semilocal_flux, madness::sub(), madness::truncate(), vtau, world, and madness::zero_functions_compressed().
Referenced by madness::Nemo::compute_nemo_potentials_impl(), and operator()().
|
private |
which derivative operator to use
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), div_dft_deriv(), make_derivative(), prep_xc_args(), and set_tau().
|
private |
additional truncation for the densities in the XC kernel
the densities in the DFT kernal are processed as their inverses, so noise in the small density regions might amplify and lead to inaccurate results. Extra truncation will tighten the truncation threshold by a specified factor, default is 0.01.
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), prep_xc_args(), prep_xc_args_response(), madness::Coulomb< double, 3 >::reset_poisson_operator_ptr(), set_extra_truncation(), and set_tau().
|
mutableprivate |
the XC functionals depend on the spin of the orbitals they act on
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), apply_xc_kernel(), make_xc_potential_impl(), and set_ispin().
|
private |
number of beta orbitals
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), make_xc_potential_impl(), prep_xc_args(), prep_xc_args_response(), and set_tau().
|
private |
the nuclear correlation factor, if it exists, for computing derivatives for GGA
Referenced by XCOperator(), apply_tau_term(), make_u1_functors(), operator()(), prep_xc_args(), set_tau(), and weak_xc_terms().
|
private |
print level; >=2 logs the meta-gga de/dtau range
Referenced by apply_tau_term(), and set_print_level().
|
mutableprivate |
the semilocal flux, assigned by make_xc_potential() in weak form only
Referenced by get_semilocal_flux(), make_xc_potential_impl(), operator()(), and weak_xc_terms().
|
mutableprivate |
the multiplicative potential, stashed by make_xc_potential()
Referenced by get_vlocal(), make_xc_potential(), and operator()().
|
mutableprivate |
de/dtau, the prefactor of the non-multiplicative meta-gga term
falls out of the same pointwise pass as the multiplicative potential, so it is stashed by make_xc_potential() rather than recomputed
Referenced by apply_tau_term(), get_vtau(), make_xc_potential_impl(), and weak_xc_terms().
|
private |
caller has opted in to the weak form, see allow_weak_form()
Referenced by allow_weak_form(), and is_weak_form().
|
private |
the user asked for the weak form: CalculationParameters::xc_weak_gga()
Two independent conditions, and both are needed. weak_form_ok says the caller implements the split; this says the user wants it.
Referenced by XCOperator(), is_weak_form(), and set_weak_gga().
|
private |
the world
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), apply_tau_term(), apply_xc_kernel(), compute_xc_energy(), make_derivative(), make_xc_potential_impl(), operator()(), operator()(), prep_xc_args(), prep_xc_args_response(), set_extra_truncation(), set_tau(), and weak_xc_terms().
| std::shared_ptr<XCfunctional> madness::XCOperator< T, NDIM >::xc |
interface to the actual XC functionals
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), apply_xc_kernel(), compute_xc_energy(), has_tau_term(), is_weak_form(), make_xc_potential_impl(), prep_xc_args(), prep_xc_args_response(), and set_tau().
|
mutableprivate |
functions that are need for the computation of the XC operator
the ordering of the intermediates is fixed, but the code can handle non-initialized functions, so if e.g. no GGA is requested, all the corresponding vector components may be left empty. For the ordering of the intermediates see xcfunctional::xc_arg
Referenced by XCOperator(), XCOperator(), XCOperator(), XCOperator(), XCOperator(), apply_xc_kernel(), compute_xc_energy(), get_tau(), has_tau_args(), is_initialized(), make_u1_functors(), make_xc_potential_impl(), prep_xc_args_response(), and set_tau().