5
5
import logging
6
6
from collections .abc import Sequence
7
7
from pathlib import Path
8
- from typing import Any , Optional , Union
8
+ from typing import Any , Union
9
9
10
10
from abipy .abio .inputs import AbinitInput
11
11
from abipy .flowtk import events
@@ -89,7 +89,7 @@ class OutputDoc(BaseModel):
89
89
"""
90
90
91
91
structure : Union [Structure ] = Field (None , description = "The output structure object" )
92
- trajectory : Optional [ Sequence [Union [Structure ]]] = Field (
92
+ trajectory : Sequence [Union [Structure ]] | None = Field (
93
93
None , description = "The trajectory of output structures"
94
94
)
95
95
energy : float = Field (
@@ -98,15 +98,15 @@ class OutputDoc(BaseModel):
98
98
energy_per_atom : float = Field (
99
99
None , description = "The final DFT energy per atom for the last calculation"
100
100
)
101
- bandgap : Optional [ float ] = Field (
101
+ bandgap : float | None = Field (
102
102
None , description = "The DFT bandgap for the last calculation"
103
103
)
104
- cbm : Optional [ float ] = Field (None , description = "CBM for this calculation" )
105
- vbm : Optional [ float ] = Field (None , description = "VBM for this calculation" )
106
- forces : Optional [ list [Vector3D ]] = Field (
104
+ cbm : float | None = Field (None , description = "CBM for this calculation" )
105
+ vbm : float | None = Field (None , description = "VBM for this calculation" )
106
+ forces : list [Vector3D ] | None = Field (
107
107
None , description = "Forces on atoms from the last calculation"
108
108
)
109
- stress : Optional [ Matrix3D ] = Field (
109
+ stress : Matrix3D | None = Field (
110
110
None , description = "Stress on the unit cell from the last calculation"
111
111
)
112
112
@@ -179,49 +179,47 @@ class AbinitTaskDoc(StructureMetadata):
179
179
Additional json loaded from the calculation directory
180
180
"""
181
181
182
- dir_name : Optional [str ] = Field (
183
- None , description = "The directory for this Abinit task"
184
- )
185
- last_updated : Optional [str ] = Field (
182
+ dir_name : str | None = Field (None , description = "The directory for this Abinit task" )
183
+ last_updated : str | None = Field (
186
184
default_factory = datetime_str ,
187
185
description = "Timestamp for when this task document was last updated" ,
188
186
)
189
- completed_at : Optional [ str ] = Field (
187
+ completed_at : str | None = Field (
190
188
None , description = "Timestamp for when this task was completed"
191
189
)
192
- input : Optional [ InputDoc ] = Field (
190
+ input : InputDoc | None = Field (
193
191
None , description = "The input to the first calculation"
194
192
)
195
- output : Optional [ OutputDoc ] = Field (
193
+ output : OutputDoc | None = Field (
196
194
None , description = "The output of the final calculation"
197
195
)
198
196
structure : Union [Structure ] = Field (
199
197
None , description = "Final output atoms from the task"
200
198
)
201
- state : Optional [ TaskState ] = Field (None , description = "State of this task" )
202
- event_report : Optional [ events .EventReport ] = Field (
199
+ state : TaskState | None = Field (None , description = "State of this task" )
200
+ event_report : events .EventReport | None = Field (
203
201
None , description = "Event report of this abinit job."
204
202
)
205
- included_objects : Optional [ list [AbinitObject ]] = Field (
203
+ included_objects : list [AbinitObject ] | None = Field (
206
204
None , description = "List of Abinit objects included with this task document"
207
205
)
208
- abinit_objects : Optional [ dict [AbinitObject , Any ]] = Field (
206
+ abinit_objects : dict [AbinitObject , Any ] | None = Field (
209
207
None , description = "Abinit objects associated with this task"
210
208
)
211
- task_label : Optional [ str ] = Field (None , description = "A description of the task" )
212
- tags : Optional [ list [str ]] = Field (
209
+ task_label : str | None = Field (None , description = "A description of the task" )
210
+ tags : list [str ] | None = Field (
213
211
None , description = "Metadata tags for this task document"
214
212
)
215
- author : Optional [ str ] = Field (
213
+ author : str | None = Field (
216
214
None , description = "Author extracted from transformations"
217
215
)
218
- icsd_id : Optional [ str ] = Field (
216
+ icsd_id : str | None = Field (
219
217
None , description = "International crystal structure database id of the structure"
220
218
)
221
- calcs_reversed : Optional [ list [Calculation ]] = Field (
219
+ calcs_reversed : list [Calculation ] | None = Field (
222
220
None , description = "The inputs and outputs for all Abinit runs in this task."
223
221
)
224
- transformations : Optional [ dict [str , Any ]] = Field (
222
+ transformations : dict [str , Any ] | None = Field (
225
223
None ,
226
224
description = "Information on the structural transformations, parsed from a "
227
225
"transformations.json file" ,
@@ -231,7 +229,7 @@ class AbinitTaskDoc(StructureMetadata):
231
229
description = "Information on the custodian settings used to run this "
232
230
"calculation, parsed from a custodian.json file" ,
233
231
)
234
- additional_json : Optional [ dict [str , Any ]] = Field (
232
+ additional_json : dict [str , Any ] | None = Field (
235
233
None , description = "Additional json loaded from the calculation directory"
236
234
)
237
235
0 commit comments