Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b759556
Generate rst files for the tree used by Sphinxs, wihtout Sphinxs
OsHCuellar Oct 31, 2025
df875e3
update theme and fix bugs with images
OsHCuellar Oct 31, 2025
b171b6e
update documentation files
OsHCuellar Oct 31, 2025
75151c6
add instructions for creating the documentation
OsHCuellar Oct 31, 2025
ed1b182
Remove generated files from tree
briling Nov 8, 2025
f18bc3b
Cleanup script with ruff
briling Nov 8, 2025
6b9025a
add command-line docs logic
liam-o-marsh Nov 10, 2025
a3538e9
wip-fix: make docs-building far less reliant on imports
liam-o-marsh Nov 11, 2025
439c991
Generate rst when qstack is not installed
briling Nov 11, 2025
c1c7709
Reorganize regression module so argument parsing does not need much
briling Nov 11, 2025
fa78bf1
Fixup
briling Nov 11, 2025
0ab5939
fix: properly add ρ-spahm command line documentation
liam-o-marsh Nov 12, 2025
782a435
Reorganize SPAHM module so argument parsing does not need much
briling Nov 12, 2025
6f9d600
Add workflow to test doc build
briling Nov 12, 2025
8764702
Update test-doc-build.yml
briling Nov 12, 2025
6640e4f
Revert "Reorganize SPAHM module so argument parsing does not need much"
briling Nov 12, 2025
253770a
Revert "fix: properly add ρ-spahm command line documentation"
briling Nov 12, 2025
252f92d
Revert "Fixup"
briling Nov 12, 2025
f584674
Revert "Reorganize regression module so argument parsing does not nee…
briling Nov 12, 2025
89af879
Revert "Generate rst when qstack is not installed"
briling Nov 12, 2025
1abdd89
Revert "wip-fix: make docs-building far less reliant on imports"
briling Nov 12, 2025
cafb82b
Use the same cache to build the docs
briling Nov 12, 2025
bdd22cd
Put sphinx argparse back
briling Nov 12, 2025
0088247
Do not run twice if push to a branch while PR
briling Nov 12, 2025
574c29e
Fixup
briling Nov 12, 2025
8258bc5
Try to deploy docs
briling Nov 12, 2025
76b2b04
Add env
briling Nov 12, 2025
ce2612b
fix: add docs builds into gitignore
liam-o-marsh Nov 12, 2025
fbdf47d
feat: make the docs' TOC into a tree
liam-o-marsh Nov 12, 2025
5c293a9
Remove the note
briling Nov 12, 2025
b2a2fa7
Update README
briling Nov 12, 2025
eca8cfd
Remove TOC from the main page
briling Nov 12, 2025
038f80c
Reapply "fix: properly add ρ-spahm command line documentation"
briling Nov 12, 2025
0f33581
Use autodoc so the docstrings are parsed
briling Nov 12, 2025
3b8d069
fix: more TOCtree fixes in documentation
liam-o-marsh Nov 13, 2025
75e7ed9
Fixup
briling Nov 13, 2025
ba4b1a2
Change theme. Modules first in TOC
briling Nov 13, 2025
2762442
fix: re-add sphinx deps in pyproject
liam-o-marsh Nov 13, 2025
2ac7931
Do not try to deploy if not push to master
briling Nov 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/docs-build-test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Test documentation build

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

env:
CACHE_NUMBER: 0 # increase to reset cache manually

jobs:
build:

if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/my-env

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
activate-environment: my-env

- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache

- name: Update environment
run: conda env update -n my-env -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install documentation requirements
shell: bash -l {0}
run: pip install -r docs/requirements.txt

- name: Build documentation src
shell: bash -l {0}
run: make build-src -C docs/

- name: Build HTML
shell: bash -l {0}
run: make html -C docs/

- name: Upload artifacts
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html/

deploy:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest

environment:
name: github-pages

permissions:
pages: write
id-token: write

steps:
- name: Deploy
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ name: Lint with Ruff
on:
push:
branches:
- main
- '*'
pull_request:
branches:
- '*'

jobs:
lint:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/python-package-conda-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ env:
jobs:
build:

# https://github.com/orgs/community/discussions/57827
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name


strategy:
matrix:
include:
Expand All @@ -34,7 +38,7 @@ jobs:
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build C
run: make -C qstack/regression/lib/
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/python-package-conda.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ __pycache__/
# C extensions
*.so

# docs
docs/source/qstack
docs/source/index.rst
docs/build/

# Distribution / packaging
.Python
build/
Expand Down Expand Up @@ -73,6 +78,8 @@ instance/

# Sphinx documentation
docs/_build/
docs/build/
docs/source/qstack

# PyBuilder
target/
Expand Down
109 changes: 67 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,12 @@ Q-stack
<p align="center"><img alt="qstack logo" align="center" src="./images/logo.png" width=66%></p>


## Contents
* [Contents](#Contents-)
* [About](#about-)
* [Install](#install-)
* [Examples](#examples-)
* [References](#references-)
* [Acknowledgements](#acknowledgements-)
## About

## About [↑](#contents)
Q-stack is a stack of codes for dedicated pre- and post-processing tasks for Quantum Machine Learning (QML).
It is a work in progress. Stay tuned for updates!

Q-stack is a stack of codes for dedicated pre- and post-processing tasks for Quantum Machine Learning (QML). It is a work in progress. Stay tuned for updates!

For now, we link to the relevant packages that will be incorporated (among others):
- [x] https://github.com/lcmd-epfl/azo-xcite-tools
- [x] https://github.com/lcmd-epfl/SPAHM
- [x] https://github.com/lcmd-epfl/SPAHM-RHO
- [x] https://github.com/lcmd-epfl/RHO-Decomposition
- [ ] https://github.com/lcmd-epfl/ml-density
- [x] https://github.com/lcmd-epfl/OTPD-basis
- [x] https://github.com/lcmd-epfl/b2r2-reaction-rep

## Install [↑](#contents)
## Install

The installation of the library for python use can be done executing one of the following commands:

Expand All @@ -39,44 +23,85 @@ python -m pip install "qstack[all] @ git+https://github.com/lcmd-epfl/Q-stack.gi

The last one is recommended if you do not know which features you wish to use, since they pull the dependencies required with all 'optional' parts of Q-stack.

### Features:

| feature | capability |
|---|---|
| `[pyscf]` | quantum-chemical computations, wrappers, and conversion tools |
| `[qml]` | stucture-based representations such as SLATM, SLATM_d, B2R2 (no quantum chemistry) |
| `[spahm]` | SPAHM (ε-SPAHM, SPAHM(a,b)) representations |
| `[cell2mol]` | interface with [cell2mol](https://github.com/lcmd-epfl/cell2mol) |
| `[equio]` | interface with [metatensor](https://github.com/metatensor/metatensor) |
| `[regression]` | tools to run kernel ridge regression (no quantum chemistry) |
| `[wigner]` | tool to compute Wigner d-matrices for real spherical harmonics |


If you want to be able to edit Q-stack's code after installing, you need to download it yourself, for instance with this series of commands

```bash
git clone https://github.com/lcmd-epfl/Q-stack
cd Q-stack

#optionally, run the following line, if you want to be extra-careful about reproducibility, by installing a well-known version of all dependencies
python -m pip install -r requirements.py3.11.txt # (or "requirements.py3.9.txt" if you have an older version of python and that first file doesn't work)
python -m pip install -r requirements.py3.13.txt # (or "requirements.py3.{9,11}.txt" if you have an older version of python and that first file doesn't work)

python -m pip install -e .[all] # note: this translates as "install as '-e'ditable, install from this directory ('.'), with optional feature 'all'"
```

For the optional step above, we also have an `environment.yml` file available, if you prefer working with conda environments.


## Examples [↑](#contents)
Q-stack comes with several example codes that illustrate some of its key capabilities. To run the examples, go to the example folder and run the following commands:
## Examples
Q-stack comes with several example codes that illustrate some of its key capabilities.
Check out the `examples/` and `tests/` folders:

- Field decomposition:
```
python example_deco.py
```
- Computation of Hirshfeld charges:
```
python example_hirsh.py
```
- Basis set optimization:
```
python example_opt.py
```
- Generation of the SPAHM representation:
```
python example_SPAHM.py
```
- An example for the structure-based reaction representations ($B^2R^2$ and $\mathrm{SLATM}_d$) will follow shortly
* Field decomposition:
- [`examples/example_deco.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/examples/example_deco.py)
- [`tests/test_fitting.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_fitting.py)

* Computation of Hirshfeld charges:
- [`examples/example_hirsh.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/examples/example_hirsh.py)

* Basis set optimization:
- [`examples/example_opt.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/examples/example_opt.py)

* Generation of the ε-SPAHM representation:
- [`examples/example_SPAHM.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/examples/example_SPAHM.py)
- [`tests/test_spahm.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_spahm.py)
- [`tests/test_spahm_grad.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_spahm_grad.py)

* Generation of the SPAHM(a,b) representations:
- [`tests/test_spahm_a.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_spahm_a.py)
- [`tests/test_spahm_b.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_spahm_b.py)
- [`tests/test_spahm_b_selected.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_spahm_b_selected.py)

* Reaction representations ($B^2R^2$ and $\mathrm{SLATM}_d$):
- [`tests/test_rxn-repr.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_rxn-repr.py)

* Computation of DORI (density overlap regions indicator):
- [`tests/test_dori.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_dori.py)

* Interface with [cell2mol](https://github.com/lcmd-epfl/cell2mol):
- [`tests/test_c2mio.py`](https://github.com/lcmd-epfl/Q-stack/tree/master/tests/test_c2mio.py)

* Parsing ORCA binary output:
- [`examples/example_orcaio.py`](https://github.com/lcmd-epfl/tree/master/examples/example_orcaio.py)
- [`tests/test_orca.py`](https://github.com/lcmd-epfl/tree/master/tests/test_orca.py)


## Sources

Relevant packages incorporated (among others):
* [https://github.com/lcmd-epfl/azo-xcite-tools](https://github.com/lcmd-epfl/azo-xcite-tools)
* [https://github.com/lcmd-epfl/SPAHM](https://github.com/lcmd-epfl/SPAHM)
* [https://github.com/lcmd-epfl/SPAHM-RHO](https://github.com/lcmd-epfl/SPAHM-RHO)
* [https://github.com/lcmd-epfl/RHO-Decomposition](https://github.com/lcmd-epfl/RHO-Decomposition)
* [https://github.com/lcmd-epfl/OTPD-basis](https://github.com/lcmd-epfl/OTPD-basis)
* [https://github.com/lcmd-epfl/b2r2-reaction-rep](https://github.com/lcmd-epfl/b2r2-reaction-rep)
* [https://github.com/lcmd-epfl/ml-density](https://github.com/lcmd-epfl/ml-density)


## References [↑](#contents)
## References

* A. Fabrizio, A. Grisafi, B. Meyer, M. Ceriotti, and C. Corminboeuf,
“Electron density learning of non-covalent systems”,
Expand Down Expand Up @@ -114,7 +139,7 @@ python example_SPAHM.py
[![DOI](https://img.shields.io/badge/DOI-10.1088/2632--2153/ac8f1a-blue)](https://doi.org/10.1088/2632-2153/ac8f1a)


## Acknowledgements [↑](#contents)
## Acknowledgements
The authors of Q-stack acknowledge the National Centre of Competence in Research (NCCR)
"Materials' Revolution: Computational Design and Discovery of Novel Materials (MARVEL)"
of the Swiss National Science Foundation (SNSF, grant number 182892)
Expand Down
13 changes: 10 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
Expand All @@ -12,6 +9,16 @@ BUILDDIR = build
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs:
make build-src
make html

clean-src:
@rm -rfv source/qstack/ source/index.rst

build-src:
@python generate_rst.py ../qstack/ -o source/ --project "Qstack" --package-root-name qstack

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
Expand Down
15 changes: 15 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Instructions to create the documentation in html format

Install Sphinx:

```bash
pip install -r requirements.txt
```

```bash
make clean clean-src
make docs
```

You can access the documenation on `Q-stack/docs/build/html/index.html`

Binary file removed docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/build/doctrees/index.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/modules.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/qstack.basis_opt.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/qstack.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/qstack.fields.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/qstack.regression.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/qstack.spahm.doctree
Binary file not shown.
4 changes: 0 additions & 4 deletions docs/build/html/.buildinfo

This file was deleted.

Binary file removed docs/build/html/_images/ackw.png
Binary file not shown.
Binary file removed docs/build/html/_images/logo.png
Binary file not shown.
Loading
Loading