dftlibs / xcfun

XCFun: A library of exchange-correlation functionals with arbitrary-order derivatives
https://dftlibs.org/xcfun/
Mozilla Public License 2.0
57 stars 32 forks source link

metaGGA functionals not usable through the Python bindings #141

Open robertodr opened 4 years ago

robertodr commented 4 years ago

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)
chjacob-tubs commented 4 years ago

I will put this on my list and will work on extending the high-level Python interface as soon as I find some time for this.

susilehtola commented 2 years ago

A meta-GGA interface would be highly valuable.

susilehtola commented 2 years ago

@chjacob-tubs is this still on your todo list?

chjacob-tubs commented 2 years ago

Thanks for the reminder, I had forgotten about it because we currently dont need it.

I will try to have a look in the next weeks, that would be a nice change from all the administration work I am currently doing. If nothing happens, please keep the reminders coming!