#include <libxc.hpp>
Inheritance diagram for q3::XC_LibXC:Public Member Functions | |
| XC_LibXC (int exchange_id, int correlation_id, int number_of_spin_components=1, std::string functional_identifier="") | |
| ~XC_LibXC () override | |
| void | compute (const std::vector< Real > &density, std::vector< Real > &xc_potential, std::vector< Real > &xc_energy_density) const override |
| Compute XC potential and energy density (LDA interface, unpolarized). | |
| void | compute_gradient_corrected (const std::vector< Real > &density, const std::vector< Real > &gradient_density_squared, std::vector< Real > &xc_potential, std::vector< Real > &gradient_correction_density, std::vector< Real > &xc_energy_density) const override |
| void | compute_gradient_corrected_spin (const std::vector< Real > &density_up, const std::vector< Real > &density_down, const std::vector< Real > &gradient_density_squared_up_up, const std::vector< Real > &gradient_density_squared_up_down, const std::vector< Real > &gradient_density_squared_down_down, std::vector< Real > &xc_potential_up, std::vector< Real > &xc_potential_down, std::vector< Real > &gradient_correction_up_up, std::vector< Real > &gradient_correction_up_down, std::vector< Real > &gradient_correction_down_down, std::vector< Real > &xc_energy_density) const override |
| void | compute_spin (const std::vector< Real > &density_up, const std::vector< Real > &density_down, std::vector< Real > &xc_potential_up, std::vector< Real > &xc_potential_down, std::vector< Real > &xc_energy_density) const override |
| std::string | name () const override |
| int | number_of_spin_components () const override |
| bool | requires_density_gradient () const override |
| Whether this is a GGA functional (needs gradients). | |
Public Member Functions inherited from q3::XCFunctional | |
| virtual | ~XCFunctional ()=default |
| virtual void | compute_exchange_correlation_kernel (const std::vector< Real > &density, std::vector< Real > &exchange_correlation_kernel) const |
| virtual void | compute_fxc_spin (const std::vector< Real > &density_up, const std::vector< Real > &density_down, std::vector< Real > &fxc_uu, std::vector< Real > &fxc_ud, std::vector< Real > &fxc_dd) const |
LibXC-based functional. Wraps supported functionals from the LibXC library. Supports LDA and GGA families. Specified by exchange + correlation IDs. Can operate in both unpolarized (number_of_spin_components=1) and spin-polarized (number_of_spin_components=2) modes.
|
inline |
Construct from LibXC functional IDs. number_of_spin_components: 1=unpolarized, 2=spin-polarized (LSDA/SGGA)
Definition at line 42 of file libxc.hpp.
References number_of_spin_components().
|
inlineoverridevirtual |
Compute XC potential and energy density (LDA interface, unpolarized).
The finiteness check is a serial pass over the finished arrays rather than part of the slice body, because an exception that escapes a parallel region terminates the process. Evaluating every point before reporting changes nothing a caller can observe: the evaluation has no side effects, so the point reported and the numbers reported with it are the same either way.
Implements q3::XCFunctional.
Definition at line 118 of file libxc.hpp.
References q3::constants::electron_charge_squared_rydberg.
|
inlineoverridevirtual |
Compute XC potential and energy density (GGA interface, unpolarized). gradient_density_squared[i] = |∇ρ|² at grid point i.
This default body is refused rather than reached: a GGA calculation using a functional that did not override compute_gradient_corrected() would silently fall back to LDA, producing numerically wrong results with no error.
Reimplemented from q3::XCFunctional.
Definition at line 254 of file libxc.hpp.
References q3::constants::electron_charge_squared_rydberg.
|
inlineoverridevirtual |
Compute XC potential and energy density (GGA interface, spin-polarized). grho2_uu = |∇ρ↑|², grho2_ud = ∇ρ↑·∇ρ↓, grho2_dd = |∇ρ↓|²
This default body is refused rather than reached: a spin-polarized GGA calculation using a functional that did not override compute_gradient_corrected_spin() would silently produce wrong physics.
Reimplemented from q3::XCFunctional.
Definition at line 363 of file libxc.hpp.
References q3::constants::electron_charge_squared_rydberg.
|
inlineoverridevirtual |
Compute XC potential and energy density (LDA interface, spin-polarized). density_up/density_down are spin-up/spin-down densities. xc_potential_up/xc_potential_down are the spin-resolved XC potentials. xc_energy_density is the XC energy density (per unit volume, evaluated at total density).
The spin arrays are interleaved two per grid point, so a slice that starts at grid point offset starts at element 2 * offset in them. Slices stay whole grid points, so a pair is never split.
Checked serially, for the reason given in compute().
This default body is refused rather than reached: a spin-polarized calculation using a functional that did not override compute_spin() would silently produce wrong physics (LDA-unpolarized result for a spin-polarized input).
Reimplemented from q3::XCFunctional.
Definition at line 182 of file libxc.hpp.
References q3::constants::electron_charge_squared_rydberg, and q3::math::tolerances::minimum_electron_density.
|
inlineoverridevirtual |
Implements q3::XCFunctional.
|
inlineoverridevirtual |
The spin mode this functional was constructed for: 1 or 2.
A LibXC handle is initialized once for a fixed mode and cannot be used in the other — a polarized handle driven through compute() misreads the interleaved (ρ↑, ρ↓) array it expects, and returns numbers that are finite, plausible and wrong. Callers that pick between the unpolarized and spin-polarized routines must branch on this rather than on how many densities they happen to hold.
Reimplemented from q3::XCFunctional.
Definition at line 109 of file libxc.hpp.
Referenced by XC_LibXC().
|
inlineoverridevirtual |
Whether this is a GGA functional (needs gradients).
Reimplemented from q3::XCFunctional.