dftax 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dftax-0.1.0/.github/workflows/ci.yml +89 -0
- dftax-0.1.0/.github/workflows/docs.yml +34 -0
- dftax-0.1.0/.github/workflows/nightly.yml +28 -0
- dftax-0.1.0/.github/workflows/publish.yml +39 -0
- dftax-0.1.0/.gitignore +224 -0
- dftax-0.1.0/.python-version +1 -0
- dftax-0.1.0/CHANGELOG.md +45 -0
- dftax-0.1.0/CITATION.cff +24 -0
- dftax-0.1.0/CONTRIBUTING.md +39 -0
- dftax-0.1.0/LICENSE +201 -0
- dftax-0.1.0/PKG-INFO +257 -0
- dftax-0.1.0/README.md +216 -0
- dftax-0.1.0/dftax/__init__.py +88 -0
- dftax-0.1.0/dftax/basis/__init__.py +5 -0
- dftax-0.1.0/dftax/basis/data/cart2sph.npz +0 -0
- dftax-0.1.0/dftax/basis/loader.py +160 -0
- dftax-0.1.0/dftax/energy/__init__.py +1 -0
- dftax-0.1.0/dftax/energy/boys.py +71 -0
- dftax-0.1.0/dftax/energy/grid.py +37 -0
- dftax-0.1.0/dftax/energy/gto.py +526 -0
- dftax-0.1.0/dftax/energy/hartree.py +53 -0
- dftax-0.1.0/dftax/energy/hybrid.py +58 -0
- dftax-0.1.0/dftax/energy/jax_df_integrals.py +256 -0
- dftax-0.1.0/dftax/energy/orbitals.py +50 -0
- dftax-0.1.0/dftax/energy/potentials.py +35 -0
- dftax-0.1.0/dftax/energy/xc.py +578 -0
- dftax-0.1.0/dftax/grid/__init__.py +12 -0
- dftax-0.1.0/dftax/grid/becke.py +86 -0
- dftax-0.1.0/dftax/grid/data/lebedev.npz +0 -0
- dftax-0.1.0/dftax/grid/grid.py +64 -0
- dftax-0.1.0/dftax/grid/lebedev.py +40 -0
- dftax-0.1.0/dftax/integrals/__init__.py +35 -0
- dftax-0.1.0/dftax/integrals/coulomb_potential.py +209 -0
- dftax-0.1.0/dftax/integrals/eri2c.py +325 -0
- dftax-0.1.0/dftax/integrals/eri3c.py +323 -0
- dftax-0.1.0/dftax/integrals/eri4c.py +478 -0
- dftax-0.1.0/dftax/integrals/multipole.py +118 -0
- dftax-0.1.0/dftax/integrals/nuclear_attraction.py +443 -0
- dftax-0.1.0/dftax/integrals/nuclear_repulsion.py +30 -0
- dftax-0.1.0/dftax/integrals/overlap.py +591 -0
- dftax-0.1.0/dftax/integrals/shell_pairs.py +151 -0
- dftax-0.1.0/dftax/ks/__init__.py +38 -0
- dftax-0.1.0/dftax/ks/batched.py +154 -0
- dftax-0.1.0/dftax/ks/driver.py +149 -0
- dftax-0.1.0/dftax/ks/energy.py +582 -0
- dftax-0.1.0/dftax/ks/energy_uks.py +363 -0
- dftax-0.1.0/dftax/ks/forces.py +91 -0
- dftax-0.1.0/dftax/ks/forces_uks.py +93 -0
- dftax-0.1.0/dftax/ks/implicit.py +160 -0
- dftax-0.1.0/dftax/ks/minimize.py +121 -0
- dftax-0.1.0/dftax/ks/minimize_uks.py +100 -0
- dftax-0.1.0/dftax/ks/properties.py +302 -0
- dftax-0.1.0/dftax/ks/scf.py +201 -0
- dftax-0.1.0/dftax/ks/scf_uks.py +150 -0
- dftax-0.1.0/dftax/py.typed +0 -0
- dftax-0.1.0/dftax/system/__init__.py +5 -0
- dftax-0.1.0/dftax/system/molecule.py +91 -0
- dftax-0.1.0/dftax/utils/__init__.py +3 -0
- dftax-0.1.0/dftax/utils/energy_aux.py +44 -0
- dftax-0.1.0/dftax/utils/vmap.py +275 -0
- dftax-0.1.0/docs/api.md +46 -0
- dftax-0.1.0/docs/index.md +68 -0
- dftax-0.1.0/docs/tutorials/batched.md +38 -0
- dftax-0.1.0/docs/tutorials/coulomb-backends.md +61 -0
- dftax-0.1.0/docs/tutorials/drivers.md +49 -0
- dftax-0.1.0/docs/tutorials/forces.md +37 -0
- dftax-0.1.0/docs/tutorials/getting-started.md +56 -0
- dftax-0.1.0/docs/tutorials/implicit-diff.md +54 -0
- dftax-0.1.0/docs/tutorials/properties.md +47 -0
- dftax-0.1.0/examples/01_water_rks.py +10 -0
- dftax-0.1.0/examples/02_ch3_uks.py +12 -0
- dftax-0.1.0/examples/03_forces_h2.py +24 -0
- dftax-0.1.0/examples/04_density_fitting.py +14 -0
- dftax-0.1.0/examples/05_batched.py +25 -0
- dftax-0.1.0/examples/06_properties.py +31 -0
- dftax-0.1.0/examples/README.md +14 -0
- dftax-0.1.0/mkdocs.yml +24 -0
- dftax-0.1.0/pyproject.toml +91 -0
- dftax-0.1.0/scripts/bench/BENCHMARKS.md +60 -0
- dftax-0.1.0/scripts/bench/benchmark.py +126 -0
- dftax-0.1.0/scripts/compare_full_eri_vs_df.py +156 -0
- dftax-0.1.0/scripts/gpu/GPU_VALIDATION.md +86 -0
- dftax-0.1.0/scripts/gpu/validate_gpu.py +206 -0
- dftax-0.1.0/tests/__init__.py +0 -0
- dftax-0.1.0/tests/conftest.py +127 -0
- dftax-0.1.0/tests/unit/__init__.py +0 -0
- dftax-0.1.0/tests/unit/test_batched.py +80 -0
- dftax-0.1.0/tests/unit/test_boys_function.py +128 -0
- dftax-0.1.0/tests/unit/test_df.py +41 -0
- dftax-0.1.0/tests/unit/test_df_streaming.py +155 -0
- dftax-0.1.0/tests/unit/test_eri.py +147 -0
- dftax-0.1.0/tests/unit/test_eri4c_compile.py +72 -0
- dftax-0.1.0/tests/unit/test_forces.py +59 -0
- dftax-0.1.0/tests/unit/test_grid_streaming.py +33 -0
- dftax-0.1.0/tests/unit/test_high_l.py +43 -0
- dftax-0.1.0/tests/unit/test_hybrid.py +67 -0
- dftax-0.1.0/tests/unit/test_implicit.py +77 -0
- dftax-0.1.0/tests/unit/test_integrals.py +237 -0
- dftax-0.1.0/tests/unit/test_integrals_batched.py +283 -0
- dftax-0.1.0/tests/unit/test_jax_df_integrals.py +305 -0
- dftax-0.1.0/tests/unit/test_jax_gto.py +302 -0
- dftax-0.1.0/tests/unit/test_level_shift.py +55 -0
- dftax-0.1.0/tests/unit/test_minimize.py +39 -0
- dftax-0.1.0/tests/unit/test_native_pipeline.py +87 -0
- dftax-0.1.0/tests/unit/test_orbitals.py +49 -0
- dftax-0.1.0/tests/unit/test_properties.py +125 -0
- dftax-0.1.0/tests/unit/test_scf_rks.py +88 -0
- dftax-0.1.0/tests/unit/test_screening.py +74 -0
- dftax-0.1.0/tests/unit/test_smoke.py +93 -0
- dftax-0.1.0/tests/unit/test_spherical.py +48 -0
- dftax-0.1.0/tests/unit/test_uks.py +200 -0
- dftax-0.1.0/tests/unit/test_utils.py +61 -0
- dftax-0.1.0/tests/unit/test_xc.py +163 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.13"
|
|
16
|
+
cache-dependency-glob: "pyproject.toml"
|
|
17
|
+
- name: Sync (test deps)
|
|
18
|
+
run: uv sync --extra test
|
|
19
|
+
- name: Ruff
|
|
20
|
+
run: uv run ruff check dftax scripts examples tests
|
|
21
|
+
|
|
22
|
+
test:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
env:
|
|
25
|
+
OMP_NUM_THREADS: "2"
|
|
26
|
+
XLA_PYTHON_CLIENT_PREALLOCATE: "false"
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v7
|
|
29
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.13"
|
|
32
|
+
cache-dependency-glob: "pyproject.toml"
|
|
33
|
+
- name: Sync (test deps)
|
|
34
|
+
run: uv sync --extra test
|
|
35
|
+
- name: Unit tests (fast subset)
|
|
36
|
+
run: uv run --extra test pytest tests/unit -q -m "not slow"
|
|
37
|
+
|
|
38
|
+
# Confirm the package installs and runs on the lower bound of requires-python.
|
|
39
|
+
# Core deps only (no PySCF), so this is a cheap import + tiny-calc smoke.
|
|
40
|
+
compat:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
python-version: ["3.11", "3.12"]
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v7
|
|
48
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
cache-dependency-glob: "pyproject.toml"
|
|
52
|
+
- name: Sync (core only)
|
|
53
|
+
run: uv sync --no-dev
|
|
54
|
+
- name: Import + tiny-calc smoke
|
|
55
|
+
run: >
|
|
56
|
+
uv run --no-dev python -c "import jax; jax.config.update('jax_enable_x64', True);
|
|
57
|
+
import dftax; from dftax import run_ks; from dftax.system import Molecule;
|
|
58
|
+
from dftax.energy.xc import LDA;
|
|
59
|
+
r = run_ks(Molecule.from_xyz('H 0 0 0; H 0 0 0.74', 'sto-3g'), LDA());
|
|
60
|
+
assert r.converged; print('compat OK', dftax.__version__, r.converged)"
|
|
61
|
+
|
|
62
|
+
build:
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v7
|
|
66
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
67
|
+
with:
|
|
68
|
+
cache-dependency-glob: "pyproject.toml"
|
|
69
|
+
- name: Build sdist + wheel
|
|
70
|
+
run: uv build
|
|
71
|
+
- name: Check metadata
|
|
72
|
+
run: uvx twine check dist/*
|
|
73
|
+
- uses: actions/upload-artifact@v7
|
|
74
|
+
with:
|
|
75
|
+
name: dist
|
|
76
|
+
path: dist/
|
|
77
|
+
|
|
78
|
+
docs:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v7
|
|
82
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
83
|
+
with:
|
|
84
|
+
python-version: "3.13"
|
|
85
|
+
cache-dependency-glob: "pyproject.toml"
|
|
86
|
+
- name: Sync (docs deps)
|
|
87
|
+
run: uv sync --extra docs
|
|
88
|
+
- name: Build docs
|
|
89
|
+
run: uv run mkdocs build
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Deploy docs
|
|
2
|
+
|
|
3
|
+
# Builds the mkdocs site and publishes it to the gh-pages branch on every push to
|
|
4
|
+
# main. Enable GitHub Pages once (Settings -> Pages -> Source: gh-pages branch) so
|
|
5
|
+
# https://andresguzco.github.io/dftax/ serves it. PRs only build (in ci.yml), they
|
|
6
|
+
# do not deploy.
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
paths:
|
|
11
|
+
- "docs/**"
|
|
12
|
+
- "mkdocs.yml"
|
|
13
|
+
- "dftax/**"
|
|
14
|
+
- ".github/workflows/docs.yml"
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
deploy:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v7
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.13"
|
|
30
|
+
cache-dependency-glob: "pyproject.toml"
|
|
31
|
+
- name: Sync (docs deps)
|
|
32
|
+
run: uv sync --extra docs
|
|
33
|
+
- name: Deploy to gh-pages
|
|
34
|
+
run: uv run mkdocs gh-deploy --force
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Nightly (full suite)
|
|
2
|
+
|
|
3
|
+
# The full test suite (including the modules auto-marked `slow`: SCF sweeps,
|
|
4
|
+
# finite-difference properties, CPHF, density fitting and streaming, the d-shell
|
|
5
|
+
# ERI compile) is too heavy for every PR, so it runs once a day and on demand.
|
|
6
|
+
# The conftest per-test JAX cache release keeps memory bounded on the runner.
|
|
7
|
+
on:
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 6 * * *" # 06:00 UTC daily
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
full:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 120
|
|
16
|
+
env:
|
|
17
|
+
OMP_NUM_THREADS: "2"
|
|
18
|
+
XLA_PYTHON_CLIENT_PREALLOCATE: "false"
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.13"
|
|
24
|
+
cache-dependency-glob: "pyproject.toml"
|
|
25
|
+
- name: Sync (test deps)
|
|
26
|
+
run: uv sync --extra test
|
|
27
|
+
- name: Full test suite (including slow)
|
|
28
|
+
run: uv run --extra test pytest tests/unit -q
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Fires only on a version tag (e.g. `git tag v0.1.0 && git push --tags`).
|
|
4
|
+
# Uses PyPI Trusted Publishing (OIDC), so no API token is stored in the repo.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# Gate the release on the suite: a tag must never publish a failing build.
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v7
|
|
15
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
16
|
+
with:
|
|
17
|
+
cache-dependency-glob: "pyproject.toml"
|
|
18
|
+
- name: Sync (test extra)
|
|
19
|
+
run: uv sync --extra test
|
|
20
|
+
- name: Lint
|
|
21
|
+
run: uv run ruff check .
|
|
22
|
+
- name: Test
|
|
23
|
+
run: uv run pytest tests/unit -m "not slow" -q
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: [test]
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: pypi
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write # required for OIDC trusted publishing
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v7
|
|
33
|
+
- uses: astral-sh/setup-uv@v8.2.0
|
|
34
|
+
with:
|
|
35
|
+
cache-dependency-glob: "pyproject.toml"
|
|
36
|
+
- name: Build
|
|
37
|
+
run: uv build
|
|
38
|
+
- name: Publish
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
dftax-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info
|
|
5
|
+
|
|
6
|
+
# results
|
|
7
|
+
results/
|
|
8
|
+
|
|
9
|
+
# Checkpoints and model weights
|
|
10
|
+
*.eqx
|
|
11
|
+
*.pkl
|
|
12
|
+
*.pt
|
|
13
|
+
*.pth
|
|
14
|
+
*.h5
|
|
15
|
+
*.hdf5
|
|
16
|
+
*.npz
|
|
17
|
+
*.npy
|
|
18
|
+
*.ckpt
|
|
19
|
+
|
|
20
|
+
# docs
|
|
21
|
+
docs/_build/
|
|
22
|
+
/.dir-locals.el
|
|
23
|
+
*bazel-*
|
|
24
|
+
*tmp*
|
|
25
|
+
*viztracer*
|
|
26
|
+
*profiler*
|
|
27
|
+
/compile_commands.json
|
|
28
|
+
*.whl
|
|
29
|
+
*.DS_Store
|
|
30
|
+
*.ipynb_checkpoints
|
|
31
|
+
__pycache__/
|
|
32
|
+
# results/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# somewhat against the advice but doing this anyway to support gpu as an optional dependency
|
|
36
|
+
uv.lock
|
|
37
|
+
|
|
38
|
+
# IDE
|
|
39
|
+
.vscode
|
|
40
|
+
|
|
41
|
+
# jupyter-book derived files
|
|
42
|
+
docs/_autosummary
|
|
43
|
+
docs/_build
|
|
44
|
+
.benchmarks/
|
|
45
|
+
|
|
46
|
+
# Byte-compiled / optimized / DLL files
|
|
47
|
+
__pycache__/
|
|
48
|
+
*.py[cod]
|
|
49
|
+
*$py.class
|
|
50
|
+
|
|
51
|
+
# C extensions
|
|
52
|
+
*.so
|
|
53
|
+
|
|
54
|
+
# Distribution / packaging
|
|
55
|
+
.Python
|
|
56
|
+
build/
|
|
57
|
+
develop-eggs/
|
|
58
|
+
dist/
|
|
59
|
+
downloads/
|
|
60
|
+
eggs/
|
|
61
|
+
.eggs/
|
|
62
|
+
lib/
|
|
63
|
+
lib64/
|
|
64
|
+
parts/
|
|
65
|
+
sdist/
|
|
66
|
+
var/
|
|
67
|
+
wheels/
|
|
68
|
+
share/python-wheels/
|
|
69
|
+
*.egg-info/
|
|
70
|
+
.installed.cfg
|
|
71
|
+
*.egg
|
|
72
|
+
MANIFEST
|
|
73
|
+
|
|
74
|
+
# PyInstaller
|
|
75
|
+
# Usually these files are written by a python script from a template
|
|
76
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
77
|
+
*.manifest
|
|
78
|
+
*.spec
|
|
79
|
+
|
|
80
|
+
# Installer logs
|
|
81
|
+
pip-log.txt
|
|
82
|
+
pip-delete-this-directory.txt
|
|
83
|
+
|
|
84
|
+
# Unit test / coverage reports
|
|
85
|
+
htmlcov/
|
|
86
|
+
.tox/
|
|
87
|
+
.nox/
|
|
88
|
+
.coverage
|
|
89
|
+
.coverage.*
|
|
90
|
+
.cache
|
|
91
|
+
nosetests.xml
|
|
92
|
+
coverage.xml
|
|
93
|
+
*.cover
|
|
94
|
+
*.py,cover
|
|
95
|
+
.hypothesis/
|
|
96
|
+
.pytest_cache/
|
|
97
|
+
cover/
|
|
98
|
+
|
|
99
|
+
# Translations
|
|
100
|
+
*.mo
|
|
101
|
+
*.pot
|
|
102
|
+
|
|
103
|
+
# Django stuff:
|
|
104
|
+
*.log
|
|
105
|
+
local_settings.py
|
|
106
|
+
db.sqlite3
|
|
107
|
+
db.sqlite3-journal
|
|
108
|
+
|
|
109
|
+
# Flask stuff:
|
|
110
|
+
instance/
|
|
111
|
+
.webassets-cache
|
|
112
|
+
|
|
113
|
+
# Scrapy stuff:
|
|
114
|
+
.scrapy
|
|
115
|
+
|
|
116
|
+
# Sphinx documentation
|
|
117
|
+
docs/_build/
|
|
118
|
+
|
|
119
|
+
# PyBuilder
|
|
120
|
+
.pybuilder/
|
|
121
|
+
target/
|
|
122
|
+
|
|
123
|
+
# Jupyter Notebook
|
|
124
|
+
.ipynb_checkpoints
|
|
125
|
+
|
|
126
|
+
# IPython
|
|
127
|
+
profile_default/
|
|
128
|
+
ipython_config.py
|
|
129
|
+
|
|
130
|
+
# pyenv
|
|
131
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
132
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
133
|
+
# .python-version
|
|
134
|
+
|
|
135
|
+
# pipenv
|
|
136
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
137
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
138
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
139
|
+
# install all needed dependencies.
|
|
140
|
+
#Pipfile.lock
|
|
141
|
+
|
|
142
|
+
# poetry
|
|
143
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
144
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
145
|
+
# commonly ignored for libraries.
|
|
146
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
147
|
+
#poetry.lock
|
|
148
|
+
|
|
149
|
+
# pdm
|
|
150
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
151
|
+
#pdm.lock
|
|
152
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
153
|
+
# in version control.
|
|
154
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
155
|
+
.pdm.toml
|
|
156
|
+
|
|
157
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
158
|
+
__pypackages__/
|
|
159
|
+
|
|
160
|
+
# Celery stuff
|
|
161
|
+
celerybeat-schedule
|
|
162
|
+
celerybeat.pid
|
|
163
|
+
|
|
164
|
+
# SageMath parsed files
|
|
165
|
+
*.sage.py
|
|
166
|
+
|
|
167
|
+
# Environments
|
|
168
|
+
.env
|
|
169
|
+
.venv
|
|
170
|
+
env/
|
|
171
|
+
venv/
|
|
172
|
+
ENV/
|
|
173
|
+
env.bak/
|
|
174
|
+
venv.bak/
|
|
175
|
+
|
|
176
|
+
# Spyder project settings
|
|
177
|
+
.spyderproject
|
|
178
|
+
.spyproject
|
|
179
|
+
|
|
180
|
+
# Rope project settings
|
|
181
|
+
.ropeproject
|
|
182
|
+
|
|
183
|
+
# mkdocs documentation
|
|
184
|
+
/site
|
|
185
|
+
|
|
186
|
+
# mypy
|
|
187
|
+
.mypy_cache/
|
|
188
|
+
.dmypy.json
|
|
189
|
+
dmypy.json
|
|
190
|
+
|
|
191
|
+
# Pyre type checker
|
|
192
|
+
.pyre/
|
|
193
|
+
|
|
194
|
+
# pytype static type analyzer
|
|
195
|
+
.pytype/
|
|
196
|
+
|
|
197
|
+
# Cython debug symbols
|
|
198
|
+
cython_debug/
|
|
199
|
+
|
|
200
|
+
# PyCharm
|
|
201
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
202
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
203
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
204
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
205
|
+
#.idea/
|
|
206
|
+
#
|
|
207
|
+
wandb/
|
|
208
|
+
*.out
|
|
209
|
+
output/
|
|
210
|
+
|
|
211
|
+
.claude/
|
|
212
|
+
# FL working-tree leftovers (not part of the engine branch)
|
|
213
|
+
data/
|
|
214
|
+
data
|
|
215
|
+
paper/
|
|
216
|
+
third_party/
|
|
217
|
+
|
|
218
|
+
# Vendored engine data (required at runtime): Lebedev angular-grid tables and
|
|
219
|
+
# Cartesian->spherical transforms. Re-include the dir first, then the file, to
|
|
220
|
+
# override data/ and *.npz above.
|
|
221
|
+
!dftax/grid/data/
|
|
222
|
+
!dftax/grid/data/lebedev.npz
|
|
223
|
+
!dftax/basis/data/
|
|
224
|
+
!dftax/basis/data/cart2sph.npz
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
dftax-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to dftax are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/), and the project aims to adhere
|
|
5
|
+
to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-06-30
|
|
8
|
+
|
|
9
|
+
First public release: a differentiable Kohn-Sham DFT engine in pure JAX/Equinox,
|
|
10
|
+
validated against PySCF and on GPU. The whole calculation is differentiable, so
|
|
11
|
+
forces, response properties, and converged-density gradients all come from one
|
|
12
|
+
autodiff engine.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **RKS + UKS** total energies as differentiable `E(P)` functionals; the KS Fock
|
|
16
|
+
is `sym(∂E/∂P)` by autodiff (no hand-coded XC potential).
|
|
17
|
+
- Solvers: on-device DIIS **SCF** (`rks_scf`/`uks_scf`) with optional
|
|
18
|
+
**level-shifting**, and Adam **direct minimization** (`rks_minimize`/`uks_minimize`).
|
|
19
|
+
- **Analytic nuclear forces** via autodiff (`rks_forces`/`uks_forces`), FD-checked.
|
|
20
|
+
- **Response properties**: dipole, polarizability, Hessian, vibrational
|
|
21
|
+
frequencies, IR and Raman intensities, and alchemical derivatives (∂E/∂Z).
|
|
22
|
+
- **Implicit differentiation** of the SCF fixed point (CPHF) for gradients of
|
|
23
|
+
converged quantities, used for the analytic polarizability.
|
|
24
|
+
- **Batched** energies and forces over many geometries via `vmap`
|
|
25
|
+
(`run_rks_batched`/`run_uks_batched`/`run_ks_batched`).
|
|
26
|
+
- **Integrals** (Obara-Saika / McMurchie-Davidson): overlap, kinetic, nuclear
|
|
27
|
+
attraction, nuclear repulsion, and 2-/3-/4-center ERIs; up to **g (l=4)**;
|
|
28
|
+
spherical-harmonic (`cart2sph`) support; shell-pair-batched builders.
|
|
29
|
+
- **XC functionals**: LDA (Slater + VWN5), PBE, PBE0, B3LYP; all closed- **and**
|
|
30
|
+
open-shell.
|
|
31
|
+
- **Coulomb/exchange backends**: exact 4-center ERI; RI density fitting (RI-J /
|
|
32
|
+
RI-K); Cauchy-Schwarz screening.
|
|
33
|
+
- **Memory-light paths**: streamed exact J/K, streamed + Schwarz-screened RI-J,
|
|
34
|
+
orbital-chunk streamed RI-K (with an exact `custom_vjp`), and streamed XC grid,
|
|
35
|
+
removing the O(N⁴)/nao²×naux materialization on every RKS/UKS path.
|
|
36
|
+
- **Native pipeline**: a `Molecule` loader (Basis Set Exchange) and a native
|
|
37
|
+
Becke/Lebedev integration grid, so the compute path needs no PySCF, libcint, or
|
|
38
|
+
libxc at runtime.
|
|
39
|
+
- **Validation/benchmark harnesses**: `scripts/gpu/validate_gpu.py` (+
|
|
40
|
+
`GPU_VALIDATION.md`) and `scripts/bench/benchmark.py` (+ `BENCHMARKS.md`).
|
|
41
|
+
|
|
42
|
+
### Notes
|
|
43
|
+
- Accuracy vs PySCF/libxc: LDA/B3LYP ~machine precision; PBE/PBE0 ~1e-5 Ha (the
|
|
44
|
+
hand-rolled GGA enhancement factors).
|
|
45
|
+
- GPU is opt-in: `pip install dftax[cuda12]` (Linux). PySCF is a test-only oracle.
|
dftax-0.1.0/CITATION.cff
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use dftax in academic work, please cite it as below."
|
|
3
|
+
title: "dftax: a differentiable Kohn-Sham DFT engine in JAX"
|
|
4
|
+
abstract: >-
|
|
5
|
+
A differentiable Kohn-Sham density functional theory engine in pure JAX/Equinox.
|
|
6
|
+
Restricted and unrestricted DFT with autodiff Fock, analytic forces, response
|
|
7
|
+
properties, implicit-differentiation SCF response, density fitting, and a native
|
|
8
|
+
integration grid.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: "Guzmán-Cordero"
|
|
12
|
+
given-names: "Andrés"
|
|
13
|
+
email: "andres.guzman-cordero@mila.quebec"
|
|
14
|
+
version: "0.1.0"
|
|
15
|
+
license: Apache-2.0
|
|
16
|
+
repository-code: "https://github.com/andresguzco/dftax"
|
|
17
|
+
url: "https://github.com/andresguzco/dftax"
|
|
18
|
+
keywords:
|
|
19
|
+
- density functional theory
|
|
20
|
+
- quantum chemistry
|
|
21
|
+
- electronic structure
|
|
22
|
+
- JAX
|
|
23
|
+
- differentiable
|
|
24
|
+
- automatic differentiation
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to dftax
|
|
2
|
+
|
|
3
|
+
Thanks for your interest! dftax is a small, dependency-light, differentiable
|
|
4
|
+
Kohn-Sham DFT engine in pure JAX. A few conventions keep it that way.
|
|
5
|
+
|
|
6
|
+
## Development setup
|
|
7
|
+
|
|
8
|
+
Managed with [uv](https://docs.astral.sh/uv/) (Python ≥ 3.13):
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
uv sync --extra test # engine + test deps (pytest, scipy, pyscf)
|
|
12
|
+
uv sync --extra cuda12 # add the CUDA-12 jaxlib for GPU work (Linux)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Running tests
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv run --extra test pytest tests/unit -q # full unit suite
|
|
19
|
+
uv run --extra test pytest tests/unit -q -m "not slow" # skip heavy compiles
|
|
20
|
+
uv run --extra test pytest tests/unit/test_scf_rks.py -q # one file
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tests require float64 (`conftest.py` enables `jax_enable_x64`). **PySCF is a
|
|
24
|
+
reference oracle only**. It must never enter the compute path; use it to build a
|
|
25
|
+
reference energy/grid and compare. GPU correctness is validated interactively
|
|
26
|
+
(`scripts/gpu/validate_gpu.py`), not in CPU CI.
|
|
27
|
+
|
|
28
|
+
## Style
|
|
29
|
+
|
|
30
|
+
- `ruff check .` and `ruff format .` (line length 100).
|
|
31
|
+
- Match the surrounding code: typed `jaxtyping` shapes, small pure functions,
|
|
32
|
+
`eqx.Module` for stateful objects, chunked `vmap`/`lax.scan` for memory.
|
|
33
|
+
- New functionals / integrals: validate against PySCF/libxc to the documented
|
|
34
|
+
tolerance and add a unit test.
|
|
35
|
+
|
|
36
|
+
## Pull requests
|
|
37
|
+
|
|
38
|
+
Keep PRs focused, include a test that fails without the change, and run the
|
|
39
|
+
(non-slow) suite + ruff before submitting.
|