unislme 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
unislme-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dr. Sabir Makhlouf (sabir.makhlouf@gmail.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
unislme-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.1
2
+ Name: unislme
3
+ Version: 0.1.0
4
+ Summary: Unified SLME and Photovoltaic Post-Processor for WIEN2k, VASP, Quantum ESPRESSO, and Generic DFT codes
5
+ Author-email: "Dr. Sabir Makhlouf" <sabir.makhlouf@gmail.com>
6
+ Maintainer-email: "Dr. Sabir Makhlouf" <sabir.makhlouf@gmail.com>
7
+ License: MIT
8
+ Keywords: photovoltaics,SLME,Shockley-Queisser,DFT,WIEN2k,VASP,Quantum ESPRESSO,solar cell,optical properties
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Physics
19
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ Provides-Extra: dev
23
+ License-File: LICENSE
24
+
25
+ # UniSLME
26
+
27
+ **Unified SLME and Photovoltaic Post-Processor for WIEN2k, VASP, Quantum ESPRESSO, and Generic DFT Codes**
28
+
29
+ [![CI](https://github.com/sabirmakhlouf/unislme/actions/workflows/ci.yml/badge.svg)](https://github.com/sabirmakhlouf/unislme/actions/workflows/ci.yml)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
31
+
32
+ `UniSLME` computes the Spectroscopic Limited Maximum Efficiency (SLME; Yu & Zunger, *Phys. Rev. Lett.* **108**, 068701, 2012) and full photovoltaic device metrics ($J_{\mathrm{sc}}$, $V_{\mathrm{oc}}$, $\mathrm{FF}$, $J\text{--}V$ curves) from first-principles complex dielectric tensors $\varepsilon(\omega) = \varepsilon_1(\omega) + i\varepsilon_2(\omega)$ across major DFT codes.
33
+
34
+ ---
35
+
36
+ ## Features
37
+
38
+ - **Unified Multi-Code Parsers (Stdlib + NumPy only):**
39
+ - **WIEN2k** (`case.epsilon`): semantic parser auto-detecting cubic (1-component), tetragonal/hexagonal (2-component), and orthorhombic (3-component) symmetries without hardcoded `skiprows`.
40
+ - **VASP** (`vasprun.xml`): XML parser extracting `<dielectricfunction>` (configurable `--block-index`, default `-1`) and optional eigenvalues.
41
+ - **Quantum ESPRESSO** (`epsr_*.dat` & `epsi_*.dat`): dual-file parser with energy-grid consistency validation.
42
+ - **Generic** (`--cols`): column-selectable parser for any whitespace/CSV optical file (CASTEP, ABINIT, Elk, GPAW, etc.) with automatic `eV`, `Ry`, `Ha` unit conversion.
43
+ - **Extensible Registry**: `PARSER_REGISTRY` + `register_parser(name, func)`.
44
+ - **Automatic Data Validation (`validate_optical_data`):**
45
+ - Auto-sorts unsorted energy grids, removes `NaN`/`Inf` rows, enforces $\varepsilon_2 \ge 0$, and warns if energy ranges suggest Hartree/Rydberg instead of eV.
46
+ - **Maximum Researcher Parameter Flexibility:**
47
+ - Crystallographic direction (`iso`, `x`, `y`, `z`, or `all` comparison)
48
+ - Positive/negative rigid scissor shifts (`--scissor`)
49
+ - Fundamental ($E_g$) and direct-allowed ($E_g^{\mathrm{da}}$) gaps with sub-bandgap smearing cutoff ($\alpha(E < E_g) = 0$)
50
+ - Absorber thickness lists or ranges (`start:stop:num`) and temperature ($T$)
51
+ - Back-reflector geometry (`ideal` double-pass $1 - e^{-2\alpha L}$ vs `single_pass` $1 - e^{-\alpha L}$)
52
+ - Optional normal-incidence front-surface reflectivity loss $(1 - R(E))$
53
+ - Manual radiative efficiency override (`--fr-override`) for experimental External Radiative Efficiency (ERE)
54
+ - Non-ideal diode series ($R_s$) and shunt ($R_{\mathrm{sh}}$) resistance numerical $J\text{--}V$ solver
55
+ - Solar spectra: built-in NREL ASTM G173-03 (`am15g`), space 5778 K blackbody scaled to 1361 W/m$^2$ (`am0`), or any custom CSV
56
+ - **2D Parameter Sweeps & Publication Outputs:**
57
+ - Maps SLME, $J_{\mathrm{sc}}$, $V_{\mathrm{oc}}$, or $\mathrm{FF}$ across any two parameters (`run_2d_sweep`)
58
+ - Exports terminal tables, `slme_results.csv`, `booktabs` LaTeX tables (`slme_results.tex`), and 300 DPI PNG figures
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install -e .
66
+ ```
67
+
68
+ For development and running tests:
69
+
70
+ ```bash
71
+ pip install -e ".[dev]"
72
+ pytest -v
73
+ ```
74
+
75
+ ---
76
+
77
+ ## CLI Quickstart
78
+
79
+ ```bash
80
+ # VASP calculation with scissor correction, reflectivity loss, and plots
81
+ unislme --code vasp --input vasprun.xml --eg 1.42 --eg-da 1.42 --scissor 0.6 \
82
+ --thickness 0.5 1.0 2.0 5.0 --temp 300 --include-reflectivity --plot
83
+
84
+ # WIEN2k anisotropic comparison across x, y, z, and iso
85
+ unislme --code wien2k --input case.epsilon --eg 1.12 --eg-da 1.55 \
86
+ --direction all --thickness 0.1:10:25 --plot
87
+
88
+ # Quantum ESPRESSO with explicit epsi file and finite series/shunt resistances
89
+ unislme --code qe --input epsr_mat.dat --epsi epsi_mat.dat \
90
+ --eg 1.50 --rs 1.5 --rsh 1000 --spectrum am0 --plot
91
+
92
+ # Generic whitespace/CSV output in Rydbergs (columns: E, Re_eps, Im_eps)
93
+ unislme --code generic --input optics.txt --cols 0,1,2 --energy-unit Ry --eg 1.60
94
+
95
+ # 2D Parameter Sweep (Thickness vs Temperature)
96
+ unislme --code generic --input optics.csv --eg 1.34 \
97
+ --sweep-x thickness_um:0.1:5.0:20 --sweep-y temperature:260:380:16 --plot
98
+
99
+ # Load settings from JSON config (overridable by CLI flags)
100
+ unislme --config params.json --temp 320
101
+
102
+ # Print academic citation and BibTeX entry
103
+ unislme --cite
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Python API Quickstart
109
+
110
+ ```python
111
+ from unislme import parse_vasp, calculate_slme, run_2d_sweep
112
+ import numpy as np
113
+
114
+ data = parse_vasp("vasprun.xml", eg=1.42, eg_da=1.42)
115
+ res = calculate_slme(
116
+ data,
117
+ thickness_m=1.0e-6,
118
+ temperature_k=300.0,
119
+ direction="iso",
120
+ back_reflector="ideal",
121
+ include_reflectivity=True,
122
+ rs_ohm_cm2=0.5,
123
+ rsh_ohm_cm2=2000.0,
124
+ )
125
+ print(f"SLME = {res.slme_percent:.2f}%, Jsc = {res.jsc_ma_cm2:.2f} mA/cm2, Voc = {res.voc_v:.3f} V")
126
+
127
+ sweep = run_2d_sweep(
128
+ data,
129
+ x_name="thickness_um",
130
+ x_values=np.linspace(0.2, 5.0, 20),
131
+ y_name="temperature",
132
+ y_values=np.linspace(260.0, 380.0, 15),
133
+ csv_path="sweep.csv",
134
+ plot_path="sweep_heatmap.png",
135
+ )
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Automated Benchmark Pipeline
141
+
142
+ To reproduce the zero-recalculation benchmark against open-access NIST JARVIS-DFT data and generate all paper-ready LaTeX tables and 300 DPI figures in `paper_outputs/`:
143
+
144
+ ```bash
145
+ python scripts/run_paper_benchmark.py
146
+ ```
147
+
148
+ ---
149
+
150
+ ## License & Attribution
151
+
152
+ Released under the [MIT License](LICENSE).
153
+ Copyright (c) 2026 Dr. Sabir Makhlouf (`sabir.makhlouf@gmail.com`).
154
+
155
+ ### Citation
156
+
157
+ If you use `UniSLME` in published research, please cite:
158
+
159
+ > S. Makhlouf, *"UniSLME: A Unified Post-Processing Tool for Photovoltaic Efficiency from First-Principles Calculations"* (2026).
160
+
161
+ ```bibtex
162
+ @software{makhlouf2026unislme,
163
+ author = {Makhlouf, Sabir},
164
+ title = {{UniSLME: A Unified Post-Processing Tool for Photovoltaic Efficiency from First-Principles Calculations}},
165
+ year = {2026},
166
+ version = {0.1.0},
167
+ email = {sabir.makhlouf@gmail.com},
168
+ license = {MIT}
169
+ }
170
+ ```
@@ -0,0 +1,146 @@
1
+ # UniSLME
2
+
3
+ **Unified SLME and Photovoltaic Post-Processor for WIEN2k, VASP, Quantum ESPRESSO, and Generic DFT Codes**
4
+
5
+ [![CI](https://github.com/sabirmakhlouf/unislme/actions/workflows/ci.yml/badge.svg)](https://github.com/sabirmakhlouf/unislme/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+
8
+ `UniSLME` computes the Spectroscopic Limited Maximum Efficiency (SLME; Yu & Zunger, *Phys. Rev. Lett.* **108**, 068701, 2012) and full photovoltaic device metrics ($J_{\mathrm{sc}}$, $V_{\mathrm{oc}}$, $\mathrm{FF}$, $J\text{--}V$ curves) from first-principles complex dielectric tensors $\varepsilon(\omega) = \varepsilon_1(\omega) + i\varepsilon_2(\omega)$ across major DFT codes.
9
+
10
+ ---
11
+
12
+ ## Features
13
+
14
+ - **Unified Multi-Code Parsers (Stdlib + NumPy only):**
15
+ - **WIEN2k** (`case.epsilon`): semantic parser auto-detecting cubic (1-component), tetragonal/hexagonal (2-component), and orthorhombic (3-component) symmetries without hardcoded `skiprows`.
16
+ - **VASP** (`vasprun.xml`): XML parser extracting `<dielectricfunction>` (configurable `--block-index`, default `-1`) and optional eigenvalues.
17
+ - **Quantum ESPRESSO** (`epsr_*.dat` & `epsi_*.dat`): dual-file parser with energy-grid consistency validation.
18
+ - **Generic** (`--cols`): column-selectable parser for any whitespace/CSV optical file (CASTEP, ABINIT, Elk, GPAW, etc.) with automatic `eV`, `Ry`, `Ha` unit conversion.
19
+ - **Extensible Registry**: `PARSER_REGISTRY` + `register_parser(name, func)`.
20
+ - **Automatic Data Validation (`validate_optical_data`):**
21
+ - Auto-sorts unsorted energy grids, removes `NaN`/`Inf` rows, enforces $\varepsilon_2 \ge 0$, and warns if energy ranges suggest Hartree/Rydberg instead of eV.
22
+ - **Maximum Researcher Parameter Flexibility:**
23
+ - Crystallographic direction (`iso`, `x`, `y`, `z`, or `all` comparison)
24
+ - Positive/negative rigid scissor shifts (`--scissor`)
25
+ - Fundamental ($E_g$) and direct-allowed ($E_g^{\mathrm{da}}$) gaps with sub-bandgap smearing cutoff ($\alpha(E < E_g) = 0$)
26
+ - Absorber thickness lists or ranges (`start:stop:num`) and temperature ($T$)
27
+ - Back-reflector geometry (`ideal` double-pass $1 - e^{-2\alpha L}$ vs `single_pass` $1 - e^{-\alpha L}$)
28
+ - Optional normal-incidence front-surface reflectivity loss $(1 - R(E))$
29
+ - Manual radiative efficiency override (`--fr-override`) for experimental External Radiative Efficiency (ERE)
30
+ - Non-ideal diode series ($R_s$) and shunt ($R_{\mathrm{sh}}$) resistance numerical $J\text{--}V$ solver
31
+ - Solar spectra: built-in NREL ASTM G173-03 (`am15g`), space 5778 K blackbody scaled to 1361 W/m$^2$ (`am0`), or any custom CSV
32
+ - **2D Parameter Sweeps & Publication Outputs:**
33
+ - Maps SLME, $J_{\mathrm{sc}}$, $V_{\mathrm{oc}}$, or $\mathrm{FF}$ across any two parameters (`run_2d_sweep`)
34
+ - Exports terminal tables, `slme_results.csv`, `booktabs` LaTeX tables (`slme_results.tex`), and 300 DPI PNG figures
35
+
36
+ ---
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install -e .
42
+ ```
43
+
44
+ For development and running tests:
45
+
46
+ ```bash
47
+ pip install -e ".[dev]"
48
+ pytest -v
49
+ ```
50
+
51
+ ---
52
+
53
+ ## CLI Quickstart
54
+
55
+ ```bash
56
+ # VASP calculation with scissor correction, reflectivity loss, and plots
57
+ unislme --code vasp --input vasprun.xml --eg 1.42 --eg-da 1.42 --scissor 0.6 \
58
+ --thickness 0.5 1.0 2.0 5.0 --temp 300 --include-reflectivity --plot
59
+
60
+ # WIEN2k anisotropic comparison across x, y, z, and iso
61
+ unislme --code wien2k --input case.epsilon --eg 1.12 --eg-da 1.55 \
62
+ --direction all --thickness 0.1:10:25 --plot
63
+
64
+ # Quantum ESPRESSO with explicit epsi file and finite series/shunt resistances
65
+ unislme --code qe --input epsr_mat.dat --epsi epsi_mat.dat \
66
+ --eg 1.50 --rs 1.5 --rsh 1000 --spectrum am0 --plot
67
+
68
+ # Generic whitespace/CSV output in Rydbergs (columns: E, Re_eps, Im_eps)
69
+ unislme --code generic --input optics.txt --cols 0,1,2 --energy-unit Ry --eg 1.60
70
+
71
+ # 2D Parameter Sweep (Thickness vs Temperature)
72
+ unislme --code generic --input optics.csv --eg 1.34 \
73
+ --sweep-x thickness_um:0.1:5.0:20 --sweep-y temperature:260:380:16 --plot
74
+
75
+ # Load settings from JSON config (overridable by CLI flags)
76
+ unislme --config params.json --temp 320
77
+
78
+ # Print academic citation and BibTeX entry
79
+ unislme --cite
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Python API Quickstart
85
+
86
+ ```python
87
+ from unislme import parse_vasp, calculate_slme, run_2d_sweep
88
+ import numpy as np
89
+
90
+ data = parse_vasp("vasprun.xml", eg=1.42, eg_da=1.42)
91
+ res = calculate_slme(
92
+ data,
93
+ thickness_m=1.0e-6,
94
+ temperature_k=300.0,
95
+ direction="iso",
96
+ back_reflector="ideal",
97
+ include_reflectivity=True,
98
+ rs_ohm_cm2=0.5,
99
+ rsh_ohm_cm2=2000.0,
100
+ )
101
+ print(f"SLME = {res.slme_percent:.2f}%, Jsc = {res.jsc_ma_cm2:.2f} mA/cm2, Voc = {res.voc_v:.3f} V")
102
+
103
+ sweep = run_2d_sweep(
104
+ data,
105
+ x_name="thickness_um",
106
+ x_values=np.linspace(0.2, 5.0, 20),
107
+ y_name="temperature",
108
+ y_values=np.linspace(260.0, 380.0, 15),
109
+ csv_path="sweep.csv",
110
+ plot_path="sweep_heatmap.png",
111
+ )
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Automated Benchmark Pipeline
117
+
118
+ To reproduce the zero-recalculation benchmark against open-access NIST JARVIS-DFT data and generate all paper-ready LaTeX tables and 300 DPI figures in `paper_outputs/`:
119
+
120
+ ```bash
121
+ python scripts/run_paper_benchmark.py
122
+ ```
123
+
124
+ ---
125
+
126
+ ## License & Attribution
127
+
128
+ Released under the [MIT License](LICENSE).
129
+ Copyright (c) 2026 Dr. Sabir Makhlouf (`sabir.makhlouf@gmail.com`).
130
+
131
+ ### Citation
132
+
133
+ If you use `UniSLME` in published research, please cite:
134
+
135
+ > S. Makhlouf, *"UniSLME: A Unified Post-Processing Tool for Photovoltaic Efficiency from First-Principles Calculations"* (2026).
136
+
137
+ ```bibtex
138
+ @software{makhlouf2026unislme,
139
+ author = {Makhlouf, Sabir},
140
+ title = {{UniSLME: A Unified Post-Processing Tool for Photovoltaic Efficiency from First-Principles Calculations}},
141
+ year = {2026},
142
+ version = {0.1.0},
143
+ email = {sabir.makhlouf@gmail.com},
144
+ license = {MIT}
145
+ }
146
+ ```
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "unislme"
7
+ version = "0.1.0"
8
+ description = "Unified SLME and Photovoltaic Post-Processor for WIEN2k, VASP, Quantum ESPRESSO, and Generic DFT codes"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Dr. Sabir Makhlouf", email = "sabir.makhlouf@gmail.com"}
14
+ ]
15
+ maintainers = [
16
+ {name = "Dr. Sabir Makhlouf", email = "sabir.makhlouf@gmail.com"}
17
+ ]
18
+ keywords = [
19
+ "photovoltaics",
20
+ "SLME",
21
+ "Shockley-Queisser",
22
+ "DFT",
23
+ "WIEN2k",
24
+ "VASP",
25
+ "Quantum ESPRESSO",
26
+ "solar cell",
27
+ "optical properties"
28
+ ]
29
+ classifiers = [
30
+ "Development Status :: 4 - Beta",
31
+ "Intended Audience :: Science/Research",
32
+ "License :: OSI Approved :: MIT License",
33
+ "Operating System :: OS Independent",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.9",
36
+ "Programming Language :: Python :: 3.10",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ "Topic :: Scientific/Engineering :: Physics",
40
+ "Topic :: Scientific/Engineering :: Chemistry"
41
+ ]
42
+ dependencies = [
43
+ "numpy>=1.21",
44
+ "scipy>=1.8",
45
+ "matplotlib>=3.5"
46
+ ]
47
+
48
+ [project.optional-dependencies]
49
+ dev = [
50
+ "pytest>=7.0",
51
+ "build>=0.10"
52
+ ]
53
+
54
+ [project.scripts]
55
+ unislme = "unislme.cli:main"
56
+
57
+ [tool.setuptools]
58
+ include-package-data = true
59
+
60
+ [tool.setuptools.packages.find]
61
+ include = ["unislme*"]
62
+
63
+ [tool.setuptools.package-data]
64
+ unislme = ["data/*.csv"]
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+ addopts = "-v"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,54 @@
1
+ """UniSLME: Unified SLME and Photovoltaic Post-Processor for DFT Codes."""
2
+
3
+ __version__ = "0.1.0"
4
+ __author__ = "Dr. Sabir Makhlouf"
5
+ __email__ = "sabir.makhlouf@gmail.com"
6
+
7
+ from .core import (
8
+ OpticalData,
9
+ OpticalProperties,
10
+ SLMEResult,
11
+ SweepResult,
12
+ calculate_slme,
13
+ compute_optical_constants,
14
+ compute_optical_properties,
15
+ load_spectrum,
16
+ run_2d_sweep,
17
+ validate_optical_data,
18
+ )
19
+ from .parsers import (
20
+ PARSER_REGISTRY,
21
+ get_parser,
22
+ list_parsers,
23
+ parse_generic,
24
+ parse_optical_file,
25
+ parse_qe,
26
+ parse_vasp,
27
+ parse_wien2k,
28
+ register_parser,
29
+ )
30
+
31
+ __all__ = [
32
+ "PARSER_REGISTRY",
33
+ "OpticalData",
34
+ "OpticalProperties",
35
+ "SLMEResult",
36
+ "SweepResult",
37
+ "__author__",
38
+ "__email__",
39
+ "__version__",
40
+ "calculate_slme",
41
+ "compute_optical_constants",
42
+ "compute_optical_properties",
43
+ "get_parser",
44
+ "list_parsers",
45
+ "load_spectrum",
46
+ "parse_generic",
47
+ "parse_optical_file",
48
+ "parse_qe",
49
+ "parse_vasp",
50
+ "parse_wien2k",
51
+ "register_parser",
52
+ "run_2d_sweep",
53
+ "validate_optical_data",
54
+ ]