Skip to content

Commit f4a51d2

Browse files
committed
Merge branch 'main' of https://github.com/materialsproject/atomate2 into atomate2-aims
2 parents 628ab6b + 0dad7cb commit f4a51d2

File tree

28 files changed

+195
-194
lines changed

28 files changed

+195
-194
lines changed

.github/workflows/testing.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: testing
33
on:
44
push:
55
branches: [main]
6-
tags: ['v*']
6+
tags: ["v*"]
77
pull_request:
8-
branches: [main]
8+
workflow_dispatch:
99

1010
jobs:
1111
lint:
@@ -45,7 +45,7 @@ jobs:
4545
- name: Install dependencies
4646
run: |
4747
python -m pip install --upgrade pip
48-
pip install .[strict,tests]
48+
pip install .[strict,tests]
4949
5050
- name: Test
5151
env:

pyproject.toml

+22-20
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ classifiers = [
1717
"Intended Audience :: System Administrators",
1818
"Operating System :: OS Independent",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.11",
2120
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
2222
"Programming Language :: Python :: 3.9",
2323
"Topic :: Other/Nonlisted Topic",
2424
"Topic :: Scientific/Engineering",
@@ -28,32 +28,33 @@ dependencies = [
2828
"PyYAML",
2929
"click",
3030
"custodian>=2023.3.10",
31-
"emmet-core>=0.65.0",
31+
"emmet-core>=0.70.0",
3232
"jobflow>=0.1.11",
33-
"monty",
33+
"monty>=2023.9.25",
3434
"numpy",
35-
"pydantic",
36-
"pymatgen>=2023.1.9",
35+
"pydantic-settings>=2.0.3",
36+
"pydantic>=2.0.1",
37+
"pymatgen>=2023.10.11",
3738
]
3839

3940
[project.optional-dependencies]
4041
amset = ["amset>=0.4.15", "pydash"]
4142
cclib = ["cclib"]
42-
mp = ["mp-api>=0.27.5"]
43+
mp = ["mp-api>=0.37.5"]
4344
phonons = ["phonopy>=1.10.8", "seekpath"]
44-
lobster = ["lobsterpy>=0.3.1"]
45+
lobster = ["lobsterpy>=0.3.2"]
4546
defects = ["dscribe>=1.2.0", "pymatgen-analysis-defects>=2022.11.30"]
46-
forcefields = ["chgnet==0.2.0", "matgl==0.8.3", "quippy-ase==0.9.14"]
47+
forcefields = ["chgnet>=0.2.2", "matgl>=0.8.3", "quippy-ase>=0.9.14"]
4748
docs = [
4849
"FireWorks==2.0.3",
49-
"autodoc_pydantic==1.9.0",
50+
"autodoc_pydantic==2.0.1",
5051
"furo==2023.9.10",
51-
"ipython==8.16.0",
52+
"ipython==8.16.1",
5253
"jsonschema[format]",
5354
"myst_parser==2.0.0",
5455
"numpydoc==1.6.0",
55-
"sphinx==7.2.6",
5656
"sphinx-copybutton==0.5.2",
57+
"sphinx==7.2.6",
5758
"sphinx_design==0.5.0",
5859
]
5960
dev = ["pre-commit>=2.12.1"]
@@ -62,21 +63,22 @@ aims = ["ase@git+https://gitlab.com/ase/ase.git@793179f4#egg=ase"]
6263
strict = [
6364
"PyYAML==6.0.1",
6465
"cclib==1.8",
65-
"chgnet==0.2.0",
66+
"chgnet==0.2.2",
6667
"click==8.1.7",
67-
"custodian==2023.7.22",
68+
"custodian==2023.10.9",
6869
"dscribe==2.1.0",
69-
"emmet-core==0.68.0",
70-
"jobflow==0.1.13",
71-
"lobsterpy==0.3.1",
70+
"emmet-core==0.70.4",
71+
"jobflow==0.1.14",
72+
"lobsterpy==0.3.2",
7273
"matgl==0.8.3",
73-
"monty==2023.9.5",
74-
"mp-api==0.35.1",
74+
"monty==2023.9.25",
75+
"mp-api==0.37.5",
7576
"numpy",
7677
"phonopy==2.20.0",
77-
"pydantic==1.10.9",
78+
"pydantic-settings==2.0.3",
79+
"pydantic==2.4.2",
7880
"pymatgen-analysis-defects==2023.8.22",
79-
"pymatgen==2023.9.10",
81+
"pymatgen==2023.10.11",
8082
"quippy-ase==0.9.14",
8183
"seekpath==2.1.0",
8284
"typing-extensions==4.8.0",

src/atomate2/amset/schemas.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@ class AmsetTaskDocument(StructureMetadata):
133133
)
134134
soc: bool = Field(None, description="Whether spin-orbit coupling was included")
135135
structure: Structure = Field(None, description="The structure used in this task")
136-
_schema: str = Field(
137-
__version__,
138-
description="Version of atomate2 used to create the document",
139-
alias="schema",
136+
schema: str = Field(
137+
__version__, description="Version of atomate2 used to create the document"
140138
)
141139

142140
@classmethod

src/atomate2/common/flows/defect.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ class FormationEnergyMaker(Maker, ABC):
199199
sites with selective dynamics set to True. So this setting only works
200200
with `relax_radius`.
201201
202+
validate_charge: bool
203+
Whether to validate the charge of the defect. If True (default), the charge
204+
of the output structure will have to match the charge of the input defect.
205+
This helps catch situations where the charge of the output defect is either
206+
improperly set or improperly parsed before the data is stored in the
207+
database.
208+
202209
collect_defect_entry_data: bool
203210
Whether to collect the defect entry data at the end of the flow.
204211
If True, the output of all the charge states for each symmetry distinct
@@ -234,14 +241,14 @@ class FormationEnergyMaker(Maker, ABC):
234241
'defect_uuid': 'a1c31095-0494-4eed-9862-95311f80a993'
235242
}
236243
]
237-
238244
"""
239245

240246
defect_relax_maker: Maker
241247
bulk_relax_maker: Maker | None = None
242248
name: str = "formation energy"
243249
relax_radius: float | str | None = None
244250
perturb: float | None = None
251+
validate_charge: bool = True
245252
collect_defect_entry_data: bool = False
246253

247254
def __post_init__(self):
@@ -317,6 +324,7 @@ def make(
317324
},
318325
relax_radius=self.relax_radius,
319326
perturb=self.perturb,
327+
validate_charge=self.validate_charge,
320328
)
321329
jobs.extend([get_sc_job, spawn_output])
322330

src/atomate2/common/jobs/defect.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -400,18 +400,18 @@ def check_charge_state(charge_state: int, task_structure: Structure) -> Response
400400
if int(charge_state) != int(task_structure.charge):
401401
raise ValueError(
402402
f"The charge of the output structure is {task_structure.charge}, "
403-
f"but expect charge state from the Defect object is {charge_state}."
403+
f"but expected charge state from the Defect object is {charge_state}."
404404
)
405405
return True
406406

407407

408408
@job
409409
def get_defect_entry(charge_state_summary: dict, bulk_summary: dict):
410410
"""Get a defect entry from a defect calculation and a bulk calculation."""
411-
bulk_c_entry = bulk_summary["sc_entry"]
411+
bulk_sc_entry = bulk_summary["sc_entry"]
412412
bulk_struct_entry = ComputedStructureEntry(
413413
structure=bulk_summary["sc_struct"],
414-
energy=bulk_c_entry.energy,
414+
energy=bulk_sc_entry.energy,
415415
)
416416
bulk_dir_name = bulk_summary["dir_name"]
417417
bulk_locpot = bulk_summary["locpot_plnr"]

src/atomate2/common/jobs/phonons.py

-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def generate_frequencies_eigenvectors(
227227
Born charges
228228
kwargs: dict
229229
Additional parameters that are passed to PhononBSDOSDoc.from_forces_born
230-
231230
"""
232231
return PhononBSDOSDoc.from_forces_born(
233232
structure=structure,

src/atomate2/common/jobs/utils.py

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def structure_to_primitive(
3030
Returns
3131
-------
3232
.Structure
33-
3433
"""
3534
sga = SpacegroupAnalyzer(structure, symprec=symprec)
3635
return sga.get_primitive_standard_structure()
@@ -53,7 +52,6 @@ def structure_to_conventional(
5352
Returns
5453
-------
5554
.Structure
56-
5755
"""
5856
sga = SpacegroupAnalyzer(structure, symprec=symprec)
5957
return sga.get_conventional_standard_structure()

src/atomate2/common/schemas/cclib.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
_T = TypeVar("_T", bound="TaskDocument")
2727

2828

29-
class TaskDocument(MoleculeMetadata):
29+
class TaskDocument(MoleculeMetadata, extra="allow"): # type: ignore[call-arg]
3030
"""
3131
Definition of a cclib-generated task document.
3232
@@ -54,10 +54,8 @@ class TaskDocument(MoleculeMetadata):
5454
default_factory=datetime_str,
5555
description="Timestamp for this task document was last updated",
5656
)
57-
_schema: str = Field(
58-
__version__,
59-
description="Version of atomate2 used to create the document",
60-
alias="schema",
57+
schema: str = Field(
58+
__version__, description="Version of atomate2 used to create the document"
6159
)
6260

6361
@classmethod
@@ -247,7 +245,7 @@ def from_logfile(
247245
metadata=metadata,
248246
)
249247
doc.molecule = final_molecule
250-
return doc.copy(update=additional_fields)
248+
return doc.model_copy(update=additional_fields)
251249

252250

253251
@requires(cclib, "cclib_calculate requires cclib to be installed.")

src/atomate2/common/schemas/defects.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ class CCDDocument(BaseModel):
150150
"in charge state (q2).",
151151
)
152152

153-
static_uuids1: List[str] = Field(
153+
static_uuids1: Optional[List[str]] = Field(
154154
None,
155155
description="UUIDs of distorted calculations for the defect (supercell) in "
156156
"charge state (q1).",
157157
)
158158

159-
static_uuids2: List[str] = Field(
159+
static_uuids2: Optional[List[str]] = Field(
160160
None,
161161
description="UUIDs of distorted calculations for the defect (supercell) in "
162162
"charge state (q2).",

src/atomate2/common/schemas/elastic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DerivedProperties(BaseModel):
6161
snyder_total: float = Field(
6262
None, description="Synder's total sound velocity (SI units)."
6363
)
64-
clark_thermalcond: float = Field(
64+
clark_thermalcond: Optional[float] = Field(
6565
None, description="Clarke's thermal conductivity (SI units)."
6666
)
6767
cahill_thermalcond: float = Field(
@@ -111,7 +111,7 @@ class ElasticDocument(StructureMetadata):
111111
elastic_tensor: ElasticTensorDocument = Field(
112112
None, description="Fitted elastic tensor."
113113
)
114-
eq_stress: Matrix3D = Field(
114+
eq_stress: Optional[Matrix3D] = Field(
115115
None, description="The equilibrium stress of the structure."
116116
)
117117
derived_properties: DerivedProperties = Field(

src/atomate2/common/schemas/phonons.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ class ThermalDisplacementData(BaseModel):
6767
class PhononUUIDs(BaseModel):
6868
"""Collection to save all uuids connected to the phonon run."""
6969

70-
optimization_run_uuid: str = Field(None, description="optimization run uuid")
71-
displacements_uuids: List[str] = Field(
70+
optimization_run_uuid: Optional[str] = Field(
71+
None, description="optimization run uuid"
72+
)
73+
displacements_uuids: Optional[List[str]] = Field(
7274
None, description="The uuids of the displacement jobs."
7375
)
74-
static_run_uuid: str = Field(None, description="static run uuid")
75-
born_run_uuid: str = Field(None, description="born run uuid")
76+
static_run_uuid: Optional[str] = Field(None, description="static run uuid")
77+
born_run_uuid: Optional[str] = Field(None, description="born run uuid")
7678

7779

7880
class ForceConstants(MSONable):
@@ -154,17 +156,17 @@ class PhononBSDOSDoc(StructureMetadata):
154156
)
155157

156158
# needed, e.g. to compute Grueneisen parameter etc
157-
force_constants: ForceConstants = Field(
159+
force_constants: Optional[ForceConstants] = Field(
158160
None, description="Force constants between every pair of atoms in the structure"
159161
)
160162

161-
born: List[Matrix3D] = Field(
163+
born: Optional[List[Matrix3D]] = Field(
162164
None,
163165
description="born charges as computed from phonopy. Only for symmetrically "
164166
"different atoms",
165167
)
166168

167-
epsilon_static: Matrix3D = Field(
169+
epsilon_static: Optional[Matrix3D] = Field(
168170
None, description="The high-frequency dielectric constant"
169171
)
170172

@@ -187,7 +189,7 @@ class PhononBSDOSDoc(StructureMetadata):
187189
"Field including all relevant job directories"
188190
)
189191

190-
uuids: PhononUUIDs = Field("Field including all relevant uuids")
192+
uuids: Optional[PhononUUIDs] = Field("Field including all relevant uuids")
191193

192194
@classmethod
193195
def from_forces_born(

0 commit comments

Comments
 (0)