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

Update develop branch in line with master branch #349

Merged
merged 74 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c447e32
Update structure files for Structure Prediction test
AntObi Nov 26, 2024
df02d8a
Fix routine of getting a SmactStructure from the Materials Project
AntObi Nov 26, 2024
c1cb77d
Enable SmactStructure MP testing
AntObi Nov 26, 2024
845b843
Fix the SmactStructure equality
AntObi Nov 26, 2024
bf92ea5
Run pre-commit
AntObi Nov 26, 2024
a738df9
Run pre-commit
AntObi Nov 26, 2024
3d3e990
Fix getting data from the Materials Project
AntObi Nov 28, 2024
200df5c
Update oxidation decorate routine and add pymatgen conversion
AntObi Nov 28, 2024
aa17c47
Remove deprecated function for converting next gen queries
AntObi Nov 28, 2024
00ab961
Run pre-commit
AntObi Nov 28, 2024
bd2be04
Remove comment about APIs
AntObi Nov 28, 2024
f389e4c
Update mutation.py
AntObi Nov 30, 2024
2629595
Add reduced_formula
AntObi Nov 30, 2024
ad5be46
Add structure prediction tutorial
AntObi Nov 30, 2024
4c4af0b
Update tutorial.rst
AntObi Nov 30, 2024
82a5809
Remove old examples
AntObi Nov 30, 2024
b081e37
Add error handling for missing API key
AntObi Nov 30, 2024
e247e83
Standardise API key retrieval to use PMG_MAPI_KEY consistently
AntObi Nov 30, 2024
30d7f8b
Add test for `as_py_struct` method in `SmactStructure`
AntObi Nov 30, 2024
1805282
Add test for reduced formula
AntObi Nov 30, 2024
691f9d4
Merge pull request #336 from WMD-group/structure_prediction_fix
AntObi Nov 30, 2024
b615bf0
Update mock modules in conf.py
AntObi Dec 1, 2024
402c943
Update composition import
AntObi Dec 1, 2024
751db6e
Update crystal space documentation
AntObi Dec 1, 2024
69ac485
Add documentation for oxidation utitilies
AntObi Dec 1, 2024
2e0a13b
Add documentation for crystal space submodules
AntObi Dec 1, 2024
994bfcd
Include extras in requirements.txt to make binder notebooks work
AntObi Dec 1, 2024
b5b58c1
Remove os.PathLike type in docstrings
AntObi Dec 1, 2024
961bdf6
Add return type hinting
AntObi Dec 1, 2024
d2b0d6e
Add links in tutorial notebooks
AntObi Dec 1, 2024
10a1f1d
Update deprecated jupyter_execute_notebooks to nb_execution_mode
AntObi Dec 1, 2024
79e896c
Render plotly figs as png to show on GitHub and the Documentation site
AntObi Dec 1, 2024
ef0a41b
Fix typo
AntObi Dec 1, 2024
2a511e5
Update docs
AntObi Dec 1, 2024
39b21e0
Fix headers
AntObi Dec 1, 2024
ac6604f
Fix comment
AntObi Dec 1, 2024
08f5d26
Update link to examples in README
AntObi Dec 1, 2024
9c823f4
Update readthedocs config file
AntObi Dec 1, 2024
70122e8
Merge pull request #337 from WMD-group/documentation_fixes
AntObi Dec 1, 2024
e48be49
Add optional extras
AntObi Dec 1, 2024
2377b15
Update ci
AntObi Dec 1, 2024
734b847
Revert "Update ci"
AntObi Dec 1, 2024
a2ca918
Add UV to CI
AntObi Dec 1, 2024
f59baf8
Run pre-commit
AntObi Dec 1, 2024
3062f8e
Merge pull request #338 from WMD-group/uv_ci
AntObi Dec 1, 2024
d5afb06
Bump numpy from 1.26.2 to 2.1.3
dependabot[bot] Dec 1, 2024
9408088
Bump myst-nb from 1.1.1 to 1.1.2
dependabot[bot] Dec 1, 2024
29b0088
Bump pytest from 8.3.2 to 8.3.4
dependabot[bot] Dec 1, 2024
6c63631
Bump sphinx-rtd-theme from 2.0.0 to 3.0.2
dependabot[bot] Dec 1, 2024
e1f31c5
Bump codecov/codecov-action from 4 to 5
dependabot[bot] Dec 1, 2024
0e321a0
Merge dependabot/github_actions/codecov/codecov-action-5 into combine…
github-actions[bot] Dec 1, 2024
6477514
Merge dependabot/pip/sphinx-rtd-theme-3.0.2 into combine-prs-branch
github-actions[bot] Dec 1, 2024
3afa4a8
Merge dependabot/pip/pytest-8.3.4 into combine-prs-branch
github-actions[bot] Dec 1, 2024
710201d
Merge dependabot/pip/myst-nb-1.1.2 into combine-prs-branch
github-actions[bot] Dec 1, 2024
627ba41
Merge dependabot/pip/numpy-2.1.3 into combine-prs-branch
github-actions[bot] Dec 1, 2024
f3779cf
Merge pull request #345 from WMD-group/combine-prs-branch
AntObi Dec 1, 2024
62f43db
Bump sphinx from 5.3.0 to 8.1.3
dependabot[bot] Dec 1, 2024
40d6f37
Change oxidation state defaults to icsd24
AntObi Dec 1, 2024
eeb4ba9
Update smact_validity and smact_filter functions
AntObi Dec 1, 2024
aa57941
Add option to select oxidation states list in crystal space
AntObi Dec 1, 2024
62a8ff9
Set oxidation states to smact14 for reproducibility with FD publication
AntObi Dec 1, 2024
56a3ef2
Use smact14 oxidation states for consistency in GNoME example
AntObi Dec 1, 2024
d8f74fa
Test `generate_composition_with_smact` with smact14 and icsd24 ox states
AntObi Dec 1, 2024
423a0bf
Merge pull request #341 from WMD-group/dependabot/pip/sphinx-8.1.3
AntObi Dec 1, 2024
ce1dd99
Remove unused argument
AntObi Dec 2, 2024
7d7459d
Use ICSD24 as the default oxidation states
AntObi Dec 2, 2024
59bf75c
Update test_core.py to reflect change to default oxidation states
AntObi Dec 2, 2024
0728f46
Merge pull request #346 from WMD-group/change_oxi_defaults
AntObi Dec 2, 2024
c375652
Bump version number to 3.0
AntObi Dec 2, 2024
3848780
Update links in the README
AntObi Dec 2, 2024
5e77193
Update contributing guide
AntObi Dec 2, 2024
0594cc4
Add new workflow to check links in Markdown
AntObi Dec 2, 2024
9fa4e56
Run pre-commit
AntObi Dec 2, 2024
08a4ea0
Merge pull request #347 from WMD-group/bump_release_v3
AntObi Dec 2, 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
16 changes: 16 additions & 0 deletions .github/workflows/check-live-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check Markdown links

on:
push:
branches:
- master
schedule:
# Every Monday at 00:00 UTC
- cron: "0 0 * * 1"

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,27 @@ jobs:

runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e ".[crystal_space,dev]"
pip install pytest-cov
pip install uv
uv pip install -e ".[optional,dev]" --system

- name: Run tests and collect coverage
env:
MP_API_KEY: ${{ secrets.MP_API_KEY }}
run: python -m pytest --cov=smact --cov-report=xml -v
- name: Upload coverage reports to CodeCov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
#files: ./coverage.xml
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ sphinx:
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Recommended reading: [How to Write the Perfect Pull Request](https://github.blog
When developing locally, it is recommended to install the python packages in `requirements-dev.txt`.

```bash
pip install -r requirements-dev.txt
pip install -e ".[dev,docs]"
```

This will allow you to run the tests locally with pytest as described in the main README,
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
**Semiconducting Materials from Analogy and Chemical Theory** (SMACT) is a collection of rapid screening and informatics tools that uses data about chemical elements.

- **Documentation:** <https://smact.readthedocs.io/en/latest/>
- **Examples:** <https://github.com/WMD-group/SMACT/tree/master/examples>
- **Examples:** <https://smact.readthedocs.io/en/latest/examples.html>

![A blue interface with the text "SMACT v3" at the top. Below that, there is a label "Materials Search" followed by two radio buttons: "Hi-fi" and "Lo-fi". The "Lo-fi" button is currently selected](SMACT.png)

Expand All @@ -33,15 +33,15 @@ There is a strong demand for functional materials across a wide range of technol

Features are accessed through Python scripts, importing classes and functions as needed.
The best place to start is looking at [the docs](https://smact.readthedocs.io/en/latest/), which highlight some simple examples of how these classes and functions can be usede
Use cases are available in our [examples](https://github.com/WMD-group/SMACT/tree/master/examples) and [tutorials](https://github.com/WMD-group/SMACT/tree/master/tutorials) folders.
Use cases are available in our [examples](https://smact.readthedocs.io/en/latest/examples.html) and [tutorials](https://smact.readthedocs.io/en/latest/tutorials.html) folders.

## Code features

- At the core of SMACT are [Element](https://smact.readthedocs.io/en/latest/smact.html#smact.Element) and [Species](https://smact.readthedocs.io/en/latest/smact.html#smact.Species) (element in a given oxidation state) classes that have various properties associated with them.

- Oxidation states that are accessible to each element are included in their properties.

- Element compositions can be screened through based on the heuristic filters of charge neutrality and electronegativity order. This is handled using the [screening module](https://smact.readthedocs.io/en/latest/smact.screening.html) and [this publication](<https://www.cell.com/chem/fulltext/S2451-9294(16)30155-3>) describes the underlying theory. An example procedure is [outlined in the docs](https://smact.readthedocs.io/en/latest/examples.html#neutral-combinations) and more examples can be found in the [counting examples subfolder](https://github.com/WMD-group/SMACT/tree/master/examples/Counting).
- Element compositions can be screened through based on the heuristic filters of charge neutrality and electronegativity order. This is handled using the [screening module](https://smact.readthedocs.io/en/latest/smact.screening.html) and [this publication](<https://www.cell.com/chem/fulltext/S2451-9294(16)30155-3>) describes the underlying theory. An example procedure is [outlined in the docs](https://smact.readthedocs.io/en/latest/examples/filter.html).

- Further filters can be applied to generated lists of compositions in order to screen for particular properties. These properties are either intrinsic properties of elements or are calculated for compositions using the [properties module](https://smact.readthedocs.io/en/latest/smact.properties.html). For example:

Expand All @@ -50,7 +50,7 @@ Use cases are available in our [examples](https://github.com/WMD-group/SMACT/tre

- Compositions can also be filtered based on sustainability via the abundance of elements in the Earth's crust or via the [HHI scale](https://pubs.acs.org/doi/10.1021/cm400893e).

- Compositions can be converted for use in Pymatgen or for representation to machine learning algorithms ([see "next steps" in this example](https://github.com/WMD-group/SMACT/blob/master/examples/Counting/Generate_compositions_lists.ipynb)) and the related [ElementEmbeddings](https://github.com/WMD-group/ElementEmbeddings) package.
- Compositions can be converted for use in Pymatgen or for representation to machine learning algorithms ([see this example](https://smact.readthedocs.io/en/latest/tutorials/smact_generation_of_solar_oxides.html)) and the related [ElementEmbeddings](https://github.com/WMD-group/ElementEmbeddings) package.

- The code also has tools for manipulating common crystal lattice types:
- Certain structure types can be built using the [builder module](https://smact.readthedocs.io/en/latest/smact.builder.html)
Expand All @@ -77,6 +77,7 @@ Use cases are available in our [examples](https://github.com/WMD-group/SMACT/tre
- **oxidation_states.py**: Used for predicting the likelihood of species coexisting in a compound based on a statistical model.
- **structure_prediction**: A submodule which contains a collection of tools for facilitating crystal structure predictions via ionic substitutions
- **dopant_prediction**: A submodule which contains a collections of tools for predicting dopants.
- **utils.py** A collection of utility functions used throughout the codebase.

## Requirements

Expand All @@ -90,6 +91,10 @@ The latest stable release can be installed via pip which will automatically set

pip install smact

Optional dependencies can also be installed. These enable full replication of the examples and tutorials

pip install "smact[optional]"

SMACT is also available via conda through the conda-forge channel on Anaconda Cloud:

conda install -c conda-forge smact
Expand Down
11 changes: 7 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"html_image",
]
myst_url_schemes = ("http", "https", "mailto")
jupyter_execute_notebooks = "off"
nb_execution_mode = "off"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand All @@ -71,9 +71,9 @@
# built documents.
#
# The short X.Y version.
version = "2.8"
version = "3.0"
# The full version, including alpha/beta/rc tags.
release = "2.8.0"
release = "3.0.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -154,7 +154,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -418,5 +418,8 @@ def __getattr__(cls, name):
"pymatgen.analysis.structure_prediction",
"pymatgen.transformations.standard_transformations",
"tabulate",
"mp_api",
"mp_api.client",
"emmet",
]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
1 change: 0 additions & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ For workflows that have been used in real examples and in published work, visit
examples/filter
examples/validity
examples/lists
examples/neutral_combos
examples/oxidation_states
examples/compound_electroneg
examples/valence_electron_count
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/doper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"\n",
"By default, the top five p-type and n-type candidates are reported. Use the `num_dopants` input to modify the number of outputs.\n",
"\n",
"### Output Format\n",
"**Output Format**\n",
"\n",
"The output is a dictionary with keys:\n",
"- \"n_type_cation\"\n",
"- \"p_type_cation\"\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Defining the exact version will make sure things don't break
sphinx==5.3.0
sphinx_rtd_theme==2.0.0
sphinx==8.1.3
sphinx_rtd_theme==3.0.2
readthedocs-sphinx-search==0.3.2
sphinx-book-theme==1.1.3
myst-nb==1.1.1
myst-nb==1.1.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Crystal Space Materials Project Data Retrieval Module
===========================


.. automodule:: smact.utils.crystal_space.download_compounds_with_mp_api
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Crystal Space SMACT Generation Module
===========================

.. automodule:: smact.utils.crystal_space.generate_composition_with_smact
:members:
:undoc-members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/smact.utils.crystal_space.plot_embedding.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Crystal Space Embedding Module
===========================


.. automodule:: smact.utils.crystal_space.plot_embedding
:members:
:undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/smact.utils.crystal_space.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SMACT Utilities Crystal Space Module
===========================

Utility functions associated with our `Faraday Discussions publication 'Mapping Inorganic Crystal Space' <https://doi.org/10.1039/D4FD00063C>`_ using SMACT


Submodules
----------

.. toctree::

smact.utils.crystal_space.download_compounds_with_mp_api
smact.utils.crystal_space.generate_composition_with_smact
smact.utils.crystal_space.plot_embedding
9 changes: 9 additions & 0 deletions docs/smact.utils.oxidation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SMACT Utilities Oxidation Module
=====================================

Miscellaneous utilities for creating SMACT compatible oxidation states list

.. automodule:: smact.utils.oxidation
:members:
:undoc-members:
:show-inheritance:
6 changes: 2 additions & 4 deletions docs/smact.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ Submodules
.. toctree::

smact.utils.composition
smact.utils.band_gap_simple
smact.utils.download_compounds_with_mp_api
smact.utils.generate_composition_with_smact
smact.utils.plot_embeddings
smact.utils.crystal_space
smact.utils.oxidation
1 change: 1 addition & 0 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Tutorials are intended as a more complete example of `smact` being applied in re
tutorials/smact_generation_of_solar_oxides
tutorials/oxidation_states
tutorials/smact_validity_of_GNoMe
tutorials/structure_prediction
tutorials/crystal_space
tutorials/crystal_space_visualisation
tutorials/filtering_icsd_oxidation_states.ipynb
5 changes: 3 additions & 2 deletions docs/tutorials/crystal_space.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"\n",
"First, we'll create binary chemical compositions using the SMACT filter. The SMACT filter is a smart tool that helps us select compositions based on important chemical rules, such as oxidation states and electronegativity.\n",
"\n",
"To generate these compositions, we'll use a function called [`generate_composition_with_smact`](../smact/utils/generate_composition_with_smact.py). This function allows us to enumerate all possible binary compositions and filter them based on the SMACT rules. \n",
"To generate these compositions, we'll use a function called [`generate_composition_with_smact`](../../smact/utils/crystal_space/generate_composition_with_smact.py). This function allows us to enumerate all possible binary compositions and filter them based on the SMACT rules. \n",
"\n",
"### Key parameters:\n",
"- `num_elements`: Number of elements in the composition (e.g., 2 for binary).\n",
Expand Down Expand Up @@ -102,6 +102,7 @@
" max_atomic_num=103,\n",
" num_processes=8,\n",
" save_path=\"data/binary/df_binary_label.pkl\",\n",
" oxidation_states_set=\"smact14\"\n",
")"
]
},
Expand All @@ -127,7 +128,7 @@
"source": [
"Next, we download data from the `Materials Project api` using the `download_mp_data` function. This function allows us to download data for a given number of elements and maximum stoichiometry. The data includes the chemical formula, energy, and other properties of the compounds.\n",
"\n",
"[`download_mp_data`](../smact/utils/download_compounds_with_mp_api.py) function takes in the following parameters:\n",
"[`download_mp_data`](../../smact/utils/crystal_space/download_compounds_with_mp_api.py) function takes in the following parameters:\n",
"\n",
"### Key parameters:\n",
"- `mp_api_key`: your Materials Project API key\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/crystal_space_visualisation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(prerequisite: [crystal_space_with_smact.ipynb](./crystal_space_with_smact.ipynb))\n",
"(prerequisite: [crystal_space.ipynb](./crystal_space.ipynb))\n",
"\n",
"In this tutorial, we will use the dimension reduction techniques to visualise a large crystal space. We will use the following techniques:\n",
"\n",
Expand Down
Loading
Loading