Skip to main content

Poraquê logo

License: MIT

Poraquê

Poraquê learns maps between the three-dimensional scalar fields of density-functional theory. Given only a crystal geometry it predicts the valence charge density and the kinetic energy density — no wavefunctions, no self-consistency cycle.

{POSCAR, INCAR, POTCAR} --analytic--> EXTCAR --Model 1--> CHGCAR --Model 2--> TAUCAR
                                                                                 |
                                                                        integrate v
                                                                              energy

The first step is closed-form; only the two field-to-field maps are learned. They are not unrelated regressions: the first is the Hohenberg–Kohn map, whose existence is a theorem, and the second is the kinetic energy density functional, the missing ingredient of orbital-free DFT.

Install

git clone https://github.com/seixas-research/poraque.git
cd poraque
pip install -e .

Python 3.11 or newer.

Use

# 1. check the data and the external-potential reconstruction
python scripts/validate_vasp_data.py --fit-sigma --form-factor

# 2. train one ext2chg and one chg2tau model on all structures
python scripts/run_train.py --write-config configs/train_config.yaml
python scripts/run_train.py --config configs/train_config.yaml

# 3. measure generalisation
python scripts/run_train.py --config configs/train_config.yaml --kfold --k-folds 5

# 4. predict a structure that has never been computed
python scripts/run_eval.py new_structure/ --output predictions/new_structure

Every predicted field is written in CHGCAR format and opens in VESTA.

Or drive it from ASE:

from ase.build import bulk
from poraque.calculator import Poraque

atoms = bulk("Au", "fcc", a=4.08, cubic=True)
atoms.calc = Poraque("models/poraque_models.pth", potcar="POTCAR")
atoms.get_potential_energy()
print(atoms.calc.components)     # T_s, E_ext, alpha Z, E_H, E_xc, Ewald

Forces and stress are not implemented, so this is single points, not relaxations.

What is in here

Path Contents
src/poraque/fields/ Shared-grid scalar fields, VASP I/O, pluggable ingestion
src/poraque/ml/ Fourier neural operators, differentiable DFT operators, training
src/poraque/physics/ Total-energy components integrated from the predicted fields
src/poraque/calculator.py ASE calculator wrapping the whole chain
src/poraque/vis/ Figures and automatic PDF reports
scripts/ Validation, training, inference, experiments
configs/ YAML run definitions
docs/source/ Sphinx documentation
docs/notes/ Design and analysis notes — start at roadmap.md
latex/user_guide/ User guide (how to run it)
latex/technical_guide/ Technical guide (physics and architecture)

Design points

  • The external potential is computed natively. Poraquê reconstructs it from the POTCAR tables on any standard VASP output, matching a reference potential to a relative 5×10⁻⁵. There is no option to import one: the training input must be exactly what inference produces.
  • Grids may differ between materials. One model serves all of them: the operator's weights live in Fourier-mode space, and batches are bucketed by grid shape.
  • Constraints are structural where possible. For chg2tau, τ = τ_vW[ρ] + softplus(·) makes the Hoffmann-Ostenhof bound hold by construction rather than by penalty.
  • Resampling is spectral. Fourier truncation is the exact band-limited projection for a plane-wave field; interpolation would alias and shift the electron count.
  • CUDA, Apple Metal and CPU, selected automatically.

Status

Twelve gold supercells — ten 27-atom cells and two 32-atom cells, spanning four grid shapes. 5-fold cross-validation, whole structures held out:

Model relative L²
ext2chg 0.0245 ± 0.0130 0.9987
chg2tau 0.0444 ± 0.0271 0.9951

The learned kinetic functional beats the analytic orbital-free functionals by a wide margin on this system — Thomas-Fermi scores 1.348 and von Weizsäcker 0.738 on the same fields, so chg2tau is 30× and 17× better respectively.

Cell size dominates the error

The aggregate above hides the only interesting thing in it. Split by cell size:

Subset ext2chg chg2tau
27-atom (10 structures) 0.0205 ± 0.0064 0.0355 ± 0.0069
32-atom (2 structures) 0.0445 ± 0.0182 0.0894 ± 0.0420

Held out, a 32-atom cell is 2.2–2.5× harder than a 27-atom one. That is the first transfer measurement this project has: with only two examples of that cell size, holding one out leaves a single sibling, and the operator has to extrapolate to a grid shape it has barely seen.

Within a familiar cell size, more data helps monotonically — the 27-atom numbers are the best yet recorded:

Dataset ext2chg chg2tau
5 structures 0.0295 ± 0.0025 0.0525 ± 0.0031
9 structures 0.0219 ± 0.0046 0.0400 ± 0.0069
12 structures, 27-atom subset 0.0205 ± 0.0064 0.0355 ± 0.0069

The three rows differ in protocol as well as in data — the 12-structure run holds out 3 structures per fold against 1 for the 5-structure run, and uses early stopping, which the earlier runs predate. Read the trend, not the third decimal.

Still one element. These numbers measure interpolation between geometries of gold and now, weakly, extrapolation across cell size. They say nothing about transfer to other chemistry. Growing the dataset remains the main open item — see docs/notes/roadmap.md.

Energies are not there yet. The total energy is a sum of terms of order 10⁴ eV whose physically relevant variation is a fraction of an eV per atom — a relative ~10⁻⁴ — and a field-level error of 2×10⁻² cannot survive that cancellation. Across the twelve structures the true spread is 0.27 eV/atom and the error on predicted differences is 0.29 eV/atom, a ratio of 1.06 with correlation r ≈ −0.1. That is an improvement on the previous 3× ratio, but an error equal to the signal and no correlation still means the predicted energy ordering carries no information. The energy module itself is validated against exact Madelung constants and uniform-electron-gas limits; it is the fields that are not yet accurate enough. See docs/source/energy/index.md.

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poraque-26.8.11.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poraque-26.8.11-py3-none-any.whl (152.4 kB view details)

Uploaded Python 3

File details

Details for the file poraque-26.8.11.tar.gz.

File metadata

  • Download URL: poraque-26.8.11.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for poraque-26.8.11.tar.gz
Algorithm Hash digest
SHA256 5070995b83fab33eeba33543f66bba98d7951287664ad56a345d15db62ddc3e9
MD5 cc8f642240cefef905dcc45d38ee7467
BLAKE2b-256 b7d6de0b7d62471e5263cdfc3f1af1ce6da135cb2b8cac174aca786fc7bd6484

See more details on using hashes here.

File details

Details for the file poraque-26.8.11-py3-none-any.whl.

File metadata

  • Download URL: poraque-26.8.11-py3-none-any.whl
  • Upload date:
  • Size: 152.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for poraque-26.8.11-py3-none-any.whl
Algorithm Hash digest
SHA256 b15e9909a9e08e367bc83d7b0716a7dbe73251407f239f340d485f8f9c5b6beb
MD5 51198e5bcb4465072a9a9d8e1f1395ad
BLAKE2b-256 6d876d2a6280aeb640d3c7677cf0359dcf1ba198bf9d8f54ff6b59cd234ddf91

See more details on using hashes here.

Release history Release notifications | RSS feed

26.8.31

2 files

26.8.30

2 files

26.8.29

2 files

26.8.28

2 files

26.8.27

2 files

26.8.26

2 files

26.8.25

2 files

26.8.24

2 files

26.8.23

2 files

26.8.22

2 files

26.8.21

2 files

26.8.20

2 files

26.8.19

2 files

26.8.18

2 files

26.8.17

2 files

26.8.16

2 files

26.8.15

2 files

26.8.14

2 files

26.8.12

2 files

This release

26.8.11 This release

2 files

26.8.8

2 files

26.8.7

2 files

26.8.6

2 files

26.6.4

2 files

26.6.3

2 files

26.6.2

2 files

26.6.1

2 files

26.6.0

2 files

26.5.5

2 files

26.5.4

2 files

26.5.3

2 files

26.5.2

2 files

26.5.1

2 files

26.5.0

2 files

26.4.1

2 files

26.4.0

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page