approximate 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.
- approximate-0.1.0/LICENSE +21 -0
- approximate-0.1.0/PKG-INFO +202 -0
- approximate-0.1.0/README.md +162 -0
- approximate-0.1.0/approximate/Data/fixed_ox_states.csv +42 -0
- approximate-0.1.0/approximate/Data/variable_ox_states_srps.csv +171 -0
- approximate-0.1.0/approximate/__init__.py +31 -0
- approximate-0.1.0/approximate/capacity.py +169 -0
- approximate-0.1.0/approximate/core.py +976 -0
- approximate-0.1.0/approximate/feature_engineering/__init__.py +21 -0
- approximate-0.1.0/approximate/feature_engineering/base.py +68 -0
- approximate-0.1.0/approximate/feature_engineering/electronegativity_features.py +175 -0
- approximate-0.1.0/approximate/feature_engineering/element_properties.py +150 -0
- approximate-0.1.0/approximate/feature_engineering/element_property_features.py +48 -0
- approximate-0.1.0/approximate/feature_engineering/feature_extractor.py +119 -0
- approximate-0.1.0/approximate/feature_engineering/ionic_radius_features.py +49 -0
- approximate-0.1.0/approximate/feature_engineering/layered_ox_features.py +98 -0
- approximate-0.1.0/approximate/feature_engineering/magnetic_moment_features.py +122 -0
- approximate-0.1.0/approximate/feature_engineering/registry.py +15 -0
- approximate-0.1.0/approximate/feature_engineering/stats_expander.py +38 -0
- approximate-0.1.0/approximate/feature_engineering/utils.py +112 -0
- approximate-0.1.0/approximate/feature_engineering/valence_features.py +100 -0
- approximate-0.1.0/approximate/plotting.py +113 -0
- approximate-0.1.0/approximate/sweep.py +111 -0
- approximate-0.1.0/approximate.egg-info/PKG-INFO +202 -0
- approximate-0.1.0/approximate.egg-info/SOURCES.txt +33 -0
- approximate-0.1.0/approximate.egg-info/dependency_links.txt +1 -0
- approximate-0.1.0/approximate.egg-info/requires.txt +20 -0
- approximate-0.1.0/approximate.egg-info/top_level.txt +1 -0
- approximate-0.1.0/pyproject.toml +76 -0
- approximate-0.1.0/setup.cfg +4 -0
- approximate-0.1.0/tests/test_api.py +58 -0
- approximate-0.1.0/tests/test_capacity.py +114 -0
- approximate-0.1.0/tests/test_plotting.py +52 -0
- approximate-0.1.0/tests/test_snapshot.py +66 -0
- approximate-0.1.0/tests/test_sweep.py +53 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RAMP-Labs
|
|
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.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: approximate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Composition-only mixed oxidation state estimation, charge balancing and capacity prediction for inorganic materials.
|
|
5
|
+
Author-email: Fay Timen <fay.a.timen@gmail.com>, "Thomas E. Ashton" <t.ashton@ucl.ac.uk>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/RAMP-Labs/ApprOxiMate
|
|
8
|
+
Project-URL: Source, https://github.com/RAMP-Labs/ApprOxiMate
|
|
9
|
+
Project-URL: Issues, https://github.com/RAMP-Labs/ApprOxiMate/issues
|
|
10
|
+
Keywords: oxidation state,charge balance,materials informatics,featurisation,battery,cathode
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Requires-Dist: pandas>=2.0
|
|
25
|
+
Provides-Extra: features
|
|
26
|
+
Requires-Dist: mendeleev>=0.17; extra == "features"
|
|
27
|
+
Requires-Dist: pymatgen>=2024.0.0; extra == "features"
|
|
28
|
+
Provides-Extra: plot
|
|
29
|
+
Requires-Dist: matplotlib>=3.7; extra == "plot"
|
|
30
|
+
Provides-Extra: all
|
|
31
|
+
Requires-Dist: approximate[features,plot]; extra == "all"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: approximate[all]; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
35
|
+
Requires-Dist: build; extra == "dev"
|
|
36
|
+
Requires-Dist: twine; extra == "dev"
|
|
37
|
+
Requires-Dist: jupyter; extra == "dev"
|
|
38
|
+
Requires-Dist: tqdm; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# ApprOxiMate
|
|
42
|
+
|
|
43
|
+
ApprOxiMate is a Python package for charge balancing inorganic chemical
|
|
44
|
+
formulae and generating oxidation-state-aware descriptors for materials
|
|
45
|
+
informatics workflows.
|
|
46
|
+
|
|
47
|
+
The project combines a charge-balancing routine with feature engineering
|
|
48
|
+
modules for valence structure, elemental properties, ionic radii,
|
|
49
|
+
electronegativity, magnetic moments, and related composition statistics.
|
|
50
|
+
It is designed for use in notebooks and machine-learning pipelines where
|
|
51
|
+
oxidation states provide useful chemical context beyond formula-only
|
|
52
|
+
descriptors.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- Charge balance inorganic formulae using fixed and variable oxidation-state
|
|
57
|
+
data.
|
|
58
|
+
- Return balanced results as strings, dictionaries, pandas DataFrames, or
|
|
59
|
+
structured Python objects.
|
|
60
|
+
- Generate descriptors for all elements in a composition and for variable
|
|
61
|
+
oxidation-state elements separately.
|
|
62
|
+
- Build feature matrices from lists of formulae for downstream modelling.
|
|
63
|
+
- Includes example notebooks for featurisation, exploratory analysis, model
|
|
64
|
+
training, and result assessment.
|
|
65
|
+
|
|
66
|
+
## Standard Reduction Potential Data
|
|
67
|
+
NIST dataset was used to collected SRP values used within the variable_ox_states_srps.csv
|
|
68
|
+
|
|
69
|
+
S. G. Bratsch, Standard Electrode Potentials and Temperature Coefficients in Water at 298.15 K, Journal of Physical and Chemical Reference Data, 1989, 18, 1–21.
|
|
70
|
+
|
|
71
|
+
## Citation
|
|
72
|
+
Please cite this package.
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install approximate
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For development, clone the repository and install it in editable mode:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
git clone https://github.com/RAMP-Labs/ApprOxiMate.git
|
|
84
|
+
cd ApprOxiMate
|
|
85
|
+
python -m pip install -e .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For notebook and development dependencies:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
python -m pip install -e ".[dev]"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
ApprOxiMate requires Python 3.10 or newer.
|
|
95
|
+
|
|
96
|
+
## Quick Start
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from approximate import charge_balance
|
|
100
|
+
|
|
101
|
+
r = charge_balance("Fe3O4")
|
|
102
|
+
print(r) # O:-2:4.0;Fe:2:1.0;Fe:3:2.0;FinalChargeBalance:0.0
|
|
103
|
+
r.oxidation_states # one entry per (element, oxidation state)
|
|
104
|
+
r.final_charge # 0.0
|
|
105
|
+
r.is_balanced # True
|
|
106
|
+
r.to_dataframe() # oxidation states as a table
|
|
107
|
+
r.to_dict() # everything as a dictionary
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Shortcuts when you only need one thing:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from approximate import oxidation_states, final_charge, parse_formula
|
|
114
|
+
|
|
115
|
+
oxidation_states("LiFePO4") # list of states
|
|
116
|
+
oxidation_states("LiFePO4", as_dataframe=True) # as a DataFrame
|
|
117
|
+
final_charge("NaMn0.5Ni0.5O2") # 0.0
|
|
118
|
+
parse_formula("LiFePO4") # {'Li': 1.0, 'Fe': 1.0, 'P': 1.0, 'O': 4.0}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Every function accepts `verbose=True` (step-by-step log) and `precision=`.
|
|
122
|
+
|
|
123
|
+
## Feature Engineering
|
|
124
|
+
|
|
125
|
+
Use `MaterialFeatureExtractor` to generate oxidation-state-aware features for
|
|
126
|
+
one formula or many formulae:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import pandas as pd
|
|
130
|
+
from approximate.feature_engineering import MaterialFeatureExtractor
|
|
131
|
+
|
|
132
|
+
# The periodic table is loaded from mendeleev automatically.
|
|
133
|
+
# Pass your own as the first argument to reuse or customise it.
|
|
134
|
+
extractor = MaterialFeatureExtractor(mode="both", ionic_radius_unit="pm")
|
|
135
|
+
|
|
136
|
+
features = extractor.get_features("LiFePO4")
|
|
137
|
+
feature_table = pd.DataFrame(
|
|
138
|
+
extractor.featurize_many(["LiFePO4", "NaCoO2"])
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`mode` controls which feature groups are returned:
|
|
143
|
+
|
|
144
|
+
- `"all"`: descriptors calculated over all elements in the formula.
|
|
145
|
+
- `"var"`: descriptors calculated only over variable oxidation-state elements.
|
|
146
|
+
- `"both"`: include both groups.
|
|
147
|
+
|
|
148
|
+
The available feature modules include:
|
|
149
|
+
|
|
150
|
+
- `ValenceFeatureModule`
|
|
151
|
+
- `ElementPropertyModule`
|
|
152
|
+
- `IonicRadiusModule`
|
|
153
|
+
- `MagneticMomentModule`
|
|
154
|
+
- `ElectronegativityModule`
|
|
155
|
+
- `TransitionMetalPotentialModule`
|
|
156
|
+
|
|
157
|
+
The transition-metal potential module is optional and can be enabled with:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
extractor = MaterialFeatureExtractor(
|
|
161
|
+
enable_tm_potential=True,
|
|
162
|
+
tm_cation="Na",
|
|
163
|
+
tm_anion="O",
|
|
164
|
+
)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Notebooks
|
|
168
|
+
|
|
169
|
+
The repository includes notebooks that demonstrate the main workflow:
|
|
170
|
+
|
|
171
|
+
- `tutorial_notebook.ipynb`: introductory charge-balancing examples.
|
|
172
|
+
- `notebooks/exp1_featurisation.ipynb`: dataset featurisation.
|
|
173
|
+
- `notebooks/exp2_EDA_of_dataset.ipynb`: exploratory data analysis.
|
|
174
|
+
- `notebooks/exp3a_approx_runML.ipynb`: modelling with ApprOxiMate features.
|
|
175
|
+
- `notebooks/exp3b_magpie_runML.ipynb`: comparison modelling with Magpie-style features.
|
|
176
|
+
- `notebooks/exp3c_oliynyk_runML.ipynb`: comparison modelling with Oliynyk-style features.
|
|
177
|
+
- `notebooks/exp4_assessing_models.ipynb`: model assessment and visualisation.
|
|
178
|
+
|
|
179
|
+
Notebooks with `exp0_` in the front show multiple ways to use ApprOxiMate outside of feature engineering and machine learning. Such as:
|
|
180
|
+
|
|
181
|
+
- `alkali_removal_notebook.ipynb`: Charge balance plots and theoretical oxidation state tracking.
|
|
182
|
+
- `parity_plot_theo_cap.ipynb`: Adjust theoretical capacity calculations using ApprOxiMates charge balance assessment.
|
|
183
|
+
- `srp_analysis.ipynb`: Since the user is able to change the SRP data to what fits their needs, this notebook helps visualise this.
|
|
184
|
+
|
|
185
|
+
## Project Layout
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
approximate/
|
|
189
|
+
core.py # Charge-balancing engine and public functions
|
|
190
|
+
Data/ # Oxidation-state and SRP lookup data
|
|
191
|
+
feature_engineering/ # Descriptor modules and feature extractor
|
|
192
|
+
notebooks/ # Experiments, datasets, outputs, and analysis
|
|
193
|
+
site/ # Web calculator (GitHub Pages, runs in-browser via Pyodide)
|
|
194
|
+
tutorial_notebook.ipynb # Introductory usage notebook
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Data Cleanup Note
|
|
198
|
+
An earlier version of Parsed_Data.csv contained 2,302 raw entries. The current Parsed_Data.csv now has 2,299 raw entries as 3 formula were lost when transferred over to ICSD_CrystStrucData.csv. This 2,299 dataset was then preprocessed and cleaned resulting in a dataset of 2,283 entires as seen in `notebooks/exp1_featurisation.ipynb` these 16 formulas were removed due to numerical precision limits encountered when parsing and balancing large formula units and therfore were unable to be charge balanced successfully.
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
This project is licensed under the MIT License. See `LICENSE` for details.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# ApprOxiMate
|
|
2
|
+
|
|
3
|
+
ApprOxiMate is a Python package for charge balancing inorganic chemical
|
|
4
|
+
formulae and generating oxidation-state-aware descriptors for materials
|
|
5
|
+
informatics workflows.
|
|
6
|
+
|
|
7
|
+
The project combines a charge-balancing routine with feature engineering
|
|
8
|
+
modules for valence structure, elemental properties, ionic radii,
|
|
9
|
+
electronegativity, magnetic moments, and related composition statistics.
|
|
10
|
+
It is designed for use in notebooks and machine-learning pipelines where
|
|
11
|
+
oxidation states provide useful chemical context beyond formula-only
|
|
12
|
+
descriptors.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Charge balance inorganic formulae using fixed and variable oxidation-state
|
|
17
|
+
data.
|
|
18
|
+
- Return balanced results as strings, dictionaries, pandas DataFrames, or
|
|
19
|
+
structured Python objects.
|
|
20
|
+
- Generate descriptors for all elements in a composition and for variable
|
|
21
|
+
oxidation-state elements separately.
|
|
22
|
+
- Build feature matrices from lists of formulae for downstream modelling.
|
|
23
|
+
- Includes example notebooks for featurisation, exploratory analysis, model
|
|
24
|
+
training, and result assessment.
|
|
25
|
+
|
|
26
|
+
## Standard Reduction Potential Data
|
|
27
|
+
NIST dataset was used to collected SRP values used within the variable_ox_states_srps.csv
|
|
28
|
+
|
|
29
|
+
S. G. Bratsch, Standard Electrode Potentials and Temperature Coefficients in Water at 298.15 K, Journal of Physical and Chemical Reference Data, 1989, 18, 1–21.
|
|
30
|
+
|
|
31
|
+
## Citation
|
|
32
|
+
Please cite this package.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install approximate
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For development, clone the repository and install it in editable mode:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/RAMP-Labs/ApprOxiMate.git
|
|
44
|
+
cd ApprOxiMate
|
|
45
|
+
python -m pip install -e .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For notebook and development dependencies:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m pip install -e ".[dev]"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
ApprOxiMate requires Python 3.10 or newer.
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from approximate import charge_balance
|
|
60
|
+
|
|
61
|
+
r = charge_balance("Fe3O4")
|
|
62
|
+
print(r) # O:-2:4.0;Fe:2:1.0;Fe:3:2.0;FinalChargeBalance:0.0
|
|
63
|
+
r.oxidation_states # one entry per (element, oxidation state)
|
|
64
|
+
r.final_charge # 0.0
|
|
65
|
+
r.is_balanced # True
|
|
66
|
+
r.to_dataframe() # oxidation states as a table
|
|
67
|
+
r.to_dict() # everything as a dictionary
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Shortcuts when you only need one thing:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from approximate import oxidation_states, final_charge, parse_formula
|
|
74
|
+
|
|
75
|
+
oxidation_states("LiFePO4") # list of states
|
|
76
|
+
oxidation_states("LiFePO4", as_dataframe=True) # as a DataFrame
|
|
77
|
+
final_charge("NaMn0.5Ni0.5O2") # 0.0
|
|
78
|
+
parse_formula("LiFePO4") # {'Li': 1.0, 'Fe': 1.0, 'P': 1.0, 'O': 4.0}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Every function accepts `verbose=True` (step-by-step log) and `precision=`.
|
|
82
|
+
|
|
83
|
+
## Feature Engineering
|
|
84
|
+
|
|
85
|
+
Use `MaterialFeatureExtractor` to generate oxidation-state-aware features for
|
|
86
|
+
one formula or many formulae:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import pandas as pd
|
|
90
|
+
from approximate.feature_engineering import MaterialFeatureExtractor
|
|
91
|
+
|
|
92
|
+
# The periodic table is loaded from mendeleev automatically.
|
|
93
|
+
# Pass your own as the first argument to reuse or customise it.
|
|
94
|
+
extractor = MaterialFeatureExtractor(mode="both", ionic_radius_unit="pm")
|
|
95
|
+
|
|
96
|
+
features = extractor.get_features("LiFePO4")
|
|
97
|
+
feature_table = pd.DataFrame(
|
|
98
|
+
extractor.featurize_many(["LiFePO4", "NaCoO2"])
|
|
99
|
+
)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`mode` controls which feature groups are returned:
|
|
103
|
+
|
|
104
|
+
- `"all"`: descriptors calculated over all elements in the formula.
|
|
105
|
+
- `"var"`: descriptors calculated only over variable oxidation-state elements.
|
|
106
|
+
- `"both"`: include both groups.
|
|
107
|
+
|
|
108
|
+
The available feature modules include:
|
|
109
|
+
|
|
110
|
+
- `ValenceFeatureModule`
|
|
111
|
+
- `ElementPropertyModule`
|
|
112
|
+
- `IonicRadiusModule`
|
|
113
|
+
- `MagneticMomentModule`
|
|
114
|
+
- `ElectronegativityModule`
|
|
115
|
+
- `TransitionMetalPotentialModule`
|
|
116
|
+
|
|
117
|
+
The transition-metal potential module is optional and can be enabled with:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
extractor = MaterialFeatureExtractor(
|
|
121
|
+
enable_tm_potential=True,
|
|
122
|
+
tm_cation="Na",
|
|
123
|
+
tm_anion="O",
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Notebooks
|
|
128
|
+
|
|
129
|
+
The repository includes notebooks that demonstrate the main workflow:
|
|
130
|
+
|
|
131
|
+
- `tutorial_notebook.ipynb`: introductory charge-balancing examples.
|
|
132
|
+
- `notebooks/exp1_featurisation.ipynb`: dataset featurisation.
|
|
133
|
+
- `notebooks/exp2_EDA_of_dataset.ipynb`: exploratory data analysis.
|
|
134
|
+
- `notebooks/exp3a_approx_runML.ipynb`: modelling with ApprOxiMate features.
|
|
135
|
+
- `notebooks/exp3b_magpie_runML.ipynb`: comparison modelling with Magpie-style features.
|
|
136
|
+
- `notebooks/exp3c_oliynyk_runML.ipynb`: comparison modelling with Oliynyk-style features.
|
|
137
|
+
- `notebooks/exp4_assessing_models.ipynb`: model assessment and visualisation.
|
|
138
|
+
|
|
139
|
+
Notebooks with `exp0_` in the front show multiple ways to use ApprOxiMate outside of feature engineering and machine learning. Such as:
|
|
140
|
+
|
|
141
|
+
- `alkali_removal_notebook.ipynb`: Charge balance plots and theoretical oxidation state tracking.
|
|
142
|
+
- `parity_plot_theo_cap.ipynb`: Adjust theoretical capacity calculations using ApprOxiMates charge balance assessment.
|
|
143
|
+
- `srp_analysis.ipynb`: Since the user is able to change the SRP data to what fits their needs, this notebook helps visualise this.
|
|
144
|
+
|
|
145
|
+
## Project Layout
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
approximate/
|
|
149
|
+
core.py # Charge-balancing engine and public functions
|
|
150
|
+
Data/ # Oxidation-state and SRP lookup data
|
|
151
|
+
feature_engineering/ # Descriptor modules and feature extractor
|
|
152
|
+
notebooks/ # Experiments, datasets, outputs, and analysis
|
|
153
|
+
site/ # Web calculator (GitHub Pages, runs in-browser via Pyodide)
|
|
154
|
+
tutorial_notebook.ipynb # Introductory usage notebook
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Data Cleanup Note
|
|
158
|
+
An earlier version of Parsed_Data.csv contained 2,302 raw entries. The current Parsed_Data.csv now has 2,299 raw entries as 3 formula were lost when transferred over to ICSD_CrystStrucData.csv. This 2,299 dataset was then preprocessed and cleaned resulting in a dataset of 2,283 entires as seen in `notebooks/exp1_featurisation.ipynb` these 16 formulas were removed due to numerical precision limits encountered when parsing and balancing large formula units and therfore were unable to be charge balanced successfully.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
This project is licensed under the MIT License. See `LICENSE` for details.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Element,Ox State
|
|
2
|
+
H,1
|
|
3
|
+
Li,1
|
|
4
|
+
Na,1
|
|
5
|
+
K,1
|
|
6
|
+
Rb,1
|
|
7
|
+
Cs,1
|
|
8
|
+
Fr,1
|
|
9
|
+
Be,2
|
|
10
|
+
Mg,2
|
|
11
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|
116
|
+
Pt,4,2,1.01
|
|
117
|
+
Pt,2,0,1.18
|
|
118
|
+
Cu,2,1,0.161
|
|
119
|
+
Cu,2,0,0.339
|
|
120
|
+
Cu,1,0,0.518
|
|
121
|
+
Ag,1,0,0.7993
|
|
122
|
+
Ag,2,1,1.98
|
|
123
|
+
Au,3,1,1.41
|
|
124
|
+
Au,3,0,1.52
|
|
125
|
+
Au,1,0,1.69
|
|
126
|
+
Sm,2,0,-2.68
|
|
127
|
+
Sm,3,0,-2.304
|
|
128
|
+
Sm,3,2,-1.55
|
|
129
|
+
Tl,1,0,-0.336
|
|
130
|
+
Tl,3,0,0.741
|
|
131
|
+
Tl,3,1,1.28
|
|
132
|
+
C,4,2,-0.07
|
|
133
|
+
C,4,0,0.2073
|
|
134
|
+
C,2,0,0.5184
|
|
135
|
+
Si,4,0,-0.931
|
|
136
|
+
Si,0,-4,-0.147
|
|
137
|
+
Ge,4,2,-2.07
|
|
138
|
+
Ge,4,0,-0.104
|
|
139
|
+
Ge,2,0,0.11
|
|
140
|
+
Sn,2,0,-0.141
|
|
141
|
+
Sn,4,0,-0.117
|
|
142
|
+
Sn,4,2,-0.094
|
|
143
|
+
Pb,2,0,-0.126
|
|
144
|
+
Pb,4,0,1.23
|
|
145
|
+
Pb,4,2,1.458
|
|
146
|
+
Bi,3,0,0.308
|
|
147
|
+
Bi,5,3,2
|
|
148
|
+
S,0,-2,0.144
|
|
149
|
+
S,6,4,0.158
|
|
150
|
+
S,6,0,0.333
|
|
151
|
+
S,4,0,0.458
|
|
152
|
+
Te,0,-2,-0.46
|
|
153
|
+
Te,4,0,0.529
|
|
154
|
+
Te,6,4,0.84
|
|
155
|
+
P,3,0,-0.402
|
|
156
|
+
P,5,0,-0.377
|
|
157
|
+
P,5,3,-0.3
|
|
158
|
+
P,0,-3,-0.088
|
|
159
|
+
Sb,3,0,0.231
|
|
160
|
+
Sb,5,3,0.54
|
|
161
|
+
As,3,0,0.234
|
|
162
|
+
As,5,3,0.566
|
|
163
|
+
N,0,-3,-3.334
|
|
164
|
+
N,3,-3,-1.887
|
|
165
|
+
N,3,0,1.447
|
|
166
|
+
Rh,3,0,0.76
|
|
167
|
+
Rh,4,0,0.83
|
|
168
|
+
Rh,4,3,1.3
|
|
169
|
+
Se,0,-2,-0.114
|
|
170
|
+
Se,4,0,0.739
|
|
171
|
+
Se,6,4,1.094
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""ApprOxiMate: composition-only mixed oxidation state estimation.
|
|
2
|
+
|
|
3
|
+
from approximate import charge_balance
|
|
4
|
+
r = charge_balance("Fe3O4")
|
|
5
|
+
"""
|
|
6
|
+
from .capacity import CapacityResult, capacity, molar_mass
|
|
7
|
+
from .sweep import SweepResult, alkali_sweep
|
|
8
|
+
from .core import (
|
|
9
|
+
BalanceResult,
|
|
10
|
+
ElementState,
|
|
11
|
+
charge_balance,
|
|
12
|
+
final_charge,
|
|
13
|
+
oxidation_states,
|
|
14
|
+
parse_formula,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"charge_balance",
|
|
21
|
+
"oxidation_states",
|
|
22
|
+
"final_charge",
|
|
23
|
+
"parse_formula",
|
|
24
|
+
"capacity",
|
|
25
|
+
"molar_mass",
|
|
26
|
+
"CapacityResult",
|
|
27
|
+
"alkali_sweep",
|
|
28
|
+
"SweepResult",
|
|
29
|
+
"BalanceResult",
|
|
30
|
+
"ElementState",
|
|
31
|
+
]
|