From 107990b134c08fb7c85af567a2313fe3bfcda182 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 19 Jul 2022 23:41:07 -0400 Subject: [PATCH 1/2] fix UT test_make_md --- dpgen/generator/run.py | 2 +- tests/generator/test_make_md.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 00f5e00af..b51ff1428 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -818,7 +818,7 @@ def make_model_devi (iter_index, cur_systems = [] ss = sys_configs[idx] for ii in ss : - cur_systems += glob.glob(ii) + cur_systems += sorted(glob.glob(ii)) # cur_systems should not be sorted, as we may add specific constrict to the similutions #cur_systems.sort() cur_systems = [os.path.abspath(ii) for ii in cur_systems] diff --git a/tests/generator/test_make_md.py b/tests/generator/test_make_md.py index 05f52665c..7d4851fec 100644 --- a/tests/generator/test_make_md.py +++ b/tests/generator/test_make_md.py @@ -53,14 +53,14 @@ def _check_confs(testCase, idx, jdata) : for ii in sys_idx : sys_poscars = [] for ss in sys_configs[ii]: - tmp_poscars = glob.glob(ss) + tmp_poscars = sorted(glob.glob(ss)) sys_poscars += tmp_poscars - sys_poscars.sort() poscars.append(sys_poscars) for ii in tasks : conf_file = os.path.join(ii, 'conf.lmp') l_conf_file = os.path.basename(os.readlink(conf_file)) poscar_file = poscars[int(l_conf_file.split('.')[0])][int(l_conf_file.split('.')[1])] + print(poscar_file, conf_file, poscars) sys_0 = dpdata.System(conf_file, type_map = jdata['type_map']) sys_1 = dpdata.System(poscar_file, type_map = jdata['type_map']) test_atom_names(testCase, sys_0, sys_1) From 121a292b5b5a89c7151f863f8d926dfdc1c45d34 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 19 Jul 2022 23:42:04 -0400 Subject: [PATCH 2/2] remove debug line --- tests/generator/test_make_md.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/generator/test_make_md.py b/tests/generator/test_make_md.py index 7d4851fec..1f756f29b 100644 --- a/tests/generator/test_make_md.py +++ b/tests/generator/test_make_md.py @@ -60,7 +60,6 @@ def _check_confs(testCase, idx, jdata) : conf_file = os.path.join(ii, 'conf.lmp') l_conf_file = os.path.basename(os.readlink(conf_file)) poscar_file = poscars[int(l_conf_file.split('.')[0])][int(l_conf_file.split('.')[1])] - print(poscar_file, conf_file, poscars) sys_0 = dpdata.System(conf_file, type_map = jdata['type_map']) sys_1 = dpdata.System(poscar_file, type_map = jdata['type_map']) test_atom_names(testCase, sys_0, sys_1)