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.
Quick usage
Section titled “Quick usage”from atomli.build import moleculefrom atomli.calculators.qc import QC
atoms = molecule("H2O")atoms.calc = QC(xc="wB97M-V", basis="def2-TZVP", device="gpu")energy = atoms.get_potential_energy() # eVforces = atoms.get_forces() # eV/ÅPeriodic calculation (settings={"periodic": True} or kpts=):
from ase.build import bulkfrom 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() # eVstress = si.get_stress() # eV/ų (Voigt [xx, yy, zz, yz, xz, xy])Supported functionals and algorithms
Section titled “Supported functionals and algorithms”xc | Class | Coulomb / exchange | Dispersion / nonlocal | Molecular (0D) | Periodic (3D PBC) | Analytical Hessian |
|---|---|---|---|---|---|---|
"PBE" | GGA | RI-J (or 4-center) / GPW FFT | Optional DFTD3 / DFTD4 | CPU & GPU | CPU & GPU | Molecular (CPU & GPU) |
"r2SCAN" | Meta-GGA | RI-J (or 4-center) / GPW FFT | Optional DFTD3 / DFTD4 | CPU & GPU | CPU & GPU | Molecular (CPU & GPU) |
"r2SCAN-3c" | Composite meta-GGA | RI-J (def2-universal-jfit) | Built-in gCP + D4 (def2-mTZVPP fixed) | CPU & GPU | Not supported | Not exposed |
"wB97X-V" | RSH GGA | RI-J + COSX (def2-universal-jkfit) | Self-consistent VV10 | CPU & GPU | Not supported | Molecular (CPU only) |
"wB97M-V" | RSH meta-GGA | RI-J + COSX (def2-universal-jkfit) | Self-consistent VV10 | CPU & GPU | Not supported | Molecular (CPU only) |
"SKALA-1.1" | Neural XC | RI-J / GPW FFT | Included in neural XC | CPU & GPU (auto-cached 2.3 MiB checkpoint) | CPU only | Not exposed |
"PBEsol", "revPBE" | GGA | RI-J (or 4-center) | Optional external dispersion | CPU only | Not supported | Molecular (CPU only) |
"LDA,VWN" | LDA | GPW FFT | None | With GTH basis | CPU only (requires gth-pade) | Periodic via DFPT |
- Spin treatment: Closed-shell singlet systems use restricted Kohn–Sham (
RKS). Any nonzerounpairedcount or nonzero per-siteinitial_magnetic_momentsselects unrestricted spin-polarized Kohn–Sham (UKS/KUKS). - Dispersion composition:
wB97X-VandwB97M-Vinclude self-consistentVV10;r2SCAN-3cincludesgCP+D4;PBEandr2SCANpair withDFTD3orDFTD4viaSumCalculator.
Constructor parameters
Section titled “Constructor parameters”| Parameter | Type | Default | Unit | Description |
|---|---|---|---|---|
xc | str | "PBE" | — | Exchange-correlation functional from the table above |
basis | str | "def2-SVP" | — | Molecular orbital basis (settings["basis"] sets periodic basis) |
density_fitting | str | None | "default" (0D) / "none" (3D) | — | "default" enables RI-J (+ COSX on hybrids); "none" selects conventional 4-center on CPU |
auxiliary_basis | str | None | None | — | Explicit molecular RI fitting basis; raises if set with density_fitting="none" or periodic settings |
pseudopotential | str | None | None | — | Molecular GTH pseudopotential ("gth-pbe" or "gth-pade") when using a molecular gth-* basis |
charge | float | None | None | Integer total molecular/cell charge override | |
unpaired | int | None | None | — | Unpaired electron count (); must match electron-count parity |
device | str | Adapter | None | Auto / atomli.gpu default | — | "cpu", "gpu" ("wgpu" alias), "gpu:<index>", "gpu:pci:<id>", or Adapter |
adapter | Adapter | int | str | None | None | — | Physical GPU selector when device="gpu" |
scf | Scf | dict | str | None | "default" | eV | SCF control block (Scf instance, dict, "default", or "robust") |
kpts | tuple | dict | KMesh | ndarray | None | None | Å | ASE k-point mesh or density; passing kpts implies periodic mode |
settings | dict | None | None | Mixed (see table) | Periodic solver settings schema (periodic, basis, pseudopotential, mesh, smearing, dft_u) |
smearing | dict | None | None | eV | ASE alias {"name": "fermi-dirac" | "gaussian", "width": float} (requires periodic mode) |
convergence | dict | None | None | eV | ASE alias {"energy": float} mapping to scf["energy_tolerance"] |
maxiter | int | None | None | — | ASE alias () mapping to scf["max_cycles"] |
skala_checkpoint | str | Path | None | None | — | Local skala-1.1.fun path (valid only with xc="SKALA-1.1") |
download | bool | True | — | Allow network fetch of pinned SKALA-1.1 weights if not cached |
require_convergence | bool | True | — | Raise on unconverged SCF (False warns, returns energy only, and refuses forces/stress) |
Basis sets and density fitting
Section titled “Basis sets and density fitting”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 shells (, covering
def2-SVPthroughdef2-QZVPand molecular GTH bases). Shells with raise ondevice="gpu". - Auxiliary fitting bases: Omitting
auxiliary_basisselectsdef2-universal-jfitforRI-Jsemilocal functionals anddef2-universal-jkfitforwB97X-V/wB97M-V. Explicit options includedef2-universal-JFIT,def2-SVP-JKFIT, andcc-pVTZ-JKFIT.
Periodic settings, kpts, and DFT+U
Section titled “Periodic settings, kpts, and DFT+U”Periodic cells must have pbc=[True, True, True] and a nondegenerate 3 × 3 cell. Unknown settings keys raise ValueError.
| Key | Type | Default | Unit | Description |
|---|---|---|---|---|
periodic | bool | False | — | Set True to enable periodic GPW mode |
basis | str | "gth-dzvp-molopt-sr" | — | Periodic GTH orbital basis |
pseudopotential | str | "gth-pbe" | — | GTH pseudopotential ("gth-pade" for LDA,VWN) |
energy_cutoff | float | 100.0 | Ha | Plane-wave density/potential grid cutoff |
mesh | [int, int, int] | None | Auto from energy_cutoff | — | Explicit [nx, ny, nz] FFT grid override |
kpoint_density | float | 15.0 | Å | Automatic mesh target max(1, ceil(density / |a_i|)) |
kpoints | [kx, ky, kz] | KMesh | dict | Auto from kpoint_density | — | Explicit reciprocal mesh or KMesh specification |
precision | float | 1e-8 | — | GPW integral and real-space grid tolerance |
derivative_mode | str | "analytical" | — | Analytical derivatives ("auto" is an alias) |
smearing | dict | None | None | Ha | {"sigma": float, "method": "fermi" | "gaussian", "chemical_potential": float, "fixed_spin": bool} |
dft_u | DftU | dict | None | None | eV | Per-element shell Hubbard correction {element: {shell: U_eV}} |
KMesh and ASE keyword aliases
Section titled “KMesh and ASE keyword aliases”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 tokpoint_density = 2*pi*d.KMesh(size, **kwargs)fields (full dict always echoed incalc.parameters["settings"]["kpoints"]):
| Field | Default | Description |
|---|---|---|
size | required | Mesh dimensions [kx, ky, kz], each |
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_around | False | Wrap mesh coordinates around reciprocal cell boundary |
ao_symmetry | False | Symmetry-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 .
Spin seeding and DFT+U
Section titled “Spin seeding and DFT+U”from ase.build import bulkfrom 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+Uprojectors match AO labels ("Fe 3d") against theMINAOreference basis; unmatched shell names raise an explicit error at SCF evaluation time.- Periodic GPU
DFT+U(PBEandr2SCAN, 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 (
unpairedor summedinitial_magnetic_moments) across every k-point mesh.
SCF controls (Scf) and state reuse
Section titled “SCF controls (Scf) and state reuse”Pass scf= as "default", "robust", a dict, or atomli.calculators.qc.Scf(...):
| Field | "default" | "robust" | Unit | Description |
|---|---|---|---|---|
max_cycles | 50 | 256 | — | Maximum SCF cycles (0 evaluates initial density only) |
energy_tolerance | 2.7211e-8 | 2.7211e-7 | eV | Total energy convergence threshold (1e-9 / 1e-8 Ha) |
density_tolerance | 1e-6 | 1e-6 | — | Density-matrix RMS convergence diagnostic |
fock_damping | 0.0 | 0.2 | — | Linear Fock damping weight |
level_shift | 0.0 | 6.8028 | eV | Virtual-orbital level shift (0.25 Ha in "robust") |
diis_start | 2 | 3 | — | One-based cycle index to begin DIIS extrapolation |
diis_size | 8 | 8 | — | Maximum Fock/residual subspace pairs (0 disables DIIS) |
diis_damp | 0.0 | 0.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_workers | None | None | — | CPU Coulomb worker override |
density_fitting_metric_regularization | None | None | — | {"relative": float, "absolute": float} RI-J metric regularization |
pyscf_nelec_compat | False | False | — | Reproduce PySCF KUHF moment scaling (unpaired / nkpts) |
pyscf_cycle_compat | False | False | — | 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") ondevice="gpu"(requiresdevice="cpu"). - Molecular
PBEsol/revPBE, periodicLDA,VWN, or periodicSKALA-1.1ondevice="gpu". - Basis sets with angular momentum ( shells and higher) on
device="gpu". - Symmetry-reduced k-point wedges (
KMesh(..., symmetry=...)) ondevice="gpu". - Restricted (
RKS) periodic MultiGridDFT+U. - Analytical molecular Hessians for
wB97X-V/wB97M-Vondevice="gpu"(CPU supported) or forSKALA-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=withsettings["kpoints"],smearing=withsettings["smearing"], orconvergence=/maxiter=with anScfobject/preset or overlappingscfdict key).