Skip to content

FNO

One operator, learned two ways

ext2chg and chg2tau share one architecture, one training loop and one family of constraints — the difference between them is only which two fields sit on either end. The maps themselves — and why they are learnable — are on the DFT page.

An operator, not a function — learned in Fourier space

A Fourier Neural Operator does not learn a map between fixed-size vectors; it learns a map between functions, discretized only at the moment a forward pass needs a number. A Fourier layer keeps its weights as complex multipliers on a fixed band of Fourier modes rather than as filters in real space, so the same trained layer applies unchanged to a field on any grid dense enough to represent that band — the discretization is a detail of the input, not a parameter of the model.

  • SpectralConv3d learns complex multipliers on the low-frequency corners of the real FFT
  • mode_selection: physical truncates at a constant |G| rather than a constant index, so every material sees the same band of physics
  • ShapeBucketSampler batches materials of identical shape together — no padding ever reaches the FFT
  • Optional cell-conditioning (FiLM) lets the network read the lattice, not just the field on it

Device-agnostic, precision-explicit

CUDA, Apple Metal and CPU are selected automatically, and two independent precision knobs separate what a field is stored in from what the operator computes in — they cost differently and answer different questions.

  • data.precision is a memory setting: float16 | float32 | float64
  • model.precision: float64 checks whether a result is a single-precision artefact; it needs training.device: cpu, since Metal has no float64 at all
  • An optional C kernel accelerates the spectral contraction on CPU 2–3.4× at inference batch size 1, and falls back to torch.einsum with no configuration
  • CPU and Apple Metal agree to 10⁻⁶ on the same forward pass

Resampling that preserves the electron count

Changing resolution by interpolation aliases a plane-wave field and shifts its integral. Poraquê resamples spectrally instead: Fourier truncation is the exact band-limited projection for a field of this kind, so the electron count survives a change of grid to machine precision.

  • Training runs at a chosen working resolution (32³ by default) regardless of each material's native grid
  • The same projection underlies dataset caching and the resolution flags on inference
  • Preserves the total charge

Keep reading

The Hohenberg–Kohn map, the missing kinetic functional, and the physics constraints layered on top.

Ingest, cache, train, predict, evaluate — and the committee/active-learning loop around it.

Held-out accuracy, the comparison against analytic functionals, how to get a trained model, and the roadmap beyond one element.

Try it on your own structure

Install it, or read the manual first.