Basic psi4numpy question for the DFT potential

Hi, I’m trying to code the DFT with psi4numpy with

I made the V potential with

sup = psi4.driver.dft_funcs.build_superfunctional(“PBE”, True)[0]
vname = “RV”
Vpot =, sup, vname)

and tried to calculate V matrix with

ks_e = 0.0
V = V_builder(D, Vpot)
if V is None:
    ks_e = 0.0
    ks_e, V = V
    V = psi4.core.Matrix.from_array(V)

but having a problem with V_builder.
I think I need to use DFT kernel as for the V_builder.

So, my question is, is there any kernel that I can use right away?
If so, where can I find them?

Thank you in advance!

*It also will be great if someone adds psi4numpy DFT tutorial 4c GGA and Meta Kernels.

Thanks for your interest in the Psi4NumPy tutorials. The DFT tutorials are still in beta and hopefully we will get to GGA/meta at some point.

V_builder is the name of a function defined in the VV10 and GRAC tutorials and passed to If you want to compute V potentials from an arbitrary kernel you can use:

import psi4
import numpy as np

mol = psi4.geometry("""
symmetry c1

scf_e, wfn ="PBE/6-31G", return_wfn=True)

# Grab relevant data
nbf = wfn.nmo()
Vpot = wfn.V_potential()

# Set a density
D = wfn.Da()

# Compute V by passing in a matrix to populate
V = psi4.core.Matrix(nbf, nbf)


Hi, would it be possible to compute V potential from an arbitrary Hermitian complex density matrix? I am having some trouble with the set_D function since it seems that D must be passed as psi4.core.Matrix object. If I define such psi4 Matrix using “from_array” function, any imaginary part will be discarded

Unfortunately none of the code (including our XC evaluator) is able to handle complex values. If you know of a code that can evaluate complex XC derivatives we could probably patch something together however.

I don’t think the imaginary part contributes to the XC potential, so you can just pass the real part as a Matrix object. The appendix here might be useful.

Thank you so much for your help