Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: aps.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.4%) to scientific vocabulary
Repository
PyMBXAS: Python-based MBXAS implementation
Basic Info
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
PyMBXAS: Python-based many-body XAS implementation
PyMBXAS is a package for setting up, manipulating, running and visualizing Many-Body X-ray Adsorption Spectroscopy (MBXAS) calculations using Python. It has an object-oriented approach to simplify the task of spectra analysis and post-processing. PyMBXAS leverages the PySCF electronic structure code and the Atomic Simulation Environment (ASE).
The MBXASplorer class implements a Bayesian optimization method that autonoumosly trains a Gaussian Process Regression model to learn the spectra using atomic structures as input. It is still under development, but stay tuned for when it releases!
Requirements
You need to have both PySCF and ASE installed in your Python environment. If you want to use GPU capabilities make sure to install gpu4pyscf.
Installation
You can install the latest stable release of the package by running:
bash
pip install pymbxas
or if you want the most up to date version:
bash
pip install git+https://gitlab.com/roncofaber/pymbxas.git
Alternatively, you can clone the repo and add it to your PYTHONPATH.
Usage
To run a MBXAS calculation, you just need to set up the PySCF_mbxas object:
```python import ase import ase.build from pymbxas.calculators.pyscf import PySCF_mbxas
read structure in ASE format
structure = ase.build.molecule("H2O")
set up calculation parameters
channel = 1 charge = 0 # charge of system spin = 0 # spin of system to_excite = "O" # index(es)/symbols of atom(s) to excite basis = "def2-svpd" xc = "lda"#"b3lyp" pbc = False
set up object (showing all extra arguments, many are optional)
obj = PySCFmbxas( structure = structure, charge = charge, spin = spin, xc = xc, basis = basis, pbc = pbc, # enable PBC or not solvent = None, # specify solvent epsilon calctype = "UKS", # UKS or UHF doxch = True, # do XCH to align energy loctype = "ibo", # localization routine
pkl_file = None, # reload previous calculation from pkl
target_dir = None, # run the calculation in a target dir
xas_verbose = 3, # verbose level of pymbxas
xas_logfile = "pymbxas.log", # file for mbxas log
dft_verbose = 6, # verbose level of pyscf
dft_logfile = "pyscf.log", # file for pyscf log
dft_output = False, # print pyscf output or not on terminal
print_fchk = False, # print FCHK files as calculation goes
save = True, # save object as pkl file
save_chk = False, # save calculation as chkfile
save_name = "pyscf_obj.pkl", # name of saved file
save_path = None, # path of saved object
gpu = False,
)
run calculation (GS + FCH + XCH)
obj.kernel(to_excite)
run calculation (GS + FCH + XCH)
obj.kernel(to_excite) ```
Output:
```console [16:01:53] |(I) |----------------------------------| | | |>>>>>> Starting PyMBXAS <<<<<<| | | | ver 0.5.0 | 11 Nov. 2024 | |----------------------------------|
[16:01:53] |(I) Started a new GS calculation [16:01:56] |(I) GS finished in 2.9 s.
[16:01:56] |(I) -----> Exciting O atom # 0 <-----| [16:01:56] |(I) >>> Started FCH calculation. [16:01:59] |(I) >>>>> FCH finished in 3.0 s. [16:01:59] |(I) >>> Started XCH calculation. [16:02:02] |(I) >>>>> XCH finished in 2.4 s. [16:02:02] |(I) >>> Started MBXAS calculation. [16:02:02] |(I) >>>>> MBXAS finished in 0.0 s [✓]. [16:02:02] |(I) ----- Excitation successful! -----|
[16:02:02] |(I) Saved everything as pyscf_obj.pkl [16:02:02] |(I) PyMBXAS finished successfully! ```
The spectra can then be obtained with:
```python import matplotlib.pyplot as plt
E, I = obj.getmbxasspectra(to_excite)#, erange=[395, 430], sigma=0.006)
plt.figure() plt.plot(E,I) plt.show() ```
Calculations can be stored as pkl files using the dill package. You can then simply reload a calculation doing:
```python obj = PySCFmbxas(pklfile="pyscf_obj.pkl")
```
References
Here are some references on the many-body approach to compute the XAS spectra of materials:
- Yufeng Liang, John Vinson, Sri Pemmaraju, Walter S. Drisdell, Eric L. Shirley, and David Prendergast,
Accurate x-ray spectral predictions: an advanced self-consistent-field approach inspired by many-body perturbation theory, Phys. Rev. Lett. 118, 096402 (2017). - Yufeng Liang and David Prendergast, Quantum many-body effects in x-ray spectra efficiently computed using a basic graph algorithm, Phys. Rev. B 97, 205127 (2018).
- Yufeng Liang and David Prendergast, Taming convergence in the determinant approach for x-ray excitation spectra, Phys. Rev. B 100, 075121 (2019).
Roadmap
Implement Machine Learning of spectral features. The mbxasplorer class implements Gaussian Process Regression to predict XAS spectra of molecules, but is still WIP. In the future, expand the method to interface and help manage multiple DFT codes, expand spectra visualization and analysis capabilities, ...
Owner
- Name: Fabrice Roncoroni
- Login: roncofaber
- Kind: user
- Location: Berkeley, CA, USA
- Company: ETH Zurich
- Repositories: 1
- Profile: https://github.com/roncofaber
More fun stuff on GitLab: https://gitlab.com/roncofaber/
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Roncoroni" given-names: "Fabrice" orcid: "https://orcid.org/0000-0001-6402-3752" title: "PyMBXAS" version: 0.5.0 date-released: 2024-11-21 url: "https://gitlab.com/roncofaber/pymbxas"
GitHub Events
Total
- Watch event: 2
- Delete event: 1
- Push event: 14
- Create event: 6
Last Year
- Watch event: 2
- Delete event: 1
- Push event: 14
- Create event: 6