Skip to content

Commit 606abe6

Browse files
committed
Merge remote-tracking branch 'origin/add_adsorption' into add_adsorption
2 parents f6f530b + 591314f commit 606abe6

File tree

25 files changed

+124
-125
lines changed

25 files changed

+124
-125
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_language_version:
33
exclude: ^(.github/|tests/test_data/abinit/)
44
repos:
55
- repo: https://github.com/charliermarsh/ruff-pre-commit
6-
rev: v0.4.4
6+
rev: v0.4.10
77
hooks:
88
- id: ruff
99
args: [--fix]
@@ -38,7 +38,7 @@ repos:
3838
- tokenize-rt==4.1.0
3939
- types-paramiko
4040
- repo: https://github.com/codespell-project/codespell
41-
rev: v2.2.6
41+
rev: v2.3.0
4242
hooks:
4343
- id: codespell
4444
stages: [commit, commit-msg]

docs/dev/abinit_tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ be added to this pseudopotential table.
1717
Note that information from the real pseudopotential files is used in the creation
1818
of the jobs and flows, hence fake pseudopotentials are not an option here.
1919

20-
2120
### File sizes
2221

2322
The files produced by ABINIT are generally large and would overwhelm the size of the
@@ -121,7 +120,7 @@ atm dev abinit-test-data TEST_NAME
121120

122121
You should change `TEST_NAME` to be a name for the workflow test. Note, `TEST_NAME` should not
123122
contain spaces or punctuation. For example, the band structure workflow test data was
124-
genenerated using `atm dev vasp-test-data Si_band_structure`.
123+
generated using `atm dev vasp-test-data Si_band_structure`.
125124

126125
This will automatically detect whether the Maker is a Job Maker or a Flow Maker and
127126
copy files in the corresponding `tests/test_data/abinit/jobs/NameOfMaker/TEST_NAME`
@@ -145,6 +144,7 @@ a unique name. For example, there cannot be two calculations called "relax".
145144
Instead you should ensure they are named something like "relax 1" and "relax 2".
146145

147146
Each `REF_RUN_FOLDER` contains:
147+
148148
- A folder called "inputs" with the run.abi and abinit_input.json, as well as with the
149149
indata, outdata and tmpdata directories. The indata directory potentially contains
150150
the reference fake input files needed for the job to be executed (e.g. a fake link to a

pyproject.toml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ strict = [
9595
"monty==2024.5.24",
9696
"mp-api==0.41.2",
9797
"numpy",
98-
"phonopy==2.24.2",
99-
"pydantic-settings==2.3.1",
100-
"pydantic==2.7.3",
98+
"phonopy==2.24.3",
99+
"pydantic-settings==2.3.3",
100+
"pydantic==2.7.4",
101101
"pymatgen-analysis-defects==2024.5.11",
102-
"pymatgen==2024.5.31",
103-
"python-ulid==2.6.0",
102+
"pymatgen==2024.6.10",
103+
"python-ulid==2.7.0",
104104
"quippy-ase==0.9.14",
105105
"seekpath==2.1.0",
106106
"torch==2.2.1",
@@ -165,15 +165,14 @@ select = ["ALL"]
165165
ignore = [
166166
"ANN002",
167167
"ANN003",
168-
"ANN101", # missing self type annotation
169-
"ANN102",
168+
"ANN101", # missing self type annotation
169+
"ANN102", # missing cls annotation
170170
"ANN401",
171-
"ARG002", # unused method argument
172-
"BLE001",
171+
"ARG002", # unused method argument
172+
# "BLE001",
173173
"C408", # Unnecessary (dict/list/tuple) call - remove call
174174
"C901", # function too complex
175175
"COM812", # trailing comma missing
176-
"DTZ", # datetime-tz-now
177176
"EM", # exception message must not use f-string literal
178177
"ERA001", # found commented out code
179178
"FBT001",
@@ -183,15 +182,18 @@ ignore = [
183182
"ISC001",
184183
"PD011", # pandas-use-of-dot-values
185184
"PERF203", # try-except-in-loop
186-
"PLR", # pylint-refactor
185+
"PLR0911", # too many returns
186+
"PLR0912", # too many branches
187+
"PLR0913", # too many arguments
188+
"PLR0915", # too many local statements
189+
"PLR2004",
187190
"PT004", # pytest-missing-fixture-name-underscore
188191
"PT006", # pytest-parametrize-names-wrong-type
189192
"PT013", # pytest-incorrect-pytest-import
190193
"PTH", # prefer Pathlib to os.path
191194
"RUF013", # implicit-optional
192195
"S324", # use of insecure hash function
193196
"S507", # paramiko auto trust
194-
"SLF", # private member accessed outside class
195197
"TD", # TODOs
196198
"TRY003", # long message outside exception class
197199
]
@@ -204,7 +206,7 @@ docstring-code-format = true
204206

205207
[tool.ruff.lint.per-file-ignores]
206208
"__init__.py" = ["F401"]
207-
"**/tests/*" = ["ANN", "ARG001", "D", "INP001", "S101"]
209+
"**/tests/*" = ["ANN", "ARG001", "D", "INP001", "PLR2004", "S101"]
208210
# flake8-type-checking (TCH): things inside TYPE_CHECKING aren't available
209211
# at runtime and so can't be used by pydantic models
210212
# flake8-future-annotations (FA): pipe operator for type unions only work in pydantic models in python 3.10+

src/atomate2/abinit/run.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,3 @@ def run_abinit(
6262
process.terminate()
6363

6464
process.wait()
65-
return

src/atomate2/abinit/schemas/calculation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import logging
66
import os
7-
from datetime import datetime
7+
from datetime import datetime, timezone
88
from pathlib import Path
99
from typing import Optional, Union
1010

@@ -236,7 +236,9 @@ def from_abinit_files(
236236

237237
abinit_gsr = GsrFile.from_file(abinit_gsr_file)
238238

239-
completed_at = str(datetime.fromtimestamp(os.stat(abinit_log_file).st_mtime))
239+
completed_at = str(
240+
datetime.fromtimestamp(os.stat(abinit_log_file).st_mtime, tz=timezone.utc)
241+
)
240242

241243
output_doc = CalculationOutput.from_abinit_gsr(abinit_gsr)
242244

@@ -255,7 +257,7 @@ def from_abinit_files(
255257
if report.run_completed:
256258
has_abinit_completed = TaskState.SUCCESS
257259

258-
except Exception as exc:
260+
except (ValueError, RuntimeError, Exception) as exc:
259261
msg = f"{cls} exception while parsing event_report:\n{exc}"
260262
logger.critical(msg)
261263

src/atomate2/abinit/sets/base.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def get_input_set(
356356
else:
357357
if prev_outputs is not None and not self.prev_outputs_deps:
358358
raise RuntimeError(
359-
f"Previous outputs not allowed for {self.__class__.__name__}."
359+
f"Previous outputs not allowed for {type(self).__name__}."
360360
)
361361
abinit_input = self.get_abinit_input(
362362
structure=structure,
@@ -573,7 +573,7 @@ def get_abinit_input(
573573
if self.factory_prev_inputs_kwargs:
574574
if not prev_outputs:
575575
raise RuntimeError(
576-
f"No previous_outputs. Required for {self.__class__.__name__}."
576+
f"No previous_outputs. Required for {type(self).__name__}."
577577
)
578578

579579
# TODO consider cases where structure might be defined even if
@@ -588,18 +588,16 @@ def get_abinit_input(
588588
)
589589
total_factory_kwargs.update(abinit_inputs)
590590

591-
else:
592-
# TODO check if this should be removed or the check be improved
593-
if structure is None:
594-
msg = (
595-
f"Structure is mandatory for {self.__class__.__name__} "
596-
f"generation since no previous output is used."
597-
)
598-
raise RuntimeError(msg)
591+
elif structure is None:
592+
msg = (
593+
f"Structure is mandatory for {type(self).__name__} "
594+
f"generation since no previous output is used."
595+
)
596+
raise RuntimeError(msg)
599597

600598
if not self.prev_outputs_deps and prev_outputs:
601599
msg = (
602-
f"Previous outputs not allowed for {self.__class__.__name__} "
600+
f"Previous outputs not allowed for {type(self).__name__} "
603601
"Consider if restart_from argument of get_input_set method "
604602
"can fit your needs instead."
605603
)

src/atomate2/abinit/utils/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def get_event_report(ofile: File, mpiabort_file: File) -> EventReport | None:
425425
report.append(last_abort_event)
426426
else:
427427
report.append(last_abort_event)
428-
except Exception as exc:
428+
except (ValueError, RuntimeError, Exception) as exc:
429429
# Return a report with an error entry with info on the exception.
430430
logger.critical(f"{ofile}: Exception while parsing ABINIT events:\n {exc!s}")
431431
return parser.report_exception(ofile.path, exc)

src/atomate2/aims/jobs/convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def make(
9797
"convergence_field_values": [],
9898
"epsilon": self.epsilon,
9999
}
100-
convergence_data.update({"idx": idx, "converged": converged})
100+
convergence_data.update(idx=idx, converged=converged)
101101

102102
if prev_dir is not None:
103103
split_prev_dir = str(prev_dir).split(":")[-1]

src/atomate2/aims/schemas/calculation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import os
66
from collections.abc import Sequence
7-
from datetime import datetime
7+
from datetime import datetime, timezone
88
from pathlib import Path
99
from typing import TYPE_CHECKING, Any, Optional, Union
1010

@@ -291,7 +291,9 @@ def from_aims_files(
291291
volumetric_files = [] if volumetric_files is None else volumetric_files
292292
aims_output = AimsOutput.from_outfile(aims_output_file)
293293

294-
completed_at = str(datetime.fromtimestamp(os.stat(aims_output_file).st_mtime))
294+
completed_at = str(
295+
datetime.fromtimestamp(os.stat(aims_output_file).st_mtime, tz=timezone.utc)
296+
)
295297

296298
output_file_paths = _get_output_file_paths(volumetric_files)
297299
aims_objects: dict[AimsObject, Any] = _get_volumetric_data(

src/atomate2/aims/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""A collection of helper utils found in atomate2 package."""
22

3-
from datetime import datetime
3+
from datetime import datetime, timezone
44

55

66
def datetime_str() -> str:
@@ -12,4 +12,4 @@ def datetime_str() -> str:
1212
str
1313
The current time.
1414
"""
15-
return str(datetime.utcnow())
15+
return str(datetime.now(tz=timezone.utc))

0 commit comments

Comments
 (0)