xcfun
xcfun copied to clipboard
metaGGA functionals not usable through the Python bindings
As noted in #140, it is not possible to use metaGGA functionals through the high-level Python class Functional
. One needs to use the pybind11-generated bindings directly:
# create empty functional
xc = xcfun_new()
# fill it with SCANc
ierr = xcfun_set(xc, "SCANc", 1.0)
# set evaluation variables enum (I'm not sure what you'd need here...)
vars = XC_N_S_GNN_GNS_GSS_TAUN_TAUS
# set evaluation mode enum (you might want another mode)
mode = XC_PARTIAL_DERIVATIVES
# set the order (0 for energy, etc)
order = 0
# set up evaluation mode
xcfun_eval_setup(xc, vars, mode, order)
# set input variables as a numpy array
dens = ...
# evaluate, the return value is a numpy array
ret = xcfun_eval(xc, dens)
# clean up functional
xcfun_delete(xc)