class rgpot::XcKernel¶
Overview¶
class XcKernel {
public:
// typedefs
typedef int(*)(std::int64_t npts, std::int64_t nbf, const double*chi, const double*dchi, const double*lapl_chi, const double*hess_chi, const double*const*scal, double*out) KernelFn;
// construction
XcKernel(std::string name);
// methods
const std::string& name() const;
std::vector<std::string> scalNames() const;
int nScal() const;
int nFields() const;
int contract(const XcGrid& grid, const std::map<std::string, const double*>& scal, double* out) const;
int applyFxc(const XcGrid& grid, const std::map<std::string, const double*>& ground, const double* dm, double* vxc) const;
int tdaSigma(const XcGrid& grid, const std::map<std::string, const double*>& ground, const XcMo& mo, const double* z, const double* vj, double* sigma) const;
int rpaSigma(const XcGrid& grid, const std::map<std::string, const double*>& ground, const XcMo& mo, const double* xy, const double* vj, double* sigma) const;
static std::vector<std::string> catalog();
static XcFields fieldsFromDensity(const XcGrid& grid, const double* P);
static void transitionDm(const XcMo& mo, const double* z, double occ, double* dm);
static void rpaTransitionDm(const XcMo& mo, const double* x, const double* y, double occ, double* dm);
static void projectOv(const XcMo& mo, const double* Vao, double* ov);
static void tdaSigma(const XcMo& mo, const double* z, const double* v1, double* sigma);
static void rpaSigma(const XcMo& mo, const double* xy, const double* v1, double* sigma);
};
Detailed Documentation¶
Construction¶
XcKernel(std::string name)
Resolve a first-slice catalog name, e.g. “xck_gga_r_o2”.
Methods¶
int contract(const XcGrid& grid, const std::map<std::string, const double*>& scal, double* out) const
Assemble scal in <name>_scal_names order and accumulate into out (nbf * nbf, +=). Returns the C ABI rc (0 on success).
int applyFxc(const XcGrid& grid, const std::map<std::string, const double*>& ground, const double* dm, double* vxc) const
XC fxc on one AO density via this kernel. Ground-state scal holds weights, Libxc arrays, and (GGA) grad_rho_a_*. Perturbed rho/grad names (rho_a_p1, grad_rho_a_p1_*) are built from dm. Accumulates into vxc (nao*nao, +=).
int tdaSigma(const XcGrid& grid, const std::map<std::string, const double*>& ground, const XcMo& mo, const double* z, const double* vj, double* sigma) const
TDA sigma with host Coulomb: v1 = vj + 0.5 * applyFxc(dm(z)). vj is the host J matrix on the transition DM (nao*nao).
int rpaSigma(const XcGrid& grid, const std::map<std::string, const double*>& ground, const XcMo& mo, const double* xy, const double* vj, double* sigma) const
RPA sigma with host Coulomb on dm(X,Y). xy/out are 2*nocc*nvir.
static std::vector<std::string> catalog()
Known first-slice contraction names (o1 Fock + o2 fxc). Empty if the translation unit was compiled without -Dwith_xckernel.
Convenience: build rho / sigma / tau / lapl / grad_rho from an AO density (symmetric or transition). Host still evaluates Libxc.
static void transitionDm(const XcMo& mo, const double* z, double occ, double* dm)
dm = einsum(‘qo,ov,pv->pq’, Co*occ, z, Cv). Matches lib.einsum path (‘qo,xov->vxq’ then ‘vxq,pv->xpq’) used by TDA.gen_vind.
static void rpaTransitionDm(const XcMo& mo, const double* x, const double* y, double occ, double* dm)
dm = einsum X plus einsum(‘po,ov,qv->pq’, Co*occ, y, Cv) (‘po,xov->vxp’ then ‘vxp,qv->xpq’).
static void projectOv(const XcMo& mo, const double* Vao, double* ov)
ov = einsum(‘pv,pq,qo->ov’, Cv, V, Co) == Co^T @ (V^T @ Cv). Matches lib.einsum path (‘pv,xpq->vxq’ then ‘vxq,qo->xov’).
static void tdaSigma(const XcMo& mo, const double* z, const double* v1, double* sigma)
(A z)_ia = e_ia z_ia + (Co^T @ v1^T @ Cv)_ia. v1 is AO (nao*nao).
static void rpaSigma(const XcMo& mo, const double* xy, const double* v1, double* sigma)
[[A,B],[-B,-A]](X,Y). xy and out are 2*nocc*nvir (X then Y).