From 87ed8f45982eb599bf21c5f36164b34d4414cd5c Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 1 Jun 2024 22:54:53 +0800 Subject: [PATCH 1/4] fix filter condition and to list --- pymatgen/io/cif.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymatgen/io/cif.py b/pymatgen/io/cif.py index c3b6083d83f..50b3d89722d 100644 --- a/pymatgen/io/cif.py +++ b/pymatgen/io/cif.py @@ -1073,7 +1073,7 @@ def get_matching_coord( if any(occu > 1 for occu in _sum_occupancies): msg = ( - f"Some occupancies ({filter(lambda x: x<=1, _sum_occupancies)}) sum to > 1! If they are within " + f"Some occupancies ({list(filter(lambda x: x>1, _sum_occupancies))}) sum to > 1! If they are within " "the occupancy_tolerance, they will be rescaled. " f"The current occupancy_tolerance is set to: {self._occupancy_tolerance}" ) From 54f7ade341d32f8a865572af8359d5edb0be50c6 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 1 Jun 2024 23:04:42 +0800 Subject: [PATCH 2/4] update unit test for err msg --- tests/io/test_cif.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/io/test_cif.py b/tests/io/test_cif.py index 87627ee9a7c..9c92fd830a7 100644 --- a/tests/io/test_cif.py +++ b/tests/io/test_cif.py @@ -748,7 +748,10 @@ def test_not_check_occu(self): cif_str = cif_file.read() cif_str = cif_str.replace("Te Te 1.0000", "Te_label Te 10.0", 1) - structs = CifParser.from_str(cif_str).parse_structures(check_occu=False) + with pytest.warns( + UserWarning, match=r"Issues encountered while parsing CIF: Some occupancies \(\[10\.0\]\) sum to > 1!" + ): + structs = CifParser.from_str(cif_str).parse_structures(check_occu=False) assert len(structs) > 0 assert set(structs[0].labels) == {"Te_label", "Ge"} From e281fdfdcb047a2cb0703be6b3235aaad760875b Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 1 Jun 2024 23:05:50 +0800 Subject: [PATCH 3/4] increase monty version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 48df3317ded..bdd83e042f2 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ python_requires=">=3.9", install_requires=[ "matplotlib>=1.5", - "monty>=2024.2.2", + "monty>=2024.5.24", "networkx>=2.2", "numpy>=1.25.0", "palettable>=3.1.1", From 2c6da9a72b50059a6a96bfe2408ae16c6be23d12 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Mon, 3 Jun 2024 21:26:54 +0800 Subject: [PATCH 4/4] Revert "increase monty version" This reverts commit e281fdfdcb047a2cb0703be6b3235aaad760875b. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bdd83e042f2..48df3317ded 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ python_requires=">=3.9", install_requires=[ "matplotlib>=1.5", - "monty>=2024.5.24", + "monty>=2024.2.2", "networkx>=2.2", "numpy>=1.25.0", "palettable>=3.1.1",