sphinx_parser - Your pyiron-like module.
Project description
Sphinx
Overview
This hosts the python binder of the DFT code Sphinx.
How to use
Stinx'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 create. For example in order to generate the class kPoints, you can run:
kPoints = sphinx.basis.kPoints.create()
You can find the input in the parent class, i.e.:
basis = sphinx.basis.create(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.create(scfDiag=sphinx.main.scfDiag.create(maxSteps=10, blockCCG={}))
pawPot_group = get_paw_from_structure(structure)
basis_group = sphinx.basis.create(eCut=25, kPoint=sphinx.basis.kPoint.create(coords=3 * [0.5]))
paw_group = sphinx.PAWHamiltonian.create(xc=1, spinPolarized=False, ekt=0.2)
initial_guess_group = sphinx.initialGuess.create(
waves=sphinx.initialGuess.waves.create(lcao=sphinx.initialGuess.waves.lcao.create()), rho=sphinx.initialGuess.rho.create(atomicOrbitals=True)
)
input_sx = sphinx.create(
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"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_parser-0.0.3.tar.gz.
File metadata
- Download URL: sphinx_parser-0.0.3.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
699801ad2b1eba8f30e62e04bd91bf09d6c7e794ff84ec6a8a4ee01254f28c53
|
|
| MD5 |
6605d994525af1fbae6bf229448fa360
|
|
| BLAKE2b-256 |
9df752453a39ffda91f4dad90bdbc5a8c780d4121da9745ea69e4a50428bfd8d
|
File details
Details for the file sphinx_parser-0.0.3-py3-none-any.whl.
File metadata
- Download URL: sphinx_parser-0.0.3-py3-none-any.whl
- Upload date:
- Size: 35.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dbea00f792f473d8c875aa008fa25203658df830a83324be32b4443cf536bfb
|
|
| MD5 |
dc4e5d3407a68e48818dd38b0d4fad8b
|
|
| BLAKE2b-256 |
af4c78b7e88459d99946ff2c4485ebf49d92eccab37dfbff2fe8267dc93e789b
|