-
Notifications
You must be signed in to change notification settings - Fork 925
Open
Labels
Description
Python version
Python 3.13.8
Pymatgen version
2025.10.7
Operating system version
Debian unstable
Current behavior
test_atoms_constraints in TestPackmolSet (tests/io/test_packmol.py) is failing in Debian builds on some architectures: arm64, ppc64el, i386, loong64, ppc64
Full set of build logs can be found at https://buildd.debian.org/status/package.php?p=pymatgen
The error message (on arm64) is
=================================== FAILURES ===================================
____________________ TestPackmolSet.test_atoms_constraints _____________________
self = <test_packmol.TestPackmolSet object at 0xffff7443e350>
def test_atoms_constraints(self):
"""
Test individual constraints.
"""
pw = PackmolBoxGen(
inputfile="input.in",
outputfile=Path("output.xyz"),
stdoutfile=Path("stdout.txt"),
control_params={"precision": 0.001},
).get_input_set(
molecules=[
{
"name": "water",
"number": 5,
"coords": water,
"constraints": ["inside sphere 0 0 0 10"],
"atoms_constraints": [
{"indices": [2], "constraints": ["inside sphere 0 0 0 5"]},
{"indices": [0, 1], "constraints": ["outside sphere 0 0 0 5.5"]},
],
},
],
)
pw.write_input(f"{self.tmp_path}/with_atoms_constraints")
assert os.path.isfile(f"{self.tmp_path}/with_atoms_constraints/input.in")
with open(f"{self.tmp_path}/with_atoms_constraints/input.in") as f:
inp = f.read()
assert ("\n atoms 3\n inside sphere 0 0 0 5\n end atoms\n") in inp
assert ("\n atoms 1 2\n outside sphere 0 0 0 5.5\n end atoms\n") in inp
pw.run(f"{self.tmp_path}/with_atoms_constraints")
assert os.path.isfile(f"{self.tmp_path}/with_atoms_constraints/output.xyz")
assert os.path.isfile(f"{self.tmp_path}/with_atoms_constraints/stdout.txt")
out = Molecule.from_file(f"{self.tmp_path}/with_atoms_constraints/output.xyz")
assert out.composition.num_atoms == 15
for site in out:
if site.specie.symbol == "H":
> assert np.linalg.norm(site.coords) >= 5.49
E AssertionError: assert np.float64(5.483361163873123) >= 5.49
E + where np.float64(5.483361163873123) = <function norm at 0xffff905acff0>(array([ 3.1658, 0.0496, -4.4769]))
E + where <function norm at 0xffff905acff0> = <module 'numpy.linalg' from '/usr/lib/python3/dist-packages/numpy/linalg/__init__.py'>.norm
E + where <module 'numpy.linalg' from '/usr/lib/python3/dist-packages/numpy/linalg/__init__.py'> = np.linalg
E + and array([ 3.1658, 0.0496, -4.4769]) = Site: H (3.1658, 0.0496, -4.4769).coords
/build/reproducible-path/pymatgen-2025.10.7+dfsg1/.pybuild/test_python3.13/tests/io/test_packmol.py:427: AssertionError
...
= 1 failed, 2689 passed, 159 skipped, 294 deselected, 10 xfailed, 2 xpassed, 77 warnings in 1227.19s (0:20:27) =
Expected Behavior
The test should pass.
Minimal example
pytest-3 -vv -k test_atoms_constraints tests/io/test_packmol.pyRelevant files to reproduce this bug
No response