Molecular DFT (RKS)

from vibeqc import Atom, Molecule, BasisSet, RKSOptions, run_rks

mol = Molecule([
    Atom(8, [0.0,  0.0,  0.0]),
    Atom(1, [0.0,  1.43, -0.98]),
    Atom(1, [0.0, -1.43, -0.98]),
])
basis = BasisSet(mol, "6-31g*")

opts = RKSOptions()
opts.functional = "PBE"     # or "LDA", "BLYP", "B3LYP", "PBE0", etc.
result = run_rks(mol, basis, opts)

print(f"E_KS        = {result.energy:.10f}")
print(f"E_Coulomb   = {result.e_coulomb:.10f}")
print(f"E_xc        = {result.e_xc:.10f}")
print(f"E_HF_exch   = {result.e_hf_exchange:.10f}")

Any functional name libxc understands is accepted — there are over 500. Common choices:

Name

Type

Use case

LDA / SVWN

LDA

Fast sanity check; too exchange-heavy for real chemistry

PBE

GGA

Default for solid-state; good cost/accuracy balance

BLYP

GGA

Classic molecular GGA

B3LYP

hybrid GGA

de-facto standard for organics

PBE0

hybrid GGA

Semiconductors, molecular properties

TPSS

meta-GGA

Better barriers than GGAs (pending — via libxc)

Hybrids automatically enable the HF-exchange mixing through libint under the hood; no extra option needed.

Grid quality

opts.grid.n_radial = 99
opts.grid.n_theta  = 29
opts.grid.n_phi    = 58

Default is medium-quality (75 × 17 × 36 ≈ 46 000 points per atom). Bumping to the above numbers matches “fine” in ORCA / PySCF and is worth using for small-system benchmarks.

Validation against PySCF

The vibe-qc regression suite runs the H2O / PBE / 6-31G* total energy through both vibe-qc and PySCF and asserts agreement to 1e-6 Ha (grid accuracy). See tests/test_rks.py for the list of cases.