off 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: off
3
+ Version: 0.1.0
4
+ Summary: A library for learning the ground state energy using orbital free density functional theory with continuous normalizing flows.
5
+ Author-email: Alexandre de Camargo <decamara@mcmaster.ca>
6
+ Project-URL: Homepage, https://github.com/AlexandreDeCamargo/of_flows
7
+ Project-URL: Repository, https://github.com/AlexandreDeCamargo/of_flows
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: jax>=0.6.0
15
+ Requires-Dist: jaxlib>=0.6.0
16
+ Requires-Dist: equinox>=0.12.0
17
+ Requires-Dist: diffrax>=0.7.0
18
+ Requires-Dist: optax>=0.2.0
19
+ Requires-Dist: scipy>=1.15.0
20
+ Requires-Dist: chex>=0.1.89
21
+ Requires-Dist: jaxtyping>=0.3.0
22
+ Requires-Dist: distrax>=0.1.5
23
+ Requires-Dist: pyscf>=2.7.0
24
+ Requires-Dist: pandas>=2.0.3
25
+ Requires-Dist: matplotlib>=3.10.0
26
+ Provides-Extra: examples
27
+ Requires-Dist: matplotlib>=3.10.0; extra == "examples"
28
+ Requires-Dist: chex>=0.1.89; extra == "examples"
29
+ Requires-Dist: numpy>=2.3.0; extra == "examples"
30
+ Dynamic: license-file
31
+
32
+ # OFF: An Orbital-Free Density Functional Theory Python library using Normalizing Flows
33
+
34
+ OFF is a [JAX](https://github.com/google/jax)-based library for **orbital-free density
35
+ functional theory (OF-DFT)** in which the electron density is represented by a
36
+ **continuous normalizing flow (CNF)** and the ground-state energy is obtained by
37
+ *variationally minimizing* a density functional with Monte-Carlo gradient estimates.
38
+ The density is normalized by construction (it is a probability flow), and the physical
39
+ density is recovered as `ρ(x) = Ne · ρ_φ(x)`.
40
+
41
+ OFF is built entirely on the JAX ecosystem — automatic differentiation, JIT
42
+ compilation, vectorization, and GPU acceleration — with
43
+ [Diffrax](https://github.com/patrick-kidger/diffrax) for the flow ODEs,
44
+ [Equinox](https://github.com/patrick-kidger/equinox) for the models and functionals,
45
+ [Distrax](https://github.com/google-deepmind/distrax) for the base distribution, and
46
+ [Optax](https://github.com/google-deepmind/optax) for the optimization.
47
+
48
+ ## Functionality
49
+
50
+ The current version of the library has the following capabilities:
51
+
52
+ * Provides an implementation of OF-DFT methods with continuous normalizing flows.
53
+ * A modular library of density functionals:
54
+ * **kinetic**: Thomas–Fermi, von Weizsäcker, and TF-λW;
55
+ * **exchange**: LDA and B88;
56
+ * **correlation**: VWN and PW92;
57
+ * **nuclear attraction**,
58
+ * **Hartree**, and
59
+ * **nuclear-cusp corrections** (Kato, Hutcheon).
60
+ * Evaluates density functionals using Monte Carlo estimators.
61
+ * In addition to Monte Carlo estimators, it also has a deterministic **grid (quadrature) readout** of the energy after training, using a
62
+ [PySCF](https://github.com/pyscf/pyscf) Becke grid converted to `jax.Array`.
63
+
64
+ ## Install
65
+
66
+ A core dependency is [PySCF](https://pyscf.org), which needs `cmake` available on the
67
+ `PATH`. In a fresh environment, from the repository root:
68
+
69
+ ```bash
70
+ pip install -e .
71
+ ```
72
+
73
+ The `db_sir` prior additionally requires AtomDB; install it only if you use that prior.
74
+
75
+ ## Use
76
+
77
+ Two stages: (1) **train** a normalizing flow for a given molecule and functional, then
78
+ (2) read out the energy on a **quadrature grid**. Both are exposed as command-line
79
+ tools (after `pip install -e .`) and as a Python API.
80
+
81
+ ### 1. Train a flow
82
+
83
+ ```bash
84
+ off-train --mol_name H2 --bond_length 1.4 \
85
+ --kin tf_w --lam 1/5 --x lda_b88_x --c none \
86
+ --hart coulomb --prior promolecular \
87
+ --solver dopri8 --epochs 500 --bs 512
88
+ ```
89
+ (equivalently `python -m off.main ...`). This minimizes the OF-DFT energy with the
90
+ Monte-Carlo estimator and writes everything under a method-tagged directory:
91
+
92
+ ```
93
+ Results/H2/tf_w_lam0.2_none_lda_b88_x_none_dopri8_promolecular_sched_mix/bl_1.40/
94
+ Checkpoints/checkpoint_*.eqx # the trained flow
95
+ training_metrics_ema.csv # EMA energy trace
96
+ job_params.json # everything needed to rebuild the run
97
+ ```
98
+
99
+ Key options: `--kin {tf,w,tf_w}`, `--x {lda,b88_x,lda_b88_x}`, `--c {vwn_c,pw92_c,none}`,
100
+ `--cc {kato,hutcheon,none}`, `--hart {coulomb,coulomb_}` (all-pairs / element-wise),
101
+ `--prior {promolecular,db_sir}`, `--solver {dopri5,tsit5,dopri8}`.
102
+
103
+ ### 2. Evaluate the energy on a grid
104
+
105
+ After training, point the quadrature tool at the run directory. It rebuilds the flow
106
+ from `job_params.json`, builds a PySCF grid, evaluates `ρ_φ` and its score there, and
107
+ integrates every energy term:
108
+
109
+ ```bash
110
+ off-quadrature Results/H2/tf_w_lam0.2_none_lda_b88_x_none_dopri8_promolecular_sched_mix/bl_1.40 --grid_level 3
111
+ ```
112
+ (equivalently `python -m off.quadrature ...`). It prints the per-term energies
113
+ (`T, V_N, V_H, E_X, E_C, E_CC, E_NN, E_total`) and the `∫ρ` check, and caches the
114
+ result in `energy_summary.json`. The same call from Python:
115
+
116
+ ```python
117
+ from off import grid_energy_from_checkpoint
118
+
119
+ e = grid_energy_from_checkpoint(
120
+ "Results/H2/.../bl_1.40", grid_level=3)
121
+ print(e["E_total"], e["Ne_integral"])
122
+ ```
123
+
124
+ ### Build a grid
125
+
126
+ ```python
127
+ from off import getGrid
128
+
129
+ h2_geom = "H 0 0 0; H 0 0 1.4"
130
+ w_grid, x_grid = getGrid(h2_geom, level=3, units="bohr")
131
+ ```
132
+
133
+ ## Package layout
134
+
135
+ ```
136
+ off/
137
+ main.py # training entry point (off-train)
138
+ quadrature.py # grid-energy readout (off-quadrature)
139
+ flow/ # the continuous normalizing flow (CNF)
140
+ ode_solver/ # Diffrax forward/reverse ODE solves
141
+ promolecular/ # base distributions (promolecular, AtomDB)
142
+ functionals/ # kinetic, exchange-correlation, nuclear, Hartree, cusp
143
+ train/ # loss (Monte-Carlo energy) and the optimization loop
144
+ ```
145
+
146
+ ## Citation
147
+
148
+ ```bibtex
149
+ @article{off,
150
+ title = {Orbital-Free DFT with Normalizing Flows},
151
+ author = {de Camargo, Alexandre and others},
152
+ year = {2026},
153
+ }
154
+ ```
@@ -0,0 +1,37 @@
1
+ off/__init__.py,sha256=ALVYNGD585q811-3aL94_cx8veoBFIE_g49tMp_NHu0,648
2
+ off/atom_energies.py,sha256=67Zj77F6gYomMBzuAAFMPpw6_MEwjEZPKZ6XOanIkSk,6458
3
+ off/main.py,sha256=BL2w7WmlvrAc9HJjxaumqqWhDl2EVzFyoI26vxJNGLY,6199
4
+ off/plot_binding_csv.py,sha256=A8f68xUGdtFEiBYCclm0AYNJQSOfzYfQEuYtxtGpO2w,2369
5
+ off/plot_pes_ema.py,sha256=GgdRHMLrHKenfP4hh1UqJH4EwFqEXj9C4XhYCWe2I5o,11391
6
+ off/plot_pes_mpl.py,sha256=OMT1S8Du0SNZJk_5uXQBfjUT32bWPVXnLuun2eFTNAI,11305
7
+ off/quadrature.py,sha256=1RenXdFdQw2yM4oyxJxONg1jMpJtKNiBJ5_7JBptgt0,11649
8
+ off/quadrature_scan.py,sha256=PJ8PswqAnL4oECyDTZVbQJzG6ToEvu9IsFNjiunmass,7639
9
+ off/scan_pes.py,sha256=bDHf1i_G-H2RRwn_54TOQlBuiy0UPPmN_PYHzqhXonQ,5554
10
+ off/test_fwd_rev.py,sha256=XkxV2sgsmHwx0Q5hmeC-h42sWNA-UF56n73Xh4C6nZE,13056
11
+ off/utils.py,sha256=NQgzFm1nZ5kS4ysN_FLaKUENzbw9iCAiEw6IYukKnU0,23844
12
+ off/config/_config.py,sha256=PwL2hUIjM9ruZ12S7xH5gFwXyor6AW8vKEaj4Ix1eXo,2754
13
+ off/dft_distrax/__init__.py,sha256=bZphcl4p3iJm7W7KLCCjXXSF_XEu_YfYUpEWDbSE-yI,1181
14
+ off/dft_distrax/dft_distrax.py,sha256=Yx1cFYwpFiG43BH7okykx2mT3B1bYAK9I8w6FL6GHPk,5994
15
+ off/flow/__init__.py,sha256=573x3ngNaxBEXsvorthaNrMcJBSzhYhaOVzxgKjxWx4,1196
16
+ off/flow/equiv_flows.py,sha256=KExeU8NNP1DmQSCYH0fdWEui-YPGLVvRVpw_Jj19yJ4,2953
17
+ off/functionals/__init__.py,sha256=v5gdzgt_IqtyP_qBe3-358p7RB6RI-P3PL3qgaNawnE,1522
18
+ off/functionals/core_correction.py,sha256=UKUHTGq3C2mYy8xDeICnq1U-JT7by0vSkhyTy5UIhEg,2990
19
+ off/functionals/exchange_correlation.py,sha256=44XBulYXmpvMwcMOd91BahcRAumRVMA2mCgZRO3LYeg,6034
20
+ off/functionals/external.py,sha256=m7UgLKo-oRpRcuGL_OHfaB-glyGkod95tEFD1mucaOM,1389
21
+ off/functionals/functional.py,sha256=KokOZwXBbHZPfafDadzR5EF52wQfKDfXA15Ax8F3OIU,5194
22
+ off/functionals/hartree.py,sha256=dwJKZ2_FSc9qkJCgQAhkfd2ExJiDw_hSiIK9ezbv9Yg,2226
23
+ off/functionals/kinetic.py,sha256=196RNHEo92hBO9IooIq8U44YL3nLtHQ-B8tKQ04mkig,2948
24
+ off/ode_solver/__init__.py,sha256=mYZkRmXbxN5fC95LSWrQjsxVWqjO_4O-HFn4I7R6x38,1228
25
+ off/ode_solver/eqx_ode.py,sha256=nlcg2u7_o-Y6RTMKc-RzKHisorhU4Rmza4Oyhpv-g9s,2792
26
+ off/promolecular/__init__.py,sha256=f53ZFDEDgGF_sop-vQuPPn7rJeqNuC9zh5LM-8p_dB0,1191
27
+ off/promolecular/promolecular_dist.py,sha256=03C5OEt5ZQZSIp8dtys_4k3h5Hi1rk9VSfU8XdQTzGY,17960
28
+ off/train/__init__.py,sha256=WB-GNBSR4Q1Dx3GWBukTsKTsmumSL8Gmb2KiVrHOrJg,1387
29
+ off/train/loop.py,sha256=nDqj62YvgXHeTnOyaRJ8qAtilVMc9gKYBCQdbIzZh1A,6981
30
+ off/train/loss.py,sha256=X-cVUgQJaUdaWPzSIrKfx-NV4ZftQbI2UkyEsnsuMjg,4634
31
+ off/train/utils.py,sha256=M2dyC_cF1y2ypy_AYxNbeIpi-MGV4vp8oHfhmpAcX5Y,1171
32
+ off-0.1.0.dist-info/licenses/LICENSE,sha256=G-KAKMtNilNsYiaAdjC4OR9CAH5DCm9Cbkk1iCN6dpA,1075
33
+ off-0.1.0.dist-info/METADATA,sha256=ySA7S66SiRbQ5ZHuj5R6_UNiNM-mEC6js7CYKR60Go4,5902
34
+ off-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
35
+ off-0.1.0.dist-info/entry_points.txt,sha256=A77cJ29nE_z1jmTLWkYxzjhbVMyj1W-OIHWZW0KM9ho,81
36
+ off-0.1.0.dist-info/top_level.txt,sha256=tHC4TPDNMYnhBhW__qfVy9n2ETS6HCz9UT3dRbd2pfY,4
37
+ off-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ off-quadrature = off.quadrature:main
3
+ off-train = off.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AlexandreDeCamargo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ off