Sphinx Parser
Overview
This hosts the python binder of the DFT code Sphinx.
How to use
Sphinx's input parser is created from the yaml-file located at src/input_data.yml. The input file is generated by src/generator.py. You can use the parser via:
from sphinx_parser.input import sphinx
This instance sphinx is used to create all possible input classes for Sphinx by choosing the class via dot-notation and call it. For example in order to generate the class kPoints, you can run:
kPoints = sphinx.basis.kPoints()
You can find the input in the parent class, i.e.:
basis = sphinx.basis(kPoints=kPoints)
Finally, you can translate it into the Sphinx format via:
from sphinx_parser.toolkit import to_sphinx
sphinx_input = to_sphinx(basis)
You can then write it to a file via:
with open('sphinx.in', 'w') as f:
f.write(sphinx_input)
Minimum working example
import numpy as np
from ase.build import bulk
import os
cwd = "TEST"
if not os.path.exists(cwd):
os.mkdir(cwd)
from sphinx_parser.toolkit import to_sphinx
from sphinx_parser.jobs import set_base_parameters
from sphinx_parser.output import collect_energy_dat
structure = bulk("Al", cubic=True)
structure[1].symbol = "Ni"
input_sx = set_base_parameters(structure)
with open(os.path.join(cwd, "input.sx"), "w") as f:
f.write(to_sphinx(input_sx))
import subprocess
command = ["sphinx"]
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, cwd=cwd)
stdout, stderr = process.communicate()
collect_energy_dat(os.path.join(cwd, "energy.dat"))
More detailed example:
import numpy as np
from ase.build import bulk
import os
cwd = "TEST"
# cwd.mkdir(exist_ok=True)
if not os.path.exists(cwd):
os.mkdir(cwd)
from sphinx_parser.input import sphinx
from sphinx_parser.ase import get_structure_group
from sphinx_parser.toolkit import to_sphinx
from sphinx_parser.potential import get_paw_from_structure
from sphinx_parser.output import collect_energy_dat
structure = bulk("Al", cubic=True)
structure[1].symbol = "Ni"
struct_group, spin_lst = get_structure_group(structure)
main_group = sphinx.main(scfDiag=sphinx.main.scfDiag(maxSteps=10, blockCCG={}))
pawPot_group = get_paw_from_structure(structure)
basis_group = sphinx.basis(eCut=25, kPoint=sphinx.basis.kPoint(coords=3 * [0.5]))
paw_group = sphinx.PAWHamiltonian(xc=1, spinPolarized=False, ekt=0.2)
initial_guess_group = sphinx.initialGuess(
waves=sphinx.initialGuess.waves(lcao=sphinx.initialGuess.waves.lcao()), rho=sphinx.initialGuess.rho(atomicOrbitals=True)
)
input_sx = sphinx(
pawPot=pawPot_group, structure=struct_group, main=main_group, basis=basis_group, PAWHamiltonian=paw_group, initialGuess=initial_guess_group
)
with open(os.path.join(cwd, "input.sx"), "w") as f:
f.write(to_sphinx(input_sx))
import subprocess
command = ["sphinx"]
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, cwd=cwd)
stdout, stderr = process.communicate()
collect_energy_dat(os.path.join(cwd, "energy.dat"))
Metadata
Release files for sphinx-parser 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx_parser-0.1.11.tar.gz | 61.7 kB | Without provenance | Details for sphinx_parser-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_parser-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for sphinx_parser-0.1.11-py3-none-any.whl |
Total release size: 98.5 kB
Release files / sphinx_parser-0.1.11.tar.gz
| Download URL | sphinx_parser-0.1.11.tar.gz |
|---|---|
| Size | 61.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31f0f6b40f4b20eb49c2a57939d3bb69577d1302c81d6f36198998be6ae7a4a8
|
|
BLAKE2b-256 checksum How to use checksums |
d7b38ad3f5d0f02f5e1d1e742926ca5cf65f21aba994c019efcd3d0a27e300df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / sphinx_parser-0.1.11-py3-none-any.whl
| Download URL | sphinx_parser-0.1.11-py3-none-any.whl |
|---|---|
| Size | 36.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87d0d98253e4ee1562733f011bee454f696a6e729d4994a4d9b2d1cb62c588ad
|
|
BLAKE2b-256 checksum How to use checksums |
e78bc62a76f450dd18d3c25605f631dea0f74d79ed0848c1c8a3ce1c7d23906a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for sphinx-parser 0.1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.