Skip to content

Commit 9ddcbbf

Browse files
pre-commit-ci[bot]pyiron-runnerjan-janssen
authored
[pre-commit.ci] pre-commit autoupdate (#307)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Format black * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update snap.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pyiron-runner <pyiron@mpie.de> Co-authored-by: Jan Janssen <jan-janssen@users.noreply.github.com>
1 parent 0cc06ab commit 9ddcbbf

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.6
3+
rev: v0.9.1
44
hooks:
55
- id: ruff
66
name: ruff lint

structuretoolkit/analyse/snap.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,8 @@ def _extract_computes_snap(
545545
np.ndarray: Output of the LAMMPS compute command
546546
"""
547547
lmp_atom_ids = lmp.numpy.extract_atom_iarray("id", num_atoms).flatten()
548-
assert np.all(
549-
lmp_atom_ids == 1 + np.arange(num_atoms)
550-
), "LAMMPS seems to have lost atoms"
548+
cond = np.all(lmp_atom_ids == 1 + np.arange(num_atoms))
549+
assert cond, "LAMMPS seems to have lost atoms"
551550

552551
# Extract types
553552
lmp_types = lmp.numpy.extract_atom_iarray(name="type", nelem=num_atoms).flatten()
@@ -569,16 +568,14 @@ def _extract_computes_snap(
569568

570569
lmp_dbarr = _extract_compute_np(lmp, "db", 1, 2, (num_atoms, num_types, 3, n_coeff))
571570
lmp_dbsum = _extract_compute_np(lmp, "db_sum", 0, 1, (num_types, 3, n_coeff))
572-
assert np.allclose(
573-
lmp_dbsum, lmp_dbarr.sum(axis=0), rtol=1e-12, atol=1e-12
574-
), "db_sum doesn't match sum of db"
571+
cond = np.allclose(lmp_dbsum, lmp_dbarr.sum(axis=0), rtol=1e-12, atol=1e-12)
572+
assert cond, "db_sum doesn't match sum of db"
575573
db_atom = np.transpose(lmp_dbarr, (0, 2, 1, 3))
576574

577575
lmp_vbarr = _extract_compute_np(lmp, "vb", 1, 2, (num_atoms, num_types, 6, n_coeff))
578576
lmp_vbsum = _extract_compute_np(lmp, "vb_sum", 0, 1, (num_types, 6, n_coeff))
579-
assert np.allclose(
580-
lmp_vbsum, lmp_vbarr.sum(axis=0), rtol=1e-12, atol=1e-12
581-
), "vb_sum doesn't match sum of vb"
577+
cond = np.allclose(lmp_vbsum, lmp_vbarr.sum(axis=0), rtol=1e-12, atol=1e-12)
578+
assert cond, "vb_sum doesn't match sum of vb"
582579
vb_sum = np.transpose(lmp_vbsum, (1, 0, 2)) / lmp_volume * eV_div_A3_to_bar
583580

584581
dbatom_shape = db_atom.shape

structuretoolkit/build/mesh.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def create_mesh(
4141
n_mesh = np.rint(np.linalg.norm(cell, axis=-1) / density).astype(int)
4242
elif density is not None:
4343
raise MeshInputError(
44-
"You cannot set n_mesh at density at the same time. Set one of"
45-
" them to None"
44+
"You cannot set n_mesh at density at the same time. Set one of them to None"
4645
)
4746
n_mesh = np.atleast_1d(n_mesh).astype(int)
4847
if len(n_mesh) == 1:

structuretoolkit/build/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ def generate(group):
9999
structures.append({"atoms": s, "symmetry": g, "repeat": i})
100100
if len(failed_groups) > 0:
101101
warnings.warn(
102-
f'Groups [{", ".join(map(str,failed_groups))}] could not be generated with stoichiometry {stoich}!'
102+
f"Groups [{', '.join(map(str, failed_groups))}] could not be generated with stoichiometry {stoich}!"
103103
)
104104
return structures

0 commit comments

Comments
 (0)