Metadata-Version: 2.4
Name: alchemi
Version: 0.1.0
Summary: Thermodynamic routing of multi-reference quantum chemistry: C/T skeleton pre-screening and MGE-based active-space selection for CASSCF
Project-URL: Homepage, https://github.com/roguetrainer/alchemi
Project-URL: Documentation, https://roguetrainer.github.io/alchemi
Project-URL: Repository, https://github.com/roguetrainer/alchemi
Project-URL: Bug Tracker, https://github.com/roguetrainer/alchemi/issues
Project-URL: Paper, https://doi.org/10.5281/zenodo.21300667
Author-email: "Ian R. C. Buckley" <ian.r.c.buckley@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Ian R. C. Buckley
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: CASSCF,DFT,NOON,PySCF,active space,density functional theory,electronic structure,multi-reference,natural orbitals,quantum chemistry
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: pyscf
Requires-Dist: pyscf>=2.4; extra == 'pyscf'
Description-Content-Type: text/markdown

# Alchemi

**Thermodynamic routing of multi-reference quantum chemistry.**

Alchemi builds a C/T skeleton from MP2 natural orbital occupation numbers
(NOONs), classifies each electron pair into an H^k stratum, and routes
the computation to the right method — automatically, without fitting parameters.

| Stratum | NOON pattern | θ_G | Method |
|---------|-------------|-----|--------|
| H⁰ (C-box) | near 2/0 | < 5° | Freeze / DFT |
| H¹ (T-arrow) | near 1, c₂ < δ* | 5–20° | CCSD |
| H² (T-arrow) | near 1, c₂ ≥ δ* | > 20° | CASSCF |

The routing threshold δ* = (π/4)√α is derived from the MGE cost-accuracy
tradeoff — not tuned on a validation set.

## Quickstart

```python
from pyscf import gto, scf, mp
from alchemi import Skeleton, Router

# Run a cheap MP2 calculation
mol = gto.M(atom="N 0 0 0; N 0 0 1.1", basis="cc-pVDZ", verbose=0)
mf  = scf.RHF(mol).run()
mp2 = mp.MP2(mf).run()

# Build the C/T skeleton
skel = Skeleton.from_pyscf(mol, mp2)
skel.report()

# Get the recommended CASSCF active space
active_orbs, n_elec = skel.active_space()
print(f"Active space: CAS({n_elec},{len(active_orbs)})")

# Soft MGE routing with β_eff
router = Router(skel, homo_lumo_gap=0.43, spin_multiplicity=1)
router.report()
```

## Installation

```bash
pip install alchemi            # core (numpy/scipy only)
pip install alchemi[pyscf]     # with PySCF integration
pip install alchemi[dev]       # with test/lint tools
```

## Theory

Alchemi implements the theoretical framework of:

- **Paper 588** — The Topological Active Space: Weak Lifting and C/T Skeleton
  Pre-Screening for CASSCF. [doi:10.5281/zenodo.21300667](https://doi.org/10.5281/zenodo.21300667)

- **Paper 491** — Galois Chemistry as the Tropical Degeneration of Density
  Functional Theory. [doi:10.5281/zenodo.21224113](https://doi.org/10.5281/zenodo.21224113)

- **Paper 596** — Weyl Chamber Homology as a DFT Failure Detector. (in preparation)

The routing is based on the **Maslov-Gibbs Einsum** (MGE) at finite inverse
temperature β_eff = Δ_HL / (corr_scale · (2S+1)). Hard thresholds (autoCAS,
AVAS) are recovered at β_eff → ∞. Alchemi gives the correct soft blend near
the H¹/H² boundary.

## Related tools

- [spectrafold](https://github.com/roguetrainer/spectrafold) — Racah spectroscopy
  from the quantum numbers that Alchemi computes
- [thermion](https://github.com/roguetrainer/thermion) — the shared ISA engine
  underlying both packages

## Citation

```bibtex
@software{alchemi2026,
  author  = {Buckley, Ian R. C.},
  title   = {Alchemi: Thermodynamic Routing of Multi-Reference Quantum Chemistry},
  year    = {2026},
  url     = {https://github.com/roguetrainer/alchemi},
}
```
