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 all 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.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ Development notes
-----------------

### Bugs, features and questions
Please use the [Issue Tracker](https://github.com/WMD-group/smact/issues) to report bugs or request features in the first instance. While we hope that most questions can be answered by searching [the docs](https://smact.readthedocs.io/en/latest/), we welcome new questions on the issue tracker, especially if they helps us improve the docs! For other queries about any aspect of the code, please contact either Dan Davies (author) or Anthony Onwuli (maintainer) by e-mail: d.w.davies@imperial.ac.uk or [email protected] respectively.
Please use the [Issue Tracker](https://github.com/WMD-group/smact/issues) to report bugs or request features in the first instance. While we hope that most questions can be answered by searching [the docs](https://smact.readthedocs.io/en/latest/), we welcome new questions on the issue tracker, especially if they help us improve the docs! For other queries about any aspect of the code, please contact either Aron Walsh on behalf of The SMACT Developers (author) or Anthony Onwuli (maintainer) by e-mail: a.walsh@imperial.ac.uk or [email protected] respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct grammatical error in the issue tracker sentence.

The previous comment by coderabbitai[bot] highlighted a grammatical error that still needs correction. The verb form should be 'help' instead of 'helps' to agree with the plural subject 'they'.

Apply this diff to correct the grammar:

- especially if they helps us improve the docs!
+ especially if they help us improve the docs!
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Please use the [Issue Tracker](https://github.com/WMD-group/smact/issues) to report bugs or request features in the first instance. While we hope that most questions can be answered by searching [the docs](https://smact.readthedocs.io/en/latest/), we welcome new questions on the issue tracker, especially if they help us improve the docs! For other queries about any aspect of the code, please contact either Aron Walsh on behalf of The SMACT Developers (author) or Anthony Onwuli (maintainer) by e-mail: [email protected] or [email protected] respectively.
Please use the [Issue Tracker](https://github.com/WMD-group/smact/issues) to report bugs or request features in the first instance. While we hope that most questions can be answered by searching [the docs](https://smact.readthedocs.io/en/latest/), we welcome new questions on the issue tracker, especially if they help us improve the docs! For other queries about any aspect of the code, please contact either Aron Walsh on behalf of The SMACT Developers (author) or Anthony Onwuli (maintainer) by e-mail: [email protected] or [email protected] respectively.
Tools
Markdownlint

125-125: null
Bare URL used

(MD034, no-bare-urls)


125-125: null
Bare URL used

(MD034, no-bare-urls)


### Code contributions
We are always looking for ways to make SMACT better and more useful to the wider community; contributions are welcome. Please use the ["Fork and Pull"](https://guides.github.com/activities/forking/) workflow to make contributions and stick as closely as possible to the following:

- Code style should comply with [PEP8](http://www.python.org/dev/peps/pep-0008) where possible. [Google's house style](https://google.github.io/styleguide/pyguide.html) is also helpful, including a good model for docstrings.
- Please use comments liberally when adding nontrivial features, and take the chance to clean up other people's code while looking at it.
- Add tests wherever possible, and use the test suite to check if you broke anything.
- Look at the [contributing guide](CONTRIBUTING.md) for more information.

### Tests
Testing modules should be pass/fail and wrapped into **tests/test_core.py** or another **tests/test_something.py** file added, if appropriate.
Expand Down
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}")
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
# pip-compile --output-file=requirements.txt setup.py
#
ase==3.23.0
# via SMACT (setup.py)
Expand All @@ -20,8 +20,6 @@ dill==0.3.8
# pathos
fonttools==4.53.0
# via matplotlib
future==1.0.0
# via uncertainties
idna==3.7
# via requests
joblib==1.4.2
Expand All @@ -34,11 +32,11 @@ matplotlib==3.8.2
# via
# ase
# pymatgen
monty==2023.11.3
monty==2024.7.30
# via pymatgen
mpmath==1.3.0
# via sympy
multiprocess==0.70.15
multiprocess==0.70.16
# via pathos
networkx==3.2.1
# via pymatgen
Expand Down Expand Up @@ -74,7 +72,7 @@ ppft==1.7.6.8
# via pathos
pybtex==0.24.0
# via pymatgen
pymatgen==2023.11.12
pymatgen==2024.5.1
# via SMACT (setup.py)
pyparsing==3.1.1
# via matplotlib
Expand Down Expand Up @@ -114,6 +112,8 @@ tenacity==8.2.3
# via plotly
tqdm==4.66.4
# via pymatgen
typing-extensions==4.12.2
# via SMACT (setup.py)
tzdata==2024.1
# via pandas
uncertainties==3.2.2
Expand Down
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
Loading