Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into master branch #306

Merged
merged 50 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
78a9356
Add magpie data to data_loader
Jul 12, 2024
edbb91a
Add magpie properties
Jul 12, 2024
0f3355f
Add magpie data
Jul 12, 2024
b563be1
Update smact/data_loader.py
AntObi Jul 12, 2024
22bd955
Merge pull request #289 from AntObi/data_updates
AntObi Jul 12, 2024
ddef919
Add the modified NValence file
Jul 16, 2024
9a2250e
Load in the modified NValence data
Jul 16, 2024
9d8f9f0
Fix __init__.py
Jul 16, 2024
8500179
Merge pull request #290 from AntObi/nvalence_modification
AntObi Jul 16, 2024
92e9bc9
Merge pull request #298 from WMD-group/master
AntObi Aug 15, 2024
231bb20
VEC integration into smact.properties
ryannduma Aug 22, 2024
c84e475
small tweak to csv file naming
ryannduma Aug 22, 2024
289ac52
changes to valence_electron_count & test_core.py
ryannduma Aug 22, 2024
c085b49
ran pre-commit
ryannduma Aug 22, 2024
b9a303a
moved VECexample.py to examples/vec_example.py
ryannduma Aug 22, 2024
e90a23b
ran pre-commit to fix qa failures
ryannduma Aug 22, 2024
80ccabf
fixing test.core issues
ryannduma Aug 22, 2024
8377670
updates on tests, pre-commit-config.yaml, and
ryannduma Aug 22, 2024
f8b7a8a
testing value error for invalid elements in VEC
ryannduma Aug 22, 2024
55ba0db
ValueError Modifications in VEC for
ryannduma Aug 22, 2024
b6f4a7b
Merge pull request #305 from ryannduma/VEC
AntObi Aug 22, 2024
538d6ae
Add composition utility module
AntObi Aug 28, 2024
e73ca25
Add test for parsing formulas
AntObi Aug 28, 2024
44927f5
Remove parser function defined within a function
AntObi Aug 28, 2024
bbf35d4
Add contributing guide
AntObi Aug 28, 2024
6dbda8b
Add form_maker and comp_maker to utils
AntObi Aug 29, 2024
df08b83
Add tests for comp_maker and form_maker
AntObi Aug 29, 2024
508f78a
Fix link
AntObi Aug 29, 2024
92fca9f
Add __future__ import
AntObi Aug 29, 2024
4bf54ce
Correct the type hint
AntObi Aug 29, 2024
87e4f61
Add __init__.py in utils
AntObi Aug 29, 2024
7a8a13b
Run pre-commit
AntObi Aug 29, 2024
b067048
Add utils to packages in setup.py
AntObi Aug 29, 2024
e34abb8
Add docs for utils
AntObi Aug 29, 2024
487247a
Fix name
AntObi Aug 29, 2024
83507d8
Add utils to docs
AntObi Aug 29, 2024
7b1f4f1
Merge pull request #307 from AntObi/utils
AntObi Aug 29, 2024
b937fae
Modify if else block for valence data for conciseness
AntObi Aug 30, 2024
54672d0
Improve docstring in parse_formula
AntObi Aug 30, 2024
97034aa
Improve docstring and use a dictionary comprehension for simplification
AntObi Aug 30, 2024
32d7f23
Improve docstring
AntObi Aug 30, 2024
a5bcf69
Improve docstring
AntObi Aug 30, 2024
69dae14
Remove unused imports
AntObi Aug 30, 2024
50865b7
Update metadata
AntObi Aug 30, 2024
4b0ea93
Update conf.py
AntObi Aug 30, 2024
6199001
Add warnings about changing SMACT defaults
AntObi Aug 30, 2024
d440b16
Merge pull request #308 from AntObi/develop
AntObi Aug 30, 2024
add458e
Update contact info in the README
AntObi Aug 30, 2024
4dc7117
Update requirement.txt
AntObi Aug 30, 2024
a7946c9
Update README.md
AntObi Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: isort
additional_dependencies: [toml]
args: ["--profile", "black", "--filter-files","--line-length=80"]
args: ["--profile", "black", "--filter-files", "--line-length=80"]
- repo: https://github.com/psf/black
rev: "23.1.0"
hooks:
Expand All @@ -16,9 +16,8 @@ repos:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/nbQA-dev/nbQA
rev: "1.6.1"
rev: "1.8.7"
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==3.3.1]
args: [--py38-plus]

args: [--py39-plus]
50 changes: 50 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing

This is a quick guide on how to follow best practice and contribute smoothly to `SMACT`.

## Workflow

We follow the [GitHub flow](<https://docs.github.com/en/get-started/using-github/github-flow>), using
branches for new work and pull requests for verifying the work.

The steps for a new piece of work can be summarised as follows:

1. Push up or create [an issue](https://github.com/WMD-group/SMACT/issues).
2. Create a branch from main, with a sensible name that relates to the issue.
3. Do the work and commit changes to the branch. Push the branch
regularly to GitHub to make sure no work is accidentally lost.
4. Write or update unit tests for the code you work on.
5. When you are finished with the work, ensure that all of the unit
tests pass on your own machine.
6. Open a pull request [on the pull request page](https://github.com/WMD-group/SMACT/pulls).
7. If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.

## Pull requests

For a general overview of using pull requests on GitHub look [in the GitHub docs](https://help.github.com/en/articles/about-pull-requests).

When creating a pull request you should:

- Ensure that the title succinctly describes the changes so it is easy to read on the overview page
- Reference the issue which the pull request is closing

Recommended reading: [How to Write the Perfect Pull Request](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/)

## Dev requirements

When developing locally, it is recommended to install the python packages in `requirements-dev.txt`.

```bash
pip install -r requirements-dev.txt
```

This will allow you to run the tests locally with pytest as described in the main README,
as well as run pre-commit hooks to automatically format python files with isort and black.
To install the pre-commit hooks (only needs to be done once):

```bash
pre-commit install
pre-commit run --all-files # optionally run hooks on all files
```

Pre-commit hooks will check all files when you commit changes, automatically fixing any files which are not formatted correctly. Those files will need to be staged again before re-attempting the commit.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = "2.6"
version = "2.7"
# The full version, including alpha/beta/rc tags.
release = "2.6.0"
release = "2.7.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions docs/smact.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Submodules

smact.structure_prediction
smact.dopant_prediction
smact.utils
smact.properties
smact.screening
smact.oxidation_states
Expand Down
9 changes: 9 additions & 0 deletions docs/smact.utils.composition.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SMACT Utilities Composition Module
=====================================

Miscellaneous utilities for composition handling

.. automodule:: smact.utils.composition
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions docs/smact.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SMACT Utilities module
===========================

The utilities module provides some utilty functions to support the core functionalities of SMACT

Submodules
----------

.. toctree::

smact.utils.composition
2 changes: 1 addition & 1 deletion examples/Crystal_Space/1_reduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
"from typing import Iterable\n",
"from collections.abc import Iterable\n",
"from pathlib import Path\n",
"\n",
"from tqdm import tqdm\n",
Expand Down
10 changes: 10 additions & 0 deletions examples/vec_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from smact.properties import valence_electron_count

# Define the compound
compound = "Fe2O3"

# Calculate the Valence Electron Count (VEC)
vec = valence_electron_count(compound)

# Print the result
print(f"The Valence Electron Count (VEC) for {compound} is: {vec:.2f}")
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python

__author__ = "Daniel W. Davies"
__author_email__ = "d.w.davies@imperial.ac.uk"
__author__ = "The SMACT Developers"
__author_email__ = "a.walsh@imperial.ac.uk"
__copyright__ = (
"Copyright Daniel W. Davies, Adam J. Jackson, Keith T. Butler (2019)"
)
__version__ = "2.6"
__version__ = "2.7"
__maintainer__ = "Anthony O. Onwuli"
__maintaier_email__ = "[email protected]"
__date__ = "July 10 2024"
__maintainer_email__ = "[email protected]"
__date__ = "August 30 2024"


import os
import unittest
Expand All @@ -28,10 +29,11 @@
author=__author__,
author_email=__author_email__,
maintainer=__maintainer__,
maintainer_email=__maintaier_email__,
maintainer_email=__maintainer_email__,
license="MIT",
packages=[
"smact",
"smact.utils",
"smact.tests",
"smact.structure_prediction",
"smact.dopant_prediction",
Expand Down
44 changes: 42 additions & 2 deletions smact/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ class Element:

Element.oxidation_states (list) : Default list of allowed oxidation states for use in SMACT

Element.oxidation_states_sp (list) : List of oxdation states recognised by the Pymatgen Structure Predictor
Element.oxidation_states_smact14 (list): Original list of oxidation states that were manually compiled for SMACT in 2014 (default in SMACT < 3.0)

Element.oxidation_states_icsd (list) : List of oxidation states that appear in the ICSD
Element.oxidation_states_sp (list) : List of oxidation states recognised by the Pymatgen Structure Predictor

Element.oxidation_states_icsd (list) : List of oxidation states that appear in the 2016 version of ICSD

Element.oxidation_states_wiki (list): List of oxidation states that appear wikipedia (https://en.wikipedia.org/wiki/Template:List_of_oxidation_states_of_the_elements) Data retrieved: 2022-09-22

Expand All @@ -73,6 +75,18 @@ class Element:

Element.HHI_r (float) : Hirfindahl-Hirschman Index for elemental reserves

Element.mendeleev (int): Mendeleev number

Element.AtomicWeight (float): Atomic weight

Element.MeltingT (float): Melting temperature in K

Element.num_valence (int): Number of valence electrons

Element.num_valence_modified (int): Number of valence electrons based on a modified definition



Raises:
NameError: Element not found in element.txt
Warning: Element not found in Eigenvalues.csv
Expand Down Expand Up @@ -140,6 +154,23 @@ def __init__(
else:
sse_Pauling = None

magpie_data = data_loader.lookup_element_magpie_data(symbol)
if magpie_data:
mendeleev = magpie_data["MendeleevNumber"]
AtomicWeight = magpie_data["AtomicWeight"]
MeltingT = magpie_data["MeltingT"]
num_valence = magpie_data["NValence"]
else:
mendeleev = None
AtomicWeight = None
MeltingT = None
num_valence = None

valence_data = data_loader.lookup_element_valence_data(symbol)
num_valence_modified = (
valence_data["NValence"] if valence_data else None
)

for attribute, value in (
("coord_envs", coord_envs),
("covalent_radius", dataset["r_cov"]),
Expand All @@ -157,6 +188,10 @@ def __init__(
"oxidation_states",
data_loader.lookup_element_oxidation_states(symbol),
),
(
"oxidation_states_smact14",
data_loader.lookup_element_oxidation_states(symbol),
),
(
"oxidation_states_icsd",
data_loader.lookup_element_oxidation_states_icsd(symbol),
Expand All @@ -174,6 +209,11 @@ def __init__(
("SSE", sse),
("SSEPauling", sse_Pauling),
("symbol", symbol),
("mendeleev", mendeleev),
("AtomicWeight", AtomicWeight),
("MeltingT", MeltingT),
("num_valence", num_valence),
("num_valence_modified", num_valence_modified),
# ('vdw_radius', dataset['RVdW']),
):
setattr(self, attribute, value)
Expand Down
98 changes: 98 additions & 0 deletions smact/data/element_valence_modified.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
element,NValence
H,1
He,2
Li,1
Be,2
B,3
C,4
N,5
O,6
F,7
Ne,8
Na,1
Mg,2
Al,3
Si,4
P,5
S,6
Cl,7
Ar,8
K,1
Ca,2
Sc,3
Ti,4
V,5
Cr,6
Mn,7
Fe,8
Co,9
Ni,10
Cu,11
Zn,12
Ga,3
Ge,4
As,5
Se,6
Br,7
Kr,8
Rb,1
Sr,2
Y,3
Zr,4
Nb,5
Mo,6
Tc,7
Ru,8
Rh,9
Pd,10
Ag,11
Cd,12
In,3
Sn,4
Sb,5
Te,6
I,7
Xe,8
Cs,1
Ba,2
La,3
Ce,4
Pr,5
Nd,6
Pm,7
Sm,8
Eu,9
Gd,10
Tb,11
Dy,12
Ho,13
Er,14
Tm,15
Yb,16
Lu,3
Hf,4
Ta,5
W,6
Re,7
Os,8
Ir,9
Pt,10
Au,11
Hg,12
Tl,3
Pb,4
Bi,5
Po,6
At,7
Rn,8
Fr,1
Ra,2
Ac,3
Th,4
Pa,5
U,6
Np,7
Pu,8
Am,9
Cm,10
Bk,11
Loading