Skip to content

FAILED src/alchemlyb/tests/parsing/test_lammps.py::test_u_nk on Ubuntu runners #458

Description

@orbeckst

In PR #456 all ubuntu runners failed src/alchemlyb/tests/parsing/test_lammps.py::test_u_nk

https://github.com/alchemistry/alchemlyb/actions/runs/24628692124/job/72012085846?pr=456#step:5:1105

u_nk.shape is one larger than expected. Warnings indicate that the parser changed something

Number of energy values in file, /home/runner/micromamba/envs/test/lib/python3.13/site-packages/alchemtest/lammps/benzene/2_NPT_vdw/mbar_lj-cut-soft-lambda_0.65_0.7_charge--0.0_0.txt.bz2, N=3669, inconsistent with previous files of length, 3668. Adding NaN to row: [1394]

All our tests should pass the same on differen operating systems, so this is a bug of some kind.

It also seems to have come up recently so perhaps it's connected to a change in numpy or pandas.

Partial pytest output from run
_________________________________ test_u_nk ___________________________________
[gw3] linux -- Python 3.13.13 /home/runner/micromamba/envs/test/bin/python3.13
def test_u_nk():
    """Test that u_nk has the correct form when extracted from files."""
    dataset = load_benzene()

    for leg, filenames in dataset["data"]["mbar"].items():
        u_nk = lmp.extract_u_nk(filenames, 300, **kwargs_mbar[leg])

        assert u_nk.index.names == ["time", "fep-lambda"]
        if leg == "1_coul-off":
            assert u_nk.shape == (30006, 6)
        elif leg == "2_vdw":
          assert u_nk.shape == (78681, 16)

E assert (78682, 16) == (78681, 16)
E
E At index 0 diff: 78682 != 78681
E
E Full diff:
E (
E - 78681,
E ? ^
E + 78682,
E ? ^
E 16,
E )

src/alchemlyb/tests/parsing/test_lammps.py:127: AssertionError
=============================== warnings summary ===============================
src/alchemlyb/tests/parsing/test_lammps.py::test_u_nk
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_col_lambda2
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_col_lambda2
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_error_no_file
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_error_num_cols
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_error_duplicate_files
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_default_tolerance
src/alchemlyb/tests/parsing/test_lammps.py::TestLammpsMbar::test_u_nk_custom_tolerance
/home/runner/work/alchemlyb/alchemlyb/src/alchemlyb/parsing/lammps.py:987: UserWarning: Number of energy values in file, /home/runner/micromamba/envs/test/lib/python3.13/site-packages/alchemtest/lammps/benzene/2_NPT_vdw/mbar_lj-cut-soft-lambda_0.65_0.7_charge--0.0_0.txt.bz2, N=3669, inconsistent with previous files of length, 3668. Adding NaN to row: [1394]
warnings.warn(
...

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions