Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3e1f8e3

Browse files
committedAug 20, 2024·
Merge branch 'develop' into displacements2
2 parents ca0d8c1 + 5cd9958 commit 3e1f8e3

25 files changed

+773
-290
lines changed
 

‎docs/Dev_ToDo.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
- Should flick through other defect codes (see
8686
https://shakenbreak.readthedocs.io/en/latest/Code_Compatibility.html, also `AiiDA-defects`) and see if
8787
there's any useful functionality we want to add!
88+
- Add short example notebook showing how to generate a defect PES for carrier capture or NEB calculations (don't use `IBRION = 2` for NEB).
8889

8990
## SK To-Do for next update:
9091
- `doped` repo/docs cleanup `TODO`s above

‎docs/Tips.rst

+7
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,13 @@ etc.).
453453
defect supercell, directly from just the relaxed structures, regardless of whether these defects were
454454
generated/parsed with ``doped``.
455455

456+
.. note::
457+
458+
Wyckoff letters for lattice sites can depend on the ordering of elements in the conventional standard
459+
structure, for which doped uses the ``spglib`` convention (e.g. in the ``DefectsGenerator`` info
460+
output).
461+
462+
456463
Serialization & Data Provenance (``JSON``/``csv``)
457464
--------------------------------------------------
458465
To aid calculation reproducibility, data provenance and easy sharing/comparison of pre- and post-processing

‎doped/analysis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def check_and_set_defect_entry_name(
118118
) -> None:
119119
"""
120120
Check that ``possible_defect_name`` is a recognised format by doped (i.e.
121-
in the format "{defect_name}_{optional_site_info}_{charge_state}").
121+
in the format ``"{defect_name}_{optional_site_info}_{charge_state}"``).
122122
123123
If the DefectEntry.name attribute is not defined or does not end with the
124124
charge state, then the entry will be renamed with the doped default name

‎doped/chemical_potentials.py

+473-48
Large diffs are not rendered by default.

‎doped/generation.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ def __init__(
11241124
``DefectEntry.charge_state_guessing_log`` attributes. See docs for examples of
11251125
modifying the generated charge states.
11261126
1127+
Note that Wyckoff letters can depend on the ordering of elements in the conventional
1128+
standard structure, for which doped uses the ``spglib`` convention.
1129+
11271130
Args:
11281131
structure (Structure):
11291132
Structure of the host material (as a pymatgen Structure object).
@@ -1836,8 +1839,6 @@ def _defect_generator_info(self):
18361839
info_string += (
18371840
"The number in the Wyckoff label is the site multiplicity/degeneracy of that defect in the "
18381841
f"conventional ('conv.') unit cell, which comprises {fu} formula unit(s) of {formula}.\n"
1839-
"Note that Wyckoff letters can depend on the ordering of elements in the conventional "
1840-
"standard structure, for which doped uses the spglib convention."
18411842
)
18421843

18431844
return info_string
@@ -2172,6 +2173,10 @@ def __repr__(self):
21722173
"""
21732174
Returns a string representation of the DefectsGenerator object, and
21742175
prints the DefectsGenerator info.
2176+
2177+
Note that Wyckoff letters can depend on the ordering of elements in
2178+
the conventional standard structure, for which doped uses the ``spglib``
2179+
convention.
21752180
"""
21762181
return (
21772182
self.__str__()

‎doped/py.typed

Whitespace-only changes.

‎doped/thermodynamics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def raw_energy_from_chempots(composition: Union[str, dict, Composition], chempot
217217
raw_energies_dict = dict(next(iter(chempots["limits"].values())))
218218

219219
if any(el.symbol not in raw_energies_dict for el in composition.elements):
220-
raise ValueError(
220+
warnings.warn(
221221
f"The chemical potentials dictionary (with elements {list(raw_energies_dict.keys())} does not "
222222
f"contain all the elements in the host composition "
223223
f"({[el.symbol for el in composition.elements]})!"

‎doped/utils/symmetry.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ def get_wyckoff(frac_coords, struct, symm_ops: Optional[list] = None, equiv_site
398398
symm_dataset, unique_sites = _get_symm_dataset_of_struc_with_all_equiv_sites(
399399
frac_coords, struct, symm_ops, symprec=symprec
400400
)
401-
conv_cell_factor = len(symm_dataset["std_positions"]) / len(symm_dataset["wyckoffs"])
401+
conv_cell_factor = len(symm_dataset.std_positions) / len(symm_dataset.wyckoffs)
402402
multiplicity = int(conv_cell_factor * len(unique_sites))
403-
wyckoff_label = f"{multiplicity}{symm_dataset['wyckoffs'][-1]}"
403+
wyckoff_label = f"{multiplicity}{symm_dataset.wyckoffs[-1]}"
404404

405405
return (wyckoff_label, unique_sites) if equiv_sites else wyckoff_label
406406

@@ -1126,7 +1126,7 @@ def point_symmetry_from_defect(defect, symm_ops=None, symprec=0.01):
11261126
symm_dataset, _unique_sites = _get_symm_dataset_of_struc_with_all_equiv_sites(
11271127
defect.site.frac_coords, defect.structure, symm_ops=symm_ops, symprec=symprec
11281128
)
1129-
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset["site_symmetry_symbols"][-1])
1129+
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset.site_symmetry_symbols[-1])
11301130
if spglib_point_group_symbol is not None:
11311131
return spglib_point_group_symbol
11321132

@@ -1240,7 +1240,7 @@ def point_symmetry_from_defect_entry(
12401240
# then easy, can just be taken from symmetry dataset of defect structure
12411241
symm_dataset = _get_sga(defect_entry.defect.structure, symprec=symprec).get_symmetry_dataset()
12421242
return schoenflies_from_hermann(
1243-
symm_dataset["site_symmetry_symbols"][defect_entry.defect.defect_site_index]
1243+
symm_dataset.site_symmetry_symbols[defect_entry.defect.defect_site_index]
12441244
)
12451245

12461246
supercell = _get_defect_supercell(defect_entry) if relaxed else _get_bulk_supercell(defect_entry)
@@ -1344,15 +1344,15 @@ def point_symmetry_from_defect_entry(
13441344
# This issue is avoided for relaxed defect supercells as we take the symm_ops of our reduced
13451345
# symmetry cell rather than that of the bulk (so no chance of spurious symmetry upgrade from
13461346
# equivalent sites), and hence the max point symmetry is the point symmetry of the defect
1347-
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset["site_symmetry_symbols"][-1])
1347+
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset.site_symmetry_symbols[-1])
13481348

13491349
# Note that, if the supercell is non-periodicity-breaking, then the site symmetry can be simply
13501350
# determined using the point group of the unrelaxed defect structure:
13511351
# unrelaxed_defect_supercell = defect_entry.calculation_metadata.get(
13521352
# "unrelaxed_defect_structure", defect_supercell
13531353
# )
13541354
# return schoenflies_from_hermann(
1355-
# _get_sga(unrelaxed_defect_supercell, symprec).get_symmetry_dataset()["pointgroup"],
1355+
# _get_sga(unrelaxed_defect_supercell, symprec).get_symmetry_dataset().pointgroup,
13561356
# )
13571357
# But current approach works for all cases with unrelaxed defect structures
13581358

@@ -1361,15 +1361,15 @@ def point_symmetry_from_defect_entry(
13611361
# the defect (e.g. for split-interstitials, split-vacancies, swapped vacancies etc),
13621362
# so use 'pointgroup' output (in this case the reduced symmetry avoids the symmetry-upgrade
13631363
# possibility with the equivalent sites, as when relaxed=False)
1364-
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset["pointgroup"])
1364+
spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset.pointgroup)
13651365

13661366
# This also works (at least for non-periodicity-breaking supercells) for relaxed defects in
13671367
# most cases, but is slightly less robust (more sensitive to ``symprec`` choice) than the
13681368
# approach above:
13691369
# schoenflies_from_hermann(
13701370
# _get_sga(
13711371
# defect_supercell, symprec=symprec
1372-
# ).get_symmetry_dataset()["pointgroup"]
1372+
# ).get_symmetry_dataset().pointgroup
13731373
# )
13741374

13751375
if spglib_point_group_symbol is not None:
@@ -1416,7 +1416,7 @@ def _check_relaxed_defect_symmetry_determination(
14161416

14171417
if unrelaxed_defect_structure is not None:
14181418
unrelaxed_spglib_point_group_symbol = schoenflies_from_hermann(
1419-
_get_sga(unrelaxed_defect_structure, symprec=symprec).get_symmetry_dataset()["pointgroup"],
1419+
_get_sga(unrelaxed_defect_structure, symprec=symprec).get_symmetry_dataset().pointgroup,
14201420
)
14211421

14221422
bulk_supercell = _get_bulk_supercell(defect_entry)
@@ -1428,9 +1428,7 @@ def _check_relaxed_defect_symmetry_determination(
14281428
symprec=symprec,
14291429
dist_tol=symprec,
14301430
)
1431-
bulk_spglib_point_group_symbol = schoenflies_from_hermann(
1432-
symm_dataset["site_symmetry_symbols"][-1]
1433-
)
1431+
bulk_spglib_point_group_symbol = schoenflies_from_hermann(symm_dataset.site_symmetry_symbols[-1])
14341432

14351433
if bulk_spglib_point_group_symbol != unrelaxed_spglib_point_group_symbol:
14361434
if verbose:

0 commit comments

Comments
 (0)
Please sign in to comment.