Skip to content

QC

QC evaluates molecular (0D) and three-dimensionally periodic (3D PBC) Kohn–Sham DFT using Gaussian orbital bases, with analytical forces, periodic stress, and analytical Hessians. It attaches directly to atomli.Atoms and ase.Atoms.

from atomli.build import molecule
from atomli.calculators.qc import QC
atoms = molecule("H2O")
atoms.calc = QC(xc="wB97M-V", basis="def2-TZVP", device="gpu")
energy = atoms.get_potential_energy() # eV
forces = atoms.get_forces() # eV/Å

Periodic calculation (settings={"periodic": True} or kpts=):

from ase.build import bulk
from atomli.calculators.qc import QC
si = bulk("Si", "diamond", a=5.43)
si.calc = QC(xc="PBE", kpts=(4, 4, 4), settings={"periodic": True})
energy = si.get_potential_energy() # eV
stress = si.get_stress() # eV/ų (Voigt [xx, yy, zz, yz, xz, xy])
xcClassCoulomb / exchangeDispersion / nonlocalMolecular (0D)Periodic (3D PBC)Analytical Hessian
"PBE"GGARI-J (or 4-center) / GPW FFTOptional DFTD3 / DFTD4CPU & GPUCPU & GPUMolecular (CPU & GPU)
"r2SCAN"Meta-GGARI-J (or 4-center) / GPW FFTOptional DFTD3 / DFTD4CPU & GPUCPU & GPUMolecular (CPU & GPU)
"r2SCAN-3c"Composite meta-GGARI-J (def2-universal-jfit)Built-in gCP + D4 (def2-mTZVPP fixed)CPU & GPUNot supportedNot exposed
"wB97X-V"RSH GGARI-J + COSX (def2-universal-jkfit)Self-consistent VV10CPU & GPUNot supportedMolecular (CPU only)
"wB97M-V"RSH meta-GGARI-J + COSX (def2-universal-jkfit)Self-consistent VV10CPU & GPUNot supportedMolecular (CPU only)
"SKALA-1.1"Neural XCRI-J / GPW FFTIncluded in neural XCCPU & GPU (auto-cached 2.3 MiB checkpoint)CPU onlyNot exposed
"PBEsol", "revPBE"GGARI-J (or 4-center)Optional external dispersionCPU onlyNot supportedMolecular (CPU only)
"LDA,VWN"LDAGPW FFTNoneWith GTH basisCPU only (requires gth-pade)Periodic via DFPT
  • Spin treatment: Closed-shell singlet systems use restricted Kohn–Sham (RKS). Any nonzero unpaired count or nonzero per-site initial_magnetic_moments selects unrestricted spin-polarized Kohn–Sham (UKS / KUKS).
  • Dispersion composition: wB97X-V and wB97M-V include self-consistent VV10; r2SCAN-3c includes gCP + D4; PBE and r2SCAN pair with DFTD3 or DFTD4 via SumCalculator.
ParameterTypeDefaultUnitDescription
xcstr"PBE"—Exchange-correlation functional from the table above
basisstr"def2-SVP"—Molecular orbital basis (settings["basis"] sets periodic basis)
density_fittingstr | None"default" (0D) / "none" (3D)—"default" enables RI-J (+ COSX on hybrids); "none" selects conventional 4-center on CPU
auxiliary_basisstr | NoneNone—Explicit molecular RI fitting basis; raises if set with density_fitting="none" or periodic settings
pseudopotentialstr | NoneNone—Molecular GTH pseudopotential ("gth-pbe" or "gth-pade") when using a molecular gth-* basis
chargefloat | NoneNoneeeInteger total molecular/cell charge override
unpairedint | NoneNone—Unpaired electron count (Nα−NβN_\alpha - N_\beta); must match electron-count parity
devicestr | Adapter | NoneAuto / atomli.gpu default—"cpu", "gpu" ("wgpu" alias), "gpu:<index>", "gpu:pci:<id>", or Adapter
adapterAdapter | int | str | NoneNone—Physical GPU selector when device="gpu"
scfScf | dict | str | None"default"eVSCF control block (Scf instance, dict, "default", or "robust")
kptstuple | dict | KMesh | ndarray | NoneNoneÅ−1^{-1}ASE k-point mesh or density; passing kpts implies periodic mode
settingsdict | NoneNoneMixed (see table)Periodic solver settings schema (periodic, basis, pseudopotential, mesh, smearing, dft_u)
smearingdict | NoneNoneeVASE alias {"name": "fermi-dirac" | "gaussian", "width": float} (requires periodic mode)
convergencedict | NoneNoneeVASE alias {"energy": float} mapping to scf["energy_tolerance"]
maxiterint | NoneNone—ASE alias (≥1\ge 1) mapping to scf["max_cycles"]
skala_checkpointstr | Path | NoneNone—Local skala-1.1.fun path (valid only with xc="SKALA-1.1")
downloadboolTrue—Allow network fetch of pinned SKALA-1.1 weights if not cached
require_convergenceboolTrue—Raise on unconverged SCF (False warns, returns energy only, and refuses forces/stress)

Query packaged basis sets at runtime with atomli.calculators.qc.available_basis_sets():

  • All-electron Gaussian sets: STO-3G, def2-SV(P), def2-SVP, def2-TZVP, def2-TZVPP, def2-mTZVPP (r2SCAN-3c), def2-QZVP, cc-pVDZ, cc-pVTZ, ANO, MINAO.
  • GPU angular-momentum scope: Native GPU kernels support basis functions up to gg shells (ℓ≤4\ell \le 4, covering def2-SVP through def2-QZVP and molecular GTH bases). Shells with ℓ>4\ell > 4 raise on device="gpu".
  • Auxiliary fitting bases: Omitting auxiliary_basis selects def2-universal-jfit for RI-J semilocal functionals and def2-universal-jkfit for wB97X-V/wB97M-V. Explicit options include def2-universal-JFIT, def2-SVP-JKFIT, and cc-pVTZ-JKFIT.

Periodic cells must have pbc=[True, True, True] and a nondegenerate 3 × 3 cell. Unknown settings keys raise ValueError.

KeyTypeDefaultUnitDescription
periodicboolFalse—Set True to enable periodic GPW mode
basisstr"gth-dzvp-molopt-sr"—Periodic GTH orbital basis
pseudopotentialstr"gth-pbe"—GTH pseudopotential ("gth-pade" for LDA,VWN)
energy_cutofffloat100.0HaPlane-wave density/potential grid cutoff
mesh[int, int, int] | NoneAuto from energy_cutoff—Explicit [nx, ny, nz] FFT grid override
kpoint_densityfloat15.0ÅAutomatic mesh target max(1, ceil(density / |a_i|))
kpoints[kx, ky, kz] | KMesh | dictAuto from kpoint_density—Explicit reciprocal mesh or KMesh specification
precisionfloat1e-8—GPW integral and real-space grid tolerance
derivative_modestr"analytical"—Analytical derivatives ("auto" is an alias)
smearingdict | NoneNoneHa{"sigma": float, "method": "fermi" | "gaussian", "chemical_potential": float, "fixed_spin": bool}
dft_uDftU | dict | NoneNoneeVPer-element shell Hubbard correction {element: {shell: U_eV}}

Use kpts= (ASE spelling) or settings["kpoints"] / settings["kpoint_density"] (never both; passing both raises ValueError):

  • kpts=(2, 2, 2) selects a Gamma-centered mesh (centering="gamma").
  • kpts={"size": (2, 2, 2), "gamma": False} selects a shifted Monkhorst–Pack mesh (centering="monkhorst_pack").
  • kpts={"density": d} converts ASE inverse-length density d [A˚]d\ [\text{Å}] to kpoint_density = 2*pi*d.
  • KMesh(size, **kwargs) fields (full dict always echoed in calc.parameters["settings"]["kpoints"]):
FieldDefaultDescription
sizerequiredMesh dimensions [kx, ky, kz], each ≥1\ge 1
centering"gamma""gamma" (PySCF make_kpts convention) or "monkhorst_pack"
symmetry"none"Wedge reduction: "none", "time_reversal", "space_group", or "space_group_and_time_reversal"
wrap_aroundFalseWrap mesh coordinates around reciprocal cell boundary
ao_symmetryFalseSymmetry-adapted AO-irrep block diagonalization

ASE unit-safe aliases: Top-level smearing={"name": "fermi-dirac" | "gaussian", "width": w_eV}, convergence={"energy": tol_eV}, and maxiter=N accept eV directly and reject conflicting native keys. With smearing active, energies, forces, and stress correspond to the Mermin free energy E−σSE - \sigma S.

from ase.build import bulk
from atomli.calculators.qc import QC, DftU
fe = bulk("Fe", "bcc", a=2.87)
fe.set_initial_magnetic_moments([2.0])
fe.calc = QC(
xc="PBE",
kpts=(4, 4, 4),
smearing={"name": "fermi-dirac", "width": 0.2},
settings={"periodic": True, "dft_u": DftU({"Fe": {"3d": 2.0}})},
)
  • DFT+U projectors match AO labels ("Fe 3d") against the MINAO reference basis; unmatched shell names raise an explicit error at SCF evaluation time.
  • Periodic GPU DFT+U (PBE and r2SCAN, including analytical forces and stress) requires unrestricted spin-polarized calculations (KUKS+U) on full k-point meshes.
  • Periodic k-point unrestricted cells enforce the declared per-cell spin moment (unpaired or summed initial_magnetic_moments) across every k-point mesh.

Pass scf= as "default", "robust", a dict, or atomli.calculators.qc.Scf(...):

Field"default""robust"UnitDescription
max_cycles50256—Maximum SCF cycles (0 evaluates initial density only)
energy_tolerance2.7211e-82.7211e-7eVTotal energy convergence threshold (1e-9 / 1e-8 Ha)
density_tolerance1e-61e-6—Density-matrix RMS convergence diagnostic
fock_damping0.00.2—Linear Fock damping weight
level_shift0.06.8028eVVirtual-orbital level shift (0.25 Ha in "robust")
diis_start23—One-based cycle index to begin DIIS extrapolation
diis_size88—Maximum Fock/residual subspace pairs (0 disables DIIS)
diis_damp0.00.0—CDIIS storage damping factor
initial_guess"minao""core_hamiltonian"—"minao", "core_hamiltonian", "atom_superposition", or "zero_density"
grid_schedule"single_grid""single_grid"—Molecular quadrature schedule: "single_grid" or "dual_grid"
coulomb_workersNoneNone—CPU Coulomb worker override
density_fitting_metric_regularizationNoneNone—{"relative": float, "absolute": float} RI-J metric regularization
pyscf_nelec_compatFalseFalse—Reproduce PySCF ≤2.14\le 2.14 KUHF moment scaling (unpaired / nkpts)
pyscf_cycle_compatFalseFalse—PySCF historical cycle stopping semantics; disables residual routing
extrapolation"cdiis""cdiis"—"cdiis" or "adiis_cdiis"
routing_policy"auto""auto"—Metallic residual routing: "auto", "off", or "force_kerker"

Inspection and warm starts: Read calc.converged (None before evaluation), calc.scf_iterations, calc.get_scf_diagnostics(), and resolved inputs in calc.parameters. Pass calc.kernel(atoms, dm0=dm) to seed with an explicit real AO density matrix, calc.set(**kwargs) to mutate settings cleanly, or calc.with_settings(**kwargs) to clone with overrides.

Unsupported combinations (explicit errors)

Section titled “Unsupported combinations (explicit errors)”
  • Conventional ERIs (density_fitting="none") on device="gpu" (requires device="cpu").
  • Molecular PBEsol / revPBE, periodic LDA,VWN, or periodic SKALA-1.1 on device="gpu".
  • Basis sets with angular momentum ℓ>4\ell > 4 (hh shells and higher) on device="gpu".
  • Symmetry-reduced k-point wedges (KMesh(..., symmetry=...)) on device="gpu".
  • Restricted (RKS) periodic MultiGrid DFT+U.
  • Analytical molecular Hessians for wB97X-V/wB97M-V on device="gpu" (CPU supported) or for SKALA-1.1 / r2SCAN-3c.
  • 1D or 2D partial PBC cells, or requesting get_stress() on a molecular calculation (PropertyNotImplementedError).
  • Declaring conflicting parameter aliases simultaneously (kpts= with settings["kpoints"], smearing= with settings["smearing"], or convergence=/maxiter= with an Scf object/preset or overlapping scf dict key).