Skip to content

Commit 60137f4

Browse files
Han Wangclaude
andcommitted
fix(test): account for Masses section in dpdata>=1.0.2 lammps output
dpdata 1.0.2 started emitting a "Masses" section in the lammps/lmp output, which broke the exact-string comparison in TestConfGenerator.test_make_conf_list on the Python 3.13 CI job (3.9 gets dpdata 1.0.1, which has no Masses section, so it kept passing). Keep the strict string comparison but include the Masses block in the expected content when the installed dpdata is >= 1.0.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5083026 commit 60137f4

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/conf/test_alloy_conf.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import os
33
import random
4+
import re
45
import shutil
56
import tempfile
67
import unittest
@@ -23,8 +24,20 @@
2324
# isort: on
2425

2526

27+
# dpdata >= 1.0.2 emits a "Masses" section in the lammps/lmp output
28+
_dpdata_ver = tuple(int(x) for x in re.findall(r"\d+", dpdata.__version__)[:3])
29+
_lmp_masses = (
30+
"Masses\n\n 1 26.9815386000 # Al\n 2 24.3050000000 # Mg\n\n"
31+
if _dpdata_ver >= (1, 0, 2)
32+
else ""
33+
)
34+
2635
ofc0 = "\n1 atoms\n2 atom types\n 0.0000000000 2.0000000000 xlo xhi\n 0.0000000000 2.0000000000 ylo yhi\n 0.0000000000 2.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n\nAtoms # atomic\n\n 1 1 0.0000000000 0.0000000000 0.0000000000\n"
27-
ofc1 = "\n1 atoms\n2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n\nAtoms # atomic\n\n 1 2 0.0000000000 0.0000000000 0.0000000000\n"
36+
ofc1 = (
37+
"\n1 atoms\n2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n\n"
38+
+ _lmp_masses
39+
+ "Atoms # atomic\n\n 1 2 0.0000000000 0.0000000000 0.0000000000\n"
40+
)
2841
ofc2 = "\n1 atoms\n2 atom types\n 0.0000000000 4.0000000000 xlo xhi\n 0.0000000000 4.0000000000 ylo yhi\n 0.0000000000 4.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n\nAtoms # atomic\n\n 1 2 0.0000000000 0.0000000000 0.0000000000\n"
2942

3043

0 commit comments

Comments
 (0)