From c04d685211b3e89daecaf2af0d3429b79feaedf5 Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 18:43:29 +0800 Subject: [PATCH 01/11] fix: add fparam, aparam temp index parse --- dpdata/deepmd/mixed.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dpdata/deepmd/mixed.py b/dpdata/deepmd/mixed.py index fe5bdaa8..25543382 100644 --- a/dpdata/deepmd/mixed.py +++ b/dpdata/deepmd/mixed.py @@ -27,6 +27,8 @@ def to_system_data(folder, type_map=None, labels=True): all_real_atom_types_concat = index_map[all_real_atom_types_concat] all_cells_concat = data["cells"] all_coords_concat = data["coords"] + all_fparam_concat = data.get("fparam", None) + all_aparam_concat = data.get("aparam", None) if labels: all_eners_concat = data.get("energies") all_forces_concat = data.get("forces") @@ -56,6 +58,12 @@ def to_system_data(folder, type_map=None, labels=True): all_cells_concat = all_cells_concat[rest_idx] temp_data["coords"] = all_coords_concat[temp_idx] all_coords_concat = all_coords_concat[rest_idx] + if all_fparam_concat: + temp_data["fparam"] = all_fparam_concat[temp_idx] + all_fparam_concat = all_fparam_concat[rest_idx] + if all_aparam_concat: + temp_data["aparam"] = all_aparam_concat[temp_idx] + all_aparam_concat = all_aparam_concat[rest_idx] if labels: if all_eners_concat is not None and all_eners_concat.size > 0: temp_data["energies"] = all_eners_concat[temp_idx] From 2bad443cf6f0fcb5fe0f2f2cce58e92a617585c2 Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:23:33 +0800 Subject: [PATCH 02/11] feat: try add UT --- tests/test_deepmd_mixed.py | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 9f0c5ed4..3d9e7dbe 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -455,5 +455,47 @@ def tearDown(self): shutil.rmtree("tmp.deepmd.mixed.single") +class TestMixedSystemWithFparamAparam(unittest.TestCase, CompLabeledSys, IsNoPBC): + def setUp(self): + self.places = 6 + self.e_places = 6 + self.f_places = 6 + self.v_places = 6 + + system_1 = dpdata.LabeledSystem( + "gaussian/methane.gaussianlog", fmt="gaussian/log" + ) + + tmp_data = system_1.data.copy() + nframes = tmp_data["coords"].shape[0] + natoms = tmp_data["atom_types"].shape[0] + + tmp_data["fparam"] = np.random.random([nframes, 2]) + tmp_data["aparam"] = np.random.random([nframes, natoms, 3]) + + self.system_1 = dpdata.LabeledSystem(data=tmp_data) + + self.system_1.to("deepmd/npy/mixed", "tmp.deepmd.fparam.aparam") + self.system_2 = dpdata.LabeledSystem("tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed") + + def tearDown(self): + if os.path.exists("tmp.deepmd.fparam.aparam"): + shutil.rmtree("tmp.deepmd.fparam.aparam") + + def test_fparam_exists(self): + self.assertTrue("fparam" in self.system_1.data) + self.assertTrue("fparam" in self.system_2.data) + np.testing.assert_almost_equal( + self.system_1.data["fparam"], self.system_2.data["fparam"], decimal=self.places + ) + + def test_aparam_exists(self): + self.assertTrue("aparam" in self.system_1.data) + self.assertTrue("aparam" in self.system_2.data) + np.testing.assert_almost_equal( + self.system_1.data["aparam"], self.system_2.data["aparam"], decimal=self.places + ) + + if __name__ == "__main__": unittest.main() From 56230e975615b9b9f13fdde80d0f85fcc2ed1c11 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 12:23:47 +0000 Subject: [PATCH 03/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_deepmd_mixed.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 3d9e7dbe..cf17a2fb 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -465,18 +465,20 @@ def setUp(self): system_1 = dpdata.LabeledSystem( "gaussian/methane.gaussianlog", fmt="gaussian/log" ) - + tmp_data = system_1.data.copy() nframes = tmp_data["coords"].shape[0] natoms = tmp_data["atom_types"].shape[0] - + tmp_data["fparam"] = np.random.random([nframes, 2]) tmp_data["aparam"] = np.random.random([nframes, natoms, 3]) self.system_1 = dpdata.LabeledSystem(data=tmp_data) - + self.system_1.to("deepmd/npy/mixed", "tmp.deepmd.fparam.aparam") - self.system_2 = dpdata.LabeledSystem("tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed") + self.system_2 = dpdata.LabeledSystem( + "tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed" + ) def tearDown(self): if os.path.exists("tmp.deepmd.fparam.aparam"): @@ -486,14 +488,18 @@ def test_fparam_exists(self): self.assertTrue("fparam" in self.system_1.data) self.assertTrue("fparam" in self.system_2.data) np.testing.assert_almost_equal( - self.system_1.data["fparam"], self.system_2.data["fparam"], decimal=self.places + self.system_1.data["fparam"], + self.system_2.data["fparam"], + decimal=self.places, ) def test_aparam_exists(self): self.assertTrue("aparam" in self.system_1.data) self.assertTrue("aparam" in self.system_2.data) np.testing.assert_almost_equal( - self.system_1.data["aparam"], self.system_2.data["aparam"], decimal=self.places + self.system_1.data["aparam"], + self.system_2.data["aparam"], + decimal=self.places, ) From d379d2bc34f3b00d476cbe7f6b367f7e0f3e9e9f Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:24:38 +0800 Subject: [PATCH 04/11] chore: refactor --- dpdata/deepmd/mixed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/deepmd/mixed.py b/dpdata/deepmd/mixed.py index 25543382..9b22dde9 100644 --- a/dpdata/deepmd/mixed.py +++ b/dpdata/deepmd/mixed.py @@ -58,10 +58,10 @@ def to_system_data(folder, type_map=None, labels=True): all_cells_concat = all_cells_concat[rest_idx] temp_data["coords"] = all_coords_concat[temp_idx] all_coords_concat = all_coords_concat[rest_idx] - if all_fparam_concat: + if all_fparam_concat is not None: temp_data["fparam"] = all_fparam_concat[temp_idx] all_fparam_concat = all_fparam_concat[rest_idx] - if all_aparam_concat: + if all_aparam_concat is not None: temp_data["aparam"] = all_aparam_concat[temp_idx] all_aparam_concat = all_aparam_concat[rest_idx] if labels: From 9c688c26009dd4dd4fa9679e48ab3e792694e696 Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:38:45 +0800 Subject: [PATCH 05/11] fix: update UT --- tests/test_deepmd_mixed.py | 132 ++++++++++++++++++++++++++++--------- 1 file changed, 102 insertions(+), 30 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index cf17a2fb..14ca8bc8 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -455,53 +455,125 @@ def tearDown(self): shutil.rmtree("tmp.deepmd.mixed.single") -class TestMixedSystemWithFparamAparam(unittest.TestCase, CompLabeledSys, IsNoPBC): +class TestMixedSystemWithFparamAparam( + unittest.TestCase, CompLabeledMultiSys, MultiSystems, MSAllIsNoPBC +): def setUp(self): self.places = 6 self.e_places = 6 self.f_places = 6 self.v_places = 6 + # C1H4 system_1 = dpdata.LabeledSystem( "gaussian/methane.gaussianlog", fmt="gaussian/log" ) - tmp_data = system_1.data.copy() - nframes = tmp_data["coords"].shape[0] - natoms = tmp_data["atom_types"].shape[0] - - tmp_data["fparam"] = np.random.random([nframes, 2]) - tmp_data["aparam"] = np.random.random([nframes, natoms, 3]) - - self.system_1 = dpdata.LabeledSystem(data=tmp_data) + # C1H3 + system_2 = dpdata.LabeledSystem( + "gaussian/methane_sub.gaussianlog", fmt="gaussian/log" + ) - self.system_1.to("deepmd/npy/mixed", "tmp.deepmd.fparam.aparam") - self.system_2 = dpdata.LabeledSystem( - "tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed" + tmp_data_1 = system_1.data.copy() + nframes_1 = tmp_data_1["coords"].shape[0] + natoms_1 = tmp_data_1["atom_types"].shape[0] + tmp_data_1["fparam"] = np.random.random([nframes_1, 2]) + tmp_data_1["aparam"] = np.random.random([nframes_1, natoms_1, 3]) + system_1_with_params = dpdata.LabeledSystem(data=tmp_data_1) + + tmp_data_2 = system_2.data.copy() + nframes_2 = tmp_data_2["coords"].shape[0] + natoms_2 = tmp_data_2["atom_types"].shape[0] + tmp_data_2["fparam"] = np.random.random([nframes_2, 2]) + tmp_data_2["aparam"] = np.random.random([nframes_2, natoms_2, 3]) + system_2_with_params = dpdata.LabeledSystem(data=tmp_data_2) + + tmp_data_3 = system_1.data.copy() + nframes_3 = tmp_data_3["coords"].shape[0] + tmp_data_3["atom_numbs"] = [1, 1, 1, 2] + tmp_data_3["atom_names"] = ["C", "H", "A", "B"] + tmp_data_3["atom_types"] = np.array([0, 1, 2, 3, 3]) + natoms_3 = len(tmp_data_3["atom_types"]) + tmp_data_3["fparam"] = np.random.random([nframes_3, 2]) + tmp_data_3["aparam"] = np.random.random([nframes_3, natoms_3, 3]) + # C1H1A1B2 with params + system_3_with_params = dpdata.LabeledSystem(data=tmp_data_3) + + self.ms = dpdata.MultiSystems( + system_1_with_params, system_2_with_params, system_3_with_params ) + + self.ms.to_deepmd_npy_mixed("tmp.deepmd.fparam.aparam") + self.place_holder_ms = dpdata.MultiSystems() + self.place_holder_ms.from_deepmd_npy("tmp.deepmd.fparam.aparam", fmt="deepmd/npy") + self.systems = dpdata.MultiSystems() + self.systems.from_deepmd_npy_mixed("tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed") + + self.ms_1 = self.ms + self.ms_2 = self.systems + + mixed_sets = glob("tmp.deepmd.fparam.aparam/*/set.*") + for i in mixed_sets: + self.assertEqual( + os.path.exists(os.path.join(i, "real_atom_types.npy")), True + ) + + self.system_names = [ + "C1H4A0B0D0", + "C1H3A0B0D0", + "C1H1A1B2D0" + ] + self.system_sizes = { + "C1H4A0B0D0": 1, + "C1H3A0B0D0": 1, + "C1H1A1B2D0": 1 + } + self.atom_names = ["C", "H", "A", "B", "D"] def tearDown(self): if os.path.exists("tmp.deepmd.fparam.aparam"): shutil.rmtree("tmp.deepmd.fparam.aparam") + + def test_len(self): + self.assertEqual(len(self.ms), 3) + self.assertEqual(len(self.systems), 3) - def test_fparam_exists(self): - self.assertTrue("fparam" in self.system_1.data) - self.assertTrue("fparam" in self.system_2.data) - np.testing.assert_almost_equal( - self.system_1.data["fparam"], - self.system_2.data["fparam"], - decimal=self.places, - ) + def test_get_nframes(self): + self.assertEqual(self.ms.get_nframes(), 3) + self.assertEqual(self.systems.get_nframes(), 3) - def test_aparam_exists(self): - self.assertTrue("aparam" in self.system_1.data) - self.assertTrue("aparam" in self.system_2.data) - np.testing.assert_almost_equal( - self.system_1.data["aparam"], - self.system_2.data["aparam"], - decimal=self.places, + def test_str(self): + self.assertEqual(str(self.ms), "MultiSystems (3 systems containing 3 frames)") + self.assertEqual( + str(self.systems), "MultiSystems (3 systems containing 3 frames)" ) + + def test_fparam_exists(self): + for formula in self.system_names: + if formula in self.ms.systems: + self.assertTrue("fparam" in self.ms[formula].data) + if formula in self.systems.systems: + self.assertTrue("fparam" in self.systems[formula].data) + + for formula in self.system_names: + if formula in self.ms.systems and formula in self.systems.systems: + np.testing.assert_almost_equal( + self.ms[formula].data["fparam"], + self.systems[formula].data["fparam"], + decimal=self.places, + ) - -if __name__ == "__main__": - unittest.main() + def test_aparam_exists(self): + for formula in self.system_names: + if formula in self.ms.systems: + self.assertTrue("aparam" in self.ms[formula].data) + if formula in self.systems.systems: + self.assertTrue("aparam" in self.systems[formula].data) + + for formula in self.system_names: + if formula in self.ms.systems and formula in self.systems.systems: + np.testing.assert_almost_equal( + self.ms[formula].data["aparam"], + self.systems[formula].data["aparam"], + decimal=self.places, + ) From 8f49dbd4dc4bbf79268d79e6357b7504860e2ea2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 12:39:01 +0000 Subject: [PATCH 06/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_deepmd_mixed.py | 40 +++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 14ca8bc8..419f4d58 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -487,7 +487,7 @@ def setUp(self): tmp_data_2["fparam"] = np.random.random([nframes_2, 2]) tmp_data_2["aparam"] = np.random.random([nframes_2, natoms_2, 3]) system_2_with_params = dpdata.LabeledSystem(data=tmp_data_2) - + tmp_data_3 = system_1.data.copy() nframes_3 = tmp_data_3["coords"].shape[0] tmp_data_3["atom_numbs"] = [1, 1, 1, 2] @@ -498,42 +498,38 @@ def setUp(self): tmp_data_3["aparam"] = np.random.random([nframes_3, natoms_3, 3]) # C1H1A1B2 with params system_3_with_params = dpdata.LabeledSystem(data=tmp_data_3) - + self.ms = dpdata.MultiSystems( system_1_with_params, system_2_with_params, system_3_with_params ) - + self.ms.to_deepmd_npy_mixed("tmp.deepmd.fparam.aparam") self.place_holder_ms = dpdata.MultiSystems() - self.place_holder_ms.from_deepmd_npy("tmp.deepmd.fparam.aparam", fmt="deepmd/npy") + self.place_holder_ms.from_deepmd_npy( + "tmp.deepmd.fparam.aparam", fmt="deepmd/npy" + ) self.systems = dpdata.MultiSystems() - self.systems.from_deepmd_npy_mixed("tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed") - + self.systems.from_deepmd_npy_mixed( + "tmp.deepmd.fparam.aparam", fmt="deepmd/npy/mixed" + ) + self.ms_1 = self.ms self.ms_2 = self.systems - + mixed_sets = glob("tmp.deepmd.fparam.aparam/*/set.*") for i in mixed_sets: self.assertEqual( os.path.exists(os.path.join(i, "real_atom_types.npy")), True ) - - self.system_names = [ - "C1H4A0B0D0", - "C1H3A0B0D0", - "C1H1A1B2D0" - ] - self.system_sizes = { - "C1H4A0B0D0": 1, - "C1H3A0B0D0": 1, - "C1H1A1B2D0": 1 - } + + self.system_names = ["C1H4A0B0D0", "C1H3A0B0D0", "C1H1A1B2D0"] + self.system_sizes = {"C1H4A0B0D0": 1, "C1H3A0B0D0": 1, "C1H1A1B2D0": 1} self.atom_names = ["C", "H", "A", "B", "D"] def tearDown(self): if os.path.exists("tmp.deepmd.fparam.aparam"): shutil.rmtree("tmp.deepmd.fparam.aparam") - + def test_len(self): self.assertEqual(len(self.ms), 3) self.assertEqual(len(self.systems), 3) @@ -547,14 +543,14 @@ def test_str(self): self.assertEqual( str(self.systems), "MultiSystems (3 systems containing 3 frames)" ) - + def test_fparam_exists(self): for formula in self.system_names: if formula in self.ms.systems: self.assertTrue("fparam" in self.ms[formula].data) if formula in self.systems.systems: self.assertTrue("fparam" in self.systems[formula].data) - + for formula in self.system_names: if formula in self.ms.systems and formula in self.systems.systems: np.testing.assert_almost_equal( @@ -569,7 +565,7 @@ def test_aparam_exists(self): self.assertTrue("aparam" in self.ms[formula].data) if formula in self.systems.systems: self.assertTrue("aparam" in self.systems[formula].data) - + for formula in self.system_names: if formula in self.ms.systems and formula in self.systems.systems: np.testing.assert_almost_equal( From 3fb4a6ad8838a200bcce0be274da6ad64276ecd6 Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:50:27 +0800 Subject: [PATCH 07/11] fix: update UT --- tests/test_deepmd_mixed.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 419f4d58..eb40c6af 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -522,9 +522,19 @@ def setUp(self): os.path.exists(os.path.join(i, "real_atom_types.npy")), True ) - self.system_names = ["C1H4A0B0D0", "C1H3A0B0D0", "C1H1A1B2D0"] - self.system_sizes = {"C1H4A0B0D0": 1, "C1H3A0B0D0": 1, "C1H1A1B2D0": 1} - self.atom_names = ["C", "H", "A", "B", "D"] + + self.system_names = [ + "C1H4A0B0", + "C1H3A0B0", + "C1H1A1B2" + ] + self.system_sizes = { + "C1H4A0B0": 1, + "C1H3A0B0": 1, + "C1H1A1B2": 1 + } + self.atom_names = ["C", "H", "A", "B"] + def tearDown(self): if os.path.exists("tmp.deepmd.fparam.aparam"): From 833cddb1ce0ad043fb762465563b817fd86c33a8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 12:51:25 +0000 Subject: [PATCH 08/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_deepmd_mixed.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index eb40c6af..9a9a69b4 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -522,20 +522,10 @@ def setUp(self): os.path.exists(os.path.join(i, "real_atom_types.npy")), True ) - - self.system_names = [ - "C1H4A0B0", - "C1H3A0B0", - "C1H1A1B2" - ] - self.system_sizes = { - "C1H4A0B0": 1, - "C1H3A0B0": 1, - "C1H1A1B2": 1 - } + self.system_names = ["C1H4A0B0", "C1H3A0B0", "C1H1A1B2"] + self.system_sizes = {"C1H4A0B0": 1, "C1H3A0B0": 1, "C1H1A1B2": 1} self.atom_names = ["C", "H", "A", "B"] - def tearDown(self): if os.path.exists("tmp.deepmd.fparam.aparam"): shutil.rmtree("tmp.deepmd.fparam.aparam") From c1c56b02fa8d5b987eaceeb4ce5970b981a342ce Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:57:09 +0800 Subject: [PATCH 09/11] fix: UT --- tests/test_deepmd_mixed.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 9a9a69b4..132edd40 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -5,6 +5,11 @@ import unittest from glob import glob +from dpdata.data_type import ( + Axis, + DataType, +) + import numpy as np from comp_sys import ( CompLabeledMultiSys, @@ -464,6 +469,27 @@ def setUp(self): self.f_places = 6 self.v_places = 6 + new_datatypes=[ + + DataType( + "fparam", + np.ndarray, + shape=(Axis.NFRAMES, 2), + required=False, + ), + DataType( + "aparam", + np.ndarray, + shape=(Axis.NFRAMES, Axis.NATOMS, 2), + required=False, + ), + ] + + for datatype in new_datatypes: + dpdata.System.register_data_type(datatype) + dpdata.LabeledSystem.register_data_type(datatype) + + # C1H4 system_1 = dpdata.LabeledSystem( "gaussian/methane.gaussianlog", fmt="gaussian/log" From 9312cb0a18f9c077b039996c046be28b6706fef4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 12:57:58 +0000 Subject: [PATCH 10/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_deepmd_mixed.py | 42 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index 132edd40..c73b3bc8 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -5,11 +5,6 @@ import unittest from glob import glob -from dpdata.data_type import ( - Axis, - DataType, -) - import numpy as np from comp_sys import ( CompLabeledMultiSys, @@ -20,6 +15,11 @@ ) from context import dpdata +from dpdata.data_type import ( + Axis, + DataType, +) + class TestMixedMultiSystemsDumpLoad( unittest.TestCase, CompLabeledMultiSys, MultiSystems, MSAllIsNoPBC @@ -469,27 +469,25 @@ def setUp(self): self.f_places = 6 self.v_places = 6 - new_datatypes=[ - - DataType( - "fparam", - np.ndarray, - shape=(Axis.NFRAMES, 2), - required=False, - ), - DataType( - "aparam", - np.ndarray, - shape=(Axis.NFRAMES, Axis.NATOMS, 2), - required=False, - ), - ] - + new_datatypes = [ + DataType( + "fparam", + np.ndarray, + shape=(Axis.NFRAMES, 2), + required=False, + ), + DataType( + "aparam", + np.ndarray, + shape=(Axis.NFRAMES, Axis.NATOMS, 2), + required=False, + ), + ] + for datatype in new_datatypes: dpdata.System.register_data_type(datatype) dpdata.LabeledSystem.register_data_type(datatype) - # C1H4 system_1 = dpdata.LabeledSystem( "gaussian/methane.gaussianlog", fmt="gaussian/log" From 64f6df0d04b41adf9ff6d9f06e9c7b0ddb5b4d87 Mon Sep 17 00:00:00 2001 From: Anyang Peng <137014849+anyangml@users.noreply.github.com> Date: Wed, 4 Jun 2025 21:00:38 +0800 Subject: [PATCH 11/11] fix: UT --- tests/test_deepmd_mixed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_deepmd_mixed.py b/tests/test_deepmd_mixed.py index c73b3bc8..bd803687 100644 --- a/tests/test_deepmd_mixed.py +++ b/tests/test_deepmd_mixed.py @@ -479,7 +479,7 @@ def setUp(self): DataType( "aparam", np.ndarray, - shape=(Axis.NFRAMES, Axis.NATOMS, 2), + shape=(Axis.NFRAMES, Axis.NATOMS, 3), required=False, ), ]