-
Notifications
You must be signed in to change notification settings - Fork 1
Add injectable potentials to allow per-element PAW path and potType override #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # sphinx_parser | ||
|
|
||
| Python interface for the [Sphinx DFT code](https://sxrepo.mpie.de) — a high-performance density functional theory (DFT) package developed at the Max Planck Institute. | ||
|
|
||
| ## What this project does | ||
|
|
||
| - Provides a Python API to construct Sphinx input files programmatically | ||
| - Integrates with ASE (Atomic Simulation Environment) as a standard `FileIOCalculator` | ||
| - Auto-generates input classes from a YAML specification (`sphinx_parser/src/input_data.yml`) | ||
| - Parses Sphinx output files (logs, energies, forces) | ||
| - Handles unit conversions between Hartree/Bohr (Sphinx) and eV/Å (ASE) | ||
|
|
||
| ## Data flow | ||
|
|
||
| ``` | ||
| input_data.yml → generator.py → input.py (generated, do not hand-edit) | ||
| ↓ | ||
| jobs.py (convenience wrappers) | ||
| ↓ | ||
| toolkit.py (serialisation to .sx format) | ||
| ↓ | ||
| calculator.py or manual file write | ||
| ↓ | ||
| input.sx → [Sphinx binary] | ||
| ↓ | ||
| sphinx.log / energy.dat / forces.sx | ||
| ↓ | ||
| output.py (SphinxLogParser) | ||
| ``` | ||
|
|
||
| ## Key files | ||
|
|
||
| | File | Role | | ||
| |------|------| | ||
| | `sphinx_parser/input.py` | Auto-generated input classes — **do not edit by hand** | | ||
| | `sphinx_parser/src/input_data.yml` | Source-of-truth YAML spec for all Sphinx input parameters | | ||
| | `sphinx_parser/src/generator.py` | Reads the YAML and regenerates `input.py` | | ||
| | `sphinx_parser/calculator.py` | ASE `FileIOCalculator` subclass (`SphinxDft`) | | ||
| | `sphinx_parser/jobs.py` | High-level helpers (`set_base_parameters`, `apply_minimization`) | | ||
| | `sphinx_parser/toolkit.py` | Low-level formatting (`to_sphinx`, `format_value`, `fill_values`) | | ||
| | `sphinx_parser/ase.py` | ASE ↔ Sphinx structure conversion | | ||
| | `sphinx_parser/output.py` | `SphinxLogParser` — parses log files into result dicts | | ||
| | `sphinx_parser/potential.py` | PAW potential lookup (VASP and JTH formats) | | ||
|
|
||
| ## Regenerating input.py | ||
|
|
||
| ```bash | ||
| python sphinx_parser/src/generator.py | ||
| ``` | ||
|
|
||
| Run this after editing `input_data.yml`. | ||
|
|
||
| ## Tests | ||
|
|
||
| ```bash | ||
| python -m pytest tests/ | ||
| ``` | ||
|
|
||
| - `tests/unit/` — unit tests for jobs, output parsing, generator | ||
| - `tests/integration/` — integration tests including README examples | ||
| - `tests/static/` — static reference data | ||
|
|
||
| CI runs on Python 3.11–3.14 via GitHub Actions. | ||
|
|
||
| ## Code style | ||
|
|
||
| ```bash | ||
| black sphinx_parser/ | ||
| ruff check sphinx_parser/ | ||
| ``` | ||
|
|
||
| Both are enforced in CI. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - **numpy**, **ase** — core scientific stack | ||
| - **semantikon**, **pint** — unit handling | ||
| - **h5py** — HDF5 I/O | ||
| - **pyyaml** — YAML parsing | ||
|
|
||
| ## Active branch: `calculator` | ||
|
|
||
| This branch adds `calculator.py` — the new ASE `FileIOCalculator` interface. It is not yet on `main`. | ||
|
|
||
| ## Notes | ||
|
|
||
| - Units inside Sphinx are Hartree / Bohr; the calculator layer converts to eV / Å for ASE. | ||
| - Atom ordering in Sphinx input must group species together; `sphinx_parser/ase.py` handles this reordering. | ||
| - Magnetic moments and constraints are also handled in `ase.py`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
potTypedocumentation/examples here use"VASP", but the rest of this PR’s usage/tests use"VaspPAW". IfpotTypeis case-sensitive, this docstring could mislead users—please clarify the validpotTypevalues and align the examples with what the library actually expects.