Skip to content

Commit 1050162

Browse files
authored
Merge pull request #81 from SMTG-Bham/develop
`ShakeNBreak` `v3.4` Former-commit-id: 0e08402
2 parents 77089ca + 690193f commit 1050162

File tree

92 files changed

+583556
-3345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+583556
-3345
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
max-parallel: 1
1717

1818
matrix:
19-
python-version: ['3.11']
19+
python-version: ['3.12']
2020

2121
name: Python ${{ matrix.python-version }} Test Pop
2222

.github/workflows/pip_install_test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ jobs:
1818

1919
matrix:
2020
os: [ ubuntu-latest, macos-14 ]
21-
python-version: [ '3.9', '3.10', '3.11' ]
22-
exclude:
23-
- os: macos-14
24-
python-version: '3.9' # Exclude Python 3.9 on macOS, not supported for macOS-14 tests
25-
# macos-latest should be 14 according to link below, but currently doesn't?
26-
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
21+
python-version: [ '3.10', '3.11', '3.12' ]
2722

2823
runs-on: ${{matrix.os}}
2924

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.10"
23+
python-version: "3.12"
2424

2525
- name: Install dependencies
2626
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ jobs:
1414

1515
matrix:
1616
os: [ ubuntu-latest, macos-14 ]
17-
python-version: [ '3.9', '3.10', '3.11' ]
18-
exclude:
19-
- os: macos-14
20-
python-version: '3.9' # Exclude Python 3.9 on macOS, not supported for macOS-14 tests
21-
# macos-latest should be 14 according to link below, but currently doesn't?
22-
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
17+
python-version: [ '3.10', '3.11', '3.12' ]
2318

2419
runs-on: ${{matrix.os}}
2520
steps:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3-
exclude: ^(docs|tests|SnB_input_files|.github|shakenbreak/scripts|CITATION*|MANIFEST*)
3+
exclude: ^(docs|tests|shakenbreak/SnB_input_files|.github|CITATION*|MANIFEST*)
44
repos:
55
# Lint and format, isort, docstrings...
66
- repo: https://github.com/charliermarsh/ruff-pre-commit

CHANGELOG.rst

Lines changed: 82 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
11
Change Log
22
==========
33

4+
v3.4.0
5+
----------
6+
- Major efficiency updates:
7+
- Uses ``_scan_sm_stol_till_match`` and turbo-charged ``StructureMatcher`` methods from ``doped``
8+
``v3``, speeding up structure matching (e.g. in ``snb-regenerate`` for identifying distinct defect
9+
geometries) by >~3 orders of magnitude.
10+
- Uses caching in atomic displacement calculations (for ``"disp"``/``"max_dist"`` metrics)
11+
- Use efficient Voronoi analyzer from ``doped`` ``v3`` for multiplicity determination.
12+
- More efficient (and cleaner) plotting with many defects/distortions
13+
- Add ``Dimer`` to default distortions grid output for vacancies, following discussions and testing for
14+
cation vacancies in oxides.
15+
- Miscellaneous:
16+
- All ``snb-xxx`` functions now auto-detect if running within a defect folder or in a top-level
17+
directory (i.e. auto ``--all`` behaviour).
18+
- Handling of gzipped ``OUTCAR.gz`` files for energy parsing.
19+
- For (rare) cases of degenerate choices of NNs to distort in terms of distance, but non-degenerate
20+
`combinations` (e.g. distorting 2 NNs of a square coordination, could be cis or trans choices),
21+
the choice is made deterministically; choosing the combination with the shortest distances between
22+
distorted NNs (i.e. the cis choice).
23+
- Greater verbosity control
24+
- Some code cleanup and formatting, and robustness updates
25+
426
v3.3.6
527
----------
6-
- Add `py.typed` to properly detect type hints by @Andrew-S-Rosen
7-
- `snb-run` updates to improve efficiency
28+
- Add ``py.typed`` to properly detect type hints by @Andrew-S-Rosen
29+
- ``snb-run`` updates to improve efficiency
830

931
v3.3.5
1032
----------
@@ -36,9 +58,9 @@ v3.3.1
3658
----------
3759
- ``distortion_metadata.json`` for each defect now saved to the individual defect folders (as well as the
3860
combined total distortion metadata in the top level folder) – more likely to be retained by the user
39-
when ``scp``ing around etc.
61+
when ``scp``\ing around etc.
4062
- Minor updates:
41-
- Refactor ``_format_defect_name`` to ``format_defect_name`` from `doped` (now a public function)
63+
- Refactor ``_format_defect_name`` to ``format_defect_name`` from ``doped`` (now a public function)
4264
- Update ``snb-run`` to avoid possible 'file exists' warning
4365
- Update tutorials/notebooks to specify ``vasp_nkred_std`` to streamline workflow
4466
- Remove unnecessary ``tutorials`` folder with duplicate tutorial notebook (to reduce workload).
@@ -56,26 +78,26 @@ v3.3.1
5678
v3.3.0
5779
----------
5880
- Add Dimer distortion as a targeted distortion for dimer reconstructions. It pushes two of the defect NN
59-
to a distance of 2 A.
60-
- Add option `distorted_atoms` to the `Distortion` class to allow users to specify the indexes of the
81+
to a distance of 2 .
82+
- Add option ``distorted_atoms`` to the ``Distortion`` class to allow users to specify the indexes of the
6183
atoms to distort.
6284
- Update tests to check the new functionality.
63-
- Update `get_homoionic_bonds` to detect homoionic bonds between different cations/anions (rather than
85+
- Update ``get_homoionic_bonds`` to detect homoionic bonds between different cations/anions (rather than
6486
just bonds between the same element)
65-
- Fix issue with `snb-generate` when no defect name was specified (by adding `unrelaxed=True` when
66-
calling `get_defect_name_from_entry`)
67-
- Update functions that read `OUTCARs` to be able to read `OUTCAR.gz` files too
87+
- Fix issue with ``snb-generate`` when no defect name was specified (by adding ``unrelaxed=True`` when
88+
calling ``get_defect_name_from_entry``)
89+
- Update functions that read ``OUTCARs`` to be able to read ``OUTCAR.gz`` files too
6890
- Update energies parsing to still work when all distortions are high energy, but warn
69-
the user about this (i.e. only `Unperturbed`)
70-
- Update `snb-run` to add early-on detection of distortions that are stuck in high energy basins and
91+
the user about this (i.e. only ``Unperturbed``)
92+
- Update ``snb-run`` to add early-on detection of distortions that are stuck in high energy basins and
7193
rename them to "High_Energy" to avoid continuing their relaxation
7294
- Miscellaneous efficiency improvements and bug fixes
7395

7496
v3.2.3
7597
----------
76-
- Ensure the sorted `pymatgen` `Structure` is created for the VASP input (fixes a rare bug in `v3.2.1`
77-
and `v3.2.2` where for certain structures the order of elements in the POSCAR was not properly sorted,
78-
which is usually fine, but messed with the `ROPT` `INCAR` setting).
98+
- Ensure the sorted ``pymatgen`` ``Structure`` is created for the VASP input (fixes a rare bug in ``v3.2.1``
99+
and ``v3.2.2`` where for certain structures the order of elements in the POSCAR was not properly sorted,
100+
which is usually fine, but messed with the ``ROPT`` ``INCAR`` setting).
79101
- Plotting format updates (make legend frame more transparent to make datapoints behind it easier to see).
80102
- Update tests
81103
- Update docs (note about handling AFM systems)
@@ -89,78 +111,78 @@ v3.2.2
89111
v3.2.1
90112
----------
91113
- Update CLI config handling.
92-
- Remove `shakenbreak.vasp` module and use `doped` VASP file writing functions directly.
93-
- Add INCAR/KPOINTS/POTCAR file writing tests. `test_local.py` now deleted as these tests are now
94-
automatically run in `test_input.py`/`test_cli.py` if `POTCAR`s available.
114+
- Remove ``shakenbreak.vasp`` module and use ``doped`` VASP file writing functions directly.
115+
- Add INCAR/KPOINTS/POTCAR file writing tests. ``test_local.py`` now deleted as these tests are now
116+
automatically run in ``test_input.py``/``test_cli.py`` if ``POTCAR``\s available.
95117

96118
v3.2.0
97119
----------
98-
- Following the major release of `doped` `v2.0`, now compatible with the new `pymatgen`
99-
defects code (`pymatgen>2022.7.25`), this update:
100-
- Allows input of `doped` `DefectsGenerator` object to `Distortions`
120+
- Following the major release of ``doped`` ``v2.0``, now compatible with the new ``pymatgen``
121+
defects code (``pymatgen>2022.7.25``), this update:
122+
- Allows input of ``doped`` ``DefectsGenerator`` object to ``Distortions``
101123
- Updates the tutorials to reflect the current recommended workflow of generating defects
102-
with `doped` and then applying `ShakeNBreak`, no longer requiring separate virtual environments 🎉
124+
with ``doped`` and then applying ``ShakeNBreak``, no longer requiring separate virtual environments 🎉
103125

104126
v3.1.0
105127
----------
106-
- Update dependencies, as `hiphive=1.2` has been released, making `ShakeNBreak` compatible with
107-
`python=3.11`🎉
128+
- Update dependencies, as ``hiphive=1.2`` has been released, making ``ShakeNBreak`` compatible with
129+
``python=3.11`` 🎉
108130

109131
v3.0.0
110132
----------
111133
- Switch to semantic versioning
112134
- Update rattling functions to handle primitive bulk materials as well as supercells.
113-
- Add check to `snb-run` if there are multiple `OUTCAR`s present with one or less ionic steps, and if
135+
- Add check to ``snb-run`` if there are multiple ``OUTCAR``\s present with one or less ionic steps, and if
114136
this is also the case for the current run -> warn the user.
115137
- Small fixes, formatting and docs updates.
116138

117139
v23.06.23
118140
----------
119-
- Add `snb-mag` function, and automatically check the magnetisation from `ISPIN = 2` `OUTCAR` files when continuing
120-
relaxations with `snb-run` (and change to `ISPIN = 1` if magnetisation is negligible).
141+
- Add ``snb-mag`` function, and automatically check the magnetisation from ``ISPIN = 2`` ``OUTCAR`` files when continuing
142+
relaxations with ``snb-run`` (and change to ``ISPIN = 1`` if magnetisation is negligible).
121143
- Update handling of minimum distances and oxidation states, to deal with single-atom primitive unit cells and
122-
systems where `pymatgen` cannot guess the oxidation state (e.g. single-elements, intermetallics etc).
144+
systems where ``pymatgen`` cannot guess the oxidation state (e.g. single-elements, intermetallics etc).
123145
- Docs updates
124146

125147
v23.06.03
126148
----------
127-
- Make parsing of `DefectEntry`s more robust.
128-
- Update dependencies (now supporting `python=3.10` due to `numba` updates)
129-
- Refactor `CITATION.cff` to `CITATIONS.md`
149+
- Make parsing of ``DefectEntry``\s more robust.
150+
- Update dependencies (now supporting ``python=3.10`` due to ``numba`` updates)
151+
- Refactor ``CITATION.cff`` to ``CITATIONS.md``
130152
- Update docs, formatting and cleanup.
131153

132154
v23.04.27
133155
----------
134-
- Update `numpy` requirement to `numpy>=1.21.2` to fix `numpy.typing.NDArray` import error.
156+
- Update ``numpy`` requirement to ``numpy>=1.21.2`` to fix ``numpy.typing.NDArray`` import error.
135157
- Add News & Views free-to-read link to docs
136158

137159
v23.04.26
138160
----------
139-
- Updates to `snb-run` (copy `job` from parent directory if present, switch to `ALGO = All` if poor electronic convergence...)
140-
- Make `format_defect_name()` more robust
141-
- Update docs and `README.md` with published article links
161+
- Updates to ``snb-run`` (copy ``job`` from parent directory if present, switch to ``ALGO = All`` if poor electronic convergence...)
162+
- Make ``format_defect_name()`` more robust
163+
- Update docs and ``README.md`` with published article links
142164
- Formatting and cleanup
143165
- Make oxidation state guessing more efficient (previously was causing bottleneck with large cells)
144166
- Fix oxidation state guessing for rare elements
145-
- Add note to `Tips` docs page about bulk phase transformation behaviour
146-
- Refactor to `json` rather than `pickle`
167+
- Add note to ``Tips`` docs page about bulk phase transformation behaviour
168+
- Refactor to ``json`` rather than ``pickle``
147169

148170
v23.02.08
149171
----------
150-
- Change `numpy` version requirement in `docs/requirements.txt` to `numpy>=1.21` to work with `numpy.typing.NDArray`.
172+
- Change ``numpy`` version requirement in ``docs/requirements.txt`` to ``numpy>=1.21`` to work with ``numpy.typing.NDArray``.
151173

152174
v23.02.02
153175
----------
154176
- Refactor Distortions() class to take in DefectEntry objects as input, rather than Defect objects, to be
155-
compatible with `pymatgen-analysis-defects`.
177+
compatible with ``pymatgen-analysis-defects``.
156178
- Fix ticks and ticklabels in plots
157179

158180

159181
v23.01.25
160182
--------
161183

162-
- Specify `pandas` version in requirements.txt to equal or higher than 1.1.0
163-
- Refactor `snb-regenerate` to execute when no arguments are specified (rather than showing help message)
184+
- Specify ``pandas`` version in requirements.txt to equal or higher than 1.1.0
185+
- Refactor ``snb-regenerate`` to execute when no arguments are specified (rather than showing help message)
164186

165187
v23.01.7
166188
--------
@@ -183,7 +205,6 @@ v22.12.1
183205
v22.11.29
184206
--------
185207

186-
Main changes:
187208
- Add example notebook showing how to generate interstitials and apply SnB to them.
188209
- Fix typo in example notebook and docs.
189210
- Add comment about font installation to Installation guide.
@@ -205,78 +226,66 @@ Docs tutorial update.
205226
v22.11.17
206227
--------
207228

208-
Main changes:
209-
210-
- Refactor :code:`Distortions()` to a list or simple-format dict of :code:`Defect` objects as input.
211-
Same for :code:`Distortions.from_structures()`
212-
- Update defect naming to :code:`{Defect.name}_s{Defect.defect_site_index}` for vacancies/substitutions and
213-
:code:`{Defect.name}_m{Defect.multiplicity}` for interstitials. Append "a", "b", "c" etc in cases of inequivalent
229+
- Refactor ``Distortions()`` to a list or simple-format dict of ``Defect`` objects as input.
230+
Same for ``Distortions.from_structures()``
231+
- Update defect naming to ``{Defect.name}_s{Defect.defect_site_index}`` for vacancies/substitutions and
232+
``{Defect.name}_m{Defect.multiplicity}`` for interstitials. Append "a", "b", "c" etc in cases of inequivalent
214233
defects
215-
- Make :code:`ShakeNBreak` compatible with most recent :code:`pymatgen` and :code:`pymatgen-analysis-defects` packages.
234+
- Make ``ShakeNBreak`` compatible with most recent ``pymatgen`` and ``pymatgen-analysis-defects`` packages.
216235
- Update legend format in plots and site index/multiplicity labelling, make default format png.
217-
- Update default charge state setting to match :code:`pymatgen-analysis-defects` oxi state + padding approach.
236+
- Update default charge state setting to match ``pymatgen-analysis-defects`` oxi state + padding approach.
218237
- A lot of additional warning and error catches.
219238
- Miscellaneous warnings and docs updates.
220239

221240

222241
v22.11.7
223242
--------
224243

225-
Main changes:
226-
227-
- Refactor ShakeNBreak to make it compatible with `pymatgen>=2022.8.23`. Now `Distortions` takes in
228-
`pymatgen.analysis.defects.core.Defect` objects.
229-
- Add `Distortions.from_dict()` and `Distortions.from_structures()` to generate defect distortions from a
244+
- Refactor ShakeNBreak to make it compatible with ``pymatgen>=2022.8.23``. Now ``Distortions`` takes in
245+
``pymatgen.analysis.defects.core.Defect`` objects.
246+
- Add ``Distortions.from_dict()`` and ``Distortions.from_structures()`` to generate defect distortions from a
230247
dictionary of defects (in doped format) or from a list of defect structures, respectively.
231248

232249
v22.11.1
233250
--------
234251

235-
Main changes:
236-
237-
- Update rattling procedure; :code:`stdev` be automatically set to 10% bulk bond length and :code:`seed` alternated for different
252+
- Update rattling procedure; ``stdev`` be automatically set to 10% bulk bond length and ``seed`` alternated for different
238253
distortions (set to 100*distortion_factor) to avoid rare 'stuck rattle' occurrences.
239-
- Refactor :code:`pickle` usages to :code:`JSON` serialisation to be more robust to package (i.e. pymatgen) updates.
240-
- Update :code:`snb-regenerate` to be more robust, can be continually rerun without generating duplicate calculations.
241-
- Update :code:`snb-run` to consider calculations with >50 ionic steps and <2 meV energy change as converged.
254+
- Refactor ``pickle`` usages to ``JSON`` serialisation to be more robust to package (i.e. pymatgen) updates.
255+
- Update ``snb-regenerate`` to be more robust, can be continually rerun without generating duplicate calculations.
256+
- Update ``snb-run`` to consider calculations with >50 ionic steps and <2 meV energy change as converged.
242257
- Minor changes, efficiency improvements and bug fixes.
243258

244259

245260
v22.10.14
246261
--------
247262

248-
Just bumping version number to test updated GH Actions pip-install-test workflow.
263+
Just bumping version number to test updated GH Actions ``pip-install-test`` workflow.
249264

250265
v22.10.13
251266
--------
252267

253-
Main changes:
254-
255268
- Updated defect name handling to work for all conventions
256-
- More robust `snb-generate` and plotting behaviour
269+
- More robust ``snb-generate`` and plotting behaviour
257270
- Add CLI summary GIF to docs and README
258-
- Updated `snb-run` behaviour to catch high-energies and forces error to improve efficiency
271+
- Updated ``snb-run`` behaviour to catch high-energies and forces error to improve efficiency
259272
- Many miscellaneous tests and fixes
260273
- Docs updates
261274

262275
v22.9.21
263276
--------
264277

265-
Main changes:
266-
267-
- Fonts now included in `package_data` so can be installed with `pip` from `PyPI`
268-
- Refactoring `distortion_plots` plot saving to saving to defect directories, and preventing overwriting of previous plots
278+
- Fonts now included in ``package_data`` so can be installed with ``pip`` from ``PyPI``
279+
- Refactoring ``distortion_plots`` plot saving to saving to defect directories, and preventing overwriting of previous plots
269280
- Miscellaneous tests and fixes
270281
- Add summary GIF to docs and README
271282
- Handling for partial oxidation state input
272-
- Setting `EDIFFG = -0.01` and `local_rattle = False` as default
283+
- Setting ``EDIFFG = -0.01`` and ``local_rattle = False`` as default
273284

274285

275286
v22.9.2
276287
--------
277288

278-
Main changes:
279-
280289
- Update CLI commands (snb-parse, analyse, plot and groundstate can all now be run with no arguments within a defect folder)
281290
- Update custom font
282291
- Update groundstate() tests
@@ -286,8 +295,6 @@ Main changes:
286295
v22.9.1
287296
--------
288297

289-
Main changes:
290-
291298
- Test for pip install
292299
- Automatic release and upload to pypi
293300
- Add ShakeNBreak custom font, and automatise its installation
@@ -297,8 +304,6 @@ Main changes:
297304
v1.0.1
298305
------
299306

300-
Main changes:
301-
302307
- Docs formatting
303308
- Update pymatgen version to v2022.7.25, while refactoring to be compatible with v2022.8.23 takes place.
304309

0 commit comments

Comments
 (0)