From e3b82328a6e8548c6d4204c07c228b24c6ec5f96 Mon Sep 17 00:00:00 2001 From: pxlxingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Thu, 23 Mar 2023 09:05:01 +0800 Subject: [PATCH 01/86] fix(abacus): fix deepks bug in autotest (#1163) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/autotest/Auto-test.md | 5 +- dpgen/auto_test/ABACUS.py | 94 +++++++++++++++++------- tests/auto_test/abacus_input/INPUT.dpks | 27 +++++++ tests/auto_test/abacus_input/jle.orb | 0 tests/auto_test/abacus_input/model.ptg | 0 tests/auto_test/confs/fcc-Al-deepks/STRU | 26 +++++++ tests/auto_test/test_abacus.py | 87 +++++++++++++++++++++- tests/auto_test/test_abacus_equi.py | 10 +-- tests/auto_test/test_abacus_property.py | 2 + 9 files changed, 212 insertions(+), 39 deletions(-) create mode 100644 tests/auto_test/abacus_input/INPUT.dpks create mode 100644 tests/auto_test/abacus_input/jle.orb create mode 100644 tests/auto_test/abacus_input/model.ptg create mode 100644 tests/auto_test/confs/fcc-Al-deepks/STRU diff --git a/doc/autotest/Auto-test.md b/doc/autotest/Auto-test.md index 7ecd36286..5d1042ddf 100644 --- a/doc/autotest/Auto-test.md +++ b/doc/autotest/Auto-test.md @@ -43,7 +43,7 @@ The default of `potcar_prefix` is "". ``` **ABACUS**: -The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc is `potcar_prefix` + `potcars`/`orb_files`/`deepks_desc`. +The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc is `potcar_prefix` + `potcars`/`orb_files`/`deepks_desc`/`deepks_model`. ```json "interaction": { "type": "abacus", @@ -52,7 +52,8 @@ The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc "potcars": {"Al": "pseudo_potential.al", "Mg": "pseudo_potential.mg"}, "orb_files": {"Al": "numerical_orb.al", "Mg": "numerical_orb.mg"}, "atom_masses": {"Al": 26.9815, "Mg":24.305}, - "deepks_desc": "jle.orb" + "deepks_desc": "jle.orb", + "deepks_model": "model.ptg" } ``` **deepmd**: diff --git a/dpgen/auto_test/ABACUS.py b/dpgen/auto_test/ABACUS.py index ed246b19f..e5a803d9e 100644 --- a/dpgen/auto_test/ABACUS.py +++ b/dpgen/auto_test/ABACUS.py @@ -20,6 +20,7 @@ def __init__(self, inter_parameter, path_to_poscar): self.potcars = inter_parameter.get("potcars", None) self.orbfile = inter_parameter.get("orb_files", None) self.deepks = inter_parameter.get("deepks_desc", None) + self.deepks_model = inter_parameter.get("deepks_model", None) self.path_to_poscar = path_to_poscar self.if_define_orb_file = False if self.orbfile == None else True @@ -48,35 +49,69 @@ def make_potential_files(self, output_dir): os.chdir(output_dir) if not os.path.isdir("./pp_orb"): os.mkdir("./pp_orb") - for i in range(len(atom_names)): - pp_orb_file = [[pp_files[i], self.potcars]] - if orb_files != None: - pp_orb_file.append([orb_files[i], self.orbfile]) - elif self.orbfile != None: - assert atom_names[i] in self.orbfile, ( - "orb_file of %s is not defined" % atom_names[i] + + pp_orb_file = [] + for iatom, atomname in enumerate(atom_names): + # pseudopotential file + if not self.potcars: + raise RuntimeError( + "please specify the pseudopotential file for each atom type in 'potcars'" ) - pp_orb_file.append([self.orbfile[atom_names[i]], self.orbfile]) - - if dpks_descriptor != None: - pp_orb_file.append([dpks_descriptor[i], self.deepks]) - elif self.deepks != None: - pp_orb_file.append([self.deepks, self.deepks]) - - for tmpf, tmpdict in pp_orb_file: - atom = atom_names[i] - if os.path.isfile(os.path.join(stru_path, tmpf)): - linked_file = os.path.join(stru_path, tmpf) - elif tmpdict != None and os.path.isfile( - os.path.join(pp_dir, tmpdict[atom]) - ): - linked_file = os.path.join(pp_dir, tmpdict[atom]) - else: - raise RuntimeError("Can not find file %s" % tmpf.split("/")[-1]) - target_file = os.path.join("./pp_orb/", tmpf.split("/")[-1]) - if os.path.isfile(target_file): - os.remove(target_file) - os.symlink(linked_file, target_file) + if atomname not in self.potcars: + raise RuntimeError( + "please specify the pseudopotential file of '%s'" % atomname + ) + pp_orb_file.append([pp_files[iatom], self.potcars[atomname]]) + + # orbital file + if orb_files: + if not self.orbfile: + raise RuntimeError( + "Orbital file is defined in STRU, so please specify the orbital file for each atom type in parameter setting file by 'orb_files'" + ) + if atomname not in self.orbfile: + raise RuntimeError( + "please specify the orbital file of '%s'" % atomname + ) + pp_orb_file.append([orb_files[iatom], self.orbfile[atomname]]) + elif self.orbfile: + dlog.warning( + "Orbital is not needed by STRU, so ignore the setting of 'orb_files' in parameter setting file" + ) + + # dpks_descriptor + if dpks_descriptor: + if not self.deepks: + raise RuntimeError( + "Deepks descriptor file is defined in STRU, so please specify in parameter setting file by 'deepks_desc'" + ) + pp_orb_file.append([dpks_descriptor, self.deepks]) + elif self.deepks: + dlog.warning( + "Deepks descriptor is not needed by STRU, so ignore the setting of 'deepks_desc' in parameter setting file" + ) + + # dpks model + if self.deepks_model: + pp_orb_file.append([self.deepks_model, self.deepks_model]) + + # link the files + for file_stru, file_param in pp_orb_file: + filename_in_stru = os.path.split(file_stru)[1] + filename_in_para = os.path.split(file_param)[1] + if filename_in_stru != filename_in_para: + dlog.warning( + "file name in STRU is not match that defined in parameter setting file: '%s', '%s'." + % (filename_in_stru, filename_in_para) + ) + + src_file = os.path.join(pp_dir, file_param) + if not os.path.isfile(src_file): + raise RuntimeError("Can not find file %s" % src_file) + tar_file = os.path.join("pp_orb", filename_in_stru) + if os.path.isfile(tar_file): + os.remove(tar_file) + os.symlink(src_file, tar_file) os.chdir(cwd) @@ -167,6 +202,9 @@ def make_input_file(self, output_dir, task_type, task_param): % incar["basis_type"] ) raise RuntimeError(mess) + if "deepks_model" in incar: + model_file = os.path.split(incar["deepks_model"])[1] + self.modify_input(incar, "deepks_model", os.path.join("pp_orb", model_file)) abacus.write_input(os.path.join(output_dir, "../INPUT"), incar) cwd = os.getcwd() os.chdir(output_dir) diff --git a/tests/auto_test/abacus_input/INPUT.dpks b/tests/auto_test/abacus_input/INPUT.dpks new file mode 100644 index 000000000..aabc29bbd --- /dev/null +++ b/tests/auto_test/abacus_input/INPUT.dpks @@ -0,0 +1,27 @@ +INPUT_PARAMETERS +#Parameters (1.General) +suffix ABACUS +calculation relax +symmetry 1 +pseudo_type upf201 + +#Parameters (2.Iteration) +ecutwfc 60 +scf_thr 1e-7 +scf_nmax 100 +#Parameters (3.Basis) +basis_type pw + +#Parameters (4.Smearing) +smearing_method gauss +smearing_sigma 0.002 + +#Parameters (5.Mixing) +mixing_type pulay +mixing_beta 0.3 +ks_solver cg + +cal_stress 1 +kspacing 0.2 + +deepks_model model.ptg diff --git a/tests/auto_test/abacus_input/jle.orb b/tests/auto_test/abacus_input/jle.orb new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auto_test/abacus_input/model.ptg b/tests/auto_test/abacus_input/model.ptg new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auto_test/confs/fcc-Al-deepks/STRU b/tests/auto_test/confs/fcc-Al-deepks/STRU new file mode 100644 index 000000000..6642a0474 --- /dev/null +++ b/tests/auto_test/confs/fcc-Al-deepks/STRU @@ -0,0 +1,26 @@ +ATOMIC_SPECIES +Al 26.9815 ./pp_orb/Al_ONCV_PBE-1.0.upf + +NUMERICAL_ORBITAL +pp_orb/Al_gga_9au_100Ry_4s4p1d.orb + +LATTICE_CONSTANT +1.8897261254578281 + +LATTICE_VECTORS +4.05 0.0 0.0 +0.0 4.05 0.0 +0.0 0.0 4.05 + +ATOMIC_POSITIONS +Cartesian # Cartesian(Unit is LATTICE_CONSTANT) +Al +0.0 +4 +0.000000000000 0.000000000000 0.000000000000 1 1 1 +0.000000000000 2.025000000000 2.025000000000 1 1 1 +2.025000000000 0.000000000000 2.025000000000 1 1 1 +2.025000000000 2.025000000000 0.000000000000 1 1 1 + +NUMERICAL_DESCRIPTOR +pp_orb/jle.orb diff --git a/tests/auto_test/test_abacus.py b/tests/auto_test/test_abacus.py index 0bf09dced..14492234b 100644 --- a/tests/auto_test/test_abacus.py +++ b/tests/auto_test/test_abacus.py @@ -62,7 +62,7 @@ def test_make_potential_files(self): self.assertTrue( os.path.isfile(os.path.join(self.equi_path, "pp_orb/Al_ONCV_PBE-1.0.upf")) ) - self.assertTrue( + self.assertFalse( os.path.isfile( os.path.join(self.equi_path, "pp_orb/Al_gga_9au_100Ry_4s4p1d.orb") ) @@ -232,3 +232,88 @@ def compare_dict(dict1, dict2): self.assertTrue(dict1[key] == dict2[key]) compare_dict(ret, ret_ref.as_dict()) + + +class TestABACUSDeepKS(unittest.TestCase): + def setUp(self): + self.jdata = { + "structures": ["confs/fcc-Al-deepks"], + "interaction": { + "type": "abacus", + "incar": "abacus_input/INPUT.dpks", + "potcar_prefix": "abacus_input", + "potcars": {"Al": "Al_ONCV_PBE-1.0.upf"}, + "orb_files": {"Al": "Al_gga_9au_100Ry_4s4p1d.orb"}, + "deepks_desc": "jle.orb", + "deepks_model": "model.ptg", + }, + "relaxation": { + "cal_type": "relaxation", + "cal_setting": { + "relax_pos": True, + "relax_shape": True, + "relax_vol": True, + }, + }, + } + + self.conf_path = "confs/fcc-Al-deepks" + self.equi_path = "confs/fcc-Al-deepks/relaxation/relax_task" + self.source_path = "equi/abacus" + if not os.path.exists(self.equi_path): + os.makedirs(self.equi_path) + + self.confs = self.jdata["structures"] + inter_param = self.jdata["interaction"] + self.task_param = self.jdata["relaxation"] + self.ABACUS = ABACUS(inter_param, os.path.join(self.conf_path, "STRU")) + + def tearDown(self): + if os.path.exists("confs/fcc-Al-deepks/relaxation"): + shutil.rmtree("confs/fcc-Al-deepks/relaxation") + + def test_make_potential_files(self): + if not os.path.exists(os.path.join(self.equi_path, "STRU")): + with self.assertRaises(FileNotFoundError): + self.ABACUS.make_potential_files(self.equi_path) + shutil.copy( + os.path.join(self.conf_path, "STRU"), os.path.join(self.equi_path, "STRU") + ) + self.ABACUS.make_potential_files(self.equi_path) + self.assertTrue( + os.path.isfile(os.path.join(self.equi_path, "pp_orb/Al_ONCV_PBE-1.0.upf")) + ) + self.assertTrue( + os.path.isfile( + os.path.join(self.equi_path, "pp_orb/Al_gga_9au_100Ry_4s4p1d.orb") + ) + ) + self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "pp_orb/jle.orb"))) + self.assertTrue( + os.path.isfile(os.path.join(self.equi_path, "pp_orb/model.ptg")) + ) + self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "inter.json"))) + + def test_make_input_file_1(self): + param = self.task_param.copy() + param["cal_setting"] = { + "relax_pos": True, + "relax_shape": True, + "relax_vol": False, + } + shutil.copy( + os.path.join(self.conf_path, "STRU"), os.path.join(self.equi_path, "STRU") + ) + self.ABACUS.make_input_file(self.equi_path, "relaxation", param) + self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "task.json"))) + self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "KPT"))) + self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "INPUT"))) + abacus_input = abacus_scf.get_abacus_input_parameters( + os.path.join(self.equi_path, "INPUT") + ) + self.assertEqual(abacus_input["calculation"].lower(), "cell-relax") + self.assertEqual(abacus_input["fixed_axes"].lower(), "volume") + self.assertEqual(abacus_input["deepks_model"].lower(), "pp_orb/model.ptg") + self.assertTrue( + abacus.check_stru_fixed(os.path.join(self.equi_path, "STRU"), fixed=False) + ) diff --git a/tests/auto_test/test_abacus_equi.py b/tests/auto_test/test_abacus_equi.py index 372e5eb0e..d5583567d 100644 --- a/tests/auto_test/test_abacus_equi.py +++ b/tests/auto_test/test_abacus_equi.py @@ -34,6 +34,8 @@ class TestEqui(unittest.TestCase): def tearDown(self): if os.path.exists("confs/fcc-Al/relaxation"): shutil.rmtree("confs/fcc-Al/relaxation") + if os.path.exists("confs/fcc-Al/STRU.bk"): + os.remove("confs/fcc-Al/STRU.bk") def test_make_equi(self): confs = self.jdata["structures"] @@ -57,14 +59,6 @@ def test_make_equi(self): pot1 = fp.read() self.assertEqual(pot0, pot1) - with open(os.path.join("abacus_input", "Al_gga_9au_100Ry_4s4p1d.orb")) as fp: - pot0 = fp.read() - with open( - os.path.join(target_path, "pp_orb", "Al_gga_9au_100Ry_4s4p1d.orb") - ) as fp: - pot1 = fp.read() - self.assertEqual(pot0, pot1) - self.assertTrue(os.path.isfile(os.path.join(target_path, "KPT"))) task_json_file = os.path.join(target_path, "task.json") diff --git a/tests/auto_test/test_abacus_property.py b/tests/auto_test/test_abacus_property.py index 41e25382c..9723f0e43 100644 --- a/tests/auto_test/test_abacus_property.py +++ b/tests/auto_test/test_abacus_property.py @@ -79,6 +79,8 @@ def tearDown(self): shutil.rmtree("confs/fcc-Al/interstitial_00") if os.path.exists("confs/fcc-Al/surface_00"): shutil.rmtree("confs/fcc-Al/surface_00") + if os.path.exists("confs/fcc-Al/gamma_00"): + shutil.rmtree("confs/fcc-Al/gamma_00") def test_make_property(self): property = {"type": "eos", "vol_start": 0.85, "vol_end": 1.15, "vol_step": 0.01} From 43f0ca9242011ef2adb03751587ef53043b13ae1 Mon Sep 17 00:00:00 2001 From: pxlxingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Sat, 25 Mar 2023 16:54:33 +0800 Subject: [PATCH 02/86] fix(abacus): get ION step by searching "ION=" in relax job (#1169) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/auto_test/lib/abacus.py | 13 +++++++--- tests/auto_test/equi/abacus/INPUT.outstru | 21 ++++++++++++++++ tests/auto_test/equi/abacus/STRU_ION47_D | 21 ++++++++++++++++ tests/auto_test/test_abacus_property.py | 29 +++++++++++++++++++++++ 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 tests/auto_test/equi/abacus/INPUT.outstru create mode 100644 tests/auto_test/equi/abacus/STRU_ION47_D diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index b72eec33a..f66278721 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -415,10 +415,17 @@ def final_stru(abacus_path): with open(logf) as f1: lines = f1.readlines() for i in range(1, len(lines)): - if lines[-i][36:41] == "istep": - max_step = int(lines[-i].split()[-1]) + max_step = "" + if "ALGORITHM --------------- ION=" in lines[-i]: + index_ben = lines[-i].index("ION=") + 4 + index_end = lines[-i].index("ELEC") + max_step = int(lines[-i][index_ben:index_end]) + if max_step < 2: + max_step = "" + else: + max_step -= 2 break - return "OUT.%s/STRU_ION%d_D" % (suffix, max_step) + return "OUT.%s/STRU_ION%s_D" % (suffix, str(max_step)) elif calculation == "md": with open(logf) as f1: lines = f1.readlines() diff --git a/tests/auto_test/equi/abacus/INPUT.outstru b/tests/auto_test/equi/abacus/INPUT.outstru new file mode 100644 index 000000000..b081476f3 --- /dev/null +++ b/tests/auto_test/equi/abacus/INPUT.outstru @@ -0,0 +1,21 @@ +INPUT_PARAMETERS +#Parameters (5.Mixing) +suffix ABACUS +calculation cell-relax +symmetry 1 +pseudo_type upf201 +ecutwfc 60 +scf_thr 1e-7 +scf_nmax 100 +basis_type pw +smearing_method gauss +smearing_sigma 0.002 +mixing_type pulay +mixing_beta 0.3 +ks_solver cg +cal_stress 1 +kspacing 0.2 +relax_nmax 100 +force_thr_ev 0.01 +stress_thr 0.1 +out_stru 1 diff --git a/tests/auto_test/equi/abacus/STRU_ION47_D b/tests/auto_test/equi/abacus/STRU_ION47_D new file mode 100644 index 000000000..b1e198899 --- /dev/null +++ b/tests/auto_test/equi/abacus/STRU_ION47_D @@ -0,0 +1,21 @@ +ATOMIC_SPECIES +Al 26.9815 ./pp_orb/Al_ONCV_PBE-1.0.upf + +LATTICE_CONSTANT +1.88972612546 + +LATTICE_VECTORS +4.01993427025 7.2584598854e-31 7.13301566977e-30 #latvec1 +7.2584598854e-31 4.01993427025 1.22599728095e-29 #latvec2 +7.13301566977e-30 1.22599728095e-29 4.01993427025 #latvec3 + +ATOMIC_POSITIONS +Direct + +Al #label +0 #magnetism +4 #number of atoms +0 0 0 m 1 1 1 +0 0.5 0.5 m 1 1 1 +0.5 0 0.5 m 1 1 1 +0.5 0.5 0 m 1 1 1 diff --git a/tests/auto_test/test_abacus_property.py b/tests/auto_test/test_abacus_property.py index 9723f0e43..2e366278f 100644 --- a/tests/auto_test/test_abacus_property.py +++ b/tests/auto_test/test_abacus_property.py @@ -102,6 +102,35 @@ def test_make_property(self): ), ) + def test_make_property_outstru(self): + os.remove(os.path.join(self.equi_path, "INPUT")) + shutil.copy( + os.path.join(self.source_path, "INPUT.outstru"), + os.path.join(self.equi_path, "INPUT"), + ) + shutil.copy( + os.path.join(self.source_path, "STRU_ION47_D"), + os.path.join(self.equi_path, "OUT.ABACUS/STRU_ION47_D"), + ) + property = {"type": "eos", "vol_start": 0.85, "vol_end": 1.15, "vol_step": 0.01} + make_property(self.jdata["structures"], self.jdata["interaction"], [property]) + self.assertTrue(os.path.exists(os.path.join(self.conf_path, "eos_00"))) + self.assertTrue(os.path.exists(os.path.join(self.conf_path, "eos_00", "INPUT"))) + for ii in glob.glob(os.path.join(self.conf_path, "eos_00", "task.*")): + self.assertTrue(os.path.exists(os.path.join(ii, "INPUT"))) + self.assertTrue(os.path.exists(os.path.join(ii, "pp_orb"))) + self.assertTrue(os.path.exists(os.path.join(ii, "KPT"))) + self.assertTrue(os.path.exists(os.path.join(ii, "STRU"))) + self.assertEqual( + os.path.realpath(os.path.join(ii, "pp_orb", "Al_ONCV_PBE-1.0.upf")), + os.path.realpath( + os.path.join( + self.jdata["interaction"]["potcar_prefix"], + "Al_ONCV_PBE-1.0.upf", + ) + ), + ) + def test_make_property_eos(self): property = {"type": "eos", "vol_start": 0.85, "vol_end": 1.15, "vol_step": 0.01} work_path = os.path.join(self.conf_path, "eos_00") From 9ea063c882563a677877060907a3c1cbf9f1a055 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 25 Mar 2023 05:03:03 -0400 Subject: [PATCH 03/86] fix a bug in `convert_training_data_to_hdf5` (#1167) In this method, `p2` has been started with `/` so no `/` should be added again. --- dpgen/util.py | 4 ++-- tests/generator/test_make_train.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dpgen/util.py b/dpgen/util.py index b4ec68010..d25d0a31e 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -125,7 +125,7 @@ def convert_training_data_to_hdf5(input_files: List[str], h5_file: str): p1, p2 = pp.split("#") ff = os.path.normpath(str((dd / p1).absolute().relative_to(cwd))) pp = ff + "#" + p2 - new_pp = os.path.normpath(os.path.relpath(ff, h5_dir)) + "/" + p2 + new_pp = os.path.normpath(os.path.relpath(ff, h5_dir)) + p2 else: pp = os.path.normpath(str((dd / pp).absolute().relative_to(cwd))) new_pp = os.path.normpath(os.path.relpath(pp, h5_dir)) @@ -144,7 +144,7 @@ def convert_training_data_to_hdf5(input_files: List[str], h5_file: str): if "#" in ii: p1, p2 = ii.split("#") p1 = os.path.normpath(os.path.relpath(p1, h5_dir)) - group = f.create_group(str(p1) + "/" + p2) + group = f.create_group(str(p1) + p2) s = dpdata.LabeledSystem(ii, fmt="deepmd/hdf5") s.to("deepmd/hdf5", group) else: diff --git a/tests/generator/test_make_train.py b/tests/generator/test_make_train.py index bb368391b..e93cba251 100644 --- a/tests/generator/test_make_train.py +++ b/tests/generator/test_make_train.py @@ -491,7 +491,7 @@ def test_1_data_v1_one_h5(self): jdata0["training"]["systems"], [ "../data.hdf5#/data.init/deepmd", - "../data.hdf5#/data.init/deepmd.hdf5/", + "../data.hdf5#/data.init/deepmd.hdf5", "../data.hdf5#/data.iters/iter.000000/02.fp/data.000", ], ) From 53427889958b10918aed8972a3af27167ad8f0be Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 09:10:36 +0800 Subject: [PATCH 04/86] [pre-commit.ci] pre-commit autoupdate (#1171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.253 → v0.0.259](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.253...v0.0.259) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- dpgen/auto_test/Lammps.py | 2 -- dpgen/auto_test/common_equi.py | 1 - dpgen/auto_test/gen_confs.py | 1 - dpgen/auto_test/lib/util.py | 2 -- dpgen/data/surf.py | 2 -- dpgen/database/run.py | 3 +-- dpgen/dispatcher/Dispatcher.py | 1 - dpgen/generator/lib/calypso_check_outcar.py | 1 - dpgen/generator/lib/calypso_run_model_devi.py | 3 --- dpgen/generator/lib/lammps.py | 1 - dpgen/generator/lib/make_calypso.py | 2 -- dpgen/generator/lib/parse_calypso.py | 1 - dpgen/generator/lib/run_calypso.py | 3 --- dpgen/generator/run.py | 9 --------- dpgen/tools/auto_gen_param.py | 7 ++----- tests/auto_test/test_elastic.py | 1 - tests/auto_test/test_eos.py | 1 - tests/auto_test/test_refine.py | 1 - tests/data/test_coll_abacus.py | 1 - tests/data/test_coll_vasp.py | 1 - tests/database/test_db_vasp.py | 1 - tests/generator/test_post_fp.py | 2 -- 23 files changed, 5 insertions(+), 46 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5ce6e9c2..1c91cd6cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: - id: check-toml # Python - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.253 + rev: v0.0.259 hooks: - id: ruff args: ["--fix"] diff --git a/dpgen/auto_test/Lammps.py b/dpgen/auto_test/Lammps.py index 1a3693807..0cd46b245 100644 --- a/dpgen/auto_test/Lammps.py +++ b/dpgen/auto_test/Lammps.py @@ -31,7 +31,6 @@ def __init__(self, inter_parameter, path_to_poscar): self.set_inter_type_func() def set_inter_type_func(self): - if self.inter_type == "deepmd": self.inter_func = inter_deepmd @@ -45,7 +44,6 @@ def set_inter_type_func(self): self.inter_func = inter_eam_alloy def set_model_param(self): - if self.inter_type == "deepmd": model_name = os.path.basename(self.model) deepmd_version = self.inter.get("deepmd_version", "1.2.0") diff --git a/dpgen/auto_test/common_equi.py b/dpgen/auto_test/common_equi.py index 2c0bfbf8e..61f3eb115 100644 --- a/dpgen/auto_test/common_equi.py +++ b/dpgen/auto_test/common_equi.py @@ -183,7 +183,6 @@ def run_equi(confs, inter_param, mdata): "API version %s has been removed. Please upgrade to 1.0." % api_version ) elif Version(api_version) >= Version("1.0"): - submission = make_submission( mdata_machine=machine, mdata_resources=resources, diff --git a/dpgen/auto_test/gen_confs.py b/dpgen/auto_test/gen_confs.py index 29cc02ba8..9a17173e6 100755 --- a/dpgen/auto_test/gen_confs.py +++ b/dpgen/auto_test/gen_confs.py @@ -93,7 +93,6 @@ def gen_element_std(ele_name): def gen_alloy(eles, key): - mpr = MPRester(key) data = mpr.query( diff --git a/dpgen/auto_test/lib/util.py b/dpgen/auto_test/lib/util.py index 62d5285a0..76005bdbc 100644 --- a/dpgen/auto_test/lib/util.py +++ b/dpgen/auto_test/lib/util.py @@ -37,7 +37,6 @@ def insert_data(task, task_type, username, file_name): def make_work_path(jdata, task, reprod_opt, static, user): - task_type = jdata["task_type"] conf_dir = jdata["conf_dir"] conf_path = os.path.abspath(conf_dir) @@ -94,7 +93,6 @@ def get_machine_info(mdata, task_type): def collect_task(all_task, task_type): - if task_type == "vasp": output_file = "OUTCAR" check_finished = vasp.check_finished diff --git a/dpgen/data/surf.py b/dpgen/data/surf.py index da1042bba..88ef0fc83 100644 --- a/dpgen/data/surf.py +++ b/dpgen/data/surf.py @@ -228,7 +228,6 @@ def poscar_elong(poscar_in, poscar_out, elong, shift_center=True): def make_unit_cell(jdata): - from_poscar = jdata.get("from_poscar", False) if not from_poscar: latt = jdata["latt"] @@ -249,7 +248,6 @@ def make_unit_cell(jdata): def make_super_cell_pymatgen(jdata): - make_unit_cell(jdata) out_dir = jdata["out_dir"] path_uc = os.path.join(out_dir, global_dirname_02) diff --git a/dpgen/database/run.py b/dpgen/database/run.py index 722028b10..8a2df327d 100644 --- a/dpgen/database/run.py +++ b/dpgen/database/run.py @@ -55,7 +55,6 @@ def _main(param): def parsing_vasp(path, config_info_dict, skip_init, output=OUTPUT, id_prefix=None): - fp_iters = os.path.join(path, ITERS_PAT) dlog.debug(fp_iters) f_fp_iters = glob(fp_iters) @@ -114,7 +113,7 @@ def _parsing_vasp(paths, config_info_dict, id_prefix, iters=True): iter_info = tmp_iter.split(".")[-1] sys_info = path.split("/")[-4] config_info_int = int(tmp_.split(".")[1]) - for (key, value) in config_info_dict.items(): + for key, value in config_info_dict.items(): if config_info_int in value: config_info = key attrib["config_info"] = config_info diff --git a/dpgen/dispatcher/Dispatcher.py b/dpgen/dispatcher/Dispatcher.py index c15c1f498..0d9e43f16 100644 --- a/dpgen/dispatcher/Dispatcher.py +++ b/dpgen/dispatcher/Dispatcher.py @@ -20,7 +20,6 @@ def make_submission( outlog, errlog, ): - if mdata_machine["local_root"] != "./": raise RuntimeError(f"local_root must be './' in dpgen's machine.json.") diff --git a/dpgen/generator/lib/calypso_check_outcar.py b/dpgen/generator/lib/calypso_check_outcar.py index 148e3a5af..e3982335e 100644 --- a/dpgen/generator/lib/calypso_check_outcar.py +++ b/dpgen/generator/lib/calypso_check_outcar.py @@ -90,7 +90,6 @@ def Write_Outcar(element, ele, volume, lat, pos, ene, force, stress, pstress): def check(): - from ase.io import read from deepmd.calculator import DP diff --git a/dpgen/generator/lib/calypso_run_model_devi.py b/dpgen/generator/lib/calypso_run_model_devi.py index f3ed62a36..1f656cc59 100644 --- a/dpgen/generator/lib/calypso_run_model_devi.py +++ b/dpgen/generator/lib/calypso_run_model_devi.py @@ -34,7 +34,6 @@ def write_model_devi_out(devi, fname): def Modd(all_models, type_map): - # Model Devi cwd = os.getcwd() @@ -44,7 +43,6 @@ def Modd(all_models, type_map): pcount = 0 strus_lists = glob.glob(os.path.join(cwd, "*.structures")) for num, strus_path in enumerate(strus_lists): - structures_data = dpdata.System(strus_path, "deepmd/npy", type_map=type_map) # every 500 confs in one task dir @@ -115,7 +113,6 @@ def Modd(all_models, type_map): if __name__ == "__main__": - cwd = os.getcwd() model_path = os.path.join( os.path.abspath(os.path.join(cwd, os.pardir)), "gen_stru_analy" diff --git a/dpgen/generator/lib/lammps.py b/dpgen/generator/lib/lammps.py index e03ed7def..bd32fd562 100644 --- a/dpgen/generator/lib/lammps.py +++ b/dpgen/generator/lib/lammps.py @@ -213,7 +213,6 @@ def get_all_dumped_forces(file_name): exist_atoms = False for idx, ii in enumerate(lines): - if "ITEM: NUMBER OF ATOMS" in ii: natoms = int(lines[idx + 1]) exist_natoms = True diff --git a/dpgen/generator/lib/make_calypso.py b/dpgen/generator/lib/make_calypso.py index 00c1412de..2758d76df 100644 --- a/dpgen/generator/lib/make_calypso.py +++ b/dpgen/generator/lib/make_calypso.py @@ -129,7 +129,6 @@ def make_calypso_input( def _make_model_devi_buffet(jdata, calypso_run_opt_path): - calypso_input_path = jdata.get("calypso_input_path") if jdata.get("vsc", False): # [input.dat.Li.250, input.dat.Li.300] @@ -164,7 +163,6 @@ def _make_model_devi_buffet(jdata, calypso_run_opt_path): def _make_model_devi_native_calypso(iter_index, model_devi_jobs, calypso_run_opt_path): - for iiidx, jobbs in enumerate(model_devi_jobs): if iter_index in jobbs.get("times"): cur_job = model_devi_jobs[iiidx] diff --git a/dpgen/generator/lib/parse_calypso.py b/dpgen/generator/lib/parse_calypso.py index 7bd3d7d50..81b2147c2 100644 --- a/dpgen/generator/lib/parse_calypso.py +++ b/dpgen/generator/lib/parse_calypso.py @@ -4,7 +4,6 @@ def _parse_calypso_input(var, input_path): - if os.path.basename(input_path) != "input.dat": input_path = os.path.join(input_path, "input.dat") if not os.path.exists(input_path): diff --git a/dpgen/generator/lib/run_calypso.py b/dpgen/generator/lib/run_calypso.py index 289f63266..1f78ffa97 100644 --- a/dpgen/generator/lib/run_calypso.py +++ b/dpgen/generator/lib/run_calypso.py @@ -37,7 +37,6 @@ def gen_structures( iter_index, jdata, mdata, caly_run_path, current_idx, length_of_caly_runopt_list ): - # run calypso # vsc means generate elemental, binary and ternary at the same time vsc = jdata.get("vsc", False) # take CALYPSO as confs generator @@ -343,7 +342,6 @@ def gen_structures( def gen_main(iter_index, jdata, mdata, caly_run_opt_list, gen_idx): - iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, model_devi_name) @@ -456,7 +454,6 @@ def analysis(iter_index, jdata, calypso_model_devi_path): def run_calypso_model_devi(iter_index, jdata, mdata): - dlog.info("start running CALYPSO") iter_name = make_iter_name(iter_index) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 9984d058e..ec5991fc9 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -662,7 +662,6 @@ def run_train(iter_index, jdata, mdata): if Version(mdata["deepmd_version"]) >= Version("1") and Version( mdata["deepmd_version"] ) < Version("3"): - # 1.x ## Commands are like `dp train` and `dp freeze` ## train_command should not be None @@ -1783,7 +1782,6 @@ def _make_model_devi_amber( def run_md_model_devi(iter_index, jdata, mdata): - # rmdlog.info("This module has been run !") model_devi_exec = mdata["model_devi_command"] @@ -1842,7 +1840,6 @@ def run_md_model_devi(iter_index, jdata, mdata): if use_plm_path: forward_files += ["plmpath.pdb"] elif model_devi_engine == "gromacs": - gromacs_settings = jdata.get("gromacs_settings", {}) mdp_filename = gromacs_settings.get("mdp_filename", "md.mdp") topol_filename = gromacs_settings.get("topol_filename", "processed.top") @@ -1956,7 +1953,6 @@ def run_md_model_devi(iter_index, jdata, mdata): def run_model_devi(iter_index, jdata, mdata): - model_devi_engine = jdata.get("model_devi_engine", "lammps") if model_devi_engine != "calypso": run_md_model_devi(iter_index, jdata, mdata) @@ -3851,7 +3847,6 @@ def run_fp(iter_index, jdata, mdata): def post_fp_check_fail(iter_index, jdata, rfailed=None): - ratio_failed = rfailed if rfailed else jdata.get("ratio_failed", 0.05) iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3880,7 +3875,6 @@ def post_fp_check_fail(iter_index, jdata, rfailed=None): def post_fp_vasp(iter_index, jdata, rfailed=None): - ratio_failed = rfailed if rfailed else jdata.get("ratio_failed", 0.05) model_devi_engine = jdata.get("model_devi_engine", "lammps") if model_devi_engine != "calypso": @@ -4169,7 +4163,6 @@ def post_fp_gaussian(iter_index, jdata): def post_fp_cp2k(iter_index, jdata, rfailed=None): - ratio_failed = rfailed if rfailed else jdata.get("ratio_failed", 0.10) model_devi_jobs = jdata["model_devi_jobs"] assert iter_index < len(model_devi_jobs) @@ -4230,7 +4223,6 @@ def post_fp_cp2k(iter_index, jdata, rfailed=None): def post_fp_pwmat(iter_index, jdata, rfailed=None): - ratio_failed = rfailed if rfailed else jdata.get("ratio_failed", 0.05) model_devi_jobs = jdata["model_devi_jobs"] assert iter_index < len(model_devi_jobs) @@ -4355,7 +4347,6 @@ def post_fp(iter_index, jdata): def set_version(mdata): - deepmd_version = "1" mdata["deepmd_version"] = deepmd_version return mdata diff --git a/dpgen/tools/auto_gen_param.py b/dpgen/tools/auto_gen_param.py index 9b6340b20..df5793be3 100755 --- a/dpgen/tools/auto_gen_param.py +++ b/dpgen/tools/auto_gen_param.py @@ -1,4 +1,4 @@ -#%% +# %% import argparse import json import os @@ -212,7 +212,6 @@ def get_model_devi_jobs( temps_intervel=0.1, num_temps=5, ): - if temps_iterator is None: temps_iterator = default_temps_generator( melt_point=melt_point, temps_intervel=temps_intervel, num_temps=num_temps @@ -243,7 +242,6 @@ def get_sys_configs(system_list): def get_init_data_sys(scan_dir="./", init_file_name="type.raw"): - init_data_sys = [] for t in os.walk(scan_dir): if init_file_name in t[2]: @@ -272,7 +270,6 @@ def get_basic_param_json( temps_intervel=0.1, num_temps=5, ): - init_data_sys = get_init_data_sys(scan_dir=scan_dir, init_file_name=init_file_name) print(f"length of init_data_sys: {len(init_data_sys)} {init_data_sys}") system_dict = scan_files(scan_dir, file_name, min_allow_files_num) @@ -336,4 +333,4 @@ def auto_gen_param(args): raise RuntimeError("must provide melt point or PARAM") -#%% +# %% diff --git a/tests/auto_test/test_elastic.py b/tests/auto_test/test_elastic.py index c611a4f8a..0a4b83725 100644 --- a/tests/auto_test/test_elastic.py +++ b/tests/auto_test/test_elastic.py @@ -67,7 +67,6 @@ def test_task_param(self): self.assertEqual(self.prop_param[0], self.elastic.task_param()) def test_make_confs(self): - shutil.copy( os.path.join(self.source_path, "Al-fcc.json"), os.path.join(self.equi_path, "result.json"), diff --git a/tests/auto_test/test_eos.py b/tests/auto_test/test_eos.py index 6c5f90ad1..de68fae95 100644 --- a/tests/auto_test/test_eos.py +++ b/tests/auto_test/test_eos.py @@ -74,7 +74,6 @@ def test_task_param(self): self.assertEqual(self.prop_param[0], self.eos.task_param()) def test_make_confs_0(self): - if not os.path.exists(os.path.join(self.equi_path, "CONTCAR")): with self.assertRaises(RuntimeError): self.eos.make_confs(self.target_path, self.equi_path) diff --git a/tests/auto_test/test_refine.py b/tests/auto_test/test_refine.py index b380ead2d..279d43e90 100644 --- a/tests/auto_test/test_refine.py +++ b/tests/auto_test/test_refine.py @@ -59,7 +59,6 @@ def tearDown(self): shutil.rmtree("confs/std-fcc/relaxation") def test_make_eos(self): - pwd = os.getcwd() confs = self.jdata["structures"] inter_param = self.jdata["interaction"] diff --git a/tests/data/test_coll_abacus.py b/tests/data/test_coll_abacus.py index c5f11f526..e6e1fd564 100644 --- a/tests/data/test_coll_abacus.py +++ b/tests/data/test_coll_abacus.py @@ -40,7 +40,6 @@ def tearDown(self): shutil.rmtree(self.odir) def test_coll(self): - with open(abacus_param_file, "r") as fp: jdata = json.load(fp) jdata["out_dir"] = self.odir diff --git a/tests/data/test_coll_vasp.py b/tests/data/test_coll_vasp.py index e5b282698..75afc41d1 100644 --- a/tests/data/test_coll_vasp.py +++ b/tests/data/test_coll_vasp.py @@ -49,7 +49,6 @@ def tearDown(self): shutil.rmtree(self.odir) def test_coll(self): - with open(param_file, "r") as fp: jdata = json.load(fp) jdata["out_dir"] = self.odir diff --git a/tests/database/test_db_vasp.py b/tests/database/test_db_vasp.py index 17fe7f0fd..73b8f8ad9 100644 --- a/tests/database/test_db_vasp.py +++ b/tests/database/test_db_vasp.py @@ -51,7 +51,6 @@ def setUp(self): self.output = jdata["output"] def testDPPotcar(self): - refd = { "@module": "dpgen.database.vasp", "@class": "DPPotcar", diff --git a/tests/generator/test_post_fp.py b/tests/generator/test_post_fp.py index 132819964..04cdf1132 100644 --- a/tests/generator/test_post_fp.py +++ b/tests/generator/test_post_fp.py @@ -76,7 +76,6 @@ def tearDown(self): shutil.rmtree("iter.000000") def test_post_fp_vasp_0(self): - with open(param_file, "r") as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 2 @@ -127,7 +126,6 @@ def test_post_fp_vasp_0(self): self.assertEqual(list(list(aparam)[1]), [1, 1]) def test_post_fp_vasp_1(self): - with open(param_file, "r") as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 1 From 12f9915b31a6ea059a57fa7489d4ea544e617f7f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 6 Apr 2023 08:42:46 +0800 Subject: [PATCH 05/86] [pre-commit.ci] pre-commit autoupdate (#1173) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.259 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.259...v0.0.260) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c91cd6cb..4dd4b23b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: - id: check-toml # Python - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.259 + rev: v0.0.260 hooks: - id: ruff args: ["--fix"] From 4364cde0ce4db9f4197d44c00c55baa98b133526 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:48:08 +0800 Subject: [PATCH 06/86] [pre-commit.ci] pre-commit autoupdate (#1178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.260 → v0.0.261](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.260...v0.0.261) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4dd4b23b3..92e91d6b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.260 + rev: v0.0.261 hooks: - id: ruff args: ["--fix"] From e500bd78a7465b06134130bd7aa357f4305c27b6 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 12 Apr 2023 01:57:29 -0400 Subject: [PATCH 07/86] add dp_train_skip_neighbor_stat argument (#1179) Fix #1147. --- dpgen/generator/arginfo.py | 8 ++++++++ dpgen/generator/run.py | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 45c148d0d..3803c96da 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -73,6 +73,7 @@ def training_args() -> List[Argument]: doc_training_iter0_model_path = "The model used to init the first iter training. Number of element should be equal to numb_models." doc_training_init_model = "Iteration > 0, the model parameters will be initilized from the model trained at the previous iteration. Iteration == 0, the model parameters will be initialized from training_iter0_model_path." doc_default_training_param = "Training parameters for deepmd-kit in 00.train. You can find instructions from here: (https://github.com/deepmodeling/deepmd-kit)." + doc_dp_train_skip_neighbor_stat = "Append --skip-neighbor-stat flag to dp train." doc_dp_compress = "Use dp compress to compress the model." doc_training_reuse_iter = "The minimal index of iteration that continues training models from old models of last iteration." doc_reusing = " This option is only adopted when continuing training models from old models. This option will override default parameters." @@ -112,6 +113,13 @@ def training_args() -> List[Argument]: optional=False, doc=doc_default_training_param, ), + Argument( + "dp_train_skip_neighbor_stat", + bool, + optional=True, + default=False, + doc=doc_dp_train_skip_neighbor_stat, + ), Argument( "dp_compress", bool, optional=True, default=False, doc=doc_dp_compress ), diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index ec5991fc9..21d516508 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -666,7 +666,10 @@ def run_train(iter_index, jdata, mdata): ## Commands are like `dp train` and `dp freeze` ## train_command should not be None assert train_command - command = "%s train %s" % (train_command, train_input_file) + extra_flags = "" + if jdata.get("dp_train_skip_neighbor_stat", False): + extra_flags += " --skip-neighbor-stat" + command = "%s train %s%s" % (train_command, train_input_file, extra_flags) if training_init_model: command = ( "{ if [ ! -f model.ckpt.index ]; then %s --init-model old/model.ckpt; else %s --restart model.ckpt; fi }" From fd9b9d2f7fd3c4a6cfdc009e9d7122fcc16f247c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 16 Apr 2023 20:46:54 -0400 Subject: [PATCH 08/86] support `mixed:N` batch size (#1183) This allows setting batches of mixed systems, i.e. `mixed:N`, without being overridden by DP-GEN. P.S. now `mixed:N` does work in my systems. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 4 ++-- dpgen/generator/run.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 3803c96da..357354a77 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -38,10 +38,10 @@ def data_args() -> List[Argument]: doc_init_data_prefix = "Prefix of initial data directories." doc_init_data_sys = "Paths of initial data. The path can be either a system diretory containing NumPy files or an HDF5 file. You may use either absolute or relative path here. Systems will be detected recursively in the directories or the HDF5 file." doc_sys_format = "Format of sys_configs." - doc_init_batch_size = "Each number is the batch_size of corresponding system for training in init_data_sys. One recommended rule for setting the sys_batch_size and init_batch_size is that batch_size mutiply number of atoms ot the stucture should be larger than 32. If set to auto, batch size will be 32 divided by number of atoms." + doc_init_batch_size = "Each number is the batch_size of corresponding system for training in init_data_sys. One recommended rule for setting the sys_batch_size and init_batch_size is that batch_size mutiply number of atoms ot the stucture should be larger than 32. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`." doc_sys_configs_prefix = "Prefix of sys_configs." doc_sys_configs = "Containing directories of structures to be explored in iterations.Wildcard characters are supported here." - doc_sys_batch_size = "Each number is the batch_size for training of corresponding system in sys_configs. If set to auto, batch size will be 32 divided by number of atoms." + doc_sys_batch_size = "Each number is the batch_size for training of corresponding system in sys_configs. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`." return [ Argument("init_data_prefix", str, optional=True, doc=doc_init_data_prefix), diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 21d516508..4a9cfae07 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -425,9 +425,13 @@ def make_train(iter_index, jdata, mdata): mdata["deepmd_version"] ) < Version("3"): # 2.x - jinput["training"]["training_data"] = {} + jinput["training"].setdefault("training_data", {}) jinput["training"]["training_data"]["systems"] = init_data_sys - jinput["training"]["training_data"]["batch_size"] = init_batch_size + old_batch_size = jinput["training"]["training_data"].get("batch_size", "") + if not ( + isinstance(old_batch_size, str) and old_batch_size.startswith("mixed:") + ): + jinput["training"]["training_data"]["batch_size"] = init_batch_size jinput["model"]["type_map"] = jdata["type_map"] # electron temperature if use_ele_temp == 0: From 68defe3aae2ebbfb721e60db9055eb778540c06a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 17 Apr 2023 00:04:54 -0400 Subject: [PATCH 09/86] bump pymatgen to a stable version (#1186) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebe9bdff4..c6426a971 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: pip install coverage git+https://github.com/materialsproject/pymatgen@b56698019098247ff54f50997a67c562b4375fc3 -e . + run: pip install coverage pymatgen==2023.3.23 -e . - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 From 6c061074243ced56bc00ddb639000817f906ae4d Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 17 Apr 2023 00:36:40 -0400 Subject: [PATCH 10/86] support one_h5 for simplify model_devi step (#1185) For `dp model_devi`, large number of small NumPy files are still quite expensive on HPCs. Signed-off-by: Jinzhe Zeng --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 4 +- dpgen/simplify/simplify.py | 13 +++- tests/simplify/__init__.py | 1 + tests/simplify/test_get_multi_system.py | 8 ++- tests/simplify/test_run_model_devi.py | 86 +++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 tests/simplify/__init__.py create mode 100644 tests/simplify/test_run_model_devi.py diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 357354a77..c42a68f74 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -92,9 +92,7 @@ def training_args() -> List[Argument]: ) doc_model_devi_activation_func = "The activation function in the model. The shape of list should be (N_models, 2), where 2 represents the embedding and fitting network. This option will override default parameters." doc_srtab_file_path = "The path of the table for the short-range pairwise interaction which is needed when using DP-ZBL potential" - doc_one_h5 = ( - "Before training, all of the training data will be merged into one HDF5 file." - ) + doc_one_h5 = "When using DeePMD-kit, all of the input data will be merged into one HDF5 file." return [ Argument("numb_models", int, optional=False, doc=doc_numb_models), diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 46374c6f1..540be1ef7 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -218,17 +218,26 @@ def run_model_devi(iter_index, jdata, mdata): # models commands = [] detail_file_name = detail_file_name_prefix + system_file_name = rest_data_name + ".old" + if jdata.get("one_h5", False): + # convert system to one h5 file + system_path = os.path.join(work_path, system_file_name) + dpdata.MultiSystems(type_map=jdata["type_map"]).from_deepmd_npy( + system_path, + labeled=False, + ).to_deepmd_hdf5(system_path + ".hdf5") + system_file_name += ".hdf5" command = "{dp} model-devi -m {model} -s {system} -o {detail_file}".format( dp=mdata.get("model_devi_command", "dp"), model=" ".join(task_model_list), - system=rest_data_name + ".old", + system=system_file_name, detail_file=detail_file_name, ) commands = [command] # submit model_devi_group_size = mdata.get("model_devi_group_size", 1) - forward_files = [rest_data_name + ".old"] + forward_files = [system_file_name] backward_files = [detail_file_name] api_version = mdata.get("api_version", "1.0") diff --git a/tests/simplify/__init__.py b/tests/simplify/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tests/simplify/__init__.py @@ -0,0 +1 @@ + diff --git a/tests/simplify/test_get_multi_system.py b/tests/simplify/test_get_multi_system.py index 641e0e80c..c0e5a5b78 100644 --- a/tests/simplify/test_get_multi_system.py +++ b/tests/simplify/test_get_multi_system.py @@ -1,10 +1,14 @@ import os import shutil +import sys import unittest import dpdata import numpy as np -from context import dpgen + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) +__package__ = "simplify" +from .context import dpgen class TestGetMultiSystem(unittest.TestCase): @@ -44,7 +48,7 @@ def test_get_multi_system(self): with self.subTest(list_data=list_data, labeled=labeled): ms = dpgen.simplify.simplify.get_multi_system( self.data if list_data else self.data[0], - {"labeled": labeled}, + {"labeled": labeled, "type_map": ["H"]}, ) assert isinstance(ms, dpdata.MultiSystems) for ss in ms.systems.values(): diff --git a/tests/simplify/test_run_model_devi.py b/tests/simplify/test_run_model_devi.py new file mode 100644 index 000000000..2499a9f9c --- /dev/null +++ b/tests/simplify/test_run_model_devi.py @@ -0,0 +1,86 @@ +import os +import shutil +import sys +import tempfile +import textwrap +import unittest +from pathlib import Path + +import dpdata + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) +__package__ = "simplify" +from .context import dpgen + + +class TestOneH5(unittest.TestCase): + def setUp(self): + work_path = Path("iter.000000") / "01.model_devi" + work_path.mkdir(parents=True, exist_ok=True) + with tempfile.TemporaryDirectory() as tmpdir: + with open(Path(tmpdir) / "test.xyz", "w") as f: + f.write( + textwrap.dedent( + """\ + 2 + + H 0.0 0.0 0.0 + H 0.0 0.0 1.0 + """ + ) + ) + dpdata.MultiSystems( + dpdata.System(Path(tmpdir) / "test.xyz", fmt="xyz") + ).to_deepmd_npy( + work_path / (dpgen.simplify.simplify.rest_data_name + ".old") + ) + + def tearDown(self) -> None: + shutil.rmtree("iter.000000") + + def test_npy(self): + jdata = { + "type_map": ["H"], + } + with tempfile.TemporaryDirectory() as remote_root: + mdata = { + "model_devi_command": ( + f"test -d {dpgen.simplify.simplify.rest_data_name}.old" + f"&& touch {dpgen.simplify.simplify.detail_file_name_prefix}" + "&& echo dp" + ), + "model_devi_machine": { + "context_type": "LocalContext", + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + }, + "model_devi_resources": { + "group_size": 1, + }, + } + dpgen.simplify.simplify.run_model_devi(0, jdata=jdata, mdata=mdata) + + def test_one_h5(self): + jdata = { + "type_map": ["H"], + "one_h5": True, + } + with tempfile.TemporaryDirectory() as remote_root: + mdata = { + "model_devi_command": ( + f"test -f {dpgen.simplify.simplify.rest_data_name}.old.hdf5" + f"&& touch {dpgen.simplify.simplify.detail_file_name_prefix}" + "&& echo dp" + ), + "model_devi_machine": { + "context_type": "LocalContext", + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + }, + "model_devi_resources": { + "group_size": 1, + }, + } + dpgen.simplify.simplify.run_model_devi(0, jdata=jdata, mdata=mdata) From 75e3676474a28089d3302d855c9c9cd9061c34a1 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 21 Apr 2023 00:58:59 -0400 Subject: [PATCH 11/86] fix batch size for simplify (#1184) #803 changed the behavior of sys_idx in the fp step and caused there to be lots of systems. However, it failed to try to get the batch size of these systems. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/run.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 4a9cfae07..7fa62ed2b 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -393,9 +393,12 @@ def make_train(iter_index, jdata, mdata): init_data_sys.append( os.path.normpath(os.path.join("..", "data.iters", sys_single)) ) - init_batch_size.append( - detect_batch_size(sys_batch_size[sys_idx], sys_single) + batch_size = ( + sys_batch_size[sys_idx] + if sys_idx < len(sys_batch_size) + else "auto" ) + init_batch_size.append(detect_batch_size(batch_size, sys_single)) # establish tasks jinput = jdata["default_training_param"] try: From 58e626490536a8bd5839c897581d233f89795f22 Mon Sep 17 00:00:00 2001 From: pxlxingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:29:37 +0800 Subject: [PATCH 12/86] refactor(abacus): modify poscar2stru in auto_test.lib.abacus (#1193) Original function `poscar2stru()` use dpdata.System to read POSCAR, but it will rotate the structure to make cell to be lower triangular, and this rotation is unexpected. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/auto_test/lib/abacus.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index f66278721..b66eafd90 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -5,6 +5,9 @@ import dpdata import numpy as np +from dpdata.abacus.scf import make_unlabeled_stru +from dpdata.utils import uniq_atom_names +from dpdata.vasp import poscar as dpdata_poscar from pymatgen.core.structure import Structure import dpgen.generator.lib.abacus_scf as abacus_scf @@ -242,7 +245,7 @@ ] -def poscar2stru(poscar, inter_param, stru): +def poscar2stru(poscar, inter_param, stru="STRU"): """ - poscar: POSCAR for input - inter_param: dictionary of 'interaction' from param.json @@ -252,8 +255,12 @@ def poscar2stru(poscar, inter_param, stru): - deepks_desc: a string of deepks descriptor file - stru: output filename, usally is 'STRU' """ - stru = dpdata.System(poscar, fmt="vasp/poscar") - stru_data = stru.data + # if use dpdata.System, the structure will be rotated to make cell to be lower triangular + with open(poscar) as fp: + lines = [line.rstrip("\n") for line in fp] + stru_data = dpdata_poscar.to_system_data(lines) + stru_data = uniq_atom_names(stru_data) + atom_mass = [] pseudo = None orb = None @@ -291,14 +298,16 @@ def poscar2stru(poscar, inter_param, stru): if "deepks_desc" in inter_param: deepks_desc = "./pp_orb/%s\n" % inter_param["deepks_desc"] - stru.to( - "stru", - "STRU", - mass=atom_mass, + stru_string = make_unlabeled_stru( + data=stru_data, + frame_idx=0, pp_file=pseudo, numerical_orbital=orb, numerical_descriptor=deepks_desc, + mass=atom_mass, ) + with open(stru, "w") as fp: + fp.write(stru_string) def stru_fix_atom(struf, fix_atom=[True, True, True]): From 41866c20b8af3ce3a7b920e691dd530d88700cf3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 08:29:04 +0800 Subject: [PATCH 13/86] [pre-commit.ci] pre-commit autoupdate (#1195) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.261 → v0.0.262](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.261...v0.0.262) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92e91d6b6..20758d9f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.261 + rev: v0.0.262 hooks: - id: ruff args: ["--fix"] From a8f0e65023aecc86680d47ad960047d7f3e81f9a Mon Sep 17 00:00:00 2001 From: pxlxingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Thu, 4 May 2023 07:30:14 +0800 Subject: [PATCH 14/86] fix(abacus): Compatibility with kspacing set to 3 values (#1197) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/auto_test/ABACUS.py | 12 +++++++-- dpgen/auto_test/Elastic.py | 2 +- dpgen/auto_test/lib/abacus.py | 11 +++++--- dpgen/generator/lib/abacus_scf.py | 29 +++++++++++++++------ tests/auto_test/test_abacus.py | 16 ++++++++++++ tests/generator/test_make_fp.py | 43 +++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 14 deletions(-) diff --git a/dpgen/auto_test/ABACUS.py b/dpgen/auto_test/ABACUS.py index e5a803d9e..54f447638 100644 --- a/dpgen/auto_test/ABACUS.py +++ b/dpgen/auto_test/ABACUS.py @@ -216,7 +216,15 @@ def make_input_file(self, output_dir, task_type, task_param): os.chdir(cwd) if "kspacing" in incar: - kspacing = float(incar["kspacing"]) + if isinstance(incar["kspacing"], str): + kspacing = [float(i) for i in incar["kspacing"].split()] + elif isinstance(incar["kspacing"], (int, float)): + kspacing = [incar["kspacing"]] + else: + kspacing = incar["kspacing"] + if len(kspacing) == 1: + kspacing = 3 * kspacing + if os.path.isfile(os.path.join(output_dir, "STRU")): kpt = abacus.make_kspacing_kpt( os.path.join(output_dir, "STRU"), kspacing @@ -228,7 +236,7 @@ def make_input_file(self, output_dir, task_type, task_param): kpt = cal_setting["K_POINTS"] else: mess = "K point information is not defined\n" - mess += "You can set key word 'kspacing' (unit in 1/bohr) as a float value in INPUT\n" + mess += "You can set key word 'kspacing' (unit in 1/bohr) as one or three float value in INPUT\n" mess += "or set key word 'K_POINTS' as a list in 'cal_setting', e.g. [1,2,3,0,0,0]\n" raise RuntimeError(mess) abacus.write_kpt(os.path.join(output_dir, "KPT"), kpt) diff --git a/dpgen/auto_test/Elastic.py b/dpgen/auto_test/Elastic.py index 0c98e44ab..7616ec740 100644 --- a/dpgen/auto_test/Elastic.py +++ b/dpgen/auto_test/Elastic.py @@ -205,7 +205,7 @@ def post_process(self, task_list): if self.inter_param["type"] == "abacus": input_aba = abacus_scf.get_abacus_input_parameters("INPUT") if "kspacing" in input_aba: - kspacing = float(input_aba["kspacing"]) + kspacing = [float(i) for i in input_aba["kspacing"].split()] kpt = abacus.make_kspacing_kpt(poscar_start, kspacing) kpt += [0, 0, 0] abacus.write_kpt("KPT", kpt) diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index b66eafd90..e5f0e2bd5 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -387,13 +387,18 @@ def write_input(inputf, inputdict): def make_kspacing_kpt(struf, kspacing): + if isinstance(kspacing, (int, float)): + kspacing = [kspacing] * 3 + elif isinstance(kspacing, list) and len(kspacing) == 1: + kspacing = 3 * kspacing + assert len(kspacing) == 3, "kspacing need 3 values" stru_data = abacus_scf.get_abacus_STRU(struf) cell = stru_data["cells"] / abacus_scf.bohr2ang volume = abs(cell[0].dot(np.cross(cell[1], cell[2]))) - coef = 2 * np.pi / volume / kspacing + coef = [2 * np.pi / volume / i for i in kspacing] kpt = [ - max(1, int(np.linalg.norm(np.cross(cell[x], cell[y])) * coef + 1)) - for x, y in [[1, 2], [2, 0], [0, 1]] + max(1, int(np.linalg.norm(np.cross(cell[ixy[0]], cell[ixy[1]])) * coef[i] + 1)) + for i, ixy in enumerate([[1, 2], [2, 0], [0, 1]]) ] return kpt diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index c307c0ad5..6e1f937d9 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -1,4 +1,5 @@ import os +import re import numpy as np from dpdata.abacus.scf import get_cell, get_coords, get_nele_from_stru @@ -34,9 +35,23 @@ def make_abacus_scf_input(fp_params): assert fp_params["ecutwfc"] >= 0, "'ecutwfc' should be non-negative." ret += "ecutwfc %f\n" % fp_params["ecutwfc"] elif key == "kspacing": - fp_params["kspacing"] = float(fp_params["kspacing"]) - assert fp_params["kspacing"] >= 0, "'kspacing' should be non-negative." - ret += "kspacing %f\n" % fp_params["kspacing"] + if isinstance(fp_params["kspacing"], (int, float)): + fp_params["kspacing"] = [float(fp_params["kspacing"])] + elif isinstance(fp_params["kspacing"], (list, tuple)): + fp_params["kspacing"] = list(fp_params["kspacing"]) + elif isinstance(fp_params["kspacing"], str): + fp_params["kspacing"] = [ + float(i) for i in fp_params["kspacing"].split() + ] + assert len(fp_params["kspacing"]) in [ + 1, + 3, + ], "'kspacing' only accept a float, or a list of one or three float, or a string of one or three float" + ret += "kspacing " + for ikspacing in fp_params["kspacing"]: + assert ikspacing >= 0, "'kspacing' should be non-negative." + ret += "%f " % ikspacing + ret += "\n" elif key == "scf_thr": fp_params["scf_thr"] = float(fp_params["scf_thr"]) ret += "scf_thr %e\n" % fp_params["scf_thr"] @@ -266,11 +281,9 @@ def get_abacus_input_parameters(INPUT): inlines = fp.read().split("\n") input_parameters = {} for line in inlines: - if line.split() == [] or len(line.split()) < 2 or line[0] in ["#"]: - continue - parameter_name = line.split()[0] - parameter_value = line.split()[1] - input_parameters[parameter_name] = parameter_value + sline = re.split("[ \t]", line.split("#")[0].strip(), maxsplit=1) + if len(sline) == 2: + input_parameters[sline[0].strip()] = sline[1].strip() fp.close() return input_parameters diff --git a/tests/auto_test/test_abacus.py b/tests/auto_test/test_abacus.py index 14492234b..bc3d4f9ca 100644 --- a/tests/auto_test/test_abacus.py +++ b/tests/auto_test/test_abacus.py @@ -200,6 +200,22 @@ def test_make_input_file_kspacing(self): kpt = f1.read().strip().split("\n")[-1].split() self.assertEqual(kpt, ["9", "9", "9", "0", "0", "0"]) + def test_make_input_file_kspacing_three_value(self): + param = self.task_param.copy() + param["cal_setting"] = { + "relax_pos": False, + "relax_shape": True, + "relax_vol": True, + "kspacing": [0.1, 0.2, 0.3], + } + shutil.copy( + os.path.join(self.conf_path, "STRU"), os.path.join(self.equi_path, "STRU") + ) + self.ABACUS.make_input_file(self.equi_path, "relaxation", param) + with open(os.path.join(self.equi_path, "KPT")) as f1: + kpt = f1.read().strip().split("\n")[-1].split() + self.assertEqual(kpt, ["9", "5", "3", "0", "0", "0"]) + def test_compuate(self): ret = self.ABACUS.compute(os.path.join(self.equi_path)) self.assertIsNone(ret) diff --git a/tests/generator/test_make_fp.py b/tests/generator/test_make_fp.py index c39b2323e..5ecf40b73 100644 --- a/tests/generator/test_make_fp.py +++ b/tests/generator/test_make_fp.py @@ -726,6 +726,49 @@ def test_make_fp_abacus(self): _check_potcar(self, 0, jdata["fp_pp_path"], jdata["fp_pp_files"]) shutil.rmtree("iter.000000") + def test_make_fp_abacus_kspacing(self): + setUpModule() + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + with open(param_abacus_post_file, "r") as fp: + jdata = json.load(fp) + fp.close() + jdata["user_fp_params"]["gamma_only"] = 0 + jdata["user_fp_params"]["kspacing"] = [0.04, 0.05, 0.06] + with open(machine_file, "r") as fp: + mdata = json.load(fp) + fp.close() + md_descript = [] + nsys = 2 + nmd = 3 + n_frame = 10 + for ii in range(nsys): + tmp = [] + for jj in range(nmd): + tmp.append(np.arange(0, 0.29, 0.29 / 10)) + md_descript.append(tmp) + atom_types = [0, 0, 0, 0, 1] + type_map = jdata["type_map"] + _make_fake_md(0, md_descript, atom_types, type_map) + make_fp(0, jdata, {}) + + input_ref = abacus_input_ref.split("\n") + for ii, iline in enumerate(input_ref): + if "gamma_only" in iline: + input_ref[ii] = "gamma_only 0" + elif "kspacing" in iline: + input_ref[ii] = "kspacing 0.040000 0.050000 0.060000" + + fp_path = os.path.join("iter.%06d" % 0, "02.fp", "INPUT") + tasks = glob.glob(os.path.join(fp_path, "task.*")) + for ii in tasks: + ifile = os.path.join(ii, "INPUT") + with open(ifile) as fp: + lines = fp.read().split("\n") + self.assertEqual(lines, input_ref) + + shutil.rmtree("iter.000000") + def test_make_fp_abacus_from_input(self): ## Verify if user chooses to diy ABACUS INPUT totally. setUpModule() From 72d33cf9c86941117d2ddca72c0d3f9220242dca Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 May 2023 09:37:52 +0800 Subject: [PATCH 15/86] [pre-commit.ci] pre-commit autoupdate (#1200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.262 → v0.0.263](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.262...v0.0.263) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20758d9f4..03cfd1937 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.262 + rev: v0.0.263 hooks: - id: ruff args: ["--fix"] From c977dcf73763b9eb3d45f631140309d355665e9a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 3 May 2023 22:19:30 -0400 Subject: [PATCH 16/86] simplify: allow initial models trained by initial data (#1201) which does not come from `pick_data` --- dpgen/simplify/simplify.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 540be1ef7..02519dcb0 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -530,12 +530,15 @@ def run_iter(param_file, machine_file): task_name = "task %02d" % jj sepline("{} {}".format(iter_name, task_name), "-") jdata["model_devi_jobs"] = [{} for _ in range(ii + 1)] - if ii == 0 and jj < 6: + if ii == 0 and jj < 6 and (jj >= 3 or not jdata.get("init_data_sys", [])): if jj == 0: - log_iter("init_pick", ii, jj) + log_iter("init_train", ii, jj) init_model(ii, jdata, mdata) + elif jj == 3: + log_iter("init_pick", ii, jj) init_pick(ii, jdata, mdata) - dlog.info("first iter, skip step 1-5") + else: + dlog.info("first iter, skip step 1-5") elif jj == 0: log_iter("make_train", ii, jj) make_train(ii, jdata, mdata) From d8519df421db984096195cf6f940aabab44a8f6b Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 3 May 2023 22:19:46 -0400 Subject: [PATCH 17/86] simplify: do not symlink if the file does not exist (#1191) If there is no candidate (i.e. all accurate or all failed), `picked_data_path` will not be dumped. --------- Signed-off-by: Jinzhe Zeng --- dpgen/simplify/simplify.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 02519dcb0..b003aa6d2 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -377,14 +377,15 @@ def make_fp_labeled(iter_index, jdata): work_path = os.path.join(iter_name, fp_name) create_path(work_path) picked_data_path = os.path.join(iter_name, model_devi_name, picked_data_name) - os.symlink( - os.path.abspath(picked_data_path), - os.path.abspath(os.path.join(work_path, "task." + fp_task_fmt % (0, 0))), - ) - os.symlink( - os.path.abspath(picked_data_path), - os.path.abspath(os.path.join(work_path, "data." + data_system_fmt % 0)), - ) + if os.path.exists(os.path.abspath(picked_data_path)): + os.symlink( + os.path.abspath(picked_data_path), + os.path.abspath(os.path.join(work_path, "task." + fp_task_fmt % (0, 0))), + ) + os.symlink( + os.path.abspath(picked_data_path), + os.path.abspath(os.path.join(work_path, "data." + data_system_fmt % 0)), + ) def make_fp_configs(iter_index, jdata): @@ -393,6 +394,8 @@ def make_fp_configs(iter_index, jdata): work_path = os.path.join(iter_name, fp_name) create_path(work_path) picked_data_path = os.path.join(iter_name, model_devi_name, picked_data_name) + if not os.path.exists(os.path.abspath(picked_data_path)): + return systems = get_multi_system(picked_data_path, jdata) ii = 0 jj = 0 From deaf641a6a61330730de959765302fb040123a89 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 3 May 2023 22:21:35 -0400 Subject: [PATCH 18/86] simplify: improve performance of selecting frames (#1202) `System.append` is slow as it concatenates arrays. Thus, this PR reduces the times of `System.append`. --- dpgen/simplify/simplify.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index b003aa6d2..2931cf8cc 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -170,8 +170,13 @@ def init_pick(iter_index, jdata, mdata): def _init_dump_selected_frames(systems, labels, selc_idx, sys_data_path, jdata): selc_systems = dpdata.MultiSystems(type_map=jdata["type_map"]) + sys_id_dict = defaultdict(list) for j in selc_idx: sys_name, sys_id = labels[j] + sys_id_dict[sys_name].append(sys_id) + for sys_name, sys_id in sys_id_dict.items(): + # sys_id: list[int] + # System.append is slow; thus, we combine the idx of the same system selc_systems.append(systems[sys_name][sys_id]) selc_systems.to_deepmd_raw(sys_data_path) selc_systems.to_deepmd_npy(sys_data_path, set_size=selc_idx.size) From 84d4a1a1c16e53ebc26cb39aef3cc7dccaff06bd Mon Sep 17 00:00:00 2001 From: Yongbin Zhuang <38876805+robinzyb@users.noreply.github.com> Date: Mon, 15 May 2023 11:44:21 +0800 Subject: [PATCH 19/86] Fix the numerical mismatch for 02.fp/task/cp2k_output after update dpdata (#1219) Fix the numerical mismatch for 02.fp/task/cp2k_output after update dpdata --- tests/generator/out_data_post_fp_cp2k/orig/box.raw | 2 +- tests/generator/out_data_post_fp_cp2k/orig/coord.raw | 2 +- tests/generator/out_data_post_fp_cp2k/orig/energy.raw | 2 +- tests/generator/out_data_post_fp_cp2k/orig/force.raw | 2 +- tests/generator/test_post_fp.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/generator/out_data_post_fp_cp2k/orig/box.raw b/tests/generator/out_data_post_fp_cp2k/orig/box.raw index ba9babfb2..7de7fc209 100644 --- a/tests/generator/out_data_post_fp_cp2k/orig/box.raw +++ b/tests/generator/out_data_post_fp_cp2k/orig/box.raw @@ -1 +1 @@ -1.080399990081787109e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.049800014495849609e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.095600032806396484e+01 +1.080400000000000027e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.049799999999999933e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.095599999999999952e+01 diff --git a/tests/generator/out_data_post_fp_cp2k/orig/coord.raw b/tests/generator/out_data_post_fp_cp2k/orig/coord.raw index fbad9852a..f95b14882 100644 --- a/tests/generator/out_data_post_fp_cp2k/orig/coord.raw +++ b/tests/generator/out_data_post_fp_cp2k/orig/coord.raw @@ -1 +1 @@ -1.027354955673217773e+00 1.706662058830261230e+00 1.602476000785827637e+00 3.963681936264038086e+00 3.976695060729980469e+00 3.215037107467651367e+00 4.365913867950439453e+00 5.882829189300537109e+00 5.464285850524902344e+00 1.528406023979187012e+00 2.262054920196533203e+00 3.791754961013793945e+00 6.766289234161376953e+00 7.323278903961181641e+00 7.395022869110107422e+00 8.059174537658691406e+00 9.176419258117675781e+00 5.758306026458740234e+00 +1.027355000000000018e+00 1.706661999999999901e+00 1.602476000000000012e+00 3.963681999999999928e+00 3.976694999999999869e+00 3.215037000000000145e+00 4.365914000000000073e+00 5.882829000000000086e+00 5.464286000000000421e+00 1.528405999999999931e+00 2.262055000000000149e+00 3.791755000000000209e+00 6.766289000000000442e+00 7.323279000000000316e+00 7.395023000000000124e+00 8.059174999999999756e+00 9.176418999999999215e+00 5.758306000000000147e+00 diff --git a/tests/generator/out_data_post_fp_cp2k/orig/energy.raw b/tests/generator/out_data_post_fp_cp2k/orig/energy.raw index 16e1e92a4..362e9a65e 100644 --- a/tests/generator/out_data_post_fp_cp2k/orig/energy.raw +++ b/tests/generator/out_data_post_fp_cp2k/orig/energy.raw @@ -1 +1 @@ --8.447582397460937500e+02 +-8.447582606992446017e+02 diff --git a/tests/generator/out_data_post_fp_cp2k/orig/force.raw b/tests/generator/out_data_post_fp_cp2k/orig/force.raw index eb099f7db..0ad41126e 100644 --- a/tests/generator/out_data_post_fp_cp2k/orig/force.raw +++ b/tests/generator/out_data_post_fp_cp2k/orig/force.raw @@ -1 +1 @@ -6.917656660079956055e-01 7.553510665893554688e-01 2.274964809417724609e+00 -3.209683299064636230e-01 2.775192558765411377e-01 9.094060063362121582e-01 -6.332576274871826172e-02 -6.449618339538574219e-01 -8.145296573638916016e-01 -1.756150871515274048e-01 -3.121818304061889648e-01 -2.260577917098999023e+00 1.112470626831054688e+00 1.688659071922302246e+00 -1.721519827842712402e+00 -1.208800196647644043e+00 -1.778025507926940918e+00 1.601097583770751953e+00 +6.917656471387700901e-01 7.553510904559461725e-01 2.274964715661485837e+00 -3.209683176564304130e-01 2.775192417423087421e-01 9.094059481875964579e-01 -6.332576187642065257e-02 -6.449617955424929994e-01 -8.145296625904011600e-01 -1.756151021831240944e-01 -3.121818289867506202e-01 -2.260577849622959601e+00 1.112470664210258198e+00 1.688659044047888358e+00 -1.721519802047959624e+00 -1.208800137434334454e+00 -1.778025455114995435e+00 1.601097547549200639e+00 diff --git a/tests/generator/test_post_fp.py b/tests/generator/test_post_fp.py index 04cdf1132..c2404c1c4 100644 --- a/tests/generator/test_post_fp.py +++ b/tests/generator/test_post_fp.py @@ -275,7 +275,7 @@ def setUp(self): self.v_places = 5 assert os.path.isdir( "out_data_post_fp_cp2k" - ), "out data for post fp gaussian should exist" + ), "out data for post fp cp2k should exist" if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_cp2k", "iter.000000") From 0aec52e97d90d03c7edefb336e4fd79c2f5ecd83 Mon Sep 17 00:00:00 2001 From: Peng Xingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Tue, 16 May 2023 08:53:14 +0800 Subject: [PATCH 20/86] fix(abacus): put pp/orb/dpks files to folder pporb in 02fp. (#1214) #1192 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng --- dpgen/generator/lib/abacus_scf.py | 21 +++++-- dpgen/generator/run.py | 91 +++++++++++++++++-------------- tests/generator/test_make_fp.py | 20 ++++++- 3 files changed, 82 insertions(+), 50 deletions(-) diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 6e1f937d9..436d92607 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -25,8 +25,9 @@ def make_abacus_scf_kpt(fp_params): return ret -def make_abacus_scf_input(fp_params): +def make_abacus_scf_input(fp_params, extra_file_path=""): # Make INPUT file for abacus pw scf calculation. + # put extra files (such as: deepks_model) to extra_file_path folder ret = "INPUT_PARAMETERS\n" ret += "calculation scf\n" for key in fp_params: @@ -181,7 +182,9 @@ def make_abacus_scf_input(fp_params): ), "'deepks_scf' should be either 0 or 1." ret += "deepks_scf %d\n" % fp_params["deepks_scf"] elif key == "deepks_model": - ret += "deepks_model %s\n" % fp_params["deepks_model"] + ret += "deepks_model %s\n" % os.path.join( + extra_file_path, os.path.split(fp_params["deepks_model"])[1] + ) elif key[0] == "_": pass elif key == "calculation": @@ -198,6 +201,7 @@ def make_abacus_scf_stru( fp_dpks_descriptor=None, fp_params=None, type_map=None, + pporb="", # pull all pp orb dpks files to pporb folder ): atom_names = sys_data["atom_names"] atom_numbs = sys_data["atom_numbs"] @@ -217,12 +221,17 @@ def make_abacus_scf_stru( ) idx = type_map.index(atom_names[iatom]) if "atom_masses" not in sys_data: - ret += atom_names[iatom] + " 1.00 " + fp_pp_files[idx] + "\n" + ret += ( + atom_names[iatom] + + " 1.00 " + + os.path.join(pporb, fp_pp_files[idx]) + + "\n" + ) else: ret += ( atom_names[iatom] + " %.3f " % sys_data["atom_masses"][iatom] - + fp_pp_files[idx] + + os.path.join(pporb, fp_pp_files[idx]) + "\n" ) @@ -267,11 +276,11 @@ def make_abacus_scf_stru( assert len(fp_orb_files) == len(type_map) for iatom in range(len(atom_names)): idx = type_map.index(atom_names[iatom]) - ret += fp_orb_files[idx] + "\n" + ret += os.path.join(pporb, fp_orb_files[idx]) + "\n" if fp_dpks_descriptor is not None: ret += "\nNUMERICAL_DESCRIPTOR\n" - ret += "%s\n" % fp_dpks_descriptor + ret += os.path.join(pporb, fp_dpks_descriptor) + "\n" return ret diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 7fa62ed2b..f4382b99a 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -25,6 +25,7 @@ import warnings from collections import Counter from collections.abc import Iterable +from pprint import pp from typing import List import dpdata @@ -3031,6 +3032,7 @@ def sys_link_fp_vasp_pp(iter_index, jdata): def _link_fp_abacus_pporb_descript(iter_index, jdata): # assume pp orbital files, numerical descrptors and model for dpks are all in fp_pp_path. fp_pp_path = os.path.abspath(jdata["fp_pp_path"]) + type_map = jdata["type_map"] iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3047,46 +3049,56 @@ def _link_fp_abacus_pporb_descript(iter_index, jdata): input_param = get_abacus_input_parameters("INPUT") fp_dpks_model = input_param.get("deepks_model", None) if fp_dpks_model != None: - model_file = os.path.join(fp_pp_path, fp_dpks_model) + model_file = os.path.join( + fp_pp_path, os.path.split(fp_dpks_model)[1] + ) # only the filename assert os.path.isfile(model_file), ( "Can not find the deepks model file %s, which is defined in %s/INPUT" % (model_file, ii) ) - os.symlink(model_file, fp_dpks_model) + os.symlink(model_file, fp_dpks_model) # link to the model file # get pp, orb, descriptor filenames from STRU stru_param = get_abacus_STRU("STRU") - pp_files = stru_param.get("pp_files", []) - orb_files = stru_param.get("orb_files", []) - descriptor_file = stru_param.get("dpks_descriptor", None) - pp_files = [] if pp_files == None else pp_files - orb_files = [] if orb_files == None else orb_files - - for jj in pp_files: - ifile = os.path.join(fp_pp_path, jj) - assert os.path.isfile(ifile), ( - "Can not find the pseudopotential file %s, which is defined in %s/STRU" - % (ifile, ii) - ) - os.symlink(ifile, jj) + atom_names = stru_param["atom_names"] + pp_files_stru = stru_param.get("pp_files", None) + orb_files_stru = stru_param.get("orb_files", None) + descriptor_file_stru = stru_param.get("dpks_descriptor", None) + + if pp_files_stru: + assert "fp_pp_files" in jdata, "need to define fp_pp_files in jdata" + if orb_files_stru: + assert "fp_orb_files" in jdata, "need to define fp_orb_files in jdata" + if descriptor_file_stru: + assert ( + "fp_dpks_descriptor" in jdata + ), "need to define fp_dpks_descriptor in jdata" - for jj in orb_files: - ifile = os.path.join(fp_pp_path, jj) + for idx, iatom in enumerate(atom_names): + type_map_idx = type_map.index(iatom) + if iatom not in type_map: + raise RuntimeError( + "atom name %s in STRU is not defined in type_map" % (iatom) + ) + if pp_files_stru: + src_file = os.path.join(fp_pp_path, jdata["fp_pp_files"][type_map_idx]) + assert os.path.isfile( + src_file + ), f"Can not find the pseudopotential file {src_file}" + os.symlink(src_file, pp_files_stru[idx]) + if orb_files_stru: + src_file = os.path.join(fp_pp_path, jdata["fp_orb_files"][type_map_idx]) + assert os.path.isfile( + src_file + ), f"Can not find the orbital file {src_file}" + os.symlink(src_file, orb_files_stru[idx]) + if descriptor_file_stru: + src_file = os.path.join(fp_pp_path, jdata["fp_dpks_descriptor"]) assert os.path.isfile( - ifile - ), "Can not find the orbital file %s, which is defined in %s/STRU" % ( - ifile, - ii, - ) - os.symlink(ifile, jj) + src_file + ), f"Can not find the descriptor file {src_file}" + os.symlink(src_file, descriptor_file_stru) - if descriptor_file != None: - ifile = os.path.join(fp_pp_path, descriptor_file) - assert os.path.isfile(ifile), ( - "Can not find the deepks descriptor file %s, which is defined in %s/STRU" - % (ifile, ii) - ) - os.symlink(ifile, descriptor_file) os.chdir(cwd) @@ -3201,6 +3213,7 @@ def make_fp_pwscf(iter_index, jdata): def make_fp_abacus_scf(iter_index, jdata): # make config + pporb_path = "pporb" fp_tasks = _make_fp_vasp_configs(iter_index, jdata) if len(fp_tasks) == 0: return @@ -3223,7 +3236,7 @@ def make_fp_abacus_scf(iter_index, jdata): raise RuntimeError( "Set 'user_fp_params' or 'fp_incar' in json file to make INPUT of ABACUS" ) - ret_input = make_abacus_scf_input(fp_params) + ret_input = make_abacus_scf_input(fp_params, extra_file_path=pporb_path) # Get orbital and deepks setting if "basis_type" in fp_params: @@ -3295,10 +3308,14 @@ def make_fp_abacus_scf(iter_index, jdata): fp_dpks_descriptor, fp_params, type_map=jdata["type_map"], + pporb=pporb_path, ) with open("STRU", "w") as fp: fp.write(ret_stru) + if not os.path.isdir(pporb_path): + os.makedirs(pporb_path) + os.chdir(cwd) # link pp and orbital files _link_fp_abacus_pporb_descript(iter_index, jdata) @@ -3756,17 +3773,9 @@ def run_fp(iter_index, jdata, mdata): assert os.path.exists(fp_input_path) fp_input_path = os.path.abspath(fp_input_path) fp_params = get_abacus_input_parameters(fp_input_path) - forward_files = ["INPUT", "STRU"] + forward_files = ["INPUT", "STRU", "pporb"] if "kspacing" not in fp_params.keys(): - forward_files = ["INPUT", "STRU", "KPT"] - forward_files += fp_pp_files - if "fp_orb_files" in jdata: - forward_files += jdata["fp_orb_files"] - if "fp_dpks_descriptor" in jdata: - forward_files.append(jdata["fp_dpks_descriptor"]) - if "user_fp_params" in jdata: - if "deepks_model" in jdata["user_fp_params"]: - forward_files.append(jdata["user_fp_params"]["deepks_model"]) + forward_files.append("KPT") backward_files = ["output", "OUT.ABACUS"] run_fp_inner( iter_index, diff --git a/tests/generator/test_make_fp.py b/tests/generator/test_make_fp.py index 5ecf40b73..a98c2b5d2 100644 --- a/tests/generator/test_make_fp.py +++ b/tests/generator/test_make_fp.py @@ -179,7 +179,7 @@ deepks_out_labels 0\n\ deepks_descriptor_lmax 0\n\ deepks_scf 0\n\ -deepks_model model.ptg\n" +deepks_model pporb/model.ptg\n" abacus_kpt_ref = "K_POINTS\n\ 0\n\ @@ -690,6 +690,20 @@ def test_make_fp_pwscf_old(self): class TestMakeFPABACUS(unittest.TestCase): + def _check_pp(self, idx, fp_pp_path, fp_pp_files): + nfile = len(fp_pp_files) + fp_path = os.path.join("iter.%06d" % idx, "02.fp") + for ii in range(nfile): + self.assertTrue(os.path.isfile(os.path.join(fp_pp_path, fp_pp_files[ii]))) + tasks = glob.glob(os.path.join(fp_path, "task.*")) + for ii in tasks: + for jj in range(nfile): + my_file_cmp( + self, + os.path.join(fp_pp_path, fp_pp_files[jj]), + os.path.join(ii, "pporb", fp_pp_files[jj]), + ) + def test_make_fp_abacus(self): setUpModule() if os.path.isdir("iter.000000"): @@ -723,7 +737,7 @@ def test_make_fp_abacus(self): _check_poscars(self, 0, jdata["fp_task_max"], jdata["type_map"]) _check_abacus_input(self, 0) _check_abacus_kpt(self, 0) - _check_potcar(self, 0, jdata["fp_pp_path"], jdata["fp_pp_files"]) + self._check_pp(0, jdata["fp_pp_path"], jdata["fp_pp_files"]) shutil.rmtree("iter.000000") def test_make_fp_abacus_kspacing(self): @@ -803,7 +817,7 @@ def test_make_fp_abacus_from_input(self): _check_poscars(self, 0, jdata["fp_task_max"], jdata["type_map"]) _check_abacus_input(self, 0) _check_abacus_kpt(self, 0) - _check_potcar(self, 0, jdata["fp_pp_path"], jdata["fp_pp_files"]) + self._check_pp(0, jdata["fp_pp_path"], jdata["fp_pp_files"]) shutil.rmtree("iter.000000") From b0c1271254e6ed7266b0dd62d5a3e00649c8e650 Mon Sep 17 00:00:00 2001 From: Liu Renxi <75369672+Liu-RX@users.noreply.github.com> Date: Tue, 16 May 2023 08:53:33 +0800 Subject: [PATCH 21/86] fix bug in make_supercell_abacus (#1212) The `from_struct["atom_types"]` used to be a list but was changed to numpy array lately, thereby introducing a bug in `make_supercell_abacus` function. Also, the key `types` is changed to `atom_types` outside the function, but not changed in the function. This commit fix the two bugs. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng --- dpgen/generator/lib/abacus_scf.py | 52 +++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 436d92607..96ae2fe98 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -1,3 +1,4 @@ +import copy import os import re @@ -401,31 +402,50 @@ def get_abacus_STRU(STRU, INPUT=None, n_ele=None): def make_supercell_abacus(from_struct, super_cell): - if "types" in from_struct: - from_struct["types"] = ( - from_struct["types"] * super_cell[0] * super_cell[1] * super_cell[2] - ) - for ix in range(super_cell[0]): - for iy in range(super_cell[1]): - for iz in range(super_cell[2]): - if ix == 0 and iy == 0 and iz == 0: - continue - for ia in range(sum(from_struct["atom_numbs"])): + to_struct = copy.deepcopy(from_struct) + + if "atom_types" in from_struct: + new_types = [] + # to_struct["atom_types"] = ( + # from_struct["atom_types"] * super_cell[0] * super_cell[1] * super_cell[2] + # ) + for idx_atm, ina in enumerate(from_struct["atom_numbs"]): + new_types += ( + [idx_atm for i in range(ina)] + * super_cell[0] + * super_cell[1] + * super_cell[2] + ) + to_struct["atom_types"] = new_types + to_atom_num = ( + sum(from_struct["atom_numbs"]) * super_cell[0] * super_cell[1] * super_cell[2] + ) + new_coord = np.zeros((to_atom_num, 3)) + idx_atm = 0 + for ia in range(sum(from_struct["atom_numbs"])): + for ix in range(super_cell[0]): + for iy in range(super_cell[1]): + for iz in range(super_cell[2]): + # if ix == 0 and iy == 0 and iz == 0: + # continue + coord = ( from_struct["coords"][ia] + from_struct["cells"][0] * ix + from_struct["cells"][1] * iy + from_struct["cells"][2] * iz ) - from_struct["coords"] = np.vstack([from_struct["coords"], coord]) - from_struct["atom_numbs"] = [ + new_coord[idx_atm] = coord + to_struct["coords"] = new_coord + new_numbs = [ i * super_cell[0] * super_cell[1] * super_cell[2] for i in from_struct["atom_numbs"] ] - from_struct["cells"][0] *= super_cell[0] - from_struct["cells"][1] *= super_cell[1] - from_struct["cells"][2] *= super_cell[2] - return from_struct + to_struct["atom_numbs"] = new_numbs + to_struct["cells"][0] *= super_cell[0] + to_struct["cells"][1] *= super_cell[1] + to_struct["cells"][2] *= super_cell[2] + return to_struct def make_kspacing_kpoints_stru(stru, kspacing): From 65bc64ad9a386ef6c3b34bd91cd464e2f3337249 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 15 May 2023 20:53:59 -0400 Subject: [PATCH 22/86] support automatic training_reuse_old_ratio (#1209) set the default value to `auto` instead of raising errors --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 14 +++++++++++-- dpgen/generator/run.py | 43 ++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index c42a68f74..b81ec1670 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -1,3 +1,4 @@ +import textwrap from typing import Dict, List from dargs import Argument, Variant @@ -78,7 +79,15 @@ def training_args() -> List[Argument]: doc_training_reuse_iter = "The minimal index of iteration that continues training models from old models of last iteration." doc_reusing = " This option is only adopted when continuing training models from old models. This option will override default parameters." doc_training_reuse_old_ratio = ( - "The probability proportion of old data during training." + doc_reusing + textwrap.dedent( + """\ + The probability proportion of old data during training. It can be:\n + - float: directly assign the probability of old data; + - `auto:f`: automatic probability, where f is the new-to-old ratio; + - `auto`: equivalent to `auto:10`. + """ + ) + + doc_reusing ) doc_training_reuse_numb_steps = "Number of training batch." + doc_reusing doc_training_reuse_start_lr = ( @@ -129,7 +138,8 @@ def training_args() -> List[Argument]: ), Argument( "training_reuse_old_ratio", - [None, float], + [str, float], + default="auto", optional=True, doc=doc_training_reuse_old_ratio, ), diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index f4382b99a..069f68796 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -265,7 +265,7 @@ def make_train(iter_index, jdata, mdata): training_iter0_model = jdata.get("training_iter0_model_path", []) training_init_model = jdata.get("training_init_model", False) training_reuse_iter = jdata.get("training_reuse_iter") - training_reuse_old_ratio = jdata.get("training_reuse_old_ratio", None) + training_reuse_old_ratio = jdata.get("training_reuse_old_ratio", "auto") # if you want to use DP-ZBL potential , you have to give the path of your energy potential file if "srtab_file_path" in jdata.keys(): @@ -283,15 +283,29 @@ def make_train(iter_index, jdata, mdata): training_reuse_start_pref_f = jdata.get("training_reuse_start_pref_f", 100) model_devi_activation_func = jdata.get("model_devi_activation_func", None) - if training_reuse_iter is not None and training_reuse_old_ratio is None: - raise RuntimeError( - "training_reuse_old_ratio not found but is mandatory when using init-model (training_reuse_iter is detected in param).\n" - "It defines the ratio of the old-data picking probability to the all-data(old-data plus new-data) picking probability in training after training_reuse_iter.\n" - "Denoting the index of the current iter as N (N >= training_reuse_iter ), old-data refers to those existed before the N-1 iter, and new-data refers to that obtained by the N-1 iter.\n" - "A recommended strategy is making the new-to-old ratio close to 10 times of the default value, to reasonably increase the sensitivity of the model to the new-data.\n" - "By default, the picking probability of data from one system or one iter is proportional to the number of batches (the number of frames divided by batch_size) of that systems or iter.\n" - "Detailed discussion about init-model (in Chinese) please see https://mp.weixin.qq.com/s/qsKMZ0j270YhQKvwXUiFvQ" + auto_ratio = False + if ( + training_reuse_iter is not None + and isinstance(training_reuse_old_ratio, str) + and training_reuse_old_ratio.startswith("auto") + ): + s = training_reuse_old_ratio.split(":") + if len(s) == 1: + new_to_old_ratio = 10.0 + elif len(s) == 2: + new_to_old_ratio = float(s[1]) + else: + raise ValueError( + "training_reuse_old_ratio is not correct, got %s" + % training_reuse_old_ratio + ) + dlog.info( + "Use automatic training_reuse_old_ratio to make new-to-old ratio close to %d times of the default value.", + training_reuse_iter, ) + auto_ratio = True + number_old_frames = 0 + number_new_frames = 0 model_devi_engine = jdata.get("model_devi_engine", "lammps") if iter_index > 0 and _check_empty_iter(iter_index - 1, fp_task_min): @@ -364,6 +378,8 @@ def make_train(iter_index, jdata, mdata): ) ) init_batch_size.append(detect_batch_size(ss, single_sys)) + if auto_ratio: + number_old_frames += get_nframes(single_sys) old_range = None if iter_index > 0: for ii in range(iter_index): @@ -385,6 +401,11 @@ def make_train(iter_index, jdata, mdata): nframes += dpdata.LabeledSystem( sys_single, fmt="deepmd/npy" ).get_nframes() + if auto_ratio: + if ii == iter_index - 1: + number_new_frames += nframes + else: + number_old_frames += nframes if nframes < fp_task_min: log_task( "nframes (%d) in data sys %s is too small, skip" % (nframes, jj) @@ -453,6 +474,10 @@ def make_train(iter_index, jdata, mdata): "DP-GEN currently only supports for DeePMD-kit 1.x or 2.x version!" ) # set training reuse model + if auto_ratio: + training_reuse_old_ratio = number_old_frames / ( + number_old_frames + number_new_frames * new_to_old_ratio + ) if training_reuse_iter is not None and iter_index >= training_reuse_iter: if "numb_steps" in jinput["training"] and training_reuse_stop_batch is not None: jinput["training"]["numb_steps"] = training_reuse_stop_batch From 9c017046afa09436925fb8f5986246a86240f2c9 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 15 May 2023 20:54:41 -0400 Subject: [PATCH 23/86] fix the links of DP-GUI (#1187) --- doc/init/init-bulk-jdata.rst | 2 +- doc/init/init-bulk-mdata.rst | 2 +- doc/init/init-reaction-jdata.rst | 2 +- doc/init/init-reaction-mdata.rst | 2 +- doc/init/init-surf-jdata.rst | 2 +- doc/init/init-surf-mdata.rst | 2 +- doc/run/param.rst | 2 +- doc/simplify/simplify-jdata.rst | 2 +- doc/simplify/simplify-mdata.rst | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/init/init-bulk-jdata.rst b/doc/init/init-bulk-jdata.rst index 8d37484bd..c3bb18d98 100644 --- a/doc/init/init-bulk-jdata.rst +++ b/doc/init/init-bulk-jdata.rst @@ -2,7 +2,7 @@ dpgen init_bulk parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-bulk-mdata.rst b/doc/init/init-bulk-mdata.rst index 79f29a4de..039a5afc2 100644 --- a/doc/init/init-bulk-mdata.rst +++ b/doc/init/init-bulk-mdata.rst @@ -2,7 +2,7 @@ dpgen init_bulk machine parameters ================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-reaction-jdata.rst b/doc/init/init-reaction-jdata.rst index 2c1f2480f..34b1e87c0 100644 --- a/doc/init/init-reaction-jdata.rst +++ b/doc/init/init-reaction-jdata.rst @@ -2,7 +2,7 @@ dpgen init_reaction parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-reaction-mdata.rst b/doc/init/init-reaction-mdata.rst index 74f39dfd7..91bd638e8 100644 --- a/doc/init/init-reaction-mdata.rst +++ b/doc/init/init-reaction-mdata.rst @@ -2,7 +2,7 @@ dpgen init_reaction machine parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-surf-jdata.rst b/doc/init/init-surf-jdata.rst index aa61245d9..a88d3a582 100644 --- a/doc/init/init-surf-jdata.rst +++ b/doc/init/init-surf-jdata.rst @@ -2,7 +2,7 @@ dpgen init_surf parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-surf-mdata.rst b/doc/init/init-surf-mdata.rst index d1f6e7c4c..be9005e0b 100644 --- a/doc/init/init-surf-mdata.rst +++ b/doc/init/init-surf-mdata.rst @@ -2,7 +2,7 @@ dpgen init_surf machine parameters ================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/run/param.rst b/doc/run/param.rst index 6b99446f3..cbb2b75e5 100644 --- a/doc/run/param.rst +++ b/doc/run/param.rst @@ -3,7 +3,7 @@ dpgen run param parameters ============================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.generator.arginfo diff --git a/doc/simplify/simplify-jdata.rst b/doc/simplify/simplify-jdata.rst index 3933566dd..3f44752c8 100644 --- a/doc/simplify/simplify-jdata.rst +++ b/doc/simplify/simplify-jdata.rst @@ -2,7 +2,7 @@ dpgen simplify parameters ========================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.simplify.arginfo diff --git a/doc/simplify/simplify-mdata.rst b/doc/simplify/simplify-mdata.rst index 40edfc201..f02f5a292 100644 --- a/doc/simplify/simplify-mdata.rst +++ b/doc/simplify/simplify-mdata.rst @@ -2,7 +2,7 @@ dpgen simplify machine parameters ================================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.simplify.arginfo From 47e64909e936f10859a6fc6097add763583fe4be Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 08:57:23 +0800 Subject: [PATCH 24/86] [pre-commit.ci] pre-commit autoupdate (#1213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.263 → v0.0.265](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.263...v0.0.265) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 03cfd1937..774ab48ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.263 + rev: v0.0.265 hooks: - id: ruff args: ["--fix"] From 18a9de91e4707c5bebf9dbb187fce6b7c975da71 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 May 2023 09:25:28 +0800 Subject: [PATCH 25/86] [pre-commit.ci] pre-commit autoupdate (#1221) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.265 → v0.0.267](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.265...v0.0.267) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 774ab48ce..49f7525ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.265 + rev: v0.0.267 hooks: - id: ruff args: ["--fix"] From e68580ca3c7c86e0acfef41114c3cf5d13d4a885 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 May 2023 23:53:40 -0400 Subject: [PATCH 26/86] bypass the upstream pymatgen error for CI (#1233) --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6426a971..f68067034 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,8 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: pip install coverage pymatgen==2023.3.23 -e . + # See https://github.com/materialsproject/api/issues/809 + run: pip install coverage pymatgen==2023.3.23 -e . 'mp-api<0.33; python_version < "3.9"' - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 From 7570fecc8e34cc79a712140149ff1832e3dee832 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 May 2023 23:55:54 -0400 Subject: [PATCH 27/86] change size and apply dark mode for the logo (#1190) Signed-off-by: Jinzhe Zeng --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- README.md | 2 +- doc/_static/css/custom.css | 8 ++++++++ doc/_static/logo-dark.svg | 1 + doc/{ => _static}/logo.svg | 0 doc/conf.py | 6 +++--- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 doc/_static/css/custom.css create mode 100644 doc/_static/logo-dark.svg rename doc/{ => _static}/logo.svg (100%) diff --git a/README.md b/README.md index d2734fd9a..166202981 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![logo](./doc/logo.svg) +DP-GEN logo -------------------------------------------------------------------------------- diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css new file mode 100644 index 000000000..9ac71c813 --- /dev/null +++ b/doc/_static/css/custom.css @@ -0,0 +1,8 @@ +.wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo { + width: 275px; +} +@media (prefers-color-scheme: dark) { + .wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo { + content: url("../logo-dark.svg"); + } +} diff --git a/doc/_static/logo-dark.svg b/doc/_static/logo-dark.svg new file mode 100644 index 000000000..80b706fa1 --- /dev/null +++ b/doc/_static/logo-dark.svg @@ -0,0 +1 @@ + diff --git a/doc/logo.svg b/doc/_static/logo.svg similarity index 100% rename from doc/logo.svg rename to doc/_static/logo.svg diff --git a/doc/conf.py b/doc/conf.py index 358c2a9b0..7c99018a1 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -75,13 +75,13 @@ # a list of builtin themes. # html_theme = "sphinx_rtd_theme" -html_logo = "logo.svg" +html_logo = "_static/logo.svg" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] -# html_css_files = ['css/custom.css'] +html_static_path = ["_static"] +html_css_files = ["css/custom.css"] autodoc_default_flags = ["members"] autosummary_generate = True From 2d826183eb69b5e8695217fe16dae77a803cef23 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 13:26:22 +0800 Subject: [PATCH 28/86] [pre-commit.ci] pre-commit autoupdate (#1227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.267 → v0.0.269](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.267...v0.0.269) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49f7525ce..d8162f802 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.267 + rev: v0.0.269 hooks: - id: ruff args: ["--fix"] From 0cd4e7cff0d362b5223be5772b2bdb67c69946d5 Mon Sep 17 00:00:00 2001 From: Yongbin Zhuang <38876805+robinzyb@users.noreply.github.com> Date: Tue, 30 May 2023 20:09:33 +0800 Subject: [PATCH 29/86] extend the doc of cp2k external_input_path in detail (#1225) How to add code blocks in the doc? --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- dpgen/generator/arginfo.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index b81ec1670..7d2835d8a 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -718,7 +718,23 @@ def fp_style_siesta_args() -> List[Argument]: def fp_style_cp2k_args() -> List[Argument]: doc_user_fp_params = "Parameters for cp2k calculation. find detail in manual.cp2k.org. only the kind section must be set before use. we assume that you have basic knowledge for cp2k input." - doc_external_input_path = "Conflict with key:user_fp_params, use the template input provided by user, some rules should be followed, read the following text in detail." + doc_external_input_path = ( + "Conflict with key:user_fp_params.\n" + "enable the template input provided by user.\n" + "some rules should be followed, read the following text in detail: \n" + "\n" + "1. One must present a KEYWORD ABC in the section CELL so that the DP-GEN can replace the cell on-the-fly. \n" + "2. One need to add these lines under FORCE_EVAL section to print forces and stresses::\n" + "\n" + " STRESS_TENSOR ANALYTICAL\n" + " &PRINT\n" + " &FORCES ON\n" + " &END FORCES\n" + " &STRESS_TENSOR ON\n" + " &END STRESS_TENSOR\n" + " &END PRINT\n" + "\n" + ) doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." return [ From fb2d0ef6d3fe98adc5cd71f98c62556c8bcad1c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 30 May 2023 20:09:47 +0800 Subject: [PATCH 30/86] [pre-commit.ci] pre-commit autoupdate (#1236) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.269 → v0.0.270](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.269...v0.0.270) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8162f802..6a1d464af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.269 + rev: v0.0.270 hooks: - id: ruff args: ["--fix"] From bd9a72e3d023089905d491e34e03178a46f03379 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 30 May 2023 08:12:24 -0400 Subject: [PATCH 31/86] split make_fp and share `make_fp_calculation` between run and simplify (#1235) Fix #1222. Currently, `make_fp` does two things: (1) select candidates from the model_devi task; (2) make FP input file. They are in the same method. This commit splits the method into two independent methods, `make_fp_configs` and `make_fp_calculation`. Run and simplify have their own `make_fp_configs`, but share the same `make_fp_calculation`. The existing problem is that `make_fp_configs` generates different formats for different model_devi_engine. (e.g., POSCAR for lammps) We should resolve this problem in the future. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/run.py | 93 +++++++++++++++++--------- dpgen/simplify/arginfo.py | 14 +++- dpgen/simplify/simplify.py | 57 +--------------- tests/generator/test_gromacs_engine.py | 4 +- 4 files changed, 79 insertions(+), 89 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 069f68796..9293d93be 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -3127,7 +3127,25 @@ def _link_fp_abacus_pporb_descript(iter_index, jdata): os.chdir(cwd) -def _make_fp_vasp_configs(iter_index, jdata): +def _make_fp_vasp_configs(iter_index: int, jdata: dict): + """Read the model deviation from model_devi step, and then generate the candidated structures + in 02.fp directory. + + Currently, the formats of generated structures are decided by model_devi_eigne. + + Parameters + ---------- + iter_index : int + The index of iteration. + jdata : dict + The json data. + + Returns + ------- + int + The number of the candidated structures. + """ + # TODO: we need to unify different data formats fp_task_max = jdata["fp_task_max"] model_devi_skip = jdata["model_devi_skip"] type_map = jdata["type_map"] @@ -3179,10 +3197,6 @@ def _make_fp_vasp_configs(iter_index, jdata): def make_fp_vasp(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return # abs path for fp_incar if it exists if "fp_incar" in jdata: jdata["fp_incar"] = os.path.abspath(jdata["fp_incar"]) @@ -3203,10 +3217,8 @@ def make_fp_vasp(iter_index, jdata): def make_fp_pwscf(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) # make pwscf input iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3237,11 +3249,9 @@ def make_fp_pwscf(iter_index, jdata): def make_fp_abacus_scf(iter_index, jdata): - # make config + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) pporb_path = "pporb" - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return # make abacus/pw/scf input iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3347,10 +3357,8 @@ def make_fp_abacus_scf(iter_index, jdata): def make_fp_siesta(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) # make siesta input iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3374,10 +3382,8 @@ def make_fp_siesta(iter_index, jdata): def make_fp_gaussian(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) # make gaussian gjf file iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3403,10 +3409,8 @@ def make_fp_gaussian(iter_index, jdata): def make_fp_cp2k(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) # make cp2k input iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, fp_name) @@ -3445,10 +3449,6 @@ def make_fp_cp2k(iter_index, jdata): def make_fp_pwmat(iter_index, jdata): - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) - if len(fp_tasks) == 0: - return # abs path for fp_incar if it exists if "fp_incar" in jdata: jdata["fp_incar"] = os.path.abspath(jdata["fp_incar"]) @@ -3504,8 +3504,9 @@ def make_fp_amber_diff(iter_index: int, jdata: dict): Jinzhe Zeng, Timothy J. Giese, Şölen Ekesan, and Darrin M. York, Journal of Chemical Theory and Computation 2021 17 (11), 6993-7009 """ - # make config - fp_tasks = _make_fp_vasp_configs(iter_index, jdata) + assert jdata["model_devi_engine"] == "amber" + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) # make amber input cwd = os.getcwd() # link two mdin files and param7 @@ -3558,8 +3559,36 @@ def make_fp_amber_diff(iter_index: int, jdata: dict): def make_fp(iter_index, jdata, mdata): - fp_style = jdata["fp_style"] + """Select the candidate strutures and make the input file of FP calculation. + Parameters + ---------- + iter_index : int + iter index + jdata : dict + Run parameters. + mdata : dict + Machine parameters. + """ + fp_tasks = _make_fp_vasp_configs(iter_index, jdata) + if len(fp_tasks) == 0: + return + make_fp_calculation(iter_index, jdata, mdata) + + +def make_fp_calculation(iter_index, jdata, mdata): + """Make the input file of FP calculation. + + Parameters + ---------- + iter_index : int + iter index + jdata : dict + Run parameters. + mdata : dict + Machine parameters. + """ + fp_style = jdata["fp_style"] if fp_style == "vasp": make_fp_vasp(iter_index, jdata) elif fp_style == "pwscf": diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 5b0d7175b..96acf7e87 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -6,7 +6,10 @@ from dpgen.generator.arginfo import ( basic_args, data_args, + fp_style_abacus_args, + fp_style_cp2k_args, fp_style_gaussian_args, + fp_style_siesta_args, fp_style_vasp_args, training_args, ) @@ -59,7 +62,7 @@ def fp_style_variant_type_args() -> Variant: Variant variant for fp style """ - doc_fp_style = "Software for First Principles, if `labeled` is false. Options include “vasp”, “gaussian” up to now." + doc_fp_style = "Software for First Principles, if `labeled` is false." doc_fp_style_none = "No fp." doc_fp_style_vasp = "VASP." doc_fp_style_gaussian = "Gaussian. The command should be set as `g16 < input`." @@ -73,6 +76,15 @@ def fp_style_variant_type_args() -> Variant: Argument( "gaussian", dict, fp_style_gaussian_args(), doc=doc_fp_style_gaussian ), + Argument("siesta", dict, fp_style_siesta_args()), + Argument("cp2k", dict, fp_style_cp2k_args()), + Argument("abacus", dict, fp_style_abacus_args()), + # TODO: not supported yet, as it requires model_devi_engine to be amber + # Argument( + # "amber/diff", dict, fp_style_amber_diff_args(), doc=doc_amber_diff + # ), + Argument("pwmat", dict, [], doc="TODO: add doc"), + Argument("pwscf", dict, [], doc="TODO: add doc"), ], optional=True, default_tag="none", diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 2931cf8cc..b7eaa29b5 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -22,7 +22,6 @@ from dpgen import dlog from dpgen.dispatcher.Dispatcher import make_submission -from dpgen.generator.lib.gaussian import make_gaussian_input # TODO: maybe the following functions can be moved to dpgen.util from dpgen.generator.lib.utils import ( @@ -36,6 +35,7 @@ data_system_fmt, fp_name, fp_task_fmt, + make_fp_calculation, make_fp_vasp_cp_cvasp, make_fp_vasp_incar, make_fp_vasp_kp, @@ -414,65 +414,14 @@ def make_fp_configs(iter_index, jdata): ii += 1 -def make_fp_gaussian(iter_index, jdata): - work_path = os.path.join(make_iter_name(iter_index), fp_name) - fp_tasks = glob.glob(os.path.join(work_path, "task.*")) - cwd = os.getcwd() - if "user_fp_params" in jdata.keys(): - fp_params = jdata["user_fp_params"] - else: - fp_params = jdata["fp_params"] - cwd = os.getcwd() - for ii in fp_tasks: - os.chdir(ii) - sys_data = dpdata.System("POSCAR").data - ret = make_gaussian_input(sys_data, fp_params) - with open("input", "w") as fp: - fp.write(ret) - os.chdir(cwd) - - -def make_fp_vasp(iter_index, jdata): - # abs path for fp_incar if it exists - if "fp_incar" in jdata: - jdata["fp_incar"] = os.path.abspath(jdata["fp_incar"]) - # get nbands esti if it exists - if "fp_nbands_esti_data" in jdata: - nbe = NBandsEsti(jdata["fp_nbands_esti_data"]) - else: - nbe = None - # order is critical! - # 1, create potcar - sys_link_fp_vasp_pp(iter_index, jdata) - # 2, create incar - make_fp_vasp_incar(iter_index, jdata, nbands_esti=nbe) - # 3, create kpoints - make_fp_vasp_kp(iter_index, jdata) - # 4, copy cvasp - make_fp_vasp_cp_cvasp(iter_index, jdata) - - -def make_fp_calculation(iter_index, jdata): - fp_style = jdata["fp_style"] - if fp_style == "vasp": - make_fp_vasp(iter_index, jdata) - elif fp_style == "gaussian": - make_fp_gaussian(iter_index, jdata) - else: - raise RuntimeError("unsupported fp_style " + fp_style) - - def make_fp(iter_index, jdata, mdata): labeled = jdata.get("labeled", False) if labeled: make_fp_labeled(iter_index, jdata) else: make_fp_configs(iter_index, jdata) - make_fp_calculation(iter_index, jdata) - # Copy user defined forward_files - iter_name = make_iter_name(iter_index) - work_path = os.path.join(iter_name, fp_name) - symlink_user_forward_files(mdata=mdata, task_type="fp", work_path=work_path) + jdata["model_devi_engine"] = "lammps" + make_fp_calculation(iter_index, jdata, mdata) def run_iter(param_file, machine_file): diff --git a/tests/generator/test_gromacs_engine.py b/tests/generator/test_gromacs_engine.py index 20c8d6e25..4386b11b9 100644 --- a/tests/generator/test_gromacs_engine.py +++ b/tests/generator/test_gromacs_engine.py @@ -12,7 +12,7 @@ __package__ = "generator" dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), "gromacs") -from .context import make_fp_gaussian, make_model_devi +from .context import make_fp, make_model_devi def _make_fake_graphs(train_path): @@ -131,7 +131,7 @@ def test_make_model_devi_gromacs_with_openbabel(self): self._copy_outputs( os.path.join(self.dirname, "outputs"), self.model_devi_task_path ) - make_fp_gaussian(iter_index=0, jdata=self.jdata) + make_fp(iter_index=0, jdata=self.jdata, mdata={}) candi = np.loadtxt( os.path.join(self.fp_path, "candidate.shuffled.000.out"), dtype=str ) From 1d9e5d4ff9eb86f632fa15d14c32fe705abdd27e Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Thu, 8 Jun 2023 22:52:32 -0400 Subject: [PATCH 32/86] apply ruff rules and fix lots of bugs (#1240) The same rules as deepmd-kit are applied. Manually fix a lot of typos, such as `pp_list` -> `pp_lists` in `dpgen/database/vasp.py`. Manually fix a typo in #1209, where `get_nframes` was forgotten to add. Manually replace the deprecated `scipy.interpolate.PiecewisePolynomial` with `scipy.interpolate.BPoly.from_derivatives`. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/conf.py | 3 - dpgen/__init__.py | 2 - dpgen/arginfo.py | 1 - dpgen/auto_test/ABACUS.py | 10 +- dpgen/auto_test/EOS.py | 4 +- dpgen/auto_test/Elastic.py | 2 +- dpgen/auto_test/Gamma.py | 12 +- dpgen/auto_test/Interstitial.py | 17 +- dpgen/auto_test/Lammps.py | 28 +-- dpgen/auto_test/Property.py | 26 +-- dpgen/auto_test/Surface.py | 3 +- dpgen/auto_test/Task.py | 26 +-- dpgen/auto_test/VASP.py | 30 +-- dpgen/auto_test/Vacancy.py | 5 +- dpgen/auto_test/calculator.py | 4 +- dpgen/auto_test/common_equi.py | 2 - dpgen/auto_test/common_prop.py | 5 +- dpgen/auto_test/gen_confs.py | 6 +- dpgen/auto_test/lib/abacus.py | 132 +------------ dpgen/auto_test/lib/lammps.py | 67 +++---- dpgen/auto_test/lib/lmp.py | 2 +- dpgen/auto_test/lib/mfp_eosfit.py | 173 +++++++----------- dpgen/auto_test/lib/pwscf.py | 4 +- dpgen/auto_test/lib/util.py | 6 +- dpgen/auto_test/lib/utils.py | 4 +- dpgen/auto_test/lib/vasp.py | 37 ++-- dpgen/auto_test/mpdb.py | 1 - dpgen/auto_test/refine.py | 2 +- dpgen/auto_test/reproduce.py | 4 +- dpgen/collect/collect.py | 2 - dpgen/data/arginfo.py | 4 +- dpgen/data/gen.py | 38 ++-- dpgen/data/reaction.py | 13 +- dpgen/data/surf.py | 67 ++----- dpgen/data/tools/bcc.py | 10 +- dpgen/data/tools/cessp2force_lin.py | 22 +-- dpgen/data/tools/create_random_disturb.py | 6 +- dpgen/data/tools/diamond.py | 10 +- dpgen/data/tools/fcc.py | 14 +- dpgen/data/tools/hcp.py | 10 +- dpgen/data/tools/io_lammps.py | 31 ++-- dpgen/data/tools/ovito_file_convert.py | 10 +- dpgen/data/tools/poscar_copy.py | 5 +- dpgen/data/tools/sc.py | 8 +- dpgen/database/__init__.py | 2 + dpgen/database/entry.py | 54 +++--- dpgen/database/run.py | 13 +- dpgen/database/vasp.py | 47 ++--- dpgen/dispatcher/Dispatcher.py | 2 +- dpgen/generator/arginfo.py | 2 +- dpgen/generator/lib/abacus_scf.py | 6 +- dpgen/generator/lib/calypso_check_outcar.py | 29 ++- dpgen/generator/lib/calypso_run_model_devi.py | 3 +- dpgen/generator/lib/calypso_run_opt.py | 41 ++--- dpgen/generator/lib/cp2k.py | 15 +- dpgen/generator/lib/cvasp.py | 6 +- dpgen/generator/lib/ele_temp.py | 3 +- dpgen/generator/lib/gaussian.py | 16 +- dpgen/generator/lib/lammps.py | 10 +- dpgen/generator/lib/make_calypso.py | 4 +- dpgen/generator/lib/parse_calypso.py | 8 +- dpgen/generator/lib/pwmat.py | 28 +-- dpgen/generator/lib/pwscf.py | 6 +- dpgen/generator/lib/run_calypso.py | 21 +-- dpgen/generator/lib/utils.py | 16 +- dpgen/generator/lib/vasp.py | 6 +- dpgen/generator/run.py | 165 +++++++---------- dpgen/main.py | 4 +- dpgen/remote/decide_machine.py | 6 +- dpgen/simplify/simplify.py | 29 ++- dpgen/tools/auto_gen_param.py | 7 +- dpgen/tools/collect_data.py | 3 - dpgen/tools/relabel.py | 7 +- dpgen/tools/run_report.py | 9 - dpgen/tools/stat_iter.py | 1 - dpgen/tools/stat_sys.py | 9 +- dpgen/util.py | 15 +- pyproject.toml | 27 ++- tests/auto_test/context.py | 2 +- tests/auto_test/test_abacus.py | 2 +- tests/auto_test/test_abacus_equi.py | 4 +- tests/auto_test/test_abacus_property.py | 2 +- tests/auto_test/test_elastic.py | 7 +- tests/auto_test/test_eos.py | 5 +- tests/auto_test/test_gamma.py | 19 +- tests/auto_test/test_interstitial.py | 6 +- tests/auto_test/test_lammps.py | 8 +- tests/auto_test/test_make_prop.py | 7 +- tests/auto_test/test_mpdb.py | 3 +- tests/auto_test/test_refine.py | 9 +- tests/auto_test/test_surface.py | 7 +- tests/auto_test/test_vacancy.py | 5 +- tests/auto_test/test_vasp.py | 10 +- tests/auto_test/test_vasp_equi.py | 9 +- tests/auto_test/test_vasp_equi_std.py | 11 +- tests/auto_test/test_vasp_kspacing.py | 9 +- tests/data/context.py | 2 +- tests/data/context_bulk.py | 2 +- tests/data/context_surf.py | 2 +- tests/data/context_surf_poscar.py | 2 +- tests/data/test_coll_abacus.py | 12 +- tests/data/test_coll_vasp.py | 12 +- tests/data/test_disturb_abacus.py | 6 +- tests/data/test_gen_bulk.py | 16 +- tests/data/test_gen_bulk_abacus.py | 18 +- tests/data/test_gen_surf.py | 15 +- tests/data/test_gen_surf_poscar.py | 15 +- tests/database/context.py | 8 +- tests/database/test_db_vasp.py | 18 +- tests/generator/context.py | 20 +- .../gromacs/model_devi_case/model_devi.py | 4 +- tests/generator/test_calypso.py | 6 +- tests/generator/test_check_bad_box.py | 11 +- tests/generator/test_check_cluster.py | 9 +- tests/generator/test_cluster.py | 6 +- tests/generator/test_concat_fp_vasp_pp.py | 16 +- tests/generator/test_gromacs_engine.py | 11 +- tests/generator/test_lammps.py | 12 +- tests/generator/test_make_fp.py | 91 +++++---- tests/generator/test_make_md.py | 19 +- tests/generator/test_make_train.py | 38 ++-- tests/generator/test_nbands_esti.py | 11 +- tests/generator/test_parse_cur_job.py | 7 +- tests/generator/test_post_fp.py | 35 ++-- tests/simplify/context.py | 3 +- tests/test_cli.py | 1 - tests/tools/context.py | 2 +- tests/tools/test_convert_mdata.py | 2 +- tests/tools/test_run_report.py | 5 +- 129 files changed, 835 insertions(+), 1215 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 7c99018a1..b0bcbb400 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,13 +11,10 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os -import subprocess import sys from datetime import date # import sys -import recommonmark -from recommonmark.transform import AutoStructify # -- Project information ----------------------------------------------------- diff --git a/dpgen/__init__.py b/dpgen/__init__.py index 927705f25..3fad112f2 100644 --- a/dpgen/__init__.py +++ b/dpgen/__init__.py @@ -1,5 +1,3 @@ -from __future__ import print_function, unicode_literals - import logging import os diff --git a/dpgen/arginfo.py b/dpgen/arginfo.py index 63405bfdd..cef1f18de 100644 --- a/dpgen/arginfo.py +++ b/dpgen/arginfo.py @@ -20,7 +20,6 @@ def general_mdata_arginfo(name: str, tasks: Tuple[str]) -> Argument: Argument arginfo """ - doc_api_version = "Please set to 1.0" doc_deepmd_version = "DeePMD-kit version, e.g. 2.1.3" doc_run_mdata = "machine.json file" diff --git a/dpgen/auto_test/ABACUS.py b/dpgen/auto_test/ABACUS.py index 54f447638..ea5ec627f 100644 --- a/dpgen/auto_test/ABACUS.py +++ b/dpgen/auto_test/ABACUS.py @@ -1,6 +1,5 @@ import os -import numpy as np from dpdata import LabeledSystem from monty.serialization import dumpfn @@ -22,7 +21,7 @@ def __init__(self, inter_parameter, path_to_poscar): self.deepks = inter_parameter.get("deepks_desc", None) self.deepks_model = inter_parameter.get("deepks_model", None) self.path_to_poscar = path_to_poscar - self.if_define_orb_file = False if self.orbfile == None else True + self.if_define_orb_file = False if self.orbfile is None else True def make_potential_files(self, output_dir): stru = os.path.abspath(os.path.join(output_dir, "STRU")) @@ -41,7 +40,7 @@ def make_potential_files(self, output_dir): else: stru_path = output_dir - if pp_files == None: + if pp_files is None: raise RuntimeError("No pseudopotential information in STRU file") pp_dir = os.path.abspath(self.potcar_prefix) @@ -101,8 +100,7 @@ def make_potential_files(self, output_dir): filename_in_para = os.path.split(file_param)[1] if filename_in_stru != filename_in_para: dlog.warning( - "file name in STRU is not match that defined in parameter setting file: '%s', '%s'." - % (filename_in_stru, filename_in_para) + f"file name in STRU is not match that defined in parameter setting file: '{filename_in_stru}', '{filename_in_para}'." ) src_file = os.path.join(pp_dir, file_param) @@ -119,7 +117,7 @@ def make_potential_files(self, output_dir): def modify_input(self, incar, x, y): if x in incar and incar[x] != y: - dlog.info("setting %s to %s" % (x, y)) + dlog.info(f"setting {x} to {y}") incar[x] = y def make_input_file(self, output_dir, task_type, task_param): diff --git a/dpgen/auto_test/EOS.py b/dpgen/auto_test/EOS.py index 6ccd60fb8..2ab57dfcf 100644 --- a/dpgen/auto_test/EOS.py +++ b/dpgen/auto_test/EOS.py @@ -76,7 +76,7 @@ def __init__(self, parameter, inter_param=None): parameter["init_from_suffix"] = parameter.get("init_from_suffix", "00") self.init_from_suffix = parameter["init_from_suffix"] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) @@ -259,7 +259,7 @@ def _compute_lower(self, output_file, all_tasks, all_res): res_data[vol] = task_result["energies"][-1] / sum( task_result["atom_numbs"] ) - ptr_data += "%7.3f %8.4f \n" % ( + ptr_data += "{:7.3f} {:8.4f} \n".format( vol, task_result["energies"][-1] / sum(task_result["atom_numbs"]), ) diff --git a/dpgen/auto_test/Elastic.py b/dpgen/auto_test/Elastic.py index 7616ec740..389935a06 100644 --- a/dpgen/auto_test/Elastic.py +++ b/dpgen/auto_test/Elastic.py @@ -50,7 +50,7 @@ def __init__(self, parameter, inter_param=None): # parameter['reproduce'] = False # self.reprod = parameter['reproduce'] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) diff --git a/dpgen/auto_test/Gamma.py b/dpgen/auto_test/Gamma.py index 97eed3b1b..cb66ea52d 100644 --- a/dpgen/auto_test/Gamma.py +++ b/dpgen/auto_test/Gamma.py @@ -7,10 +7,8 @@ import numpy as np from ase.lattice.cubic import BodyCenteredCubic as bcc from ase.lattice.cubic import FaceCenteredCubic as fcc -from ase.lattice.hexagonal import HexagonalClosedPacked as hcp from monty.serialization import dumpfn, loadfn from pymatgen.core.structure import Structure -from pymatgen.core.surface import SlabGenerator from pymatgen.io.ase import AseAtomsAdaptor import dpgen.auto_test.lib.abacus as abacus @@ -22,9 +20,7 @@ class Gamma(Property): - """ - Calculation of common gamma lines for bcc and fcc - """ + """Calculation of common gamma lines for bcc and fcc.""" def __init__(self, parameter, inter_param=None): parameter["reproduce"] = parameter.get("reproduce", False) @@ -95,7 +91,7 @@ def __init__(self, parameter, inter_param=None): parameter["init_from_suffix"] = parameter.get("init_from_suffix", "00") self.init_from_suffix = parameter["init_from_suffix"] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) @@ -359,7 +355,7 @@ def __poscar_fix(self, poscar) -> None: + fix_dict[self.add_fix[2]] + "\n" ) - with open(poscar, "r") as fin1: + with open(poscar) as fin1: contents = fin1.readlines() contents.insert(insert_pos - 1, "Selective dynamics\n") for ii in range(insert_pos, 0, 1): @@ -387,7 +383,7 @@ def __inLammpes_fix(self, inLammps) -> None: + fix_dict[self.add_fix[2]] + "\n" ) - with open(inLammps, "r") as fin1: + with open(inLammps) as fin1: contents = fin1.readlines() for ii in range(len(contents)): upper = re.search("variable N equal count\(all\)", contents[ii]) diff --git a/dpgen/auto_test/Interstitial.py b/dpgen/auto_test/Interstitial.py index b98f18d15..ae5befc5d 100644 --- a/dpgen/auto_test/Interstitial.py +++ b/dpgen/auto_test/Interstitial.py @@ -10,7 +10,6 @@ import dpgen.auto_test.lib.abacus as abacus import dpgen.auto_test.lib.lammps as lammps -import dpgen.generator.lib.abacus_scf as abacus_scf from dpgen.auto_test.Property import Property from dpgen.auto_test.refine import make_refine from dpgen.auto_test.reproduce import make_repro, post_repro @@ -76,7 +75,7 @@ def __init__(self, parameter, inter_param=None): parameter["init_from_suffix"] = parameter.get("init_from_suffix", "00") self.init_from_suffix = parameter["init_from_suffix"] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) @@ -248,7 +247,7 @@ def make_confs(self, path_to_work, path_to_equi, refine=False): num_atom = super_size * 2 chl = -num_atom - 2 os.chdir(path_to_work) - with open("POSCAR", "r") as fin: + with open("POSCAR") as fin: fin.readline() scale = float(fin.readline().split()[0]) latt_param = float(fin.readline().split()[0]) @@ -257,7 +256,7 @@ def make_confs(self, path_to_work, path_to_equi, refine=False): if not os.path.isfile("task.000000/POSCAR"): raise RuntimeError("need task.000000 structure as reference") - with open("task.000000/POSCAR", "r") as fin: + with open("task.000000/POSCAR") as fin: pos_line = fin.read().split("\n") super_latt_param = float(pos_line[2].split()[0]) @@ -467,13 +466,13 @@ def make_confs(self, path_to_work, path_to_equi, refine=False): def post_process(self, task_list): if True: - fin1 = open(os.path.join(task_list[0], "..", "element.out"), "r") + fin1 = open(os.path.join(task_list[0], "..", "element.out")) for ii in task_list: conf = os.path.join(ii, "conf.lmp") inter = os.path.join(ii, "inter.json") insert_ele = fin1.readline().split()[0] if os.path.isfile(conf): - with open(conf, "r") as fin2: + with open(conf) as fin2: conf_line = fin2.read().split("\n") insert_line = conf_line[-2] type_map = loadfn(inter)["type_map"] @@ -505,9 +504,7 @@ def _compute_lower(self, output_file, all_tasks, all_res): ptr_data = os.path.dirname(output_file) + "\n" if not self.reprod: - with open( - os.path.join(os.path.dirname(output_file), "element.out"), "r" - ) as fin: + with open(os.path.join(os.path.dirname(output_file), "element.out")) as fin: fc = fin.read().split("\n") ptr_data += "Insert_ele-Struct: Inter_E(eV) E(eV) equi_E(eV)\n" idid = -1 @@ -528,7 +525,7 @@ def _compute_lower(self, output_file, all_tasks, all_res): supercell_index = loadfn(os.path.join(ii, "supercell.json")) # insert_ele = loadfn(os.path.join(ii, 'task.json'))['insert_ele'][0] insert_ele = fc[idid] - ptr_data += "%s: %7.3f %7.3f %7.3f \n" % ( + ptr_data += "{}: {:7.3f} {:7.3f} {:7.3f} \n".format( insert_ele + "-" + str(supercell_index) + "-" + structure_dir, evac, task_result["energies"][-1], diff --git a/dpgen/auto_test/Lammps.py b/dpgen/auto_test/Lammps.py index 0cd46b245..38f3d623d 100644 --- a/dpgen/auto_test/Lammps.py +++ b/dpgen/auto_test/Lammps.py @@ -138,36 +138,40 @@ def make_input_file(self, output_dir, task_type, task_param): # deal with user input in.lammps for relaxation if os.path.isfile(self.in_lammps) and task_type == "relaxation": - with open(self.in_lammps, "r") as fin: + with open(self.in_lammps) as fin: fc = fin.read() # user input in.lammps for property calculation if "input_prop" in cal_setting and os.path.isfile(cal_setting["input_prop"]): - with open(os.path.abspath(cal_setting["input_prop"]), "r") as fin: + with open(os.path.abspath(cal_setting["input_prop"])) as fin: fc = fin.read() else: if "etol" in cal_setting: dlog.info( - "%s setting etol to %s" - % (self.make_input_file.__name__, cal_setting["etol"]) + "{} setting etol to {}".format( + self.make_input_file.__name__, cal_setting["etol"] + ) ) etol = cal_setting["etol"] if "ftol" in cal_setting: dlog.info( - "%s setting ftol to %s" - % (self.make_input_file.__name__, cal_setting["ftol"]) + "{} setting ftol to {}".format( + self.make_input_file.__name__, cal_setting["ftol"] + ) ) ftol = cal_setting["ftol"] if "maxiter" in cal_setting: dlog.info( - "%s setting maxiter to %s" - % (self.make_input_file.__name__, cal_setting["maxiter"]) + "{} setting maxiter to {}".format( + self.make_input_file.__name__, cal_setting["maxiter"] + ) ) maxiter = cal_setting["maxiter"] if "maxeval" in cal_setting: dlog.info( - "%s setting maxeval to %s" - % (self.make_input_file.__name__, cal_setting["maxeval"]) + "{} setting maxeval to {}".format( + self.make_input_file.__name__, cal_setting["maxeval"] + ) ) maxeval = cal_setting["maxeval"] @@ -300,7 +304,7 @@ def compute(self, output_dir): force = [] virial = [] stress = [] - with open(dump_lammps, "r") as fin: + with open(dump_lammps) as fin: dump = fin.read().split("\n") dumptime = [] for idx, ii in enumerate(dump): @@ -354,7 +358,7 @@ def compute(self, output_dir): fz = float(dump[idx + 9 + jj].split()[7]) force[-1].append([fx, fy, fz]) - with open(log_lammps, "r") as fp: + with open(log_lammps) as fp: if "Total wall time:" not in fp.read(): warnings.warn("lammps not finished " + log_lammps + " skip") return None diff --git a/dpgen/auto_test/Property.py b/dpgen/auto_test/Property.py index e0fb4d3c1..8b6a18f1b 100644 --- a/dpgen/auto_test/Property.py +++ b/dpgen/auto_test/Property.py @@ -11,8 +11,7 @@ class Property(ABC): @abstractmethod def __init__(self, parameter): - """ - Constructor + """Constructor. Parameters ---------- @@ -23,8 +22,7 @@ def __init__(self, parameter): @abstractmethod def make_confs(self, path_to_work, path_to_equi, refine=False): - """ - Make configurations needed to compute the property. + """Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists. @@ -47,31 +45,24 @@ def make_confs(self, path_to_work, path_to_equi, refine=False): @abstractmethod def post_process(self, task_list): - """ - post_process the KPOINTS file in elastic. - """ + """post_process the KPOINTS file in elastic.""" pass @property @abstractmethod def task_type(self): - """ - Return the type of each computational task, for example, 'relaxation', 'static'.... - """ + """Return the type of each computational task, for example, 'relaxation', 'static'....""" pass @property @abstractmethod def task_param(self): - """ - Return the parameter of each computational task, for example, {'ediffg': 1e-4} - """ + """Return the parameter of each computational task, for example, {'ediffg': 1e-4}.""" pass def compute(self, output_file, print_file, path_to_work): - """ - Postprocess the finished tasks to compute the property. - Output the result to a json database + """Postprocess the finished tasks to compute the property. + Output the result to a json database. Parameters ---------- @@ -107,8 +98,7 @@ def compute(self, output_file, print_file, path_to_work): @abstractmethod def _compute_lower(self, output_file, all_tasks, all_res): - """ - Compute the property. + """Compute the property. Parameters ---------- diff --git a/dpgen/auto_test/Surface.py b/dpgen/auto_test/Surface.py index da5770598..b04123cfb 100644 --- a/dpgen/auto_test/Surface.py +++ b/dpgen/auto_test/Surface.py @@ -11,7 +11,6 @@ import dpgen.auto_test.lib.abacus as abacus import dpgen.auto_test.lib.vasp as vasp -import dpgen.generator.lib.abacus_scf as abacus_scf from dpgen import dlog from dpgen.auto_test.Property import Property from dpgen.auto_test.refine import make_refine @@ -83,7 +82,7 @@ def __init__(self, parameter, inter_param=None): parameter["init_from_suffix"] = parameter.get("init_from_suffix", "00") self.init_from_suffix = parameter["init_from_suffix"] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) diff --git a/dpgen/auto_test/Task.py b/dpgen/auto_test/Task.py index 848a8bebd..f293eb0bf 100644 --- a/dpgen/auto_test/Task.py +++ b/dpgen/auto_test/Task.py @@ -4,8 +4,7 @@ class Task(ABC): @abstractmethod def __init__(self, inter_parameter, path_to_poscar): - """ - Constructor + """Constructor. Parameters ---------- @@ -18,11 +17,10 @@ def __init__(self, inter_parameter, path_to_poscar): @abstractmethod def make_potential_files(self, output_dir): - """ - Prepare potential files for a computational task. + """Prepare potential files for a computational task. For example, the VASP prepares POTCAR. DeePMD prepares frozen model(s). - IMPORTANT: Interaction should be stored in output_dir/inter.json + IMPORTANT: Interaction should be stored in output_dir/inter.json. Parameters ---------- @@ -40,8 +38,7 @@ def make_potential_files(self, output_dir): @abstractmethod def make_input_file(self, output_dir, task_type, task_param): - """ - Prepare input files for a computational task + """Prepare input files for a computational task For example, the VASP prepares INCAR. LAMMPS (including DeePMD, MEAM...) prepares in.lammps. @@ -62,8 +59,7 @@ def make_input_file(self, output_dir, task_type, task_param): @abstractmethod def compute(self, output_dir): - """ - Compute output of the task. + """Compute output of the task. IMPORTANT: The output configuration should be converted and stored in a CONTCAR file. Parameters @@ -89,25 +85,19 @@ def compute(self, output_dir): @staticmethod @abstractmethod def forward_files(self): - """ - Return forward files. - """ + """Return forward files.""" pass @property @staticmethod @abstractmethod def forward_common_files(self): - """ - Return forward common files. - """ + """Return forward common files.""" pass @property @staticmethod @abstractmethod def backward_files(self): - """ - Return backward files. - """ + """Return backward files.""" pass diff --git a/dpgen/auto_test/VASP.py b/dpgen/auto_test/VASP.py index cf317a438..e5b38d2e6 100644 --- a/dpgen/auto_test/VASP.py +++ b/dpgen/auto_test/VASP.py @@ -41,7 +41,7 @@ def make_potential_files(self, output_dir): for jj in ele_pot_list: if ii == jj: with open( - os.path.join(self.potcar_prefix, self.potcars[jj]), "r" + os.path.join(self.potcar_prefix, self.potcars[jj]) ) as fin: for line in fin: print(line.strip("\n"), file=fp) @@ -54,7 +54,6 @@ def make_potential_files(self, output_dir): if ii == jj: with open( os.path.join(self.potcar_prefix, self.potcars[jj]), - "r", ) as fin: for line in fin: print(line.strip("\n"), file=fp) @@ -137,36 +136,41 @@ def make_input_file(self, output_dir, task_type, task_param): if "ediff" in cal_setting: dlog.info( - "%s setting EDIFF to %s" - % (self.make_input_file.__name__, cal_setting["ediff"]) + "{} setting EDIFF to {}".format( + self.make_input_file.__name__, cal_setting["ediff"] + ) ) incar["EDIFF"] = cal_setting["ediff"] if "ediffg" in cal_setting: dlog.info( - "%s setting EDIFFG to %s" - % (self.make_input_file.__name__, cal_setting["ediffg"]) + "{} setting EDIFFG to {}".format( + self.make_input_file.__name__, cal_setting["ediffg"] + ) ) incar["EDIFFG"] = cal_setting["ediffg"] if "encut" in cal_setting: dlog.info( - "%s setting ENCUT to %s" - % (self.make_input_file.__name__, cal_setting["encut"]) + "{} setting ENCUT to {}".format( + self.make_input_file.__name__, cal_setting["encut"] + ) ) incar["ENCUT"] = cal_setting["encut"] if "kspacing" in cal_setting: dlog.info( - "%s setting KSPACING to %s" - % (self.make_input_file.__name__, cal_setting["kspacing"]) + "{} setting KSPACING to {}".format( + self.make_input_file.__name__, cal_setting["kspacing"] + ) ) incar["KSPACING"] = cal_setting["kspacing"] if "kgamma" in cal_setting: dlog.info( - "%s setting KGAMMA to %s" - % (self.make_input_file.__name__, cal_setting["kgamma"]) + "{} setting KGAMMA to {}".format( + self.make_input_file.__name__, cal_setting["kgamma"] + ) ) incar["KGAMMA"] = cal_setting["kgamma"] @@ -201,7 +205,7 @@ def compute(self, output_dir): else: ls = LabeledSystem(outcar) stress = [] - with open(outcar, "r") as fin: + with open(outcar) as fin: lines = fin.read().split("\n") for line in lines: if "in kB" in line: diff --git a/dpgen/auto_test/Vacancy.py b/dpgen/auto_test/Vacancy.py index 06a65d728..b298407d7 100644 --- a/dpgen/auto_test/Vacancy.py +++ b/dpgen/auto_test/Vacancy.py @@ -9,7 +9,6 @@ from pymatgen.core.structure import Structure import dpgen.auto_test.lib.abacus as abacus -import dpgen.generator.lib.abacus_scf as abacus_scf from dpgen import dlog from dpgen.auto_test.Property import Property from dpgen.auto_test.refine import make_refine @@ -75,7 +74,7 @@ def __init__(self, parameter, inter_param=None): parameter["init_from_suffix"] = parameter.get("init_from_suffix", "00") self.init_from_suffix = parameter["init_from_suffix"] self.parameter = parameter - self.inter_param = inter_param if inter_param != None else {"type": "vasp"} + self.inter_param = inter_param if inter_param is not None else {"type": "vasp"} def make_confs(self, path_to_work, path_to_equi, refine=False): path_to_work = os.path.abspath(path_to_work) @@ -242,7 +241,7 @@ def _compute_lower(self, output_file, all_tasks, all_res): evac = task_result["energies"][-1] - equi_epa * natoms supercell_index = loadfn(os.path.join(ii, "supercell.json")) - ptr_data += "%s: %7.3f %7.3f %7.3f \n" % ( + ptr_data += "{}: {:7.3f} {:7.3f} {:7.3f} \n".format( str(supercell_index) + "-" + structure_dir, evac, task_result["energies"][-1], diff --git a/dpgen/auto_test/calculator.py b/dpgen/auto_test/calculator.py index 90e800371..aba707b06 100644 --- a/dpgen/auto_test/calculator.py +++ b/dpgen/auto_test/calculator.py @@ -4,9 +4,7 @@ def make_calculator(inter_parameter, path_to_poscar): - """ - Make an instance of Task - """ + """Make an instance of Task.""" inter_type = inter_parameter["type"] if inter_type == "vasp": return VASP(inter_parameter, path_to_poscar) diff --git a/dpgen/auto_test/common_equi.py b/dpgen/auto_test/common_equi.py index 61f3eb115..bd37fb9e8 100644 --- a/dpgen/auto_test/common_equi.py +++ b/dpgen/auto_test/common_equi.py @@ -1,8 +1,6 @@ import glob import os import shutil -import warnings -from multiprocessing import Pool from monty.serialization import dumpfn from packaging.version import Version diff --git a/dpgen/auto_test/common_prop.py b/dpgen/auto_test/common_prop.py index 1f3ea3461..1cd821a4a 100644 --- a/dpgen/auto_test/common_prop.py +++ b/dpgen/auto_test/common_prop.py @@ -1,6 +1,5 @@ import glob import os -import warnings from multiprocessing import Pool from packaging.version import Version @@ -23,9 +22,7 @@ def make_property_instance(parameters, inter_param): - """ - Make an instance of Property - """ + """Make an instance of Property.""" prop_type = parameters["type"] if prop_type == "eos": return EOS(parameters, inter_param) diff --git a/dpgen/auto_test/gen_confs.py b/dpgen/auto_test/gen_confs.py index 9a17173e6..1554efd21 100755 --- a/dpgen/auto_test/gen_confs.py +++ b/dpgen/auto_test/gen_confs.py @@ -5,7 +5,7 @@ import re from pymatgen.analysis.structure_matcher import StructureMatcher -from pymatgen.ext.matproj import Composition, MPRester +from pymatgen.ext.matproj import MPRester import dpgen.auto_test.lib.crys as crys @@ -136,10 +136,10 @@ def _main(): print("generate %s" % (args.elements)) if len(args.elements) == 1: - gen_element(args.elements[0], key) + gen_element(args.elements[0], args.key) # gen_element_std(args.elements[0]) else: - gen_alloy(args.elements, key) + gen_alloy(args.elements, args.key) if __name__ == "__main__": diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index e5f0e2bd5..6a90fea8f 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -1,7 +1,5 @@ #!/usr/bin/python3 import os -import sys -from unicodedata import numeric import dpdata import numpy as np @@ -124,116 +122,6 @@ "Mt": 268, "Rg": 272, "Hs": 277, - "H": 1.0079, - "He": 4.0026, - "Li": 6.941, - "Be": 9.0122, - "B": 10.811, - "C": 12.0107, - "N": 14.0067, - "O": 15.9994, - "F": 18.9984, - "Ne": 20.1797, - "Na": 22.9897, - "Mg": 24.305, - "Al": 26.9815, - "Si": 28.0855, - "P": 30.9738, - "S": 32.065, - "Cl": 35.453, - "K": 39.0983, - "Ar": 39.948, - "Ca": 40.078, - "Sc": 44.9559, - "Ti": 47.867, - "V": 50.9415, - "Cr": 51.9961, - "Mn": 54.938, - "Fe": 55.845, - "Ni": 58.6934, - "Co": 58.9332, - "Cu": 63.546, - "Zn": 65.39, - "Ga": 69.723, - "Ge": 72.64, - "As": 74.9216, - "Se": 78.96, - "Br": 79.904, - "Kr": 83.8, - "Rb": 85.4678, - "Sr": 87.62, - "Y": 88.9059, - "Zr": 91.224, - "Nb": 92.9064, - "Mo": 95.94, - "Tc": 98, - "Ru": 101.07, - "Rh": 102.9055, - "Pd": 106.42, - "Ag": 107.8682, - "Cd": 112.411, - "In": 114.818, - "Sn": 118.71, - "Sb": 121.76, - "I": 126.9045, - "Te": 127.6, - "Xe": 131.293, - "Cs": 132.9055, - "Ba": 137.327, - "La": 138.9055, - "Ce": 140.116, - "Pr": 140.9077, - "Nd": 144.24, - "Pm": 145, - "Sm": 150.36, - "Eu": 151.964, - "Gd": 157.25, - "Tb": 158.9253, - "Dy": 162.5, - "Ho": 164.9303, - "Er": 167.259, - "Tm": 168.9342, - "Yb": 173.04, - "Lu": 174.967, - "Hf": 178.49, - "Ta": 180.9479, - "W": 183.84, - "Re": 186.207, - "Os": 190.23, - "Ir": 192.217, - "Pt": 195.078, - "Au": 196.9665, - "Hg": 200.59, - "Tl": 204.3833, - "Pb": 207.2, - "Bi": 208.9804, - "Po": 209, - "At": 210, - "Rn": 222, - "Fr": 223, - "Ra": 226, - "Ac": 227, - "Pa": 231.0359, - "Th": 232.0381, - "Np": 237, - "U": 238.0289, - "Am": 243, - "Pu": 244, - "Cm": 247, - "Bk": 247, - "Cf": 251, - "Es": 252, - "Fm": 257, - "Md": 258, - "No": 259, - "Rf": 261, - "Lr": 262, - "Db": 262, - "Bh": 264, - "Sg": 266, - "Mt": 268, - "Rg": 272, - "Hs": 277, } key_words_list = [ "ATOMIC_SPECIES", @@ -246,14 +134,13 @@ def poscar2stru(poscar, inter_param, stru="STRU"): - """ - - poscar: POSCAR for input + """- poscar: POSCAR for input - inter_param: dictionary of 'interaction' from param.json some key words for ABACUS are: - atom_masses: a dictionary of atoms' masses - orb_files: a dictionary of orbital files - deepks_desc: a string of deepks descriptor file - - stru: output filename, usally is 'STRU' + - stru: output filename, usally is 'STRU'. """ # if use dpdata.System, the structure will be rotated to make cell to be lower triangular with open(poscar) as fp: @@ -311,15 +198,14 @@ def poscar2stru(poscar, inter_param, stru="STRU"): def stru_fix_atom(struf, fix_atom=[True, True, True]): - """ - ... + """... ATOMIC_POSITIONS Cartesian #Cartesian(Unit is LATTICE_CONSTANT) Si #Name of element 0.0 #Magnetic for this element. 2 #Number of atoms 0.00 0.00 0.00 0 0 0 #x,y,z, move_x, move_y, move_z - 0.25 0.25 0.25 0 0 0 + 0.25 0.25 0.25 0 0 0. """ fix_xyz = ["0" if i else "1" for i in fix_atom] if os.path.isfile(struf): @@ -342,7 +228,7 @@ def stru_fix_atom(struf, fix_atom=[True, True, True]): elif flag_atom_number: flag_atom_number -= 1 x, y, z = lines[i].split()[:3] - lines[i] = "%s %s %s %s %s %s\n" % tuple([x, y, z] + fix_xyz) + lines[i] = "{} {} {} {} {} {}\n".format(*tuple([x, y, z] + fix_xyz)) elif flag_read_coord_type and flag_read_atom_number: flag_read_atom_number -= 1 elif not flag_read_atom_number: @@ -358,7 +244,7 @@ def stru_fix_atom(struf, fix_atom=[True, True, True]): def stru_scale(stru_in, stru_out, scale): - with open(stru_in, "r") as fin: + with open(stru_in) as fin: lines = fin.readlines() for i in range(len(lines)): if "LATTICE_CONSTANT" in lines[i]: @@ -404,7 +290,7 @@ def make_kspacing_kpt(struf, kspacing): def check_finished(fname): - with open(fname, "r") as fp: + with open(fname) as fp: return "Total Time :" in fp.read() @@ -421,7 +307,7 @@ def final_stru(abacus_path): calculation = line.split()[1] elif "out_stru" in line and line.split()[0] == "out_stru": out_stru = bool(line.split()[1]) - logf = os.path.join(abacus_path, "OUT.%s/running_%s.log" % (suffix, calculation)) + logf = os.path.join(abacus_path, f"OUT.{suffix}/running_{calculation}.log") if calculation in ["relax", "cell-relax"]: if not out_stru: return "OUT.%s/STRU_ION_D" % suffix @@ -439,7 +325,7 @@ def final_stru(abacus_path): else: max_step -= 2 break - return "OUT.%s/STRU_ION%s_D" % (suffix, str(max_step)) + return f"OUT.{suffix}/STRU_ION{str(max_step)}_D" elif calculation == "md": with open(logf) as f1: lines = f1.readlines() diff --git a/dpgen/auto_test/lib/lammps.py b/dpgen/auto_test/lib/lammps.py index cb27a8e98..d544d0d2b 100644 --- a/dpgen/auto_test/lib/lammps.py +++ b/dpgen/auto_test/lib/lammps.py @@ -1,9 +1,6 @@ #!/usr/bin/env python3 import os -import random -import subprocess as sp -import sys import dpdata from dpdata.periodic_table import Element @@ -13,9 +10,8 @@ def cvt_lammps_conf(fin, fout, type_map, ofmt="lammps/data"): - """ - Format convert from fin to fout, specify the output format by ofmt - Imcomplete situation + """Format convert from fin to fout, specify the output format by ofmt + Imcomplete situation. """ supp_ofmt = ["lammps/dump", "lammps/data", "vasp/poscar"] supp_exts = ["dump", "lmp", "poscar/POSCAR"] @@ -26,7 +22,7 @@ def cvt_lammps_conf(fin, fout, type_map, ofmt="lammps/data"): ofmt = "lammps/data" elif "poscar" in fout or "POSCAR" in fout: ofmt = "vasp/poscar" - if not ofmt in supp_ofmt: + if ofmt not in supp_ofmt: raise RuntimeError( "output format " + ofmt + " is not supported. use one of " + str(supp_ofmt) ) @@ -40,15 +36,14 @@ def cvt_lammps_conf(fin, fout, type_map, ofmt="lammps/data"): def apply_type_map(conf_file, deepmd_type_map, ptypes): - """ - apply type map. + """Apply type map. conf_file: conf file converted from POSCAR deepmd_type_map: deepmd atom type map - ptypes: atom types defined in POSCAR + ptypes: atom types defined in POSCAR. """ natoms = _get_conf_natom(conf_file) ntypes = len(deepmd_type_map) - with open(conf_file, "r") as fp: + with open(conf_file) as fp: lines = fp.read().split("\n") # with open(conf_file+'.bk', 'w') as fp: # fp.write("\n".join(lines)) @@ -85,7 +80,7 @@ def apply_type_map(conf_file, deepmd_type_map, ptypes): def _get_ntype(conf): - with open(conf, "r") as fp: + with open(conf) as fp: lines = fp.read().split("\n") for ii in lines: if "atom types" in ii: @@ -94,7 +89,7 @@ def _get_ntype(conf): def _get_conf_natom(conf): - with open(conf, "r") as fp: + with open(conf) as fp: lines = fp.read().split("\n") for ii in lines: if "atoms" in ii: @@ -405,9 +400,7 @@ def make_lammps_press_relax( def make_lammps_phonon( conf, masses, interaction, param, etol=0, ftol=1e-10, maxiter=5000, maxeval=500000 ): - """ - make lammps input for elastic calculation - """ + """Make lammps input for elastic calculation.""" ret = "" ret += "clear\n" ret += "units metal\n" @@ -426,7 +419,7 @@ def make_lammps_phonon( def _get_epa(lines): for ii in lines: - if ("Final energy per atoms" in ii) and (not "print" in ii): + if ("Final energy per atoms" in ii) and ("print" not in ii): return float(ii.split("=")[1].split()[0]) raise RuntimeError( 'cannot find key "Final energy per atoms" in lines, something wrong' @@ -435,7 +428,7 @@ def _get_epa(lines): def _get_vpa(lines): for ii in lines: - if ("Final volume per atoms" in ii) and (not "print" in ii): + if ("Final volume per atoms" in ii) and ("print" not in ii): return float(ii.split("=")[1].split()[0]) raise RuntimeError( 'cannot find key "Final volume per atoms" in lines, something wrong' @@ -444,7 +437,7 @@ def _get_vpa(lines): def _get_natoms(lines): for ii in lines: - if ("Total number of atoms" in ii) and (not "print" in ii): + if ("Total number of atoms" in ii) and ("print" not in ii): return int(ii.split("=")[1].split()[0]) raise RuntimeError( 'cannot find key "Total number of atoms" in lines, something wrong' @@ -452,10 +445,8 @@ def _get_natoms(lines): def get_nev(log): - """ - get natoms, energy_per_atom and volume_per_atom from lammps log - """ - with open(log, "r") as fp: + """Get natoms, energy_per_atom and volume_per_atom from lammps log.""" + with open(log) as fp: lines = fp.read().split("\n") epa = _get_epa(lines) vpa = _get_vpa(lines) @@ -464,34 +455,28 @@ def get_nev(log): def get_base_area(log): - """ - get base area - """ - with open(log, "r") as fp: + """Get base area.""" + with open(log) as fp: lines = fp.read().split("\n") for ii in lines: - if ("Final Base area" in ii) and (not "print" in ii): + if ("Final Base area" in ii) and ("print" not in ii): return float(ii.split("=")[1].split()[0]) def get_stress(log): - """ - get stress from lammps log - """ - with open(log, "r") as fp: + """Get stress from lammps log.""" + with open(log) as fp: lines = fp.read().split("\n") for ii in lines: - if ("Final Stress" in ii) and (not "print" in ii): + if ("Final Stress" in ii) and ("print" not in ii): vstress = [float(jj) for jj in ii.split("=")[1].split()] stress = util.voigt_to_stress(vstress) return stress def poscar_from_last_dump(dump, poscar_out, deepmd_type_map): - """ - get poscar from the last frame of a lammps MD traj (dump format) - """ - with open(dump, "r") as fp: + """Get poscar from the last frame of a lammps MD traj (dump format).""" + with open(dump) as fp: lines = fp.read().split("\n") step_idx = -1 for idx, ii in enumerate(lines): @@ -503,7 +488,7 @@ def poscar_from_last_dump(dump, poscar_out, deepmd_type_map): fp.write("\n".join(lines[step_idx:])) cvt_lammps_conf("tmp_dump", poscar_out, ofmt="vasp") os.remove("tmp_dump") - with open(poscar_out, "r") as fp: + with open(poscar_out) as fp: lines = fp.read().split("\n") types = [deepmd_type_map[int(ii.split("_")[1])] for ii in lines[5].split()] lines[5] = " ".join(types) @@ -512,15 +497,15 @@ def poscar_from_last_dump(dump, poscar_out, deepmd_type_map): def check_finished_new(fname, keyword): - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") flag = False for jj in lines: - if (keyword in jj) and (not "print" in jj): + if (keyword in jj) and ("print" not in jj): flag = True return flag def check_finished(fname): - with open(fname, "r") as fp: + with open(fname) as fp: return "Total wall time:" in fp.read() diff --git a/dpgen/auto_test/lib/lmp.py b/dpgen/auto_test/lib/lmp.py index 15705ec8a..e0894398a 100644 --- a/dpgen/auto_test/lib/lmp.py +++ b/dpgen/auto_test/lib/lmp.py @@ -170,7 +170,7 @@ def from_system_data(system): ret += "0 %f xlo xhi\n" % system["cell"][0][0] ret += "0 %f ylo yhi\n" % system["cell"][1][1] ret += "0 %f zlo zhi\n" % system["cell"][2][2] - ret += "%f %f %f xy xz yz\n" % ( + ret += "{:f} {:f} {:f} xy xz yz\n".format( system["cell"][1][0], system["cell"][2][0], system["cell"][2][1], diff --git a/dpgen/auto_test/lib/mfp_eosfit.py b/dpgen/auto_test/lib/mfp_eosfit.py index 148c9b5f8..06a26d629 100755 --- a/dpgen/auto_test/lib/mfp_eosfit.py +++ b/dpgen/auto_test/lib/mfp_eosfit.py @@ -1,17 +1,13 @@ #!/usr/bin/env python3 -from __future__ import division import argparse import os -import sys import matplotlib.pyplot as plt import numpy as np -import scipy.integrate as INT -from scipy.interpolate import * -from scipy.misc import derivative -from scipy.optimize import curve_fit, fsolve, leastsq, minimize, root +from scipy.interpolate import BPoly, LSQUnivariateSpline, UnivariateSpline, interp1d +from scipy.optimize import fsolve, leastsq kb = 1.3806488e-23 # J K^-1 kb_ev = 8.6173324e-05 # eV K^-1 @@ -81,9 +77,8 @@ def res_murnaghan(pars, y, x): def murnaghan(vol, pars): - """ - Four-parameters murnaghan EOS. - From PRB 28,5480 (1983) + """Four-parameters murnaghan EOS. + From PRB 28,5480 (1983). """ e0 = pars[0] b0 = pars[1] @@ -108,10 +103,9 @@ def res_birch(pars, y, x): def birch(v, parameters): - """ - From Intermetallic compounds: Principles and Practice, Vol. I: Princples + """From Intermetallic compounds: Principles and Practice, Vol. I: Princples Chapter 9 pages 195-210 by M. Mehl. B. Klein, D. Papaconstantopoulos - paper downloaded from Web + paper downloaded from Web. case where n=0 """ @@ -146,9 +140,7 @@ def calc_props_mBM4(pars): def mBM4(vol, pars): - """ - Birch-Murnaghan 4 pars equation from PRB 70, 224107, 3-order BM - """ + """Birch-Murnaghan 4 pars equation from PRB 70, 224107, 3-order BM.""" e0 = pars[0] b0 = pars[1] bp = pars[2] @@ -171,9 +163,7 @@ def res_mBM5(pars, y, x): def mBM5(vol, pars): - """ - modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048 - """ + """Modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048.""" e0 = pars[0] b0 = pars[1] bp = pars[2] @@ -207,9 +197,7 @@ def res_mBM4poly(pars, y, x): def mBM4poly(vol, parameters): - """ - modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048, original expressions. - """ + """Modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048, original expressions.""" a = parameters[0] b = parameters[1] c = parameters[2] @@ -283,9 +271,7 @@ def res_mBM5poly(pars, y, x): def mBM5poly(vol, pars): - """ - modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048, original expressions. - """ + """Modified BM5 EOS, Shang SL comput mater sci, 2010: 1040-1048, original expressions.""" a = pars[0] b = pars[1] c = pars[2] @@ -395,9 +381,7 @@ def calc_props_BM4(pars): def BM4(vol, pars): - """ - Birch-Murnaghan 4 pars equation from PRB 70, 224107, 3-order - """ + """Birch-Murnaghan 4 pars equation from PRB 70, 224107, 3-order.""" e0 = pars[0] b0 = pars[1] bp = pars[2] @@ -416,9 +400,7 @@ def res_BM5(pars, y, x): def BM5(vol, pars): - """ - Birch-Murnaghan 5 pars equation from PRB 70, 224107, 4-Order - """ + """Birch-Murnaghan 5 pars equation from PRB 70, 224107, 4-Order.""" e0 = pars[0] b0 = pars[1] b0p = pars[2] @@ -445,9 +427,8 @@ def BM5(vol, pars): def rBM4(vol, pars): - """ - Implementions as Alberto Otero-de-la-Roza, i.e. rBM4 is used here - Comput Physics Comm, 2011, 182: 1708-1720 + """Implementions as Alberto Otero-de-la-Roza, i.e. rBM4 is used here + Comput Physics Comm, 2011, 182: 1708-1720. """ e0 = pars[0] b0 = pars[1] @@ -466,10 +447,9 @@ def res_rBM4(pars, y, x): def rBM4_pv(vol, pars): - """ - Implementions as Alberto Otero-de-la-Roza, i.e. rBM4 is used here + """Implementions as Alberto Otero-de-la-Roza, i.e. rBM4 is used here Comput Physics Comm, 2011, 182: 1708-1720 - Fit for V-P relations + Fit for V-P relations. """ e0 = pars[0] b0 = pars[1] @@ -482,15 +462,14 @@ def rBM4_pv(vol, pars): return P -def res_rBM4_pv(par, y, x): +def res_rBM4_pv(pars, y, x): res = y - rBM4_pv(x, pars) return res def rBM5(vol, pars): - """ - Implementions as Alberto Otero-de-la-Roza, i.e. rBM5 is used here - Comput Physics Comm, 2011, 182: 1708-1720 + """Implementions as Alberto Otero-de-la-Roza, i.e. rBM5 is used here + Comput Physics Comm, 2011, 182: 1708-1720. """ e0 = pars[0] b0 = pars[1] @@ -514,10 +493,9 @@ def res_rBM5(pars, y, x): def rBM5_pv(vol, pars): - """ - Implementions as Alberto Otero-de-la-Roza, i.e. rBM5 is used here + """Implementions as Alberto Otero-de-la-Roza, i.e. rBM5 is used here Comput Physics Comm, 2011, 182: 1708-1720 - Fit for V-P relations + Fit for V-P relations. """ e0 = pars[0] b0 = pars[1] @@ -538,7 +516,7 @@ def rBM5_pv(vol, pars): return P -def res_rBM5_pv(par, y, x): +def res_rBM5_pv(pars, y, x): res = y - rBM5_pv(x, pars) return res @@ -551,9 +529,7 @@ def res_universal(pars, y, x): def universal(vol, parameters): - """ - Universal equation of state(Vinet P et al., J. Phys.: Condens. Matter 1, p1941 (1989)) - """ + """Universal equation of state(Vinet P et al., J. Phys.: Condens. Matter 1, p1941 (1989)).""" e0 = parameters[0] b0 = parameters[1] bp = parameters[2] @@ -580,8 +556,7 @@ def res_LOG4(pars, y, x): def LOG4(vol, pars): - """ - Natrual strain (Poirier-Tarantola)EOS with 4 paramters + """Natrual strain (Poirier-Tarantola)EOS with 4 paramters Seems only work in near-equillibrium range. """ e0 = pars[0] @@ -622,8 +597,7 @@ def calc_props_LOG4(pars): def rPT4(vol, pars): - """ - Natrual strain EOS with 4 paramters + """Natrual strain EOS with 4 paramters Seems only work in near-equillibrium range. Implementions as Alberto Otero-de-la-Roza, i.e. rPT4 is used here Comput Physics Comm, 2011, 182: 1708-1720, @@ -647,8 +621,7 @@ def res_rPT4(pars, y, x): def rPT4_pv(vol, pars): - """ - Natrual strain (Poirier-Tarantola)EOS with 4 paramters + """Natrual strain (Poirier-Tarantola)EOS with 4 paramters Seems only work in near-equillibrium range. Implementions as Alberto Otero-de-la-Roza, i.e. rPT4 is used here Comput Physics Comm, 2011, 182: 1708-1720, @@ -677,9 +650,7 @@ def res_LOG5(pars, y, x): def LOG5(vol, parameters): - """ - Natrual strain (Poirier-Tarantola)EOS with 5 paramters - """ + """Natrual strain (Poirier-Tarantola)EOS with 5 paramters.""" e0 = parameters[0] b0 = parameters[1] b0p = parameters[2] @@ -708,8 +679,7 @@ def LOG5(vol, parameters): def rPT5(vol, pars): - """ - Natrual strain EOS with 4 paramters + """Natrual strain EOS with 4 paramters Seems only work in near-equillibrium range. Implementions as Alberto Otero-de-la-Roza, i.e. rPT5 is used here Comput Physics Comm, 2011, 182: 1708-1720, @@ -738,8 +708,7 @@ def res_rPT5(pars, y, x): def rPT5_pv(vol, pars): - """ - Natrual strain (Poirier-Tarantola)EOS with 5 paramters + """Natrual strain (Poirier-Tarantola)EOS with 5 paramters Implementions as Alberto Otero-de-la-Roza, i.e. rPT5 is used here Comput Physics Comm, 2011, 182: 1708-1720, in their article, labeled as PT3 (3-order), however, we mention it as @@ -788,8 +757,7 @@ def calc_props_vinet(pars): def vinet(vol, pars): - """ - Vinet equation from PRB 70, 224107 + """Vinet equation from PRB 70, 224107 Following, Shang Shunli et al., comput mater sci, 2010: 1040-1048, original expressions. """ e0 = pars[0] @@ -816,14 +784,14 @@ def vinet_pv(vol, pars): return P -def res_vinet_pv(par, y, x): +def res_vinet_pv(pars, y, x): res = y - vinet(x, pars) return res # ---------------------------------------------------------------------------------------- def Li4p(V, parameters): - """Li JH, APL, 87, 194111 (2005)""" + """Li JH, APL, 87, 194111 (2005).""" E0 = parameters[0] B0 = parameters[1] BP = parameters[2] @@ -884,9 +852,7 @@ def res_morse(p, en, volume): def morse_AB(volume, p): - """ - morse_AB EOS formula from Song's FVT souces - """ + """morse_AB EOS formula from Song's FVT souces.""" # p0 = [e0, b0, bp, v0, bpp] E0 = p[0] A = p[1] @@ -909,9 +875,8 @@ def res_morse_AB(p, en, volume): def morse_3p(volume, p): - """ - morse_AB EOS formula from Song's FVT souces - A= 0.5*B + """morse_AB EOS formula from Song's FVT souces + A= 0.5*B. """ # p0 = [e0, b0, bp, v0, bpp] E0 = p[0] @@ -935,8 +900,7 @@ def res_morse_3p(p, en, volume): def morse_6p(vol, par): - """ - Generalized Morse EOS proposed by Qin, see: + """Generalized Morse EOS proposed by Qin, see: Qin et al. Phys Rev B, 2008, 78, 214108. Qin et al. Phys Rev B, 2008, 77, 220103(R). """ @@ -985,9 +949,7 @@ def res_morse_6p(p, en, volume): # ---------------------------------------------------------------------------------------- def mie(v, p): - """ - Mie model for song's FVT - """ + """Mie model for song's FVT.""" # p0 = [e0, b0, bp, v0, bpp] E0 = p[0] m = p[1] @@ -1006,9 +968,7 @@ def res_mie(p, e, v): def mie_simple(v, p): - """ - Mie_simple model for song's FVT - """ + """Mie_simple model for song's FVT.""" # p0 = [e0, b0, bp, v0, bpp] E0 = p[0] m = 4 @@ -1028,9 +988,8 @@ def res_mie_simple(p, e, v): # ---------------------------------------------------------------------------------------- def TEOS(v, par): - """ - Holland, et al, Journal of Metamorphic Geology, 2011, 29(3): 333-383 - Modified Tait equation of Huang & Chow + """Holland, et al, Journal of Metamorphic Geology, 2011, 29(3): 333-383 + Modified Tait equation of Huang & Chow. """ e0 = par[0] b0 = par[1] @@ -1056,8 +1015,7 @@ def res_TEOS(p, e, v): # ---------------------------------------------------------------------------------------- def SJX_v2(vol, par): - """ - Sun Jiuxun, et al. J phys Chem Solids, 2005, 66: 773-782. + """Sun Jiuxun, et al. J phys Chem Solids, 2005, 66: 773-782. They said it is satified for the limiting condition at high pressure. """ e0 = par[0] @@ -1087,9 +1045,7 @@ def res_SJX_v2(p, e, v): def SJX_5p(vol, par): - """ - SJX_5p's five parameters EOS, Physica B: Condens Mater, 2011, 406: 1276-1282 - """ + """SJX_5p's five parameters EOS, Physica B: Condens Mater, 2011, 406: 1276-1282.""" e0 = par[0] a = par[1] b = par[2] @@ -1188,7 +1144,7 @@ def read_vlp(fin, fstart, fend): cellc.append(c) cellba.append(ba) cellca.append(ca) - print("\n** Vmin = %f, Vmax = %f" % (min(vol), max(vol))) + print(f"\n** Vmin = {min(vol):f}, Vmax = {max(vol):f}") # some special conditions if fstart <= 0: @@ -1268,7 +1224,7 @@ def read_velp(fin, fstart, fend): cellc.append(c) cellba.append(ba) cellca.append(ca) - print("\n** Vmin = %f, Vmax = %f" % (min(vol), max(vol))) + print(f"\n** Vmin = {min(vol):f}, Vmax = {max(vol):f}") # some special conditions if fstart <= 0: @@ -1351,8 +1307,7 @@ def repro_vp(func, vol_i, pars): def ext_vec( func, fin, p0, fs, fe, vols=None, vole=None, ndata=101, refit=0, show_fig=False ): - """ - extrapolate the data points for E-V based on the fitted parameters in small or + """Extrapolate the data points for E-V based on the fitted parameters in small or very large volume range. """ # read fitted-parameters @@ -1381,7 +1336,7 @@ def ext_vec( cax = cellca[-1] else: cax = sca(vx) - fw.write("%f\t%f\t%f\n" % (vx, ex, cax)) + fw.write(f"{vx:f}\t{ex:f}\t{cax:f}\n") fw.flush() fw.close() @@ -1406,7 +1361,7 @@ def ext_splint(xp, yp, order=3, method="unispl"): SPLINT = interp1d return SPLINT(xp, yp, order, bounds_error=False) elif method == "piecepoly": - SPLINT = PiecewisePolynomial + SPLINT = BPoly.from_derivatives return SPLINT(xp, yp, order) else: if method == "unispl": @@ -1429,9 +1384,7 @@ def ext_velp( fout="ext_velp.dat", show_fig=False, ): - """ - extrapolate the lattice parameters based on input data - """ + """Extrapolate the lattice parameters based on input data.""" # read file vol, eng, cella, cellb, cellc, cellba, cellca = read_velp(fin, fstart, fend) @@ -1488,8 +1441,7 @@ def ext_velp( ) for i in range(ndata): fw.write( - "%12.6f\t%12.6f\t%12.6f\t%12.6f\t%12.6f\t%12.6f\t%12.6f\t%12.6f\n" - % ( + "{:12.6f}\t{:12.6f}\t{:12.6f}\t{:12.6f}\t{:12.6f}\t{:12.6f}\t{:12.6f}\t{:12.6f}\n".format( vv[i], ee[i], cellaa[i], @@ -1612,16 +1564,16 @@ def lsqfit_eos( if func == "morse_AB": e0, A, B, v0 = popt print("%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "A", "B", "E0(eV)")) - print("%12f\t%12f\t%12f\t%12f\n" % (v0, A, B, e0)) + print(f"{v0:12f}\t{A:12f}\t{B:12f}\t{e0:12f}\n") elif func == "morse_3p": e0, A, v0 = popt B = 0.5 * A print("%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "A", "B", "E0(eV)")) - print("%12f\t%12f\t%12f\t%12f\n" % (v0, A, B, e0)) + print(f"{v0:12f}\t{A:12f}\t{B:12f}\t{e0:12f}\n") elif func in ["mie", "mie_simple"]: e0, m, n, v0 = popt print("%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "m", "n", "E0(eV)")) - print("%12f\t%12f\t%12f\t%12f\n" % (v0, m, n, e0)) + print(f"{v0:12f}\t{m:12f}\t{n:12f}\t{e0:12f}\n") elif func == "morse_6p": e0, b0, bp, v0, bpp, m, n = calc_props_morse_6p(popt) b0 = eV2GPa * b0 @@ -1630,9 +1582,7 @@ def lsqfit_eos( "%12s\t%12s\t%12s\t%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "B0(GPa)", "Bp", "E0(eV)", "Bpp(1/GPa)", "m", "n") ) - print( - "%12f\t%12f\t%12f\t%12f\t%12f\t%12f\t%12f\n" % (v0, b0, bp, e0, bpp, m, n) - ) + print(f"{v0:12f}\t{b0:12f}\t{bp:12f}\t{e0:12f}\t{bpp:12f}\t{m:12f}\t{n:12f}\n") elif func == "SJX_5p": e0, b0, bp, v0, n = calc_props_SJX_5p(popt) b0 = eV2GPa * b0 @@ -1640,7 +1590,7 @@ def lsqfit_eos( "%12s\t%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "B0(GPa)", "Bp", "E0(eV)", "n") ) - print("%12f\t%12f\t%12f\t%12f\t%12f\n" % (v0, b0, bp, e0, n)) + print(f"{v0:12f}\t{b0:12f}\t{bp:12f}\t{e0:12f}\t{n:12f}\n") elif func in ["mBM4poly", "mBM5poly", "mBM4", "LOG4", "vinet", "morse", "BM4"]: prop_func = eval("calc_props_" + func) e0, b0, bp, v0, bpp = prop_func(popt) @@ -1650,7 +1600,7 @@ def lsqfit_eos( "%12s\t%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "B0(GPa)", "Bp", "E0(eV)", "Bpp(1/GPa)") ) - print("%12f\t%12f\t%12f\t%12f\t%12f\n" % (v0, b0, bp, e0, bpp)) + print(f"{v0:12f}\t{b0:12f}\t{bp:12f}\t{e0:12f}\t{bpp:12f}\n") else: e0, b0, bp, v0, bpp = popt b0 = eV2GPa * b0 @@ -1659,7 +1609,7 @@ def lsqfit_eos( "%12s\t%12s\t%12s\t%12s\t%12s" % ("V0(A**3)", "B0(GPa)", "Bp", "E0(eV)", "Bpp(1/GPa)") ) - print("%12f\t%12f\t%12f\t%12f\t%12f\n" % (v0, b0, bp, e0, bpp)) + print(f"{v0:12f}\t{b0:12f}\t{bp:12f}\t{e0:12f}\t{bpp:12f}\n") # write the fitted results in fit.out fw = open(fout, "w+") @@ -1712,12 +1662,17 @@ def lsqfit_eos( ) for i in range(len(vol)): fve.write( - "%20f\t%20f\t%20f\t%20f\n" - % (vol[i], repro_en[i], en[i], 100 * np.abs((en[i] - repro_en[i]) / en[i])) + "{:20f}\t{:20f}\t{:20f}\t{:20f}\n".format( + vol[i], repro_en[i], en[i], 100 * np.abs((en[i] - repro_en[i]) / en[i]) + ) ) fve.flush() p_tmp = repro_press[i] - fvp.write("%20f\t%20f\t%20f\t%20f\n" % (vol[i], p_tmp, p_tmp / 100, p_tmp * 10)) + fvp.write( + "{:20f}\t{:20f}\t{:20f}\t{:20f}\n".format( + vol[i], p_tmp, p_tmp / 100, p_tmp * 10 + ) + ) fvp.flush() fve.close() fvp.close() diff --git a/dpgen/auto_test/lib/pwscf.py b/dpgen/auto_test/lib/pwscf.py index d3844497b..eb3efddcd 100644 --- a/dpgen/auto_test/lib/pwscf.py +++ b/dpgen/auto_test/lib/pwscf.py @@ -72,7 +72,7 @@ def _make_pwscf_03_config(sys_data): cc = 0 for ii in range(ntypes): for jj in range(atom_numbs[ii]): - ret += "%s %f %f %f\n" % ( + ret += "{} {:f} {:f} {:f}\n".format( atom_names[ii], coordinates[cc][0], coordinates[cc][1], @@ -116,7 +116,7 @@ def _make_smearing(fp_params): degauss = fp_params["sigma"] if (smearing is not None) and (smearing.split(":")[0] == "mp"): smearing = "mp" - if not (smearing in [None, "gauss", "mp", "fd"]): + if smearing not in [None, "gauss", "mp", "fd"]: raise RuntimeError("unknow smearing method " + smearing) return smearing, degauss diff --git a/dpgen/auto_test/lib/util.py b/dpgen/auto_test/lib/util.py index 76005bdbc..4e355fbd1 100644 --- a/dpgen/auto_test/lib/util.py +++ b/dpgen/auto_test/lib/util.py @@ -4,7 +4,6 @@ import numpy as np import requests -from dpgen import dlog from dpgen.auto_test.lib import abacus, lammps, vasp from dpgen.auto_test.lib.utils import cmd_append_log @@ -28,10 +27,7 @@ def voigt_to_stress(inpt): def insert_data(task, task_type, username, file_name): assert task in ["eos", "elastic", "surf"] assert task_type in ["vasp", "deepmd"] - url = ( - "http://115.27.161.2:5000/insert_test_data?username=%s&expr_type=%s&data_type=%s" - % (username, task_type, task) - ) + url = f"http://115.27.161.2:5000/insert_test_data?username={username}&expr_type={task_type}&data_type={task}" res = requests.post(url, data=open(file_name).read()) print("Successful upload!") diff --git a/dpgen/auto_test/lib/utils.py b/dpgen/auto_test/lib/utils.py index cba2f25fc..1fd4f7af7 100644 --- a/dpgen/auto_test/lib/utils.py +++ b/dpgen/auto_test/lib/utils.py @@ -29,7 +29,7 @@ def create_path(path): def replace(file_name, pattern, subst): - file_handel = open(file_name, "r") + file_handel = open(file_name) file_string = file_handel.read() file_handel.close() file_string = re.sub(pattern, subst, file_string) @@ -71,4 +71,4 @@ def log_task(message): def record_iter(record, confs, ii, jj): with open(record, "a") as frec: - frec.write("%s %s %s\n" % (confs, ii, jj)) + frec.write(f"{confs} {ii} {jj}\n") diff --git a/dpgen/auto_test/lib/vasp.py b/dpgen/auto_test/lib/vasp.py index 1aa0793b7..9efeea04a 100644 --- a/dpgen/auto_test/lib/vasp.py +++ b/dpgen/auto_test/lib/vasp.py @@ -3,9 +3,8 @@ import warnings import numpy as np -from pymatgen.io.vasp import Incar, Kpoints, Potcar +from pymatgen.io.vasp import Incar, Kpoints -import dpgen.auto_test.lib.lammps as lammps import dpgen.auto_test.lib.util as util from dpgen.generator.lib.vasp import incar_upper @@ -30,14 +29,14 @@ class OutcarItemError(Exception): def regulate_poscar(poscar_in, poscar_out): - with open(poscar_in, "r") as fp: + with open(poscar_in) as fp: lines = fp.read().split("\n") names = lines[5].split() counts = [int(ii) for ii in lines[6].split()] assert len(names) == len(counts) uniq_name = [] for ii in names: - if not (ii in uniq_name): + if ii not in uniq_name: uniq_name.append(ii) uniq_count = np.zeros(len(uniq_name), dtype=int) for nn, cc in zip(names, counts): @@ -63,7 +62,7 @@ def regulate_poscar(poscar_in, poscar_out): def sort_poscar(poscar_in, poscar_out, new_names): - with open(poscar_in, "r") as fp: + with open(poscar_in) as fp: lines = fp.read().split("\n") names = lines[5].split() counts = [int(ii) for ii in lines[6].split()] @@ -91,7 +90,7 @@ def sort_poscar(poscar_in, poscar_out, new_names): def perturb_xz(poscar_in, poscar_out, pert=0.01): - with open(poscar_in, "r") as fp: + with open(poscar_in) as fp: lines = fp.read().split("\n") zz = lines[4] az = [float(ii) for ii in zz.split()] @@ -115,7 +114,7 @@ def reciprocal_box(box): def make_kspacing_kpoints(poscar, kspacing, kgamma): if type(kspacing) is not list: kspacing = [kspacing, kspacing, kspacing] - with open(poscar, "r") as fp: + with open(poscar) as fp: lines = fp.read().split("\n") scale = float(lines[1]) box = [] @@ -135,7 +134,7 @@ def make_kspacing_kpoints(poscar, kspacing, kgamma): def get_energies(fname): if not check_finished(fname): warnings.warn("incomplete outcar: " + fname) - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") try: ener = _get_energies(lines) @@ -147,7 +146,7 @@ def get_energies(fname): def get_boxes(fname): if not check_finished(fname): warnings.warn("incomplete outcar: " + fname) - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") try: ener = _get_boxes(lines) @@ -159,7 +158,7 @@ def get_boxes(fname): def get_nev(fname): if not check_finished(fname): warnings.warn("incomplete outcar: " + fname) - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") try: natoms = _get_natoms(lines) @@ -174,7 +173,7 @@ def get_nev(fname): def get_stress(fname): if not check_finished(fname): warnings.warn("incomplete outcar: " + fname) - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") try: stress = _get_stress(lines)[-1] @@ -184,7 +183,7 @@ def get_stress(fname): def check_finished(fname): - with open(fname, "r") as fp: + with open(fname) as fp: return "Elapsed time (sec):" in fp.read() @@ -397,13 +396,13 @@ def make_vasp_phonon_incar( def get_poscar_types(fname): - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") return lines[5].split() def get_poscar_natoms(fname): - with open(fname, "r") as fp: + with open(fname) as fp: lines = fp.read().split("\n") return [int(ii) for ii in lines[6].split()] @@ -432,24 +431,24 @@ def _poscar_scale_cartesian(str_in, scale): boxl = lines[ii].split() boxv = [float(ii) for ii in boxl] boxv = np.array(boxv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (boxv[0], boxv[1], boxv[2]) + lines[ii] = f"{boxv[0]:.16e} {boxv[1]:.16e} {boxv[2]:.16e}\n" # scale coord for ii in range(8, 8 + numb_atoms): cl = lines[ii].split() cv = [float(ii) for ii in cl] cv = np.array(cv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (cv[0], cv[1], cv[2]) + lines[ii] = f"{cv[0]:.16e} {cv[1]:.16e} {cv[2]:.16e}\n" return lines def poscar_natoms(poscar_in): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) return _poscar_natoms(lines) def poscar_scale(poscar_in, poscar_out, scale): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) if "D" == lines[7][0] or "d" == lines[7][0]: lines = _poscar_scale_direct(lines, scale) @@ -462,7 +461,7 @@ def poscar_scale(poscar_in, poscar_out, scale): def poscar_vol(poscar_in): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) box = [] for ii in range(2, 5): diff --git a/dpgen/auto_test/mpdb.py b/dpgen/auto_test/mpdb.py index c6409013a..db1121e41 100644 --- a/dpgen/auto_test/mpdb.py +++ b/dpgen/auto_test/mpdb.py @@ -1,6 +1,5 @@ import os -from pymatgen.core import Structure from pymatgen.ext.matproj import MPRester, MPRestError from dpgen import dlog diff --git a/dpgen/auto_test/refine.py b/dpgen/auto_test/refine.py index d44bd15d7..cd0fcd8f0 100644 --- a/dpgen/auto_test/refine.py +++ b/dpgen/auto_test/refine.py @@ -58,7 +58,7 @@ def make_refine(init_from_suffix, output_suffix, path_to_work): os.symlink(os.path.relpath(init_poscar), POSCAR) else: raise FileNotFoundError( - "no %s or %s in the init_from directory" % (CONTCAR, POSCAR) + f"no {CONTCAR} or {POSCAR} in the init_from directory" ) os.chdir(cwd) diff --git a/dpgen/auto_test/reproduce.py b/dpgen/auto_test/reproduce.py index ce4c7483c..ada3102fb 100644 --- a/dpgen/auto_test/reproduce.py +++ b/dpgen/auto_test/reproduce.py @@ -46,7 +46,7 @@ def make_repro( if os.path.exists(os.path.join(path_to_work, "element.out")): os.remove(os.path.join(path_to_work, "element.out")) fout_element = open(os.path.join(path_to_work, "element.out"), "a+") - fin_element = open(os.path.join(init_data_path_todo, "element.out"), "r") + fin_element = open(os.path.join(init_data_path_todo, "element.out")) for ii in init_data_task_todo: # get frame number @@ -153,7 +153,7 @@ def post_repro( output_ener_tot.extend(output_task_result["energies"]) init_epa = init_ener[jj - idid] / natoms - ptr_data += "%s %7.3f %7.3f %7.3f\n" % ( + ptr_data += "{} {:7.3f} {:7.3f} {:7.3f}\n".format( ii, init_epa, output_epa, diff --git a/dpgen/collect/collect.py b/dpgen/collect/collect.py index faadf6336..808341e6f 100644 --- a/dpgen/collect/collect.py +++ b/dpgen/collect/collect.py @@ -4,10 +4,8 @@ import glob import json import os -import sys import dpdata -import numpy as np from dpgen.generator.run import data_system_fmt diff --git a/dpgen/data/arginfo.py b/dpgen/data/arginfo.py index 6bbcd3fa1..ca7ac4b69 100644 --- a/dpgen/data/arginfo.py +++ b/dpgen/data/arginfo.py @@ -1,6 +1,6 @@ -from typing import Dict, List +from typing import List -from dargs import Argument, ArgumentEncoder, Variant +from dargs import Argument, Variant from dpgen.arginfo import general_mdata_arginfo diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index 14314ada8..83bd59745 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -3,14 +3,11 @@ import argparse import glob import json -import logging import os -import random import re import shutil import subprocess as sp import sys -import time import warnings import dpdata @@ -31,7 +28,6 @@ get_abacus_STRU, make_abacus_scf_kpt, make_abacus_scf_stru, - make_kspacing_kpoints_stru, make_supercell_abacus, ) from dpgen.generator.lib.utils import symlink_user_forward_files @@ -62,7 +58,7 @@ def create_path(path, back=False): def replace(file_name, pattern, subst): - file_handel = open(file_name, "r") + file_handel = open(file_name) file_string = file_handel.read() file_handel.close() file_string = re.sub(pattern, subst, file_string) @@ -130,7 +126,7 @@ def poscar_ele(poscar_in, poscar_out, eles, natoms): ele_line += str(ii) + " " for ii in natoms: natom_line += str(ii) + " " - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) lines[5] = ele_line + "\n" lines[6] = natom_line + "\n" @@ -188,7 +184,7 @@ def poscar_natoms(lines): def poscar_shuffle(poscar_in, poscar_out): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) numb_atoms = poscar_natoms(lines) idx = np.arange(8, 8 + numb_atoms) @@ -229,18 +225,18 @@ def poscar_scale_cartesian(str_in, scale): boxl = lines[ii].split() boxv = [float(ii) for ii in boxl] boxv = np.array(boxv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (boxv[0], boxv[1], boxv[2]) + lines[ii] = f"{boxv[0]:.16e} {boxv[1]:.16e} {boxv[2]:.16e}\n" # scale coord for ii in range(8, 8 + numb_atoms): cl = lines[ii].split() cv = [float(ii) for ii in cl] cv = np.array(cv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (cv[0], cv[1], cv[2]) + lines[ii] = f"{cv[0]:.16e} {cv[1]:.16e} {cv[2]:.16e}\n" return lines def poscar_scale(poscar_in, poscar_out, scale): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) if "D" == lines[7][0] or "d" == lines[7][0]: lines = poscar_scale_direct(lines, scale) @@ -366,7 +362,7 @@ def make_super_cell_poscar(jdata): from_struct.to(to_file, "poscar") # make system dir (copy) - lines = open(to_file, "r").read().split("\n") + lines = open(to_file).read().split("\n") natoms_str = lines[6] natoms_list = [int(ii) for ii in natoms_str.split()] dlog.info(natoms_list) @@ -1079,7 +1075,7 @@ def coll_vasp_md(jdata): # dlog.info("OUTCAR",outcar) if os.path.isfile(outcar): # dlog.info("*"*40) - with open(outcar, "r") as fin: + with open(outcar) as fin: nforce = fin.read().count("TOTAL-FORCE") # dlog.info("nforce is", nforce) # dlog.info("md_nstep", md_nstep) @@ -1095,8 +1091,8 @@ def coll_vasp_md(jdata): arg_cvt = " " if len(valid_outcars) == 0: raise RuntimeError( - "MD dir: %s: find no valid outcar in sys %s, " - "check if your vasp md simulation is correctly done" % (path_md, ii) + "MD dir: {}: find no valid outcar in sys {}, " + "check if your vasp md simulation is correctly done".format(path_md, ii) ) flag = True @@ -1127,7 +1123,7 @@ def coll_vasp_md(jdata): def _vasp_check_fin(ii): if os.path.isfile(os.path.join(ii, "OUTCAR")): - with open(os.path.join(ii, "OUTCAR"), "r") as fp: + with open(os.path.join(ii, "OUTCAR")) as fp: content = fp.read() count = content.count("Elapse") if count != 1: @@ -1233,8 +1229,10 @@ def coll_abacus_md(jdata): arg_cvt = " " if len(valid_outcars) == 0: raise RuntimeError( - "MD dir: %s: find no valid OUT.ABACUS in sys %s, " - "check if your abacus md simulation is correctly done." % (path_md, ii) + "MD dir: {}: find no valid OUT.ABACUS in sys {}, " + "check if your abacus md simulation is correctly done.".format( + path_md, ii + ) ) flag = True @@ -1469,17 +1467,17 @@ def run_abacus_md(jdata, mdata): def gen_init_bulk(args): try: import ruamel - from monty.serialization import dumpfn, loadfn + from monty.serialization import loadfn warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) jdata = loadfn(args.PARAM) if args.MACHINE is not None: mdata = loadfn(args.MACHINE) except Exception: - with open(args.PARAM, "r") as fp: + with open(args.PARAM) as fp: jdata = json.load(fp) if args.MACHINE is not None: - with open(args.MACHINE, "r") as fp: + with open(args.MACHINE) as fp: mdata = json.load(fp) if args.MACHINE is not None: diff --git a/dpgen/data/reaction.py b/dpgen/data/reaction.py index 2df183796..adbd453ac 100644 --- a/dpgen/data/reaction.py +++ b/dpgen/data/reaction.py @@ -1,10 +1,9 @@ -""" -input: trajectory +"""input: trajectory 00: ReaxFF MD (lammps) 01: build dataset (mddatasetbuilder) 02: fp (gaussian) 03: convert to deepmd data -output: data +output: data. """ import glob @@ -106,7 +105,7 @@ def run_reaxff(jdata, mdata, log_file="reaxff_log"): def link_trj(jdata): - """link lammpstrj""" + """Link lammpstrj.""" create_path(build_path) task_path = os.path.join(build_path, "task.000") create_path(task_path) @@ -217,17 +216,17 @@ def convert_data(jdata): def gen_init_reaction(args): try: import ruamel - from monty.serialization import dumpfn, loadfn + from monty.serialization import loadfn warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) jdata = loadfn(args.PARAM) if args.MACHINE is not None: mdata = loadfn(args.MACHINE) except Exception: - with open(args.PARAM, "r") as fp: + with open(args.PARAM) as fp: jdata = json.load(fp) if args.MACHINE is not None: - with open(args.MACHINE, "r") as fp: + with open(args.MACHINE) as fp: mdata = json.load(fp) jdata_arginfo = init_reaction_jdata_arginfo() diff --git a/dpgen/data/surf.py b/dpgen/data/surf.py index 88ef0fc83..4a61ac418 100644 --- a/dpgen/data/surf.py +++ b/dpgen/data/surf.py @@ -14,7 +14,6 @@ from ase.build import general_surface # -----ASE------- -from ase.io import read from pymatgen.core import Element, Structure from pymatgen.io.ase import AseAtomsAdaptor @@ -48,7 +47,7 @@ def create_path(path): def replace(file_name, pattern, subst): - file_handel = open(file_name, "r") + file_handel = open(file_name) file_string = file_handel.read() file_handel.close() file_string = re.sub(pattern, subst, file_string) @@ -126,7 +125,7 @@ def poscar_ele(poscar_in, poscar_out, eles, natoms): ele_line += str(ii) + " " for ii in natoms: natom_line += str(ii) + " " - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) lines[5] = ele_line + "\n" lines[6] = natom_line + "\n" @@ -142,13 +141,13 @@ def _poscar_natoms(lines): def poscar_natoms(poscar_in): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) return _poscar_natoms(lines) def poscar_shuffle(poscar_in, poscar_out): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) numb_atoms = _poscar_natoms(lines) idx = np.arange(8, 8 + numb_atoms) @@ -169,39 +168,8 @@ def poscar_scale_direct(str_in, scale): return lines -def poscar_scale_cartesian(str_in, scale): - lines = str_in.copy() - numb_atoms = _poscar_natoms(lines) - # scale box - for ii in range(2, 5): - boxl = lines[ii].split() - boxv = [float(ii) for ii in boxl] - boxv = np.array(boxv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (boxv[0], boxv[1], boxv[2]) - # scale coord - for ii in range(8, 8 + numb_atoms): - cl = lines[ii].split() - cv = [float(ii) for ii in cl] - cv = np.array(cv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (cv[0], cv[1], cv[2]) - return lines - - -def poscar_scale(poscar_in, poscar_out, scale): - with open(poscar_in, "r") as fin: - lines = list(fin) - if "D" == lines[7][0] or "d" == lines[7][0]: - lines = poscar_scale_direct(lines, scale) - elif "C" == lines[7][0] or "c" == lines[7][0]: - lines = poscar_scale_cartesian(lines, scale) - else: - raise RuntimeError("Unknow poscar style at line 7: %s" % lines[7]) - with open(poscar_out, "w") as fout: - fout.write("".join(lines)) - - def poscar_elong(poscar_in, poscar_out, elong, shift_center=True): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) if lines[7][0].upper() != "C": raise RuntimeError("only works for Cartesian POSCAR") @@ -210,7 +178,7 @@ def poscar_elong(poscar_in, poscar_out, elong, shift_center=True): boxzl = np.linalg.norm(boxz) elong_ratio = elong / boxzl boxz = boxz * (1.0 + elong_ratio) - lines[4] = "%.16e %.16e %.16e\n" % (boxz[0], boxz[1], boxz[2]) + lines[4] = f"{boxz[0]:.16e} {boxz[1]:.16e} {boxz[2]:.16e}\n" if shift_center: poscar_str = "".join(lines) st = Structure.from_str(poscar_str, fmt="poscar") @@ -415,15 +383,6 @@ def make_vasp_relax(jdata): os.chdir(cwd) -def poscar_scale_direct(str_in, scale): - lines = str_in.copy() - numb_atoms = _poscar_natoms(lines) - pscale = float(lines[1]) - pscale = pscale * scale - lines[1] = str(pscale) + "\n" - return lines - - def poscar_scale_cartesian(str_in, scale): lines = str_in.copy() numb_atoms = _poscar_natoms(lines) @@ -432,18 +391,18 @@ def poscar_scale_cartesian(str_in, scale): boxl = lines[ii].split() boxv = [float(ii) for ii in boxl] boxv = np.array(boxv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (boxv[0], boxv[1], boxv[2]) + lines[ii] = f"{boxv[0]:.16e} {boxv[1]:.16e} {boxv[2]:.16e}\n" # scale coord for ii in range(8, 8 + numb_atoms): cl = lines[ii].split() cv = [float(ii) for ii in cl] cv = np.array(cv) * scale - lines[ii] = "%.16e %.16e %.16e\n" % (cv[0], cv[1], cv[2]) + lines[ii] = f"{cv[0]:.16e} {cv[1]:.16e} {cv[2]:.16e}\n" return lines def poscar_scale(poscar_in, poscar_out, scale): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) if "D" == lines[7][0] or "d" == lines[7][0]: lines = poscar_scale_direct(lines, scale) @@ -582,7 +541,7 @@ def pert_scaled(jdata): def _vasp_check_fin(ii): if os.path.isfile(os.path.join(ii, "OUTCAR")): - with open(os.path.join(ii, "OUTCAR"), "r") as fp: + with open(os.path.join(ii, "OUTCAR")) as fp: content = fp.read() count = content.count("Elapse") if count != 1: @@ -645,17 +604,17 @@ def run_vasp_relax(jdata, mdata): def gen_init_surf(args): try: import ruamel - from monty.serialization import dumpfn, loadfn + from monty.serialization import loadfn warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) jdata = loadfn(args.PARAM) if args.MACHINE is not None: mdata = loadfn(args.MACHINE) except Exception: - with open(args.PARAM, "r") as fp: + with open(args.PARAM) as fp: jdata = json.load(fp) if args.MACHINE is not None: - with open(args.MACHINE, "r") as fp: + with open(args.MACHINE) as fp: mdata = json.load(fp) out_dir = out_dir_name(jdata) diff --git a/dpgen/data/tools/bcc.py b/dpgen/data/tools/bcc.py index a48baef07..9c471e36b 100644 --- a/dpgen/data/tools/bcc.py +++ b/dpgen/data/tools/bcc.py @@ -14,12 +14,12 @@ def poscar_unit(latt): ret = "" ret += "BCC : a = %f \n" % latt ret += "%.16f\n" % (latt) - ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2]) - ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2]) - ret += "%.16f %.16f %.16f\n" % (box[2][0], box[2][1], box[2][2]) + ret += f"{box[0][0]:.16f} {box[0][1]:.16f} {box[0][2]:.16f}\n" + ret += f"{box[1][0]:.16f} {box[1][1]:.16f} {box[1][2]:.16f}\n" + ret += f"{box[2][0]:.16f} {box[2][1]:.16f} {box[2][2]:.16f}\n" ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "%.16f %.16f %.16f\n" % (0.0, 0.0, 0.0) - ret += "%.16f %.16f %.16f\n" % (0.5, 0.5, 0.5) + ret += f"{0.0:.16f} {0.0:.16f} {0.0:.16f}\n" + ret += f"{0.5:.16f} {0.5:.16f} {0.5:.16f}\n" return ret diff --git a/dpgen/data/tools/cessp2force_lin.py b/dpgen/data/tools/cessp2force_lin.py index aa6c91c3a..2a034247b 100755 --- a/dpgen/data/tools/cessp2force_lin.py +++ b/dpgen/data/tools/cessp2force_lin.py @@ -102,7 +102,7 @@ def scan_outcar_file(file_handle): elif potcar: return [configs, potcar, ipt] else: - sys.stderr.write("Could not determine atom types in file %s.\n" % filename) + sys.stderr.write("Could not determine atom types in file.\n") sys.exit() @@ -121,12 +121,12 @@ def process_outcar_file_v5_dev( if outcars[i].endswith(".gz"): f = gzip.open(outcars[i], "rb") else: - f = open(outcars[i], "r") + f = open(outcars[i]) # Writing current OUTCAR's information into potfit format files. nconfs = data[i][0] natoms = sum(data[i][2]) # ipt - if windex == None: + if windex is None: windex = range(nconfs) if windex == "final": windex = [nconfs - 1] @@ -165,15 +165,9 @@ def process_outcar_file_v5_dev( "## force file generated from file %s config %d\n" % (outcars[i], count) ) - fw.write( - "#X %13.8f %13.8f %13.8f\n" % (box_x[0], box_x[1], box_x[2]) - ) - fw.write( - "#Y %13.8f %13.8f %13.8f\n" % (box_y[0], box_y[1], box_y[2]) - ) - fw.write( - "#Z %13.8f %13.8f %13.8f\n" % (box_z[0], box_z[1], box_z[2]) - ) + fw.write(f"#X {box_x[0]:13.8f} {box_x[1]:13.8f} {box_x[2]:13.8f}\n") + fw.write(f"#Y {box_y[0]:13.8f} {box_y[1]:13.8f} {box_y[2]:13.8f}\n") + fw.write(f"#Z {box_z[0]:13.8f} {box_z[1]:13.8f} {box_z[2]:13.8f}\n") fw.write("#W %f\n" % (args.weight)) fw.write("#E %.10f\n" % (energy)) if stress: @@ -303,7 +297,7 @@ def Parser(): if item.endswith(".gz"): f = gzip.open(item, "rb") else: - f = open(item, "r") + f = open(item) data.append(scan_outcar_file(f)) f.close() max_types = max(max_types, len(data[-1][1])) @@ -350,7 +344,7 @@ def Parser(): # process all the outcar files sr = args.configs_range - if sr == None: + if sr is None: windex = None else: sr = sr.split() diff --git a/dpgen/data/tools/create_random_disturb.py b/dpgen/data/tools/create_random_disturb.py index b8fb47dfa..591dee232 100755 --- a/dpgen/data/tools/create_random_disturb.py +++ b/dpgen/data/tools/create_random_disturb.py @@ -3,8 +3,6 @@ import argparse import glob import os -import shutil -import sys import ase.io import numpy as np @@ -244,9 +242,7 @@ def create_disturbs_abacus_dev( def create_random_alloys(fin, alloy_dist, ifmt="vasp", ofmt="vasp"): - """ - In fact, atomsk also gives us the convinient tool to do this - """ + """In fact, atomsk also gives us the convinient tool to do this.""" # alloy_dist = {'Zr': 0.80, 'Nb': 0.20} atomic_symbols = alloy_dist.keys() atomic_ratios = alloy_dist.values() diff --git a/dpgen/data/tools/diamond.py b/dpgen/data/tools/diamond.py index 312872851..056ce9be9 100644 --- a/dpgen/data/tools/diamond.py +++ b/dpgen/data/tools/diamond.py @@ -19,18 +19,18 @@ def poscar_unit(latt): ret = "" ret += "DIAMOND\n" ret += "%.16f\n" % (latt) - ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2]) - ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2]) - ret += "%.16f %.16f %.16f\n" % (box[2][0], box[2][1], box[2][2]) + ret += f"{box[0][0]:.16f} {box[0][1]:.16f} {box[0][2]:.16f}\n" + ret += f"{box[1][0]:.16f} {box[1][1]:.16f} {box[1][2]:.16f}\n" + ret += f"{box[2][0]:.16f} {box[2][1]:.16f} {box[2][2]:.16f}\n" ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "%.16f %.16f %.16f\n" % ( + ret += "{:.16f} {:.16f} {:.16f}\n".format( 0.12500000000000, 0.12500000000000, 0.12500000000000, ) - ret += "%.16f %.16f %.16f\n" % ( + ret += "{:.16f} {:.16f} {:.16f}\n".format( 0.87500000000000, 0.87500000000000, 0.87500000000000, diff --git a/dpgen/data/tools/fcc.py b/dpgen/data/tools/fcc.py index f4576e3c4..80f0b476b 100644 --- a/dpgen/data/tools/fcc.py +++ b/dpgen/data/tools/fcc.py @@ -14,14 +14,14 @@ def poscar_unit(latt): ret = "" ret += "FCC : a = %f \n" % latt ret += "%.16f\n" % (latt) - ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2]) - ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2]) - ret += "%.16f %.16f %.16f\n" % (box[2][0], box[2][1], box[2][2]) + ret += f"{box[0][0]:.16f} {box[0][1]:.16f} {box[0][2]:.16f}\n" + ret += f"{box[1][0]:.16f} {box[1][1]:.16f} {box[1][2]:.16f}\n" + ret += f"{box[2][0]:.16f} {box[2][1]:.16f} {box[2][2]:.16f}\n" ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "%.16f %.16f %.16f\n" % (0.0, 0.0, 0.0) - ret += "%.16f %.16f %.16f\n" % (0.5, 0.5, 0.0) - ret += "%.16f %.16f %.16f\n" % (0.5, 0.0, 0.5) - ret += "%.16f %.16f %.16f\n" % (0.0, 0.5, 0.5) + ret += f"{0.0:.16f} {0.0:.16f} {0.0:.16f}\n" + ret += f"{0.5:.16f} {0.5:.16f} {0.0:.16f}\n" + ret += f"{0.5:.16f} {0.0:.16f} {0.5:.16f}\n" + ret += f"{0.0:.16f} {0.5:.16f} {0.5:.16f}\n" return ret diff --git a/dpgen/data/tools/hcp.py b/dpgen/data/tools/hcp.py index 60c15f8aa..aeea4afc3 100644 --- a/dpgen/data/tools/hcp.py +++ b/dpgen/data/tools/hcp.py @@ -17,12 +17,12 @@ def poscar_unit(latt): ret = "" ret += "HCP : a = %f / sqrt(2)\n" % latt ret += "%.16f\n" % (latt / np.sqrt(2)) - ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2]) - ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2]) - ret += "%.16f %.16f %.16f\n" % (box[2][0], box[2][1], box[2][2]) + ret += f"{box[0][0]:.16f} {box[0][1]:.16f} {box[0][2]:.16f}\n" + ret += f"{box[1][0]:.16f} {box[1][1]:.16f} {box[1][2]:.16f}\n" + ret += f"{box[2][0]:.16f} {box[2][1]:.16f} {box[2][2]:.16f}\n" ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "%.16f %.16f %.16f\n" % (0, 0, 0) - ret += "%.16f %.16f %.16f\n" % (1.0 / 3, 1.0 / 3, 1.0 / 2) + ret += f"{0:.16f} {0:.16f} {0:.16f}\n" + ret += f"{1.0 / 3:.16f} {1.0 / 3:.16f} {1.0 / 2:.16f}\n" return ret diff --git a/dpgen/data/tools/io_lammps.py b/dpgen/data/tools/io_lammps.py index 35223c68b..e8c01d228 100755 --- a/dpgen/data/tools/io_lammps.py +++ b/dpgen/data/tools/io_lammps.py @@ -1,9 +1,7 @@ #!/usr/bin/env python3 -""" - -ASE Atoms convert to LAMMPS configuration -Some functions are adapted from ASE lammpsrun.py +"""ASE Atoms convert to LAMMPS configuration +Some functions are adapted from ASE lammpsrun.py. """ @@ -13,12 +11,12 @@ def dir2car(v, A): - """Direct to cartesian coordinates""" + """Direct to cartesian coordinates.""" return np.dot(v, A) def car2dir(v, Ainv): - """Cartesian to direct coordinates""" + """Cartesian to direct coordinates.""" return np.dot(v, Ainv) @@ -44,25 +42,22 @@ def stress6_to_stress9(s6): def is_upper_triangular(mat): - """ - test if 3x3 matrix is upper triangular - LAMMPS has a rule for cell matrix definition + """Test if 3x3 matrix is upper triangular + LAMMPS has a rule for cell matrix definition. """ def near0(x): - """Test if a float is within .00001 of 0""" + """Test if a float is within .00001 of 0.""" return abs(x) < 0.00001 return near0(mat[1, 0]) and near0(mat[2, 0]) and near0(mat[2, 1]) def convert_cell(ase_cell): - """ - Convert a parallel piped (forming right hand basis) + """Convert a parallel piped (forming right hand basis) to lower triangular matrix LAMMPS can accept. This - function transposes cell matrix so the bases are column vectors + function transposes cell matrix so the bases are column vectors. """ - # if ase_cell is lower triangular, cell is upper tri-angular cell = np.matrix.transpose(ase_cell) @@ -190,10 +185,10 @@ def ase2lammpsdata(atoms, typeids=None, fout="out.lmp"): xz = cell[2, 0] yz = cell[2, 1] - fw.write("%f\t%f\t xlo xhi\n" % (0, xhi)) - fw.write("%f\t%f\t ylo yhi\n" % (0, yhi)) - fw.write("%f\t%f\t zlo zhi\n" % (0, zhi)) - fw.write("%f\t%f\t%f\t xy xz yz\n" % (xy, xz, yz)) + fw.write(f"{0:f}\t{xhi:f}\t xlo xhi\n") + fw.write(f"{0:f}\t{yhi:f}\t ylo yhi\n") + fw.write(f"{0:f}\t{zhi:f}\t zlo zhi\n") + fw.write(f"{xy:f}\t{xz:f}\t{yz:f}\t xy xz yz\n") fw.write("\n") # write mases diff --git a/dpgen/data/tools/ovito_file_convert.py b/dpgen/data/tools/ovito_file_convert.py index 5b3f19c7c..252b70b22 100755 --- a/dpgen/data/tools/ovito_file_convert.py +++ b/dpgen/data/tools/ovito_file_convert.py @@ -1,14 +1,10 @@ #!/usr/bin/env ovitos -""" -This Script is adapted from Alexander Stukowski, the author of OVITO. +"""This Script is adapted from Alexander Stukowski, the author of OVITO. See: http://forum.ovito.org/index.php?topic=131.0 for details. """ import argparse -import os -import sys -import numpy as np -from ovito.io import * +from ovito.io import export_file, import_file supp_ofmt = ["lammps_dump", "lammps_data", "vasp"] supp_exts = ["dump", "lmp", "poscar/POSCAR"] @@ -35,7 +31,7 @@ ofmt = "lammps_data" elif ext == "poscar" or ext == "POSCAR": ofmt = "vasp" -if not ofmt in supp_ofmt: +if ofmt not in supp_ofmt: raise RuntimeError( "output format " + ofmt + " is not supported. use one of " + str(supp_ofmt) ) diff --git a/dpgen/data/tools/poscar_copy.py b/dpgen/data/tools/poscar_copy.py index 24aab403b..fcae43ffe 100755 --- a/dpgen/data/tools/poscar_copy.py +++ b/dpgen/data/tools/poscar_copy.py @@ -2,9 +2,8 @@ import argparse -import numpy as np -from ovito.io import * -from ovito.modifiers import * +from ovito.io import export_file, import_file +from ovito.modifiers import ShowPeriodicImagesModifier def copy_system(ncopy, fin, fout): diff --git a/dpgen/data/tools/sc.py b/dpgen/data/tools/sc.py index 2c2c0671a..fff019d6d 100644 --- a/dpgen/data/tools/sc.py +++ b/dpgen/data/tools/sc.py @@ -14,11 +14,11 @@ def poscar_unit(latt): ret = "" ret += "SC : a = %f \n" % latt ret += "%.16f\n" % (latt) - ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2]) - ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2]) - ret += "%.16f %.16f %.16f\n" % (box[2][0], box[2][1], box[2][2]) + ret += f"{box[0][0]:.16f} {box[0][1]:.16f} {box[0][2]:.16f}\n" + ret += f"{box[1][0]:.16f} {box[1][1]:.16f} {box[1][2]:.16f}\n" + ret += f"{box[2][0]:.16f} {box[2][1]:.16f} {box[2][2]:.16f}\n" ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "%.16f %.16f %.16f\n" % (0.0, 0.0, 0.0) + ret += f"{0.0:.16f} {0.0:.16f} {0.0:.16f}\n" return ret diff --git a/dpgen/database/__init__.py b/dpgen/database/__init__.py index fadd65267..8352dda9b 100644 --- a/dpgen/database/__init__.py +++ b/dpgen/database/__init__.py @@ -1,2 +1,4 @@ from .entry import Entry from .vasp import DPPotcar, VaspInput + +__all__ = ["Entry", "DPPotcar", "VaspInput"] diff --git a/dpgen/database/entry.py b/dpgen/database/entry.py index 41da89320..95563af9c 100644 --- a/dpgen/database/entry.py +++ b/dpgen/database/entry.py @@ -1,17 +1,11 @@ # /usr/bin/env python -# coding: utf-8 # Copyright (c) The Dpmodeling Team. import json -import warnings -from uuid import uuid4 -from dpdata import LabeledSystem, System from monty.json import MontyDecoder, MontyEncoder, MSONable from pymatgen.core.composition import Composition -from dpgen.database.vasp import VaspInput - """ This module implements equivalents of the basic Entry objects, which is the basic entity that can be used to perform many analyses. Entries @@ -21,10 +15,30 @@ class Entry(MSONable): - """ - An lightweight Entry object containing key computed data + """An lightweight Entry object containing key computed data for storing purpose. + Parameters + ---------- + composition : Composition + Composition of the entry. For + flexibility, this can take the form of all the typical input + taken by a Composition, including a {symbol: amt} dict, + a string formula, and others. + inputs : dict + An dict of parameters associated with + the entry. Defaults to None. + data : dict + An dict of any additional data associated + with the entry. Defaults to None. + entry_id : obj + An optional id to uniquely identify the entry. + attribute : + Optional attribute of the entry. This can be used to + specify that the entry is a newly found compound, or to specify + a particular label for the entry, or else ... Used for further + analysis and plotting purposes. An attribute can be anything + but must be MSONable. """ def __init__( @@ -37,25 +51,7 @@ def __init__( attribute=None, tag=None, ): - """ - Initializes a Entry. - - Args: - composition (Composition): Composition of the entry. For - flexibility, this can take the form of all the typical input - taken by a Composition, including a {symbol: amt} dict, - a string formula, and others. - inputs (dict): An dict of parameters associated with - the entry. Defaults to None. - data (dict): An dict of any additional data associated - with the entry. Defaults to None. - entry_id (obj): An optional id to uniquely identify the entry. - attribute: Optional attribute of the entry. This can be used to - specify that the entry is a newly found compound, or to specify - a particular label for the entry, or else ... Used for further - analysis and plotting purposes. An attribute can be anything - but must be MSONable. - """ + """Initializes a Entry.""" self.composition = Composition(composition) self.calculator = calculator self.inputs = inputs @@ -88,8 +84,8 @@ def number_element(self): def __repr__(self): output = [ - "Entry {} - {}".format(self.entry_id, self.composition.formula), - "calculator: {}".format(self.calculator), + f"Entry {self.entry_id} - {self.composition.formula}", + f"calculator: {self.calculator}", ] return "\n".join(output) diff --git a/dpgen/database/run.py b/dpgen/database/run.py index 8a2df327d..2930d3f70 100644 --- a/dpgen/database/run.py +++ b/dpgen/database/run.py @@ -1,17 +1,12 @@ # /usr/bin/env python -# coding: utf-8 # Copyright (c) The Dpmodeling Team. import json import os -import time -import traceback from glob import glob -from threading import Thread from uuid import uuid4 -import numpy as np -from dpdata import LabeledSystem, System +from dpdata import LabeledSystem from monty.serialization import dumpfn, loadfn from dpgen import SHORT_CMD, dlog @@ -32,7 +27,7 @@ def db_run(args): def _main(param): - with open(param, "r") as fp: + with open(param) as fp: jdata = json.load(fp) calculator = jdata["calculator"] path = jdata["path"] @@ -82,7 +77,7 @@ def _parsing_vasp(paths, config_info_dict, id_prefix, iters=True): iter_record = [] iter_record_new = [] try: - with open("record.database", "r") as f_record: + with open("record.database") as f_record: iter_record = [i.split()[0] for i in f_record.readlines()] iter_record.sort() dlog.info("iter_record") @@ -120,7 +115,7 @@ def _parsing_vasp(paths, config_info_dict, id_prefix, iters=True): attrib["task_info"] = task_info attrib["iter_info"] = iter_info attrib["sys_info"] = sys_info - with open(f_outcar, "r") as fin_outcar: + with open(f_outcar) as fin_outcar: infile_outcar = fin_outcar.readlines() for line in infile_outcar: if "running on" in line: diff --git a/dpgen/database/vasp.py b/dpgen/database/vasp.py index dcbef299d..7b4f94d6a 100644 --- a/dpgen/database/vasp.py +++ b/dpgen/database/vasp.py @@ -1,5 +1,4 @@ # /usr/bin/env python -# coding: utf-8 # Copyright (c) PThe Dpmodeling Team. @@ -19,13 +18,13 @@ class DPPotcar(MSONable): def __init__(self, symbols=None, functional="PBE", pp_file=None, pp_lists=None): - if pp_lists and pp_file is None: + if pp_lists is not None and pp_file is None: for pp in pp_lists: assert isinstance(pp, PotcarSingle) self.potcars = pp_lists - elif pp_file and pp_list is None: + elif pp_file is not None and pp_lists is None: self.potcars = Potcar.from_file(pp_file) - elif pp_file and pp_list: + elif pp_file is not None and pp_lists is not None: self.potcars = Potcar.from_file(pp_file) else: try: @@ -84,7 +83,7 @@ def from_file(cls, filename): potcars = Potcar.from_file(filename) return cls(pp_lists=potcars) except Exception: - with open(filename, "r") as f: + with open(filename) as f: content = f.readlines() functional = content[0].strip().split(":")[-1].strip() symbols = content[1].strip().split() @@ -96,10 +95,10 @@ def write_file(self, filename): class VaspInput(dict, MSONable): - """ - Class to contain a set of vasp input objects corresponding to a run. + """Class to contain a set of vasp input objects corresponding to a run. Args: + ---- incar: Incar object. kpoints: Kpoints object. poscar: Poscar object. @@ -146,14 +145,16 @@ def from_dict(cls, d): return cls(**sub_d) def write_input(self, output_dir=".", make_dir_if_not_present=True): - """ - Write VASP input to a directory. - - Args: - output_dir (str): Directory to write to. Defaults to current - directory ("."). - make_dir_if_not_present (bool): Create the directory if not - present. Defaults to True. + """Write VASP input to a directory. + + Parameters + ---------- + output_dir : str + Directory to write to. Defaults to current + directory ("."). + make_dir_if_not_present : bool + Create the directory if not + present. Defaults to True. """ if make_dir_if_not_present and not os.path.exists(output_dir): os.makedirs(output_dir) @@ -163,16 +164,18 @@ def write_input(self, output_dir=".", make_dir_if_not_present=True): @staticmethod def from_directory(input_dir, optional_files=None): - """ - Read in a set of VASP input from a directory. Note that only the + """Read in a set of VASP input from a directory. Note that only the standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless optional_filenames is specified. - Args: - input_dir (str): Directory to read VASP input from. - optional_files (dict): Optional files to read in as well as a - dict of {filename: Object type}. Object type must have a - static method from_file. + Parameters + ---------- + input_dir : str + Directory to read VASP input from. + optional_files : dict + Optional files to read in as well as a + dict of {filename: Object type}. Object type must have a + static method from_file. """ sub_d = {} try: diff --git a/dpgen/dispatcher/Dispatcher.py b/dpgen/dispatcher/Dispatcher.py index 0d9e43f16..27399dfed 100644 --- a/dpgen/dispatcher/Dispatcher.py +++ b/dpgen/dispatcher/Dispatcher.py @@ -21,7 +21,7 @@ def make_submission( errlog, ): if mdata_machine["local_root"] != "./": - raise RuntimeError(f"local_root must be './' in dpgen's machine.json.") + raise RuntimeError("local_root must be './' in dpgen's machine.json.") abs_local_root = os.path.abspath("./") diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 7d2835d8a..bdfdccb6f 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -1,5 +1,5 @@ import textwrap -from typing import Dict, List +from typing import List from dargs import Argument, Variant diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 96ae2fe98..6a8ea3213 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -191,7 +191,7 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): elif key == "calculation": pass else: - ret += "%s %s\n" % (key, str(fp_params[key])) + ret += f"{key} {str(fp_params[key])}\n" return ret @@ -206,7 +206,7 @@ def make_abacus_scf_stru( ): atom_names = sys_data["atom_names"] atom_numbs = sys_data["atom_numbs"] - if type_map == None: + if type_map is None: type_map = atom_names assert len(atom_names) == len(atom_numbs), "Please check the name of atoms. " @@ -376,7 +376,7 @@ def get_additional_from_STRU(geometry_inlines, nele): def get_abacus_STRU(STRU, INPUT=None, n_ele=None): # read in geometry from STRU file. n_ele is the number of elements. # Either n_ele or INPUT should be provided. - with open(STRU, "r") as fp: + with open(STRU) as fp: geometry_inlines = fp.read().split("\n") for iline, line in enumerate(geometry_inlines): if line.split() == [] or len(line) == 0: diff --git a/dpgen/generator/lib/calypso_check_outcar.py b/dpgen/generator/lib/calypso_check_outcar.py index e3982335e..668131669 100644 --- a/dpgen/generator/lib/calypso_check_outcar.py +++ b/dpgen/generator/lib/calypso_check_outcar.py @@ -1,14 +1,8 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import glob import os -import sys -import time import numpy as np -from ase.io import read -from deepmd.calculator import DP """ check if structure optimization worked well @@ -17,7 +11,7 @@ def Get_Element_Num(elements): - """Using the Atoms.symples to Know Element&Num""" + """Using the Atoms.symples to Know Element&Num.""" element = [] ele = {} element.append(elements[0]) @@ -30,12 +24,12 @@ def Get_Element_Num(elements): def Write_Contcar(element, ele, lat, pos): - """Write CONTCAR""" + """Write CONTCAR.""" f = open("CONTCAR", "w") f.write("ASE-DPKit-FAILED-nan\n") f.write("1.0\n") for i in range(3): - f.write("%15.10f %15.10f %15.10f\n" % tuple(lat[i])) + f.write("{:15.10f} {:15.10f} {:15.10f}\n".format(*tuple(lat[i]))) for x in element: f.write(x + " ") f.write("\n") @@ -46,11 +40,11 @@ def Write_Contcar(element, ele, lat, pos): na = sum(ele.values()) dpos = np.dot(pos, np.linalg.inv(lat)) for i in range(na): - f.write("%15.10f %15.10f %15.10f\n" % tuple(dpos[i])) + f.write("{:15.10f} {:15.10f} {:15.10f}\n".format(*tuple(dpos[i]))) def Write_Outcar(element, ele, volume, lat, pos, ene, force, stress, pstress): - """Write OUTCAR""" + """Write OUTCAR.""" f = open("OUTCAR", "w") for x in element: f.write("VRHFIN =" + str(x) + "\n") @@ -70,23 +64,22 @@ def Write_Outcar(element, ele, volume, lat, pos, ene, force, stress, pstress): f.write("\n") ext_pressure = np.sum(stress[0] + stress[1] + stress[2]) / 3.0 - pstress f.write( - "external pressure = %20.6f kB Pullay stress = %20.6f kB\n" - % (ext_pressure, pstress) + f"external pressure = {ext_pressure:20.6f} kB Pullay stress = {pstress:20.6f} kB\n" ) f.write("volume of cell : %20.6f\n" % volume) f.write("direct lattice vectors\n") for i in range(3): - f.write("%10.6f %10.6f %10.6f\n" % tuple(lat[i])) + f.write("{:10.6f} {:10.6f} {:10.6f}\n".format(*tuple(lat[i]))) f.write("POSITION TOTAL-FORCE(eV/Angst)\n") f.write("-------------------------------------------------------------------\n") na = sum(ele.values()) for i in range(na): - f.write("%15.6f %15.6f %15.6f" % tuple(pos[i])) - f.write("%15.6f %15.6f %15.6f\n" % tuple(force[i])) + f.write("{:15.6f} {:15.6f} {:15.6f}".format(*tuple(pos[i]))) + f.write("{:15.6f} {:15.6f} {:15.6f}\n".format(*tuple(force[i]))) f.write("-------------------------------------------------------------------\n") - f.write("energy without entropy= %20.6f %20.6f\n" % (ene, ene)) + f.write(f"energy without entropy= {ene:20.6f} {ene:20.6f}\n") enthalpy = ene + pstress * volume / 1602.17733 - f.write("enthalpy is TOTEN = %20.6f %20.6f\n" % (enthalpy, enthalpy)) + f.write(f"enthalpy is TOTEN = {enthalpy:20.6f} {enthalpy:20.6f}\n") def check(): diff --git a/dpgen/generator/lib/calypso_run_model_devi.py b/dpgen/generator/lib/calypso_run_model_devi.py index 1f656cc59..5ad3f70bb 100644 --- a/dpgen/generator/lib/calypso_run_model_devi.py +++ b/dpgen/generator/lib/calypso_run_model_devi.py @@ -4,7 +4,6 @@ import math import os import shutil -import sys import dpdata import numpy as np @@ -22,7 +21,7 @@ def write_model_devi_out(devi, fname): f"min_devi_{item}", f"avg_devi_{item}", ) - header += "%16s" % str("min_dis") + header += "%16s" % "min_dis" np.savetxt( fname, devi, diff --git a/dpgen/generator/lib/calypso_run_opt.py b/dpgen/generator/lib/calypso_run_opt.py index 99c0fec80..9cb94f958 100644 --- a/dpgen/generator/lib/calypso_run_opt.py +++ b/dpgen/generator/lib/calypso_run_opt.py @@ -1,15 +1,12 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import glob import os -import sys import time import numpy as np -from ase.constraints import ExpCellFilter, UnitCellFilter +from ase.constraints import UnitCellFilter from ase.io import read -from ase.optimize import BFGS, LBFGS, QuasiNewton +from ase.optimize import LBFGS from deepmd.calculator import DP """ @@ -19,7 +16,7 @@ def Get_Element_Num(elements): - """Using the Atoms.symples to Know Element&Num""" + """Using the Atoms.symples to Know Element&Num.""" element = [] ele = {} element.append(elements[0]) @@ -32,12 +29,12 @@ def Get_Element_Num(elements): def Write_Contcar(element, ele, lat, pos): - """Write CONTCAR""" + """Write CONTCAR.""" f = open("CONTCAR", "w") f.write("ASE-DPKit-Optimization\n") f.write("1.0\n") for i in range(3): - f.write("%15.10f %15.10f %15.10f\n" % tuple(lat[i])) + f.write("{:15.10f} {:15.10f} {:15.10f}\n".format(*tuple(lat[i]))) for x in element: f.write(x + " ") f.write("\n") @@ -48,11 +45,11 @@ def Write_Contcar(element, ele, lat, pos): na = sum(ele.values()) dpos = np.dot(pos, np.linalg.inv(lat)) for i in range(na): - f.write("%15.10f %15.10f %15.10f\n" % tuple(dpos[i])) + f.write("{:15.10f} {:15.10f} {:15.10f}\n".format(*tuple(dpos[i]))) def Write_Outcar(element, ele, volume, lat, pos, ene, force, stress, pstress): - """Write OUTCAR""" + """Write OUTCAR.""" f = open("OUTCAR", "w") for x in element: f.write("VRHFIN =" + str(x) + "\n") @@ -72,23 +69,22 @@ def Write_Outcar(element, ele, volume, lat, pos, ene, force, stress, pstress): f.write("\n") ext_pressure = np.sum(stress[0] + stress[1] + stress[2]) / 3.0 - pstress f.write( - "external pressure = %20.6f kB Pullay stress = %20.6f kB\n" - % (ext_pressure, pstress) + f"external pressure = {ext_pressure:20.6f} kB Pullay stress = {pstress:20.6f} kB\n" ) f.write("volume of cell : %20.6f\n" % volume) f.write("direct lattice vectors\n") for i in range(3): - f.write("%10.6f %10.6f %10.6f\n" % tuple(lat[i])) + f.write("{:10.6f} {:10.6f} {:10.6f}\n".format(*tuple(lat[i]))) f.write("POSITION TOTAL-FORCE(eV/Angst)\n") f.write("-------------------------------------------------------------------\n") na = sum(ele.values()) for i in range(na): - f.write("%15.6f %15.6f %15.6f" % tuple(pos[i])) - f.write("%15.6f %15.6f %15.6f\n" % tuple(force[i])) + f.write("{:15.6f} {:15.6f} {:15.6f}".format(*tuple(pos[i]))) + f.write("{:15.6f} {:15.6f} {:15.6f}\n".format(*tuple(force[i]))) f.write("-------------------------------------------------------------------\n") - f.write("energy without entropy= %20.6f %20.6f\n" % (ene, ene / na)) + f.write(f"energy without entropy= {ene:20.6f} {ene / na:20.6f}\n") enthalpy = ene + pstress * volume / 1602.17733 - f.write("enthalpy is TOTEN = %20.6f %20.6f\n" % (enthalpy, enthalpy / na)) + f.write(f"enthalpy is TOTEN = {enthalpy:20.6f} {enthalpy / na:20.6f}\n") def read_stress_fmax(): @@ -96,12 +92,12 @@ def read_stress_fmax(): fmax = 0.01 # assert os.path.exists('./input.dat'), 'input.dat does not exist!' try: - f = open("input.dat", "r") - except: + f = open("input.dat") + except Exception: assert os.path.exists( "../input.dat" ), " now we are in %s, do not find ../input.dat" % (os.getcwd()) - f = open("../input.dat", "r") + f = open("../input.dat") lines = f.readlines() f.close() for line in lines: @@ -115,8 +111,7 @@ def read_stress_fmax(): def run_opt(fmax, stress): - """Using the ASE&DP to Optimize Configures""" - + """Using the ASE&DP to Optimize Configures.""" calc = DP(model="../graph.000.pb") # init the model before iteration os.system("mv OUTCAR OUTCAR-last") @@ -165,7 +160,7 @@ def run_opt(fmax, stress): stop = time.time() _cwd = os.getcwd() _cwd = os.path.basename(_cwd) - print("%s is done, time: %s" % (_cwd, stop - start)) + print(f"{_cwd} is done, time: {stop - start}") def run(): diff --git a/dpgen/generator/lib/cp2k.py b/dpgen/generator/lib/cp2k.py index 2bfede252..4ab9ae4c5 100644 --- a/dpgen/generator/lib/cp2k.py +++ b/dpgen/generator/lib/cp2k.py @@ -1,4 +1,3 @@ -import dpdata import numpy as np default_config = { @@ -32,10 +31,9 @@ def update_dict(old_d, update_d): - """ - a method to recursive update dict + """A method to recursive update dict :old_d: old dictionary - :update_d: some update value written in dictionary form + :update_d: some update value written in dictionary form. """ import collections.abc @@ -51,8 +49,7 @@ def update_dict(old_d, update_d): def iterdict(d, out_list, flag=None): - """ - :doc: a recursive expansion of dictionary into cp2k input + """:doc: a recursive expansion of dictionary into cp2k input :k: current key :v: current value :d: current dictionary under expansion @@ -64,7 +61,7 @@ def iterdict(d, out_list, flag=None): # if value is dictionary if isinstance(v, dict): # flag == None, it is now in top level section of cp2k - if flag == None: + if flag is None: out_list.append("&" + k) out_list.append("&END " + k) iterdict(v, out_list, k) @@ -98,7 +95,7 @@ def iterdict(d, out_list, flag=None): else: v = str(v) - if flag == None: + if flag is None: out_list.append(k + " " + v) print(k, ":", v) else: @@ -154,7 +151,7 @@ def make_cp2k_xyz(sys_data): def make_cp2k_input_from_external(sys_data, exinput_path): # read the input content as string - with open(exinput_path, "r") as f: + with open(exinput_path) as f: exinput = f.readlines() # find the ABC cell string diff --git a/dpgen/generator/lib/cvasp.py b/dpgen/generator/lib/cvasp.py index d98d549d4..d4d98f770 100644 --- a/dpgen/generator/lib/cvasp.py +++ b/dpgen/generator/lib/cvasp.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- import argparse @@ -37,9 +36,8 @@ def runvasp( auto_npar=False, ediffg=-0.05, ): - """ - cmd example: - cmd=['mpirun', '-np', '32' , '-machinefile', 'hosts','vasp_std'] + """Cmd example: + cmd=['mpirun', '-np', '32' , '-machinefile', 'hosts','vasp_std']. """ if opt: jobs = cvj.full_opt_run( diff --git a/dpgen/generator/lib/ele_temp.py b/dpgen/generator/lib/ele_temp.py index e2396b6fe..15e1b802c 100644 --- a/dpgen/generator/lib/ele_temp.py +++ b/dpgen/generator/lib/ele_temp.py @@ -1,4 +1,3 @@ -import json import os import dpdata @@ -7,7 +6,7 @@ from pymatgen.io.vasp.inputs import Incar -class NBandsEsti(object): +class NBandsEsti: def __init__(self, test_list): if type(test_list) is list: ele_t = [] diff --git a/dpgen/generator/lib/gaussian.py b/dpgen/generator/lib/gaussian.py index eb4c919f2..dca371ee1 100644 --- a/dpgen/generator/lib/gaussian.py +++ b/dpgen/generator/lib/gaussian.py @@ -72,7 +72,7 @@ def _crd2mul(symbols, crds): f"{atomnumber}\nDPGEN\n", "\n".join( [ - "{:2s} {:22.15f} {:22.15f} {:22.15f}".format(s, x, y, z) + f"{s:2s} {x:22.15f} {y:22.15f} {z:22.15f}" for s, (x, y, z) in zip(symbols, crds) ] ), @@ -167,20 +167,20 @@ def make_gaussian_input(sys_data, fp_params): buff = [] # keywords, e.g., force b3lyp/6-31g** if use_fragment_guesses: - keywords[0] = "{} guess=fragment={}".format(keywords[0], frag_numb) + keywords[0] = f"{keywords[0]} guess=fragment={frag_numb}" chkkeywords = [] if len(keywords) > 1: - chkkeywords.append("%chk={}.chk".format(str(uuid.uuid1()))) + chkkeywords.append(f"%chk={str(uuid.uuid1())}.chk") - nprockeywords = "%nproc={:d}".format(nproc) + nprockeywords = f"%nproc={nproc:d}" titlekeywords = "DPGEN" - chargekeywords = "{} {}".format(charge, multiplicity) + chargekeywords = f"{charge} {multiplicity}" buff = [ *chkkeywords, nprockeywords, - "#{}".format(keywords[0]), + f"#{keywords[0]}", "", titlekeywords, "", @@ -193,7 +193,7 @@ def make_gaussian_input(sys_data, fp_params): "%s(Fragment=%d) %f %f %f" % (symbol, frag_index[ii] + 1, *coordinate) ) else: - buff.append("%s %f %f %f" % (symbol, *coordinate)) + buff.append("{} {:f} {:f} {:f}".format(symbol, *coordinate)) if "basis_set" in fp_params: # custom basis set buff.extend(["", fp_params["basis_set"], ""]) @@ -203,7 +203,7 @@ def make_gaussian_input(sys_data, fp_params): "\n--link1--", *chkkeywords, nprockeywords, - "#{}".format(kw), + f"#{kw}", "", titlekeywords, "", diff --git a/dpgen/generator/lib/lammps.py b/dpgen/generator/lib/lammps.py index bd32fd562..0da9c8346 100644 --- a/dpgen/generator/lib/lammps.py +++ b/dpgen/generator/lib/lammps.py @@ -1,9 +1,6 @@ #!/usr/bin/env python3 -import os import random -import subprocess as sp -import sys import dpdata import numpy as np @@ -101,10 +98,7 @@ def make_lammps_input( keywords += "fparam ${ELE_TEMP}" if ele_temp_a is not None: keywords += "aparam ${ELE_TEMP}" - ret += ( - "pair_style deepmd %s out_freq ${THERMO_FREQ} out_file model_devi.out %s\n" - % (graph_list, keywords) - ) + ret += f"pair_style deepmd {graph_list} out_freq ${{THERMO_FREQ}} out_file model_devi.out {keywords}\n" ret += "pair_coeff * *\n" ret += "\n" ret += "thermo_style custom step temp pe ke etotal press vol lx ly lz xy xz yz\n" @@ -135,7 +129,7 @@ def make_lammps_input( pka_vec = _sample_sphere() pka_vec *= pka_vn ret += "group first id 1\n" - ret += 'if "${restart} == 0" then "velocity first set %f %f %f"\n' % ( + ret += 'if "${{restart}} == 0" then "velocity first set {:f} {:f} {:f}"\n'.format( pka_vec[0], pka_vec[1], pka_vec[2], diff --git a/dpgen/generator/lib/make_calypso.py b/dpgen/generator/lib/make_calypso.py index 2758d76df..b4d84da49 100644 --- a/dpgen/generator/lib/make_calypso.py +++ b/dpgen/generator/lib/make_calypso.py @@ -6,8 +6,6 @@ import numpy as np -from dpgen.generator.lib.utils import create_path - def make_calypso_input( nameofatoms, @@ -233,7 +231,7 @@ def write_model_devi_out(devi, fname): f"min_devi_{item}", f"avg_devi_{item}", ) - header += "%16s" % str("min_dis") + header += "%16s" % "min_dis" np.savetxt( fname, devi, diff --git a/dpgen/generator/lib/parse_calypso.py b/dpgen/generator/lib/parse_calypso.py index 81b2147c2..460d478b6 100644 --- a/dpgen/generator/lib/parse_calypso.py +++ b/dpgen/generator/lib/parse_calypso.py @@ -9,7 +9,7 @@ def _parse_calypso_input(var, input_path): if not os.path.exists(input_path): raise FileNotFoundError(input_path) - f = open(input_path, "r") + f = open(input_path) lines = f.readlines() f.close() @@ -21,9 +21,9 @@ def _parse_calypso_input(var, input_path): def _parse_calypso_dis_mtx(numberofspecies, input_path): try: - f = open(input_path, "r") - except: - f = open(os.path.join(input_path, "input.dat"), "r") + f = open(input_path) + except Exception: + f = open(os.path.join(input_path, "input.dat")) while True: line = f.readline() if len(line) == 0: diff --git a/dpgen/generator/lib/pwmat.py b/dpgen/generator/lib/pwmat.py index 06ef0ddf3..c2100ee69 100644 --- a/dpgen/generator/lib/pwmat.py +++ b/dpgen/generator/lib/pwmat.py @@ -1,6 +1,5 @@ #!/usr/bin/python3 -import os import numpy as np @@ -18,7 +17,7 @@ def _make_pwmat_kp_mp(kpoints): def _make_kspacing_kpoints(config, kspacing): - with open(config, "r") as fp: + with open(config) as fp: lines = fp.read().split("\n") box = [] for idx, ii in enumerate(lines): @@ -63,8 +62,8 @@ def make_pwmat_input_dict( "94 4 3 " + str(icmix) + " " + str(sigma) + " " + str(smearing) ) else: - SCF_ITER0_1 = "6 4 3 0.0000 " + str(simga) + " 2" - SCF_ITER0_2 = "94 4 3 " + str(icmix) + " " + str(simga) + " 2" + SCF_ITER0_1 = "6 4 3 0.0000 " + str(sigma) + " 2" + SCF_ITER0_2 = "94 4 3 " + str(icmix) + " " + str(sigma) + " 2" else: if smearing is not None: @@ -107,7 +106,7 @@ def _update_input_dict(input_dict_, user_dict): return input_dict_ input_dict = input_dict_ for ii in user_dict: - input_dict[ci] = user_dict[ii] + input_dict[ii] = user_dict[ii] return input_dict @@ -121,7 +120,7 @@ def write_input_dict(input_dict): rs = "F" else: rs = str(input_dict[key]) - lines.append("%s=%s" % (key, rs)) + lines.append(f"{key}={rs}") return "\n".join(lines) @@ -135,25 +134,25 @@ def _make_smearing(fp_params): smearing = fp_params["smearing"] if "sigma" in fp_params: sigma = fp_params["sigma"] - if icmix == None: - if smearing == None: - if sigma == None: + if icmix is None: + if smearing is None: + if sigma is None: return None, None, None else: return None, None, sigma else: - if sigma == None: + if sigma is None: return None, smearing, None else: return None, smearing, sigma else: - if smearing == None: - if sigma == None: + if smearing is None: + if sigma is None: return icmix, None, None else: return icmix, None, sigma else: - if sigma == None: + if sigma is None: return icmix, smearing, None else: return icmix, smearing, sigma @@ -206,4 +205,5 @@ def input_upper(dinput): standard_input = {} for key, val in dinput.items(): standard_input[key.upper()] = val - return Input(standard_input) + # return Input(standard_input) + return standard_input diff --git a/dpgen/generator/lib/pwscf.py b/dpgen/generator/lib/pwscf.py index bc3c6bab3..39d3174b3 100644 --- a/dpgen/generator/lib/pwscf.py +++ b/dpgen/generator/lib/pwscf.py @@ -17,7 +17,7 @@ def _convert_dict(idict): ws = "'" + idict[key] + "'" else: ws = str(idict[key]) - lines.append("%s=%s," % (key, ws)) + lines.append(f"{key}={ws},") return lines @@ -110,7 +110,7 @@ def _make_pwscf_03_config(sys_data): cc = 0 for ii in range(ntypes): for jj in range(atom_numbs[ii]): - ret += "%s %f %f %f\n" % ( + ret += "{} {:f} {:f} {:f}\n".format( atom_names[ii], coordinates[cc][0], coordinates[cc][1], @@ -157,7 +157,7 @@ def _make_smearing(fp_params): degauss = fp_params["sigma"] if (smearing is not None) and (smearing.split(":")[0] == "mp"): smearing = "mp" - if not (smearing in [None, "gauss", "mp", "fd"]): + if smearing not in [None, "gauss", "mp", "fd"]: raise RuntimeError("unknow smearing method " + smearing) return smearing, degauss diff --git a/dpgen/generator/lib/run_calypso.py b/dpgen/generator/lib/run_calypso.py index 1f78ffa97..6af12008d 100644 --- a/dpgen/generator/lib/run_calypso.py +++ b/dpgen/generator/lib/run_calypso.py @@ -1,23 +1,18 @@ -""" -calypso as model devi engine: - 1. gen_structures - 2. analysis - 3. model devi +"""calypso as model devi engine: +1. gen_structures +2. analysis +3. model devi. """ -import copy import glob -import math import os import random -import re import shutil import sys from itertools import combinations from pathlib import Path import dpdata -import numpy as np from ase.io.trajectory import Trajectory from ase.io.vasp import write_vasp from packaging.version import Version @@ -91,7 +86,7 @@ def gen_structures( PickUpStep = 1 try: os.mkdir("opt") - except: + except Exception: pass popsize = int(_parse_calypso_input("PopSize", ".")) @@ -109,7 +104,7 @@ def gen_structures( for pop in range(ii * int(popsize), (ii + 1) * int(popsize)): try: os.mkdir("task.%03d" % pop) - except: + except Exception: shutil.rmtree("task.%03d" % pop) os.mkdir("task.%03d" % pop) shutil.copyfile( @@ -241,7 +236,7 @@ def gen_structures( shutil.copyfile(name, "POSCAR_%s" % (idx + 1)) try: os.mkdir("task.%04d" % (idx + 1)) - except: + except Exception: shutil.rmtree("task.%04d" % (idx + 1)) os.mkdir("task.%04d" % (idx + 1)) shutil.copyfile( @@ -481,7 +476,7 @@ def run_calypso_model_devi(iter_index, jdata, mdata): lines = ["1 0\n"] f.close() else: - f = open(record_calypso_path, "r") + f = open(record_calypso_path) lines = f.readlines() f.close() diff --git a/dpgen/generator/lib/utils.py b/dpgen/generator/lib/utils.py index 10c1ae360..4eaf4ad87 100644 --- a/dpgen/generator/lib/utils.py +++ b/dpgen/generator/lib/utils.py @@ -30,7 +30,7 @@ def create_path(path): def replace(file_name, pattern, subst): - file_handel = open(file_name, "r") + file_handel = open(file_name) file_string = file_handel.read() file_handel.close() file_string = re.sub(pattern, subst, file_string) @@ -76,18 +76,20 @@ def record_iter(record, ii, jj): def symlink_user_forward_files(mdata, task_type, work_path, task_format=None): - """ - Symlink user-defined forward_common_files - Current path should be work_path, such as 00.train + """Symlink user-defined forward_common_files + Current path should be work_path, such as 00.train. Parameters - --------- + ---------- mdata : dict machine parameters - task_type: str + task_type : str task_type, such as "train" work_path : str work_path, such as "iter.000001/00.train" + task_format : dict + formats of tasks + Returns ------- None @@ -100,7 +102,7 @@ def symlink_user_forward_files(mdata, task_type, work_path, task_format=None): for file in user_forward_files: assert os.path.isfile( file - ), "user_forward_file %s of %s stage doesn't exist. " % (file, task_type) + ), f"user_forward_file {file} of {task_type} stage doesn't exist. " tasks = glob.glob(os.path.join(work_path, task_format[task_type])) for task in tasks: if os.path.isfile(os.path.join(task, os.path.basename(file))): diff --git a/dpgen/generator/lib/vasp.py b/dpgen/generator/lib/vasp.py index dcfbf0e43..fd5a6ff81 100644 --- a/dpgen/generator/lib/vasp.py +++ b/dpgen/generator/lib/vasp.py @@ -1,8 +1,6 @@ #!/usr/bin/python3 -import os -import numpy as np from pymatgen.io.vasp import Incar @@ -68,7 +66,7 @@ def write_incar_dict(incar_dict): rs = "F" else: rs = str(incar_dict[key]) - lines.append("%s=%s" % (key, rs)) + lines.append(f"{key}={rs}") return "\n".join(lines) @@ -79,7 +77,7 @@ def _make_smearing(fp_params): smearing = fp_params["smearing"] if "sigma" in fp_params: sigma = fp_params["sigma"] - if smearing == None: + if smearing is None: return None, sigma smearing_method = (smearing.split(":")[0]).lower() if smearing_method == "mp": diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 9293d93be..3c0ca1e5f 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -1,12 +1,11 @@ #!/usr/bin/env python3 -""" -init: data +"""init: data iter: 00.train 01.model_devi 02.vasp - 03.data + 03.data. """ import argparse @@ -20,12 +19,10 @@ import queue import random import shutil -import subprocess as sp import sys import warnings from collections import Counter from collections.abc import Iterable -from pprint import pp from typing import List import dpdata @@ -33,7 +30,7 @@ import scipy.constants as pc from numpy.linalg import norm from packaging.version import Version -from pymatgen.io.vasp import Incar, Kpoints, Potcar +from pymatgen.io.vasp import Incar, Kpoints from dpgen import ROOT_PATH, SHORT_CMD, dlog from dpgen.auto_test.lib.vasp import make_kspacing_kpoints @@ -68,26 +65,21 @@ # from dpgen.generator.lib.pwscf import cvt_1frame from dpgen.generator.lib.pwmat import ( - input_upper, make_pwmat_input_dict, make_pwmat_input_user_dict, write_input_dict, ) from dpgen.generator.lib.pwscf import make_pwscf_input from dpgen.generator.lib.run_calypso import ( - analysis, - gen_structures, run_calypso_model_devi, ) from dpgen.generator.lib.siesta import make_siesta_input from dpgen.generator.lib.utils import ( - copy_file_list, create_path, log_iter, log_task, make_iter_name, record_iter, - replace, symlink_user_forward_files, ) from dpgen.generator.lib.vasp import ( @@ -196,7 +188,7 @@ def poscar_natoms(lines): def poscar_shuffle(poscar_in, poscar_out): - with open(poscar_in, "r") as fin: + with open(poscar_in) as fin: lines = list(fin) numb_atoms = poscar_natoms(lines) idx = np.arange(8, 8 + numb_atoms) @@ -530,7 +522,7 @@ def make_train(iter_index, jdata, mdata): os.path.isdir(jj) if "#" not in jj else os.path.isfile(jj.split("#")[0]) ): raise RuntimeError( - "data sys %s does not exists, cwd is %s" % (jj, os.getcwd()) + f"data sys {jj} does not exists, cwd is {os.getcwd()}" ) os.chdir(cwd) # set random seed for each model @@ -625,9 +617,8 @@ def make_train(iter_index, jdata, mdata): def _link_old_models(work_path, old_model_files, ii): - """ - link the `ii`th old model given by `old_model_files` to - the `ii`th training task in `work_path` + """Link the `ii`th old model given by `old_model_files` to + the `ii`th training task in `work_path`. """ task_path = os.path.join(work_path, train_task_fmt % ii) task_old_path = os.path.join(task_path, "old") @@ -656,6 +647,12 @@ def detect_batch_size(batch_size, system=None): raise RuntimeError("Unsupported batch size") +def get_nframes(system): + format = "deepmd/npy" if "#" not in system else "deepmd/hdf5" + s = dpdata.LabeledSystem(system, fmt=format) + return s.get_nframes() + + def run_train(iter_index, jdata, mdata): # print("debug:run_train:mdata", mdata) # load json param @@ -702,17 +699,11 @@ def run_train(iter_index, jdata, mdata): extra_flags = "" if jdata.get("dp_train_skip_neighbor_stat", False): extra_flags += " --skip-neighbor-stat" - command = "%s train %s%s" % (train_command, train_input_file, extra_flags) + command = f"{train_command} train {train_input_file}{extra_flags}" if training_init_model: - command = ( - "{ if [ ! -f model.ckpt.index ]; then %s --init-model old/model.ckpt; else %s --restart model.ckpt; fi }" - % (command, command) - ) + command = f"{{ if [ ! -f model.ckpt.index ]; then {command} --init-model old/model.ckpt; else {command} --restart model.ckpt; fi }}" else: - command = ( - "{ if [ ! -f model.ckpt.index ]; then %s; else %s --restart model.ckpt; fi }" - % (command, command) - ) + command = f"{{ if [ ! -f model.ckpt.index ]; then {command}; else {command} --restart model.ckpt; fi }}" command = "/bin/sh -c '%s'" % command commands.append(command) command = "%s freeze" % train_command @@ -840,8 +831,7 @@ def _get_param_alias(jdata, names): if ii in jdata: return jdata[ii] raise ValueError( - "one of the keys %s should be in jdata %s" - % (str(names), (json.dumps(jdata, indent=4))) + f"one of the keys {str(names)} should be in jdata {json.dumps(jdata, indent=4)}" ) @@ -983,7 +973,7 @@ def revise_lmp_input_plm(lmp_lines, in_plm, out_plm="output.plumed"): idx = find_only_one_key(lmp_lines, ["fix", "dpgen_plm"]) lmp_lines[ idx - ] = "fix dpgen_plm all plumed plumedfile %s outfile %s\n" % ( + ] = "fix dpgen_plm all plumed plumedfile {} outfile {}\n".format( in_plm, out_plm, ) @@ -1833,7 +1823,7 @@ def run_md_model_devi(iter_index, jdata, mdata): all_task = glob.glob(os.path.join(work_path, "task.*")) all_task.sort() - fp = open(os.path.join(work_path, "cur_job.json"), "r") + fp = open(os.path.join(work_path, "cur_job.json")) cur_job = json.load(fp) run_tasks_ = all_task @@ -1854,10 +1844,7 @@ def run_md_model_devi(iter_index, jdata, mdata): model_devi_engine = jdata.get("model_devi_engine", "lammps") if model_devi_engine == "lammps": - command = ( - "{ if [ ! -f dpgen.restart.10000 ]; then %s -i input.lammps -v restart 0; else %s -i input.lammps -v restart 1; fi }" - % (model_devi_exec, model_devi_exec) - ) + command = f"{{ if [ ! -f dpgen.restart.10000 ]; then {model_devi_exec} -i input.lammps -v restart 0; else {model_devi_exec} -i input.lammps -v restart 1; fi }}" command = "/bin/sh -c '%s'" % command commands = [command] @@ -1900,20 +1887,17 @@ def run_md_model_devi(iter_index, jdata, mdata): deffnm, maxwarn, ) - command += "&& %s mdrun -deffnm %s -cpi" % (model_devi_exec, deffnm) + command += f"&& {model_devi_exec} mdrun -deffnm {deffnm} -cpi" if ndx_filename: command += f'&& echo -e "{grp_name}\\n{grp_name}\\n" | {model_devi_exec} trjconv -s {ref_filename} -f {deffnm}.trr -n {ndx_filename} -o {traj_filename} -pbc mol -ur compact -center' else: - command += ( - '&& echo -e "%s\\n%s\\n" | %s trjconv -s %s -f %s.trr -o %s -pbc mol -ur compact -center' - % ( - grp_name, - grp_name, - model_devi_exec, - ref_filename, - deffnm, - traj_filename, - ) + command += '&& echo -e "{}\\n{}\\n" | {} trjconv -s {} -f {}.trr -o {} -pbc mol -ur compact -center'.format( + grp_name, + grp_name, + model_devi_exec, + ref_filename, + deffnm, + traj_filename, ) command += "&& if [ ! -d traj ]; then \n mkdir traj; fi\n" command += f"python -c \"import dpdata;system = dpdata.System('{traj_filename}', fmt='gromacs/gro'); [system.to_gromacs_gro('traj/%d.gromacstrj' % (i * {trj_freq}), frame_idx=i) for i in range(system.get_nframes())]; system.to_deepmd_npy('traj_deepmd')\"" @@ -2113,9 +2097,7 @@ def _select_by_model_devi_standard( iter_name = modd_system_task[0].split("/")[0] _work_path = os.path.join(iter_name, model_devi_name) # calypso_run_opt_path = os.path.join(_work_path,calypso_run_opt_name) - calypso_run_opt_path = glob.glob( - "%s/%s.*" % (_work_path, calypso_run_opt_name) - )[0] + calypso_run_opt_path = glob.glob(f"{_work_path}/{calypso_run_opt_name}.*")[0] numofspecies = _parse_calypso_input("NumberOfSpecies", calypso_run_opt_path) min_dis = _parse_calypso_dis_mtx(numofspecies, calypso_run_opt_path) fp_candidate = [] @@ -2213,17 +2195,17 @@ def _select_by_model_devi_adaptive_trust_low( model_devi_f_avg_relative: bool = False, model_devi_merge_traj: bool = False, ): - """ - modd_system_task model deviation tasks belonging to one system + """modd_system_task model deviation tasks belonging to one system f_trust_hi numb_candi_f number of candidate due to the f model deviation perc_candi_f percentage of candidate due to the f model deviation v_trust_hi numb_candi_v number of candidate due to the v model deviation perc_candi_v percentage of candidate due to the v model deviation - model_devi_skip + model_devi_skip. - returns + Returns + ------- accur the accurate set candi the candidate set failed the failed set @@ -2316,31 +2298,27 @@ def _make_fp_vasp_inner( type_map, jdata, ): - """ - iter_index int iter index + """iter_index int iter index modd_path string path of model devi work_path string path of fp fp_task_max int max number of tasks fp_link_files [string] linked files for fp, POTCAR for example - fp_params map parameters for fp + fp_params map parameters for fp. """ - # -------------------------------------------------------------------------------------------------------------------------------------- model_devi_engine = jdata.get("model_devi_engine", "lammps") if model_devi_engine == "calypso": iter_name = work_path.split("/")[0] _work_path = os.path.join(iter_name, model_devi_name) # calypso_run_opt_path = os.path.join(_work_path,calypso_run_opt_name) - calypso_run_opt_path = glob.glob( - "%s/%s.*" % (_work_path, calypso_run_opt_name) - )[0] + calypso_run_opt_path = glob.glob(f"{_work_path}/{calypso_run_opt_name}.*")[0] numofspecies = _parse_calypso_input("NumberOfSpecies", calypso_run_opt_path) min_dis = _parse_calypso_dis_mtx(numofspecies, calypso_run_opt_path) calypso_total_fp_num = 300 modd_path = os.path.join(modd_path, calypso_model_devi_name) model_devi_skip = -1 - with open(os.path.join(modd_path, "Model_Devi.out"), "r") as summfile: + with open(os.path.join(modd_path, "Model_Devi.out")) as summfile: summary = np.loadtxt(summfile) summaryfmax = summary[:, -4] dis = summary[:, -1] @@ -2354,7 +2332,7 @@ def _make_fp_vasp_inner( tot = len(summaryfmax) - nan_num candi_num = tot - acc_num - fail_num dlog.info( - "summary accurate_ratio: {0:8.4f}% candidata_ratio: {1:8.4f}% failed_ratio: {2:8.4f}% in {3:d} structures".format( + "summary accurate_ratio: {:8.4f}% candidata_ratio: {:8.4f}% failed_ratio: {:8.4f}% in {:d} structures".format( acc_num * 100 / tot, candi_num * 100 / tot, fail_num * 100 / tot, tot ) ) @@ -2451,7 +2429,7 @@ def _trust_limitation_check(sys_idx, lim): model_devi_merge_traj=model_devi_merge_traj, ) dlog.info( - "system {0:s} {1:9s} : f_trust_lo {2:6.3f} v_trust_lo {3:6.3f}".format( + "system {:s} {:9s} : f_trust_lo {:6.3f} v_trust_lo {:6.3f}".format( ss, "adapted", f_trust_lo_ad, v_trust_lo_ad ) ) @@ -2504,13 +2482,11 @@ def _trust_limitation_check(sys_idx, lim): fp_sum = sum(counter.values()) if fp_sum == 0: - dlog.info( - "system {0:s} has no fp task, maybe the model devi is nan %".format(ss) - ) + dlog.info(f"system {ss:s} has no fp task, maybe the model devi is nan %") continue for cc_key, cc_value in counter.items(): dlog.info( - "system {0:s} {1:9s} : {2:6d} in {3:6d} {4:6.2f} %".format( + "system {:s} {:9s} : {:6d} in {:6d} {:6.2f} %".format( ss, cc_key, cc_value, fp_sum, cc_value / fp_sum * 100 ) ) @@ -2586,7 +2562,7 @@ def _trust_limitation_check(sys_idx, lim): numb_task = 0 # ---------------------------------------------------------------------------- dlog.info( - "system {0:s} accurate_ratio: {1:8.4f} thresholds: {2:6.4f} and {3:6.4f} eff. task min and max {4:4d} {5:4d} number of fp tasks: {6:6d}".format( + "system {:s} accurate_ratio: {:8.4f} thresholds: {:6.4f} and {:6.4f} eff. task min and max {:4d} {:4d} number of fp tasks: {:6d}".format( ss, accurate_ratio, fp_accurate_soft_threshold, @@ -2601,6 +2577,7 @@ def _trust_limitation_check(sys_idx, lim): # read all.lammpstrj, save in all_sys for each system_index all_sys = [] trj_freq = None + netcdftraj = None if model_devi_merge_traj: for ii in modd_system_task: all_traj = os.path.join(ii, "all.lammpstrj") @@ -2665,7 +2642,7 @@ def _trust_limitation_check(sys_idx, lim): if cluster_cutoff is not None: # take clusters jj = fp_candidate[cc][2] - poscar_name = "{}.cluster.{}.POSCAR".format(conf_name, jj) + poscar_name = f"{conf_name}.cluster.{jj}.POSCAR" new_system = take_cluster(conf_name, type_map, jj, jdata) new_system.to_vasp_poscar(poscar_name) fp_task_name = make_fp_task_name(int(ss), cc) @@ -2725,19 +2702,19 @@ def _trust_limitation_check(sys_idx, lim): os.chdir(cwd) if count_bad_box > 0: dlog.info( - "system {0:s} skipped {1:6d} confs with bad box, {2:6d} remains".format( + "system {:s} skipped {:6d} confs with bad box, {:6d} remains".format( ss, count_bad_box, numb_task - count_bad_box ) ) if count_bad_cluster > 0: dlog.info( - "system {0:s} skipped {1:6d} confs with bad cluster, {2:6d} remains".format( + "system {:s} skipped {:6d} confs with bad cluster, {:6d} remains".format( ss, count_bad_cluster, numb_task - count_bad_cluster ) ) if model_devi_engine == "calypso": dlog.info( - "summary accurate_ratio: {0:8.4f}% candidata_ratio: {1:8.4f}% failed_ratio: {2:8.4f}% in {3:d} structures".format( + "summary accurate_ratio: {:8.4f}% candidata_ratio: {:8.4f}% failed_ratio: {:8.4f}% in {:d} structures".format( acc_num * 100 / tot, candi_num * 100 / tot, fail_num * 100 / tot, tot ) ) @@ -2928,7 +2905,7 @@ def _make_fp_pwmat_input(iter_index, jdata): def make_fp_vasp_cp_cvasp(iter_index, jdata): # Move cvasp interface to jdata - if ("cvasp" in jdata) and (jdata["cvasp"] == True): + if ("cvasp" in jdata) and (jdata["cvasp"] is True): pass else: return @@ -3073,14 +3050,13 @@ def _link_fp_abacus_pporb_descript(iter_index, jdata): # get value of 'deepks_model' from INPUT input_param = get_abacus_input_parameters("INPUT") fp_dpks_model = input_param.get("deepks_model", None) - if fp_dpks_model != None: + if fp_dpks_model is not None: model_file = os.path.join( fp_pp_path, os.path.split(fp_dpks_model)[1] ) # only the filename - assert os.path.isfile(model_file), ( - "Can not find the deepks model file %s, which is defined in %s/INPUT" - % (model_file, ii) - ) + assert os.path.isfile( + model_file + ), f"Can not find the deepks model file {model_file}, which is defined in {ii}/INPUT" os.symlink(model_file, fp_dpks_model) # link to the model file # get pp, orb, descriptor filenames from STRU @@ -3156,7 +3132,7 @@ def _make_fp_vasp_configs(iter_index: int, jdata: dict): modd_path = os.path.join(iter_name, model_devi_name) task_min = -1 if os.path.isfile(os.path.join(modd_path, "cur_job.json")): - cur_job = json.load(open(os.path.join(modd_path, "cur_job.json"), "r")) + cur_job = json.load(open(os.path.join(modd_path, "cur_job.json"))) if "task_min" in cur_job: task_min = cur_job["task_min"] else: @@ -3615,7 +3591,7 @@ def make_fp_calculation(iter_index, jdata, mdata): def _vasp_check_fin(ii): if os.path.isfile(os.path.join(ii, "OUTCAR")): - with open(os.path.join(ii, "OUTCAR"), "r") as fp: + with open(os.path.join(ii, "OUTCAR")) as fp: content = fp.read() count = content.count("Elapse") if count != 1: @@ -3627,7 +3603,7 @@ def _vasp_check_fin(ii): def _qe_check_fin(ii): if os.path.isfile(os.path.join(ii, "output")): - with open(os.path.join(ii, "output"), "r") as fp: + with open(os.path.join(ii, "output")) as fp: content = fp.read() count = content.count("JOB DONE") if count != 1: @@ -3639,7 +3615,7 @@ def _qe_check_fin(ii): def _abacus_scf_check_fin(ii): if os.path.isfile(os.path.join(ii, "OUT.ABACUS/running_scf.log")): - with open(os.path.join(ii, "OUT.ABACUS/running_scf.log"), "r") as fp: + with open(os.path.join(ii, "OUT.ABACUS/running_scf.log")) as fp: content = fp.read() count = content.count("!FINAL_ETOT_IS") if count != 1: @@ -3651,7 +3627,7 @@ def _abacus_scf_check_fin(ii): def _siesta_check_fin(ii): if os.path.isfile(os.path.join(ii, "output")): - with open(os.path.join(ii, "output"), "r") as fp: + with open(os.path.join(ii, "output")) as fp: content = fp.read() count = content.count("End of run") if count != 1: @@ -3663,7 +3639,7 @@ def _siesta_check_fin(ii): def _gaussian_check_fin(ii): if os.path.isfile(os.path.join(ii, "output")): - with open(os.path.join(ii, "output"), "r") as fp: + with open(os.path.join(ii, "output")) as fp: content = fp.read() count = content.count("termination") if count == 0: @@ -3675,7 +3651,7 @@ def _gaussian_check_fin(ii): def _cp2k_check_fin(ii): if os.path.isfile(os.path.join(ii, "output")): - with open(os.path.join(ii, "output"), "r") as fp: + with open(os.path.join(ii, "output")) as fp: content = fp.read() count = content.count("SCF run converged") if count == 0: @@ -3687,7 +3663,7 @@ def _cp2k_check_fin(ii): def _pwmat_check_fin(ii): if os.path.isfile(os.path.join(ii, "REPORT")): - with open(os.path.join(ii, "REPORT"), "r") as fp: + with open(os.path.join(ii, "REPORT")) as fp: content = fp.read() count = content.count("time") if count != 1: @@ -3741,9 +3717,8 @@ def run_fp_inner( "-x high_level.nc -y rc.nc -frc high_level.mdfrc -inf high_level.mdinfo && " ) + ( - 'dpamber corr --cutoff %f --parm7_file ../qmmm$SYS.parm7 --nc rc.nc --hl high_level --ll low_level --qm_region "$QM_REGION"' - ) - % (jdata["cutoff"],) + 'dpamber corr --cutoff {:f} --parm7_file ../qmmm$SYS.parm7 --nc rc.nc --hl high_level --ll low_level --qm_region "$QM_REGION"' + ).format(jdata["cutoff"]) ) fp_run_tasks = fp_tasks @@ -3787,10 +3762,10 @@ def run_fp(iter_index, jdata, mdata): forward_files = ["POSCAR", "INCAR", "POTCAR", "KPOINTS"] backward_files = ["fp.log", "OUTCAR", "vasprun.xml"] # Move cvasp interface to jdata - if ("cvasp" in jdata) and (jdata["cvasp"] == True): + if ("cvasp" in jdata) and (jdata["cvasp"] is True): mdata["fp_resources"]["cvasp"] = True if ("cvasp" in mdata["fp_resources"]) and ( - mdata["fp_resources"]["cvasp"] == True + mdata["fp_resources"]["cvasp"] is True ): dlog.info("cvasp is on !") forward_files.append("cvasp.py") @@ -4134,12 +4109,12 @@ def post_fp_abacus_scf(iter_index, jdata): oo, fmt="abacus/scf", type_map=jdata["type_map"] ) if len(_sys) > 0: - if all_sys == None: + if all_sys is None: all_sys = _sys else: all_sys.append(_sys) - if all_sys != None: + if all_sys is not None: sys_data_path = os.path.join(work_path, "data.%s" % ss) all_sys.to_deepmd_raw(sys_data_path) all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_output)) @@ -4340,7 +4315,7 @@ def post_fp_pwmat(iter_index, jdata, rfailed=None): dlog.info("failed frame number: %s " % icount) dlog.info("total frame number: %s " % tcount) reff = icount / tcount - dlog.info("ratio of failed frame: {:.2%}".format(reff)) + dlog.info(f"ratio of failed frame: {reff:.2%}") if reff > ratio_failed: raise RuntimeError("find too many unsuccessfully terminated jobs") @@ -4434,9 +4409,9 @@ def run_iter(param_file, machine_file): jdata = loadfn(param_file) mdata = loadfn(machine_file) except Exception: - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) jdata_arginfo = run_jdata_arginfo() @@ -4495,7 +4470,7 @@ def run_iter(param_file, machine_file): if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1]: continue task_name = "task %02d" % jj - sepline("{} {}".format(iter_name, task_name), "-") + sepline(f"{iter_name} {task_name}", "-") if jj == 0: log_iter("make_train", ii, jj) make_train(ii, jdata, mdata) diff --git a/dpgen/main.py b/dpgen/main.py index c0a94803d..42b65c116 100644 --- a/dpgen/main.py +++ b/dpgen/main.py @@ -1,13 +1,11 @@ #!/usr/bin/env python -# coding: utf-8 # Copyright (c) DeepGenerator Development Team. import argparse -import itertools import sys -from dpgen import __version__, info +from dpgen import info from dpgen.auto_test.run import gen_test from dpgen.collect.collect import gen_collect from dpgen.data.gen import gen_init_bulk diff --git a/dpgen/remote/decide_machine.py b/dpgen/remote/decide_machine.py index ced049ef0..e76c61e2d 100644 --- a/dpgen/remote/decide_machine.py +++ b/dpgen/remote/decide_machine.py @@ -1,12 +1,10 @@ #!/usr/bin/env python -# coding: utf-8 def convert_mdata(mdata, task_types=["train", "model_devi", "fp"]): - """ - Convert mdata for DP-GEN main process. + """Convert mdata for DP-GEN main process. New convension is like mdata["fp"]["machine"], - DP-GEN needs mdata["fp_machine"] + DP-GEN needs mdata["fp_machine"]. Notice that we deprecate the function which can automatically select one most avalaible machine, since this function was only used by Angus, and only supports for Slurm. diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index b7eaa29b5..3124fe115 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -14,6 +14,7 @@ import os import queue import warnings +from collections import defaultdict from typing import List, Union import dpdata @@ -29,24 +30,18 @@ log_iter, make_iter_name, record_iter, - symlink_user_forward_files, ) from dpgen.generator.run import ( data_system_fmt, fp_name, fp_task_fmt, make_fp_calculation, - make_fp_vasp_cp_cvasp, - make_fp_vasp_incar, - make_fp_vasp_kp, make_train, model_devi_name, - model_devi_task_fmt, post_fp, post_train, run_fp, run_train, - sys_link_fp_vasp_pp, train_name, train_task_fmt, ) @@ -137,7 +132,7 @@ def init_model(iter_index, jdata, mdata): def init_pick(iter_index, jdata, mdata): - """pick up init data from dataset randomly""" + """Pick up init data from dataset randomly.""" pick_data = jdata["pick_data"] init_pick_number = jdata["init_pick_number"] # use MultiSystems with System @@ -183,7 +178,7 @@ def _init_dump_selected_frames(systems, labels, selc_idx, sys_data_path, jdata): def make_model_devi(iter_index, jdata, mdata): - """calculate the model deviation of the rest idx""" + """Calculate the model deviation of the rest idx.""" pick_data = jdata["pick_data"] iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, model_devi_name) @@ -208,7 +203,7 @@ def make_model_devi(iter_index, jdata, mdata): def run_model_devi(iter_index, jdata, mdata): - """submit dp test tasks""" + """Submit dp test tasks.""" iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, model_devi_name) # generate command @@ -269,7 +264,7 @@ def run_model_devi(iter_index, jdata, mdata): def post_model_devi(iter_index, jdata, mdata): - """calculate the model deviation""" + """Calculate the model deviation.""" iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, model_devi_name) @@ -314,7 +309,7 @@ def post_model_devi(iter_index, jdata, mdata): fp_sum = sum(counter.values()) for cc_key, cc_value in counter.items(): dlog.info( - "{0:9s} : {1:6d} in {2:6d} {3:6.2f} %".format( + "{:9s} : {:6d} in {:6d} {:6.2f} %".format( cc_key, cc_value, fp_sum, cc_value / fp_sum * 100 ) ) @@ -341,7 +336,7 @@ def post_model_devi(iter_index, jdata, mdata): dlog.info("no candidate") else: dlog.info( - "total candidate {0:6d} picked {1:6d} ({2:6.2f} %) rest {3:6d} ({4:6.2f} % )".format( + "total candidate {:6d} picked {:6d} ({:6.2f} %) rest {:6d} ({:6.2f} % )".format( counter["candidate"], len(pick_idx), float(len(pick_idx)) / counter["candidate"] * 100.0, @@ -425,7 +420,7 @@ def make_fp(iter_index, jdata, mdata): def run_iter(param_file, machine_file): - """init (iter 0): init_pick + """Init (iter 0): init_pick. tasks (iter > 0): 00 make_train (same as generator) @@ -441,15 +436,15 @@ def run_iter(param_file, machine_file): # TODO: function of handling input json should be combined as one function try: import ruamel - from monty.serialization import dumpfn, loadfn + from monty.serialization import loadfn warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) jdata = loadfn(param_file) mdata = loadfn(machine_file) except Exception: - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) jdata_arginfo = simplify_jdata_arginfo() @@ -485,7 +480,7 @@ def run_iter(param_file, machine_file): if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1]: continue task_name = "task %02d" % jj - sepline("{} {}".format(iter_name, task_name), "-") + sepline(f"{iter_name} {task_name}", "-") jdata["model_devi_jobs"] = [{} for _ in range(ii + 1)] if ii == 0 and jj < 6 and (jj >= 3 or not jdata.get("init_data_sys", [])): if jj == 0: diff --git a/dpgen/tools/auto_gen_param.py b/dpgen/tools/auto_gen_param.py index df5793be3..6d837dc47 100755 --- a/dpgen/tools/auto_gen_param.py +++ b/dpgen/tools/auto_gen_param.py @@ -6,7 +6,7 @@ from itertools import tee -class System(object): +class System: current_num_of_system = 0 current_num_of_sub_systems = 0 @@ -49,7 +49,7 @@ def get_sub_system(self): return self.sub_system_list -class Iteration(object): +class Iteration: current_num_of_itearation = 0 current_num_of_sub_itearation = 0 @@ -133,8 +133,7 @@ def get_system_list( map_iterator=None, file_name="POSCAR", ): - """ - :type map_iterator: Iterable use to generate sys_configs + """:type map_iterator: Iterable use to generate sys_configs :Exmaple [['000000', '000001',], ['00000[2-9]',], ['00001?', '000020',],] """ if sub_iteration_num != len(map_list): diff --git a/dpgen/tools/collect_data.py b/dpgen/tools/collect_data.py index 2a270a47e..511dacc24 100755 --- a/dpgen/tools/collect_data.py +++ b/dpgen/tools/collect_data.py @@ -5,9 +5,6 @@ import json import os import subprocess as sp -import sys - -import numpy as np def file_len(fname): diff --git a/dpgen/tools/relabel.py b/dpgen/tools/relabel.py index ac5196eaa..140e614fa 100755 --- a/dpgen/tools/relabel.py +++ b/dpgen/tools/relabel.py @@ -5,17 +5,14 @@ import json import os import shutil -import subprocess as sp import sys -import numpy as np - sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) import dpdata from dpgen.generator.lib.pwscf import make_pwscf_input from dpgen.generator.lib.siesta import make_siesta_input -from dpgen.generator.run import make_vasp_incar, update_mass_map +from dpgen.generator.run import update_mass_map def get_lmp_info(input_file): @@ -180,7 +177,7 @@ def create_tasks( os.chdir(target_folder) fp_pp_path = os.path.abspath(fp_pp_path) os.chdir(cwd_) - # fp_params = fp_jdata['fp_params'] + fp_params = fp_jdata["fp_params"] # collect tasks from iter dirs sys_tasks = [[] for ii in sys] sys_tasks_record = [[] for ii in sys] diff --git a/dpgen/tools/run_report.py b/dpgen/tools/run_report.py index 88b3a4b06..1bc8f3d9f 100755 --- a/dpgen/tools/run_report.py +++ b/dpgen/tools/run_report.py @@ -1,14 +1,5 @@ #!/usr/bin/env python3 -import argparse -import glob -import json -import os -import shutil -import subprocess as sp -import sys - -import numpy as np from dpgen.tools.stat_iter import stat_iter from dpgen.tools.stat_sys import stat_sys diff --git a/dpgen/tools/stat_iter.py b/dpgen/tools/stat_iter.py index 5a3eb8932..43a0617fa 100644 --- a/dpgen/tools/stat_iter.py +++ b/dpgen/tools/stat_iter.py @@ -3,7 +3,6 @@ import json import os import subprocess -import sys from collections import defaultdict import dpdata diff --git a/dpgen/tools/stat_sys.py b/dpgen/tools/stat_sys.py index 5a0cb6471..c2f704bb1 100644 --- a/dpgen/tools/stat_sys.py +++ b/dpgen/tools/stat_sys.py @@ -1,15 +1,10 @@ #!/usr/bin/env python3 -import argparse import glob import json import os -import shutil -import subprocess as sp import sys -import numpy as np - sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) from dpgen.tools.relabel import get_lmp_info @@ -62,7 +57,7 @@ def stat_sys(target_folder, param_file="param.json", verbose=True, mute=False): os.path.join(ii, "01.model_devi", linked_keys[-3], "input.lammps") ) trait = [ens, temp, pres] - if not trait in sys_tasks_trait[sys_idx]: + if trait not in sys_tasks_trait[sys_idx]: sys_tasks_trait[sys_idx].append(trait) sys_tasks_trait_count[sys_idx].append(0) t_idx = sys_tasks_trait[sys_idx].index(trait) @@ -103,4 +98,4 @@ def stat_sys(target_folder, param_file="param.json", verbose=True, mute=False): def run_report(args): - stat_tasks(args.JOB_DIR, args.param, args.verbose) + stat_sys(args.JOB_DIR, args.param, args.verbose) diff --git a/dpgen/util.py b/dpgen/util.py index d25d0a31e..1a6db4814 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 import json import os from pathlib import Path @@ -20,9 +19,7 @@ def sepline(ch="-", sp="-", screen=False): - r""" - seperate the output by '-' - """ + r"""Seperate the output by '-'.""" if screen: print(ch.center(MaxLength, sp)) else: @@ -30,10 +27,8 @@ def sepline(ch="-", sp="-", screen=False): def box_center(ch="", fill=" ", sp="|"): - r""" - put the string at the center of | | - """ - strs = ch.center(Len, fill) + r"""Put the string at the center of | |.""" + strs = ch.center(MaxLength, fill) dlog.info(sp + strs[1 : len(strs) - 1 :] + sp) @@ -64,9 +59,7 @@ def expand_sys_str(root_dir: Union[str, Path]) -> List[str]: f_keys = ["/"] f.visit(lambda x: f_keys.append("/" + x)) matches = [ - "%s#%s" % (root_dir, d) - for d in f_keys - if str(Path(d) / "type.raw") in f_keys + f"{root_dir}#{d}" for d in f_keys if str(Path(d) / "type.raw") in f_keys ] else: raise OSError(f"{root_dir} does not exist.") diff --git a/pyproject.toml b/pyproject.toml index c893bddd1..3bec52c1e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,32 @@ write_to = "dpgen/_version.py" profile = "black" [tool.ruff] -target-version = "py37" +target-version = "py38" select = [ "I", # isort + "E", # errors + "F", # pyflakes + "D", # pydocstyle + "UP", # pyupgrade ] +ignore = [ + "E501", # line too long + "F841", # local variable is assigned to but never used + "E741", # ambiguous variable name + "E402", # module level import not at top of file + "D413", # missing blank line after last section + "D416", # section name should end with a colon + "D203", # 1 blank line required before class docstring + "D107", # missing docstring in __init__ + "D213", # multi-line docstring summary should start at the second line + "D100", # TODO: missing docstring in public module + "D101", # TODO: missing docstring in public class + "D102", # TODO: missing docstring in public method + "D103", # TODO: missing docstring in public function + "D104", # TODO: missing docstring in public package + "D105", # TODO: missing docstring in magic method + "D205", # 1 blank line required between summary line and description + "D401", # TODO: first line should be in imperative mood + "D404", # TODO: first word of the docstring should not be This +] +ignore-init-module-imports = true diff --git a/tests/auto_test/context.py b/tests/auto_test/context.py index 454820555..37f558c74 100644 --- a/tests/auto_test/context.py +++ b/tests/auto_test/context.py @@ -2,7 +2,7 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.auto_test.lib.vasp import * +from dpgen.auto_test.lib.vasp import * # noqa: F403 def setUpModule(): diff --git a/tests/auto_test/test_abacus.py b/tests/auto_test/test_abacus.py index bc3d4f9ca..9cfedd3d1 100644 --- a/tests/auto_test/test_abacus.py +++ b/tests/auto_test/test_abacus.py @@ -12,7 +12,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" -from .context import setUpModule +from .context import setUpModule # noqa: F401 class TestABACUS(unittest.TestCase): diff --git a/tests/auto_test/test_abacus_equi.py b/tests/auto_test/test_abacus_equi.py index d5583567d..c2a5ce144 100644 --- a/tests/auto_test/test_abacus_equi.py +++ b/tests/auto_test/test_abacus_equi.py @@ -1,5 +1,3 @@ -import glob -import json import os import shutil import sys @@ -12,7 +10,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" -from .context import setUpModule +from .context import setUpModule # noqa: F401 class TestEqui(unittest.TestCase): diff --git a/tests/auto_test/test_abacus_property.py b/tests/auto_test/test_abacus_property.py index 2e366278f..edcc3985c 100644 --- a/tests/auto_test/test_abacus_property.py +++ b/tests/auto_test/test_abacus_property.py @@ -20,7 +20,7 @@ from dpgen.auto_test.Surface import Surface from dpgen.auto_test.Vacancy import Vacancy -from .context import setUpModule +from .context import setUpModule # noqa: F401 class TestABACUS(unittest.TestCase): diff --git a/tests/auto_test/test_elastic.py b/tests/auto_test/test_elastic.py index 0a4b83725..1a56655ae 100644 --- a/tests/auto_test/test_elastic.py +++ b/tests/auto_test/test_elastic.py @@ -1,14 +1,9 @@ import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn -from pymatgen.analysis.elasticity.strain import Deformation, Strain from pymatgen.core import Structure from pymatgen.io.vasp import Incar @@ -17,7 +12,7 @@ from dpgen.auto_test.Elastic import Elastic -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestElastic(unittest.TestCase): diff --git a/tests/auto_test/test_eos.py b/tests/auto_test/test_eos.py index de68fae95..bd3d15251 100644 --- a/tests/auto_test/test_eos.py +++ b/tests/auto_test/test_eos.py @@ -1,5 +1,4 @@ import glob -import json import os import shutil import sys @@ -7,7 +6,7 @@ import dpdata import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn from pymatgen.io.vasp import Incar sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) @@ -15,7 +14,7 @@ from dpgen.auto_test.EOS import EOS -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestEOS(unittest.TestCase): diff --git a/tests/auto_test/test_gamma.py b/tests/auto_test/test_gamma.py index 7cdd97371..7268c58a2 100644 --- a/tests/auto_test/test_gamma.py +++ b/tests/auto_test/test_gamma.py @@ -1,33 +1,18 @@ import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from ase.lattice.cubic import BodyCenteredCubic as bcc -from ase.lattice.cubic import FaceCenteredCubic as fcc -from ase.lattice.hexagonal import HexagonalClosedPacked as hcp -from monty.serialization import dumpfn, loadfn from pymatgen.core.structure import Structure -from pymatgen.core.surface import SlabGenerator -from pymatgen.io.ase import AseAtomsAdaptor from pymatgen.io.vasp import Incar -import dpgen.auto_test.lib.vasp as vasp -from dpgen import dlog -from dpgen.auto_test.Property import Property -from dpgen.auto_test.refine import make_refine -from dpgen.auto_test.reproduce import make_repro, post_repro - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" from dpgen.auto_test.Gamma import Gamma -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestGamma(unittest.TestCase): @@ -115,7 +100,7 @@ def test_make_confs_bcc(self): st1_file = os.path.join(ii, "POSCAR.tmp") self.assertTrue(os.path.isfile(st1_file)) st1 = Structure.from_file(st1_file) - with open(st1_file, mode="r") as f: + with open(st1_file) as f: z_coord_str = f.readlines()[-1].split()[-2] z_coord = float(z_coord_str) self.assertTrue(z_coord <= 1) diff --git a/tests/auto_test/test_interstitial.py b/tests/auto_test/test_interstitial.py index ce22631bb..51e8ec276 100644 --- a/tests/auto_test/test_interstitial.py +++ b/tests/auto_test/test_interstitial.py @@ -1,24 +1,20 @@ import glob -import json import os import shutil import sys import unittest -import dpdata import numpy as np -from monty.serialization import dumpfn, loadfn from pymatgen.analysis.defects.core import Interstitial as pmg_Interstitial from pymatgen.core import Structure from pymatgen.io.vasp import Incar -from pymatgen.symmetry.analyzer import SpacegroupAnalyzer sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" from dpgen.auto_test.Interstitial import Interstitial -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestInterstitial(unittest.TestCase): diff --git a/tests/auto_test/test_lammps.py b/tests/auto_test/test_lammps.py index a13f5c6a8..5bf420558 100644 --- a/tests/auto_test/test_lammps.py +++ b/tests/auto_test/test_lammps.py @@ -1,13 +1,9 @@ -import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" @@ -15,7 +11,7 @@ from dpgen.auto_test.Lammps import Lammps from dpgen.auto_test.lib.lammps import inter_deepmd -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestLammps(unittest.TestCase): diff --git a/tests/auto_test/test_make_prop.py b/tests/auto_test/test_make_prop.py index 2c63b5845..5e6649508 100644 --- a/tests/auto_test/test_make_prop.py +++ b/tests/auto_test/test_make_prop.py @@ -1,13 +1,10 @@ import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" @@ -16,7 +13,7 @@ from dpgen.auto_test.common_prop import make_property -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestMakeProperty(unittest.TestCase): diff --git a/tests/auto_test/test_mpdb.py b/tests/auto_test/test_mpdb.py index 055240908..b27a84227 100644 --- a/tests/auto_test/test_mpdb.py +++ b/tests/auto_test/test_mpdb.py @@ -2,7 +2,6 @@ import sys import unittest -from monty.serialization import dumpfn, loadfn from pymatgen.analysis.structure_matcher import StructureMatcher from pymatgen.core import Structure @@ -10,7 +9,7 @@ __package__ = "auto_test" from dpgen.auto_test.mpdb import get_structure -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 try: os.environ["MAPI_KEY"] diff --git a/tests/auto_test/test_refine.py b/tests/auto_test/test_refine.py index 279d43e90..5b698952c 100644 --- a/tests/auto_test/test_refine.py +++ b/tests/auto_test/test_refine.py @@ -1,22 +1,15 @@ import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn -from pymatgen.io.vasp import Incar - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" from dpgen.auto_test.common_prop import make_property -from dpgen.auto_test.refine import make_refine -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestMakeProperty(unittest.TestCase): diff --git a/tests/auto_test/test_surface.py b/tests/auto_test/test_surface.py index b6abdfa26..228fb2504 100644 --- a/tests/auto_test/test_surface.py +++ b/tests/auto_test/test_surface.py @@ -1,13 +1,10 @@ import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn from pymatgen.core import Structure from pymatgen.core.surface import SlabGenerator from pymatgen.io.vasp import Incar @@ -17,7 +14,7 @@ from dpgen.auto_test.Surface import Surface -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestSurface(unittest.TestCase): diff --git a/tests/auto_test/test_vacancy.py b/tests/auto_test/test_vacancy.py index b2e348573..8ee680b69 100644 --- a/tests/auto_test/test_vacancy.py +++ b/tests/auto_test/test_vacancy.py @@ -1,13 +1,10 @@ import glob -import json import os import shutil import sys import unittest -import dpdata import numpy as np -from monty.serialization import dumpfn, loadfn from pymatgen.analysis.defects.core import Vacancy as pmg_Vacancy from pymatgen.core import Structure from pymatgen.io.vasp import Incar @@ -18,7 +15,7 @@ from dpgen.auto_test.Vacancy import Vacancy -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestVacancy(unittest.TestCase): diff --git a/tests/auto_test/test_vasp.py b/tests/auto_test/test_vasp.py index e994c8906..0fbe60b60 100644 --- a/tests/auto_test/test_vasp.py +++ b/tests/auto_test/test_vasp.py @@ -1,14 +1,10 @@ -import glob -import json import os import shutil import sys import unittest -import dpdata import numpy as np -from dpdata import LabeledSystem -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn from pymatgen.io.vasp import Incar sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) @@ -17,7 +13,7 @@ from dpgen.auto_test.VASP import VASP from dpgen.generator.lib.vasp import incar_upper -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestVASP(unittest.TestCase): @@ -123,7 +119,7 @@ def test_make_input_file_5(self): incar = incar_upper(Incar.from_file(os.path.join(self.equi_path, "INCAR"))) self.assertEqual(incar["ISIF"], 6) - def test_make_input_file_5(self): + def test_make_input_file_6(self): param = self.task_param.copy() param["cal_setting"] = { "relax_pos": False, diff --git a/tests/auto_test/test_vasp_equi.py b/tests/auto_test/test_vasp_equi.py index 37c7f6c60..1195660d0 100644 --- a/tests/auto_test/test_vasp_equi.py +++ b/tests/auto_test/test_vasp_equi.py @@ -1,23 +1,18 @@ -import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" from pymatgen.io.vasp import Incar -from dpgen.auto_test.calculator import make_calculator from dpgen.auto_test.common_equi import make_equi, post_equi -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestEqui(unittest.TestCase): diff --git a/tests/auto_test/test_vasp_equi_std.py b/tests/auto_test/test_vasp_equi_std.py index 5f513dbaa..d5f3061be 100644 --- a/tests/auto_test/test_vasp_equi_std.py +++ b/tests/auto_test/test_vasp_equi_std.py @@ -1,23 +1,18 @@ -import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np -from monty.serialization import dumpfn, loadfn +from monty.serialization import loadfn sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" from pymatgen.io.vasp import Incar -from dpgen.auto_test.calculator import make_calculator -from dpgen.auto_test.common_equi import make_equi, post_equi +from dpgen.auto_test.common_equi import make_equi -from .context import make_kspacing_kpoints, setUpModule +from .context import setUpModule # noqa: F401 class TestEqui(unittest.TestCase): diff --git a/tests/auto_test/test_vasp_kspacing.py b/tests/auto_test/test_vasp_kspacing.py index cac726a8a..43adfc2c3 100644 --- a/tests/auto_test/test_vasp_kspacing.py +++ b/tests/auto_test/test_vasp_kspacing.py @@ -1,18 +1,17 @@ import glob -import json import os -import shutil import sys import unittest -import dpdata import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "auto_test" -from pymatgen.io.vasp import Incar, Kpoints -from .context import make_kspacing_kpoints, setUpModule +from .context import ( + make_kspacing_kpoints, + setUpModule, # noqa: F401 +) class TestVASPMakeKpoint(unittest.TestCase): diff --git a/tests/data/context.py b/tests/data/context.py index 4c65e8fd7..4697fc89d 100644 --- a/tests/data/context.py +++ b/tests/data/context.py @@ -2,7 +2,7 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.data.gen import * +from dpgen.data.gen import * # noqa: F403 param_file = "al.json" abacus_param_file = "ch4.json" diff --git a/tests/data/context_bulk.py b/tests/data/context_bulk.py index 9602a2e12..a6b3567a7 100644 --- a/tests/data/context_bulk.py +++ b/tests/data/context_bulk.py @@ -2,7 +2,7 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.data.gen import * +from dpgen.data.gen import * # noqa: F403 param_file = "alloy.json" abacus_param_file = "CuW.json" diff --git a/tests/data/context_surf.py b/tests/data/context_surf.py index e4ad3516a..4a5bd2ecb 100644 --- a/tests/data/context_surf.py +++ b/tests/data/context_surf.py @@ -2,6 +2,6 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.data.surf import * +from dpgen.data.surf import * # noqa: F403 param_file = "surf.json" diff --git a/tests/data/context_surf_poscar.py b/tests/data/context_surf_poscar.py index 11d15717f..f3cf6bc77 100644 --- a/tests/data/context_surf_poscar.py +++ b/tests/data/context_surf_poscar.py @@ -2,6 +2,6 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.data.surf import * +from dpgen.data.surf import * # noqa: F403 param_file = "surf_poscar.json" diff --git a/tests/data/test_coll_abacus.py b/tests/data/test_coll_abacus.py index e6e1fd564..63e2d6e7d 100644 --- a/tests/data/test_coll_abacus.py +++ b/tests/data/test_coll_abacus.py @@ -1,4 +1,3 @@ -import glob import json import os import shutil @@ -10,12 +9,17 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import abacus_param_file, coll_abacus_md, out_dir_name, setUpModule +from .context import ( + abacus_param_file, + coll_abacus_md, + out_dir_name, + setUpModule, # noqa: F401 +) class TestCollAbacus(unittest.TestCase): def setUp(self): - with open(abacus_param_file, "r") as fp: + with open(abacus_param_file) as fp: jdata = json.load(fp) self.odir = out_dir_name(jdata) assert os.path.isdir( @@ -40,7 +44,7 @@ def tearDown(self): shutil.rmtree(self.odir) def test_coll(self): - with open(abacus_param_file, "r") as fp: + with open(abacus_param_file) as fp: jdata = json.load(fp) jdata["out_dir"] = self.odir print(os.getcwd()) diff --git a/tests/data/test_coll_vasp.py b/tests/data/test_coll_vasp.py index 75afc41d1..bb3d9c877 100644 --- a/tests/data/test_coll_vasp.py +++ b/tests/data/test_coll_vasp.py @@ -1,4 +1,3 @@ -import glob import json import os import shutil @@ -10,12 +9,17 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import coll_vasp_md, out_dir_name, param_file, setUpModule +from .context import ( + coll_vasp_md, + out_dir_name, + param_file, + setUpModule, # noqa: F401 +) class TestCollVasp(unittest.TestCase): def setUp(self): - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) self.odir = out_dir_name(jdata) assert os.path.isdir("out_data_02_md"), "out data for post fp vasp should exist" @@ -49,7 +53,7 @@ def tearDown(self): shutil.rmtree(self.odir) def test_coll(self): - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["out_dir"] = self.odir coll_vasp_md(jdata) diff --git a/tests/data/test_disturb_abacus.py b/tests/data/test_disturb_abacus.py index f64d8554c..365d3e723 100644 --- a/tests/data/test_disturb_abacus.py +++ b/tests/data/test_disturb_abacus.py @@ -8,7 +8,11 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import * +from .context import ( + abacus_stru_file, + get_abacus_STRU, + setUpModule, # noqa: F401 +) class TestPertAbacus(unittest.TestCase): diff --git a/tests/data/test_gen_bulk.py b/tests/data/test_gen_bulk.py index a8eefad87..64df71bc8 100644 --- a/tests/data/test_gen_bulk.py +++ b/tests/data/test_gen_bulk.py @@ -9,14 +9,24 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import setUpModule -from .context_bulk import * +from .context import setUpModule # noqa: F401 +from .context_bulk import ( + create_path, + make_scale, + make_super_cell, + make_unit_cell, + make_vasp_relax, + out_dir_name, + param_file, + pert_scaled, + place_element, +) class TestGenBulk(unittest.TestCase): def setUp(self): self.alloy = [] - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) if "init_fp_style" not in jdata: jdata["init_fp_style"] = "VASP" diff --git a/tests/data/test_gen_bulk_abacus.py b/tests/data/test_gen_bulk_abacus.py index 7223db6cf..83ef45fb9 100644 --- a/tests/data/test_gen_bulk_abacus.py +++ b/tests/data/test_gen_bulk_abacus.py @@ -7,14 +7,26 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import setUpModule -from .context_bulk import * +from .context import setUpModule # noqa: F401 +from .context_bulk import ( + abacus_param_file, + create_path, + get_abacus_STRU, + make_abacus_relax, + make_scale_ABACUS, + make_super_cell_ABACUS, + make_super_cell_STRU, + make_unit_cell_ABACUS, + out_dir_name, + pert_scaled, + place_element_ABACUS, +) class TestGenBulkABACUS(unittest.TestCase): def setUp(self): self.alloy = [] - with open(abacus_param_file, "r") as fp: + with open(abacus_param_file) as fp: jdata = json.load(fp) out_dir = out_dir_name(jdata) self.out_dir = out_dir diff --git a/tests/data/test_gen_surf.py b/tests/data/test_gen_surf.py index e1a484d9b..1db270a09 100644 --- a/tests/data/test_gen_surf.py +++ b/tests/data/test_gen_surf.py @@ -9,8 +9,17 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import setUpModule -from .context_surf import * +from .context import setUpModule # noqa: F401 +from .context_surf import ( + create_path, + make_scale, + make_super_cell_pymatgen, + make_vasp_relax, + out_dir_name, + param_file, + pert_scaled, + place_element, +) class TestGenSurf(unittest.TestCase): @@ -30,7 +39,7 @@ def setUp(self): "elong-7.000", "elong-8.000", ] - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) out_dir = out_dir_name(jdata) jdata["out_dir"] = out_dir diff --git a/tests/data/test_gen_surf_poscar.py b/tests/data/test_gen_surf_poscar.py index 89ebfc33c..06f559a1e 100644 --- a/tests/data/test_gen_surf_poscar.py +++ b/tests/data/test_gen_surf_poscar.py @@ -9,8 +9,17 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" -from .context import setUpModule -from .context_surf_poscar import * +from .context import setUpModule # noqa: F401 +from .context_surf_poscar import ( + create_path, + make_scale, + make_super_cell_pymatgen, + make_vasp_relax, + out_dir_name, + param_file, + pert_scaled, + place_element, +) class TestGenSurfPOSCAR(unittest.TestCase): @@ -23,7 +32,7 @@ def setUp(self): "elong-2.000", "elong-4.000", ] - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) out_dir = out_dir_name(jdata) jdata["out_dir"] = out_dir diff --git a/tests/database/context.py b/tests/database/context.py index fbe0aa186..f9fe353fd 100644 --- a/tests/database/context.py +++ b/tests/database/context.py @@ -2,10 +2,10 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -import dpgen -from dpgen.database.entry import Entry -from dpgen.database.run import parsing_vasp -from dpgen.database.vasp import DPPotcar, VaspInput +import dpgen # noqa: F401 +from dpgen.database.entry import Entry # noqa: F401 +from dpgen.database.run import parsing_vasp # noqa: F401 +from dpgen.database.vasp import DPPotcar, VaspInput # noqa: F401 def setUpModule(): diff --git a/tests/database/test_db_vasp.py b/tests/database/test_db_vasp.py index 73b8f8ad9..514ef3fe2 100644 --- a/tests/database/test_db_vasp.py +++ b/tests/database/test_db_vasp.py @@ -6,16 +6,20 @@ import unittest from glob import glob -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "database" -from dpdata import LabeledSystem, System -from monty.serialization import dumpfn, loadfn -from monty.shutil import remove +from dpdata import LabeledSystem +from monty.serialization import loadfn from pymatgen.io.vasp import Incar, Kpoints, Poscar, Potcar -from .context import DPPotcar, Entry, VaspInput, dpgen, parsing_vasp, setUpModule +from .context import ( + DPPotcar, + Entry, + VaspInput, + dpgen, + parsing_vasp, + setUpModule, # noqa: F401 +) iter_pat = "02.fp/task.007.00000*" init_pat = "al.bcc.02x02x02/02.md/sys-0016/scale-1.000/00000*" @@ -44,7 +48,7 @@ def setUp(self): self.ref_entries = loadfn(os.path.join(self.cwd, "data/entries.json")) self.init_path = sorted(glob(os.path.join(self.r_init_path, init_pat))) self.iter_path = sorted(glob(os.path.join(self.r_iter_path, iter_pat))) - with open("param_Al.json", "r") as fr: + with open("param_Al.json") as fr: jdata = json.load(fr) self.config_info_dict = jdata["config_info_dict"] self.skip_init = jdata["skip_init"] diff --git a/tests/generator/context.py b/tests/generator/context.py index 033f4cb50..619684d9a 100644 --- a/tests/generator/context.py +++ b/tests/generator/context.py @@ -2,15 +2,21 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.generator.lib.ele_temp import NBandsEsti -from dpgen.generator.lib.gaussian import _crd2frag, detect_multiplicity -from dpgen.generator.lib.lammps import get_all_dumped_forces, get_dumped_forces -from dpgen.generator.lib.make_calypso import make_calypso_input, write_model_devi_out +from dpgen.generator.lib.ele_temp import NBandsEsti # noqa: F401 +from dpgen.generator.lib.gaussian import _crd2frag, detect_multiplicity # noqa: F401 +from dpgen.generator.lib.lammps import ( + get_all_dumped_forces, # noqa: F401 + get_dumped_forces, # noqa: F401 +) +from dpgen.generator.lib.make_calypso import ( + make_calypso_input, # noqa: F401 + write_model_devi_out, # noqa: F401 +) from dpgen.generator.lib.parse_calypso import ( - _parse_calypso_dis_mtx, - _parse_calypso_input, + _parse_calypso_dis_mtx, # noqa: F401 + _parse_calypso_input, # noqa: F401 ) -from dpgen.generator.run import * +from dpgen.generator.run import * # noqa: F403 param_file = "param-mg-vasp.json" param_file_merge_traj = "param-mg-vasp_merge_traj.json" diff --git a/tests/generator/gromacs/model_devi_case/model_devi.py b/tests/generator/gromacs/model_devi_case/model_devi.py index 6c0b81568..7ce46e301 100755 --- a/tests/generator/gromacs/model_devi_case/model_devi.py +++ b/tests/generator/gromacs/model_devi_case/model_devi.py @@ -9,9 +9,7 @@ def calc_model_devi_f(fs): - """ - fs : numpy.ndarray, size of `n_models x n_frames x n_atoms x 3` - """ + """Fs : numpy.ndarray, size of `n_models x n_frames x n_atoms x 3`.""" fs_mean = np.mean(fs, axis=0) # print(fs_mean.shape) fs_err = np.sum((fs - fs_mean) ** 2, axis=-1) diff --git a/tests/generator/test_calypso.py b/tests/generator/test_calypso.py index cb4546bca..5d9abb854 100644 --- a/tests/generator/test_calypso.py +++ b/tests/generator/test_calypso.py @@ -1,13 +1,8 @@ -import glob -import json import os -import shutil import sys -import textwrap import unittest from pathlib import Path -import dpdata import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) @@ -17,6 +12,7 @@ _parse_calypso_dis_mtx, _parse_calypso_input, make_calypso_input, + setUpModule, # noqa: F401 write_model_devi_out, ) diff --git a/tests/generator/test_check_bad_box.py b/tests/generator/test_check_bad_box.py index e40b42853..7de9070bd 100644 --- a/tests/generator/test_check_bad_box.py +++ b/tests/generator/test_check_bad_box.py @@ -1,16 +1,13 @@ -import glob -import json import os -import shutil import sys import unittest -import dpdata -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import check_bad_box +from .context import ( + check_bad_box, + setUpModule, # noqa: F401 +) class TestCheckBadBox(unittest.TestCase): diff --git a/tests/generator/test_check_cluster.py b/tests/generator/test_check_cluster.py index fb969e047..e5e92ee49 100644 --- a/tests/generator/test_check_cluster.py +++ b/tests/generator/test_check_cluster.py @@ -1,14 +1,13 @@ -import importlib import os import sys import unittest -import dpdata -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import check_cluster, setUpModule +from .context import ( + check_cluster, + setUpModule, # noqa: F401 +) class Test_check_cluster(unittest.TestCase): diff --git a/tests/generator/test_cluster.py b/tests/generator/test_cluster.py index 87151b4ef..193306d1d 100644 --- a/tests/generator/test_cluster.py +++ b/tests/generator/test_cluster.py @@ -9,7 +9,11 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" from .comp_sys import CompSys -from .context import _crd2frag, setUpModule, take_cluster +from .context import ( + _crd2frag, + setUpModule, # noqa: F401 + take_cluster, +) @unittest.skipIf(importlib.util.find_spec("openbabel") is None, "requires openbabel") diff --git a/tests/generator/test_concat_fp_vasp_pp.py b/tests/generator/test_concat_fp_vasp_pp.py index 989a09bd2..a9efcd5f6 100644 --- a/tests/generator/test_concat_fp_vasp_pp.py +++ b/tests/generator/test_concat_fp_vasp_pp.py @@ -1,16 +1,16 @@ -import glob -import json import os import shutil import sys import unittest -import dpdata -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import fp_name, make_iter_name, setUpModule, sys_link_fp_vasp_pp +from .context import ( + fp_name, + make_iter_name, + setUpModule, # noqa: F401 + sys_link_fp_vasp_pp, +) class TestConcatVASPPP(unittest.TestCase): @@ -53,10 +53,10 @@ def test(self): ) self.assertTrue(os.path.isfile(os.path.join(work_path, "POTCAR.000"))) self.assertTrue(os.path.isfile(os.path.join(work_path, "POTCAR.001"))) - with open((os.path.join(work_path, "POTCAR.000"))) as fp: + with open(os.path.join(work_path, "POTCAR.000")) as fp: pot = fp.read() self.assertEqual(pot, "O\nH\n") - with open((os.path.join(work_path, "POTCAR.001"))) as fp: + with open(os.path.join(work_path, "POTCAR.001")) as fp: pot = fp.read() self.assertEqual(pot, "H\nC\n") for ii in ["task.000.000000", "task.000.000001"]: diff --git a/tests/generator/test_gromacs_engine.py b/tests/generator/test_gromacs_engine.py index 4386b11b9..d74d1333d 100644 --- a/tests/generator/test_gromacs_engine.py +++ b/tests/generator/test_gromacs_engine.py @@ -1,6 +1,4 @@ -import glob import importlib -import json import os import shutil import sys @@ -12,7 +10,11 @@ __package__ = "generator" dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), "gromacs") -from .context import make_fp, make_model_devi +from .context import ( + make_fp, + make_model_devi, + setUpModule, # noqa: F401 +) def _make_fake_graphs(train_path): @@ -53,7 +55,6 @@ def setUp(self): ], "shuffle_poscar": False, "fp_style": "gaussian", - "shuffle_poscar": False, "fp_task_max": 20, "fp_task_min": 1, "fp_pp_path": "./", @@ -105,7 +106,7 @@ def _copy_outputs(self, path_1, path_2): shutil.copytree(os.path.join(path_1, "traj"), os.path.join(path_2, "traj")) @unittest.skipIf( - importlib.util.find_spec("openbabel") != None, + importlib.util.find_spec("openbabel") is not None, "when openbabel is found, this test will be skipped. ", ) def test_make_model_devi_gromacs_without_openbabel(self): diff --git a/tests/generator/test_lammps.py b/tests/generator/test_lammps.py index 2fbf011ca..df2d6acf0 100644 --- a/tests/generator/test_lammps.py +++ b/tests/generator/test_lammps.py @@ -1,17 +1,17 @@ -import glob -import json import os -import shutil import sys import textwrap import unittest -import dpdata import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import get_all_dumped_forces, get_dumped_forces +from .context import ( + get_all_dumped_forces, + get_dumped_forces, + setUpModule, # noqa: F401 +) class TestGetDumpForce(unittest.TestCase): @@ -54,7 +54,7 @@ def test_read_dump(self): self.assertAlmostEqual(ff[ii], self.expected_f[ii]) -class TestGetDumpForce(unittest.TestCase): +class TestGetDumpForce2(unittest.TestCase): def setUp(self): file_content = textwrap.dedent( """\ diff --git a/tests/generator/test_make_fp.py b/tests/generator/test_make_fp.py index a98c2b5d2..1b222dc90 100644 --- a/tests/generator/test_make_fp.py +++ b/tests/generator/test_make_fp.py @@ -14,7 +14,7 @@ import scipy.constants as pc from pymatgen.io.vasp import Incar, Kpoints -from .comp_sys import test_atom_names, test_atom_types, test_cell, test_coord +from .comp_sys import test_atom_names from .context import ( detect_multiplicity, machine_file, @@ -36,10 +36,9 @@ param_pwscf_file, param_pwscf_old_file, param_siesta_file, - parse_cur_job, ref_cp2k_file_exinput, ref_cp2k_file_input, - setUpModule, + setUpModule, # noqa: F401 ) vasp_incar_ref = "PREC=A\n\ @@ -232,7 +231,7 @@ def _write_lammps_dump(sys, dump_file, f_idx=0): fp.write(str(natoms) + "\n") fp.write("ITEM: BOX BOUNDS xy xz yz pp pp pp\n") for ii in range(3): - fp.write("%f %f %f\n" % (bd[ii][0], bd[ii][1], tilt[ii])) + fp.write(f"{bd[ii][0]:f} {bd[ii][1]:f} {tilt[ii]:f}\n") fp.write("ITEM: ATOMS id type x y z\n") for ii in range(natoms): fp.write( @@ -242,11 +241,10 @@ def _write_lammps_dump(sys, dump_file, f_idx=0): def _make_fake_md(idx, md_descript, atom_types, type_map, ele_temp=None): - """ - md_descript: list of dimension + """md_descript: list of dimension [n_sys][n_MD][n_frame] ele_temp: list of dimension - [n_sys][n_MD] + [n_sys][n_MD]. """ natoms = len(atom_types) ntypes = len(type_map) @@ -281,11 +279,10 @@ def _make_fake_md(idx, md_descript, atom_types, type_map, ele_temp=None): def _make_fake_md_merge_traj(idx, md_descript, atom_types, type_map, ele_temp=None): - """ - md_descript: list of dimension + """md_descript: list of dimension [n_sys][n_MD][n_frame] ele_temp: list of dimension - [n_sys][n_MD] + [n_sys][n_MD]. """ natoms = len(atom_types) ntypes = len(type_map) @@ -626,9 +623,9 @@ def test_make_fp_pwscf(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_pwscf_file, "r") as fp: + with open(param_pwscf_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -659,9 +656,9 @@ def test_make_fp_pwscf_old(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_pwscf_old_file, "r") as fp: + with open(param_pwscf_old_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -708,10 +705,10 @@ def test_make_fp_abacus(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_abacus_post_file, "r") as fp: + with open(param_abacus_post_file) as fp: jdata = json.load(fp) fp.close() - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -744,12 +741,12 @@ def test_make_fp_abacus_kspacing(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_abacus_post_file, "r") as fp: + with open(param_abacus_post_file) as fp: jdata = json.load(fp) fp.close() jdata["user_fp_params"]["gamma_only"] = 0 jdata["user_fp_params"]["kspacing"] = [0.04, 0.05, 0.06] - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -788,10 +785,10 @@ def test_make_fp_abacus_from_input(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_diy_abacus_post_file, "r") as fp: + with open(param_diy_abacus_post_file) as fp: jdata = json.load(fp) fp.close() - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -826,7 +823,7 @@ def test_make_fp_amber_diff(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_amber_file, "r") as fp: + with open(param_amber_file) as fp: jdata = json.load(fp) jdata["mdin_prefix"] = os.path.abspath(jdata["mdin_prefix"]) task_dir = os.path.join( @@ -851,9 +848,9 @@ def test_make_fp_siesta(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_siesta_file, "r") as fp: + with open(param_siesta_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -886,9 +883,9 @@ def test_make_fp_vasp(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -923,9 +920,9 @@ def test_make_fp_vasp_merge_traj(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file_merge_traj, "r") as fp: + with open(param_file_merge_traj) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -954,9 +951,9 @@ def test_make_fp_vasp_old(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_old_file, "r") as fp: + with open(param_old_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -990,9 +987,9 @@ def test_make_fp_vasp_old(self): def test_make_fp_vasp_less_sel(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 1 @@ -1028,10 +1025,10 @@ def test_make_fp_vasp_from_incar(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_diy_file, "r") as fp: + with open(param_diy_file) as fp: jdata = json.load(fp) fp.close() - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -1068,10 +1065,10 @@ def test_make_fp_vasp_ele_temp(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_diy_file, "r") as fp: + with open(param_diy_file) as fp: jdata = json.load(fp) fp.close() - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -1109,10 +1106,10 @@ def test_make_fp_vasp_multiple_trust_level(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_multiple_trust_file, "r") as fp: + with open(param_multiple_trust_file) as fp: jdata = json.load(fp) fp.close() - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp.close() md_descript = [] @@ -1151,10 +1148,10 @@ def make_fp_gaussian(self, multiplicity="auto"): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_gaussian_file, "r") as fp: + with open(param_gaussian_file) as fp: jdata = json.load(fp) jdata["user_fp_params"]["multiplicity"] = multiplicity - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -1211,9 +1208,9 @@ def test_make_fp_cp2k(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_cp2k_file, "r") as fp: + with open(param_cp2k_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -1236,7 +1233,7 @@ def test_make_fp_cp2k(self): jdata["model_devi_f_trust_hi"], ) _check_poscars(self, 0, jdata["fp_task_max"], jdata["type_map"]) - with open(ref_cp2k_file_input, "r") as f: + with open(ref_cp2k_file_input) as f: cp2k_input_ref = "".join(f.readlines()) _check_cp2k_input_head(self, 0, cp2k_input_ref) _check_potcar(self, 0, jdata["fp_pp_path"], jdata["fp_pp_files"]) @@ -1246,9 +1243,9 @@ def test_make_fp_cp2k_exinput(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_cp2k_file_exinput, "r") as fp: + with open(param_cp2k_file_exinput) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 @@ -1271,7 +1268,7 @@ def test_make_fp_cp2k_exinput(self): jdata["model_devi_f_trust_hi"], ) _check_poscars(self, 0, jdata["fp_task_max"], jdata["type_map"]) - with open(ref_cp2k_file_exinput, "r") as f: + with open(ref_cp2k_file_exinput) as f: cp2k_exinput_ref = "".join(f.readlines()) _check_cp2k_input_head(self, 0, cp2k_exinput_ref) _check_potcar(self, 0, jdata["fp_pp_path"], jdata["fp_pp_files"]) @@ -1283,9 +1280,9 @@ def test_make_fp_pwmat(self): setUpModule() if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_pwmat_file, "r") as fp: + with open(param_pwmat_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) md_descript = [] nsys = 2 diff --git a/tests/generator/test_make_md.py b/tests/generator/test_make_md.py index f22bb4236..165475939 100644 --- a/tests/generator/test_make_md.py +++ b/tests/generator/test_make_md.py @@ -5,10 +5,8 @@ import shutil import sys import unittest -from pathlib import Path import dpdata -import numpy as np from dpgen.generator.run import parse_cur_job_sys_revmat @@ -28,7 +26,6 @@ revise_lmp_input_dump, revise_lmp_input_model, revise_lmp_input_plm, - setUpModule, ) @@ -143,9 +140,9 @@ def tearDown(self): def test_make_model_devi(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) _make_fake_models(0, jdata["numb_models"]) make_model_devi(0, jdata, mdata) @@ -158,10 +155,10 @@ def test_make_model_devi(self): def test_make_model_devi_nopbc_npt(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["model_devi_nopbc"] = True - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) _make_fake_models(0, jdata["numb_models"]) cwd = os.getcwd() @@ -172,11 +169,11 @@ def test_make_model_devi_nopbc_npt(self): def test_make_model_devi_nopbc_nvt(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["model_devi_nopbc"] = True jdata["model_devi_jobs"][0]["ensemble"] = "nvt" - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) _make_fake_models(0, jdata["numb_models"]) make_model_devi(0, jdata, mdata) @@ -532,9 +529,9 @@ def tearDown(self): def test_make_model_devi(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") - with open(param_amber_file, "r") as fp: + with open(param_amber_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) jdata["sys_prefix"] = os.path.abspath(jdata["sys_prefix"]) _make_fake_models(0, jdata["numb_models"]) diff --git a/tests/generator/test_make_train.py b/tests/generator/test_make_train.py index e93cba251..c9e78338d 100644 --- a/tests/generator/test_make_train.py +++ b/tests/generator/test_make_train.py @@ -22,7 +22,7 @@ param_file_v1, param_file_v1_et, run_train, - setUpModule, + setUpModule, # noqa: F401 ) @@ -52,7 +52,7 @@ def _comp_init_data(testCase, iter_idx, init_data_prefix, init_data_sys): sys1 = os.path.join("iter.%06d" % iter_idx, "00.train", "data.init", ii) testCase.assertTrue( _comp_sys_files(sys0, sys1), - "systems %s %s are not identical" % (sys0, sys1), + f"systems {sys0} {sys1} are not identical", ) @@ -197,7 +197,7 @@ def _check_model_inputs_v1(testCase, iter_idx, jdata, reuse=False): old_ratio = jdata["training_reuse_old_ratio"] testCase.assertEqual( jdata0["training"]["auto_prob_style"], - "prob_sys_size; 0:1:%f; 1:2:%f" % (old_ratio, 1 - old_ratio), + f"prob_sys_size; 0:1:{old_ratio:f}; 1:2:{1 - old_ratio:f}", ) @@ -230,9 +230,9 @@ class TestMakeTrain(unittest.TestCase): def test_0(self): # No longer support for DeePMD-kit-0.x version. return - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) fp_task_min = jdata["fp_task_min"] make_train(0, jdata, mdata) @@ -250,9 +250,9 @@ def test_0(self): def test_1_data(self): # No longer support for DeePMD-kit-0.x version. return - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min @@ -276,9 +276,9 @@ def test_1_data(self): def test_1_skip(self): # No longer support for DeePMD-kit-0.x version. return - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) - with open(machine_file, "r") as fp: + with open(machine_file) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min - 1 @@ -295,10 +295,10 @@ def test_1_skip(self): shutil.rmtree("iter.000000") def test_1_data_v1(self): - with open(param_file_v1, "r") as fp: + with open(param_file_v1) as fp: jdata = json.load(fp) jdata.pop("use_ele_temp", None) - with open(machine_file_v1, "r") as fp: + with open(machine_file_v1) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min @@ -320,7 +320,7 @@ def test_1_data_v1(self): shutil.rmtree("iter.000000") def test_1_data_reuse_v1(self): - with open(param_file_v1, "r") as fp: + with open(param_file_v1) as fp: jdata = json.load(fp) jdata.pop("use_ele_temp", None) jdata["training_reuse_iter"] = 1 @@ -329,7 +329,7 @@ def test_1_data_reuse_v1(self): jdata["training_reuse_start_lr"] = 1e-4 jdata["training_reuse_start_pref_e"] = 0.1 jdata["training_reuse_start_pref_f"] = 100 - with open(machine_file_v1, "r") as fp: + with open(machine_file_v1) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min @@ -364,9 +364,9 @@ def test_1_data_reuse_v1(self): shutil.rmtree("iter.000000") def test_1_data_v1_eletron_temp(self): - with open(param_file_v1_et, "r") as fp: + with open(param_file_v1_et) as fp: jdata = json.load(fp) - with open(machine_file_v1, "r") as fp: + with open(machine_file_v1) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min @@ -392,12 +392,12 @@ def test_1_data_v1_h5(self): dpdata.LabeledSystem("data/deepmd", fmt="deepmd/npy").to_deepmd_hdf5( "data/deepmd.hdf5" ) - with open(param_file_v1, "r") as fp: + with open(param_file_v1) as fp: jdata = json.load(fp) jdata.pop("use_ele_temp", None) jdata["init_data_sys"].append("deepmd.hdf5") jdata["init_batch_size"].append("auto") - with open(machine_file_v1, "r") as fp: + with open(machine_file_v1) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min @@ -461,13 +461,13 @@ def test_1_data_v1_one_h5(self): dpdata.LabeledSystem("data/deepmd", fmt="deepmd/npy").to_deepmd_hdf5( "data/deepmd.hdf5" ) - with open(param_file_v1, "r") as fp: + with open(param_file_v1) as fp: jdata = json.load(fp) jdata.pop("use_ele_temp", None) jdata["init_data_sys"].append("deepmd.hdf5") jdata["init_batch_size"].append("auto") jdata["one_h5"] = True - with open(machine_file_v1, "r") as fp: + with open(machine_file_v1) as fp: mdata = json.load(fp) make_train(0, jdata, mdata) # make fake fp results #data == fp_task_min diff --git a/tests/generator/test_nbands_esti.py b/tests/generator/test_nbands_esti.py index c5d9bcdb5..4d2dccafa 100644 --- a/tests/generator/test_nbands_esti.py +++ b/tests/generator/test_nbands_esti.py @@ -1,14 +1,13 @@ -import importlib import os import sys import unittest -import dpdata -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import NBandsEsti +from .context import ( + NBandsEsti, + setUpModule, # noqa: F401 +) class TestNBandsEsti(unittest.TestCase): @@ -54,7 +53,7 @@ def test_get_default_nbands(self): nb = NBandsEsti._get_default_nbands(res) self.assertEqual(nb, 66) - def test_get_default_nbands(self): + def test_get_default_nbands2(self): res = NBandsEsti._get_res("out_data_nbands_esti/mgal/") nb = NBandsEsti._get_default_nbands(res) self.assertEqual(nb, 124) diff --git a/tests/generator/test_parse_cur_job.py b/tests/generator/test_parse_cur_job.py index e03c920ea..fb0a5a911 100644 --- a/tests/generator/test_parse_cur_job.py +++ b/tests/generator/test_parse_cur_job.py @@ -2,11 +2,12 @@ import sys import unittest -import numpy as np - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" -from .context import machine_file, param_file, parse_cur_job, setUpModule +from .context import ( + parse_cur_job, + setUpModule, # noqa: F401 +) class TestParseCurJob(unittest.TestCase): diff --git a/tests/generator/test_post_fp.py b/tests/generator/test_post_fp.py index c2404c1c4..5d3f5cc45 100644 --- a/tests/generator/test_post_fp.py +++ b/tests/generator/test_post_fp.py @@ -1,4 +1,3 @@ -import glob import json import os import shutil @@ -12,31 +11,19 @@ __package__ = "generator" from .comp_sys import ( CompLabeledSys, - test_atom_names, - test_atom_types, - test_cell, - test_coord, ) from .context import ( - machine_file, param_abacus_post_file, param_amber_file, param_cp2k_file, param_file, param_gaussian_file, - param_old_file, param_pwmat_file, param_pwscf_file, - param_pwscf_old_file, param_siesta_file, post_fp, - post_fp_abacus_scf, - post_fp_cp2k, - post_fp_gaussian, - post_fp_pwscf, - post_fp_siesta, post_fp_vasp, - setUpModule, + setUpModule, # noqa: F401 ) @@ -76,7 +63,7 @@ def tearDown(self): shutil.rmtree("iter.000000") def test_post_fp_vasp_0(self): - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 2 post_fp_vasp(0, jdata, rfailed=0.3) @@ -126,7 +113,7 @@ def test_post_fp_vasp_0(self): self.assertEqual(list(list(aparam)[1]), [1, 1]) def test_post_fp_vasp_1(self): - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 1 post_fp_vasp(0, jdata, rfailed=0.3) @@ -173,7 +160,7 @@ def test_post_fp_vasp_1(self): self.assertEqual(list(fparam), [100000]) def test_post_fp_vasp_2(self): - with open(param_file, "r") as fp: + with open(param_file) as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 1 with self.assertRaises(RuntimeError): @@ -192,7 +179,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_pwscf", "iter.000000") - with open(param_pwscf_file, "r") as fp: + with open(param_pwscf_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -213,7 +200,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_abacus", "iter.000000") - with open(param_abacus_post_file, "r") as fp: + with open(param_abacus_post_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -237,7 +224,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_siesta", "iter.000000") - with open(param_siesta_file, "r") as fp: + with open(param_siesta_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -258,7 +245,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_gaussian", "iter.000000") - with open(param_gaussian_file, "r") as fp: + with open(param_gaussian_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -279,7 +266,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_cp2k", "iter.000000") - with open(param_cp2k_file, "r") as fp: + with open(param_cp2k_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -300,7 +287,7 @@ def setUp(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") shutil.copytree("out_data_post_fp_pwmat", "iter.000000") - with open(param_pwmat_file, "r") as fp: + with open(param_pwmat_file) as fp: jdata = json.load(fp) post_fp(0, jdata) self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw") @@ -325,7 +312,7 @@ def setUp(self): os.path.join("iter.000000", "02.fp", "task.000.000000", "dataset") ) self.system_1 = list(ms.systems.values())[0] - with open(param_amber_file, "r") as fp: + with open(param_amber_file) as fp: jdata = json.load(fp) jdata["type_map"] = self.system_1.get_atom_names() post_fp(0, jdata) diff --git a/tests/simplify/context.py b/tests/simplify/context.py index 88f06f91b..c68902eca 100644 --- a/tests/simplify/context.py +++ b/tests/simplify/context.py @@ -2,5 +2,4 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) - -import dpgen.simplify.simplify +import dpgen.simplify.simplify # noqa: F401 diff --git a/tests/test_cli.py b/tests/test_cli.py index cd2a4a7a3..0c2125d2a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,4 @@ import subprocess as sp -import sys import unittest diff --git a/tests/tools/context.py b/tests/tools/context.py index 3f1ab8fbb..a51ca9249 100644 --- a/tests/tools/context.py +++ b/tests/tools/context.py @@ -2,7 +2,7 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) -from dpgen.tools.run_report import * +from dpgen.tools.run_report import * # noqa: F403 def my_file_cmp(test, f0, f1): diff --git a/tests/tools/test_convert_mdata.py b/tests/tools/test_convert_mdata.py index 1f0c020c8..57e15b52c 100644 --- a/tests/tools/test_convert_mdata.py +++ b/tests/tools/test_convert_mdata.py @@ -8,7 +8,7 @@ __package__ = "tools" from dpgen.remote.decide_machine import convert_mdata -from .context import setUpModule +from .context import setUpModule # noqa: F401 class TestConvertMdata(unittest.TestCase): diff --git a/tests/tools/test_run_report.py b/tests/tools/test_run_report.py index 0553d99f0..44474c366 100644 --- a/tests/tools/test_run_report.py +++ b/tests/tools/test_run_report.py @@ -6,7 +6,10 @@ test_dir = os.path.abspath(os.path.join(os.path.dirname(__file__))) sys.path.insert(0, os.path.join(test_dir, "..")) __package__ = "tools" -from .context import stat_sys +from .context import ( + setUpModule, # noqa: F401 + stat_sys, +) class TestRunReport(unittest.TestCase): From d8a36a096f604f37d66c6d52a8514fec38d5df66 Mon Sep 17 00:00:00 2001 From: Sian Chen Date: Mon, 12 Jun 2023 08:30:43 +0800 Subject: [PATCH 33/86] fix: description in README.md (#1241) Signed-off-by: Sian Chen --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 166202981..70b465d35 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![conda install](https://img.shields.io/conda/dn/conda-forge/dpgen?label=conda%20install)](https://anaconda.org/conda-forge/dpgen) [![pip install](https://img.shields.io/pypi/dm/dpgen?label=pip%20install)](https://pypi.org/project/dpgen) -DP-GEN (Deep Generator) is a software written in Python, delicately designed to generate a deep learning based model of interatomic potential energy and force field. DP-GEN is dependent on [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit/). With highly scalable interface with common softwares for molecular simulation, DP-GEN is capable to automatically prepare scripts and maintain job queues on HPC machines (High Performance Cluster) and analyze results. +DP-GEN (Deep Potential GENerator) is a software written in Python, delicately designed to generate a deep learning based model of interatomic potential energy and force field. DP-GEN is dependent on [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit/). With highly scalable interface with common softwares for molecular simulation, DP-GEN is capable to automatically prepare scripts and maintain job queues on HPC machines (High Performance Cluster) and analyze results. If you use this software in any publication, please cite: @@ -47,7 +47,7 @@ dpgen -h DP-GEN contains the following workflows: -* [`dpgen run`](https://docs.deepmodeling.com/projects/dpgen/en/latest/run/): Main process of Deep Generator. +* [`dpgen run`](https://docs.deepmodeling.com/projects/dpgen/en/latest/run/): Main process of Deep Potential Generator. * [Init](https://docs.deepmodeling.com/projects/dpgen/en/latest/init/): Generating initial data. * `dpgen init_bulk`: Generating initial data for bulk systems. * `dpgen init_surf`: Generating initial data for surface systems. From 00e61855624c1fdb58123686eaac3e23723c1765 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 13 Jun 2023 09:42:29 -0400 Subject: [PATCH 34/86] =?UTF-8?q?docs:=20move=20=C2=B7ratio=5Ffailed=C2=B7?= =?UTF-8?q?=20out=20of=20fp=20variant=20(#1243)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation of `ratio_failed` is available and shared for all fp styles. Thus, this argument should move out of any specific fp variant in the documentation. --------- Signed-off-by: Jinzhe Zeng --- dpgen/generator/arginfo.py | 8 ++------ dpgen/simplify/arginfo.py | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index bdfdccb6f..1c2ead2ec 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -550,7 +550,6 @@ def fp_style_vasp_args() -> List[Argument]: doc_cvasp = ( "If cvasp is true, DP-GEN will use Custodian to help control VASP calculation." ) - doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." doc_fp_skip_bad_box = ( "Skip the configurations that are obviously unreasonable before 02.fp" ) @@ -561,7 +560,6 @@ def fp_style_vasp_args() -> List[Argument]: Argument("fp_incar", str, optional=False, doc=doc_fp_incar), Argument("fp_aniso_kspacing", list, optional=True, doc=doc_fp_aniso_kspacing), Argument("cvasp", bool, optional=True, doc=doc_cvasp), - Argument("ratio_failed", float, optional=True, doc=doc_ratio_failed), Argument("fp_skip_bad_box", str, optional=True, doc=doc_fp_skip_bad_box), ] @@ -662,7 +660,6 @@ def fp_style_gaussian_args() -> List[Argument]: "kept. In this case, other atoms out of the soft cutoff radius will be removed." ) doc_fp_params_gaussian = "Parameters for Gaussian calculation." - doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." return [ Argument( @@ -678,7 +675,6 @@ def fp_style_gaussian_args() -> List[Argument]: Argument( "fp_params", dict, args, [], optional=False, doc=doc_fp_params_gaussian ), - Argument("ratio_failed", float, optional=True, doc=doc_ratio_failed), ] @@ -735,7 +731,6 @@ def fp_style_cp2k_args() -> List[Argument]: " &END PRINT\n" "\n" ) - doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." return [ Argument( @@ -748,7 +743,6 @@ def fp_style_cp2k_args() -> List[Argument]: Argument( "external_input_path", str, optional=True, doc=doc_external_input_path ), - Argument("ratio_failed", float, optional=True, doc=doc_ratio_failed), ] @@ -827,6 +821,7 @@ def fp_args() -> List[Argument]: doc_detailed_report_make_fp = ( "If set to true, detailed report will be generated for each iteration." ) + doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." return [ Argument("fp_task_max", int, optional=False, doc=doc_fp_task_max), @@ -848,6 +843,7 @@ def fp_args() -> List[Argument]: default=True, doc=doc_detailed_report_make_fp, ), + Argument("ratio_failed", float, optional=True, doc=doc_ratio_failed), ] diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 96acf7e87..9a76f4b9e 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -108,6 +108,7 @@ def fp_args() -> List[Argument]: ) doc_fp_accurate_threshold = "If the accurate ratio is larger than this number, no fp calculation will be performed, i.e. fp_task_max = 0." doc_fp_accurate_soft_threshold = "If the accurate ratio is between this number and fp_accurate_threshold, the fp_task_max linearly decays to zero." + doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." return [ Argument("fp_task_max", int, optional=True, doc=doc_fp_task_max), @@ -121,6 +122,7 @@ def fp_args() -> List[Argument]: optional=True, doc=doc_fp_accurate_soft_threshold, ), + Argument("ratio_failed", float, optional=True, doc=doc_ratio_failed), ] From 951350cda82bf284ac5832b85e00d60ff83db4b1 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 13 Jun 2023 09:48:46 -0400 Subject: [PATCH 35/86] add fp_style custom (#1244) Add fp_style custom. One can use customized codes to run FP tasks and is not limited to what DP-GEN supports. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 35 +++++++++ dpgen/generator/run.py | 95 +++++++++++++++++++++++- dpgen/simplify/arginfo.py | 7 ++ dpgen/util.py | 30 ++++++++ tests/generator/context.py | 1 + tests/generator/param-custom-fp.json | 107 +++++++++++++++++++++++++++ tests/generator/test_make_fp.py | 54 ++++++++++++++ tests/generator/test_post_fp.py | 35 +++++++++ 8 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 tests/generator/param-custom-fp.json diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 1c2ead2ec..7ed784f46 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -783,6 +783,35 @@ def fp_style_amber_diff_args() -> List[Argument]: ] +def fp_style_custom_args() -> List[Argument]: + """Arguments for FP style custom. + + Returns + ------- + list[dargs.Argument] + list of Gaussian fp style arguments + """ + doc_fp_params_custom = "Parameters for FP calculation." + doc_input_fmt = "Input dpdata format of the custom FP code. Such format should only need the first argument as the file name." + doc_output_fmt = "Output dpata format of the custom FP code. Such format should only need the first argument as the file name." + doc_input_fn = "Input file name of the custom FP code." + doc_output_fn = "Output file name of the custom FP code." + return [ + Argument( + "fp_params", + dict, + optional=False, + doc=doc_fp_params_custom, + sub_fields=[ + Argument("input_fmt", str, optional=False, doc=doc_input_fmt), + Argument("input_fn", str, optional=False, doc=doc_input_fn), + Argument("output_fmt", str, optional=False, doc=doc_output_fmt), + Argument("output_fn", str, optional=False, doc=doc_output_fn), + ], + ), + ] + + def fp_style_variant_type_args() -> Variant: doc_fp_style = "Software for First Principles." doc_amber_diff = ( @@ -792,6 +821,11 @@ def fp_style_variant_type_args() -> Variant: "The command argument in the machine file should be path to sander. " "One should also install dpamber and make it visible in the PATH." ) + doc_custom = ( + "Custom FP code. You need to provide the input and output file format and name. " + "The command argument in the machine file should be the script to run custom FP codes. " + "The extra forward and backward files can be defined in the machine file." + ) return Variant( "fp_style", @@ -806,6 +840,7 @@ def fp_style_variant_type_args() -> Variant: ), Argument("pwmat", dict, [], doc="TODO: add doc"), Argument("pwscf", dict, [], doc="TODO: add doc"), + Argument("custom", dict, fp_style_custom_args(), doc=doc_custom), ], optional=False, doc=doc_fp_style, diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 3c0ca1e5f..1b630ead7 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -23,6 +23,7 @@ import warnings from collections import Counter from collections.abc import Iterable +from pathlib import Path from typing import List import dpdata @@ -88,7 +89,13 @@ write_incar_dict, ) from dpgen.remote.decide_machine import convert_mdata -from dpgen.util import convert_training_data_to_hdf5, expand_sys_str, normalize, sepline +from dpgen.util import ( + convert_training_data_to_hdf5, + expand_sys_str, + normalize, + sepline, + set_directory, +) from .arginfo import run_jdata_arginfo @@ -3534,6 +3541,30 @@ def make_fp_amber_diff(iter_index: int, jdata: dict): os.chdir(cwd) +def make_fp_custom(iter_index, jdata): + """Make input file for customized FP style. + + Convert the POSCAR file to custom format. + + Parameters + ---------- + iter_index : int + iter index + jdata : dict + Run parameters. + """ + work_path = os.path.join(make_iter_name(iter_index), fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) + fp_params = jdata["fp_params"] + input_fn = fp_params["input_fn"] + input_fmt = fp_params["input_fmt"] + + for ii in fp_tasks: + with set_directory(Path(ii)): + system = dpdata.System("POSCAR", fmt="vasp/poscar") + system.to(input_fmt, input_fn) + + def make_fp(iter_index, jdata, mdata): """Select the candidate strutures and make the input file of FP calculation. @@ -3581,6 +3612,8 @@ def make_fp_calculation(iter_index, jdata, mdata): make_fp_pwmat(iter_index, jdata) elif fp_style == "amber/diff": make_fp_amber_diff(iter_index, jdata) + elif fp_style == "custom": + make_fp_custom(iter_index, jdata) else: raise RuntimeError("unsupported fp style") # Copy user defined forward_files @@ -3890,6 +3923,19 @@ def run_fp(iter_index, jdata, mdata): log_file="output", forward_common_files=forward_common_files, ) + elif fp_style == "custom": + fp_params = jdata["fp_params"] + forward_files = [fp_params["input_fn"]] + backward_files = [fp_params["output_fn"]] + run_fp_inner( + iter_index, + jdata, + mdata, + forward_files, + backward_files, + None, + log_file="output", + ) else: raise RuntimeError("unsupported fp style") @@ -4354,6 +4400,51 @@ def post_fp_amber_diff(iter_index, jdata): all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_output), prec=np.float64) +def post_fp_custom(iter_index, jdata): + """Post fp for custom fp. Collect data from user-defined `output_fn`. + + Parameters + ---------- + iter_index : int + The index of the current iteration. + jdata : dict + The parameter data. + """ + model_devi_jobs = jdata["model_devi_jobs"] + assert iter_index < len(model_devi_jobs) + + iter_name = make_iter_name(iter_index) + work_path = os.path.join(iter_name, fp_name) + fp_tasks = glob.glob(os.path.join(work_path, "task.*")) + fp_tasks.sort() + if len(fp_tasks) == 0: + return + + system_index = [] + for ii in fp_tasks: + system_index.append(os.path.basename(ii).split(".")[1]) + system_index.sort() + set_tmp = set(system_index) + system_index = list(set_tmp) + system_index.sort() + + fp_params = jdata["fp_params"] + output_fn = fp_params["output_fn"] + output_fmt = fp_params["output_fmt"] + + for ss in system_index: + sys_output = glob.glob(os.path.join(work_path, "task.%s.*" % ss)) + sys_output.sort() + all_sys = dpdata.MultiSystems(type_map=jdata["type_map"]) + for oo in sys_output: + if os.path.exists(os.path.join(oo, output_fn)): + sys = dpdata.LabeledSystem(os.path.join(oo, output_fn), fmt=output_fmt) + all_sys.append(sys) + sys_data_path = os.path.join(work_path, "data.%s" % ss) + all_sys.to_deepmd_raw(sys_data_path) + all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_output), prec=np.float64) + + def post_fp(iter_index, jdata): fp_style = jdata["fp_style"] if fp_style == "vasp": @@ -4372,6 +4463,8 @@ def post_fp(iter_index, jdata): post_fp_pwmat(iter_index, jdata) elif fp_style == "amber/diff": post_fp_amber_diff(iter_index, jdata) + elif fp_style == "custom": + post_fp_custom(iter_index, jdata) else: raise RuntimeError("unsupported fp style") post_fp_check_fail(iter_index, jdata) diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 9a76f4b9e..087f55710 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -8,6 +8,7 @@ data_args, fp_style_abacus_args, fp_style_cp2k_args, + fp_style_custom_args, fp_style_gaussian_args, fp_style_siesta_args, fp_style_vasp_args, @@ -66,6 +67,11 @@ def fp_style_variant_type_args() -> Variant: doc_fp_style_none = "No fp." doc_fp_style_vasp = "VASP." doc_fp_style_gaussian = "Gaussian. The command should be set as `g16 < input`." + doc_custom = ( + "Custom FP code. You need to provide the input and output file format and name. " + "The command argument in the machine file should be the script to run custom FP codes. " + "The extra forward and backward files can be defined in the machine file." + ) return Variant( "fp_style", @@ -85,6 +91,7 @@ def fp_style_variant_type_args() -> Variant: # ), Argument("pwmat", dict, [], doc="TODO: add doc"), Argument("pwscf", dict, [], doc="TODO: add doc"), + Argument("custom", dict, fp_style_custom_args(), doc=doc_custom), ], optional=True, default_tag="none", diff --git a/dpgen/util.py b/dpgen/util.py index 1a6db4814..2c7bd3a26 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -1,6 +1,9 @@ #!/usr/bin/env python import json import os +from contextlib import ( + contextmanager, +) from pathlib import Path from typing import List, Union @@ -145,3 +148,30 @@ def convert_training_data_to_hdf5(input_files: List[str], h5_file: str): group = f.create_group(str(pp)) s = dpdata.LabeledSystem(ii, fmt="deepmd/npy") s.to("deepmd/hdf5", group) + + +@contextmanager +def set_directory(path: Path): + """Sets the current working path within the context. + + Parameters + ---------- + path : Path + The path to the cwd + + Yields + ------ + None + + Examples + -------- + >>> with set_directory("some_path"): + ... do_something() + """ + cwd = Path().absolute() + path.mkdir(exist_ok=True, parents=True) + try: + os.chdir(path) + yield + finally: + os.chdir(cwd) diff --git a/tests/generator/context.py b/tests/generator/context.py index 619684d9a..6da7932bc 100644 --- a/tests/generator/context.py +++ b/tests/generator/context.py @@ -40,6 +40,7 @@ param_diy_abacus_post_file = "param-methane-abacus-diy.json" param_amber_file = "param-amber.json" param_multiple_trust_file = "param-mg-vasp-multi-trust.json" +param_custom_fp_file = "param-custom-fp.json" def my_file_cmp(test, f0, f1): diff --git a/tests/generator/param-custom-fp.json b/tests/generator/param-custom-fp.json new file mode 100644 index 000000000..f66cad71f --- /dev/null +++ b/tests/generator/param-custom-fp.json @@ -0,0 +1,107 @@ +{ + "type_map": ["C", "H", "N"], + "mass_map": [16, 2, 14], + + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": ["Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [1, 1], + "sys_configs": [ + ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], + ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] + ], + "_comment": "0 1 2 3", + "_comment": "4 5 6 7", + "sys_batch_size": [1, 1, 1, 1, + 1, 1, 1, 1 + ], + + "_comment": " 00.train ", + "numb_models": 4, + "default_training_param" : { + "_comment": " model parameters", + "use_smooth": true, + "sel_a": [81, 81, 20], + "rcut_smth": 0.50, + "rcut": 6.50, + "filter_neuron": [25, 50, 100], + "filter_resnet_dt": false, + "n_axis_neuron": 12, + "n_neuron": [240, 240, 240], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + + "_comment": " traing controls", + "systems": [], + "set_prefix": "set", + "stop_batch": 400000, + "batch_size": 1, + "start_lr": 0.002, + "decay_steps": 2000, + "decay_rate": 0.95, + "seed": 0, + + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0, + + "_comment": " display and restart", + "_comment": " frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 2000, + "numb_test": 10, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "load_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + + "_comment": "that's all" + }, + + "_comment": " 01.model_devi ", + "_comment": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.050, + "model_devi_f_trust_hi": 0.150, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, + {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, + {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, + {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, + {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, + {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, + {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, + {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + ], + + "_comment": " 02.fp ", + "fp_style": "custom", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [], + "fp_params": { + "input_fn": "input.h5", + "input_fmt": "deepmd/hdf5", + "output_fn": "output.h5", + "output_fmt": "deepmd/hdf5" + }, + "_comment": " that's all " +} diff --git a/tests/generator/test_make_fp.py b/tests/generator/test_make_fp.py index 1b222dc90..7c9699e6d 100644 --- a/tests/generator/test_make_fp.py +++ b/tests/generator/test_make_fp.py @@ -25,6 +25,7 @@ param_amber_file, param_cp2k_file, param_cp2k_file_exinput, + param_custom_fp_file, param_diy_abacus_post_file, param_diy_file, param_file, @@ -1311,5 +1312,58 @@ def test_make_fp_pwmat(self): # shutil.rmtree('iter.000000') +class TestMakeFPCustom(unittest.TestCase): + def test_make_fp_custom(self): + setUpModule() + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + with open(param_custom_fp_file) as fp: + jdata = json.load(fp) + with open(machine_file) as fp: + mdata = json.load(fp) + md_descript = [] + nsys = 2 + nmd = 3 + n_frame = 10 + for ii in range(nsys): + tmp = [] + for jj in range(nmd): + tmp.append(np.arange(0, 0.29, 0.29 / 10)) + md_descript.append(tmp) + atom_types = [0, 1, 2, 2, 0, 1] + type_map = jdata["type_map"] + _make_fake_md(0, md_descript, atom_types, type_map) + make_fp(0, jdata, {}) + # check input.h5 can be read + fp_params = jdata["fp_params"] + input_fn = fp_params["input_fn"] + input_fmt = fp_params["input_fmt"] + fp_task_max = jdata["fp_task_max"] + type_map = jdata["type_map"] + + fp_path = os.path.join("iter.%06d" % 0, "02.fp") + candi_files = glob.glob(os.path.join(fp_path, "candidate.shuffled.*.out")) + candi_files.sort() + sys_idx = [str(os.path.basename(ii).split(".")[2]) for ii in candi_files] + for sidx, ii in zip(sys_idx, candi_files): + md_task = [] + f_idx = [] + with open(ii) as fp: + for line in fp: + md_task.append(line.split()[0]) + f_idx.append(line.split()[1]) + md_task = md_task[:fp_task_max] + f_idx = f_idx[:fp_task_max] + for cc, (tt, ff) in enumerate(zip(md_task, f_idx)): + traj_file = os.path.join(tt, "traj", "%d.lammpstrj" % int(ff)) + input_file = os.path.join( + fp_path, "task.%03d.%06d" % (int(sidx), cc), input_fn + ) + system1 = dpdata.System(traj_file, "lammps/dump", type_map=type_map) + system2 = dpdata.System(input_file, input_fmt, type_map=type_map) + assert system1.formula == system2.formula + shutil.rmtree("iter.000000") + + if __name__ == "__main__": unittest.main() diff --git a/tests/generator/test_post_fp.py b/tests/generator/test_post_fp.py index 5d3f5cc45..240ec99d6 100644 --- a/tests/generator/test_post_fp.py +++ b/tests/generator/test_post_fp.py @@ -16,6 +16,7 @@ param_abacus_post_file, param_amber_file, param_cp2k_file, + param_custom_fp_file, param_file, param_gaussian_file, param_pwmat_file, @@ -323,5 +324,39 @@ def setUp(self): )[0] +class TestPostFPCustom(unittest.TestCase, CompLabeledSys): + def setUp(self): + self.places = 5 + self.e_places = 5 + self.f_places = 5 + self.v_places = 2 + assert os.path.isdir( + "out_data_post_fp_pwmat" + ), "out data for post fp pwmat should exist" + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + with open(param_custom_fp_file) as fp: + jdata = json.load(fp) + fp_params = jdata["fp_params"] + output_fn = fp_params["output_fn"] + output_fmt = fp_params["output_fmt"] + type_map = jdata["type_map"] + ["Type_0"] + ss = dpdata.LabeledSystem( + os.path.join("data", "deepmd"), fmt="deepmd/raw", type_map=type_map + ) + output_filename = os.path.join( + "iter.000000", "02.fp", "task.000.000000", output_fn + ) + os.makedirs(os.path.dirname(output_filename), exist_ok=True) + ss.to(output_fmt, output_filename) + post_fp(0, jdata) + self.system_1 = ss + self.system_2 = list( + dpdata.MultiSystems(type_map=type_map) + .from_deepmd_raw("iter.000000/02.fp/data.000") + .systems.values() + )[0] + + if __name__ == "__main__": unittest.main() From b7d9135ea75a5c58a24c779b34e7eff5f916fd2b Mon Sep 17 00:00:00 2001 From: Yongbin Zhuang <38876805+robinzyb@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:48:57 +0800 Subject: [PATCH 36/86] len(all_sys) should > 0 for post_fp_cp2k (#1245) fix for this discussion https://github.com/deepmodeling/dpgen/discussions/1237#discussioncomment-6124499 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- dpgen/generator/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 1b630ead7..40dcfbd78 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -4295,7 +4295,7 @@ def post_fp_cp2k(iter_index, jdata, rfailed=None): all_sys.append(_sys) icount += len(all_sys) - if all_sys is not None: + if (all_sys is not None) and (len(all_sys) > 0): sys_data_path = os.path.join(work_path, "data.%s" % ss) all_sys.to_deepmd_raw(sys_data_path) all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_output)) From d83429dcadb41b633bda37ed92e2f7d19ce2d9e9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 22:02:05 +0800 Subject: [PATCH 37/86] [pre-commit.ci] pre-commit autoupdate (#1242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.270 → v0.0.272](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.270...v0.0.272) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a1d464af..77b8f0387 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.270 + rev: v0.0.272 hooks: - id: ruff args: ["--fix"] From ef7a2ca43447abd40a98f111766555d3b55a5007 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 21 Jun 2023 07:14:04 -0400 Subject: [PATCH 38/86] bump pymatgen to 2023.5.31 (#1250) The old version is broken again. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f68067034..c67dfafbf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies # See https://github.com/materialsproject/api/issues/809 - run: pip install coverage pymatgen==2023.3.23 -e . 'mp-api<0.33; python_version < "3.9"' + run: pip install coverage pymatgen==2023.5.31 -e . 'mp-api<0.33; python_version < "3.9"' - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 From 667573986357c938a84b137836be11c4a6aa13fd Mon Sep 17 00:00:00 2001 From: Liu Renxi <75369672+Liu-RX@users.noreply.github.com> Date: Thu, 22 Jun 2023 21:03:16 +0800 Subject: [PATCH 39/86] Fix bug in make_supercell_abacus (#1229) A test confirming the result of enlarged cell is also added. --------- Signed-off-by: Liu Renxi <75369672+Liu-RX@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- dpgen/generator/lib/abacus_scf.py | 11 ++++------- tests/data/CuW.json | 4 ++-- tests/data/context_bulk.py | 6 ++++++ tests/data/test_gen_bulk_abacus.py | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 6a8ea3213..5478bccc9 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -409,13 +409,8 @@ def make_supercell_abacus(from_struct, super_cell): # to_struct["atom_types"] = ( # from_struct["atom_types"] * super_cell[0] * super_cell[1] * super_cell[2] # ) - for idx_atm, ina in enumerate(from_struct["atom_numbs"]): - new_types += ( - [idx_atm for i in range(ina)] - * super_cell[0] - * super_cell[1] - * super_cell[2] - ) + for idx_atm in from_struct["atom_types"]: + new_types += [idx_atm] * super_cell[0] * super_cell[1] * super_cell[2] to_struct["atom_types"] = new_types to_atom_num = ( sum(from_struct["atom_numbs"]) * super_cell[0] * super_cell[1] * super_cell[2] @@ -436,6 +431,8 @@ def make_supercell_abacus(from_struct, super_cell): + from_struct["cells"][2] * iz ) new_coord[idx_atm] = coord + idx_atm += 1 + to_struct["coords"] = new_coord new_numbs = [ i * super_cell[0] * super_cell[1] * super_cell[2] diff --git a/tests/data/CuW.json b/tests/data/CuW.json index 4d289710e..d60dfb187 100644 --- a/tests/data/CuW.json +++ b/tests/data/CuW.json @@ -5,8 +5,8 @@ "latt": 3.76, "super_cell": [ 1, - 1, - 1 + 2, + 2 ], "elements": [ "Cu", "W" diff --git a/tests/data/context_bulk.py b/tests/data/context_bulk.py index a6b3567a7..995da6554 100644 --- a/tests/data/context_bulk.py +++ b/tests/data/context_bulk.py @@ -1,8 +1,14 @@ import os import sys +import numpy as np + sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from dpgen.data.gen import * # noqa: F403 param_file = "alloy.json" abacus_param_file = "CuW.json" + +abacus_ref_Cu_coord = 3.76 * np.array( + [[0.5, 0, 0.5], [0.5, 0, 1.5], [0.5, 1, 0.5], [0.5, 1, 1.5]] +) diff --git a/tests/data/test_gen_bulk_abacus.py b/tests/data/test_gen_bulk_abacus.py index 83ef45fb9..520589829 100644 --- a/tests/data/test_gen_bulk_abacus.py +++ b/tests/data/test_gen_bulk_abacus.py @@ -5,11 +5,14 @@ import sys import unittest +import numpy as np + sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "data" from .context import setUpModule # noqa: F401 from .context_bulk import ( abacus_param_file, + abacus_ref_Cu_coord, create_path, get_abacus_STRU, make_abacus_relax, @@ -39,6 +42,7 @@ def setUp(self): create_path(out_dir) def tearDown(self): + # pass shutil.rmtree(self.root_dir) def test(self): @@ -80,14 +84,20 @@ def testSTRU(self): # struct0=Structure.from_file(os.path.join(path,"STRU")) alloys = glob.glob(os.path.join(path, "sys-*")) stru0 = get_abacus_STRU(os.path.join(alloys[0], "STRU")) - self.assertEqual(len(alloys), stru0["coords"].shape[0]) + self.assertEqual( + jdata["super_cell"][0] * jdata["super_cell"][1] * jdata["super_cell"][2], + stru0["coords"].shape[0], + ) for ii in alloys: elem_numb = [int(i) for i in ii.split("/")[-1].split("-")[1:]] struct = get_abacus_STRU(os.path.join(ii, "STRU")) self.assertEqual(struct["atom_numbs"], elem_numb) + if os.path.basename(ii) == "sys-0004": + np.testing.assert_almost_equal( + struct["coords"], abacus_ref_Cu_coord, decimal=3 + ) path = self.out_dir + "/01.scale_pert" alloys = glob.glob(os.path.join(path, "sys-*")) - self.assertEqual(len(alloys), stru0["coords"].shape[0]) for ii in alloys: scales = glob.glob(os.path.join(ii, "scale-*")) self.assertEqual(len(scales), self.scale_numb) From 52b40f9cc4b0a953361fd7aad01262ac61b46094 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 24 Jun 2023 21:06:21 -0400 Subject: [PATCH 40/86] Use get_global_number_of_atoms() instead (#1256) ``` /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ase/atoms.py:967: VisibleDeprecationWarning: Use get_global_number_of_atoms() instead ``` --- dpgen/data/tools/create_random_disturb.py | 6 +++--- dpgen/data/tools/io_lammps.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dpgen/data/tools/create_random_disturb.py b/dpgen/data/tools/create_random_disturb.py index 591dee232..8814c7ff9 100755 --- a/dpgen/data/tools/create_random_disturb.py +++ b/dpgen/data/tools/create_random_disturb.py @@ -54,7 +54,7 @@ def create_disturbs_ase( # read-in by ase atoms = ase.io.read(fin) - natoms = atoms.get_number_of_atoms() + natoms = atoms.get_global_number_of_atoms() pos0 = atoms.get_positions() # creat nfile ofmt files. @@ -119,7 +119,7 @@ def create_disturbs_ase_dev( # read-in by ase atoms = ase.io.read(fin) - natoms = atoms.get_number_of_atoms() + natoms = atoms.get_global_number_of_atoms() cell0 = atoms.get_cell() # creat nfile ofmt files. @@ -186,7 +186,7 @@ def create_disturbs_abacus_dev( # read-in by ase # atoms = ase.io.read(fin) - # natoms = atoms.get_number_of_atoms() + # natoms = atoms.get_global_number_of_atoms() # cell0 = atoms.get_cell() stru = get_abacus_STRU(fin) diff --git a/dpgen/data/tools/io_lammps.py b/dpgen/data/tools/io_lammps.py index e8c01d228..f23045905 100755 --- a/dpgen/data/tools/io_lammps.py +++ b/dpgen/data/tools/io_lammps.py @@ -163,7 +163,7 @@ def ase2lammpsdata(atoms, typeids=None, fout="out.lmp"): fw.write("\n") # write number of atoms - natoms = atoms.get_number_of_atoms() + natoms = atoms.get_global_number_of_atoms() fw.write("%d atoms\n" % natoms) fw.write("\n") From 930f6052a04d0d73d73c7bb7fcfefd1f1765a265 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 24 Jun 2023 21:10:39 -0400 Subject: [PATCH 41/86] load files according to filename suffix (#1255) The current `try...catch` does not report what's wrong in the YAML file if it is invalid. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/data/gen.py | 20 +++---------------- dpgen/data/reaction.py | 20 +++---------------- dpgen/data/surf.py | 19 +++--------------- dpgen/generator/run.py | 17 +++++----------- dpgen/simplify/simplify.py | 19 +++--------------- dpgen/util.py | 33 +++++++++++++++++++++++++++++++ tests/sample.json | 1 + tests/sample.yaml | 1 + tests/test_load_file.py | 18 +++++++++++++++++ tests/tools/test_convert_mdata.py | 4 ++-- 10 files changed, 72 insertions(+), 80 deletions(-) create mode 100644 tests/sample.json create mode 100644 tests/sample.yaml create mode 100644 tests/test_load_file.py diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index 83bd59745..6f7856cf0 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -2,13 +2,11 @@ import argparse import glob -import json import os import re import shutil import subprocess as sp import sys -import warnings import dpdata import numpy as np @@ -33,6 +31,7 @@ from dpgen.generator.lib.utils import symlink_user_forward_files from dpgen.generator.lib.vasp import incar_upper from dpgen.remote.decide_machine import convert_mdata +from dpgen.util import load_file def create_path(path, back=False): @@ -1465,22 +1464,9 @@ def run_abacus_md(jdata, mdata): def gen_init_bulk(args): - try: - import ruamel - from monty.serialization import loadfn - - warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) - jdata = loadfn(args.PARAM) - if args.MACHINE is not None: - mdata = loadfn(args.MACHINE) - except Exception: - with open(args.PARAM) as fp: - jdata = json.load(fp) - if args.MACHINE is not None: - with open(args.MACHINE) as fp: - mdata = json.load(fp) - + jdata = load_file(args.PARAM) if args.MACHINE is not None: + mdata = load_file(args.MACHINE) # Selecting a proper machine mdata = convert_mdata(mdata, ["fp"]) # disp = make_dispatcher(mdata["fp_machine"]) diff --git a/dpgen/data/reaction.py b/dpgen/data/reaction.py index adbd453ac..a76766846 100644 --- a/dpgen/data/reaction.py +++ b/dpgen/data/reaction.py @@ -7,10 +7,8 @@ """ import glob -import json import os import random -import warnings import dpdata @@ -18,7 +16,7 @@ from dpgen.dispatcher.Dispatcher import make_submission_compat from dpgen.generator.run import create_path, make_fp_task_name from dpgen.remote.decide_machine import convert_mdata -from dpgen.util import normalize, sepline +from dpgen.util import load_file, normalize, sepline from .arginfo import init_reaction_jdata_arginfo @@ -214,20 +212,8 @@ def convert_data(jdata): def gen_init_reaction(args): - try: - import ruamel - from monty.serialization import loadfn - - warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) - jdata = loadfn(args.PARAM) - if args.MACHINE is not None: - mdata = loadfn(args.MACHINE) - except Exception: - with open(args.PARAM) as fp: - jdata = json.load(fp) - if args.MACHINE is not None: - with open(args.MACHINE) as fp: - mdata = json.load(fp) + jdata = load_file(args.PARAM) + mdata = load_file(args.MACHINE) jdata_arginfo = init_reaction_jdata_arginfo() jdata = normalize(jdata_arginfo, jdata) diff --git a/dpgen/data/surf.py b/dpgen/data/surf.py index 4a61ac418..75b2281d3 100644 --- a/dpgen/data/surf.py +++ b/dpgen/data/surf.py @@ -2,13 +2,11 @@ import argparse import glob -import json import os import re import shutil import subprocess as sp import sys -import warnings import numpy as np from ase.build import general_surface @@ -29,6 +27,7 @@ from dpgen.dispatcher.Dispatcher import make_submission_compat from dpgen.generator.lib.utils import symlink_user_forward_files from dpgen.remote.decide_machine import convert_mdata +from dpgen.util import load_file def create_path(path): @@ -602,26 +601,14 @@ def run_vasp_relax(jdata, mdata): def gen_init_surf(args): - try: - import ruamel - from monty.serialization import loadfn - - warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) - jdata = loadfn(args.PARAM) - if args.MACHINE is not None: - mdata = loadfn(args.MACHINE) - except Exception: - with open(args.PARAM) as fp: - jdata = json.load(fp) - if args.MACHINE is not None: - with open(args.MACHINE) as fp: - mdata = json.load(fp) + jdata = load_file(args.PARAM) out_dir = out_dir_name(jdata) jdata["out_dir"] = out_dir dlog.info("# working dir %s" % out_dir) if args.MACHINE is not None: + mdata = load_file(args.MACHINE) # Decide a proper machine mdata = convert_mdata(mdata, ["fp"]) # disp = make_dispatcher(mdata["fp_machine"]) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 40dcfbd78..0963ebdd1 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -92,6 +92,7 @@ from dpgen.util import ( convert_training_data_to_hdf5, expand_sys_str, + load_file, normalize, sepline, set_directory, @@ -4494,18 +4495,8 @@ def set_version(mdata): def run_iter(param_file, machine_file): - try: - import ruamel - from monty.serialization import dumpfn, loadfn - - warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) - jdata = loadfn(param_file) - mdata = loadfn(machine_file) - except Exception: - with open(param_file) as fp: - jdata = json.load(fp) - with open(machine_file) as fp: - mdata = json.load(fp) + jdata = load_file(param_file) + mdata = load_file(machine_file) jdata_arginfo = run_jdata_arginfo() jdata = normalize(jdata_arginfo, jdata, strict_check=False) @@ -4513,6 +4504,8 @@ def run_iter(param_file, machine_file): update_mass_map(jdata) if jdata.get("pretty_print", False): + from monty.serialization import dumpfn + # assert(jdata["pretty_format"] in ['json','yaml']) fparam = ( SHORT_CMD diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 3124fe115..2cf610e91 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -9,11 +9,9 @@ 02: fp (optional, if the original dataset do not have fp data, same as generator) """ import glob -import json import logging import os import queue -import warnings from collections import defaultdict from typing import List, Union @@ -46,7 +44,7 @@ train_task_fmt, ) from dpgen.remote.decide_machine import convert_mdata -from dpgen.util import expand_sys_str, normalize, sepline +from dpgen.util import expand_sys_str, load_file, normalize, sepline from .arginfo import simplify_jdata_arginfo @@ -433,19 +431,8 @@ def run_iter(param_file, machine_file): 07 run_fp (same as generator) 08 post_fp (same as generator) """ - # TODO: function of handling input json should be combined as one function - try: - import ruamel - from monty.serialization import loadfn - - warnings.simplefilter("ignore", ruamel.yaml.error.MantissaNoDotYAML1_1Warning) - jdata = loadfn(param_file) - mdata = loadfn(machine_file) - except Exception: - with open(param_file) as fp: - jdata = json.load(fp) - with open(machine_file) as fp: - mdata = json.load(fp) + jdata = load_file(param_file) + mdata = load_file(machine_file) jdata_arginfo = simplify_jdata_arginfo() jdata = normalize(jdata_arginfo, jdata) diff --git a/dpgen/util.py b/dpgen/util.py index 2c7bd3a26..6cdc28982 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -175,3 +175,36 @@ def set_directory(path: Path): yield finally: os.chdir(cwd) + + +def load_file(filename: Union[str, os.PathLike]) -> dict: + """Load data from a JSON or YAML file. + + Parameters + ---------- + filename : str or os.PathLike + The filename to load data from, whose suffix should be .json, .yaml, or .yml + + Returns + ------- + dict + The data loaded from the file + + Raises + ------ + ValueError + If the file format is not supported + """ + filename = str(filename) + if filename.endswith(".json"): + with open(filename) as fp: + data = json.load(fp) + elif filename.endswith(".yaml") or filename.endswith(".yml"): + from ruamel.yaml import YAML + + yaml = YAML(typ="safe", pure=True) + with open(filename) as fp: + data = yaml.load(fp) + else: + raise ValueError(f"Unsupported file format: {filename}") + return data diff --git a/tests/sample.json b/tests/sample.json new file mode 100644 index 000000000..c068f91ac --- /dev/null +++ b/tests/sample.json @@ -0,0 +1 @@ +{"aa": "bb"} \ No newline at end of file diff --git a/tests/sample.yaml b/tests/sample.yaml new file mode 100644 index 000000000..9f408e971 --- /dev/null +++ b/tests/sample.yaml @@ -0,0 +1 @@ +aa: bb \ No newline at end of file diff --git a/tests/test_load_file.py b/tests/test_load_file.py new file mode 100644 index 000000000..583d9c1aa --- /dev/null +++ b/tests/test_load_file.py @@ -0,0 +1,18 @@ +import unittest +from pathlib import Path + +from dpgen.util import load_file + +this_directory = Path(__file__).parent + + +class TestLoadFile(unittest.TestCase): + def test_load_json_file(self): + ref = {"aa": "bb"} + jdata = load_file(this_directory / "sample.json") + self.assertEqual(jdata, ref) + + def test_load_yaml_file(self): + ref = {"aa": "bb"} + jdata = load_file(this_directory / "sample.yaml") + self.assertEqual(jdata, ref) diff --git a/tests/tools/test_convert_mdata.py b/tests/tools/test_convert_mdata.py index 57e15b52c..f5d76c7a0 100644 --- a/tests/tools/test_convert_mdata.py +++ b/tests/tools/test_convert_mdata.py @@ -1,4 +1,3 @@ -import json import os import sys import unittest @@ -7,6 +6,7 @@ sys.path.insert(0, os.path.join(test_dir, "..")) __package__ = "tools" from dpgen.remote.decide_machine import convert_mdata +from dpgen.util import load_file from .context import setUpModule # noqa: F401 @@ -15,7 +15,7 @@ class TestConvertMdata(unittest.TestCase): machine_file = "machine_fp_single.json" def test_convert_mdata(self): - mdata = json.load(open(self.machine_file)) + mdata = load_file(self.machine_file) mdata = convert_mdata(mdata, ["fp"]) self.assertEqual(mdata["fp_command"], "vasp_std") self.assertEqual(mdata["fp_group_size"], 8) From ae9833ccaaebbe3d9d132cc602db257a36caf166 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 24 Jun 2023 22:41:41 -0400 Subject: [PATCH 42/86] docs: fix docs for fp_task_min (#1257) The current documentation needs to be corrected. See also #596. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- dpgen/generator/arginfo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 7ed784f46..674bcb577 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -848,13 +848,13 @@ def fp_style_variant_type_args() -> Variant: def fp_args() -> List[Argument]: - doc_fp_task_max = "Maximum number of structures to be calculated in each system in 02.fp of each iteration." - doc_fp_task_min = "Minimum number of structures to be calculated in each system in 02.fp of each iteration." + doc_fp_task_max = "Maximum number of structures to be calculated in each system in 02.fp of each iteration. If the number of candidate structures exceeds `fp_task_max`, `fp_task_max` structures will be randomly picked from the candidates and labeled." + doc_fp_task_min = "Skip the training in the next iteration if the number of structures is no more than `fp_task_min`." doc_fp_accurate_threshold = "If the accurate ratio is larger than this number, no fp calculation will be performed, i.e. fp_task_max = 0." doc_fp_accurate_soft_threshold = "If the accurate ratio is between this number and fp_accurate_threshold, the fp_task_max linearly decays to zero." - doc_fp_cluster_vacuum = "If the vacuum size is smaller than this value, this cluster will not be choosen for labeling." + doc_fp_cluster_vacuum = "If the vacuum size is smaller than this value, this cluster will not be chosen for labeling." doc_detailed_report_make_fp = ( - "If set to true, detailed report will be generated for each iteration." + "If set to true, a detailed report will be generated for each iteration." ) doc_ratio_failed = "Check the ratio of unsuccessfully terminated jobs. If too many FP tasks are not converged, RuntimeError will be raised." From 0b8b1756ca78350fc594abe395f138d1b311ed42 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 25 Jun 2023 20:47:12 -0400 Subject: [PATCH 43/86] check arguments with 2D lists (#1258) Considering one may write these arguments as 1D lists. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/arginfo.py | 34 +++++++++++++++++++++++++++++++++- dpgen/generator/arginfo.py | 24 +++++++++++++++++++----- pyproject.toml | 2 +- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/dpgen/arginfo.py b/dpgen/arginfo.py index cef1f18de..5f2fd8d19 100644 --- a/dpgen/arginfo.py +++ b/dpgen/arginfo.py @@ -1,4 +1,4 @@ -from typing import Tuple +from typing import Callable, Tuple from dargs import Argument @@ -43,3 +43,35 @@ def general_mdata_arginfo(name: str, tasks: Tuple[str]) -> Argument: ) ) return Argument(name, dict, sub_fields=sub_fields, doc=doc_run_mdata) + + +def check_nd_list(dimesion: int = 2) -> Callable: + """Return a method to check if the input is a nd list. + + Parameters + ---------- + dimesion : int, default=2 + dimension of the array + + Returns + ------- + callable + check function + """ + + def check(value, dimension=dimesion): + if value is None: + # do not check null + return True + if dimension: + if not isinstance(value, list): + return False + if dimension > 1: + if not all(check(v, dimension=dimesion - 1) for v in value): + return False + return True + + return check + + +errmsg_nd_list = "Must be a %d-dimension list." diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 674bcb577..82d090553 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -3,7 +3,7 @@ from dargs import Argument, Variant -from dpgen.arginfo import general_mdata_arginfo +from dpgen.arginfo import check_nd_list, errmsg_nd_list, general_mdata_arginfo def run_mdata_arginfo() -> Argument: @@ -41,7 +41,7 @@ def data_args() -> List[Argument]: doc_sys_format = "Format of sys_configs." doc_init_batch_size = "Each number is the batch_size of corresponding system for training in init_data_sys. One recommended rule for setting the sys_batch_size and init_batch_size is that batch_size mutiply number of atoms ot the stucture should be larger than 32. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`." doc_sys_configs_prefix = "Prefix of sys_configs." - doc_sys_configs = "Containing directories of structures to be explored in iterations.Wildcard characters are supported here." + doc_sys_configs = "2D list. Containing directories of structures to be explored in iterations for each system. Wildcard characters are supported here." doc_sys_batch_size = "Each number is the batch_size for training of corresponding system in sys_configs. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`." return [ @@ -54,7 +54,14 @@ def data_args() -> List[Argument]: "init_batch_size", [list, str], optional=True, doc=doc_init_batch_size ), Argument("sys_configs_prefix", str, optional=True, doc=doc_sys_configs_prefix), - Argument("sys_configs", list, optional=False, doc=doc_sys_configs), + Argument( + "sys_configs", + list, + optional=False, + doc=doc_sys_configs, + extra_check=check_nd_list(2), + extra_check_errmsg=errmsg_nd_list % 2, + ), Argument("sys_batch_size", list, optional=True, doc=doc_sys_batch_size), ] @@ -466,7 +473,7 @@ def model_devi_amber_args() -> List[Argument]: "List of ints. The number of steps to run. Each number maps to a system." ) doc_r = ( - "3D or 4D list of floats. Constrict values for the enhanced sampling. " + "2D or 3D list of floats. Constrict values for the enhanced sampling. " "The first dimension maps to systems. " "The second dimension maps to confs in each system. The third dimension is the " "constrict value. It can be a single float for 1D or list of floats for nD." @@ -502,7 +509,14 @@ def model_devi_amber_args() -> List[Argument]: Argument("qm_region", list, optional=False, doc=doc_qm_region), Argument("qm_charge", list, optional=False, doc=doc_qm_charge), Argument("nsteps", list, optional=False, doc=doc_nsteps), - Argument("r", list, optional=False, doc=doc_r), + Argument( + "r", + list, + optional=False, + doc=doc_r, + extra_check=check_nd_list(2), + extra_check_errmsg=errmsg_nd_list % 2, + ), Argument("disang_prefix", str, optional=True, doc=doc_disang_prefix), Argument("disang", list, optional=False, doc=doc_disang), # post model devi args diff --git a/pyproject.toml b/pyproject.toml index 3bec52c1e..eaa80e15e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ 'GromacsWrapper>=0.8.0', 'dpdispatcher>=0.3.11', 'netCDF4', - 'dargs>=0.2.9', + 'dargs>=0.3.5', 'h5py', 'pymatgen-analysis-defects', 'openbabel-wheel', From 19af30825c19d59cd4108af9e41d7c87d56b5a65 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:17:57 +0800 Subject: [PATCH 44/86] [pre-commit.ci] pre-commit autoupdate (#1260) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.272 → v0.0.275](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.272...v0.0.275) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77b8f0387..dfbbc80ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.272 + rev: v0.0.275 hooks: - id: ruff args: ["--fix"] From 997b99d2788cb65971aeed6b7049559cb25f3353 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 5 Jul 2023 01:05:04 -0400 Subject: [PATCH 45/86] drop Python 3.8 support (#1264) The upstream package has a bug in Python 3.8 (https://github.com/materialsproject/api/issues/809), so we decide to drop Python 3.8 support. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 4 ++-- README.md | 2 +- conda/construct.yaml | 2 +- doc/overview/overview.md | 2 +- dpgen/arginfo.py | 4 ++-- dpgen/data/arginfo.py | 8 +++----- dpgen/dispatcher/Dispatcher.py | 13 ++++++------- dpgen/generator/arginfo.py | 31 +++++++++++++++---------------- dpgen/generator/run.py | 5 ++--- dpgen/simplify/arginfo.py | 4 +--- dpgen/simplify/simplify.py | 4 ++-- dpgen/util.py | 6 +++--- pyproject.toml | 5 ++--- 13 files changed, 41 insertions(+), 49 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c67dfafbf..0086dacc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.9", "3.11"] steps: - uses: actions/checkout@v2 @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies # See https://github.com/materialsproject/api/issues/809 - run: pip install coverage pymatgen==2023.5.31 -e . 'mp-api<0.33; python_version < "3.9"' + run: pip install coverage pymatgen==2023.5.31 -e . - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index 70b465d35..586ee3959 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and ## Download and Install -DP-GEN only supports Python 3.8 and above. +DP-GEN only supports Python 3.9 and above. One can download the source code of dpgen by ```bash diff --git a/conda/construct.yaml b/conda/construct.yaml index 020ae1f56..83c1b0822 100644 --- a/conda/construct.yaml +++ b/conda/construct.yaml @@ -9,7 +9,7 @@ channels: - deepmodeling specs: - - python 3.8 + - python 3.9 - pip - dpgen {{ version }} diff --git a/doc/overview/overview.md b/doc/overview/overview.md index 801370e5f..cb184bccb 100644 --- a/doc/overview/overview.md +++ b/doc/overview/overview.md @@ -21,7 +21,7 @@ Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and ## Download and install -DP-GEN only supports Python 3.8 and above. +DP-GEN only supports Python 3.9 and above. Please follow our [GitHub](https://github.com/deepmodeling/dpgen) webpage to download the [latest released version](https://github.com/deepmodeling/dpgen/tree/master) and [development version](https://github.com/deepmodeling/dpgen/tree/devel). One can download the source code of dpgen by diff --git a/dpgen/arginfo.py b/dpgen/arginfo.py index 5f2fd8d19..9d1841ecb 100644 --- a/dpgen/arginfo.py +++ b/dpgen/arginfo.py @@ -1,11 +1,11 @@ -from typing import Callable, Tuple +from typing import Callable from dargs import Argument from dpgen.dispatcher.Dispatcher import mdata_arginfo -def general_mdata_arginfo(name: str, tasks: Tuple[str]) -> Argument: +def general_mdata_arginfo(name: str, tasks: tuple[str]) -> Argument: """Generate arginfo for general mdata. Parameters diff --git a/dpgen/data/arginfo.py b/dpgen/data/arginfo.py index ca7ac4b69..3b5793ea1 100644 --- a/dpgen/data/arginfo.py +++ b/dpgen/data/arginfo.py @@ -1,5 +1,3 @@ -from typing import List - from dargs import Argument, Variant from dpgen.arginfo import general_mdata_arginfo @@ -38,11 +36,11 @@ def init_reaction_mdata_arginfo() -> Argument: return general_mdata_arginfo("init_reaction_mdata", ("reaxff", "build", "fp")) -def init_bulk_vasp_args() -> List[Argument]: +def init_bulk_vasp_args() -> list[Argument]: return [] -def init_bulk_abacus_args() -> List[Argument]: +def init_bulk_abacus_args() -> list[Argument]: doc_relax_kpt = 'Path of `KPT` file for relaxation in stage 1. Only useful if `init_fp_style` is "ABACUS".' doc_md_kpt = 'Path of `KPT` file for MD simulations in stage 3. Only useful if `init_fp_style` is "ABACUS".' doc_atom_masses = 'List of atomic masses of elements. The order should be the same as `Elements`. Only useful if `init_fp_style` is "ABACUS".' @@ -53,7 +51,7 @@ def init_bulk_abacus_args() -> List[Argument]: ] -def init_bulk_variant_type_args() -> List[Variant]: +def init_bulk_variant_type_args() -> list[Variant]: doc_init_fp_style = "First-principle software. If this key is absent." return [ Variant( diff --git a/dpgen/dispatcher/Dispatcher.py b/dpgen/dispatcher/Dispatcher.py index 27399dfed..d3a922b7e 100644 --- a/dpgen/dispatcher/Dispatcher.py +++ b/dpgen/dispatcher/Dispatcher.py @@ -1,6 +1,5 @@ import os from distutils.version import LooseVersion -from typing import List # import dargs from dargs.dargs import Argument @@ -56,7 +55,7 @@ def make_submission( return submission -def mdata_arginfo() -> List[Argument]: +def mdata_arginfo() -> list[Argument]: """This method generates arginfo for a single mdata. A submission requires the following keys: command, machine, @@ -94,13 +93,13 @@ def mdata_arginfo() -> List[Argument]: def make_submission_compat( machine: dict, resources: dict, - commands: List[str], + commands: list[str], work_path: str, - run_tasks: List[str], + run_tasks: list[str], group_size: int, - forward_common_files: List[str], - forward_files: List[str], - backward_files: List[str], + forward_common_files: list[str], + forward_files: list[str], + backward_files: list[str], outlog: str = "log", errlog: str = "err", api_version: str = "1.0", diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 82d090553..33dd64c88 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -1,5 +1,4 @@ import textwrap -from typing import List from dargs import Argument, Variant @@ -18,7 +17,7 @@ def run_mdata_arginfo() -> Argument: # basics -def basic_args() -> List[Argument]: +def basic_args() -> list[Argument]: doc_type_map = "Atom types. Reminder: The elements in param.json, type.raw and data.lmp(when using lammps) should be in the same order." doc_mass_map = 'Standard atomic weights (default: "auto"). if one want to use isotopes, or non-standard element names, chemical symbols, or atomic number in the type_map list, please customize the mass_map list instead of using "auto".' doc_use_ele_temp = "Currently only support fp_style vasp. \n\n\ @@ -35,7 +34,7 @@ def basic_args() -> List[Argument]: ] -def data_args() -> List[Argument]: +def data_args() -> list[Argument]: doc_init_data_prefix = "Prefix of initial data directories." doc_init_data_sys = "Paths of initial data. The path can be either a system diretory containing NumPy files or an HDF5 file. You may use either absolute or relative path here. Systems will be detected recursively in the directories or the HDF5 file." doc_sys_format = "Format of sys_configs." @@ -69,7 +68,7 @@ def data_args() -> List[Argument]: # Training -def training_args() -> List[Argument]: +def training_args() -> list[Argument]: """Traning arguments. Returns @@ -226,7 +225,7 @@ def model_devi_jobs_rev_mat_args() -> Argument: ) -def model_devi_jobs_args() -> List[Argument]: +def model_devi_jobs_args() -> list[Argument]: # this may be not correct doc_sys_rev_mat = ( "system-resolved revise matrix for revising variable(s) defined in the template into specific values. " @@ -292,7 +291,7 @@ def model_devi_jobs_args() -> List[Argument]: ) -def model_devi_lmp_args() -> List[Argument]: +def model_devi_lmp_args() -> list[Argument]: doc_model_devi_dt = "Timestep for MD. 0.002 is recommend." doc_model_devi_skip = "Number of structures skipped for fp in each MD." doc_model_devi_f_trust_lo = "Lower bound of forces for the selection. If list or dict, should be set for each index in sys_configs, respectively." @@ -438,7 +437,7 @@ def model_devi_lmp_args() -> List[Argument]: ] -def model_devi_amber_args() -> List[Argument]: +def model_devi_amber_args() -> list[Argument]: """Amber engine arguments.""" doc_model_devi_jobs = ( "List of dicts. The list including the dict for information of each cycle." @@ -535,7 +534,7 @@ def model_devi_amber_args() -> List[Argument]: ] -def model_devi_args() -> List[Variant]: +def model_devi_args() -> list[Variant]: doc_model_devi_engine = "Engine for the model deviation task." doc_amber = "Amber DPRc engine. The command argument in the machine file should be path to sander." return [ @@ -556,7 +555,7 @@ def model_devi_args() -> List[Variant]: # Labeling # vasp -def fp_style_vasp_args() -> List[Argument]: +def fp_style_vasp_args() -> list[Argument]: doc_fp_pp_path = "Directory of psuedo-potential file to be used for 02.fp exists." doc_fp_pp_files = "Psuedo-potential file to be used for 02.fp. Note that the order of elements should correspond to the order in type_map." doc_fp_incar = "Input file for VASP. INCAR must specify KSPACING and KGAMMA." @@ -579,7 +578,7 @@ def fp_style_vasp_args() -> List[Argument]: # abacus -def fp_style_abacus_args() -> List[Argument]: +def fp_style_abacus_args() -> list[Argument]: doc_fp_pp_path = "Directory of psuedo-potential or numerical orbital files to be used for 02.fp exists." doc_fp_pp_files = "Psuedo-potential file to be used for 02.fp. Note that the order of elements should correspond to the order in type_map." doc_fp_orb_files = "numerical orbital file to be used for 02.fp when using LCAO basis. Note that the order of elements should correspond to the order in type_map." @@ -604,7 +603,7 @@ def fp_style_abacus_args() -> List[Argument]: # gaussian -def fp_style_gaussian_args() -> List[Argument]: +def fp_style_gaussian_args() -> list[Argument]: """Gaussian fp style arguments. Returns @@ -693,7 +692,7 @@ def fp_style_gaussian_args() -> List[Argument]: # siesta -def fp_style_siesta_args() -> List[Argument]: +def fp_style_siesta_args() -> list[Argument]: doc_ecut = "Define the plane wave cutoff for grid." doc_ediff = "Tolerance of Density Matrix." doc_kspacing = "Sample factor in Brillouin zones." @@ -726,7 +725,7 @@ def fp_style_siesta_args() -> List[Argument]: # cp2k -def fp_style_cp2k_args() -> List[Argument]: +def fp_style_cp2k_args() -> list[Argument]: doc_user_fp_params = "Parameters for cp2k calculation. find detail in manual.cp2k.org. only the kind section must be set before use. we assume that you have basic knowledge for cp2k input." doc_external_input_path = ( "Conflict with key:user_fp_params.\n" @@ -760,7 +759,7 @@ def fp_style_cp2k_args() -> List[Argument]: ] -def fp_style_amber_diff_args() -> List[Argument]: +def fp_style_amber_diff_args() -> list[Argument]: """Arguments for FP style amber/diff. Returns @@ -797,7 +796,7 @@ def fp_style_amber_diff_args() -> List[Argument]: ] -def fp_style_custom_args() -> List[Argument]: +def fp_style_custom_args() -> list[Argument]: """Arguments for FP style custom. Returns @@ -861,7 +860,7 @@ def fp_style_variant_type_args() -> Variant: ) -def fp_args() -> List[Argument]: +def fp_args() -> list[Argument]: doc_fp_task_max = "Maximum number of structures to be calculated in each system in 02.fp of each iteration. If the number of candidate structures exceeds `fp_task_max`, `fp_task_max` structures will be randomly picked from the candidates and labeled." doc_fp_task_min = "Skip the training in the next iteration if the number of structures is no more than `fp_task_min`." doc_fp_accurate_threshold = "If the accurate ratio is larger than this number, no fp calculation will be performed, i.e. fp_task_max = 0." diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 0963ebdd1..f0bb55176 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -24,7 +24,6 @@ from collections import Counter from collections.abc import Iterable from pathlib import Path -from typing import List import dpdata import numpy as np @@ -2089,7 +2088,7 @@ def _read_model_devi_file( def _select_by_model_devi_standard( - modd_system_task: List[str], + modd_system_task: list[str], f_trust_lo: float, f_trust_hi: float, v_trust_lo: float, @@ -2192,7 +2191,7 @@ def _select_by_model_devi_standard( def _select_by_model_devi_adaptive_trust_low( - modd_system_task: List[str], + modd_system_task: list[str], f_trust_hi: float, numb_candi_f: int, perc_candi_f: float, diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 087f55710..41ca5676f 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -1,5 +1,3 @@ -from typing import List - from dargs import Argument, Variant from dpgen.arginfo import general_mdata_arginfo @@ -99,7 +97,7 @@ def fp_style_variant_type_args() -> Variant: ) -def fp_args() -> List[Argument]: +def fp_args() -> list[Argument]: """Generate arginfo for fp. Returns diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 2cf610e91..7cfb0bbb4 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -13,7 +13,7 @@ import os import queue from collections import defaultdict -from typing import List, Union +from typing import Union import dpdata import numpy as np @@ -62,7 +62,7 @@ def get_system_cls(jdata): return dpdata.System -def get_multi_system(path: Union[str, List[str]], jdata: dict) -> dpdata.MultiSystems: +def get_multi_system(path: Union[str, list[str]], jdata: dict) -> dpdata.MultiSystems: """Get MultiSystems from a path or list of paths. Both NumPy and HDF5 formats are supported. For details diff --git a/dpgen/util.py b/dpgen/util.py index 6cdc28982..872543f46 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -5,7 +5,7 @@ contextmanager, ) from pathlib import Path -from typing import List, Union +from typing import Union import dpdata import h5py @@ -35,7 +35,7 @@ def box_center(ch="", fill=" ", sp="|"): dlog.info(sp + strs[1 : len(strs) - 1 :] + sp) -def expand_sys_str(root_dir: Union[str, Path]) -> List[str]: +def expand_sys_str(root_dir: Union[str, Path]) -> list[str]: """Recursively iterate over directories taking those that contain `type.raw` file. If root_dir is a file but not a directory, it will be assumed as an HDF5 file. @@ -91,7 +91,7 @@ def normalize(arginfo: Argument, data: dict, strict_check: bool = True) -> dict: return data -def convert_training_data_to_hdf5(input_files: List[str], h5_file: str): +def convert_training_data_to_hdf5(input_files: list[str], h5_file: str): """Convert training data to HDF5 format and update the input files. Parameters diff --git a/pyproject.toml b/pyproject.toml index eaa80e15e..b89858ba6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,6 @@ authors = [ ] license = {file = "LICENSE"} classifiers = [ - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -35,7 +34,7 @@ dependencies = [ 'openbabel-wheel', 'packaging', ] -requires-python = ">=3.8" +requires-python = ">=3.9" readme = "README.md" keywords = ["deep potential generator", "active learning", "deepmd-kit"] @@ -57,7 +56,7 @@ write_to = "dpgen/_version.py" profile = "black" [tool.ruff] -target-version = "py38" +target-version = "py39" select = [ "I", # isort "E", # errors From 7b78bb43106a6fdf2bcfa6c2dae4ac208712eecb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 06:54:22 +0000 Subject: [PATCH 46/86] [pre-commit.ci] pre-commit autoupdate (#1263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.275 → v0.0.276](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.275...v0.0.276) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- dpgen/auto_test/Property.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dfbbc80ce..76d41c90d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,8 +23,8 @@ repos: rev: 23.3.0 hooks: - id: black-jupyter -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.275 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.276 hooks: - id: ruff args: ["--fix"] diff --git a/dpgen/auto_test/Property.py b/dpgen/auto_test/Property.py index 8b6a18f1b..61b94614b 100644 --- a/dpgen/auto_test/Property.py +++ b/dpgen/auto_test/Property.py @@ -102,13 +102,14 @@ def _compute_lower(self, output_file, all_tasks, all_res): Parameters ---------- - output_file: + output_file The file to output the property all_tasks : list of str The list of directories to the tasks all_res : list of str The list of results - Returns: + + Returns ------- res_data : dist The dict storing the result of the property From c88c7729448efc26c74373579544ff0b2825242f Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 9 Jul 2023 10:19:02 -0400 Subject: [PATCH 47/86] fix a typo in new_to_old_ratio message (#1270) --- dpgen/generator/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index f0bb55176..0b79f6be9 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -300,7 +300,7 @@ def make_train(iter_index, jdata, mdata): ) dlog.info( "Use automatic training_reuse_old_ratio to make new-to-old ratio close to %d times of the default value.", - training_reuse_iter, + new_to_old_ratio, ) auto_ratio = True number_old_frames = 0 From f2da7dbf257e7b55efdab8846c05bb1b099ae2a8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:01:01 +0800 Subject: [PATCH 48/86] [pre-commit.ci] pre-commit autoupdate (#1272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0) - [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.277](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.277) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76d41c90d..1a63d4ed1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: - id: check-toml # Python - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.276 + rev: v0.0.277 hooks: - id: ruff args: ["--fix"] From a356e7040563a074ea8a71795a66510917a4efd3 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 15 Jul 2023 10:31:13 -0400 Subject: [PATCH 49/86] fix a bug in the number of frames for auto ratio (#1276) --- dpgen/generator/run.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 0b79f6be9..d19e82e9f 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -400,11 +400,11 @@ def make_train(iter_index, jdata, mdata): nframes += dpdata.LabeledSystem( sys_single, fmt="deepmd/npy" ).get_nframes() - if auto_ratio: - if ii == iter_index - 1: - number_new_frames += nframes - else: - number_old_frames += nframes + if auto_ratio: + if ii == iter_index - 1: + number_new_frames += nframes + else: + number_old_frames += nframes if nframes < fp_task_min: log_task( "nframes (%d) in data sys %s is too small, skip" % (nframes, jj) From e86d82156c54af665070d1d95977e3842e3013e6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:16:02 +0800 Subject: [PATCH 50/86] [pre-commit.ci] pre-commit autoupdate (#1278) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.277 → v0.0.278](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.277...v0.0.278) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- dpgen/data/tools/diamond.py | 12 ++---------- dpgen/generator/run.py | 5 +---- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a63d4ed1..52ff8bfb1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.277 + rev: v0.0.278 hooks: - id: ruff args: ["--fix"] diff --git a/dpgen/data/tools/diamond.py b/dpgen/data/tools/diamond.py index 056ce9be9..f4a2b52a3 100644 --- a/dpgen/data/tools/diamond.py +++ b/dpgen/data/tools/diamond.py @@ -25,14 +25,6 @@ def poscar_unit(latt): ret += "Type\n" ret += "%d\n" % numb_atoms() ret += "Direct\n" - ret += "{:.16f} {:.16f} {:.16f}\n".format( - 0.12500000000000, - 0.12500000000000, - 0.12500000000000, - ) - ret += "{:.16f} {:.16f} {:.16f}\n".format( - 0.87500000000000, - 0.87500000000000, - 0.87500000000000, - ) + ret += f"{0.12500000000000:.16f} {0.12500000000000:.16f} {0.12500000000000:.16f}\n" + ret += f"{0.87500000000000:.16f} {0.87500000000000:.16f} {0.87500000000000:.16f}\n" return ret diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index d19e82e9f..83e214498 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -980,10 +980,7 @@ def revise_lmp_input_plm(lmp_lines, in_plm, out_plm="output.plumed"): idx = find_only_one_key(lmp_lines, ["fix", "dpgen_plm"]) lmp_lines[ idx - ] = "fix dpgen_plm all plumed plumedfile {} outfile {}\n".format( - in_plm, - out_plm, - ) + ] = f"fix dpgen_plm all plumed plumedfile {in_plm} outfile {out_plm}\n" return lmp_lines From 5d77334c404be88140052cd749dd693c4844dc42 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:15:59 +0800 Subject: [PATCH 51/86] [pre-commit.ci] pre-commit autoupdate (#1289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.278...v0.0.280) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 52ff8bfb1..8f556139f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.0.280 hooks: - id: ruff args: ["--fix"] From 2a6fd0949dcd6d2baba63985548067156900294b Mon Sep 17 00:00:00 2001 From: zhaohan <32747623+dingzhaohan@users.noreply.github.com> Date: Wed, 26 Jul 2023 09:12:30 +0800 Subject: [PATCH 52/86] Using dict.get methods to get machine.local_root (#1287) If local_root isn't `./`, dpgen will raise error and exit, it seems local_root must be './', so I try to get a default value if machine.json doesn't provided it. --- dpgen/dispatcher/Dispatcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpgen/dispatcher/Dispatcher.py b/dpgen/dispatcher/Dispatcher.py index d3a922b7e..2c50f18c9 100644 --- a/dpgen/dispatcher/Dispatcher.py +++ b/dpgen/dispatcher/Dispatcher.py @@ -19,7 +19,7 @@ def make_submission( outlog, errlog, ): - if mdata_machine["local_root"] != "./": + if mdata_machine.get("local_root", "./") != "./": raise RuntimeError("local_root must be './' in dpgen's machine.json.") abs_local_root = os.path.abspath("./") From 801f279cb0dba325396f4eb7d8fdede032bd6778 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 25 Jul 2023 21:22:54 -0400 Subject: [PATCH 53/86] throw RuntimeError if no system is found by expand_sys_str (#1292) Fix #1286. --- dpgen/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dpgen/util.py b/dpgen/util.py index 872543f46..896a3d504 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -49,6 +49,11 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]: ------- List[str] list of string pointing to system directories + + Raises + ------ + RuntimeError + No system was found in the directory """ root_dir = Path(root_dir) if root_dir.is_dir(): @@ -66,6 +71,8 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]: ] else: raise OSError(f"{root_dir} does not exist.") + if len(matches) == 0: + raise RuntimeError("%s does not contain any systems!" % root_dir) return matches From 6e74617e9da9fb9238d67f8e83cd5d27e6fa92cd Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 1 Aug 2023 04:22:02 -0400 Subject: [PATCH 54/86] use OIDC to publish packages (#1298) drop token --- .github/workflows/release.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19f733d7c..d40539314 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,21 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} release-to-pypi: - uses: deepmodeling/workflows/.github/workflows/release-to-pypi.yml@main - secrets: - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + name: Release to pypi + runs-on: ubuntu-latest + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.x + architecture: x64 + - name: Install dependencies + run: python -m pip install build + - run: python -m build + - name: Publish a Python distribution to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 From 1944bc987c1d8a1738b57edbf57d891b45a683b4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 10 Aug 2023 09:27:32 +0800 Subject: [PATCH 55/86] [pre-commit.ci] pre-commit autoupdate (#1304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.282](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.280...v0.0.282) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f556139f..a5b50e0ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.280 + rev: v0.0.282 hooks: - id: ruff args: ["--fix"] From 9a3f202d9ca3134f2c885a2a16b6c5dca402996d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:52:33 +0800 Subject: [PATCH 56/86] [pre-commit.ci] pre-commit autoupdate (#1307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.284](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.284) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng --- .pre-commit-config.yaml | 2 +- dpgen/auto_test/gen_confs.py | 4 ++-- dpgen/auto_test/lib/mfp_eosfit.py | 6 +----- dpgen/auto_test/lib/vasp.py | 2 +- dpgen/data/gen.py | 14 ++++++-------- dpgen/generator/lib/abacus_scf.py | 22 +++++++++++----------- dpgen/generator/lib/ele_temp.py | 4 ++-- dpgen/generator/lib/gaussian.py | 4 ++-- dpgen/generator/lib/make_calypso.py | 14 ++++++++------ dpgen/generator/lib/pwmat.py | 2 +- dpgen/generator/lib/pwscf.py | 4 ++-- dpgen/generator/lib/vasp.py | 2 +- dpgen/generator/run.py | 20 ++++++++++---------- dpgen/simplify/simplify.py | 2 +- tests/auto_test/test_abacus.py | 4 ++-- tests/auto_test/test_vasp.py | 4 ++-- 16 files changed, 53 insertions(+), 57 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5b50e0ae..30c59d1ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.282 + rev: v0.0.284 hooks: - id: ruff args: ["--fix"] diff --git a/dpgen/auto_test/gen_confs.py b/dpgen/auto_test/gen_confs.py index 1554efd21..2c23ed101 100755 --- a/dpgen/auto_test/gen_confs.py +++ b/dpgen/auto_test/gen_confs.py @@ -50,7 +50,7 @@ def gen_ele_std(ele_name, ctype): def gen_element(ele_name, key): - assert type(ele_name) == str + assert isinstance(ele_name, str) mpr = MPRester(key) data = mpr.query( {"elements": [ele_name], "nelements": 1}, @@ -87,7 +87,7 @@ def gen_element(ele_name, key): def gen_element_std(ele_name): - assert type(ele_name) == str + assert isinstance(ele_name, str) for ii in global_std_crystal.keys(): ss = gen_ele_std(ele_name, ii) diff --git a/dpgen/auto_test/lib/mfp_eosfit.py b/dpgen/auto_test/lib/mfp_eosfit.py index 06a26d629..c28b5651f 100755 --- a/dpgen/auto_test/lib/mfp_eosfit.py +++ b/dpgen/auto_test/lib/mfp_eosfit.py @@ -1668,11 +1668,7 @@ def lsqfit_eos( ) fve.flush() p_tmp = repro_press[i] - fvp.write( - "{:20f}\t{:20f}\t{:20f}\t{:20f}\n".format( - vol[i], p_tmp, p_tmp / 100, p_tmp * 10 - ) - ) + fvp.write(f"{vol[i]:20f}\t{p_tmp:20f}\t{p_tmp / 100:20f}\t{p_tmp * 10:20f}\n") fvp.flush() fve.close() fvp.close() diff --git a/dpgen/auto_test/lib/vasp.py b/dpgen/auto_test/lib/vasp.py index 9efeea04a..202cba4cb 100644 --- a/dpgen/auto_test/lib/vasp.py +++ b/dpgen/auto_test/lib/vasp.py @@ -112,7 +112,7 @@ def reciprocal_box(box): def make_kspacing_kpoints(poscar, kspacing, kgamma): - if type(kspacing) is not list: + if not isinstance(kspacing, list): kspacing = [kspacing, kspacing, kspacing] with open(poscar) as fp: lines = fp.read().split("\n") diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index 6f7856cf0..4a2527f6d 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -576,7 +576,7 @@ def make_abacus_relax(jdata, mdata): ) # a dictionary in which all of the values are strings if "kspacing" not in standard_incar: if "gamma_only" in standard_incar: - if type(standard_incar["gamma_only"]) == str: + if isinstance(standard_incar["gamma_only"], str): standard_incar["gamma_only"] = int(eval(standard_incar["gamma_only"])) if standard_incar["gamma_only"] == 0: if "relax_kpt" not in jdata: @@ -917,7 +917,7 @@ def make_abacus_md(jdata, mdata): # "Cannot find any k-points information." if "kspacing" not in standard_incar: if "gamma_only" in standard_incar: - if type(standard_incar["gamma_only"]) == str: + if isinstance(standard_incar["gamma_only"], str): standard_incar["gamma_only"] = int(eval(standard_incar["gamma_only"])) if standard_incar["gamma_only"] == 0: if "md_kpt" not in jdata: @@ -1090,8 +1090,8 @@ def coll_vasp_md(jdata): arg_cvt = " " if len(valid_outcars) == 0: raise RuntimeError( - "MD dir: {}: find no valid outcar in sys {}, " - "check if your vasp md simulation is correctly done".format(path_md, ii) + f"MD dir: {path_md}: find no valid outcar in sys {ii}, " + "check if your vasp md simulation is correctly done" ) flag = True @@ -1228,10 +1228,8 @@ def coll_abacus_md(jdata): arg_cvt = " " if len(valid_outcars) == 0: raise RuntimeError( - "MD dir: {}: find no valid OUT.ABACUS in sys {}, " - "check if your abacus md simulation is correctly done.".format( - path_md, ii - ) + f"MD dir: {path_md}: find no valid OUT.ABACUS in sys {ii}, " + "check if your abacus md simulation is correctly done." ) flag = True diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 5478bccc9..67f5d17bf 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -59,8 +59,8 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ret += "scf_thr %e\n" % fp_params["scf_thr"] elif key == "scf_nmax": fp_params["scf_nmax"] = int(fp_params["scf_nmax"]) - assert ( - fp_params["scf_nmax"] >= 0 and type(fp_params["scf_nmax"]) == int + assert fp_params["scf_nmax"] >= 0 and isinstance( + fp_params["scf_nmax"], int ), "'scf_nmax' should be a positive integer." ret += "scf_nmax %d\n" % fp_params["scf_nmax"] elif key == "basis_type": @@ -73,7 +73,7 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): elif key == "dft_functional": ret += "dft_functional %s\n" % fp_params["dft_functional"] elif key == "gamma_only": - if type(fp_params["gamma_only"]) == str: + if isinstance(fp_params["gamma_only"], str): fp_params["gamma_only"] = int(eval(fp_params["gamma_only"])) assert ( fp_params["gamma_only"] == 0 or fp_params["gamma_only"] == 1 @@ -95,7 +95,7 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ), "'mixing_beta' should between 0 and 1." ret += "mixing_beta %f\n" % fp_params["mixing_beta"] elif key == "symmetry": - if type(fp_params["symmetry"]) == str: + if isinstance(fp_params["symmetry"], str): fp_params["symmetry"] = int(eval(fp_params["symmetry"])) assert ( fp_params["symmetry"] == 0 or fp_params["symmetry"] == 1 @@ -103,8 +103,8 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ret += "symmetry %d\n" % fp_params["symmetry"] elif key == "nbands": fp_params["nbands"] = int(fp_params["nbands"]) - assert ( - fp_params["nbands"] > 0 and type(fp_params["nbands"]) == int + assert fp_params["nbands"] > 0 and isinstance( + fp_params["nbands"], int ), "'nbands' should be a positive integer." ret += "nbands %d\n" % fp_params["nbands"] elif key == "nspin": @@ -143,14 +143,14 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ), "'smearing_sigma' should be non-negative." ret += "smearing_sigma %f\n" % fp_params["smearing_sigma"] elif key == "cal_force": - if type(fp_params["cal_force"]) == str: + if isinstance(fp_params["cal_force"], str): fp_params["cal_force"] = int(eval(fp_params["cal_force"])) assert ( fp_params["cal_force"] == 0 or fp_params["cal_force"] == 1 ), "'cal_force' should be either 0 or 1." ret += "cal_force %d\n" % fp_params["cal_force"] elif key == "cal_stress": - if type(fp_params["cal_stress"]) == str: + if isinstance(fp_params["cal_stress"], str): fp_params["cal_stress"] = int(eval(fp_params["cal_stress"])) assert ( fp_params["cal_stress"] == 0 or fp_params["cal_stress"] == 1 @@ -158,7 +158,7 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ret += "cal_stress %d\n" % fp_params["cal_stress"] # paras for deepks elif key == "deepks_out_labels": - if type(fp_params["deepks_out_labels"]) == str: + if isinstance(fp_params["deepks_out_labels"], str): fp_params["deepks_out_labels"] = int( eval(fp_params["deepks_out_labels"]) ) @@ -176,7 +176,7 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ), "'deepks_descriptor_lmax' should be a positive integer." ret += "deepks_descriptor_lmax %d\n" % fp_params["deepks_descriptor_lmax"] elif key == "deepks_scf": - if type(fp_params["deepks_scf"]) == str: + if isinstance(fp_params["deepks_scf"], str): fp_params["deepks_scf"] = int(eval(fp_params["deepks_scf"])) assert ( fp_params["deepks_scf"] == 0 or fp_params["deepks_scf"] == 1 @@ -447,7 +447,7 @@ def make_supercell_abacus(from_struct, super_cell): def make_kspacing_kpoints_stru(stru, kspacing): # adapted from dpgen.autotest.lib.vasp.make_kspacing_kpoints - if type(kspacing) is not list: + if not isinstance(kspacing, list): kspacing = [kspacing, kspacing, kspacing] box = stru["cells"] rbox = vasp.reciprocal_box(box) diff --git a/dpgen/generator/lib/ele_temp.py b/dpgen/generator/lib/ele_temp.py index 15e1b802c..9f9f2c014 100644 --- a/dpgen/generator/lib/ele_temp.py +++ b/dpgen/generator/lib/ele_temp.py @@ -8,7 +8,7 @@ class NBandsEsti: def __init__(self, test_list): - if type(test_list) is list: + if isinstance(test_list, list): ele_t = [] vol = [] d_nbd = [] @@ -28,7 +28,7 @@ def __init__(self, test_list): self.pref = np.average(alpha) # print(np.average(alpha), np.std(alpha), self.err/self.pref) # print((ele_t), vol, d_nbd, nbd, alpha) - elif type(test_list) is str: + elif isinstance(test_list, str): with open(test_list) as fp: self.pref = float(fp.readline()) self.err = float(fp.readline()) diff --git a/dpgen/generator/lib/gaussian.py b/dpgen/generator/lib/gaussian.py index dca371ee1..421f15b84 100644 --- a/dpgen/generator/lib/gaussian.py +++ b/dpgen/generator/lib/gaussian.py @@ -115,7 +115,7 @@ def make_gaussian_input(sys_data, fp_params): else: keywords = fp_params["keywords"] - if type(keywords) == str: + if isinstance(keywords, str): keywords = [keywords] else: keywords = keywords.copy() @@ -128,7 +128,7 @@ def make_gaussian_input(sys_data, fp_params): use_fragment_guesses = False multiplicity = fp_params.get("multiplicity", "auto") - if type(multiplicity) == int: + if isinstance(multiplicity, int): multiplicity = fp_params["multiplicity"] mult_auto = False elif multiplicity == "auto": diff --git a/dpgen/generator/lib/make_calypso.py b/dpgen/generator/lib/make_calypso.py index b4d84da49..c96e2e960 100644 --- a/dpgen/generator/lib/make_calypso.py +++ b/dpgen/generator/lib/make_calypso.py @@ -39,7 +39,7 @@ def make_calypso_input( assert ( numberofformula is not None and len(numberofformula) == 2 - and type(numberofformula) is list + and isinstance(numberofformula, list) ) ret += "NumberOfFormula = %s\n" % (" ".join(list(map(str, numberofformula)))) ret += "# The volume per formula unit. Unit is in angstrom^3.\n" @@ -66,9 +66,9 @@ def make_calypso_input( ret += ( "# The population size. Normally, it has a larger number for larger systems.\n" ) - assert popsize is not None and type(popsize) is int + assert popsize is not None and isinstance(popsize, int) ret += "PopSize = %d\n" % (popsize) - assert maxstep is not None and type(maxstep) is int + assert maxstep is not None and isinstance(maxstep, int) ret += "# The Max step for iteration\n" ret += "MaxStep = %d\n" % (maxstep) ret += "#It determines which method should be adopted in generation the random structure. \n" @@ -79,7 +79,7 @@ def make_calypso_input( ret += "# 0 combination of all method\n" ret += "# If GenType=3 or 4, it determined the small unit to grow the whole structure\n" ret += "# It determines which local optimization method should be interfaced in the simulation.\n" - assert icode is not None and type(icode) is int + assert icode is not None and isinstance(icode, int) ret += "ICode= %d\n" % (icode) ret += "# ICode= 1 interfaced with VASP\n" ret += "# ICode= 2 interfaced with SIESTA\n" @@ -101,9 +101,11 @@ def make_calypso_input( ret += "NumberOfParallel = 4\n" assert split is not None ret += "Split = %s\n" % (split) - assert pstress is not None and (type(pstress) is int or type(pstress) is float) + assert pstress is not None and ( + isinstance(pstress, int) or isinstance(pstress, float) + ) ret += "PSTRESS = %f\n" % (pstress) - assert fmax is not None or type(fmax) is float + assert fmax is not None or isinstance(fmax, float) ret += "fmax = %f\n" % (fmax) ret += "################################ End of The Basic Parameters of CALYPSO #######################\n" if vsc == "T": diff --git a/dpgen/generator/lib/pwmat.py b/dpgen/generator/lib/pwmat.py index c2100ee69..6e3e10805 100644 --- a/dpgen/generator/lib/pwmat.py +++ b/dpgen/generator/lib/pwmat.py @@ -113,7 +113,7 @@ def _update_input_dict(input_dict_, user_dict): def write_input_dict(input_dict): lines = [] for key in input_dict: - if type(input_dict[key]) == bool: + if isinstance(input_dict[key], bool): if input_dict[key]: rs = "T" else: diff --git a/dpgen/generator/lib/pwscf.py b/dpgen/generator/lib/pwscf.py index 39d3174b3..c4a86fc80 100644 --- a/dpgen/generator/lib/pwscf.py +++ b/dpgen/generator/lib/pwscf.py @@ -8,12 +8,12 @@ def _convert_dict(idict): lines = [] for key in idict.keys(): - if type(idict[key]) == bool: + if isinstance(idict[key], bool): if idict[key]: ws = ".TRUE." else: ws = ".FALSE." - elif type(idict[key]) == str: + elif isinstance(idict[key], str): ws = "'" + idict[key] + "'" else: ws = str(idict[key]) diff --git a/dpgen/generator/lib/vasp.py b/dpgen/generator/lib/vasp.py index fd5a6ff81..a5f1e7aee 100644 --- a/dpgen/generator/lib/vasp.py +++ b/dpgen/generator/lib/vasp.py @@ -59,7 +59,7 @@ def _update_incar_dict(incar_dict_, user_dict): def write_incar_dict(incar_dict): lines = [] for key in incar_dict: - if type(incar_dict[key]) == bool: + if isinstance(incar_dict[key], bool): if incar_dict[key]: rs = "T" else: diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 83e214498..46eea3f58 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -210,9 +210,9 @@ def poscar_shuffle(poscar_in, poscar_out): def expand_idx(in_list): ret = [] for ii in in_list: - if type(ii) == int: + if isinstance(ii, int): ret.append(ii) - elif type(ii) == str: + elif isinstance(ii, str): step_str = ii.split(":") if len(step_str) > 1: step = int(step_str[1]) @@ -566,7 +566,7 @@ def make_train(iter_index, jdata, mdata): mdata["deepmd_version"], ) assert ( - type(model_devi_activation_func) is list + isinstance(model_devi_activation_func, list) and len(model_devi_activation_func) == numb_models ) if ( @@ -601,7 +601,7 @@ def make_train(iter_index, jdata, mdata): old_model_files = glob.glob(os.path.join(prev_task_path, "model.ckpt*")) _link_old_models(work_path, old_model_files, ii) else: - if type(training_iter0_model) == str: + if isinstance(training_iter0_model, str): training_iter0_model = [training_iter0_model] iter0_models = [] for ii in training_iter0_model: @@ -640,7 +640,7 @@ def _link_old_models(work_path, old_model_files, ii): def detect_batch_size(batch_size, system=None): - if type(batch_size) == int: + if isinstance(batch_size, int): return batch_size elif batch_size == "auto": # automaticcaly set batch size, batch_size = 32 // atom_numb (>=1, <=fram_numb) @@ -1439,7 +1439,7 @@ def _make_model_devi_native(iter_index, jdata, mdata, conf_systems): for cc in ss: for tt_ in temps: if use_ele_temp: - if type(tt_) == list: + if isinstance(tt_, list): tt = tt_[0] if use_ele_temp == 1: te_f = tt_[1] @@ -1448,7 +1448,7 @@ def _make_model_devi_native(iter_index, jdata, mdata, conf_systems): te_f = None te_a = tt_[1] else: - assert type(tt_) == float or type(tt_) == int + assert isinstance(tt_, (float, int)) tt = float(tt_) if use_ele_temp == 1: te_f = tt @@ -3258,15 +3258,15 @@ def make_fp_abacus_scf(iter_index, jdata): if fp_params["basis_type"] == "lcao": assert ( "fp_orb_files" in jdata - and type(jdata["fp_orb_files"]) == list + and isinstance(jdata["fp_orb_files"], list) and len(jdata["fp_orb_files"]) == len(fp_pp_files) ) fp_orb_files = jdata["fp_orb_files"] dpks_out_labels = fp_params.get("deepks_out_labels", 0) dpks_scf = fp_params.get("deepks_scf", 0) if dpks_out_labels or dpks_scf: - assert ( - "fp_dpks_descriptor" in jdata and type(jdata["fp_dpks_descriptor"]) == str + assert "fp_dpks_descriptor" in jdata and isinstance( + jdata["fp_dpks_descriptor"], str ) fp_dpks_descriptor = jdata["fp_dpks_descriptor"] diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 7cfb0bbb4..51ff364cb 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -105,7 +105,7 @@ def init_model(iter_index, jdata, mdata): return iter0_models = [] training_iter0_model = jdata.get("training_iter0_model_path", []) - if type(training_iter0_model) == str: + if isinstance(training_iter0_model, str): training_iter0_model = [training_iter0_model] for ii in training_iter0_model: model_is = glob.glob(ii) diff --git a/tests/auto_test/test_abacus.py b/tests/auto_test/test_abacus.py index 9cfedd3d1..28099e821 100644 --- a/tests/auto_test/test_abacus.py +++ b/tests/auto_test/test_abacus.py @@ -237,10 +237,10 @@ def test_compuate(self): def compare_dict(dict1, dict2): self.assertEqual(dict1.keys(), dict2.keys()) for key in dict1: - if type(dict1[key]) is dict: + if isinstance(dict1[key], dict): compare_dict(dict1[key], dict2[key]) else: - if type(dict1[key]) is np.ndarray: + if isinstance(dict1[key], np.ndarray): np.testing.assert_almost_equal( dict1[key], dict2[key], decimal=5 ) diff --git a/tests/auto_test/test_vasp.py b/tests/auto_test/test_vasp.py index 0fbe60b60..ae458b393 100644 --- a/tests/auto_test/test_vasp.py +++ b/tests/auto_test/test_vasp.py @@ -147,10 +147,10 @@ def compare_dict(dict1, dict2): for key in dict1: if key == "stress": self.assertTrue((np.array(dict1[key]["data"]) == dict2[key]).all()) - elif type(dict1[key]) is dict: + elif isinstance(dict1[key], dict): compare_dict(dict1[key], dict2[key]) else: - if type(dict1[key]) is np.ndarray: + if isinstance(dict1[key], np.ndarray): self.assertTrue((dict1[key] == dict2[key]).all()) else: self.assertTrue(dict1[key] == dict2[key]) From b4924593e44dcdccd72c07088bc0b7be74734f92 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Aug 2023 09:35:05 +0800 Subject: [PATCH 57/86] [pre-commit.ci] pre-commit autoupdate (#1311) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.284 → v0.0.285](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.284...v0.0.285) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30c59d1ab..078492395 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.284 + rev: v0.0.285 hooks: - id: ruff args: ["--fix"] From 6c5a48fdbd5d1c121c15ae6cbc293f979732ee52 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 25 Aug 2023 02:09:51 -0400 Subject: [PATCH 58/86] test: pin pymatgen-analysis-defects to <2023.08.22 (#1313) The tests need to be fixed... --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0086dacc4..da2671502 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - # See https://github.com/materialsproject/api/issues/809 - run: pip install coverage pymatgen==2023.5.31 -e . + run: pip install coverage 'pymatgen-analysis-defects<2023.08.22' -e . - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 From 07617631213e81cf38da1e6840bc8b0b2f568392 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 25 Aug 2023 02:13:47 -0400 Subject: [PATCH 59/86] simplify: support model deviation of energy per atom (#1312) Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> --- dpgen/simplify/arginfo.py | 16 ++++ dpgen/simplify/simplify.py | 30 +++++-- tests/simplify/test_post_model_devi.py | 116 +++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 tests/simplify/test_post_model_devi.py diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 41ca5676f..9aa8f0234 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -32,6 +32,8 @@ def general_simplify_arginfo() -> Argument: doc_model_devi_f_trust_hi = ( "The higher bound of forces for the selection for the model deviation." ) + doc_model_devi_e_trust_lo = "The lower bound of energy per atom for the selection for the model deviation. Requires DeePMD-kit version >=2.2.2." + doc_model_devi_e_trust_hi = "The higher bound of energy per atom for the selection for the model deviation. Requires DeePMD-kit version >=2.2.2." return [ Argument("labeled", bool, optional=True, default=False, doc=doc_labeled), @@ -50,6 +52,20 @@ def general_simplify_arginfo() -> Argument: optional=False, doc=doc_model_devi_f_trust_hi, ), + Argument( + "model_devi_e_trust_lo", + float, + optional=True, + default=float("inf"), + doc=doc_model_devi_e_trust_lo, + ), + Argument( + "model_devi_e_trust_hi", + float, + optional=True, + default=float("inf"), + doc=doc_model_devi_e_trust_hi, + ), ] diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 51ff364cb..e5dc24d7c 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -268,6 +268,8 @@ def post_model_devi(iter_index, jdata, mdata): f_trust_lo = jdata["model_devi_f_trust_lo"] f_trust_hi = jdata["model_devi_f_trust_hi"] + e_trust_lo = jdata["model_devi_e_trust_lo"] + e_trust_hi = jdata["model_devi_e_trust_hi"] type_map = jdata.get("type_map", []) sys_accurate = dpdata.MultiSystems(type_map=type_map) @@ -285,16 +287,30 @@ def post_model_devi(iter_index, jdata, mdata): if line.startswith("# data.rest.old"): name = (line.split()[1]).split("/")[-1] elif line.startswith("#"): - pass + columns = line.split()[1:] + cidx_step = columns.index("step") + cidx_max_devi_f = columns.index("max_devi_f") + try: + cidx_devi_e = columns.index("devi_e") + except ValueError: + # DeePMD-kit < 2.2.2 + cidx_devi_e = None else: - idx = int(line.split()[0]) - f_devi = float(line.split()[4]) + idx = int(line.split()[cidx_step]) + f_devi = float(line.split()[cidx_max_devi_f]) + if cidx_devi_e is not None: + e_devi = float(line.split()[cidx_devi_e]) + else: + e_devi = 0.0 subsys = sys_entire[name][idx] - if f_trust_lo <= f_devi < f_trust_hi: - sys_candinate.append(subsys) - elif f_devi >= f_trust_hi: + if f_devi >= f_trust_hi or e_devi >= e_trust_hi: sys_failed.append(subsys) - elif f_devi < f_trust_lo: + elif ( + f_trust_lo <= f_devi < f_trust_hi + or e_trust_lo <= e_devi < e_trust_hi + ): + sys_candinate.append(subsys) + elif f_devi < f_trust_lo and e_devi < e_trust_lo: sys_accurate.append(subsys) else: raise RuntimeError("reach a place that should NOT be reached...") diff --git a/tests/simplify/test_post_model_devi.py b/tests/simplify/test_post_model_devi.py new file mode 100644 index 000000000..0eeac7fc2 --- /dev/null +++ b/tests/simplify/test_post_model_devi.py @@ -0,0 +1,116 @@ +import os +import shutil +import sys +import unittest +from pathlib import Path + +import dpdata +import numpy as np + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) +__package__ = "simplify" +from .context import dpgen + + +class TestSimplifyModelDevi(unittest.TestCase): + def setUp(self): + self.work_path = Path("iter.000001") / dpgen.simplify.simplify.model_devi_name + self.work_path.mkdir(exist_ok=True, parents=True) + self.system = dpdata.System( + data={ + "atom_names": ["H"], + "atom_numbs": [1], + "atom_types": np.zeros((1,), dtype=int), + "coords": np.zeros((1, 1, 3), dtype=np.float32), + "cells": np.zeros((1, 3, 3), dtype=np.float32), + "orig": np.zeros(3, dtype=np.float32), + "nopbc": True, + "energies": np.zeros((1,), dtype=np.float32), + "forces": np.zeros((1, 1, 3), dtype=np.float32), + } + ) + self.system.to_deepmd_npy( + self.work_path / "data.rest.old" / self.system.formula + ) + model_devi = np.array([[0, 0.2, 0.1, 0.15, 0.2, 0.1, 0.15, 0.2]]) + np.savetxt( + self.work_path / "details", + model_devi, + fmt=["%12d"] + ["%19.6e" for _ in range(7)], + header="data.rest.old/" + + self.system.formula + + "\n step max_devi_v min_devi_v avg_devi_v max_devi_f min_devi_f avg_devi_f devi_e", + ) + + def tearDown(self): + shutil.rmtree("iter.000001", ignore_errors=True) + + def test_post_model_devi_f_candidate(self): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_f_trust_lo": 0.15, + "model_devi_f_trust_hi": 0.25, + "model_devi_e_trust_lo": float("inf"), + "model_devi_e_trust_hi": float("inf"), + "iter_pick_number": 1, + }, + {}, + ) + assert (self.work_path / "data.picked" / self.system.formula).exists() + + def test_post_model_devi_e_candidate(self): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_e_trust_lo": 0.15, + "model_devi_e_trust_hi": 0.25, + "model_devi_f_trust_lo": float("inf"), + "model_devi_f_trust_hi": float("inf"), + "iter_pick_number": 1, + }, + {}, + ) + assert (self.work_path / "data.picked" / self.system.formula).exists() + + def test_post_model_devi_f_failed(self): + with self.assertRaises(RuntimeError): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_f_trust_lo": 0.0, + "model_devi_f_trust_hi": 0.0, + "model_devi_e_trust_lo": float("inf"), + "model_devi_e_trust_hi": float("inf"), + "iter_pick_number": 1, + }, + {}, + ) + + def test_post_model_devi_e_failed(self): + with self.assertRaises(RuntimeError): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_e_trust_lo": 0.0, + "model_devi_e_trust_hi": 0.0, + "model_devi_f_trust_lo": float("inf"), + "model_devi_f_trust_hi": float("inf"), + "iter_pick_number": 1, + }, + {}, + ) + + def test_post_model_devi_accurate(self): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_e_trust_lo": 0.3, + "model_devi_e_trust_hi": 0.4, + "model_devi_f_trust_lo": 0.3, + "model_devi_f_trust_hi": 0.4, + "iter_pick_number": 1, + }, + {}, + ) + assert (self.work_path / "data.accurate" / self.system.formula).exists() From 2a25606a790824ea8f4136bb942066f2fe25d062 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 28 Aug 2023 06:15:06 -0400 Subject: [PATCH 60/86] update deepmd input to v2; format JSON files (#1315) This PR updates all JSON files: - convert `default_training_param` to v2 format - format JSON files - update `_comment` to `_commentN` to avoid duplicated keys - enable `check-json` and `pretty-format-json` hooks ```py import json from glob import glob from deepmd.utils.compat import update_deepmd_input, convert_input_v1_v2 for ii in glob("**/*.json", recursive=True): with open(ii) as f: content = f.read() count = 1 while True: if r'"_comment"' not in content: break content = content.replace('"_comment"', '"_comment%d"' % count, 1) count += 1 try: jdata = json.loads(content) except Exception as e: print(ii, e) continue if "default_training_param" in jdata: jdata["default_training_param"] = update_deepmd_input( jdata["default_training_param"], warning=False) if "decay_rate" in jdata["default_training_param"]["learning_rate"]: jdata["default_training_param"] = convert_input_v1_v2( jdata["default_training_param"], warning=False) if "load_ckpt" in jdata["default_training_param"]["training"]: del jdata["default_training_param"]["training"]["load_ckpt"] content = json.dumps(jdata, indent=2) with open(ii, "w") as f: f.write(content) ``` --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 10 +- doc/simplify/simplify.md | 5 +- dpgen/data/jsons/al.diamond.111.json | 54 +- dpgen/data/jsons/al.diamond.222.json | 54 +- dpgen/data/jsons/al.fcc.111.json | 54 +- dpgen/data/jsons/al.fcc.222.json | 54 +- dpgen/data/jsons/al.hcp.111.json | 54 +- dpgen/data/jsons/al.hcp.222.json | 54 +- dpgen/data/jsons/al.hcp.332.json | 54 +- dpgen/data/jsons/al.sc.222.json | 54 +- dpgen/data/jsons/almg.diamond.111.json | 57 +- dpgen/data/jsons/almg.diamond.222.json | 57 +- dpgen/data/jsons/almg.fcc.111.json | 57 +- dpgen/data/jsons/almg.fcc.222.json | 57 +- dpgen/data/jsons/almg.hcp.111.json | 57 +- dpgen/data/jsons/almg.hcp.222.json | 57 +- dpgen/data/jsons/almg.hcp.332.json | 57 +- dpgen/data/jsons/almg.sc.222.json | 57 +- dpgen/data/jsons/almg.sc.333.json | 57 +- dpgen/data/jsons/mg.diamond.111.json | 54 +- dpgen/data/jsons/mg.diamond.222.json | 54 +- dpgen/data/jsons/mg.fcc.111.json | 54 +- dpgen/data/jsons/mg.fcc.222.json | 54 +- dpgen/data/jsons/mg.hcp.111.json | 54 +- dpgen/data/jsons/mg.hcp.222.json | 50 +- dpgen/data/jsons/mg.hcp.332.json | 50 +- dpgen/data/jsons/mg.sc.222.json | 54 +- dpgen/data/jsons/param.json | 58 +- dpgen/data/jsons/si.diamond.111.json | 54 +- dpgen/data/jsons/si.diamond.222.json | 54 +- dpgen/data/jsons/si.fcc.111.json | 54 +- dpgen/data/jsons/si.fcc.222.json | 54 +- dpgen/data/jsons/si.hcp.111.json | 54 +- dpgen/data/jsons/si.hcp.222.json | 54 +- dpgen/data/jsons/si.sc.222.json | 54 +- dpgen/data/jsons/surf.al.fcc.json | 62 +- dpgen/data/jsons/surf.al.hcp.json | 62 +- dpgen/data/jsons/surf.almg.fcc.json | 65 +- dpgen/data/jsons/surf.almg.hcp.json | 65 +- dpgen/data/jsons/surf.mg.fcc.json | 62 +- dpgen/data/jsons/surf.mg.hcp.json | 62 +- dpgen/data/jsons/surf.si.diamond.json | 82 +- dpgen/data/jsons/w.bcc.111.json | 58 +- dpgen/data/jsons/w.bcc.222.json | 58 +- dpgen/data/jsons/w.diamond.111.json | 58 +- dpgen/data/jsons/w.fcc.111.json | 58 +- dpgen/data/jsons/w.hcp.111.json | 58 +- dpgen/data/jsons/water.111.json | 62 +- .../CH4-refact-dpdispatcher/INCAR_methane | 2 +- .../machine-ali-ehpc.json | 163 ++-- .../machine-dpcloudserver.json | 225 +++-- .../param_CH4_deepmd-kit-1.1.0.json | 1 - .../param_CH4_deepmd-kit-2.x.json | 1 + examples/database/param_Ti.json | 115 ++- examples/init/abacus/CuW/CuW.json | 27 +- examples/init/abacus/fcc-Al-lcao/init.json | 61 +- examples/init/abacus/fcc-Al-lcao/machine.json | 201 ++-- examples/init/abacus/fcc-Al-pw/init.json | 55 +- examples/init/abacus/fcc-Al-pw/machine.json | 201 ++-- examples/init/al.json | 2 +- examples/init/ch4.json | 51 +- examples/init/cu.surf.hcp.111.json | 107 ++- examples/init/surf.json | 104 +- .../DeePMD-kit-1.0/machine-local-4GPU.json | 26 +- .../machine/DeePMD-kit-1.x/machine-local.json | 10 +- .../DeePMD-kit-1.x/machine-slurm-qe.json | 26 +- .../DeePMD-kit-2.x/lebesgue_v2_machine.json | 191 ++-- examples/run/ch4/machine.json | 134 +-- examples/run/ch4/param.json | 297 +++--- .../dp0.12-lammps-cp2k/CH4/param_CH4.json | 136 --- .../machine-slurm-pwmat-single.json | 80 -- .../dp0.12-lammps-pwmat/param_CH4.json | 97 -- .../dp-lammps-siesta/CH4/param_CH4.json | 134 --- .../Al/param_al_all_gpu.json | 393 -------- .../dp0.12-lammps-vasp/CH4/param_CH4.json | 98 -- .../dp1.x-gromacs-gaussian/param.json | 176 ---- .../dp2.x-gromacs-gaussian/param.json | 209 ++++ .../dp2.x-lammps-cp2k/CH4/param_CH4.json | 156 +++ .../CH4/param_CH4.yaml | 1 - .../machine-slurm-pwmat-single.json | 80 ++ .../dp2.x-lammps-pwmat/param_CH4.json | 147 +++ .../dp-lammps-siesta/CH4/param_CH4.json | 148 +++ .../dp-lammps-siesta/CH4/param_CH4.yaml | 1 - .../Al/param_al_all_gpu.json | 450 +++++++++ .../Al/param_al_all_gpu.yaml | 1 - .../dp2.x-lammps-vasp/CH4/param_CH4.json | 146 +++ .../CH4/param_CH4.yaml | 1 - .../run/deprecated/param-h2oscan-vasp.json | 891 ++++++++++++++---- .../run/deprecated/param-mg-vasp-ucloud.json | 602 +++++++++--- examples/run/deprecated/param-mg-vasp.json | 615 +++++++++--- .../run/deprecated/param-pyridine-pwscf.json | 427 ++++++--- examples/run/dp-calypso-vasp/machine.json | 148 +-- examples/run/dp-calypso-vasp/param.json | 465 +++++++-- .../run/dp-lammps-enhance_sampling/param.json | 335 ++++--- .../methane/machine.json | 75 -- .../methane/param.json | 150 --- .../methane/machine.json | 75 -- .../dp1.x-lammps-ABACUS-pw/methane/param.json | 144 --- .../dp1.x-lammps-cp2k/methane/param-ch4.json | 134 --- .../run/dp1.x-lammps-vasp-et/param_elet.json | 99 -- .../Al/param_al_all_gpu-deepmd-kit-1.1.0.json | 371 -------- .../dodecane/dodecane.json | 84 -- .../run/dp2.x-gromacs-gaussian/param.json | 428 ++++++--- .../methane/machine.json | 85 ++ .../methane/param.json | 171 ++++ .../fcc-al/machine.json | 186 ++-- .../fcc-al/run_param.json | 85 +- .../fcc-al/machine.json | 186 ++-- .../fcc-al/run_param.json | 9 +- .../methane/machine.json | 85 ++ .../dp2.x-lammps-ABACUS-pw/methane/param.json | 162 ++++ .../dp2.x-lammps-cp2k/methane/param-ch4.json | 138 +++ .../methane/template.inp | 0 .../param_CH4_deepmd-kit-2.0.1.json | 33 +- .../run/dp2.x-lammps-gaussian/machine.json | 198 ++-- .../param_C4H16N4_deepmd-kit-2.0.1.json | 34 +- .../run/dp2.x-lammps-vasp-et/param_elet.json | 131 +++ .../Al/param_al_all_gpu-deepmd-kit-2.x.json | 430 +++++++++ .../CH4/INCAR_methane | 0 .../CH4/POT_C | 0 .../CH4/POT_H | 0 .../CH4/param_CH4_deepmd-kit-2.x.json} | 16 +- .../param_CH4_deepmd-kit-2.0.1.json | 5 +- .../dodecane/dodecane.json | 152 +++ .../simplify_example/machine.json | 194 ++-- .../simplify_example/simplify.json | 231 +++-- examples/simplify/qm7.json | 31 +- examples/test/deepmd_param.json | 29 +- examples/test/meam_param.json | 29 +- examples/test/vasp_param.json | 105 +-- examples/test/vasp_param_from_incar.json | 26 +- tests/auto_test/equi/abacus/cell-relax.json | 2 +- tests/auto_test/equi/vasp/Al-fcc.json | 2 +- tests/auto_test/equi/vasp/outcar.json | 2 +- .../output/gamma_00/task.000000/inter.json | 2 +- .../output/gamma_00/task.000000/miller.json | 6 +- .../gamma_00/task.000000/result_task.json | 2 +- .../output/gamma_00/task.000000/task.json | 2 +- .../output/gamma_00/task.000001/inter.json | 2 +- .../output/gamma_00/task.000001/miller.json | 6 +- .../gamma_00/task.000001/result_task.json | 2 +- .../output/gamma_00/task.000001/task.json | 2 +- .../output/gamma_00/task.000002/inter.json | 2 +- .../output/gamma_00/task.000002/miller.json | 6 +- .../gamma_00/task.000002/result_task.json | 2 +- .../output/gamma_00/task.000002/task.json | 2 +- .../output/relaxation/relax_task/result.json | 2 +- tests/data/CuW.json | 21 +- tests/data/al.json | 47 +- tests/data/alloy.json | 46 +- tests/data/ch4.json | 62 +- tests/data/surf.json | 88 +- tests/data/surf_poscar.json | 85 +- tests/database/param_Al.json | 115 ++- .../gromacs/model_devi_case/input.json | 2 +- tests/generator/machine-local-v1.json | 63 +- tests/generator/machine-local.json | 101 +- .../02.fp/task.000.000000/job.json | 4 +- .../02.fp/task.000.000001/job.json | 4 +- .../02.fp/task.001.000000/job.json | 4 +- .../02.fp/task.001.000001/job.json | 4 +- tests/generator/param-amber.json | 22 +- tests/generator/param-custom-fp.json | 418 ++++++-- tests/generator/param-methane-abacus-diy.json | 290 +++--- tests/generator/param-methane-abacus.json | 332 ++++--- tests/generator/param-mg-vasp-diy.json | 210 +++-- .../generator/param-mg-vasp-multi-trust.json | 260 ++--- tests/generator/param-mg-vasp-old.json | 240 +++-- tests/generator/param-mg-vasp-v1-et.json | 220 +++-- tests/generator/param-mg-vasp-v1.json | 218 +++-- tests/generator/param-mg-vasp.json | 248 +++-- tests/generator/param-mg-vasp_merge_traj.json | 246 +++-- tests/generator/param-mgo-cp2k-exinput.json | 408 ++++++-- tests/generator/param-pyridine-cp2k.json | 443 ++++++--- tests/generator/param-pyridine-gaussian.json | 414 ++++++-- tests/generator/param-pyridine-pwmat.json | 447 ++++++--- tests/generator/param-pyridine-pwscf-old.json | 428 ++++++--- tests/generator/param-pyridine-pwscf.json | 454 ++++++--- tests/generator/param-pyridine-siesta.json | 424 +++++++-- tests/sample.json | 4 +- tests/test_check_examples.py | 28 +- tests/tools/machine_fp_single.json | 28 +- tests/tools/machine_fp_single2.json | 25 +- tests/tools/run_report_test_output/param.json | 207 ++-- 184 files changed, 13612 insertions(+), 7972 deletions(-) delete mode 120000 examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-1.1.0.json create mode 120000 examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-2.x.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-pwmat/machine-slurm-pwmat-single.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-pwmat/param_CH4.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.json delete mode 100644 examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.json delete mode 100644 examples/run/deprecated/dp1.x-gromacs-gaussian/param.json create mode 100644 examples/run/deprecated/dp2.x-gromacs-gaussian/param.json create mode 100644 examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.json rename examples/run/deprecated/{dp0.12-lammps-cp2k => dp2.x-lammps-cp2k}/CH4/param_CH4.yaml (98%) create mode 100644 examples/run/deprecated/dp2.x-lammps-pwmat/machine-slurm-pwmat-single.json create mode 100644 examples/run/deprecated/dp2.x-lammps-pwmat/param_CH4.json create mode 100644 examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json rename examples/run/deprecated/{dp0.12-lammps-siesta => dp2.x-lammps-siesta}/dp-lammps-siesta/CH4/param_CH4.yaml (98%) create mode 100644 examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.json rename examples/run/deprecated/{dp0.12-lammps-vasp => dp2.x-lammps-vasp}/Al/param_al_all_gpu.yaml (99%) create mode 100644 examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.json rename examples/run/deprecated/{dp0.12-lammps-vasp => dp2.x-lammps-vasp}/CH4/param_CH4.yaml (98%) delete mode 100644 examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/machine.json delete mode 100644 examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/param.json delete mode 100644 examples/run/dp1.x-lammps-ABACUS-pw/methane/machine.json delete mode 100644 examples/run/dp1.x-lammps-ABACUS-pw/methane/param.json delete mode 100644 examples/run/dp1.x-lammps-cp2k/methane/param-ch4.json delete mode 100644 examples/run/dp1.x-lammps-vasp-et/param_elet.json delete mode 100644 examples/run/dp1.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-1.1.0.json delete mode 100644 examples/run/dp1.x_lammps_gaussian/dodecane/dodecane.json create mode 100644 examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/machine.json create mode 100644 examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/param.json create mode 100644 examples/run/dp2.x-lammps-ABACUS-pw/methane/machine.json create mode 100644 examples/run/dp2.x-lammps-ABACUS-pw/methane/param.json create mode 100644 examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json rename examples/run/{dp1.x-lammps-cp2k => dp2.x-lammps-cp2k}/methane/template.inp (100%) create mode 100644 examples/run/dp2.x-lammps-vasp-et/param_elet.json create mode 100644 examples/run/dp2.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-2.x.json rename examples/run/{dp1.x-lammps-vasp => dp2.x-lammps-vasp}/CH4/INCAR_methane (100%) rename examples/run/{dp1.x-lammps-vasp => dp2.x-lammps-vasp}/CH4/POT_C (100%) rename examples/run/{dp1.x-lammps-vasp => dp2.x-lammps-vasp}/CH4/POT_H (100%) rename examples/run/{dp1.x-lammps-vasp/CH4/param_CH4_deepmd-kit-1.1.0.json => dp2.x-lammps-vasp/CH4/param_CH4_deepmd-kit-2.x.json} (89%) create mode 100644 examples/run/dp2.x_lammps_gaussian/dodecane/dodecane.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 078492395..904018833 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,12 +12,20 @@ repos: exclude: "^tests/.*$" - id: check-yaml exclude: "^conda/.*$" - #- id: check-json + - id: check-json + exclude: "^examples/CH4-lebesgue/.*$" - id: check-added-large-files - id: check-merge-conflict - id: check-symlinks exclude: "^tests/tools/run_report_test_output/.*$" - id: check-toml + - id: pretty-format-json + args: + - "--autofix" + - "--no-sort-keys" + - "--indent=4" + exclude: "^examples/CH4-lebesgue/.*$" + # Python - repo: https://github.com/psf/black rev: 23.7.0 diff --git a/doc/simplify/simplify.md b/doc/simplify/simplify.md index c462c85df..8a1fa6dec 100644 --- a/doc/simplify/simplify.md +++ b/doc/simplify/simplify.md @@ -70,7 +70,7 @@ Here is an example of `param.json` for QM7 dataset: "learning_rate": { "type": "exp", "start_lr": 0.001, - "decay_steps": 10, + "stop_lr": 5e-8, "decay_rate": 0.99 }, "loss": { @@ -85,12 +85,11 @@ Here is an example of `param.json` for QM7 dataset: }, "training": { "set_prefix": "set", - "stop_batch": 10000, + "numb_steps": 10000, "disp_file": "lcurve.out", "disp_freq": 1000, "numb_test": 1, "save_freq": 1000, - "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, diff --git a/dpgen/data/jsons/al.diamond.111.json b/dpgen/data/jsons/al.diamond.111.json index ff015329f..8fe91110c 100644 --- a/dpgen/data/jsons/al.diamond.111.json +++ b/dpgen/data/jsons/al.diamond.111.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [1, 1, 1], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.diamond.222.json b/dpgen/data/jsons/al.diamond.222.json index 693390f4c..ef9ff78c7 100644 --- a/dpgen/data/jsons/al.diamond.222.json +++ b/dpgen/data/jsons/al.diamond.222.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.fcc.111.json b/dpgen/data/jsons/al.fcc.111.json index 4b0649d03..64ec32688 100644 --- a/dpgen/data/jsons/al.fcc.111.json +++ b/dpgen/data/jsons/al.fcc.111.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.fcc.222.json b/dpgen/data/jsons/al.fcc.222.json index c23f6ebe6..901a43156 100644 --- a/dpgen/data/jsons/al.fcc.222.json +++ b/dpgen/data/jsons/al.fcc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [2, 2, 2], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.hcp.111.json b/dpgen/data/jsons/al.hcp.111.json index 493fed54e..b9aa495f8 100644 --- a/dpgen/data/jsons/al.hcp.111.json +++ b/dpgen/data/jsons/al.hcp.111.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.hcp.222.json b/dpgen/data/jsons/al.hcp.222.json index ce057c5ef..85ecc8b9d 100644 --- a/dpgen/data/jsons/al.hcp.222.json +++ b/dpgen/data/jsons/al.hcp.222.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [2, 2, 2], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.hcp.332.json b/dpgen/data/jsons/al.hcp.332.json index d16c2f1cc..990e13e4e 100644 --- a/dpgen/data/jsons/al.hcp.332.json +++ b/dpgen/data/jsons/al.hcp.332.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [3, 3, 2], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 3, + 3, + 2 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/al.sc.222.json b/dpgen/data/jsons/al.sc.222.json index 6ab46dd98..9b7d0ee1e 100644 --- a/dpgen/data/jsons/al.sc.222.json +++ b/dpgen/data/jsons/al.sc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "sc", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "sc", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.diamond.111.json b/dpgen/data/jsons/almg.diamond.111.json index c41b905be..d6800a15e 100644 --- a/dpgen/data/jsons/almg.diamond.111.json +++ b/dpgen/data/jsons/almg.diamond.111.json @@ -1,23 +1,38 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [1, 1, 1], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.diamond.222.json b/dpgen/data/jsons/almg.diamond.222.json index b94c24b06..968f7a781 100644 --- a/dpgen/data/jsons/almg.diamond.222.json +++ b/dpgen/data/jsons/almg.diamond.222.json @@ -1,23 +1,38 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.fcc.111.json b/dpgen/data/jsons/almg.fcc.111.json index e6fb8d951..7a81d8f7a 100644 --- a/dpgen/data/jsons/almg.fcc.111.json +++ b/dpgen/data/jsons/almg.fcc.111.json @@ -1,23 +1,38 @@ { - "cell_type": "fcc", - "latt": 4.3, - "super_cell": [1, 1, 1], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.3, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.fcc.222.json b/dpgen/data/jsons/almg.fcc.222.json index dab0caf8f..526296e14 100644 --- a/dpgen/data/jsons/almg.fcc.222.json +++ b/dpgen/data/jsons/almg.fcc.222.json @@ -1,23 +1,38 @@ { - "cell_type": "fcc", - "latt": 4.3, - "super_cell": [2, 2, 2], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.3, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.hcp.111.json b/dpgen/data/jsons/almg.hcp.111.json index 9ef72bd4c..c3e6f959b 100644 --- a/dpgen/data/jsons/almg.hcp.111.json +++ b/dpgen/data/jsons/almg.hcp.111.json @@ -1,23 +1,38 @@ { - "cell_type": "hcp", - "latt": 4.3, - "super_cell": [1, 1, 1], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.3, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.hcp.222.json b/dpgen/data/jsons/almg.hcp.222.json index 1abe49cc5..bd294960e 100644 --- a/dpgen/data/jsons/almg.hcp.222.json +++ b/dpgen/data/jsons/almg.hcp.222.json @@ -1,23 +1,38 @@ { - "cell_type": "hcp", - "latt": 4.3, - "super_cell": [2, 2, 2], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.3, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.hcp.332.json b/dpgen/data/jsons/almg.hcp.332.json index 024c1eb21..a42c819d2 100644 --- a/dpgen/data/jsons/almg.hcp.332.json +++ b/dpgen/data/jsons/almg.hcp.332.json @@ -1,23 +1,38 @@ { - "cell_type": "hcp", - "latt": 4.3, - "super_cell": [3, 3, 2], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.3, + "super_cell": [ + 3, + 3, + 2 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.sc.222.json b/dpgen/data/jsons/almg.sc.222.json index c27f9fd82..f13f31309 100644 --- a/dpgen/data/jsons/almg.sc.222.json +++ b/dpgen/data/jsons/almg.sc.222.json @@ -1,23 +1,38 @@ { - "cell_type": "sc", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "sc", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/almg.sc.333.json b/dpgen/data/jsons/almg.sc.333.json index 31bf2e42c..48434e6e9 100644 --- a/dpgen/data/jsons/almg.sc.333.json +++ b/dpgen/data/jsons/almg.sc.333.json @@ -1,23 +1,38 @@ { - "cell_type": "sc", - "latt": 2.5, - "super_cell": [3, 3, 3], - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "sc", + "latt": 2.5, + "super_cell": [ + 3, + 3, + 3 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.diamond.111.json b/dpgen/data/jsons/mg.diamond.111.json index 27e9cf944..9cf5929cd 100644 --- a/dpgen/data/jsons/mg.diamond.111.json +++ b/dpgen/data/jsons/mg.diamond.111.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 3.3, - "super_cell": [1, 1, 1], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 3.3, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.diamond.222.json b/dpgen/data/jsons/mg.diamond.222.json index 91e371b20..3e57d89fb 100644 --- a/dpgen/data/jsons/mg.diamond.222.json +++ b/dpgen/data/jsons/mg.diamond.222.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 3.3, - "super_cell": [2, 2, 2], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 3.3, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.fcc.111.json b/dpgen/data/jsons/mg.fcc.111.json index aee62759b..4b410025d 100644 --- a/dpgen/data/jsons/mg.fcc.111.json +++ b/dpgen/data/jsons/mg.fcc.111.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.48, - "super_cell": [1, 1, 1], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.48, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.fcc.222.json b/dpgen/data/jsons/mg.fcc.222.json index dd42387a1..1c336433a 100644 --- a/dpgen/data/jsons/mg.fcc.222.json +++ b/dpgen/data/jsons/mg.fcc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.48, - "super_cell": [2, 2, 2], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.48, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.hcp.111.json b/dpgen/data/jsons/mg.hcp.111.json index cc36f847f..de791a650 100644 --- a/dpgen/data/jsons/mg.hcp.111.json +++ b/dpgen/data/jsons/mg.hcp.111.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.48, - "super_cell": [1, 1, 1], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.48, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.hcp.222.json b/dpgen/data/jsons/mg.hcp.222.json index 54b06974a..228085b5e 100644 --- a/dpgen/data/jsons/mg.hcp.222.json +++ b/dpgen/data/jsons/mg.hcp.222.json @@ -1,20 +1,34 @@ { - "cell_type": "hcp", - "latt": 4.48, - "super_cell": [2, 2, 2], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.48, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.hcp.332.json b/dpgen/data/jsons/mg.hcp.332.json index d81ce2bfe..c072c16e3 100644 --- a/dpgen/data/jsons/mg.hcp.332.json +++ b/dpgen/data/jsons/mg.hcp.332.json @@ -1,20 +1,34 @@ { - "cell_type": "hcp", - "latt": 4.48, - "super_cell": [3, 3, 2], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.48, + "super_cell": [ + 3, + 3, + 2 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/mg.sc.222.json b/dpgen/data/jsons/mg.sc.222.json index 137b39104..b05669cc3 100644 --- a/dpgen/data/jsons/mg.sc.222.json +++ b/dpgen/data/jsons/mg.sc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "sc", - "latt": 2.7, - "super_cell": [2, 2, 2], - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "sc", + "latt": 2.7, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/param.json b/dpgen/data/jsons/param.json index 70eb96ea1..5527819e0 100644 --- a/dpgen/data/jsons/param.json +++ b/dpgen/data/jsons/param.json @@ -1,22 +1,40 @@ { - "cell_type": "hcp", - "latt": 4.03, - "super_cell": [2, 1, 1], - "elements": ["Al", "Mg"], - "potcars": ["/gpfs/share/home/1600017784/start/data/POTCAR/Al/POTCAR", - "/gpfs/share/home/1600017784/start/data/POTCAR/Mg/POTCAR" - ], - "encut": 600, - "kspacing": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "relax_incar": "INCAR", - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 20, - "_comment": "that's all", - "stages":[1,2] + "cell_type": "hcp", + "latt": 4.03, + "super_cell": [ + 2, + 1, + 1 + ], + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/gpfs/share/home/1600017784/start/data/POTCAR/Al/POTCAR", + "/gpfs/share/home/1600017784/start/data/POTCAR/Mg/POTCAR" + ], + "encut": 600, + "kspacing": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "relax_incar": "INCAR", + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 20, + "_comment1": "that's all", + "stages": [ + 1, + 2 + ] } diff --git a/dpgen/data/jsons/si.diamond.111.json b/dpgen/data/jsons/si.diamond.111.json index b9c63547c..153435fec 100644 --- a/dpgen/data/jsons/si.diamond.111.json +++ b/dpgen/data/jsons/si.diamond.111.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [1, 1, 1], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.diamond.222.json b/dpgen/data/jsons/si.diamond.222.json index a7dc5a8c6..8d648cad7 100644 --- a/dpgen/data/jsons/si.diamond.222.json +++ b/dpgen/data/jsons/si.diamond.222.json @@ -1,22 +1,36 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.fcc.111.json b/dpgen/data/jsons/si.fcc.111.json index 2f13eda55..a63cbcc37 100644 --- a/dpgen/data/jsons/si.fcc.111.json +++ b/dpgen/data/jsons/si.fcc.111.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.fcc.222.json b/dpgen/data/jsons/si.fcc.222.json index f0c1a620e..4c1a48548 100644 --- a/dpgen/data/jsons/si.fcc.222.json +++ b/dpgen/data/jsons/si.fcc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [2, 2, 2], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.hcp.111.json b/dpgen/data/jsons/si.hcp.111.json index fd65bd6e3..b3a66a6cd 100644 --- a/dpgen/data/jsons/si.hcp.111.json +++ b/dpgen/data/jsons/si.hcp.111.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.hcp.222.json b/dpgen/data/jsons/si.hcp.222.json index b7dcd70d3..a6f7e2157 100644 --- a/dpgen/data/jsons/si.hcp.222.json +++ b/dpgen/data/jsons/si.hcp.222.json @@ -1,22 +1,36 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [2, 2, 2], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/si.sc.222.json b/dpgen/data/jsons/si.sc.222.json index c1d015060..a136c51f8 100644 --- a/dpgen/data/jsons/si.sc.222.json +++ b/dpgen/data/jsons/si.sc.222.json @@ -1,22 +1,36 @@ { - "cell_type": "sc", - "latt": 2.5, - "super_cell": [2, 2, 2], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "sc", + "latt": 2.5, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.al.fcc.json b/dpgen/data/jsons/surf.al.fcc.json index 17787a5bc..30efd029a 100644 --- a/dpgen/data/jsons/surf.al.fcc.json +++ b/dpgen/data/jsons/surf.al.fcc.json @@ -1,26 +1,40 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.al.hcp.json b/dpgen/data/jsons/surf.al.hcp.json index 9bc1971ea..4c28934e7 100644 --- a/dpgen/data/jsons/surf.al.hcp.json +++ b/dpgen/data/jsons/surf.al.hcp.json @@ -1,26 +1,40 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Al"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Al" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.almg.fcc.json b/dpgen/data/jsons/surf.almg.fcc.json index c1cc480cb..cda94f5ae 100644 --- a/dpgen/data/jsons/surf.almg.fcc.json +++ b/dpgen/data/jsons/surf.almg.fcc.json @@ -1,27 +1,42 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.almg.hcp.json b/dpgen/data/jsons/surf.almg.hcp.json index bb83686a5..59fba4af5 100644 --- a/dpgen/data/jsons/surf.almg.hcp.json +++ b/dpgen/data/jsons/surf.almg.hcp.json @@ -1,27 +1,42 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Al", "Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", - "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Al", + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Al/POTCAR", + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.mg.fcc.json b/dpgen/data/jsons/surf.mg.fcc.json index d6353e3e0..43a55b0af 100644 --- a/dpgen/data/jsons/surf.mg.fcc.json +++ b/dpgen/data/jsons/surf.mg.fcc.json @@ -1,26 +1,40 @@ { - "cell_type": "fcc", - "latt": 4.48, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.48, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.mg.hcp.json b/dpgen/data/jsons/surf.mg.hcp.json index b18e8c365..c7c91d2df 100644 --- a/dpgen/data/jsons/surf.mg.hcp.json +++ b/dpgen/data/jsons/surf.mg.hcp.json @@ -1,26 +1,40 @@ { - "cell_type": "hcp", - "latt": 4.48, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "elements": ["Mg"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.48, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "elements": [ + "Mg" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Mg/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/surf.si.diamond.json b/dpgen/data/jsons/surf.si.diamond.json index fc374346d..725a9b90f 100644 --- a/dpgen/data/jsons/surf.si.diamond.json +++ b/dpgen/data/jsons/surf.si.diamond.json @@ -1,28 +1,58 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [1, 1, 1], - "z_min": 12, - "vacuum_max": 9, - "vacuum_resol": 0.2, - "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", - "pymatgen_surf": true, - "millers": [[0,0,1], [1,1,0], [1,1,1]], - "elements": ["Si"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.06, - "kgamma": false, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 1, + 1, + 1 + ], + "z_min": 12, + "vacuum_max": 9, + "vacuum_resol": 0.2, + "lmp_cmd": "/home/wanghan/Soft/lammps/lammps-16Mar18/src/lmp_mpi", + "pymatgen_surf": true, + "millers": [ + [ + 0, + 0, + 1 + ], + [ + 1, + 1, + 0 + ], + [ + 1, + 1, + 1 + ] + ], + "elements": [ + "Si" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/Si/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.06, + "kgamma": false, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/w.bcc.111.json b/dpgen/data/jsons/w.bcc.111.json index 7d18285bd..210514e6c 100644 --- a/dpgen/data/jsons/w.bcc.111.json +++ b/dpgen/data/jsons/w.bcc.111.json @@ -1,24 +1,38 @@ { - "cell_type": "bcc", - "latt": 3.2, - "super_cell": [1, 1, 1], - "elements": ["W"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "ismear": 1, - "sigma": 0.2, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 30, - "pert_box": 0.005, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "bcc", + "latt": 3.2, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "W" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "ismear": 1, + "sigma": 0.2, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 30, + "pert_box": 0.005, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/w.bcc.222.json b/dpgen/data/jsons/w.bcc.222.json index 6a3b223e1..0fa54012e 100644 --- a/dpgen/data/jsons/w.bcc.222.json +++ b/dpgen/data/jsons/w.bcc.222.json @@ -1,24 +1,38 @@ { - "cell_type": "bcc", - "latt": 3.173, - "super_cell": [2, 2, 2], - "elements": ["W"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "ismear": 1, - "sigma": 0.2, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.005, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "bcc", + "latt": 3.173, + "super_cell": [ + 2, + 2, + 2 + ], + "elements": [ + "W" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "ismear": 1, + "sigma": 0.2, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.005, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/w.diamond.111.json b/dpgen/data/jsons/w.diamond.111.json index a0d04fc83..89ce0e8af 100644 --- a/dpgen/data/jsons/w.diamond.111.json +++ b/dpgen/data/jsons/w.diamond.111.json @@ -1,24 +1,38 @@ { - "cell_type": "diamond", - "latt": 2.5, - "super_cell": [1, 1, 1], - "elements": ["W"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "ismear": 1, - "sigma": 0.2, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 30, - "pert_box": 0.005, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "diamond", + "latt": 2.5, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "W" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "ismear": 1, + "sigma": 0.2, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 30, + "pert_box": 0.005, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/w.fcc.111.json b/dpgen/data/jsons/w.fcc.111.json index e94ecaa56..705181620 100644 --- a/dpgen/data/jsons/w.fcc.111.json +++ b/dpgen/data/jsons/w.fcc.111.json @@ -1,24 +1,38 @@ { - "cell_type": "fcc", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["W"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "ismear": 1, - "sigma": 0.2, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 30, - "pert_box": 0.005, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "W" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "ismear": 1, + "sigma": 0.2, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 30, + "pert_box": 0.005, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/w.hcp.111.json b/dpgen/data/jsons/w.hcp.111.json index 033bd13b6..dc8093a63 100644 --- a/dpgen/data/jsons/w.hcp.111.json +++ b/dpgen/data/jsons/w.hcp.111.json @@ -1,24 +1,38 @@ { - "cell_type": "hcp", - "latt": 4.04, - "super_cell": [1, 1, 1], - "elements": ["W"], - "potcars": ["/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" - ], - "encut": 600, - "kspacing_relax": 0.16, - "kspacing_md": 0.08, - "kgamma": false, - "ismear": 1, - "sigma": 0.2, - "scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06], - "skip_relax": false, - "pert_numb": 30, - "pert_box": 0.005, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "cell_type": "hcp", + "latt": 4.04, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "W" + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.unknown/potpaw_PBE/W/POTCAR" + ], + "encut": 600, + "kspacing_relax": 0.16, + "kspacing_md": 0.08, + "kgamma": false, + "ismear": 1, + "sigma": 0.2, + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 30, + "pert_box": 0.005, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/dpgen/data/jsons/water.111.json b/dpgen/data/jsons/water.111.json index 4f5733a90..6cd01b135 100644 --- a/dpgen/data/jsons/water.111.json +++ b/dpgen/data/jsons/water.111.json @@ -1,29 +1,37 @@ { - "_comment": "init poscars form a crystal structure", - "cell_type": "diamond", - "latt": 2.5, - "elements": ["Si"], - "_comment": "if set from poscar, the options above will be ignored", - "from_poscar": true, - "from_poscar_path": "ice6.POSCAR", - - "_comment": "", - "super_cell": [1, 1, 1], - "potcars": [ "/home/wanghan/Soft/vasp/potcar.52/potpaw_PBE.52/O/POTCAR", - "/home/wanghan/Soft/vasp/potcar.52/potpaw_PBE.52/H/POTCAR" - ], - "encut": 900, - "kspacing_relax": 0.75, - "kspacing_md": 0.75, - "kgamma": false, - "scale": [1.0], - "skip_relax": true, - "pert_numb": 100, - "pert_box": 0.03, - "pert_atom": 0.01, - "md_temp": 100, - "md_nstep": 10, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "_comment1": "init poscars form a crystal structure", + "cell_type": "diamond", + "latt": 2.5, + "elements": [ + "Si" + ], + "_comment2": "if set from poscar, the options above will be ignored", + "from_poscar": true, + "from_poscar_path": "ice6.POSCAR", + "_comment3": "", + "super_cell": [ + 1, + 1, + 1 + ], + "potcars": [ + "/home/wanghan/Soft/vasp/potcar.52/potpaw_PBE.52/O/POTCAR", + "/home/wanghan/Soft/vasp/potcar.52/potpaw_PBE.52/H/POTCAR" + ], + "encut": 900, + "kspacing_relax": 0.75, + "kspacing_md": 0.75, + "kgamma": false, + "scale": [ + 1.0 + ], + "skip_relax": true, + "pert_numb": 100, + "pert_box": 0.03, + "pert_atom": 0.01, + "md_temp": 100, + "md_nstep": 10, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment4": "that's all" } diff --git a/examples/CH4-refact-dpdispatcher/INCAR_methane b/examples/CH4-refact-dpdispatcher/INCAR_methane index b946fb7e5..4d1d7d039 120000 --- a/examples/CH4-refact-dpdispatcher/INCAR_methane +++ b/examples/CH4-refact-dpdispatcher/INCAR_methane @@ -1 +1 @@ -../run/dp1.x-lammps-vasp/CH4/INCAR_methane \ No newline at end of file +../run/dp2.x-lammps-vasp/CH4/INCAR_methane \ No newline at end of file diff --git a/examples/CH4-refact-dpdispatcher/machine-ali-ehpc.json b/examples/CH4-refact-dpdispatcher/machine-ali-ehpc.json index 40bf56abe..372545587 100644 --- a/examples/CH4-refact-dpdispatcher/machine-ali-ehpc.json +++ b/examples/CH4-refact-dpdispatcher/machine-ali-ehpc.json @@ -1,83 +1,92 @@ { - "api_version": "1.0", - "train": - { - "command": "dp", - "machine": { - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/fengbo/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "fengbo" + "api_version": "1.0", + "train": { + "command": "dp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/fengbo/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "fengbo" + } + }, + "resources": { + "batch_type": "PBS", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 1, + "custom_flags": [ + "#SBATCH --mem=32G" + ], + "strategy": { + "if_cuda_multi_devices": true + }, + "para_deg": 3, + "source_list": [ + "/home/fengbo/deepmd.1.2.4.env" + ] } - }, - "resources": { - "batch_type": "PBS", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 1, - "custom_flags":["#SBATCH --mem=32G"], - "strategy": {"if_cuda_multi_devices": true}, - "para_deg": 3, - "source_list": ["/home/fengbo/deepmd.1.2.4.env"] - } }, - "model_devi": - { - "command": "lmp", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/fengbo/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "fengbo" - } - }, - "resources": { - "batch_type": "PBS", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 5, - "source_list": ["/home/fengbo/deepmd.1.2.4.env"] - }, - "_comments" : "In user_forward_files, define input files to be uploaded.", - "user_forward_files" : [], - "_comments" : "In user_backward_files, define output files to be collected.", - "user_backward_files" : ["HILLS"] + "model_devi": { + "command": "lmp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/fengbo/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "fengbo" + } + }, + "resources": { + "batch_type": "PBS", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 5, + "source_list": [ + "/home/fengbo/deepmd.1.2.4.env" + ] + }, + "_comments": "In user_backward_files, define output files to be collected.", + "user_forward_files": [], + "user_backward_files": [ + "HILLS" + ] }, - "fp": - { - "command": "vasp_std", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/fengbo/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "fengbo" - } - }, - "resources": { - "batch_type": "PBS", - "number_node": 1, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "G_32_128", - "group_size": 1, - "source_list": ["~/vasp.env"] - }, - "_comments" : "In user_forward_files, define input files to be uploaded.", - "user_forward_files" : ["vdw_kernel.bindat"], - "_comments" : "In user_backward_files, define output files to be collected.", - "user_backward_files" : [] + "fp": { + "command": "vasp_std", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/fengbo/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "fengbo" + } + }, + "resources": { + "batch_type": "PBS", + "number_node": 1, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "G_32_128", + "group_size": 1, + "source_list": [ + "~/vasp.env" + ] + }, + "_comments": "In user_backward_files, define output files to be collected.", + "user_forward_files": [ + "vdw_kernel.bindat" + ], + "user_backward_files": [] } } diff --git a/examples/CH4-refact-dpdispatcher/machine-dpcloudserver.json b/examples/CH4-refact-dpdispatcher/machine-dpcloudserver.json index b13293fe1..d3a1c9db1 100644 --- a/examples/CH4-refact-dpdispatcher/machine-dpcloudserver.json +++ b/examples/CH4-refact-dpdispatcher/machine-dpcloudserver.json @@ -1,131 +1,128 @@ { - "api_version": "1.0", - "train" : - { - "command": "dp", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "yfb222333", - "password": "", - "program_id": 0, - "input_data":{ - "job_type": "indicate", - "log_file": "dp_cloud_server.log", - "command": null, - "backward_files": [], - "job_name": "dpgen_20210630_job", - "machine": { - "platform": "ali", - "resources": { - "gpu_type": "1 * NVIDIA P100", - "cpu_num": 4, - "mem_limit": 30, - "disk_size": 100, - "region": "cn-beijing", - "time_limit": "2:00:00", - "image_name": "yfb-deepmd-kit-1.2.4-cuda10" + "api_version": "1.0", + "train": { + "command": "dp", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "yfb222333", + "password": "", + "program_id": 0, + "input_data": { + "job_type": "indicate", + "log_file": "dp_cloud_server.log", + "command": null, + "backward_files": [], + "job_name": "dpgen_20210630_job", + "machine": { + "platform": "ali", + "resources": { + "gpu_type": "1 * NVIDIA P100", + "cpu_num": 4, + "mem_limit": 30, + "disk_size": 100, + "region": "cn-beijing", + "time_limit": "2:00:00", + "image_name": "yfb-deepmd-kit-1.2.4-cuda10" } }, - "job_resources": null + "job_resources": null + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "GPU", + "group_size": 1 } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "GPU", - "group_size": 1 - } }, - "model_devi": - { - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "yfb222333", - "password": "", - "program_id": 0, - "input_data":{ - "job_type": "indicate", - "log_file": "dp_cloud_server.log", - "command": null, - "backward_files": [], - "job_name": "dpgen_20210630_job", - "machine": { - "platform": "ali", - "resources": { - "gpu_type": "1 * NVIDIA P100", - "cpu_num": 4, - "mem_limit": 30, - "disk_size": 100, - "region": "cn-beijing", - "time_limit": "2:00:00", - "image_name": "yfb-deepmd-kit-1.2.4-cuda10" + "model_devi": { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "yfb222333", + "password": "", + "program_id": 0, + "input_data": { + "job_type": "indicate", + "log_file": "dp_cloud_server.log", + "command": null, + "backward_files": [], + "job_name": "dpgen_20210630_job", + "machine": { + "platform": "ali", + "resources": { + "gpu_type": "1 * NVIDIA P100", + "cpu_num": 4, + "mem_limit": 30, + "disk_size": 100, + "region": "cn-beijing", + "time_limit": "2:00:00", + "image_name": "yfb-deepmd-kit-1.2.4-cuda10" } }, - "job_resources": null + "job_resources": null + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "GPU", + "group_size": 5 } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "GPU", - "group_size": 5 - } }, - "fp": - { - "command": "mpirun -n 16 vasp_std", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "yfb222333", - "password": "", - "program_id": 0, - "input_data":{ - "job_type": "indicate", - "log_file": "dp_cloud_server.log", - "command": null, - "backward_files": [], - "job_name": "dpgen_20210630_job", - "machine": { - "platform": "ali", - "resources": { - "cpu_num": 32, - "mem_limit": 64, - "disk_size": 200, - "region": "cn-beijing", - "time_limit": "2:00:00", - "image_name": "deepmd-vasp-cloudserver-v8" + "fp": { + "command": "mpirun -n 16 vasp_std", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "yfb222333", + "password": "", + "program_id": 0, + "input_data": { + "job_type": "indicate", + "log_file": "dp_cloud_server.log", + "command": null, + "backward_files": [], + "job_name": "dpgen_20210630_job", + "machine": { + "platform": "ali", + "resources": { + "cpu_num": 32, + "mem_limit": 64, + "disk_size": 200, + "region": "cn-beijing", + "time_limit": "2:00:00", + "image_name": "deepmd-vasp-cloudserver-v8" } }, - "job_resources": null + "job_resources": null + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "CPU", + "group_size": 5, + "source_list": [ + "/opt/intel/oneapi/setvars.sh" + ] } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "CPU", - "group_size": 5, - "source_list": [ - "/opt/intel/oneapi/setvars.sh" - ] - } } } diff --git a/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-1.1.0.json b/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-1.1.0.json deleted file mode 120000 index 2916f7885..000000000 --- a/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-1.1.0.json +++ /dev/null @@ -1 +0,0 @@ -../run/dp1.x-lammps-vasp/CH4/param_CH4_deepmd-kit-1.1.0.json \ No newline at end of file diff --git a/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-2.x.json b/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-2.x.json new file mode 120000 index 000000000..3f11d42a7 --- /dev/null +++ b/examples/CH4-refact-dpdispatcher/param_CH4_deepmd-kit-2.x.json @@ -0,0 +1 @@ +../run/dp2.x-lammps-vasp/CH4/param_CH4_deepmd-kit-2.x.json \ No newline at end of file diff --git a/examples/database/param_Ti.json b/examples/database/param_Ti.json index be78af113..ed2e6b556 100644 --- a/examples/database/param_Ti.json +++ b/examples/database/param_Ti.json @@ -1,19 +1,100 @@ { - "path" : "/path/to/Ti", - "calculator" : "vasp", - "_comment" : "Current only support VASP", - "output" : "./db_Ti.json", - "id_prefix" : "", - "config_info_dict" : { - "fcc-bulk" : [0,1,2,3,4,5,6,7], - "hcp-bulk" : [8,9,10,11,12,13,14,15], - "bcc-bulk" : [16,17,18,19,20,21,22,23], - "fcc-surf-100" : [24,25,26,27,28,29,30,31], - "fcc-surf-111" : [32,33,34,35,36,37,38,39], - "fcc-surf-110" : [40,41,42,43,44,45,46,47], - "hcp-surf-001" : [48,49,50,51,52,53,54,55], - "hcp-surf-100" : [56,57,58,59,60,61,62,63], - "hcp-surf-110" : [64,65,66,67,68,69,70,71] - }, - "skip_init" : true + "path": "/path/to/Ti", + "calculator": "vasp", + "_comment1": "Current only support VASP", + "output": "./db_Ti.json", + "id_prefix": "", + "config_info_dict": { + "fcc-bulk": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "hcp-bulk": [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ], + "bcc-bulk": [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "fcc-surf-100": [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 + ], + "fcc-surf-111": [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39 + ], + "fcc-surf-110": [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47 + ], + "hcp-surf-001": [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55 + ], + "hcp-surf-100": [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63 + ], + "hcp-surf-110": [ + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71 + ] + }, + "skip_init": true } diff --git a/examples/init/abacus/CuW/CuW.json b/examples/init/abacus/CuW/CuW.json index 9abd406ce..0703bfb21 100644 --- a/examples/init/abacus/CuW/CuW.json +++ b/examples/init/abacus/CuW/CuW.json @@ -1,6 +1,11 @@ { - "init_fp_style": "ABACUS", - "stages": [1, 2, 3, 4], + "init_fp_style": "ABACUS", + "stages": [ + 1, + 2, + 3, + 4 + ], "cell_type": "fcc", "latt": 3.76, "super_cell": [ @@ -9,14 +14,18 @@ 1 ], "elements": [ - "Cu", "W" + "Cu", + "W" + ], + "atom_masses": [ + 63.55, + 183.8 ], - "atom_masses": [63.55, 183.8], "potcars": [ "Cu_ONCV_PBE-1.0.upf", - "W_ONCV_PBE-1.0.upf" + "W_ONCV_PBE-1.0.upf" ], - "orb_files":[ + "orb_files": [ "Cu_gga_9au_60Ry_4s2p2d1f.orb", "W_gga_10au_60Ry_4s2p2d2f.orb" ], @@ -24,8 +33,8 @@ "relax_kpt": "KPT", "md_kpt": "KPT", "md_incar": "INPUT.md", - "dpks_descriptor": "jle.orb", - "dpks_model": "model.ptg", + "dpks_descriptor": "jle.orb", + "dpks_model": "model.ptg", "scale": [ 0.99 ], @@ -39,5 +48,5 @@ "Cu", "W" ], - "_comment": "that's all" + "_comment1": "that's all" } diff --git a/examples/init/abacus/fcc-Al-lcao/init.json b/examples/init/abacus/fcc-Al-lcao/init.json index fccb79da7..1095fa54b 100644 --- a/examples/init/abacus/fcc-Al-lcao/init.json +++ b/examples/init/abacus/fcc-Al-lcao/init.json @@ -1,24 +1,41 @@ { - "init_fp_style": "ABACUS", - "stages": [1,2,3,4], - "cell_type": "diamond", - "super_cell": [2, 1, 1], - "elements": ["Al"], - "from_poscar": true, - "from_poscar_path": "./Al.STRU", - "potcars": ["Al_ONCV_PBE-1.0.upf"], - "orb_files": ["Al_gga_9au_100Ry_4s4p1d.orb"], - "relax_incar": "./INPUT.rlx", - "md_incar" : "./INPUT.md", - "relax_kpt": "./KPT.rlx", - "md_kpt": "./KPT.md", - "md_nstep": 3, - "scale": [1.00], - "skip_relax": false, - "pert_numb": 2, - "pert_box": 0.03, - "pert_atom": 0.01, - "deepgen_templ": "../generator/template/", - "coll_ndata": 5000, - "_comment": "that's all" + "init_fp_style": "ABACUS", + "stages": [ + 1, + 2, + 3, + 4 + ], + "cell_type": "diamond", + "super_cell": [ + 2, + 1, + 1 + ], + "elements": [ + "Al" + ], + "from_poscar": true, + "from_poscar_path": "./Al.STRU", + "potcars": [ + "Al_ONCV_PBE-1.0.upf" + ], + "orb_files": [ + "Al_gga_9au_100Ry_4s4p1d.orb" + ], + "relax_incar": "./INPUT.rlx", + "md_incar": "./INPUT.md", + "relax_kpt": "./KPT.rlx", + "md_kpt": "./KPT.md", + "md_nstep": 3, + "scale": [ + 1.0 + ], + "skip_relax": false, + "pert_numb": 2, + "pert_box": 0.03, + "pert_atom": 0.01, + "deepgen_templ": "../generator/template/", + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/examples/init/abacus/fcc-Al-lcao/machine.json b/examples/init/abacus/fcc-Al-lcao/machine.json index ba74f0297..1a35c7107 100644 --- a/examples/init/abacus/fcc-Al-lcao/machine.json +++ b/examples/init/abacus/fcc-Al-lcao/machine.json @@ -1,106 +1,111 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" :[ - { - "command": "dp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 200, - "scass_type":"", - "checkpoint_files":["00*/checkpoint","00*/model.ckpt*"], - "checkpoint_time":30, - "platform": "", - "region":"", - "image_name":"", - "on_demand":0, - "job_type":"" + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": [ + { + "command": "dp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 200, + "scass_type": "", + "checkpoint_files": [ + "00*/checkpoint", + "00*/model.ckpt*" + ], + "checkpoint_time": 30, + "platform": "", + "region": "", + "image_name": "", + "on_demand": 0 + } + } + }, + "resources": { + "local_root": "./", + "group_size": 1 } } - }, - "resources": { - "local_root":"./", - "group_size": 1 - } - }], - "model_devi": - [{ - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"", - "platform": "", - "region":"", - "image_name":"", - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "on_demand":0, - "job_type":"" + ], + "model_devi": [ + { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "", + "platform": "", + "region": "", + "image_name": "", + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "on_demand": 0 + } + } + }, + "resources": { + "local_root": "./", + "group_size": 50 } } - }, - "resources": { - "local_root":"./", - "group_size": 50 - } - }], - "fp": - [{ - "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "scass_type":"", - "platform": "", - "image_name":"", - "on_demand":0 + ], + "fp": [ + { + "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "scass_type": "", + "platform": "", + "image_name": "", + "on_demand": 0 + } + } + }, + "resources": { + "group_size": 50, + "local_root": "./", + "source_list": [ + "" + ] } } - }, - "resources": { - "group_size": 50, - "local_root":"./", - "source_list": [""] - } - } - ] + ] } diff --git a/examples/init/abacus/fcc-Al-pw/init.json b/examples/init/abacus/fcc-Al-pw/init.json index 0874040e4..d90cef3bd 100644 --- a/examples/init/abacus/fcc-Al-pw/init.json +++ b/examples/init/abacus/fcc-Al-pw/init.json @@ -1,23 +1,38 @@ { "init_fp_style": "ABACUS", - "stages": [1,2,3,4], - "cell_type": "fcc", - "super_cell": [2, 1, 1], - "elements": ["Al"], - "from_poscar": true, - "from_poscar_path": "./Al.STRU", - "potcars": ["Al_ONCV_PBE-1.0.upf"], - "relax_incar": "INPUT.rlx", - "relax_kpt": "KPT", - "md_incar" : "INPUT.md", - "md_kpt" : "KPT", - "skip_relax": false, - "scale": [1.00], - "pert_numb": 10, - "md_nstep" : 10, - "pert_box": 0.01, - "pert_atom": 0.01, - "deepgen_templ": "../generator/template/", - "coll_ndata": 10, - "_comment": "that's all" + "stages": [ + 1, + 2, + 3, + 4 + ], + "cell_type": "fcc", + "super_cell": [ + 2, + 1, + 1 + ], + "elements": [ + "Al" + ], + "from_poscar": true, + "from_poscar_path": "./Al.STRU", + "potcars": [ + "Al_ONCV_PBE-1.0.upf" + ], + "relax_incar": "INPUT.rlx", + "relax_kpt": "KPT", + "md_incar": "INPUT.md", + "md_kpt": "KPT", + "skip_relax": false, + "scale": [ + 1.0 + ], + "pert_numb": 10, + "md_nstep": 10, + "pert_box": 0.01, + "pert_atom": 0.01, + "deepgen_templ": "../generator/template/", + "coll_ndata": 10, + "_comment1": "that's all" } diff --git a/examples/init/abacus/fcc-Al-pw/machine.json b/examples/init/abacus/fcc-Al-pw/machine.json index ba74f0297..1a35c7107 100644 --- a/examples/init/abacus/fcc-Al-pw/machine.json +++ b/examples/init/abacus/fcc-Al-pw/machine.json @@ -1,106 +1,111 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" :[ - { - "command": "dp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 200, - "scass_type":"", - "checkpoint_files":["00*/checkpoint","00*/model.ckpt*"], - "checkpoint_time":30, - "platform": "", - "region":"", - "image_name":"", - "on_demand":0, - "job_type":"" + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": [ + { + "command": "dp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 200, + "scass_type": "", + "checkpoint_files": [ + "00*/checkpoint", + "00*/model.ckpt*" + ], + "checkpoint_time": 30, + "platform": "", + "region": "", + "image_name": "", + "on_demand": 0 + } + } + }, + "resources": { + "local_root": "./", + "group_size": 1 } } - }, - "resources": { - "local_root":"./", - "group_size": 1 - } - }], - "model_devi": - [{ - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"", - "platform": "", - "region":"", - "image_name":"", - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "on_demand":0, - "job_type":"" + ], + "model_devi": [ + { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "", + "platform": "", + "region": "", + "image_name": "", + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "on_demand": 0 + } + } + }, + "resources": { + "local_root": "./", + "group_size": 50 } } - }, - "resources": { - "local_root":"./", - "group_size": 50 - } - }], - "fp": - [{ - "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": , - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "scass_type":"", - "platform": "", - "image_name":"", - "on_demand":0 + ], + "fp": [ + { + "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "scass_type": "", + "platform": "", + "image_name": "", + "on_demand": 0 + } + } + }, + "resources": { + "group_size": 50, + "local_root": "./", + "source_list": [ + "" + ] } } - }, - "resources": { - "group_size": 50, - "local_root":"./", - "source_list": [""] - } - } - ] + ] } diff --git a/examples/init/al.json b/examples/init/al.json index 41e365cad..6f1fbb2ab 100644 --- a/examples/init/al.json +++ b/examples/init/al.json @@ -28,5 +28,5 @@ "Mg", "Al" ], - "_comment": "that's all" + "_comment1": "that's all" } diff --git a/examples/init/ch4.json b/examples/init/ch4.json index 3902c24da..622b74b5f 100644 --- a/examples/init/ch4.json +++ b/examples/init/ch4.json @@ -1,19 +1,36 @@ { - "stages": [1,2,3,4], - "cell_type": "diamond", - "super_cell": [1, 1, 1], - "elements": ["H","C"], - "from_poscar": true, - "from_poscar_path": "./CH4.POSCAR", - "potcars": ["./POTCAR_H", "./POTCAR_C"], - "relax_incar": "./INCAR_methane.rlx", - "md_incar" : "./INCAR_methane.md", - "scale": [1.00], - "skip_relax": false, - "pert_numb": 30, - "md_nstep" : 10, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 5000, - "_comment": "that's all" + "stages": [ + 1, + 2, + 3, + 4 + ], + "cell_type": "diamond", + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "H", + "C" + ], + "from_poscar": true, + "from_poscar_path": "./CH4.POSCAR", + "potcars": [ + "./POTCAR_H", + "./POTCAR_C" + ], + "relax_incar": "./INCAR_methane.rlx", + "md_incar": "./INCAR_methane.md", + "scale": [ + 1.0 + ], + "skip_relax": false, + "pert_numb": 30, + "md_nstep": 10, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/examples/init/cu.surf.hcp.111.json b/examples/init/cu.surf.hcp.111.json index 00816e09d..7ed24507f 100644 --- a/examples/init/cu.surf.hcp.111.json +++ b/examples/init/cu.surf.hcp.111.json @@ -1,56 +1,59 @@ { - "_comments": "This is an example to generate Cu-hcp surface configurations.", - "_comments": "This example is used in Computer Physics Communications, 2020, 107206.", - "_comments" : "Last modified on 2019.8.27 by Yuzhi Zhang.", - "stages": [ - 1, - 2 - ], - "cell_type": "hcp", - "latt": 3.63, - "super_cell": [ - 1, - 1, - 1 - ], - "z_min": 10, - "vacuum_max": 10, - "vacuum_resol": [ - 0.5, - 1 - ], - "mid_point": 4.0, - "millers": [ - [ - 1, - 0, - 0 + "_comments": "Last modified on 2019.8.27 by Yuzhi Zhang.", + "stages": [ + 1, + 2 ], - [ - 1, - 1, - 0 + "cell_type": "hcp", + "latt": 3.63, + "super_cell": [ + 1, + 1, + 1 ], - [ - 0, - 0, - 1 - ] - ], - "elements": [ - "Cu" - ], - "potcars": [ - "PATH/POTCAR" - ], - "relax_incar" : "PATH/INCAR_surf_rlx", - "scale": [ - 0.96,0.98, 1.0,1.02, 1.04, 1.06 - ], - "skip_relax": false, - "pert_numb": 20, - "pert_box": 0.03, - "pert_atom": 0.01, - "lmp_cmd" : "PATH/lmp_serial", - "_comment": "that's all" + "z_min": 10, + "vacuum_max": 10, + "vacuum_resol": [ + 0.5, + 1 + ], + "mid_point": 4.0, + "millers": [ + [ + 1, + 0, + 0 + ], + [ + 1, + 1, + 0 + ], + [ + 0, + 0, + 1 + ] + ], + "elements": [ + "Cu" + ], + "potcars": [ + "PATH/POTCAR" + ], + "relax_incar": "PATH/INCAR_surf_rlx", + "scale": [ + 0.96, + 0.98, + 1.0, + 1.02, + 1.04, + 1.06 + ], + "skip_relax": false, + "pert_numb": 20, + "pert_box": 0.03, + "pert_atom": 0.01, + "lmp_cmd": "PATH/lmp_serial", + "_comment1": "that's all" } diff --git a/examples/init/surf.json b/examples/init/surf.json index 902fc8d0b..08ec0f05a 100644 --- a/examples/init/surf.json +++ b/examples/init/surf.json @@ -1,56 +1,56 @@ { - "stages": [ - 1, - 2 - ], - "cell_type": "fcc", - "latt": 4.1, - "super_cell": [ - 1, - 1, - 1 - ], - "z_min": 9, - "vacuum_max": 9.0, - "vacuum_resol": [ - 0.5, - 1 - ], - "mid_point": 4.0, - "head_ratio": 0.6, - "vacuum_numb": 20, - "millers": [ - [ - 1, - 0, - 0 + "stages": [ + 1, + 2 ], - [ - 1, - 1, - 0 + "cell_type": "fcc", + "latt": 4.1, + "super_cell": [ + 1, + 1, + 1 ], - [ - 1, - 1, - 1 - ] - ], - "elements": [ - "Al" - ], - "potcars": [ - "./POTCAR" - ], - "relax_incar" : "INCAR_metal_rlx_low", - "scale": [ - 0.98, - 1.0 - ], - "skip_relax": true, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 5000, - "_comment": "that's all" + "z_min": 9, + "vacuum_max": 9.0, + "vacuum_resol": [ + 0.5, + 1 + ], + "mid_point": 4.0, + "head_ratio": 0.6, + "vacuum_numb": 20, + "millers": [ + [ + 1, + 0, + 0 + ], + [ + 1, + 1, + 0 + ], + [ + 1, + 1, + 1 + ] + ], + "elements": [ + "Al" + ], + "potcars": [ + "./POTCAR" + ], + "relax_incar": "INCAR_metal_rlx_low", + "scale": [ + 0.98, + 1.0 + ], + "skip_relax": true, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/examples/machine/DeePMD-kit-1.0/machine-local-4GPU.json b/examples/machine/DeePMD-kit-1.0/machine-local-4GPU.json index e0e6bfca0..854ee01ba 100644 --- a/examples/machine/DeePMD-kit-1.0/machine-local-4GPU.json +++ b/examples/machine/DeePMD-kit-1.0/machine-local-4GPU.json @@ -1,12 +1,12 @@ { - "_comment" : "This is an example of DP-GEN on Local device running with 4 GPUs", - "_comment": "Last updated on 2021.5.9 for DP-GEN 0.9.2 by Ke XU", + "_comment1": "This is an example of DP-GEN on Local device running with 4 GPUs", + "_comment2": "Last updated on 2021.5.9 for DP-GEN 0.9.2 by Ke XU", "train": { - "_comment" : "Specify the installed path of DeePMD-kit", + "_comment3": "Specify the installed path of DeePMD-kit", "command": "/home/user/anaconda3/bin/dp", - "_comment" : "Specify machine settings", + "_comment4": "Specify machine settings", "machine": { - "_comment": "Supported batches include slurm, pbs, shell, lsf.", + "_comment5": "Supported batches include slurm, pbs, shell, lsf.", "batch_type": "shell", "context_type": "local", "remote_root": "/tmp/dpwork", @@ -14,22 +14,22 @@ }, "resources": { "module_list": [], - "_comment": "Environment to be activated. This will generate source xxx/psxevars.sh in scripts. ", + "_comment6": "Environment to be activated. This will generate source xxx/psxevars.sh in scripts. ", "source_list": [ "/opt/intel/parallel_studio_xe_2020/psxevars.sh" ], "batch_type": "shell", - "_comment": "DP-GEN will put 4 tasks together in one submitting script.", + "_comment7": "DP-GEN will put 4 tasks together in one submitting script.", "group_size": 4, - "_comment" : "The number of nodes.", + "_comment8": "The number of nodes.", "number_node": 1, - "_comment" : "The number of CPUs.", + "_comment9": "The number of CPUs.", "cpu_per_node": 4, - "_comment" : "If you choose to run with multiple GPUs simultaneously, just ignore numb_gpu.", + "_comment10": "If you choose to run with multiple GPUs simultaneously, just ignore numb_gpu.", "gpu_per_node": 0, "kwargs": {}, "strategy": { - "_comment" : "Allow the multi-GPU task running.", + "_comment11": "Allow the multi-GPU task running.", "if_cuda_multi_devices": true }, "para_deg": 4, @@ -68,11 +68,11 @@ "local_root": "./" }, "resources": { - "_comment" : "Load the intel compiler.", + "_comment12": "Load the intel compiler.", "source_list": [ "/opt/intel/parallel_studio_xe_2020/psxevars.sh" ], - "_comment": "This will generate export PATH=/home/user/Soft/VASP/vasp.5.4.4-allbak/bin:$PATH in scripts;", + "_comment13": "This will generate export PATH=/home/user/Soft/VASP/vasp.5.4.4-allbak/bin:$PATH in scripts;", "envs": { "PATH": "/home/user/Soft/VASP/vasp.5.4.4-allbak/bin:$PATH" }, diff --git a/examples/machine/DeePMD-kit-1.x/machine-local.json b/examples/machine/DeePMD-kit-1.x/machine-local.json index 2eb999743..eaac4cb5d 100644 --- a/examples/machine/DeePMD-kit-1.x/machine-local.json +++ b/examples/machine/DeePMD-kit-1.x/machine-local.json @@ -1,7 +1,7 @@ { "api_version": "1.0", "train": { - "_comment": "training on localhost", + "_comment1": "training on localhost", "machine": { "batch_type": "shell", "context_type": "local", @@ -21,9 +21,9 @@ "command": "/home/wanghan/local/deepmd/1.*/dp" }, "model_devi": { - "_comment": "model devi on localhost", + "_comment2": "model devi on localhost", "machine": { - "_comment": "If lazy_local, calculations are done directly in current folders.", + "_comment3": "If lazy_local, calculations are done directly in current folders.", "batch_type": "shell", "context_type": "lazylocal", "local_root": "./" @@ -40,7 +40,7 @@ "command": "/home/wanghan/local/bin/lmp_mpi_010" }, "fp": { - "_comment": "fp on localhost", + "_comment4": "fp on localhost", "machine": { "batch_type": "shell", "context_type": "local", @@ -51,7 +51,7 @@ "module_list": [ "mpi" ], - "_comment": "that's all", + "_comment5": "that's all", "batch_type": "shell", "group_size": 2, "cpu_per_node": 4, diff --git a/examples/machine/DeePMD-kit-1.x/machine-slurm-qe.json b/examples/machine/DeePMD-kit-1.x/machine-slurm-qe.json index 6f96d397d..40ed09746 100644 --- a/examples/machine/DeePMD-kit-1.x/machine-slurm-qe.json +++ b/examples/machine/DeePMD-kit-1.x/machine-slurm-qe.json @@ -1,39 +1,39 @@ { - "_comment": "Last updated on 2021.4.30 for DP-GEN 0.9.2 by Yuzhi Zhang", + "_comment1": "Last updated on 2021.4.30 for DP-GEN 0.9.2 by Yuzhi Zhang", "train": { - "_comment" : "Specify the installed path of DeePMD-kit", + "_comment2": "Specify the installed path of DeePMD-kit", "command": "PATH_TO_DEEPMD/dp", - "_comment" : "Specify machine settings", + "_comment3": "Specify machine settings", "machine": { "batch_type": "slurm", "context_type": "ssh", "remote_profile": { "hostname": "localhost", - "_comment" : "The port for connection, most common settings is 22", + "_comment4": "The port for connection, most common settings is 22", "port": 22, - "_comment" : "Specify your username.", + "_comment5": "Specify your username.", "username": "USERNAME" }, - "_comment" : "You should alwasy make sure that directory of work_path exits. ", + "_comment6": "You should alwasy make sure that directory of work_path exits. ", "remote_root": "PATH_TO_WORK", "local_root": "./" }, "resources": { - "_comment" : "Environment to be activated. This will generate source PATH/train_new.env . ", + "_comment7": "Environment to be activated. This will generate source PATH/train_new.env . ", "source_list": [ "PATH/train_new.env" ], - "_comment" : " Module is a common tools on HPC clustes to manage softwares for multiple users.", - "_comment" : "Modules to be loaded. This will generate module load intel", + "_comment8": " Module is a common tools on HPC clustes to manage softwares for multiple users.", + "_comment9": "Modules to be loaded. This will generate module load intel", "module_list": [ "intel" ], "batch_type": "slurm", - "_comment" : "The number of nodes. This will generate #SBATCH -N 1 in your script. ", + "_comment10": "The number of nodes. This will generate #SBATCH -N 1 in your script. ", "number_node": 1, - "_comment" : "The number of CPUs. #SBATCH -n 4", + "_comment11": "The number of CPUs. #SBATCH -n 4", "cpu_per_node": 4, - "_comment" : "The number of GPU cards. #SBATCH --gres=gpu:1", + "_comment12": "The number of GPU cards. #SBATCH --gres=gpu:1", "gpu_per_node": 1, "queue_name": "all", "custom_flags": [ @@ -63,7 +63,7 @@ ], "module_list": [], "batch_type": "slurm", - "_comment": "DP-GEN will put 5 tasks together in one submitting script.", + "_comment13": "DP-GEN will put 5 tasks together in one submitting script.", "group_size": 5, "number_node": 1, "cpu_per_node": 4, diff --git a/examples/machine/DeePMD-kit-2.x/lebesgue_v2_machine.json b/examples/machine/DeePMD-kit-2.x/lebesgue_v2_machine.json index ae6ac31ab..8fdd1db35 100644 --- a/examples/machine/DeePMD-kit-2.x/lebesgue_v2_machine.json +++ b/examples/machine/DeePMD-kit-2.x/lebesgue_v2_machine.json @@ -1,107 +1,106 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" : - { - "command": "dp", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "your lebesgue register email", - "password": "your lebesgue password", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 100, - "scass_type":"c8_m60_1 * NVIDIA P100", - "platform": "ali", - "image_name":"deepmd-kit:2.0.1", - "on_demand":0 + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": { + "command": "dp", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "your lebesgue register email", + "password": "your lebesgue password", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 100, + "scass_type": "c8_m60_1 * NVIDIA P100", + "platform": "ali", + "image_name": "deepmd-kit:2.0.1", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "GPU", + "group_size": 1 } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "GPU", - "group_size": 1 - } }, - "model_devi": - { - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "your lebesgue register email", - "password": "your lebesgue password", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"c8_m60_1 * NVIDIA P100", - "platform": "ali", - "image_name":"deepmd-kit:2.0.1", - "on_demand":0 + "model_devi": { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "your lebesgue register email", + "password": "your lebesgue password", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "c8_m60_1 * NVIDIA P100", + "platform": "ali", + "image_name": "deepmd-kit:2.0.1", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "GPU", + "group_size": 5 } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "GPU", - "group_size": 5 - } }, - "fp": - { - "command": "mpirun -n 16 vasp_std", - "machine": { - "batch_type": "DpCloudServer", - "context_type": "DpCloudServerContext", - "local_root" : "./", - "remote_profile":{ - "email": "your lebesgue register email", - "password": "your lebesgue password", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "scass_type":"c8_m8_cpu", - "platform": "ali", - "image_name":"vasp:5.4.4", - "on_demand":0 + "fp": { + "command": "mpirun -n 16 vasp_std", + "machine": { + "batch_type": "DpCloudServer", + "context_type": "DpCloudServerContext", + "local_root": "./", + "remote_profile": { + "email": "your lebesgue register email", + "password": "your lebesgue password", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "scass_type": "c8_m8_cpu", + "platform": "ali", + "image_name": "vasp:5.4.4", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "DpCloudServer", + "number_node": 1, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "CPU", + "group_size": 5, + "source_list": [ + "/opt/intel/oneapi/setvars.sh" + ] } - }, - "resources": { - "batch_type": "DpCloudServer", - "number_node": 1, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "CPU", - "group_size": 5, - "source_list": ["/opt/intel/oneapi/setvars.sh"] - } } } diff --git a/examples/run/ch4/machine.json b/examples/run/ch4/machine.json index 653f613d6..70b8ee67a 100644 --- a/examples/run/ch4/machine.json +++ b/examples/run/ch4/machine.json @@ -1,75 +1,77 @@ { - "deepmd_path": "/sharedext4/local/deepmd-kit-0.12.4/", - "train_machine": { - "machine_type": "slurm", - "hostname" : "localhost", - "port" : 22, - "username": "root", - "work_path" : "/sharedext4/generator/example/deep.gen/generator/ch4/", - "_comment" : "that's all" + "deepmd_path": "/sharedext4/local/deepmd-kit-0.12.4/", + "train_machine": { + "machine_type": "slurm", + "hostname": "localhost", + "port": 22, + "username": "root", + "work_path": "/sharedext4/generator/example/deep.gen/generator/ch4/", + "_comment1": "that's all" }, - "train_resources": { - "numb_node": 1, - "numb_gpu": 1, - "task_per_node":8, - "partition" : "GPU-H", - "exclude_list" : [], - "source_list": [ "/sharedext4/local/deepmd-kit-0.12.4/bin/activate" ], - "module_list": [ ], - "time_limit": "23:0:0", - "mem_limit": 32, - "_comment": "that's all" + "train_resources": { + "numb_node": 1, + "numb_gpu": 1, + "task_per_node": 8, + "partition": "GPU-H", + "exclude_list": [], + "source_list": [ + "/sharedext4/local/deepmd-kit-0.12.4/bin/activate" + ], + "module_list": [], + "time_limit": "23:0:0", + "mem_limit": 32, + "_comment2": "that's all" }, - - "model_devi_command": "/sharedext4/softwares/lammps/bin/lmp_serial", - "model_devi_group_size": 1, - "_comment": "model_devi on localhost", - "model_devi_machine": { - "machine_type": "slurm", - "hostname" : "localhost", - "port" : 22, - "username": "root", - "work_path" : "/sharedext4/generator/example/deep.gen/generator/ch4/", - "_comment" : "that's all" + "model_devi_command": "/sharedext4/softwares/lammps/bin/lmp_serial", + "model_devi_group_size": 1, + "_comment3": "model_devi on localhost", + "model_devi_machine": { + "machine_type": "slurm", + "hostname": "localhost", + "port": 22, + "username": "root", + "work_path": "/sharedext4/generator/example/deep.gen/generator/ch4/", + "_comment4": "that's all" }, - "_comment": " if use GPU, numb_nodes(nn) should always be 1 ", - "_comment": " if numb_nodes(nn) = 1 multi-threading rather than mpi is assumed", - "model_devi_resources": { - "numb_node": 1, - "numb_gpu": 0, - "task_per_node":1, - "source_list": ["/sharedext4/local/deepmd-kit-0.12.4/bin/lammps.activate" ], - "module_list": [ ], - "time_limit": "19:0:0", - "mem_limit": 32, - "partition" : "GPU-All", - "_comment": "that's all" + "_comment5": " if use GPU, numb_nodes(nn) should always be 1 ", + "_comment6": " if numb_nodes(nn) = 1 multi-threading rather than mpi is assumed", + "model_devi_resources": { + "numb_node": 1, + "numb_gpu": 0, + "task_per_node": 1, + "source_list": [ + "/sharedext4/local/deepmd-kit-0.12.4/bin/lammps.activate" + ], + "module_list": [], + "time_limit": "19:0:0", + "mem_limit": 32, + "partition": "GPU-All", + "_comment7": "that's all" }, - - "_comment": "fp on localhost ", - "fp_command": "/sharedext4/vasp/vasp.5.4.4/bin/vasp_std", - "fp_group_size": 1, - "fp_machine": { + "_comment8": "fp on localhost ", + "fp_command": "/sharedext4/vasp/vasp.5.4.4/bin/vasp_std", + "fp_group_size": 1, + "fp_machine": { "machine_type": "slurm", - "hostname" : "localhost", - "port" : 22, - "username": "root", - "work_path" : "/sharedext4/generator/example/deep.gen/generator/ch4/", - "_comment" : "that's all" + "hostname": "localhost", + "port": 22, + "username": "root", + "work_path": "/sharedext4/generator/example/deep.gen/generator/ch4/", + "_comment9": "that's all" }, - "fp_resources": { - "numb_node": 1, - "task_per_node":1, - "numb_gpu": 0, - "exclude_list" : [], - "source_list": ["/sharedext4/softwares/source/vasp_cpu.activate" ], - "module_list": [], - "with_mpi" : 1, - "time_limit": "1:0:0", - "partition" : "GPU-All", - "_comment": "that's all" + "fp_resources": { + "numb_node": 1, + "task_per_node": 1, + "numb_gpu": 0, + "exclude_list": [], + "source_list": [ + "/sharedext4/softwares/source/vasp_cpu.activate" + ], + "module_list": [], + "with_mpi": 1, + "time_limit": "1:0:0", + "partition": "GPU-All", + "_comment10": "that's all" }, - - - "_comment": " that's all " + "_comment11": " that's all " } diff --git a/examples/run/ch4/param.json b/examples/run/ch4/param.json index 2a996e5fe..9983473b8 100644 --- a/examples/run/ch4/param.json +++ b/examples/run/ch4/param.json @@ -1,114 +1,193 @@ { - "type_map": ["H","C"], - "mass_map": [1, 12], - - "init_data_prefix": "/sharedext4/generator/example/deep.gen/data/", - - "init_data_sys": [ - "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/02.md/sys-0004-0001/deepmd" - ], - "init_batch_size": [ - 8 - ], - "sys_configs": [ - ["/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000[0-4]/POSCAR"], - ["/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000[5-9]/POSCAR"], - ["/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR"], - ["/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00002*/POSCAR"] - ], - "_comment": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25", - "sys_batch_size": [ - 8, 8, 8, 8 + "type_map": [ + "H", + "C" ], - - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [16,4], - "rcut_smth": 0.50, - "rcut": 5, - "filter_neuron": [10, 20, 40], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 30000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 150, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/sharedext4/generator/example/deep.gen/data/", + "init_data_sys": [ + "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/02.md/sys-0004-0001/deepmd" + ], + "init_batch_size": [ + 8 + ], + "sys_configs": [ + [ + "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000[0-4]/POSCAR" + ], + [ + "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000[5-9]/POSCAR" + ], + [ + "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR" + ], + [ + "/sharedext4/generator/example/deep.gen/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00002*/POSCAR" + ] + ], + "_comment1": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25", + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment2": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut": 5, + "rcut_smth": 0.5, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 150, + "start_lr": 0.001, + "stop_lr": 3.505266624882874e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 30000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 300, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [2], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [3], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "npt", "_idx": "03"} - ], - - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 30, - "fp_task_min": 5, - "fp_pp_path": "/sharedext4/generator/example/deep.gen/data/ch4/", - "fp_pp_files": ["POTCAR"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 400, - "ediff": 1e-6, - "kspacing": 2, - "_comment": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", - "smearing": "gauss", - "sigma": 0.05, - "_comment": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", - "metagga": "NONE", - "npar": 4, - "kpar": 1, - "_comment": " that's all " + "_comment8": " 01.model_devi ", + "_comment9": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 2 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 3 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "npt", + "_idx": "03" + } + ], + "_comment10": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 30, + "fp_task_min": 5, + "fp_pp_path": "/sharedext4/generator/example/deep.gen/data/ch4/", + "fp_pp_files": [ + "POTCAR" + ], + "fp_params": { + "_comment11": "given in unit depending on the fp method", + "ecut": 400, + "ediff": 1e-06, + "kspacing": 2, + "_comment12": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", + "smearing": "gauss", + "sigma": 0.05, + "_comment13": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", + "metagga": "NONE", + "npar": 4, + "kpar": 1, + "_comment14": " that's all " }, - "_comment": " that's all " + "_comment15": " that's all " } diff --git a/examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.json b/examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.json deleted file mode 100644 index b8163e785..000000000 --- a/examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "type_map": [ - "H", - "C" - ], - "mass_map": [ - 1, - 12 - ], - "init_data_prefix": "/public/data/deepmd-tutorial/data/", - "init_data_sys": [ - "deepmd" - ], - "init_batch_size": [ - 8 - ], - "sys_configs": [ - [ - "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" - ], - [ - "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8, - 8, - 8 - ], - "_comment": " that's all ", - "numb_models": 4, - "default_training_param": { - "_comment": "that's all", - "use_smooth": true, - "sel_a": [ - 16, - 4 - ], - "rcut_smth": 0.5, - "rcut": 5, - "filter_neuron": [ - 10, - 20, - 40 - ], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [ - 120, - 120, - 120 - ], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "systems": [ ], - "set_prefix": "set", - "stop_batch": 40000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 200, - "decay_rate": 0.95, - "seed": 0, - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - }, - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - { - "sys_idx": [ - 0 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 1000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 5000, - "ensemble": "nvt", - "_idx": "01" - } - ], - "fp_style": "cp2k", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 5, - "fp_params": { - "cutoff": "400", - "rel_cutoff": "50", - "functional": "PBE", - "pair_potential_path": "dftd3.dat", - "pair_ref_functional": "PBE", - "basis_path": "BASIS_MOLOPT", - "pp_path": "GTH_POTENTIALS", - "element_list": ["H", "C"], - "basis_list": ["DZVP-MOLOPT-GTH", "DZVP-MOLOPT-GTH"], - "_comment": "elment_list, basis_list, pp_list should be one to one correspondance", - "pp_list": ["GTH-PBE-q1", "GTH-PBE-q4"] - } -} diff --git a/examples/run/deprecated/dp0.12-lammps-pwmat/machine-slurm-pwmat-single.json b/examples/run/deprecated/dp0.12-lammps-pwmat/machine-slurm-pwmat-single.json deleted file mode 100644 index 9138f0cbf..000000000 --- a/examples/run/deprecated/dp0.12-lammps-pwmat/machine-slurm-pwmat-single.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "train": [ - { - "machine": { - "machine_type": "slurm", - "hostname": "mstation", - "port": 22, - "username": "test", - "password": "PWmat2019", - "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_train" - }, - "resources": { - "numb_node": 1, - "numb_gpu": 4, - "task_per_node": 4, - "partition": "control", - "exclude_list": [], - "source_list": [ - "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/train.env" - ], - "module_list": [], - "time_limit": "23:0:0" - }, - "deepmd_path" : "/home/test/anaconda2/envs/python3/" - } - ], - "model_devi": [ - { - "machine": { - "machine_type": "slurm", - "hostname": "mstation", - "port": 22, - "username": "test", - "password": "PWmat2019", - "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_model" - }, - "resources": { - "numb_node": 1, - "numb_gpu": 4, - "task_per_node": 4, - "partition": "control", - "exclude_list": [], - "source_list": [ - "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/train.env" - ], - "module_list": [], - "time_limit": "23:0:0" - }, - "command": "srun --mpi=pmi2 lmp_mpi", - "group_size": 10 - } - ], - "fp": [ - { - "machine": { - "machine_type": "slurm", - "hostname": "mstation", - "port": 22, - "username": "test", - "password": "PWmat2019", - "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_fp" - }, - "resources": { - "task_per_node": 4, - "numb_gpu": 4, - "exclude_list": [], - "with_mpi": false, - "source_list": [], - "module_list": [ - "cuda/8.0" - ], - "time_limit": "120:0:0", - "partition": "control", - "_comment": "that's All" - }, - "command": "mpirun -np 4 PWmat", - "group_size": 5 - } - ] -} diff --git a/examples/run/deprecated/dp0.12-lammps-pwmat/param_CH4.json b/examples/run/deprecated/dp0.12-lammps-pwmat/param_CH4.json deleted file mode 100644 index b1b3756ad..000000000 --- a/examples/run/deprecated/dp0.12-lammps-pwmat/param_CH4.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "type_map": ["H","C"], - "mass_map": [1, 12], - - "init_data_prefix": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/", - - "init_data_sys": [ - "ch4/00.data" - ], - "init_batch_size": [ - 8 - ], - "sys_configs_prefix": - "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/", - "sys_configs": [ - ["/home/test/software/dpgen/examples/run/dp-lammps-pwmat/scale-1.000/00000*/POSCAR"], - ["/home/test/software/dpgen/examples/run/dp-lammps-pwmat/scale-1.000/00001*/POSCAR"] - ], - - "sys_batch_size": [ - 8, 8, 8, 8 - ], - - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [16,4], - "rcut_smth": 0.50, - "rcut": 5, - "filter_neuron": [10, 20, 40], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": ["./00.data/"], - "set_prefix": "set", - "stop_batch": 2000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 100, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" - }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0], - "temps": [ 300], "press": [0.0], "trj_freq": 10, "nsteps": 300, "ensemble": "nvt", "_idx": "00"}, - {"sys_idx": [1], - "temps": [ 300], "press": [0.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "01"} - ], - - "_comment": " 02.fp ", - "fp_style": "pwmat", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 8, - "fp_pp_path": ".", - "fp_pp_files": ["C.SG15.PBE.UPF", "H.SG15.PBE.UPF"], - "fp_incar" : "etot.input", - "_comment": " that's all " -} diff --git a/examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json b/examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json deleted file mode 100644 index 44ebced0e..000000000 --- a/examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "type_map": [ - "H", - "C" - ], - "mass_map": [ - 1, - 12 - ], - "init_data_prefix": "/public/data/deepmd-tutorial/data/", - "init_data_sys": [ - "deepmd" - ], - "init_batch_size": [ - 8 - ], - "sys_configs": [ - [ - "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" - ], - [ - "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8, - 8, - 8 - ], - "_comment": " that's all ", - "numb_models": 4, - "default_training_param": { - "_comment": "that's all", - "use_smooth": true, - "sel_a": [ - 16, - 4 - ], - "rcut_smth": 0.5, - "rcut": 5, - "filter_neuron": [ - 10, - 20, - 40 - ], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [ - 120, - 120, - 120 - ], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "systems": [ ], - "set_prefix": "set", - "stop_batch": 40000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 200, - "decay_rate": 0.95, - "seed": 0, - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - }, - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - { - "sys_idx": [ - 0 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 1000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 5000, - "ensemble": "nvt", - "_idx": "01" - } - ], - "fp_style": "siesta", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 5, - "fp_pp_path": ".", - "fp_pp_files": ["C.psf", "H.psf"], - "fp_params": { - "ecut": 300, - "ediff": 1e-4, - "kspacing": 1.0, - "mixingWeight": 0.05, - "NumberPulay": 5, - "_comment": " that's all " - }, - "_comment": " that's all " -} diff --git a/examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.json b/examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.json deleted file mode 100644 index f8950dca1..000000000 --- a/examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.json +++ /dev/null @@ -1,393 +0,0 @@ -{ - "type_map": ["Al"], - "mass_map": [27], - - "init_data_prefix": "/gpfs/share/home/1600017784/generator/Al/init/", - - "init_data_sys": [ - "al.fcc.02x02x02/02.md/sys-0032/deepmd", - "al.hcp.02x02x02/02.md/sys-0016/deepmd", - "al.bcc.02x02x02/02.md/sys-0016/deepmd" - ], - "init_batch_size": [ - 1, - 2, - 2 - ], - "sys_configs": [ - - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[5-9]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00001*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00002*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00003*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00004*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00005*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00006*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00007*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00008*/POSCAR"], - - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR"], - - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR"], - ["/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", - "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR"] - ], - "sys_batch_size": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [300], - "rcut_smth": 2.00, - "rcut": 8.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 4, - "save_freq": 2000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" - }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": -[ - { - "_idx": 0, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 0, - 8, - 16 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 1, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 1, - 9, - 17 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 2, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 2, - 10, - 18 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 3, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 3, - 11, - 19 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 4, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 4, - 12, - 20 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 5, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 5, - 13, - 21 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 6, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 6, - 14, - 22 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 7, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 7, - 15, - 23 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 8, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 0, - 8, - 16 - ], - "temps": [ - 330.0, - 396.0, - 462.0, - 528.0, - 594.0 - ], - "trj_freq": 10 - } -], - - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 300, - "fp_task_min": 5, - "fp_pp_path": "/gpfs/share/home/1600017784/start/data/POTCAR/Al/", - "fp_pp_files": ["POTCAR"], - "fp_incar": "/gpfs/share/home/1600017784/start/pku_input_set/INCAR_metal_scf_gpu", - "_comment": " that's all " -} diff --git a/examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.json b/examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.json deleted file mode 100644 index 6af7ed649..000000000 --- a/examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "type_map": ["H","C"], - "mass_map": [1, 12], - - "init_data_prefix": "/gpfs/share/home/1600017784/yuzhi/methane/init/", - - "init_data_sys": [ - "CH4.POSCAR.01x01x01/02.md/sys-0004-0001/deepmd" - ], - "init_batch_size": [ - 8 - ], - "sys_configs_prefix": - "/gpfs/share/home/1600017784/yuzhi/methane/init/", - "sys_configs": [ - ["CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000*/POSCAR"], - ["CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR"] - ], - - "sys_batch_size": [ - 8, 8, 8, 8 - ], - - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [16,4], - "rcut_smth": 0.50, - "rcut": 5, - "filter_neuron": [10, 20, 40], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 2000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 100, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" - }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 300, "ensemble": "nvt", "_idx": "00"}, - {"sys_idx": [1], - "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "01"} - ], - - "_comment": " 02.fp ", - "cvasp": false, - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 5, - "fp_pp_path": "/gpfs/share/home/1600017784/yuzhi/methane/", - "fp_pp_files": ["POT_H","POT_C"], -"fp_incar" : "/gpfs/share/home/1600017784/yuzhi/methane/INCAR_methane", - "_comment": " that's all " -} diff --git a/examples/run/deprecated/dp1.x-gromacs-gaussian/param.json b/examples/run/deprecated/dp1.x-gromacs-gaussian/param.json deleted file mode 100644 index 29065b3e4..000000000 --- a/examples/run/deprecated/dp1.x-gromacs-gaussian/param.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "type_map": [ - "H", - "C", - "N", - "O", - "Cl" - ], - "mass_map": [ - 2, - 12, - 14, - 16, - 35 - ], - "init_data_prefix": "somplace/tyk2-dpgen", - "init_data_sys": ["init_data", "mdtraj_data"], - "sys_configs_prefix": "somplace/tyk2-dpgen", - "sys_configs": [ - ["model_devi/lig_ejm_31"], - ["model_devi/lig_ejm_42"], - ["model_devi/lig_ejm_43"], - ["model_devi/lig_ejm_44"], - ["model_devi/lig_ejm_45"], - ["model_devi/lig_ejm_46"], - ["model_devi/lig_ejm_47"], - ["model_devi/lig_ejm_48"], - ["model_devi/lig_ejm_49"], - ["model_devi/lig_ejm_50"], - ["model_devi/lig_ejm_54"], - ["model_devi/lig_ejm_55"], - ["model_devi/lig_jmc_27"], - ["model_devi/lig_jmc_28"], - ["model_devi/lig_jmc_30"] - ], - "sys_format": "gromacs/gro", - "numb_models": 4, - "training_reuse_iter": 1, - "training_reuse_old_ratio": 0.3, - "training_reuse_start_lr": 0.0001, - "training_reuse_decay_steps": 500, - "training_reuse_stop_batch": 200000, - "training_reuse_start_pref_e": 1, - "training_reuse_start_pref_f": 100, - "train_param": "input.json", - "default_training_param": { - "model": { - "type_map": [ - "H", - "C", - "N", - "O", - "Cl" - ], - "descriptor": { - "type": "se_a", - "sel": [ - 40, - 48, - 48, - 48, - 48 - ], - "rcut_smth": 0.50, - "rcut": 6.00, - "neuron": [ - 25, - 50, - 100 - ], - "resnet_dt": false, - "axis_neuron": 16, - "type_one_side": true - }, - "fitting_net": { - "neuron": [ - 60, - 60, - 60 - ], - "resnet_dt": true - } - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 2000, - "decay_rate": 0.95 - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 8, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0, - "start_pref_pf": 0, - "limit_pref_pf": 0 - }, - "training": { - "set_prefix": "set", - "stop_batch": 1000000, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - "model_devi_engine": "gromacs", - "gromacs_settings": { - "mdp_filename": "md.mdp", - "topol_filename": "processed.top", - "conf_filename": "npt.gro", - "index_filename": "index.raw", - "ref_filename": "em.tpr", - "model_devi_script": "model_devi.py", - "traj_filename": "deepmd_traj.gro" - }, - "model_devi_dt": 0.001, - "model_devi_f_trust_lo": 0.20, - "model_devi_f_trust_hi": 0.40, - "model_devi_clean_traj": false, - "model_devi_skip": 0, - "model_devi_nopbc": true, - "model_devi_activation_func": [ - "tanh", - "tanh", - "gelu", - "gelu" - ], - "model_devi_jobs": [ - { - "_idx": 0, - "ensemble": "nvt", - "nsteps": 5000, - "press": [], - "sys_idx": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14 - ], - "temps": [], - "trj_freq": 10, - "_comment": "trj_freq should be consistent with nstxout in mdp" - } - ], - "fp_style": "gaussian", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 1, - "fp_pp_path": "./", - "fp_pp_files": [], - "fp_params": { - "keywords": "force m062x/6-31g(d) nosymm", - "nproc": 16, - "multiplicity": "auto" - } -} diff --git a/examples/run/deprecated/dp2.x-gromacs-gaussian/param.json b/examples/run/deprecated/dp2.x-gromacs-gaussian/param.json new file mode 100644 index 000000000..99842df95 --- /dev/null +++ b/examples/run/deprecated/dp2.x-gromacs-gaussian/param.json @@ -0,0 +1,209 @@ +{ + "type_map": [ + "H", + "C", + "N", + "O", + "Cl" + ], + "mass_map": [ + 2, + 12, + 14, + 16, + 35 + ], + "init_data_prefix": "somplace/tyk2-dpgen", + "init_data_sys": [ + "init_data", + "mdtraj_data" + ], + "sys_configs_prefix": "somplace/tyk2-dpgen", + "sys_configs": [ + [ + "model_devi/lig_ejm_31" + ], + [ + "model_devi/lig_ejm_42" + ], + [ + "model_devi/lig_ejm_43" + ], + [ + "model_devi/lig_ejm_44" + ], + [ + "model_devi/lig_ejm_45" + ], + [ + "model_devi/lig_ejm_46" + ], + [ + "model_devi/lig_ejm_47" + ], + [ + "model_devi/lig_ejm_48" + ], + [ + "model_devi/lig_ejm_49" + ], + [ + "model_devi/lig_ejm_50" + ], + [ + "model_devi/lig_ejm_54" + ], + [ + "model_devi/lig_ejm_55" + ], + [ + "model_devi/lig_jmc_27" + ], + [ + "model_devi/lig_jmc_28" + ], + [ + "model_devi/lig_jmc_30" + ] + ], + "sys_format": "gromacs/gro", + "numb_models": 4, + "training_reuse_iter": 1, + "training_reuse_old_ratio": 0.3, + "training_reuse_start_lr": 0.0001, + "training_reuse_decay_steps": 500, + "training_reuse_stop_batch": 200000, + "training_reuse_start_pref_e": 1, + "training_reuse_start_pref_f": 100, + "train_param": "input.json", + "default_training_param": { + "model": { + "type_map": [ + "H", + "C", + "N", + "O", + "Cl" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 40, + 48, + 48, + 48, + 48 + ], + "rcut_smth": 0.5, + "rcut": 6.0, + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "axis_neuron": 16, + "type_one_side": true + }, + "fitting_net": { + "neuron": [ + 60, + 60, + 60 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 2000, + "stop_lr": 7.274491561439049e-15 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 8, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0, + "start_pref_pf": 0, + "limit_pref_pf": 0 + }, + "training": { + "stop_batch": 1000000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "set_prefix": "set" + } + } + }, + "model_devi_engine": "gromacs", + "gromacs_settings": { + "mdp_filename": "md.mdp", + "topol_filename": "processed.top", + "conf_filename": "npt.gro", + "index_filename": "index.raw", + "ref_filename": "em.tpr", + "model_devi_script": "model_devi.py", + "traj_filename": "deepmd_traj.gro" + }, + "model_devi_dt": 0.001, + "model_devi_f_trust_lo": 0.2, + "model_devi_f_trust_hi": 0.4, + "model_devi_clean_traj": false, + "model_devi_skip": 0, + "model_devi_nopbc": true, + "model_devi_activation_func": [ + "tanh", + "tanh", + "gelu", + "gelu" + ], + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "nvt", + "nsteps": 5000, + "press": [], + "sys_idx": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "temps": [], + "trj_freq": 10, + "_comment1": "trj_freq should be consistent with nstxout in mdp" + } + ], + "fp_style": "gaussian", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 1, + "fp_pp_path": "./", + "fp_pp_files": [], + "fp_params": { + "keywords": "force m062x/6-31g(d) nosymm", + "nproc": 16, + "multiplicity": "auto" + } +} diff --git a/examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.json b/examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.json new file mode 100644 index 000000000..bc07d204a --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.json @@ -0,0 +1,156 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/public/data/deepmd-tutorial/data/", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 8 + ], + "sys_configs": [ + [ + "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" + ], + [ + "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment1": " that's all ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut": 5, + "rcut_smth": 0.5, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 200, + "start_lr": 0.001, + "stop_lr": 3.505266624882874e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "training": { + "seed": 0, + "stop_batch": 40000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 5000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "fp_style": "cp2k", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 5, + "fp_params": { + "cutoff": "400", + "rel_cutoff": "50", + "functional": "PBE", + "pair_potential_path": "dftd3.dat", + "pair_ref_functional": "PBE", + "basis_path": "BASIS_MOLOPT", + "pp_path": "GTH_POTENTIALS", + "element_list": [ + "H", + "C" + ], + "basis_list": [ + "DZVP-MOLOPT-GTH", + "DZVP-MOLOPT-GTH" + ], + "_comment3": "elment_list, basis_list, pp_list should be one to one correspondance", + "pp_list": [ + "GTH-PBE-q1", + "GTH-PBE-q4" + ] + } +} diff --git a/examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.yaml b/examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.yaml similarity index 98% rename from examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.yaml rename to examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.yaml index 8a7b83baf..358648077 100644 --- a/examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.yaml +++ b/examples/run/deprecated/dp2.x-lammps-cp2k/CH4/param_CH4.yaml @@ -61,7 +61,6 @@ default_training_param: numb_test: 4 save_freq: 1000 save_ckpt: model.ckpt - load_ckpt: model.ckpt disp_training: true time_training: true profiling: false diff --git a/examples/run/deprecated/dp2.x-lammps-pwmat/machine-slurm-pwmat-single.json b/examples/run/deprecated/dp2.x-lammps-pwmat/machine-slurm-pwmat-single.json new file mode 100644 index 000000000..be8a6b027 --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-pwmat/machine-slurm-pwmat-single.json @@ -0,0 +1,80 @@ +{ + "train": [ + { + "machine": { + "machine_type": "slurm", + "hostname": "mstation", + "port": 22, + "username": "test", + "password": "PWmat2019", + "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_train" + }, + "resources": { + "numb_node": 1, + "numb_gpu": 4, + "task_per_node": 4, + "partition": "control", + "exclude_list": [], + "source_list": [ + "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/train.env" + ], + "module_list": [], + "time_limit": "23:0:0" + }, + "deepmd_path": "/home/test/anaconda2/envs/python3/" + } + ], + "model_devi": [ + { + "machine": { + "machine_type": "slurm", + "hostname": "mstation", + "port": 22, + "username": "test", + "password": "PWmat2019", + "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_model" + }, + "resources": { + "numb_node": 1, + "numb_gpu": 4, + "task_per_node": 4, + "partition": "control", + "exclude_list": [], + "source_list": [ + "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/train.env" + ], + "module_list": [], + "time_limit": "23:0:0" + }, + "command": "srun --mpi=pmi2 lmp_mpi", + "group_size": 10 + } + ], + "fp": [ + { + "machine": { + "machine_type": "slurm", + "hostname": "mstation", + "port": 22, + "username": "test", + "password": "PWmat2019", + "work_path": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/work_fp" + }, + "resources": { + "task_per_node": 4, + "numb_gpu": 4, + "exclude_list": [], + "with_mpi": false, + "source_list": [], + "module_list": [ + "cuda/8.0" + ], + "time_limit": "120:0:0", + "partition": "control", + "_comment1": "that's All" + }, + "command": "mpirun -np 4 PWmat", + "group_size": 5 + } + ] +} diff --git a/examples/run/deprecated/dp2.x-lammps-pwmat/param_CH4.json b/examples/run/deprecated/dp2.x-lammps-pwmat/param_CH4.json new file mode 100644 index 000000000..3c2ebfdef --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-pwmat/param_CH4.json @@ -0,0 +1,147 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/", + "init_data_sys": [ + "ch4/00.data" + ], + "init_batch_size": [ + 8 + ], + "sys_configs_prefix": "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/", + "sys_configs": [ + [ + "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/scale-1.000/00000*/POSCAR" + ], + [ + "/home/test/software/dpgen/examples/run/dp-lammps-pwmat/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut": 5, + "rcut_smth": 0.5, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 100, + "start_lr": 0.001, + "stop_lr": 0.0003584859224085419 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 2000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [ + "./00.data/" + ], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 300 + ], + "press": [ + 0.0 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 300 + ], + "press": [ + 0.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment9": " 02.fp ", + "fp_style": "pwmat", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 8, + "fp_pp_path": ".", + "fp_pp_files": [ + "C.SG15.PBE.UPF", + "H.SG15.PBE.UPF" + ], + "fp_incar": "etot.input", + "_comment10": " that's all " +} diff --git a/examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json b/examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json new file mode 100644 index 000000000..56555f0fd --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.json @@ -0,0 +1,148 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/public/data/deepmd-tutorial/data/", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 8 + ], + "sys_configs": [ + [ + "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" + ], + [ + "/public/data/deepmd-tutorial/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment1": " that's all ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut": 5, + "rcut_smth": 0.5, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 200, + "start_lr": 0.001, + "stop_lr": 3.505266624882874e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "training": { + "seed": 0, + "stop_batch": 40000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 5000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "fp_style": "siesta", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 5, + "fp_pp_path": ".", + "fp_pp_files": [ + "C.psf", + "H.psf" + ], + "fp_params": { + "ecut": 300, + "ediff": 0.0001, + "kspacing": 1.0, + "mixingWeight": 0.05, + "NumberPulay": 5, + "_comment3": " that's all " + }, + "_comment4": " that's all " +} diff --git a/examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml b/examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml similarity index 98% rename from examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml rename to examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml index 6a3ae9598..77b426760 100644 --- a/examples/run/deprecated/dp0.12-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml +++ b/examples/run/deprecated/dp2.x-lammps-siesta/dp-lammps-siesta/CH4/param_CH4.yaml @@ -60,7 +60,6 @@ default_training_param: numb_test: 4 save_freq: 1000 save_ckpt: model.ckpt - load_ckpt: model.ckpt disp_training: true time_training: true profiling: false diff --git a/examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.json b/examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.json new file mode 100644 index 000000000..e3383a2e1 --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.json @@ -0,0 +1,450 @@ +{ + "type_map": [ + "Al" + ], + "mass_map": [ + 27 + ], + "init_data_prefix": "/gpfs/share/home/1600017784/generator/Al/init/", + "init_data_sys": [ + "al.fcc.02x02x02/02.md/sys-0032/deepmd", + "al.hcp.02x02x02/02.md/sys-0016/deepmd", + "al.bcc.02x02x02/02.md/sys-0016/deepmd" + ], + "init_batch_size": [ + 1, + 2, + 2 + ], + "sys_configs": [ + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00001*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00002*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00003*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00004*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00005*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00006*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00007*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00008*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR" + ], + [ + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", + "/gpfs/share/home/1600017784/generator/Al/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR" + ] + ], + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 300 + ], + "rcut": 8.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.001, + "stop_lr": 3.505266624882874e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 2000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 0, + 8, + 16 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 1, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 1, + 9, + 17 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 2, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 2, + 10, + 18 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 3, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 3, + 11, + 19 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 4, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 4, + 12, + 20 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 5, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 5, + 13, + 21 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 6, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 6, + 14, + 22 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 7, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 7, + 15, + 23 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 8, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 0, + 8, + 16 + ], + "temps": [ + 330.0, + 396.0, + 462.0, + 528.0, + 594.0 + ], + "trj_freq": 10 + } + ], + "_comment9": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 300, + "fp_task_min": 5, + "fp_pp_path": "/gpfs/share/home/1600017784/start/data/POTCAR/Al/", + "fp_pp_files": [ + "POTCAR" + ], + "fp_incar": "/gpfs/share/home/1600017784/start/pku_input_set/INCAR_metal_scf_gpu", + "_comment10": " that's all " +} diff --git a/examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.yaml b/examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.yaml similarity index 99% rename from examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.yaml rename to examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.yaml index 37409d69a..0a8d362fb 100644 --- a/examples/run/deprecated/dp0.12-lammps-vasp/Al/param_al_all_gpu.yaml +++ b/examples/run/deprecated/dp2.x-lammps-vasp/Al/param_al_all_gpu.yaml @@ -109,7 +109,6 @@ default_training_param: numb_test: 4 save_freq: 2000 save_ckpt: model.ckpt - load_ckpt: model.ckpt disp_training: true time_training: true profiling: false diff --git a/examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.json b/examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.json new file mode 100644 index 000000000..8ff640f7e --- /dev/null +++ b/examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.json @@ -0,0 +1,146 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/gpfs/share/home/1600017784/yuzhi/methane/init/", + "init_data_sys": [ + "CH4.POSCAR.01x01x01/02.md/sys-0004-0001/deepmd" + ], + "init_batch_size": [ + 8 + ], + "sys_configs_prefix": "/gpfs/share/home/1600017784/yuzhi/methane/init/", + "sys_configs": [ + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00000*/POSCAR" + ], + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut": 5, + "rcut_smth": 0.5, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 100, + "start_lr": 0.001, + "stop_lr": 0.0003584859224085419 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 2000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment9": " 02.fp ", + "cvasp": false, + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 5, + "fp_pp_path": "/gpfs/share/home/1600017784/yuzhi/methane/", + "fp_pp_files": [ + "POT_H", + "POT_C" + ], + "fp_incar": "/gpfs/share/home/1600017784/yuzhi/methane/INCAR_methane", + "_comment10": " that's all " +} diff --git a/examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.yaml b/examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.yaml similarity index 98% rename from examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.yaml rename to examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.yaml index 2a77eddef..7a34e9ef9 100644 --- a/examples/run/deprecated/dp0.12-lammps-vasp/CH4/param_CH4.yaml +++ b/examples/run/deprecated/dp2.x-lammps-vasp/CH4/param_CH4.yaml @@ -61,7 +61,6 @@ default_training_param: numb_test: 4 save_freq: 1000 save_ckpt: model.ckpt - load_ckpt: model.ckpt disp_training: true time_training: true profiling: false diff --git a/examples/run/deprecated/param-h2oscan-vasp.json b/examples/run/deprecated/param-h2oscan-vasp.json index 1ccc592b7..84e7dbb3c 100644 --- a/examples/run/deprecated/param-h2oscan-vasp.json +++ b/examples/run/deprecated/param-h2oscan-vasp.json @@ -1,209 +1,694 @@ { - "type_map": ["O", "H"], - "mass_map": [16, 2], - - "init_data_prefix": "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.train", - "init_data_sys": ["ice01c", - "ice01h", - "ice02", - "ice03", - "ice04", - "ice05", - "ice06", - "ice07", - "ice08", - "ice09", - "ice10", - "ice11", - "ice12", - "ice13", - "ice14", - "ice15", - "waterliquid/nvt-330K", - "waterliquid/nvt-360K" - ], - "init_batch_size": [1, 3, 3, 3, 1, 2, 3, 2, 4, 3, 2, 2, 3, 2, 3, 3, 1, 1], - "sys_configs": [ - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[0-4]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/00009?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[7-8]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[5-6]?/POSCAR"], - ["/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[0-4]?/POSCAR"], - ["/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/009?/POSCAR"], - ["/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[7-8]?/POSCAR"], - ["/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[5-6]?/POSCAR"], - ["/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[0-4]?/POSCAR"] + "type_map": [ + "O", + "H" ], - "_comment": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", - "_comment": "16 ....................................... 31", - "_comment": "32 ....................................... 47", - "_comment": "48 ....................................... 63", - "_comment": "64 65 66 67", - "sys_batch_size": [1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, - 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [200, 400], - "rcut_smth": 0.50, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 1000000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 5000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2 + ], + "init_data_prefix": "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.train", + "init_data_sys": [ + "ice01c", + "ice01h", + "ice02", + "ice03", + "ice04", + "ice05", + "ice06", + "ice07", + "ice08", + "ice09", + "ice10", + "ice11", + "ice12", + "ice13", + "ice14", + "ice15", + "waterliquid/nvt-330K", + "waterliquid/nvt-360K" + ], + "init_batch_size": [ + 1, + 3, + 3, + 3, + 1, + 2, + 3, + 2, + 4, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 1, + 1 + ], + "sys_configs": [ + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01c/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice01h/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice02/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice03/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice04/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice05/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice06/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice07/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice08/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice09/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice10/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice11/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice12/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice13/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice14/0000[0-4]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/00009?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[7-8]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[5-6]?/POSCAR" + ], + [ + "/home/yixiaoc/SCR/wanghan/data/water.all.phase/init.md/ice15/0000[0-4]?/POSCAR" + ], + [ + "/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/009?/POSCAR" + ], + [ + "/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[7-8]?/POSCAR" + ], + [ + "/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[5-6]?/POSCAR" + ], + [ + "/scratch/gpfs/yixiaoc/wanghan/data/water/init.md/waterliquid/00[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", + "_comment2": "16 ....................................... 31", + "_comment3": "32 ....................................... 47", + "_comment4": "48 ....................................... 63", + "_comment5": "64 65 66 67", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 4, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 1, + 1 + ], + "_comment6": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 200, + 400 + ], + "rcut": 6.0, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 5000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 1000000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_taut": 0.1, - "model_devi_taup": 0.5, - "model_devi_skip": 10, - "model_devi_f_trust_lo": 0.150, - "model_devi_f_trust_hi": 0.250, - "model_devi_clean_traj": true, - "_comment": "group 1: 0,1,11,lw; group 2: 2-6,9,12-15; group 3: 7,8,lw; group 4: 10.", - "model_devi_jobs": [ - {"sys_idx":[ 0, 4, 8, 12, 16, 20, 24, 36, 44, 48, 52, 56, 60, 64], "s_t": true, - "Ts": [ 50], "Ps": [1e-1,5e-1,1e0,5e0,1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4], "t_freq": 20, "nsteps": 1000, "ens": "npt", "_idx": "00"}, - {"sys_idx":[ 28,32,40], - "Ts": [ 50], "Ps": [1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4,1e5,5e5], "t_freq": 20, "nsteps": 1000, "ens": "npt", "_idx": "01"}, - {"sys_idx":[ 1, 5, 9, 13, 17, 21, 25, 37, 45, 49, 53, 57, 61, 65], "s_t": true, - "Ts": [ 50], "Ps": [1e-1,5e-1,1e0,5e0,1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4], "t_freq": 20, "nsteps": 5000, "ens": "npt", "_idx": "02"}, - {"sys_idx":[ 29,33,41], - "Ts": [ 50], "Ps": [1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4,1e5,5e5], "t_freq": 20, "nsteps": 5000, "ens": "npt", "_idx": "03"}, - {"sys_idx":[ 2, 6, 10, 14, 18, 22, 26, 38, 46, 50, 54, 58, 62, 66], "s_t": true, - "Ts": [ 50], "Ps": [1e-1,5e-1,1e0,5e0,1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4], "t_freq": 20, "nsteps": 10000, "ens": "npt", "_idx": "04"}, - {"sys_idx":[ 30,34,42], - "Ts": [ 50], "Ps": [1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4,1e5,5e5], "t_freq": 20, "nsteps": 10000, "ens": "npt", "_idx": "05"}, - {"sys_idx":[ 3, 7, 11, 13, 17, 23, 27, 39, 47, 51, 55, 59, 63, 67], "s_t": true, - "Ts": [ 50], "Ps": [1e-1,5e-1,1e0,5e0,1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4], "t_freq": 20, "nsteps": 10000, "ens": "npt", "_idx": "06"}, - {"sys_idx":[ 31,35,44], - "Ts": [ 50], "Ps": [1e1,5e1,1e2,5e2,1e3,5e3,1e4,5e4,1e5,5e5], "t_freq": 20, "nsteps": 10000, "ens": "npt", "_idx": "07"} + "_comment12": " 01.model_devi ", + "_comment13": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_taut": 0.1, + "model_devi_taup": 0.5, + "model_devi_skip": 10, + "model_devi_f_trust_lo": 0.15, + "model_devi_f_trust_hi": 0.25, + "model_devi_clean_traj": true, + "_comment14": "group 1: 0,1,11,lw; group 2: 2-6,9,12-15; group 3: 7,8,lw; group 4: 10.", + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4, + 8, + 12, + 16, + 20, + 24, + 36, + 44, + 48, + 52, + 56, + 60, + 64 + ], + "s_t": true, + "Ts": [ + 50 + ], + "Ps": [ + 0.1, + 0.5, + 1.0, + 5.0, + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0 + ], + "t_freq": 20, + "nsteps": 1000, + "ens": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 28, + 32, + 40 + ], + "Ts": [ + 50 + ], + "Ps": [ + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0, + 100000.0, + 500000.0 + ], + "t_freq": 20, + "nsteps": 1000, + "ens": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 1, + 5, + 9, + 13, + 17, + 21, + 25, + 37, + 45, + 49, + 53, + 57, + 61, + 65 + ], + "s_t": true, + "Ts": [ + 50 + ], + "Ps": [ + 0.1, + 0.5, + 1.0, + 5.0, + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0 + ], + "t_freq": 20, + "nsteps": 5000, + "ens": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 29, + 33, + 41 + ], + "Ts": [ + 50 + ], + "Ps": [ + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0, + 100000.0, + 500000.0 + ], + "t_freq": 20, + "nsteps": 5000, + "ens": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 2, + 6, + 10, + 14, + 18, + 22, + 26, + 38, + 46, + 50, + 54, + 58, + 62, + 66 + ], + "s_t": true, + "Ts": [ + 50 + ], + "Ps": [ + 0.1, + 0.5, + 1.0, + 5.0, + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0 + ], + "t_freq": 20, + "nsteps": 10000, + "ens": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 30, + 34, + 42 + ], + "Ts": [ + 50 + ], + "Ps": [ + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0, + 100000.0, + 500000.0 + ], + "t_freq": 20, + "nsteps": 10000, + "ens": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 3, + 7, + 11, + 13, + 17, + 23, + 27, + 39, + 47, + 51, + 55, + 59, + 63, + 67 + ], + "s_t": true, + "Ts": [ + 50 + ], + "Ps": [ + 0.1, + 0.5, + 1.0, + 5.0, + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0 + ], + "t_freq": 20, + "nsteps": 10000, + "ens": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 31, + 35, + 44 + ], + "Ts": [ + 50 + ], + "Ps": [ + 10.0, + 50.0, + 100.0, + 500.0, + 1000.0, + 5000.0, + 10000.0, + 50000.0, + 100000.0, + 500000.0 + ], + "t_freq": 20, + "nsteps": 10000, + "ens": "npt", + "_idx": "07" + } + ], + "_comment15": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": "/home/yixiaoc/SCR/wanghan/data/water.all.phase", + "fp_pp_files": [ + "POTCAR" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": "/home/yixiaoc/SCR/wanghan/data/water.all.phase", - "fp_pp_files": ["POTCAR"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 800, - "ediff": 1e-6, - "kspacing": 0.5, - "_comment": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", - "smearing": "gauss", - "sigma": 0.05, - "_comment": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", - "metagga": "SCAN", - "npar": 1, - "kpar": 1, - "_comment": " that's all " + "fp_params": { + "_comment16": "given in unit depending on the fp method", + "ecut": 800, + "ediff": 1e-06, + "kspacing": 0.5, + "_comment17": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", + "smearing": "gauss", + "sigma": 0.05, + "_comment18": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", + "metagga": "SCAN", + "npar": 1, + "kpar": 1, + "_comment19": " that's all " }, - - "_comment": " that's all " + "_comment20": " that's all " } diff --git a/examples/run/deprecated/param-mg-vasp-ucloud.json b/examples/run/deprecated/param-mg-vasp-ucloud.json index 507e79396..443242a5a 100644 --- a/examples/run/deprecated/param-mg-vasp-ucloud.json +++ b/examples/run/deprecated/param-mg-vasp-ucloud.json @@ -1,147 +1,467 @@ { - "type_map": ["Mg"], - "mass_map": [24], - - "init_data_prefix": "/home/ubuntu/generator/data/mgop/", - "init_data_sys": ["mg.fcc.01x01x01/02.md/sys-0004/deepmd", - "mg.hcp.01x01x01/02.md/sys-0002/deepmd", - "mg.diamond.01x01x01/02.md/sys-0002/deepmd" - ], - "init_batch_size": [8, 16, 16], - "sys_configs": [ - ["/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00009?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[7-8]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[5-6]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[0-4]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR"], - ["/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/00009?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[7-8]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[5-6]?/POSCAR"], - ["/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[0-4]?/POSCAR"] + "type_map": [ + "Mg" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 2, 2, 2, 2, - 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, - 2, 2, 2, 2, - 4, 4, 4, 4 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24 + ], + "init_data_prefix": "/home/ubuntu/generator/data/mgop/", + "init_data_sys": [ + "mg.fcc.01x01x01/02.md/sys-0004/deepmd", + "mg.hcp.01x01x01/02.md/sys-0002/deepmd", + "mg.diamond.01x01x01/02.md/sys-0002/deepmd" + ], + "init_batch_size": [ + 8, + 16, + 16 + ], + "sys_configs": [ + [ + "/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00009?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/00009?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/ubuntu/generator/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 4, + 4, + 4, + 4 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": true, - - "model_devi_jobs": [ - {"sys_idx": [0,4,26,30], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "00"}, - {"sys_idx": [1,5,27,31], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "01"}, - {"sys_idx": [2,6,28,32], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "02"}, - {"sys_idx": [3,7,29,33], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "03"}, - {"sys_idx": [0,4,26,30], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "04"}, - {"sys_idx": [1,5,27,31], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "05"}, - {"sys_idx": [2,6,28,32], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "06"}, - {"sys_idx": [3,7,29,33], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "07"}, - {"sys_idx": [0,4,26,30], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "08"}, - {"sys_idx": [1,5,27,31], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "09"}, - {"sys_idx": [2,6,28,32], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "10"}, - {"sys_idx": [3,7,29,33], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "11"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "02" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "05" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "06" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "07" + }, + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "08" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "09" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "10" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "11" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "_comment12": "fp on localhost ", + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": "/home/ubuntu/generator/data/mgop/", + "fp_pp_files": [ + "POTCAR" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "_comment": "fp on localhost ", - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": "/home/ubuntu/generator/data/mgop/", - "fp_pp_files": ["POTCAR"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 600, - "ediff": 1e-6, - "kspacing": 0.16, - "npar": 1, - "kpar": 1, - "_comment": " that's all " + "fp_params": { + "_comment13": "given in unit depending on the fp method", + "ecut": 600, + "ediff": 1e-06, + "kspacing": 0.16, + "npar": 1, + "kpar": 1, + "_comment14": " that's all " }, - - "_comment": " that's all " + "_comment15": " that's all " } diff --git a/examples/run/deprecated/param-mg-vasp.json b/examples/run/deprecated/param-mg-vasp.json index 126f63cc1..6c680fa31 100644 --- a/examples/run/deprecated/param-mg-vasp.json +++ b/examples/run/deprecated/param-mg-vasp.json @@ -1,153 +1,474 @@ { - "type_map": ["Mg"], - "mass_map": [24], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/data/mgop/", - "init_data_sys": ["mg.fcc.01x01x01/02.md/sys-0004/deepmd", - "mg.hcp.01x01x01/02.md/sys-0002/deepmd", - "mg.diamond.01x01x01/02.md/sys-0002/deepmd" - ], - "init_batch_size": [8, 16, 16], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[0-4]?/POSCAR"] + "type_map": [ + "Mg" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 2, 2, 2, 2, - 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, - 2, 2, 2, 2, - 4, 4, 4, 4 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/data/mgop/", + "init_data_sys": [ + "mg.fcc.01x01x01/02.md/sys-0004/deepmd", + "mg.hcp.01x01x01/02.md/sys-0002/deepmd", + "mg.diamond.01x01x01/02.md/sys-0002/deepmd" + ], + "init_batch_size": [ + 8, + 16, + 16 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.hcp.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.fcc.01x01x01/01.scale_pert/surf-111/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-001/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-100/sys-0012/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000003/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000001/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/surf.mg.hcp.01x01x01/01.scale_pert/surf-110/sys-0016/scale*/elong*/000002/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.diamond.02x02x02/01.scale_pert/sys-0016/scale*/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/mgop/mg.sc.02x02x02/01.scale_pert/sys-0008/scale*/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 4, + 4, + 4, + 4 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0,4,26,30], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "00"}, - {"sys_idx": [1,5,27,31], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "01"}, - {"sys_idx": [2,6,28,32], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "02"}, - {"sys_idx": [3,7,29,33], "temps": [ 50], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "03"}, - {"sys_idx": [0,4,26,30], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "04"}, - {"sys_idx": [1,5,27,31], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "05"}, - {"sys_idx": [2,6,28,32], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "06"}, - {"sys_idx": [3,7,29,33], "temps": [ 100], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "07"}, - {"sys_idx": [0,4,26,30], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "nvt", "_idx": "08"}, - {"sys_idx": [1,5,27,31], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "09"}, - {"sys_idx": [2,6,28,32], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "10"}, - {"sys_idx": [3,7,29,33], "temps": [ 300], "press": [1.0], "trj_freq": 10, "nsteps": 3000, "ensemble": "nvt", "_idx": "11"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "02" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 50 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "05" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "06" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "07" + }, + { + "sys_idx": [ + 0, + 4, + 26, + 30 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "08" + }, + { + "sys_idx": [ + 1, + 5, + 27, + 31 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "09" + }, + { + "sys_idx": [ + 2, + 6, + 28, + 32 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "10" + }, + { + "sys_idx": [ + 3, + 7, + 29, + 33 + ], + "temps": [ + 300 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "11" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": "/home/linfengz/SCR/wanghan/data/mgop/", + "fp_pp_files": [ + "POTCAR" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": "/home/linfengz/SCR/wanghan/data/mgop/", - "fp_pp_files": ["POTCAR"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 600, - "ediff": 1e-6, - "kspacing": 0.16, - "_comment": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", - "smearing": "mp", - "sigma": 0.25, - "_comment": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", - "metagga": "NONE", - "npar": 1, - "kpar": 1, - "user_vasp_params": { - "EDIFF" : 1e-5 - }, - "_comment": " that's all " + "fp_params": { + "_comment12": "given in unit depending on the fp method", + "ecut": 600, + "ediff": 1e-06, + "kspacing": 0.16, + "_comment13": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", + "smearing": "mp", + "sigma": 0.25, + "_comment14": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", + "metagga": "NONE", + "npar": 1, + "kpar": 1, + "user_vasp_params": { + "EDIFF": 1e-05 + }, + "_comment15": " that's all " }, - - "_comment": " that's all " + "_comment16": " that's all " } diff --git a/examples/run/deprecated/param-pyridine-pwscf.json b/examples/run/deprecated/param-pyridine-pwscf.json index f7348c583..7529960cf 100644 --- a/examples/run/deprecated/param-pyridine-pwscf.json +++ b/examples/run/deprecated/param-pyridine-pwscf.json @@ -1,111 +1,328 @@ { - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 10, - "model_devi_f_trust_lo": 0.200, - "model_devi_f_trust_hi": 0.300, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 10, + "model_devi_f_trust_lo": 0.2, + "model_devi_f_trust_hi": 0.3, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } + ], + "_comment11": " 02.fp ", + "fp_style": "pwscf", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": "/home/linfengz/SCR/wanghan/deepgen.pyridine/pwscf/", + "fp_pp_files": [ + "C_HSCV_PBE-1.0.UPF", + "H_HSCV_PBE-1.0.UPF", + "N_HSCV_PBE-1.0.UPF" ], - - "_comment": " 02.fp ", - "fp_style": "pwscf", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": "/home/linfengz/SCR/wanghan/deepgen.pyridine/pwscf/", - "fp_pp_files": ["C_HSCV_PBE-1.0.UPF", "H_HSCV_PBE-1.0.UPF", "N_HSCV_PBE-1.0.UPF"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 110.0, - "ediff": 1e-8, - "kspacing": 0.6, - "npar": 1, - "kpar": 1, - "_comment": " that's all " + "fp_params": { + "_comment12": "given in unit depending on the fp method", + "ecut": 110.0, + "ediff": 1e-08, + "kspacing": 0.6, + "npar": 1, + "kpar": 1, + "_comment13": " that's all " }, - - "_comment": " that's all " + "_comment14": " that's all " } diff --git a/examples/run/dp-calypso-vasp/machine.json b/examples/run/dp-calypso-vasp/machine.json index f07f2dd87..b563d27c4 100644 --- a/examples/run/dp-calypso-vasp/machine.json +++ b/examples/run/dp-calypso-vasp/machine.json @@ -1,70 +1,82 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" :[ - { - "command": "dp", - "machine": { - "batch_type": "pbs", - "context_type": "lazylocal", - "local_root" : "./" - }, - "resources": { - "envs": {"LD_LIBRARY_PATH": "/opt/software/cuda/10.1/lib64:$LD_LIBRARY_PATH"}, - "custom_flags":["#PBS -l walltime=48:0:0"], - "number_node": 1, - "local_root":"./", - "cpu_per_node": 16, - "gpu_per_node": 1, - "queue_name": "T4_16_62", - "group_size": 1 - } - }], - "model_devi": - [{ - "calypso_path":"/home/zhenyu/workplace/dpgen/AA-2400/debug/calypso_input", - "deepmdkit_python":"/home/zhenyu/soft/deepmd-kit/envs/debug/bin/python", - "_deepmdkit_python":"this python will be used to optimize structures generated by CALYPSO with ase", - "_deepmdkit_python":"and also will be used to calculate model deviation in iter.000001/01.model_devi/model_devi_results", - "_deepmdkit_python":"with calypso_run_model_devi.py script", - "command": "", - "machine": { - "_batch_type": "pbs", - "batch_type": "shell", - "context_type": "lazylocal", - "remote_root": "/home/zhenyu/workplace/dpgen/AA-2400/debug/temp", - "local_root" : "./" - }, - "resources": { - "envs": {"LD_LIBRARY_PATH": "/opt/software/cuda/10.1/lib64:$LD_LIBRARY_PATH"}, - "custom_flags":["#PBS -l walltime=48:0:0"], - "number_node": 1, - "local_root":"./", - "cpu_per_node": 16, - "gpu_per_node": 1, - "queue_name": "T4_16_62", - "group_size": 50 - } - }], - "fp": - [{ - "command": "mpirun -n 32 /opt/vasp/vasp_std", - "machine": { - "batch_type": "shell", - "context_type": "lazylocal", - "local_root" : "./", - "remote_root": "/home/zhenyu/workplace/dpgen/AA-2400/debug/temp" - }, - "resources": { - "number_node": 1, - "cpu_per_node": 12, - "gpu_per_node": 0, - "queue_name": "C_32_64", - "group_size": 10, - "local_root":"./", - "custom_flags":["#PBS -l walltime=200:0:0"], - "source_list": ["/opt/intel/oneapi/setvars.sh"] - } - } - ] + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": [ + { + "command": "dp", + "machine": { + "batch_type": "pbs", + "context_type": "lazylocal", + "local_root": "./" + }, + "resources": { + "envs": { + "LD_LIBRARY_PATH": "/opt/software/cuda/10.1/lib64:$LD_LIBRARY_PATH" + }, + "custom_flags": [ + "#PBS -l walltime=48:0:0" + ], + "number_node": 1, + "local_root": "./", + "cpu_per_node": 16, + "gpu_per_node": 1, + "queue_name": "T4_16_62", + "group_size": 1 + } + } + ], + "model_devi": [ + { + "calypso_path": "/home/zhenyu/workplace/dpgen/AA-2400/debug/calypso_input", + "deepmdkit_python": "/home/zhenyu/soft/deepmd-kit/envs/debug/bin/python", + "_deepmdkit_python": "with calypso_run_model_devi.py script", + "command": "", + "machine": { + "_batch_type": "pbs", + "batch_type": "shell", + "context_type": "lazylocal", + "remote_root": "/home/zhenyu/workplace/dpgen/AA-2400/debug/temp", + "local_root": "./" + }, + "resources": { + "envs": { + "LD_LIBRARY_PATH": "/opt/software/cuda/10.1/lib64:$LD_LIBRARY_PATH" + }, + "custom_flags": [ + "#PBS -l walltime=48:0:0" + ], + "number_node": 1, + "local_root": "./", + "cpu_per_node": 16, + "gpu_per_node": 1, + "queue_name": "T4_16_62", + "group_size": 50 + } + } + ], + "fp": [ + { + "command": "mpirun -n 32 /opt/vasp/vasp_std", + "machine": { + "batch_type": "shell", + "context_type": "lazylocal", + "local_root": "./", + "remote_root": "/home/zhenyu/workplace/dpgen/AA-2400/debug/temp" + }, + "resources": { + "number_node": 1, + "cpu_per_node": 12, + "gpu_per_node": 0, + "queue_name": "C_32_64", + "group_size": 10, + "local_root": "./", + "custom_flags": [ + "#PBS -l walltime=200:0:0" + ], + "source_list": [ + "/opt/intel/oneapi/setvars.sh" + ] + } + } + ] } diff --git a/examples/run/dp-calypso-vasp/param.json b/examples/run/dp-calypso-vasp/param.json index 96f566938..401216b89 100644 --- a/examples/run/dp-calypso-vasp/param.json +++ b/examples/run/dp-calypso-vasp/param.json @@ -1,103 +1,99 @@ { - "model_devi_engine":"calypso", - "_calypso_path":"/home/zhenyu/workplace/dpgen/AA-2400/debug", - "_calypso_input_path":"/home/zhenyu/workplace/dpgen/AA-2400/debug/calypso_input", - "_model_devi_max_iter": 50, - "vsc":false, - + "model_devi_engine": "calypso", + "_calypso_path": "/home/zhenyu/workplace/dpgen/AA-2400/debug", + "_calypso_input_path": "/home/zhenyu/workplace/dpgen/AA-2400/debug/calypso_input", + "_model_devi_max_iter": 50, + "vsc": false, "type_map": [ - "Mg", + "Mg", "Al", "Cu" ], "mass_map": [ - 24, + 24, 27, 64 ], - "init_data_prefix":"/home/zhenyu/workplace/dpgen/AA-2400/data/", + "init_data_prefix": "/home/zhenyu/workplace/dpgen/AA-2400/data/", "init_data_sys": [ - "data.init/data.init/AlCuMg/init.000" + "data.init/data.init/AlCuMg/init.000" ], - "_comment": " that's all ", - + "_comment1": " that's all ", "training_init_model": false, "training_iter0_model_path": "/home/zhenyu/workplace/dpgen/AA-2400/pb/00[0-3]", - "training_reuse_iter": 0, - "training_reuse_old_ratio": 0.9, - "training_reuse_start_lr": 1e-4, - "training_reuse_stop_batch": 1000000, - "training_reuse_start_pref_e": 0.2, - "training_reuse_start_pref_f": 100, - + "training_reuse_iter": 0, + "training_reuse_old_ratio": 0.9, + "training_reuse_start_lr": 0.0001, + "training_reuse_stop_batch": 1000000, + "training_reuse_start_pref_e": 0.2, + "training_reuse_start_pref_f": 100, "numb_models": 4, "default_training_param": { - "model": { - "descriptor": { - "type": "se_e2_a", - "sel": [ - 500, - 700, - 1100 - ], - "rcut_smth": 2.0, - "rcut": 12.0, - "neuron": [ - 25, - 50, - 100 - ], - "resnet_dt": false, - "axis_neuron": 12, - "type_one_side": true, - "seed": 1801819940, - "_activation_function": "tanh" + "model": { + "descriptor": { + "type": "se_e2_a", + "sel": [ + 500, + 700, + 1100 + ], + "rcut_smth": 2.0, + "rcut": 12.0, + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "axis_neuron": 12, + "type_one_side": true, + "seed": 1801819940, + "_activation_function": "tanh" + }, + "fitting_net": { + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true, + "seed": 2375417769 + }, + "type_map": [ + "Mg", + "Al", + "Cu" + ] }, - "fitting_net": { - "neuron": [ - 240, - 240, - 240 - ], - "resnet_dt": true, - "seed": 2375417769 + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 5000 }, - "type_map": [ - "Mg", - "Al", - "Cu" - ] - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 5000 - }, - "loss": { - "start_pref_e": 0.2, - "limit_pref_e": 2, - "start_pref_f": 100, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 + "loss": { + "start_pref_e": 0.2, + "limit_pref_e": 2, + "start_pref_f": 100, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "training": { + "stop_batch": 6000, + "seed": 3982377700, + "_comment2": "that's all", + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 2000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "set_prefix": "set" + } }, - "training": { - "stop_batch": 6000, - "seed": 3982377700, - "_comment": "that's all", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 4, - "save_freq": 2000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - "set_prefix": "set" - } - }, - "sys_configs":"", + "sys_configs": "", "model_devi_dt": 0.002, "model_devi_skip": 0, "model_devi_f_trust_lo": 0.05, @@ -106,22 +102,311 @@ "model_devi_e_trust_hi": 10000000000.0, "model_devi_clean_traj": true, "model_devi_jobs": [ -{"times":[0],"NameOfAtoms":["Mg","Al","Cu"],"NumberOfAtoms":[1,1,1],"NumberOfFormula":[1,1],"Volume":[30],"DistanceOfIon":[[1.48,1.44,1.59],[1.44,1.41,1.56],[1.59,1.56,1.70]],"PsoRatio":[0.6],"PopSize":[500],"MaxStep":[3],"ICode":[1],"Split":"T","VSC":"T","MaxNumAtom":[31],"CtrlRange":[[1,10],[1,10],[1,10]]}, -{"times":[1],"NameOfAtoms":["Mg","Al"],"NumberOfAtoms":[1,1],"NumberOfFormula":[1,1],"Volume":[30],"DistanceOfIon":[[1.48,1.44],[1.44,1.41]],"PsoRatio":[0.6],"PopSize":[500],"MaxStep":[3],"ICode":[1],"Split":"T"}, -{"times":[3],"NameOfAtoms":["Al","Cu"],"NumberOfAtoms":[1,10],"NumberOfFormula":[1,2],"Volume":[300],"DistanceOfIon":[[1.48,1.44],[1.44,1.41]],"PsoRatio":[0.6],"PopSize":[5],"MaxStep":[3],"ICode":[1],"Split":"T"}, -{"times":[2],"NameOfAtoms":["Mg","Al","Cu"],"NumberOfAtoms":[1,1,1],"NumberOfFormula":[1,1],"Volume":[30],"DistanceOfIon":[[1.48,1.44,1.59],[1.44,1.41,1.56],[1.59,1.56,1.70]],"PsoRatio":[0.6],"PopSize":[5],"MaxStep":[1],"ICode":[1],"Split":"T","VSC":"T","MaxNumAtom":[31],"CtrlRange":[[1,10],[1,10],[1,10]],"PSTRESS":[0],"fmax":[0.01]}, -{"times":[4],"NameOfAtoms":["Mg","Al","Cu"],"NumberOfAtoms":[1,1,1],"NumberOfFormula":[1,1],"Volume":30,"DistanceOfIon":[[1.48,1.44,1.59],[1.44,1.41,1.56],[1.59,1.56,1.70]],"PsoRatio":0.6,"PopSize":5,"MaxStep":1,"ICode":1,"Split":"T","VSC":"T","MaxNumAtom":31,"CtrlRange":[[1,10],[1,10],[1,10]],"PSTRESS":[0, 400 ],"fmax":0.01} + { + "times": [ + 0 + ], + "NameOfAtoms": [ + "Mg", + "Al", + "Cu" + ], + "NumberOfAtoms": [ + 1, + 1, + 1 + ], + "NumberOfFormula": [ + 1, + 1 + ], + "Volume": [ + 30 + ], + "DistanceOfIon": [ + [ + 1.48, + 1.44, + 1.59 + ], + [ + 1.44, + 1.41, + 1.56 + ], + [ + 1.59, + 1.56, + 1.7 + ] + ], + "PsoRatio": [ + 0.6 + ], + "PopSize": [ + 500 + ], + "MaxStep": [ + 3 + ], + "ICode": [ + 1 + ], + "Split": "T", + "VSC": "T", + "MaxNumAtom": [ + 31 + ], + "CtrlRange": [ + [ + 1, + 10 + ], + [ + 1, + 10 + ], + [ + 1, + 10 + ] + ] + }, + { + "times": [ + 1 + ], + "NameOfAtoms": [ + "Mg", + "Al" + ], + "NumberOfAtoms": [ + 1, + 1 + ], + "NumberOfFormula": [ + 1, + 1 + ], + "Volume": [ + 30 + ], + "DistanceOfIon": [ + [ + 1.48, + 1.44 + ], + [ + 1.44, + 1.41 + ] + ], + "PsoRatio": [ + 0.6 + ], + "PopSize": [ + 500 + ], + "MaxStep": [ + 3 + ], + "ICode": [ + 1 + ], + "Split": "T" + }, + { + "times": [ + 3 + ], + "NameOfAtoms": [ + "Al", + "Cu" + ], + "NumberOfAtoms": [ + 1, + 10 + ], + "NumberOfFormula": [ + 1, + 2 + ], + "Volume": [ + 300 + ], + "DistanceOfIon": [ + [ + 1.48, + 1.44 + ], + [ + 1.44, + 1.41 + ] + ], + "PsoRatio": [ + 0.6 + ], + "PopSize": [ + 5 + ], + "MaxStep": [ + 3 + ], + "ICode": [ + 1 + ], + "Split": "T" + }, + { + "times": [ + 2 + ], + "NameOfAtoms": [ + "Mg", + "Al", + "Cu" + ], + "NumberOfAtoms": [ + 1, + 1, + 1 + ], + "NumberOfFormula": [ + 1, + 1 + ], + "Volume": [ + 30 + ], + "DistanceOfIon": [ + [ + 1.48, + 1.44, + 1.59 + ], + [ + 1.44, + 1.41, + 1.56 + ], + [ + 1.59, + 1.56, + 1.7 + ] + ], + "PsoRatio": [ + 0.6 + ], + "PopSize": [ + 5 + ], + "MaxStep": [ + 1 + ], + "ICode": [ + 1 + ], + "Split": "T", + "VSC": "T", + "MaxNumAtom": [ + 31 + ], + "CtrlRange": [ + [ + 1, + 10 + ], + [ + 1, + 10 + ], + [ + 1, + 10 + ] + ], + "PSTRESS": [ + 0 + ], + "fmax": [ + 0.01 + ] + }, + { + "times": [ + 4 + ], + "NameOfAtoms": [ + "Mg", + "Al", + "Cu" + ], + "NumberOfAtoms": [ + 1, + 1, + 1 + ], + "NumberOfFormula": [ + 1, + 1 + ], + "Volume": 30, + "DistanceOfIon": [ + [ + 1.48, + 1.44, + 1.59 + ], + [ + 1.44, + 1.41, + 1.56 + ], + [ + 1.59, + 1.56, + 1.7 + ] + ], + "PsoRatio": 0.6, + "PopSize": 5, + "MaxStep": 1, + "ICode": 1, + "Split": "T", + "VSC": "T", + "MaxNumAtom": 31, + "CtrlRange": [ + [ + 1, + 10 + ], + [ + 1, + 10 + ], + [ + 1, + 10 + ] + ], + "PSTRESS": [ + 0, + 400 + ], + "fmax": 0.01 + } ], - "fp_style": "vasp", "shuffle_poscar": false, "fp_task_max": 10, "fp_task_min": 1, "fp_pp_path": "/home/zhenyu/workplace/dpgen/AA-2400/vasp_input", "fp_pp_files": [ - "POTCAR.Mg", + "POTCAR.Mg", "POTCAR.Al", "POTCAR.Cu" ], - "fp_incar":"/home/zhenyu/workplace/dpgen/AA-2400/vasp_input/INCAR" + "fp_incar": "/home/zhenyu/workplace/dpgen/AA-2400/vasp_input/INCAR" } diff --git a/examples/run/dp-lammps-enhance_sampling/param.json b/examples/run/dp-lammps-enhance_sampling/param.json index f63d04985..6bfb043a1 100644 --- a/examples/run/dp-lammps-enhance_sampling/param.json +++ b/examples/run/dp-lammps-enhance_sampling/param.json @@ -1,126 +1,223 @@ { - "type_map": ["C", "H"], - "mass_map": [12.0, 1.0], - - "_comment": "initial data set for Training and the number of frames in each training batch", - "init_data_prefix": "someplace/tutorial-dpgen-enhance", - "init_data_sys": [ - "raw_file" - ], - "init_batch_size": [ - 4 - ], - - "_comment": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", - "sys_configs_prefix": "someplace/tutorial-dpgen-enhance", - "sys_configs": [ - [ - "configs/POSCAR_[0-9]" + "type_map": [ + "C", + "H" ], - [ - "configs/POSCAR_0" - ] - ], - - "_comment": " 00.train ", - "numb_models": 4, - "training_init_model": true, - "training_reuse_iter": 1, - "training_reuse_old_ratio": 0.2, - "training_reuse_stop_batch": 100000, - "training_reuse_start_lr": 0.0001, - "training_reuse_start_pref_e": 0.1, - "training_reuse_start_pref_f": 200, - "default_training_param": { - "model": { - "type_map": ["C","H"], - "descriptor": { - "type": "se_a", - "sel": [2,6], - "rcut_smth": 0.5, - "rcut": 5.0, - "neuron": [20,40,80], - "resnet_dt": false, - "axis_neuron": 6, - "seed": 0 - }, - "fitting_net": { - "neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 1, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 500, - "decay_rate": 0.95 + "mass_map": [ + 12.0, + 1.0 + ], + "_comment1": "initial data set for Training and the number of frames in each training batch", + "init_data_prefix": "someplace/tutorial-dpgen-enhance", + "init_data_sys": [ + "raw_file" + ], + "init_batch_size": [ + 4 + ], + "_comment2": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", + "sys_configs_prefix": "someplace/tutorial-dpgen-enhance", + "sys_configs": [ + [ + "configs/POSCAR_[0-9]" + ], + [ + "configs/POSCAR_0" + ] + ], + "_comment3": " 00.train ", + "numb_models": 4, + "training_init_model": true, + "training_reuse_iter": 1, + "training_reuse_old_ratio": 0.2, + "training_reuse_stop_batch": 100000, + "training_reuse_start_lr": 0.0001, + "training_reuse_start_pref_e": 0.1, + "training_reuse_start_pref_f": 200, + "default_training_param": { + "model": { + "type_map": [ + "C", + "H" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 2, + 6 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "neuron": [ + 20, + 40, + 80 + ], + "resnet_dt": false, + "axis_neuron": 6, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 1, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 500, + "stop_lr": 1.2286894111517773e-12 + }, + "training": { + "stop_batch": 200000, + "seed": 1, + "_comment4": "frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 100, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - "training": { - "systems": [], - "set_prefix": "set", - "stop_batch": 200000, - "batch_size": 1, - "seed": 1, - "_comment": "frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 100, - "numb_test": 10, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - - "_comment": " 01.model_devi ", - "model_devi_dt": 0.0005, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.08, - "model_devi_f_trust_hi": 0.25, - "model_devi_clean_traj": false, - "model_devi_plumed" : true, - "model_devi_jobs": [ - { "sys_idx": [0],"trj_freq": 10,"_idx": "00", - "template":{ "lmp": "lmp/input.lammps", "plm": "lmp/input.plumed" }, - "rev_mat":{ "lmp": {"V_NSTEPS": [20000], "V_TEMP": [300], "V_PRES": [1]}, - "plm": {"V_TEMP": [300], "V_STRIDE": [10]} - } + "_comment5": " 01.model_devi ", + "model_devi_dt": 0.0005, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.08, + "model_devi_f_trust_hi": 0.25, + "model_devi_clean_traj": false, + "model_devi_plumed": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "trj_freq": 10, + "_idx": "00", + "template": { + "lmp": "lmp/input.lammps", + "plm": "lmp/input.plumed" + }, + "rev_mat": { + "lmp": { + "V_NSTEPS": [ + 20000 + ], + "V_TEMP": [ + 300 + ], + "V_PRES": [ + 1 + ] + }, + "plm": { + "V_TEMP": [ + 300 + ], + "V_STRIDE": [ + 10 + ] + } + } }, - { "sys_idx": [0],"trj_freq": 10,"_idx": "01", - "template":{ "lmp": "lmp/input.lammps", "plm": "lmp/input.plumed" }, - "rev_mat":{ "lmp": {"V_NSTEPS": [50000], "V_TEMP": [300], "V_PRES": [1]}, - "plm": {"V_TEMP": [300], "V_STRIDE": [10]} - } + { + "sys_idx": [ + 0 + ], + "trj_freq": 10, + "_idx": "01", + "template": { + "lmp": "lmp/input.lammps", + "plm": "lmp/input.plumed" + }, + "rev_mat": { + "lmp": { + "V_NSTEPS": [ + 50000 + ], + "V_TEMP": [ + 300 + ], + "V_PRES": [ + 1 + ] + }, + "plm": { + "V_TEMP": [ + 300 + ], + "V_STRIDE": [ + 10 + ] + } + } }, - { "sys_idx": [1],"trj_freq": 10,"_idx": "01", - "template":{ "lmp": "lmp/input.lammps", "plm": "lmp/input.plumed" }, - "rev_mat":{ "lmp": {"V_NSTEPS": [300000], "V_TEMP": [300], "V_PRES": [1]}, - "plm": {"V_TEMP": [300], "V_STRIDE": [10]} - } + { + "sys_idx": [ + 1 + ], + "trj_freq": 10, + "_idx": "01", + "template": { + "lmp": "lmp/input.lammps", + "plm": "lmp/input.plumed" + }, + "rev_mat": { + "lmp": { + "V_NSTEPS": [ + 300000 + ], + "V_TEMP": [ + 300 + ], + "V_PRES": [ + 1 + ] + }, + "plm": { + "V_TEMP": [ + 300 + ], + "V_STRIDE": [ + 10 + ] + } + } } - ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 150, - "_comment": "the maximum number of stcs to calc.", - "fp_task_min": 5, - "fp_pp_path": "./", - "fp_pp_files": ["POTCAR_C", "POTCAR_H"], - "fp_incar" : "INCAR", - "_comment": " that's all " + ], + "_comment6": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 150, + "_comment7": "the maximum number of stcs to calc.", + "fp_task_min": 5, + "fp_pp_path": "./", + "fp_pp_files": [ + "POTCAR_C", + "POTCAR_H" + ], + "fp_incar": "INCAR", + "_comment8": " that's all " } diff --git a/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/machine.json b/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/machine.json deleted file mode 100644 index 0bc72e8b2..000000000 --- a/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/machine.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "api_version": "1.0", - "train": [ - { - "command": "dp", - "machine": { - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 1, - "custom_flags":["#SBATCH --mem=32G"], - "strategy": {"if_cuda_multi_devices": true}, - "para_deg": 3, - "source_list": ["/home/user1234/deepmd.1.2.4.env"] - } - } - ], - "model_devi":[ - { - "command": "lmp", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 5, - "source_list": ["/home/user1234/deepmd.1.2.4.env"] - } - } - ], - "fp":[ - { - "command": "ABACUS.mpi", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "G_32_128", - "group_size": 1, - "source_list": ["~/abacus.env"] - } - } - ] - } diff --git a/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/param.json b/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/param.json deleted file mode 100644 index 1af3ae951..000000000 --- a/examples/run/dp1.x-lammps-ABACUS-lcao-dpks/methane/param.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "type_map": ["H", "C"], - "mass_map": [1.0, 12.0], - - "_comment": "initial data set for Training and the number of frames in each training batch", - "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", - "init_data_sys": [ - "abacus_init_data" - ], - "init_batch_size": [ - 8 - ], - - "_comment": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", - "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", - "sys_configs": [ - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" - ], - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8 - ], - - "_comment": " 00.train ", - "numb_models": 4, - - "default_training_param": { - "model": { - "type_map": ["H","C"], - "descriptor": { - "type": "se_a", - "sel": [16,4], - "rcut_smth": 0.5, - "rcut": 5.0, - "neuron": [10,20,40], - "resnet_dt": false, - "axis_neuron": 12, - "seed": 0 - }, - "fitting_net": { - "neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 180, - "decay_rate": 0.95 - }, - "training": { - "set_prefix": "set", - "numb_steps": 2000, - "batch_size": 1, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - "_comment": "that's all" - } - }, - - "_comment": " 01.model_devi ", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { - "sys_idx": [ - 0 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 3000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 150 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 9000, - "ensemble": "nvt", - "_idx": "01" - } - ], - - "_comment": " 02.fp ", - "fp_style": "abacus", - "shuffle_poscar": false, - "fp_task_max": 50, - "fp_task_min": 8, - "fp_pp_path": "./", - "fp_pp_files": [ "H_ONCV_PBE-1.0.upf","C_ONCV_PBE-1.0.upf"], - "fp_orb_files": ["H_gga_8au_60Ry_2s1p.orb", "C_gga_8au_60Ry_2s2p1d.orb"], - "fp_dpks_descriptor": "jle.orb", - "user_fp_params":{ - "ntype": 2, - "cal_force": 1, - "cal_stress": 1, - "deepks_model": "model.ptg", - "deepks_out_labels": 1, - "basis_type": "lcao", - "gamma_only": 1, - "ecutwfc": 80, - "mixing_type": "pulay", - "mixing_beta": 0.4, - "symmetry": 1, - "nbands": 5, - "nspin": 1, - "smearing_method": "fixed" - } -} diff --git a/examples/run/dp1.x-lammps-ABACUS-pw/methane/machine.json b/examples/run/dp1.x-lammps-ABACUS-pw/methane/machine.json deleted file mode 100644 index 0bc72e8b2..000000000 --- a/examples/run/dp1.x-lammps-ABACUS-pw/methane/machine.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "api_version": "1.0", - "train": [ - { - "command": "dp", - "machine": { - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 1, - "custom_flags":["#SBATCH --mem=32G"], - "strategy": {"if_cuda_multi_devices": true}, - "para_deg": 3, - "source_list": ["/home/user1234/deepmd.1.2.4.env"] - } - } - ], - "model_devi":[ - { - "command": "lmp", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 5, - "source_list": ["/home/user1234/deepmd.1.2.4.env"] - } - } - ], - "fp":[ - { - "command": "ABACUS.mpi", - "machine":{ - "batch_type": "PBS", - "context_type": "SSHContext", - "local_root": "./", - "remote_root": "/home/user1234/work_path_dpdispatcher_test", - "remote_profile": { - "hostname": "39.xxx.xx.xx", - "username": "user1234" - } - }, - "resources": { - "number_node": 1, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "G_32_128", - "group_size": 1, - "source_list": ["~/abacus.env"] - } - } - ] - } diff --git a/examples/run/dp1.x-lammps-ABACUS-pw/methane/param.json b/examples/run/dp1.x-lammps-ABACUS-pw/methane/param.json deleted file mode 100644 index a6cf0eb30..000000000 --- a/examples/run/dp1.x-lammps-ABACUS-pw/methane/param.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "type_map": ["H", "C"], - "mass_map": [1.0, 12.0], - - "_comment": "initial data set for Training and the number of frames in each training batch", - "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", - "init_data_sys": [ - "abacus_init_data" - ], - "init_batch_size": [ - 8 - ], - - "_comment": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", - "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", - "sys_configs": [ - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" - ], - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8 - ], - - "_comment": " 00.train ", - "numb_models": 4, - - "default_training_param": { - "model": { - "type_map": ["H","C"], - "descriptor": { - "type": "se_a", - "sel": [16,4], - "rcut_smth": 0.5, - "rcut": 5.0, - "neuron": [10,20,40], - "resnet_dt": false, - "axis_neuron": 12, - "seed": 0 - }, - "fitting_net": { - "neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 180, - "decay_rate": 0.95 - }, - "training": { - "set_prefix": "set", - "numb_steps": 2000, - "batch_size": 1, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - "_comment": "that's all" - } - }, - - "_comment": " 01.model_devi ", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { - "sys_idx": [ - 0 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 1000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 3000, - "ensemble": "nvt", - "_idx": "01" - } - ], - - "_comment": " 02.fp ", - "fp_style": "abacus", - "shuffle_poscar": false, - "fp_task_max": 30, - "fp_task_min": 8, - "fp_pp_path": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/SG15_ONCV_v1.0_upf", - "fp_pp_files": [ "H_ONCV_PBE-1.0.upf","C_ONCV_PBE-1.0.upf"], - "user_fp_params":{ - "ntype": 2, - "ecutwfc": 80, - "mixing_type": "pulay", - "mixing_beta": 0.4, - "symmetry": 1, - "nbands": 5, - "nspin": 1, - "ks_solver": "cg", - "smearing": "fixed", - "sigma": 0.001 - } -} diff --git a/examples/run/dp1.x-lammps-cp2k/methane/param-ch4.json b/examples/run/dp1.x-lammps-cp2k/methane/param-ch4.json deleted file mode 100644 index bab722abf..000000000 --- a/examples/run/dp1.x-lammps-cp2k/methane/param-ch4.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "type_map": [ - "H", - "C" - ], - "mass_map": [ - 1, - 12 - ], - "init_data_prefix": "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data", - "init_data_sys": [ - "deepmd" - ], - "init_batch_size": [ - 8 - ], - "sys_configs": [ - ["/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR"], - ["/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR"] - ], - "sys_batch_size": [ - 8, - 8, - 8, - 8 - ], - "_comment": " that's all ", - "numb_models": 4, - "default_training_param": { - "model": { - "descriptor": { - "type": "se_a", - "sel": [ - 16, - 4 - ], - "rcut_smth": 0.5, - "rcut": 5.0, - "_comment": "modify according your system", - "neuron": [ - 10, - 20, - 40 - ], - "resnet_dt": false, - "axis_neuron": 12, - "seed": 1 - }, - "fitting_net": { - "neuron": [ - 120, - 120, - 120 - ], - "resnet_dt": true, - "seed": 1 - }}, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 100, - "_comment": "nope", - "decay_rate": 0.95 - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0 - }, - "training": { - "systems": [ ], - "set_prefix": "set", - "stop_batch": 2000, - "batch_size": 1, - "seed": 1, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": true, - "model_devi_jobs": [ - { - "sys_idx": [ - 0 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 300, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 100 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 3000, - "ensemble": "nvt", - "_idx": "01" - } - - ], - "fp_style": "cp2k", - "shuffle_poscar": false, - "fp_task_max": 20, - "fp_task_min": 5, - "external_input_path": "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/cp2k_dpgen/template.inp" -} diff --git a/examples/run/dp1.x-lammps-vasp-et/param_elet.json b/examples/run/dp1.x-lammps-vasp-et/param_elet.json deleted file mode 100644 index cc0f4a962..000000000 --- a/examples/run/dp1.x-lammps-vasp-et/param_elet.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "type_map": ["Al", "Mg"], - "mass_map": [27, 24], - "use_ele_temp": 2, - - "init_data_prefix": "/home/wanghan/study/deep.md/data/almgop.20/init//", - - "init_data_sys": [ - "al.fcc.01x01x01/02.md/sys-0004/deepmd", - "mg.fcc.01x01x01/02.md/sys-0004/deepmd" - ], - "sys_configs": [ - ["/home/wanghan/study/deep.md/data/almgop.20/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"], - ["/home/wanghan/study/deep.md/data/almgop.20/init/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"] - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "model" : { - "descriptor": { - "type": "se_a", - "sel": [90, 90], - "rcut_smth": 1.80, - "rcut": 6.00, - "neuron": [10, 20, 40], - "resnet_dt": false, - "axis_neuron": 4, - "seed": 1 - }, - "fitting_net" : { - "neuron": [120, 120, 120], - "resnet_dt": true, - "numb_fparam": 10, - "seed": 1 - } - }, - - "loss" : { - "start_pref_e": 0.02, - "limit_pref_e": 1, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - - "learning_rate" : { - "start_lr": 0.001, - "decay_steps": 5000, - "decay_rate": 0.95 - }, - - "_comment": " traing controls", - "training" : { - "systems": [], - "set_prefix": "set", - "stop_batch": 1000, - "batch_size": 1, - - "seed": 1, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training":true, - "time_training":true, - "profiling": false, - "profiling_file": "timeline.json" - }, - "_comment": "that's all" - }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { "_idx": 0, "ensemble": "npt", "nsteps": 50, "press": [1.0,2.0], "sys_idx": [0, 1], "temps": [50,100], "trj_freq": 10 } - ], - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 8, - "fp_task_min": 2, - "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", - "fp_pp_files": ["POTCAR.Al", "POTCAR.Mg"], - "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", - "_comment": " that's all " -} diff --git a/examples/run/dp1.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-1.1.0.json b/examples/run/dp1.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-1.1.0.json deleted file mode 100644 index 4b4d92ba2..000000000 --- a/examples/run/dp1.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-1.1.0.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "type_map": ["Al"], - "mass_map": [27], - - "init_data_prefix": "/data1/yfb222333/2_dpgen_gpu_multi/init/", - - "init_data_sys": [ - "al.fcc.02x02x02/02.md/sys-0032/deepmd", - "al.hcp.02x02x02/02.md/sys-0016/deepmd", - "al.bcc.02x02x02/02.md/sys-0016/deepmd" - ], - "sys_configs": [ - - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[5-9]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00001*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00002*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00003*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00004*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00005*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00006*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00007*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00008*/POSCAR"], - - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR"], - - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR"], - ["/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", - "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR"] - ], - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "model":{ - "_comment": " model parameters", - "type_map":["Al"], - "descriptor":{ - "type": "se_a", - "sel": [300], - "rcut_smth": 2.00, - "rcut": 8.00, - "neuron": [240, 240, 240], - "resnet_dt": true, - "axis_neuron": 12, - "seed": 1 -}, - "fitting_net":{ - "neuron": [25, 50, 100], - "resnet_dt": false, - "sedd": 1 -}}, - "learning_rate":{ - "type": "exp", - "start_lr": 0.001, - "decay_steps": 2000, - "decay_rate": 0.95 -}, - "loss":{ - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0 -}, - "training":{ - "coord_norm": true, - "type_fitting_net": false, - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 20000, - "batch_size": 1, - "seed": 0, - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 4, - "save_freq": 2000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - "_comment": "that's all"} - }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": -[ - { - "_idx": 0, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 0, - 8, - 16 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 1, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 1, - 9, - 17 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 2, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 2, - 10, - 18 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 3, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 3, - 11, - 19 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 4, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 4, - 12, - 20 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 5, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 5, - 13, - 21 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 6, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 6, - 14, - 22 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 7, - "ensemble": "npt", - "nsteps": 3000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 7, - 15, - 23 - ], - "temps": [ - 50, - 132.0, - 198.0, - 264.0 - ], - "trj_freq": 10 - }, - { - "_idx": 8, - "ensemble": "npt", - "nsteps": 1000, - "press": [ - 1.0, - 10.0, - 100.0, - 1000.0, - 5000.0, - 10000.0, - 20000.0, - 50000.0 - ], - "sys_idx": [ - 0, - 8, - 16 - ], - "temps": [ - 330.0, - 396.0, - 462.0, - 528.0, - 594.0 - ], - "trj_freq": 10 - } -], - - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 300, - "fp_task_min": 5, - "fp_pp_path": "/data1/yfb222333/2_dpgen_gpu_multi/POTCAR-Al", - "fp_pp_files": ["POTCAR"], - "fp_incar": "/data1/yfb222333/2_dpgen_gpu_multi/INCAR_metal_scf_gpu", - "_comment": " that's all " -} diff --git a/examples/run/dp1.x_lammps_gaussian/dodecane/dodecane.json b/examples/run/dp1.x_lammps_gaussian/dodecane/dodecane.json deleted file mode 100644 index b6f80d142..000000000 --- a/examples/run/dp1.x_lammps_gaussian/dodecane/dodecane.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "type_map": ["C", "H"], - "mass_map": [12.011, 1.008], - "init_data_prefix": "/home/jzzeng/0719dodecane/gen/", - "init_data_sys": ["init_data"], - "sys_configs": [ - ["/home/jzzeng/0719dodecane/gen/data.dodecane.atomic"] - ], - "sys_format":"lammps/lmp", - "numb_models": 4, - "default_training_param" : { - "model":{ - "type_map": ["C","H"], - "descriptor":{ - "type":"se_a", - "sel": [40, 80], - "rcut_smth": 1.00, - "rcut": 6.00, - "neuron": [25, 50, 100], - "resnet_dt": false, - "axis_neuron": 12 - }, - "fitting_net":{ - "neuron": [240, 240, 240], - "resnet_dt": true - } - }, - "learning_rate":{ - "type": "exp", - "start_lr": 0.001, - "decay_steps": 400, - "decay_rate": 0.99 - }, - "loss":{ - "start_pref_e": 0.02, - "limit_pref_e": 1, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0, - "start_pref_pf": 0, - "limit_pref_pf": 0 - }, - "training":{ - "set_prefix": "set", - "stop_batch": 400000, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - "use_clusters": true, - "cluster_cutoff": 3.5, - "cluster_minify": true, - "use_relative": true, - "epsilon": 1.0, - "model_devi_dt": 0.0001, - "model_devi_skip": 100, - "model_devi_f_trust_lo": 0.20, - "model_devi_f_trust_hi": 0.45, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0], "temps": [ 3000], "trj_freq": 10, "nsteps": 2000, "ensemble": "nvt", "_idx": "00"}, - {"sys_idx": [0], "temps": [ 3000], "trj_freq": 10, "nsteps": 4000, "ensemble": "nvt", "_idx": "01"}, - {"sys_idx": [0], "temps": [ 3000], "trj_freq": 10, "nsteps": 8000, "ensemble": "nvt", "_idx": "02"}, - {"sys_idx": [0], "temps": [ 3000], "trj_freq": 10, "nsteps": 16000, "ensemble": "nvt", "_idx": "03"} - ], - "fp_style": "gaussian", - "shuffle_poscar": false, - "fp_task_max": 1000, - "fp_task_min": 10, - "fp_params": { - "keywords": "force mn15/6-31g**", - "nproc": 4, - "multiplicity": "auto" - } -} diff --git a/examples/run/dp2.x-gromacs-gaussian/param.json b/examples/run/dp2.x-gromacs-gaussian/param.json index 86561e34a..3371cda38 100644 --- a/examples/run/dp2.x-gromacs-gaussian/param.json +++ b/examples/run/dp2.x-gromacs-gaussian/param.json @@ -1,157 +1,281 @@ { - "type_map": ["H", "C", "N", "O", "F", "S", "Cl"], - "mass_map": [2, 12, 14, 16, 17, 32, 35], - "init_data_prefix": "/path/to/init/data", - "init_data_sys": ["data.init"], - "sys_configs_prefix": "/path/to/model/devi/data", - "sys_configs": [ - ["model_devi/CHEMBL3402749_500"], - ["model_devi/CHEMBL3402741_400"], - ["model_devi/CHEMBL3402748_5300"], - ["model_devi/CHEMBL3402743_42"], - ["model_devi/CHEMBL3402761_1"], - ["model_devi/CHEMBL3402756_2.7"], - ["model_devi/CHEMBL3402750_400"], - ["model_devi/CHEMBL3402764_90"], - ["model_devi/CHEMBL3402758_10"], - ["model_devi/CHEMBL3402754_40"], - ["model_devi/CHEMBL3402747_3400"], - ["model_devi/CHEMBL3402762_1"], - ["model_devi/CHEMBL3402744_300"], - ["model_devi/CHEMBL3402752_30000"], - ["model_devi/CHEMBL3402742_23"], - ["model_devi/CHEMBL3402759_5.7"], - ["model_devi/CHEMBL3402745_200"], - ["model_devi/CHEMBL3402757_6.5"], - ["model_devi/CHEMBL3402755_4200"], - ["model_devi/CHEMBL3402751_2100"], - ["model_devi/CHEMBL3402753_200"], - ["model_devi/CHEMBL3402763_90"], - ["model_devi/CHEMBL3402765_11-charged-pKa-8.1"], - ["model_devi/CHEMBL3402760_1"] - ], - "sys_charges": [ - 0, - 1, - 0, - 1, - 0, - 1, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 1, - 0, - 1, - 0, - 0, - 0, - 1, - 1, - 1 - ], - "sys_format": "gromacs/gro", - "numb_models": 4, - "training_reuse_iter": 1, - "training_reuse_old_ratio": 0.3, - "training_reuse_start_lr": 0.0001, - "training_reuse_decay_steps": 500, - "training_reuse_numb_steps": 200000, - "training_reuse_start_pref_e": 1, - "training_reuse_start_pref_f": 100, - "train_param": "input.json", - "default_training_param": { - "model": { - "type_map": ["H", "C", "N", "O", "F", "S", "Cl"], - "descriptor": { - "type": "se_e2_a", - "sel": [40, 48, 48, 48, 48, 48, 48], - "rcut_smth": 0.50, - "rcut": 6.00, - "neuron": [25, 50, 100], - "resnet_dt": false, - "axis_neuron": 16, - "type_one_side": true - }, - "fitting_net": { - "neuron": [240, 240, 240], - "resnet_dt": true, - "type": "ener" - } + "type_map": [ + "H", + "C", + "N", + "O", + "F", + "S", + "Cl" + ], + "mass_map": [ + 2, + 12, + 14, + 16, + 17, + 32, + 35 + ], + "init_data_prefix": "/path/to/init/data", + "init_data_sys": [ + "data.init" + ], + "sys_configs_prefix": "/path/to/model/devi/data", + "sys_configs": [ + [ + "model_devi/CHEMBL3402749_500" + ], + [ + "model_devi/CHEMBL3402741_400" + ], + [ + "model_devi/CHEMBL3402748_5300" + ], + [ + "model_devi/CHEMBL3402743_42" + ], + [ + "model_devi/CHEMBL3402761_1" + ], + [ + "model_devi/CHEMBL3402756_2.7" + ], + [ + "model_devi/CHEMBL3402750_400" + ], + [ + "model_devi/CHEMBL3402764_90" + ], + [ + "model_devi/CHEMBL3402758_10" + ], + [ + "model_devi/CHEMBL3402754_40" + ], + [ + "model_devi/CHEMBL3402747_3400" + ], + [ + "model_devi/CHEMBL3402762_1" + ], + [ + "model_devi/CHEMBL3402744_300" + ], + [ + "model_devi/CHEMBL3402752_30000" + ], + [ + "model_devi/CHEMBL3402742_23" + ], + [ + "model_devi/CHEMBL3402759_5.7" + ], + [ + "model_devi/CHEMBL3402745_200" + ], + [ + "model_devi/CHEMBL3402757_6.5" + ], + [ + "model_devi/CHEMBL3402755_4200" + ], + [ + "model_devi/CHEMBL3402751_2100" + ], + [ + "model_devi/CHEMBL3402753_200" + ], + [ + "model_devi/CHEMBL3402763_90" + ], + [ + "model_devi/CHEMBL3402765_11-charged-pKa-8.1" + ], + [ + "model_devi/CHEMBL3402760_1" + ] + ], + "sys_charges": [ + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1 + ], + "sys_format": "gromacs/gro", + "numb_models": 4, + "training_reuse_iter": 1, + "training_reuse_old_ratio": 0.3, + "training_reuse_start_lr": 0.0001, + "training_reuse_decay_steps": 500, + "training_reuse_numb_steps": 200000, + "training_reuse_start_pref_e": 1, + "training_reuse_start_pref_f": 100, + "train_param": "input.json", + "default_training_param": { + "model": { + "type_map": [ + "H", + "C", + "N", + "O", + "F", + "S", + "Cl" + ], + "descriptor": { + "type": "se_e2_a", + "sel": [ + 40, + 48, + 48, + 48, + 48, + 48, + 48 + ], + "rcut_smth": 0.5, + "rcut": 6.0, + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "axis_neuron": 16, + "type_one_side": true + }, + "fitting_net": { + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true, + "type": "ener" + } + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 5000 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 8, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "training": { + "numb_steps": 1000000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt" + } }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 5000 + "model_devi_engine": "gromacs", + "gromacs_settings": { + "mdp_filename": "md.mdp", + "topol_filename": "processed.top", + "conf_filename": "npt.gro", + "index_filename": "index.raw", + "ref_filename": "em.tpr", + "model_devi_script": "model_devi.py", + "traj_filename": "deepmd_traj.gro", + "group_name": "Other" }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 8, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "training": { - "numb_steps": 1000000, - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt" - } - }, - "model_devi_engine": "gromacs", - "gromacs_settings": { - "mdp_filename": "md.mdp", - "topol_filename": "processed.top", - "conf_filename": "npt.gro", - "index_filename": "index.raw", - "ref_filename": "em.tpr", - "model_devi_script": "model_devi.py", - "traj_filename": "deepmd_traj.gro", - "group_name": "Other" - }, - "model_devi_dt": 0.001, - "model_devi_f_trust_lo": 0.20, - "model_devi_f_trust_hi": 0.60, - "model_devi_clean_traj": false, - "model_devi_skip": 0, - "model_devi_nopbc": true, - "model_devi_activation_func": [ - ["tanh", "tanh"], - ["tanh", "tanh"], - ["tanh", "tanh"], - ["tanh", "tanh"] - ], - "model_devi_jobs": [ - { - "_idx": 0, - "ensemble": "nvt", - "nsteps": 100, - "press": [], - "sys_idx": [ 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23], - "temps": [], - "trj_freq": 1 + "model_devi_dt": 0.001, + "model_devi_f_trust_lo": 0.2, + "model_devi_f_trust_hi": 0.6, + "model_devi_clean_traj": false, + "model_devi_skip": 0, + "model_devi_nopbc": true, + "model_devi_activation_func": [ + [ + "tanh", + "tanh" + ], + [ + "tanh", + "tanh" + ], + [ + "tanh", + "tanh" + ], + [ + "tanh", + "tanh" + ] + ], + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "nvt", + "nsteps": 100, + "press": [], + "sys_idx": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "temps": [], + "trj_freq": 1 + } + ], + "fp_style": "gaussian", + "shuffle_poscar": false, + "fp_task_max": 50, + "fp_task_min": 1, + "fp_pp_path": "./", + "fp_pp_files": [], + "fp_params": { + "keywords": "force m062x/6-31** nosymm", + "nproc": 28, + "multiplicity": 1 } - ], - "fp_style": "gaussian", - "shuffle_poscar": false, - "fp_task_max": 50, - "fp_task_min": 1, - "fp_pp_path": "./", - "fp_pp_files": [], - "fp_params": { - "keywords": "force m062x/6-31** nosymm", - "nproc": 28, - "multiplicity": 1 - } } diff --git a/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/machine.json b/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/machine.json new file mode 100644 index 000000000..0ff483640 --- /dev/null +++ b/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/machine.json @@ -0,0 +1,85 @@ +{ + "api_version": "1.0", + "train": [ + { + "command": "dp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 1, + "custom_flags": [ + "#SBATCH --mem=32G" + ], + "strategy": { + "if_cuda_multi_devices": true + }, + "para_deg": 3, + "source_list": [ + "/home/user1234/deepmd.1.2.4.env" + ] + } + } + ], + "model_devi": [ + { + "command": "lmp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 5, + "source_list": [ + "/home/user1234/deepmd.1.2.4.env" + ] + } + } + ], + "fp": [ + { + "command": "ABACUS.mpi", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "G_32_128", + "group_size": 1, + "source_list": [ + "~/abacus.env" + ] + } + } + ] +} diff --git a/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/param.json b/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/param.json new file mode 100644 index 000000000..6f99f4ae2 --- /dev/null +++ b/examples/run/dp2.x-lammps-ABACUS-lcao-dpks/methane/param.json @@ -0,0 +1,171 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1.0, + 12.0 + ], + "_comment1": "initial data set for Training and the number of frames in each training batch", + "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", + "init_data_sys": [ + "abacus_init_data" + ], + "init_batch_size": [ + 8 + ], + "_comment2": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", + "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", + "sys_configs": [ + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + ], + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "type_map": [ + "H", + "C" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 12, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 180, + "stop_lr": 0.0005655675757628467 + }, + "training": { + "numb_steps": 2000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "_comment4": "that's all", + "training_data": { + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment5": " 01.model_devi ", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 150 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 9000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment6": " 02.fp ", + "fp_style": "abacus", + "shuffle_poscar": false, + "fp_task_max": 50, + "fp_task_min": 8, + "fp_pp_path": "./", + "fp_pp_files": [ + "H_ONCV_PBE-1.0.upf", + "C_ONCV_PBE-1.0.upf" + ], + "fp_orb_files": [ + "H_gga_8au_60Ry_2s1p.orb", + "C_gga_8au_60Ry_2s2p1d.orb" + ], + "fp_dpks_descriptor": "jle.orb", + "user_fp_params": { + "ntype": 2, + "cal_force": 1, + "cal_stress": 1, + "deepks_model": "model.ptg", + "deepks_out_labels": 1, + "basis_type": "lcao", + "gamma_only": 1, + "ecutwfc": 80, + "mixing_type": "pulay", + "mixing_beta": 0.4, + "symmetry": 1, + "nbands": 5, + "nspin": 1, + "smearing_method": "fixed" + } +} diff --git a/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/machine.json b/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/machine.json index 21d234673..92e6fba99 100644 --- a/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/machine.json +++ b/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/machine.json @@ -1,103 +1,105 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" : - { - "command": "dp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 200, - "scass_type":"", - "checkpoint_files":["00*/checkpoint","00*/model.ckpt*"], - "checkpoint_time":30, - "platform": "", - "region":"", - "image_name":"", - "on_demand":0 + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": { + "command": "dp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 200, + "scass_type": "", + "checkpoint_files": [ + "00*/checkpoint", + "00*/model.ckpt*" + ], + "checkpoint_time": 30, + "platform": "", + "region": "", + "image_name": "", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 1 } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 1 - } }, - "model_devi": - { - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"", - "platform": "", - "region":"", - "image_name":"", - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "on_demand":0 + "model_devi": { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "", + "platform": "", + "region": "", + "image_name": "", + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 50 } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 50 - } }, - "fp": - { - "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "scass_type":"", - "platform": "", - "image_name":"", - "on_demand":0 + "fp": { + "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "scass_type": "", + "platform": "", + "image_name": "", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 50, + "source_list": [ + "" + ] } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 50, - "source_list": [""] - } } } diff --git a/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/run_param.json b/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/run_param.json index cdfc177a7..59b0f22c9 100644 --- a/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/run_param.json +++ b/examples/run/dp2.x-lammps-ABACUS-lcao/fcc-al/run_param.json @@ -9,14 +9,14 @@ "init_data_sys": [ "Al.STRU.02x01x01/02.md/sys-0008/deepmd" ], - "sys_format":"abacus/stru", + "sys_format": "abacus/stru", "sys_configs_prefix": "./", "sys_configs": [ [ "Al.STRU.02x01x01/01.scale_pert/sys-0008/scale*/00000*/STRU" ] ], - "_comment": " that's all ", + "_comment1": " that's all ", "numb_models": 4, "default_training_param": { "model": { @@ -66,14 +66,13 @@ "stop_batch": 20000, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all" } }, "model_devi_dt": 0.002, @@ -82,29 +81,69 @@ "model_devi_f_trust_hi": 0.15, "model_devi_clean_traj": false, "model_devi_jobs": [ - { "sys_idx": [0], "temps": [100], "press": [1.0], "trj_freq": 10,"nsteps": 300, "ensemble": "nvt", "_idx": "00"}, - { "sys_idx": [0], "temps": [100, 300], "press": [1.0, 100.0], "trj_freq": 10,"nsteps": 300, "ensemble": "nvt", "_idx": "01"} - + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1.0 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 0 + ], + "temps": [ + 100, + 300 + ], + "press": [ + 1.0, + 100.0 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "nvt", + "_idx": "01" + } ], "fp_style": "abacus", "shuffle_poscar": false, "fp_task_max": 20, "fp_task_min": 5, "fp_pp_path": "./", - "fp_pp_files": ["Al_ONCV_PBE-1.0.upf"], - "fp_orb_files": ["Al_gga_9au_100Ry_4s4p1d.orb"], - "k_points": [1,1,1,0,0,0], - "user_fp_params":{ - "ntype": 1, - "symmetry": 0, - "basis_type": "lcao", - "ecutwfc": 100, - "scf_thr": 1e-8, - "scf_nmax": 100, - "smearing_method": "gauss", - "smearing_sigma": 0.002, - "mixing_type": "pulay", - "mixing_beta": 0.3, - "cal_force": 1 - } + "fp_pp_files": [ + "Al_ONCV_PBE-1.0.upf" + ], + "fp_orb_files": [ + "Al_gga_9au_100Ry_4s4p1d.orb" + ], + "k_points": [ + 1, + 1, + 1, + 0, + 0, + 0 + ], + "user_fp_params": { + "ntype": 1, + "symmetry": 0, + "basis_type": "lcao", + "ecutwfc": 100, + "scf_thr": 1e-08, + "scf_nmax": 100, + "smearing_method": "gauss", + "smearing_sigma": 0.002, + "mixing_type": "pulay", + "mixing_beta": 0.3, + "cal_force": 1 + } } diff --git a/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/machine.json b/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/machine.json index 21d234673..92e6fba99 100644 --- a/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/machine.json +++ b/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/machine.json @@ -1,103 +1,105 @@ { - "api_version": "1.0", - "deepmd_version": "2.0.1", - "train" : - { - "command": "dp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 200, - "scass_type":"", - "checkpoint_files":["00*/checkpoint","00*/model.ckpt*"], - "checkpoint_time":30, - "platform": "", - "region":"", - "image_name":"", - "on_demand":0 + "api_version": "1.0", + "deepmd_version": "2.0.1", + "train": { + "command": "dp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 200, + "scass_type": "", + "checkpoint_files": [ + "00*/checkpoint", + "00*/model.ckpt*" + ], + "checkpoint_time": 30, + "platform": "", + "region": "", + "image_name": "", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 1 } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 1 - } }, - "model_devi": - { - "command": "lmp -i input.lammps -v restart 0", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"", - "platform": "", - "region":"", - "image_name":"", - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "on_demand":0 + "model_devi": { + "command": "lmp -i input.lammps -v restart 0", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "", + "platform": "", + "region": "", + "image_name": "", + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 50 } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 50 - } }, - "fp": - { - "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "checkpoint_files": "sync_files", - "checkpoint_time":30, - "scass_type":"", - "platform": "", - "image_name":"", - "on_demand":0 + "fp": { + "command": "OMP_NUM_THREADS=1 mpirun -n 8 abacus", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "checkpoint_files": "sync_files", + "checkpoint_time": 30, + "scass_type": "", + "platform": "", + "image_name": "", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "group_size": 50, + "source_list": [ + "" + ] } - }, - "resources": { - "batch_type": "Lebesgue", - "group_size": 50, - "source_list": [""] - } } } diff --git a/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/run_param.json b/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/run_param.json index 1c492b309..e295f1db0 100644 --- a/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/run_param.json +++ b/examples/run/dp2.x-lammps-ABACUS-pw/fcc-al/run_param.json @@ -9,7 +9,7 @@ "init_data_sys": [ "Al.STRU.02x01x01/02.md/sys-0008/deepmd" ], - "sys_format":"abacus/stru", + "sys_format": "abacus/stru", "sys_configs_prefix": "./", "sys_configs": [ [ @@ -19,7 +19,7 @@ "Al.STRU.02x01x01/01.scale_pert/sys-0008/scale*/000010/STRU" ] ], - "_comment": " 00.train ", + "_comment1": " 00.train ", "numb_models": 4, "default_training_param": { "model": { @@ -69,17 +69,16 @@ "stop_batch": 20000, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all" } }, - "_comment": "01.model_devi ", + "_comment3": "01.model_devi ", "model_devi_dt": 0.002, "model_devi_skip": 0, "model_devi_f_trust_lo": 0.05, diff --git a/examples/run/dp2.x-lammps-ABACUS-pw/methane/machine.json b/examples/run/dp2.x-lammps-ABACUS-pw/methane/machine.json new file mode 100644 index 000000000..0ff483640 --- /dev/null +++ b/examples/run/dp2.x-lammps-ABACUS-pw/methane/machine.json @@ -0,0 +1,85 @@ +{ + "api_version": "1.0", + "train": [ + { + "command": "dp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 1, + "custom_flags": [ + "#SBATCH --mem=32G" + ], + "strategy": { + "if_cuda_multi_devices": true + }, + "para_deg": 3, + "source_list": [ + "/home/user1234/deepmd.1.2.4.env" + ] + } + } + ], + "model_devi": [ + { + "command": "lmp", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 5, + "source_list": [ + "/home/user1234/deepmd.1.2.4.env" + ] + } + } + ], + "fp": [ + { + "command": "ABACUS.mpi", + "machine": { + "batch_type": "PBS", + "context_type": "SSHContext", + "local_root": "./", + "remote_root": "/home/user1234/work_path_dpdispatcher_test", + "remote_profile": { + "hostname": "39.xxx.xx.xx", + "username": "user1234" + } + }, + "resources": { + "number_node": 1, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "G_32_128", + "group_size": 1, + "source_list": [ + "~/abacus.env" + ] + } + } + ] +} diff --git a/examples/run/dp2.x-lammps-ABACUS-pw/methane/param.json b/examples/run/dp2.x-lammps-ABACUS-pw/methane/param.json new file mode 100644 index 000000000..d0ebc40a0 --- /dev/null +++ b/examples/run/dp2.x-lammps-ABACUS-pw/methane/param.json @@ -0,0 +1,162 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1.0, + 12.0 + ], + "_comment1": "initial data set for Training and the number of frames in each training batch", + "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", + "init_data_sys": [ + "abacus_init_data" + ], + "init_batch_size": [ + 8 + ], + "_comment2": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", + "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", + "sys_configs": [ + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + ], + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "type_map": [ + "H", + "C" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 12, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 180, + "stop_lr": 0.0005655675757628467 + }, + "training": { + "numb_steps": 2000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "_comment4": "that's all", + "training_data": { + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment5": " 01.model_devi ", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment6": " 02.fp ", + "fp_style": "abacus", + "shuffle_poscar": false, + "fp_task_max": 30, + "fp_task_min": 8, + "fp_pp_path": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/SG15_ONCV_v1.0_upf", + "fp_pp_files": [ + "H_ONCV_PBE-1.0.upf", + "C_ONCV_PBE-1.0.upf" + ], + "user_fp_params": { + "ntype": 2, + "ecutwfc": 80, + "mixing_type": "pulay", + "mixing_beta": 0.4, + "symmetry": 1, + "nbands": 5, + "nspin": 1, + "ks_solver": "cg", + "smearing": "fixed", + "sigma": 0.001 + } +} diff --git a/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json b/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json new file mode 100644 index 000000000..9f998fb46 --- /dev/null +++ b/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json @@ -0,0 +1,138 @@ +{ + "type_map": [ + "H", + "C" + ], + "mass_map": [ + 1, + 12 + ], + "init_data_prefix": "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 8 + ], + "sys_configs": [ + [ + "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" + ], + [ + "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8, + 8, + 8 + ], + "_comment1": " that's all ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "_comment2": "modify according your system", + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 12, + "seed": 1 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "seed": 1 + } + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 100, + "_comment3": "nope", + "stop_lr": 0.0003584859224085419 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "stop_batch": 2000, + "seed": 1, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": true, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 300, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 100 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "fp_style": "cp2k", + "shuffle_poscar": false, + "fp_task_max": 20, + "fp_task_min": 5, + "external_input_path": "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/cp2k_dpgen/template.inp" +} diff --git a/examples/run/dp1.x-lammps-cp2k/methane/template.inp b/examples/run/dp2.x-lammps-cp2k/methane/template.inp similarity index 100% rename from examples/run/dp1.x-lammps-cp2k/methane/template.inp rename to examples/run/dp2.x-lammps-cp2k/methane/template.inp diff --git a/examples/run/dp2.x-lammps-cp2k/param_CH4_deepmd-kit-2.0.1.json b/examples/run/dp2.x-lammps-cp2k/param_CH4_deepmd-kit-2.0.1.json index df596a6d1..7c7f5acbb 100644 --- a/examples/run/dp2.x-lammps-cp2k/param_CH4_deepmd-kit-2.0.1.json +++ b/examples/run/dp2.x-lammps-cp2k/param_CH4_deepmd-kit-2.0.1.json @@ -19,7 +19,7 @@ "./data/CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" ] ], - "_comment": " that's all ", + "_comment1": " that's all ", "numb_models": 4, "default_training_param": { "model": { @@ -73,14 +73,13 @@ "_batch_size": 1, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all" } }, "model_devi_dt": 0.002, @@ -119,24 +118,32 @@ "ensemble": "nvt", "_idx": "01" } - ], - "ratio_failed": 0.20, + "ratio_failed": 0.2, "fp_style": "cp2k", "shuffle_poscar": false, "fp_task_max": 30, "fp_task_min": 1, - "user_fp_params": { - "FORCE_EVAL":{ - "DFT":{ + "user_fp_params": { + "FORCE_EVAL": { + "DFT": { "BASIS_SET_FILE_NAME": "BASIS_MOLOPT", "POTENTIAL_FILE_NAME": "GTH_POTENTIALS" }, - "SUBSYS":{ - "KIND":{ - "_": ["C","H"], - "POTENTIAL": ["GTH-PBE-q4", "GTH-PBE-q1"], - "BASIS_SET": ["DZVP-MOLOPT-GTH","DZVP-MOLOPT-GTH"] + "SUBSYS": { + "KIND": { + "_": [ + "C", + "H" + ], + "POTENTIAL": [ + "GTH-PBE-q4", + "GTH-PBE-q1" + ], + "BASIS_SET": [ + "DZVP-MOLOPT-GTH", + "DZVP-MOLOPT-GTH" + ] } } } diff --git a/examples/run/dp2.x-lammps-gaussian/machine.json b/examples/run/dp2.x-lammps-gaussian/machine.json index f9f19c37a..450baa944 100644 --- a/examples/run/dp2.x-lammps-gaussian/machine.json +++ b/examples/run/dp2.x-lammps-gaussian/machine.json @@ -1,109 +1,111 @@ { - "api_version": "1.0", - "deepmd_version": "2.1.0", - "train" : - { - "command": "dp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "xxx", - "password": "xxx", - "program_id": 123, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "00*/train.log", - "grouped":true, - "job_name": "dpgen_train_job", - "disk_size": 100, - "scass_type":"c4_m15_1 * NVIDIA T4", - "checkpoint_files":["00*/checkpoint","00*/model.ckpt*"], - "checkpoint_time":30, - "platform": "ali", - "image_name":"LBG_DeePMD-kit_2.1.0_v1", - "on_demand":0 + "api_version": "1.0", + "deepmd_version": "2.1.0", + "train": { + "command": "dp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "xxx", + "password": "xxx", + "program_id": 123, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "00*/train.log", + "grouped": true, + "job_name": "dpgen_train_job", + "disk_size": 100, + "scass_type": "c4_m15_1 * NVIDIA T4", + "checkpoint_files": [ + "00*/checkpoint", + "00*/model.ckpt*" + ], + "checkpoint_time": 30, + "platform": "ali", + "image_name": "LBG_DeePMD-kit_2.1.0_v1", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 1 } - }, - "resources": { - "batch_type": "Lebesgue", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 1 - } }, - "model_devi": - { - "command": "lmp", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "xxx", - "password": "xxx", - "program_id": 123, - "keep_backup":true, - "input_data":{ - "job_type": "indicate", - "log_file": "*/model_devi.log", - "grouped":true, - "job_name": "dpgen_model_devi_job", - "disk_size": 200, - "scass_type":"c4_m15_1 * NVIDIA T4", - "platform": "ali", - "image_name":"LBG_DeePMD-kit_2.1.0_v1", - "on_demand":0 + "model_devi": { + "command": "lmp", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "xxx", + "password": "xxx", + "program_id": 123, + "keep_backup": true, + "input_data": { + "job_type": "indicate", + "log_file": "*/model_devi.log", + "grouped": true, + "job_name": "dpgen_model_devi_job", + "disk_size": 200, + "scass_type": "c4_m15_1 * NVIDIA T4", + "platform": "ali", + "image_name": "LBG_DeePMD-kit_2.1.0_v1", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "number_node": 1, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "T4_4_15", + "group_size": 50 } - }, - "resources": { - "batch_type": "Lebesgue", - "number_node": 1, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "T4_4_15", - "group_size": 50 - } }, - "fp": - { - "command": "g09 < input > output ||:", - "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "xxx", - "password": "xxx", - "program_id": 123, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "task*/fp.log", - "grouped":true, - "job_name": "dpgen_fp_job", - "disk_size": 100, - "scass_type":"c16_m32_cpu", - "platform": "ali", - "image_name":"LBG_Gaussian_09_v2", - "on_demand":0 + "fp": { + "command": "g09 < input > output ||:", + "machine": { + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "xxx", + "password": "xxx", + "program_id": 123, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "task*/fp.log", + "grouped": true, + "job_name": "dpgen_fp_job", + "disk_size": 100, + "scass_type": "c16_m32_cpu", + "platform": "ali", + "image_name": "LBG_Gaussian_09_v2", + "on_demand": 0 + } } + }, + "resources": { + "batch_type": "Lebesgue", + "source_list": [ + "/root/g09.sh" + ], + "number_node": 1, + "cpu_per_node": 16, + "gpu_per_node": 0, + "queue_name": "CPU", + "group_size": 10 } - }, - "resources": { - "batch_type": "Lebesgue", - "source_list": ["/root/g09.sh"], - "number_node": 1, - "cpu_per_node": 16, - "gpu_per_node": 0, - "queue_name": "CPU", - "group_size": 10 - } } } diff --git a/examples/run/dp2.x-lammps-gaussian/param_C4H16N4_deepmd-kit-2.0.1.json b/examples/run/dp2.x-lammps-gaussian/param_C4H16N4_deepmd-kit-2.0.1.json index 4f422fe73..5dac25455 100644 --- a/examples/run/dp2.x-lammps-gaussian/param_C4H16N4_deepmd-kit-2.0.1.json +++ b/examples/run/dp2.x-lammps-gaussian/param_C4H16N4_deepmd-kit-2.0.1.json @@ -11,17 +11,29 @@ ], "init_data_prefix": "./data/deepmd/", "init_data_sys": [ - "data.000","data.001","data.002","data.003","data.004","data.005" + "data.000", + "data.001", + "data.002", + "data.003", + "data.004", + "data.005" + ], + "init_batch_size": [ + "auto", + "auto", + "auto", + "auto", + "auto", + "auto" ], - "init_batch_size": ["auto","auto","auto","auto","auto","auto"], "sys_configs": [ [ "./data/md_sys/data.ch4n2" ] ], - "_comment": " that's all ", + "_comment1": " that's all ", "numb_models": 4, - "sys_format":"lammps/lmp", + "sys_format": "lammps/lmp", "default_training_param": { "model": { "type_map": [ @@ -74,14 +86,13 @@ "_batch_size": 1, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all" } }, "model_devi_dt": 0.002, @@ -120,21 +131,20 @@ "ensemble": "nvt", "_idx": "01" } - ], "use_clusters": true, "cluster_cutoff": 5.0, "cluster_minify": true, "use_relative": true, "epsilon": 1.0, - "ratio_failed": 0.20, + "ratio_failed": 0.2, "fp_style": "gaussian", "shuffle_poscar": false, "fp_task_max": 20, "fp_task_min": 5, - "fp_params":{ - "keywords": "force B3LYP 6-31g(d,p) nosymm", - "nproc":2 , - "multiplicity": "auto" + "fp_params": { + "keywords": "force B3LYP 6-31g(d,p) nosymm", + "nproc": 2, + "multiplicity": "auto" } } diff --git a/examples/run/dp2.x-lammps-vasp-et/param_elet.json b/examples/run/dp2.x-lammps-vasp-et/param_elet.json new file mode 100644 index 000000000..92c34262a --- /dev/null +++ b/examples/run/dp2.x-lammps-vasp-et/param_elet.json @@ -0,0 +1,131 @@ +{ + "type_map": [ + "Al", + "Mg" + ], + "mass_map": [ + 27, + 24 + ], + "use_ele_temp": 2, + "init_data_prefix": "/home/wanghan/study/deep.md/data/almgop.20/init//", + "init_data_sys": [ + "al.fcc.01x01x01/02.md/sys-0004/deepmd", + "mg.fcc.01x01x01/02.md/sys-0004/deepmd" + ], + "sys_configs": [ + [ + "/home/wanghan/study/deep.md/data/almgop.20/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/home/wanghan/study/deep.md/data/almgop.20/init/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ] + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "_comment2": " model parameters", + "model": { + "descriptor": { + "type": "se_a", + "sel": [ + 90, + 90 + ], + "rcut_smth": 1.8, + "rcut": 6.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 4, + "seed": 1 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "numb_fparam": 10, + "seed": 1 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 1, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "start_lr": 0.001, + "decay_steps": 5000, + "stop_lr": 0.0009897937816869885 + }, + "_comment3": " traing controls", + "training": { + "stop_batch": 1000, + "seed": 1, + "_comment4": " display and restart", + "_comment5": " frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + }, + "_comment6": "that's all" + }, + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 50, + "press": [ + 1.0, + 2.0 + ], + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "trj_freq": 10 + } + ], + "_comment9": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 8, + "fp_task_min": 2, + "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", + "fp_pp_files": [ + "POTCAR.Al", + "POTCAR.Mg" + ], + "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", + "_comment10": " that's all " +} diff --git a/examples/run/dp2.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-2.x.json b/examples/run/dp2.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-2.x.json new file mode 100644 index 000000000..25c5f6b2a --- /dev/null +++ b/examples/run/dp2.x-lammps-vasp/Al/param_al_all_gpu-deepmd-kit-2.x.json @@ -0,0 +1,430 @@ +{ + "type_map": [ + "Al" + ], + "mass_map": [ + 27 + ], + "init_data_prefix": "/data1/yfb222333/2_dpgen_gpu_multi/init/", + "init_data_sys": [ + "al.fcc.02x02x02/02.md/sys-0032/deepmd", + "al.hcp.02x02x02/02.md/sys-0016/deepmd", + "al.bcc.02x02x02/02.md/sys-0016/deepmd" + ], + "sys_configs": [ + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00001*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00002*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00003*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00004*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00005*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00006*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00007*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00008*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.hcp.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00000[5-9]/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00001*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00002*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00003*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00004*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00005*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00006*/POSCAR" + ], + [ + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00007*/POSCAR", + "/data1/yfb222333/2_dpgen_gpu_multi/init/al.bcc.02x02x02/01.scale_pert/sys-0016/scale-1.000/00008*/POSCAR" + ] + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "_comment2": " model parameters", + "type_map": [ + "Al" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 300 + ], + "rcut_smth": 2.0, + "rcut": 8.0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true, + "axis_neuron": 12, + "seed": 1 + }, + "fitting_net": { + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "sedd": 1 + } + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 2000, + "stop_lr": 0.0005987369392383787 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "coord_norm": true, + "type_fitting_net": false, + "_comment3": " traing controls", + "stop_batch": 20000, + "seed": 0, + "_comment4": " display and restart", + "_comment5": " frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 2000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "_comment6": "that's all", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 0, + 8, + 16 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 1, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 1, + 9, + 17 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 2, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 2, + 10, + 18 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 3, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 3, + 11, + 19 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 4, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 4, + 12, + 20 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 5, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 5, + 13, + 21 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 6, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 6, + 14, + 22 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 7, + "ensemble": "npt", + "nsteps": 3000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 7, + 15, + 23 + ], + "temps": [ + 50, + 132.0, + 198.0, + 264.0 + ], + "trj_freq": 10 + }, + { + "_idx": 8, + "ensemble": "npt", + "nsteps": 1000, + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 5000.0, + 10000.0, + 20000.0, + 50000.0 + ], + "sys_idx": [ + 0, + 8, + 16 + ], + "temps": [ + 330.0, + 396.0, + 462.0, + 528.0, + 594.0 + ], + "trj_freq": 10 + } + ], + "_comment9": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 300, + "fp_task_min": 5, + "fp_pp_path": "/data1/yfb222333/2_dpgen_gpu_multi/POTCAR-Al", + "fp_pp_files": [ + "POTCAR" + ], + "fp_incar": "/data1/yfb222333/2_dpgen_gpu_multi/INCAR_metal_scf_gpu", + "_comment10": " that's all " +} diff --git a/examples/run/dp1.x-lammps-vasp/CH4/INCAR_methane b/examples/run/dp2.x-lammps-vasp/CH4/INCAR_methane similarity index 100% rename from examples/run/dp1.x-lammps-vasp/CH4/INCAR_methane rename to examples/run/dp2.x-lammps-vasp/CH4/INCAR_methane diff --git a/examples/run/dp1.x-lammps-vasp/CH4/POT_C b/examples/run/dp2.x-lammps-vasp/CH4/POT_C similarity index 100% rename from examples/run/dp1.x-lammps-vasp/CH4/POT_C rename to examples/run/dp2.x-lammps-vasp/CH4/POT_C diff --git a/examples/run/dp1.x-lammps-vasp/CH4/POT_H b/examples/run/dp2.x-lammps-vasp/CH4/POT_H similarity index 100% rename from examples/run/dp1.x-lammps-vasp/CH4/POT_H rename to examples/run/dp2.x-lammps-vasp/CH4/POT_H diff --git a/examples/run/dp1.x-lammps-vasp/CH4/param_CH4_deepmd-kit-1.1.0.json b/examples/run/dp2.x-lammps-vasp/CH4/param_CH4_deepmd-kit-2.x.json similarity index 89% rename from examples/run/dp1.x-lammps-vasp/CH4/param_CH4_deepmd-kit-1.1.0.json rename to examples/run/dp2.x-lammps-vasp/CH4/param_CH4_deepmd-kit-2.x.json index 7925ce3ee..5c094f0fb 100644 --- a/examples/run/dp1.x-lammps-vasp/CH4/param_CH4_deepmd-kit-1.1.0.json +++ b/examples/run/dp2.x-lammps-vasp/CH4/param_CH4_deepmd-kit-2.x.json @@ -20,7 +20,7 @@ "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR" ] ], - "_comment": " that's all ", + "_comment1": " that's all ", "numb_models": 4, "default_training_param": { "model": { @@ -59,7 +59,7 @@ "type": "exp", "start_lr": 0.001, "decay_steps": 100, - "decay_rate": 0.95 + "stop_lr": 0.0003584859224085419 }, "loss": { "start_pref_e": 0.02, @@ -70,20 +70,20 @@ "limit_pref_v": 0.0 }, "training": { - "set_prefix": "set", "stop_batch": 2000, - "batch_size": 1, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all", + "training_data": { + "set_prefix": "set", + "batch_size": 1 + } } }, "model_devi_dt": 0.002, @@ -132,6 +132,6 @@ "POTCAR_H", "POTCAR_C" ], - "_comments" : "We can only provide empty files in public, you should provide valid POTCARS yourself when running DP-GEN", + "_comments": "We can only provide empty files in public, you should provide valid POTCARS yourself when running DP-GEN", "fp_incar": "/data1/yfb222333/2_dpgen_gpu_multi/INCAR_methane" } diff --git a/examples/run/dp2.x-lammps-vasp/param_CH4_deepmd-kit-2.0.1.json b/examples/run/dp2.x-lammps-vasp/param_CH4_deepmd-kit-2.0.1.json index b732f34e9..a59f44f9f 100644 --- a/examples/run/dp2.x-lammps-vasp/param_CH4_deepmd-kit-2.0.1.json +++ b/examples/run/dp2.x-lammps-vasp/param_CH4_deepmd-kit-2.0.1.json @@ -20,7 +20,7 @@ "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale*/00001*/POSCAR" ] ], - "_comment": " that's all ", + "_comment1": " that's all ", "numb_models": 4, "default_training_param": { "model": { @@ -74,14 +74,13 @@ "batch_size": 1, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 4, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, "profiling_file": "timeline.json", - "_comment": "that's all" + "_comment2": "that's all" } }, "model_devi_dt": 0.002, diff --git a/examples/run/dp2.x_lammps_gaussian/dodecane/dodecane.json b/examples/run/dp2.x_lammps_gaussian/dodecane/dodecane.json new file mode 100644 index 000000000..e28574bb9 --- /dev/null +++ b/examples/run/dp2.x_lammps_gaussian/dodecane/dodecane.json @@ -0,0 +1,152 @@ +{ + "type_map": [ + "C", + "H" + ], + "mass_map": [ + 12.011, + 1.008 + ], + "init_data_prefix": "/home/jzzeng/0719dodecane/gen/", + "init_data_sys": [ + "init_data" + ], + "sys_configs": [ + [ + "/home/jzzeng/0719dodecane/gen/data.dodecane.atomic" + ] + ], + "sys_format": "lammps/lmp", + "numb_models": 4, + "default_training_param": { + "model": { + "type_map": [ + "C", + "H" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 40, + 80 + ], + "rcut_smth": 1.0, + "rcut": 6.0, + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "axis_neuron": 12 + }, + "fitting_net": { + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 400, + "stop_lr": 4.317124741065782e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 1, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0, + "start_pref_pf": 0, + "limit_pref_pf": 0 + }, + "training": { + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "set_prefix": "set" + } + } + }, + "use_clusters": true, + "cluster_cutoff": 3.5, + "cluster_minify": true, + "use_relative": true, + "epsilon": 1.0, + "model_devi_dt": 0.0001, + "model_devi_skip": 100, + "model_devi_f_trust_lo": 0.2, + "model_devi_f_trust_hi": 0.45, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 3000 + ], + "trj_freq": 10, + "nsteps": 2000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 0 + ], + "temps": [ + 3000 + ], + "trj_freq": 10, + "nsteps": 4000, + "ensemble": "nvt", + "_idx": "01" + }, + { + "sys_idx": [ + 0 + ], + "temps": [ + 3000 + ], + "trj_freq": 10, + "nsteps": 8000, + "ensemble": "nvt", + "_idx": "02" + }, + { + "sys_idx": [ + 0 + ], + "temps": [ + 3000 + ], + "trj_freq": 10, + "nsteps": 16000, + "ensemble": "nvt", + "_idx": "03" + } + ], + "fp_style": "gaussian", + "shuffle_poscar": false, + "fp_task_max": 1000, + "fp_task_min": 10, + "fp_params": { + "keywords": "force mn15/6-31g**", + "nproc": 4, + "multiplicity": "auto" + } +} diff --git a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/machine.json b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/machine.json index ae25aa061..967735fb5 100644 --- a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/machine.json +++ b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/machine.json @@ -1,113 +1,115 @@ { "api_version": "1.0", - "_comment": "dependent on dpdispatcher 0.4.15", - "train" : - { + "_comment1": "dependent on dpdispatcher 0.4.15", + "train": { "command": "dp", "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "00*/lcurve.out", - "grouped": true, - "job_name": "simplify_MAPbI3-scan_train_job", - "disk_size": 100, - "scass_type":"c8_m32_1 * NVIDIA V100", - "platform": "ali", - "checkpoint_files": ["00*/model.ckpt*", "00*/checkpoint"], - "checkpoint_time": 15, - "image_name":"LBG_DeePMD-kit_2.1.1_v1.1", - "on_demand":0 - } - } + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "00*/lcurve.out", + "grouped": true, + "job_name": "simplify_MAPbI3-scan_train_job", + "disk_size": 100, + "scass_type": "c8_m32_1 * NVIDIA V100", + "platform": "ali", + "checkpoint_files": [ + "00*/model.ckpt*", + "00*/checkpoint" + ], + "checkpoint_time": 15, + "image_name": "LBG_DeePMD-kit_2.1.1_v1.1", + "on_demand": 0 + } + } }, "resources": { - "batch_type": "Lebesgue", - "number_node": 15, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "V100_8_32", - "group_size": 1 + "batch_type": "Lebesgue", + "number_node": 15, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "V100_8_32", + "group_size": 1 } - }, - "model_devi": - { + }, + "model_devi": { "command": "dp", "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "cubic-*/*/md.log", - "grouped": true, - "job_name": "MAPbI3-scan_md_job", - "disk_size": 100, - "scass_type":"c8_m32_1 * NVIDIA V100", - "platform": "ali", - "checkpoint_files": "sync_files", - "checkpoint_time": 15, - "image_name":"LBG_DeePMD-kit_2.1.1_v1.1", - "on_demand":0 - } - } + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "cubic-*/*/md.log", + "grouped": true, + "job_name": "MAPbI3-scan_md_job", + "disk_size": 100, + "scass_type": "c8_m32_1 * NVIDIA V100", + "platform": "ali", + "checkpoint_files": "sync_files", + "checkpoint_time": 15, + "image_name": "LBG_DeePMD-kit_2.1.1_v1.1", + "on_demand": 0 + } + } }, "resources": { - "batch_type": "Lebesgue", - "number_node": 15, - "cpu_per_node": 4, - "gpu_per_node": 1, - "queue_name": "V100_8_32", - "group_size": 10 + "batch_type": "Lebesgue", + "number_node": 15, + "cpu_per_node": 4, + "gpu_per_node": 1, + "queue_name": "V100_8_32", + "group_size": 10 } - }, - "fp": - { + }, + "fp": { "command": "ulimit -m unlimited; ulimit -s unlimited; mpirun -n 32 vasp_std", "machine": { - "batch_type": "Lebesgue", - "context_type": "LebesgueContext", - "local_root" : "./", - "remote_profile":{ - "email": "", - "password": "", - "program_id": 0, - "input_data":{ - "api_version":2, - "job_type": "indicate", - "log_file": "**/fp.log", - "grouped": true, - "job_name": "simplify_MAPbI3-scan_fp_job", - "disk_size": 100, - "scass_type":"c32_m64_cpu", - "platform": "ali", - "checkpoint_files": "sync_files", - "checkpoint_time": 15, - "image_name":"LBG_vasp-5-4-4_v1", - "on_demand":0 - } - } + "batch_type": "Lebesgue", + "context_type": "LebesgueContext", + "local_root": "./", + "remote_profile": { + "email": "", + "password": "", + "program_id": 0, + "input_data": { + "api_version": 2, + "job_type": "indicate", + "log_file": "**/fp.log", + "grouped": true, + "job_name": "simplify_MAPbI3-scan_fp_job", + "disk_size": 100, + "scass_type": "c32_m64_cpu", + "platform": "ali", + "checkpoint_files": "sync_files", + "checkpoint_time": 15, + "image_name": "LBG_vasp-5-4-4_v1", + "on_demand": 0 + } + } }, "resources": { - "batch_type": "Lebesgue", - "number_node": 15, - "cpu_per_node": 32, - "gpu_per_node": 0, - "queue_name": "CPU", - "group_size": 10, - "source_list": ["/opt/intel/oneapi/setvars.sh"] + "batch_type": "Lebesgue", + "number_node": 15, + "cpu_per_node": 32, + "gpu_per_node": 0, + "queue_name": "CPU", + "group_size": 10, + "source_list": [ + "/opt/intel/oneapi/setvars.sh" + ] } - } - } + } +} diff --git a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json index cb5420910..23d0f8083 100644 --- a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json +++ b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json @@ -1,94 +1,147 @@ { - "type_map": ["I","Pb","C","N","H"], - "mass_map": [126.90447, 207.2, 12.0108, 14.0067, 1.00795], - - "pick_data": "../data", - "init_data_prefix": "", - "init_data_sys": [], - "sys_configs": [null], - "sys_batch_size": [1], - - "_comment": " 00.train ", - "numb_models": 4, - "model_devi_activation_func":[["tanh","tanh"],["tanh","gelu"],["gelu","gelu"],["gelu","tanh"]], - - "default_training_param": { - "model": { - "type_map": ["I","Pb","C","N","H"], - "descriptor": { - "type": "se_e2_a", - "sel": + "type_map": [ + "I", + "Pb", + "C", + "N", + "H" + ], + "mass_map": [ + 126.90447, + 207.2, + 12.0108, + 14.0067, + 1.00795 + ], + "pick_data": "../data", + "init_data_prefix": "", + "init_data_sys": [], + "sys_configs": [ + null + ], + "sys_batch_size": [ + 1 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "model_devi_activation_func": [ [ - 20, - 8, - 8, - 8, - 48 + "tanh", + "tanh" ], - "rcut_smth": 2.00, - "rcut": 6.00, - "neuron": [25, 50, 100], - "resnet_dt": false, - "type_one_side": true, - "trainable": true, - "axis_neuron": 12, - "seed": 0 - }, - "fitting_net": { - "neuron": [240, 240, 240], - "resnet_dt": true, - "trainable": [true, true, true, true], - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 2, - "start_pref_v": 0.01, - "limit_pref_v": 1 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 25, - "decay_rate": 0.95 + [ + "tanh", + "gelu" + ], + [ + "gelu", + "gelu" + ], + [ + "gelu", + "tanh" + ] + ], + "default_training_param": { + "model": { + "type_map": [ + "I", + "Pb", + "C", + "N", + "H" + ], + "descriptor": { + "type": "se_e2_a", + "sel": [ + 20, + 8, + 8, + 8, + 48 + ], + "rcut_smth": 2.0, + "rcut": 6.0, + "neuron": [ + 25, + 50, + 100 + ], + "resnet_dt": false, + "type_one_side": true, + "trainable": true, + "axis_neuron": 12, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true, + "trainable": [ + true, + true, + true, + true + ], + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 2, + "start_pref_v": 0.01, + "limit_pref_v": 1 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 25, + "stop_lr": 3.505266624882874e-08 + }, + "training": { + "stop_batch": 5000, + "seed": 1, + "_comment2": "frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 10000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "set_prefix": "set", + "batch_size": "auto" + } + } }, - "training": { - "set_prefix": "set", - "stop_batch": 5000, - "batch_size": "auto", - "seed": 1, - "_comment": "frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 10000, - "save_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - - "_comment": "02.fp", - "fp_style": "vasp", - "fp_skip_bad_box": "length_ratio:5;height_ratio:5", - "fp_accurate_threshold": 0.10, - "fp_accurate_soft_threshold": 0.00, - "fp_task_max": 20, - "fp_task_min": 5, - "ratio_failed": 0.30, - "fp_pp_path": "../vasp_inputs/", - "fp_pp_files": ["POTCAR_I","POTCAR_Pb_d","POTCAR_C","POTCAR_N","POTCAR_H"], - "fp_incar": "INCAR", - - "labeled": false, - "init_pick_number":5, - "iter_pick_number":5, - "model_devi_f_trust_lo":0.30, - "model_devi_f_trust_hi":100.00, - "cvasp": false + "_comment3": "02.fp", + "fp_style": "vasp", + "fp_skip_bad_box": "length_ratio:5;height_ratio:5", + "fp_accurate_threshold": 0.1, + "fp_accurate_soft_threshold": 0.0, + "fp_task_max": 20, + "fp_task_min": 5, + "ratio_failed": 0.3, + "fp_pp_path": "../vasp_inputs/", + "fp_pp_files": [ + "POTCAR_I", + "POTCAR_Pb_d", + "POTCAR_C", + "POTCAR_N", + "POTCAR_H" + ], + "fp_incar": "INCAR", + "labeled": false, + "init_pick_number": 5, + "iter_pick_number": 5, + "model_devi_f_trust_lo": 0.3, + "model_devi_f_trust_hi": 100.0, + "cvasp": false } diff --git a/examples/simplify/qm7.json b/examples/simplify/qm7.json index 38ba048c2..bee5a1536 100644 --- a/examples/simplify/qm7.json +++ b/examples/simplify/qm7.json @@ -16,7 +16,9 @@ "pick_data": "/scratch/jz748/simplify/qm7", "init_data_prefix": "", "init_data_sys": [], - "sys_configs": [null], + "sys_configs": [ + null + ], "sys_batch_size": [ "auto" ], @@ -39,8 +41,8 @@ 3, 1 ], - "rcut_smth": 1.00, - "rcut": 6.00, + "rcut_smth": 1.0, + "rcut": 6.0, "neuron": [ 25, 50, @@ -62,7 +64,7 @@ "type": "exp", "start_lr": 0.001, "decay_steps": 10, - "decay_rate": 0.99 + "stop_lr": 4.317124741065782e-08 }, "loss": { "start_pref_e": 0.02, @@ -75,19 +77,20 @@ "limit_pref_pf": 0 }, "training": { - "set_prefix": "set", "stop_batch": 10000, "disp_file": "lcurve.out", "disp_freq": 1000, - "numb_test": 1, "save_freq": 1000, "save_ckpt": "model.ckpt", "disp_training": true, "time_training": true, "profiling": false, - "profiling_file": "timeline.json" + "profiling_file": "timeline.json", + "training_data": { + "set_prefix": "set" + } }, - "_comment": "that's all" + "_comment1": "that's all" }, "use_clusters": true, "fp_style": "gaussian", @@ -97,11 +100,11 @@ "keywords": "mn15/6-31g** force nosymm scf(maxcyc=512)", "nproc": 28, "multiplicity": 1, - "_comment": " that's all " + "_comment2": " that's all " }, - "init_pick_number":100, - "iter_pick_number":100, - "model_devi_f_trust_lo":0.10, - "model_devi_f_trust_hi":0.30, - "_comment": " that's all " + "init_pick_number": 100, + "iter_pick_number": 100, + "model_devi_f_trust_lo": 0.1, + "model_devi_f_trust_hi": 0.3, + "_comment3": " that's all " } diff --git a/examples/test/deepmd_param.json b/examples/test/deepmd_param.json index ae920184d..5d04afc66 100644 --- a/examples/test/deepmd_param.json +++ b/examples/test/deepmd_param.json @@ -1,5 +1,5 @@ { - "_comment": "models", + "_comment1": "models", "potcar_map": { "Al": "/somewhere/example/POTCAR" }, @@ -7,15 +7,14 @@ "key_id": "key id of Material project", "task_type": "deepmd", "task": "all", - "vasp_params": { "ecut": 650, - "ediff": 1e-6, + "ediff": 1e-06, "kspacing": 0.1, "kgamma": false, "npar": 1, "kpar": 1, - "_comment": " that's all " + "_comment2": " that's all " }, "lammps_params": { "model_dir": "somewhere/example/Al_model", @@ -25,39 +24,39 @@ "model_name": false, "model_param_type": false }, - "_comment": "00.equi", + "_comment3": "00.equi", "alloy_shift": false, - "_comment": "01.eos", + "_comment4": "01.eos", "vol_start": 12, "vol_end": 22, "vol_step": 0.5, - "_comment": "02.elastic", - "norm_deform": 2e-2, - "shear_deform": 5e-2, - "_comment": "03.vacancy", + "_comment5": "02.elastic", + "norm_deform": 0.02, + "shear_deform": 0.05, + "_comment6": "03.vacancy", "supercell": [ 3, 3, 3 ], - "_comment": "04.interstitial", + "_comment7": "04.interstitial", "insert_ele": [ "Al" ], "reprod-opt": false, - "_comment": "05.surface", + "_comment8": "05.surface", "min_slab_size": 10, "min_vacuum_size": 11, - "_comment": "pert xz to work around vasp bug...", + "_comment9": "pert xz to work around vasp bug...", "pert_xz": 0.01, "max_miller": 2, "relax_box": false, - "_comment": "06.phonon", + "_comment10": "06.phonon", "supercell_matrix": [ 2, 2, 2 ], "band": "0 1 0 0.5 1 0.5 0.375 0.75 0.375 0 0 0 0.5 0.5 0.5", - "_comment": "that's all" + "_comment11": "that's all" } diff --git a/examples/test/meam_param.json b/examples/test/meam_param.json index 1790bb2a9..7eeec66d2 100644 --- a/examples/test/meam_param.json +++ b/examples/test/meam_param.json @@ -1,5 +1,5 @@ { - "_comment": "models", + "_comment1": "models", "potcar_map": { "Al": "/somewhere/example/POTCAR" }, @@ -7,15 +7,14 @@ "key_id": "key id of Material project", "task_type": "meam", "task": "all", - "vasp_params": { "ecut": 650, - "ediff": 1e-6, + "ediff": 1e-06, "kspacing": 0.1, "kgamma": false, "npar": 1, "kpar": 1, - "_comment": " that's all " + "_comment2": " that's all " }, "lammps_params": { "model_dir": "somewhere/example/meam", @@ -38,39 +37,39 @@ "FeS" ] }, - "_comment": "00.equi", + "_comment3": "00.equi", "alloy_shift": false, - "_comment": "01.eos", + "_comment4": "01.eos", "vol_start": 12, "vol_end": 22, "vol_step": 0.5, - "_comment": "02.elastic", - "norm_deform": 2e-2, - "shear_deform": 5e-2, - "_comment": "03.vacancy", + "_comment5": "02.elastic", + "norm_deform": 0.02, + "shear_deform": 0.05, + "_comment6": "03.vacancy", "supercell": [ 3, 3, 3 ], - "_comment": "04.interstitial", + "_comment7": "04.interstitial", "insert_ele": [ "Al" ], "reprod-opt": false, - "_comment": "05.surface", + "_comment8": "05.surface", "min_slab_size": 10, "min_vacuum_size": 11, - "_comment": "pert xz to work around vasp bug...", + "_comment9": "pert xz to work around vasp bug...", "pert_xz": 0.01, "max_miller": 2, "relax_box": false, - "_comment": "06.phonon", + "_comment10": "06.phonon", "supercell_matrix": [ 2, 2, 2 ], "band": "0 1 0 0.5 1 0.5 0.375 0.75 0.375 0 0 0 0.5 0.5 0.5", - "_comment": "that's all" + "_comment11": "that's all" } diff --git a/examples/test/vasp_param.json b/examples/test/vasp_param.json index d1dfb9a1d..981b78f02 100644 --- a/examples/test/vasp_param.json +++ b/examples/test/vasp_param.json @@ -1,55 +1,54 @@ { - "_comment": "models", - "potcar_map": { - "Al": "/somewhere/example/POTCAR" - }, - "conf_dir": "confs/Al/std-fcc", - "key_id": "key id of Material project", - "task_type": "vasp", - "task": "all", - - "vasp_params": { - "ecut": 650, - "ediff": 1e-6, - "kspacing": 0.1, - "kgamma": false, - "npar": 1, - "kpar": 1, - "_comment": " that's all " - }, - "_comment": "00.equi", - "alloy_shift": false, - "_comment": "01.eos", - "vol_start": 12, - "vol_end": 22, - "vol_step": 0.5, - "_comment": "02.elastic", - "norm_deform": 2e-2, - "shear_deform": 5e-2, - "_comment": "03.vacancy", - "supercell": [ - 3, - 3, - 3 - ], - "_comment": "04.interstitial", - "insert_ele": [ - "Al" - ], - "reprod-opt": false, - "_comment": "05.surface", - "min_slab_size": 10, - "min_vacuum_size": 11, - "_comment": "pert xz to work around vasp bug...", - "pert_xz": 0.01, - "max_miller": 2, - "relax_box": false, - "_comment": "06.phonon", - "supercell_matrix": [ - 2, - 2, - 2 - ], - "band": "0 1 0 0.5 1 0.5 0.375 0.75 0.375 0 0 0 0.5 0.5 0.5", - "_comment": "that's all" + "_comment1": "models", + "potcar_map": { + "Al": "/somewhere/example/POTCAR" + }, + "conf_dir": "confs/Al/std-fcc", + "key_id": "key id of Material project", + "task_type": "vasp", + "task": "all", + "vasp_params": { + "ecut": 650, + "ediff": 1e-06, + "kspacing": 0.1, + "kgamma": false, + "npar": 1, + "kpar": 1, + "_comment2": " that's all " + }, + "_comment3": "00.equi", + "alloy_shift": false, + "_comment4": "01.eos", + "vol_start": 12, + "vol_end": 22, + "vol_step": 0.5, + "_comment5": "02.elastic", + "norm_deform": 0.02, + "shear_deform": 0.05, + "_comment6": "03.vacancy", + "supercell": [ + 3, + 3, + 3 + ], + "_comment7": "04.interstitial", + "insert_ele": [ + "Al" + ], + "reprod-opt": false, + "_comment8": "05.surface", + "min_slab_size": 10, + "min_vacuum_size": 11, + "_comment9": "pert xz to work around vasp bug...", + "pert_xz": 0.01, + "max_miller": 2, + "relax_box": false, + "_comment10": "06.phonon", + "supercell_matrix": [ + 2, + 2, + 2 + ], + "band": "0 1 0 0.5 1 0.5 0.375 0.75 0.375 0 0 0 0.5 0.5 0.5", + "_comment11": "that's all" } diff --git a/examples/test/vasp_param_from_incar.json b/examples/test/vasp_param_from_incar.json index c5cf91ba4..9acf0928e 100644 --- a/examples/test/vasp_param_from_incar.json +++ b/examples/test/vasp_param_from_incar.json @@ -1,5 +1,5 @@ { - "_comment": "models", + "_comment1": "models", "potcar_map": { "Al": "/somewhere/example/POTCAR" }, @@ -7,43 +7,41 @@ "key_id": "key id of Material project", "task_type": "vasp", "task": "all", - "relax_incar": "somewhere/relax_incar", "scf_incar": "somewhere/scf_incar", - - "_comment": "00.equi", + "_comment2": "00.equi", "alloy_shift": false, - "_comment": "01.eos", + "_comment3": "01.eos", "vol_start": 12, "vol_end": 22, "vol_step": 0.5, - "_comment": "02.elastic", - "norm_deform": 2e-2, - "shear_deform": 5e-2, - "_comment": "03.vacancy", + "_comment4": "02.elastic", + "norm_deform": 0.02, + "shear_deform": 0.05, + "_comment5": "03.vacancy", "supercell": [ 3, 3, 3 ], - "_comment": "04.interstitial", + "_comment6": "04.interstitial", "insert_ele": [ "Al" ], "reprod-opt": false, - "_comment": "05.surface", + "_comment7": "05.surface", "min_slab_size": 10, "min_vacuum_size": 11, - "_comment": "pert xz to work around vasp bug...", + "_comment8": "pert xz to work around vasp bug...", "pert_xz": 0.01, "max_miller": 2, "relax_box": false, - "_comment": "06.phonon", + "_comment9": "06.phonon", "supercell_matrix": [ 2, 2, 2 ], "band": "0 1 0 0.5 1 0.5 0.375 0.75 0.375 0 0 0 0.5 0.5 0.5", - "_comment": "that's all" + "_comment10": "that's all" } diff --git a/tests/auto_test/equi/abacus/cell-relax.json b/tests/auto_test/equi/abacus/cell-relax.json index 03d7fcb71..f394f46db 100644 --- a/tests/auto_test/equi/abacus/cell-relax.json +++ b/tests/auto_test/equi/abacus/cell-relax.json @@ -4776,4 +4776,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/equi/vasp/Al-fcc.json b/tests/auto_test/equi/vasp/Al-fcc.json index ad921e693..e0d30e9ab 100644 --- a/tests/auto_test/equi/vasp/Al-fcc.json +++ b/tests/auto_test/equi/vasp/Al-fcc.json @@ -267,4 +267,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/equi/vasp/outcar.json b/tests/auto_test/equi/vasp/outcar.json index 9866ee2d3..48ff14c96 100644 --- a/tests/auto_test/equi/vasp/outcar.json +++ b/tests/auto_test/equi/vasp/outcar.json @@ -4668,4 +4668,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000000/inter.json b/tests/auto_test/output/gamma_00/task.000000/inter.json index 052167468..3f046499f 100644 --- a/tests/auto_test/output/gamma_00/task.000000/inter.json +++ b/tests/auto_test/output/gamma_00/task.000000/inter.json @@ -5,4 +5,4 @@ "type_map": { "Mo": 0 } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000000/miller.json b/tests/auto_test/output/gamma_00/task.000000/miller.json index 0a6e1ab11..35084a204 100644 --- a/tests/auto_test/output/gamma_00/task.000000/miller.json +++ b/tests/auto_test/output/gamma_00/task.000000/miller.json @@ -1 +1,5 @@ -[1, 1, 0] \ No newline at end of file +[ + 1, + 1, + 0 +] diff --git a/tests/auto_test/output/gamma_00/task.000000/result_task.json b/tests/auto_test/output/gamma_00/task.000000/result_task.json index 591103fc6..bcc319404 100644 --- a/tests/auto_test/output/gamma_00/task.000000/result_task.json +++ b/tests/auto_test/output/gamma_00/task.000000/result_task.json @@ -10680,4 +10680,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000000/task.json b/tests/auto_test/output/gamma_00/task.000000/task.json index dfe1db76b..b757d2c2f 100644 --- a/tests/auto_test/output/gamma_00/task.000000/task.json +++ b/tests/auto_test/output/gamma_00/task.000000/task.json @@ -31,4 +31,4 @@ "relax_shape": false, "relax_vol": false } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000001/inter.json b/tests/auto_test/output/gamma_00/task.000001/inter.json index 052167468..3f046499f 100644 --- a/tests/auto_test/output/gamma_00/task.000001/inter.json +++ b/tests/auto_test/output/gamma_00/task.000001/inter.json @@ -5,4 +5,4 @@ "type_map": { "Mo": 0 } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000001/miller.json b/tests/auto_test/output/gamma_00/task.000001/miller.json index 0a6e1ab11..35084a204 100644 --- a/tests/auto_test/output/gamma_00/task.000001/miller.json +++ b/tests/auto_test/output/gamma_00/task.000001/miller.json @@ -1 +1,5 @@ -[1, 1, 0] \ No newline at end of file +[ + 1, + 1, + 0 +] diff --git a/tests/auto_test/output/gamma_00/task.000001/result_task.json b/tests/auto_test/output/gamma_00/task.000001/result_task.json index 50f35afdf..7be63eddc 100644 --- a/tests/auto_test/output/gamma_00/task.000001/result_task.json +++ b/tests/auto_test/output/gamma_00/task.000001/result_task.json @@ -10680,4 +10680,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000001/task.json b/tests/auto_test/output/gamma_00/task.000001/task.json index dfe1db76b..b757d2c2f 100644 --- a/tests/auto_test/output/gamma_00/task.000001/task.json +++ b/tests/auto_test/output/gamma_00/task.000001/task.json @@ -31,4 +31,4 @@ "relax_shape": false, "relax_vol": false } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000002/inter.json b/tests/auto_test/output/gamma_00/task.000002/inter.json index 052167468..3f046499f 100644 --- a/tests/auto_test/output/gamma_00/task.000002/inter.json +++ b/tests/auto_test/output/gamma_00/task.000002/inter.json @@ -5,4 +5,4 @@ "type_map": { "Mo": 0 } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000002/miller.json b/tests/auto_test/output/gamma_00/task.000002/miller.json index 0a6e1ab11..35084a204 100644 --- a/tests/auto_test/output/gamma_00/task.000002/miller.json +++ b/tests/auto_test/output/gamma_00/task.000002/miller.json @@ -1 +1,5 @@ -[1, 1, 0] \ No newline at end of file +[ + 1, + 1, + 0 +] diff --git a/tests/auto_test/output/gamma_00/task.000002/result_task.json b/tests/auto_test/output/gamma_00/task.000002/result_task.json index cb2da59ad..6d11eb0c0 100644 --- a/tests/auto_test/output/gamma_00/task.000002/result_task.json +++ b/tests/auto_test/output/gamma_00/task.000002/result_task.json @@ -10680,4 +10680,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/gamma_00/task.000002/task.json b/tests/auto_test/output/gamma_00/task.000002/task.json index dfe1db76b..b757d2c2f 100644 --- a/tests/auto_test/output/gamma_00/task.000002/task.json +++ b/tests/auto_test/output/gamma_00/task.000002/task.json @@ -31,4 +31,4 @@ "relax_shape": false, "relax_vol": false } -} \ No newline at end of file +} diff --git a/tests/auto_test/output/relaxation/relax_task/result.json b/tests/auto_test/output/relaxation/relax_task/result.json index 051fe8cf2..cc38cd7fd 100644 --- a/tests/auto_test/output/relaxation/relax_task/result.json +++ b/tests/auto_test/output/relaxation/relax_task/result.json @@ -374,4 +374,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/data/CuW.json b/tests/data/CuW.json index d60dfb187..9ad025de7 100644 --- a/tests/data/CuW.json +++ b/tests/data/CuW.json @@ -1,6 +1,11 @@ { - "init_fp_style": "ABACUS", - "stages": [1, 2, 3, 4], + "init_fp_style": "ABACUS", + "stages": [ + 1, + 2, + 3, + 4 + ], "cell_type": "fcc", "latt": 3.76, "super_cell": [ @@ -9,12 +14,16 @@ 2 ], "elements": [ - "Cu", "W" + "Cu", + "W" + ], + "atom_masses": [ + 63.55, + 183.8 ], - "atom_masses": [63.55, 183.8], "potcars": [ "abacus.in/Cu_ONCV_PBE-1.0.upf", - "abacus.in/W_ONCV_PBE-1.0.upf" + "abacus.in/W_ONCV_PBE-1.0.upf" ], "relax_incar": "abacus.in/INPUT", "relax_kpt": "abacus.in/KPT", @@ -33,5 +42,5 @@ "Cu", "W" ], - "_comment": "that's all" + "_comment1": "that's all" } diff --git a/tests/data/al.json b/tests/data/al.json index b19e7c884..3c96c484f 100644 --- a/tests/data/al.json +++ b/tests/data/al.json @@ -1,19 +1,32 @@ { - "cell_type": "fcc", - "super_cell": [1, 1, 1], - "elements": ["Al"], - "from_poscar": false, - "from_poscar_path": "example/POSCAR", - "potcars": ["example/POTCAR"], - "relax_incar": "example/INCAR.rlx", - "md_incar" : "example/INCAR.md", - "scale": [1.00], - "skip_relax": false, - "pert_numb": 2, - "md_nstep" : 1, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 10, - "type_map" : ["Mg", "Al"], - "_comment": "that's all" + "cell_type": "fcc", + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al" + ], + "from_poscar": false, + "from_poscar_path": "example/POSCAR", + "potcars": [ + "example/POTCAR" + ], + "relax_incar": "example/INCAR.rlx", + "md_incar": "example/INCAR.md", + "scale": [ + 1.0 + ], + "skip_relax": false, + "pert_numb": 2, + "md_nstep": 1, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 10, + "type_map": [ + "Mg", + "Al" + ], + "_comment1": "that's all" } diff --git a/tests/data/alloy.json b/tests/data/alloy.json index 78cfa5e61..dd42d585c 100644 --- a/tests/data/alloy.json +++ b/tests/data/alloy.json @@ -1,19 +1,31 @@ { - "cell_type": "fcc", - "latt": 2.4, - "super_cell": [1, 1, 1], - "elements": ["Al","Mg"], - "from_poscar": false, - "from_poscar_path": "example/POSCAR", - "potcars": ["./POTCAR","./POTCAR"], - "relax_incar": "./INCAR_metal_rlx_low", - "md_incar" : "example/INCAR.md", - "scale": [1.00], - "skip_relax": true, - "pert_numb": 3, - "md_nstep" : 1, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 3, - "_comment": "that's all" + "cell_type": "fcc", + "latt": 2.4, + "super_cell": [ + 1, + 1, + 1 + ], + "elements": [ + "Al", + "Mg" + ], + "from_poscar": false, + "from_poscar_path": "example/POSCAR", + "potcars": [ + "./POTCAR", + "./POTCAR" + ], + "relax_incar": "./INCAR_metal_rlx_low", + "md_incar": "example/INCAR.md", + "scale": [ + 1.0 + ], + "skip_relax": true, + "pert_numb": 3, + "md_nstep": 1, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 3, + "_comment1": "that's all" } diff --git a/tests/data/ch4.json b/tests/data/ch4.json index 7f3a74933..ce67eeb1f 100644 --- a/tests/data/ch4.json +++ b/tests/data/ch4.json @@ -1,26 +1,46 @@ { - "init_fp_style": "ABACUS", - "stages": [1, 2, 3, 4], - "super_cell": [1, 1, 1], - "_comment": "if from_poscar = true, the cell_type and super_cell keys are actually useless", + "init_fp_style": "ABACUS", + "stages": [ + 1, + 2, + 3, + 4 + ], + "super_cell": [ + 1, + 1, + 1 + ], + "_comment1": "if from_poscar = true, the cell_type and super_cell keys are actually useless", "cell_type": "fcc", - "elements": ["H","C"], - "atom_masses": [1, 12], - "_comment": "if from_poscar = false, you have to set atom_masse.", - "out_dir": "./", - "from_poscar": true, - "from_poscar_path": "./STRU", - "potcars": ["./H_ONCV_PBE-1.0.upf", "./C_ONCV_PBE-1.0.upf"], - "relax_incar": "./INPUT", + "elements": [ + "H", + "C" + ], + "atom_masses": [ + 1, + 12 + ], + "_comment2": "if from_poscar = false, you have to set atom_masse.", + "out_dir": "./", + "from_poscar": true, + "from_poscar_path": "./STRU", + "potcars": [ + "./H_ONCV_PBE-1.0.upf", + "./C_ONCV_PBE-1.0.upf" + ], + "relax_incar": "./INPUT", "relax_kspacing": 10, - "md_incar" : "./INPUT.md", + "md_incar": "./INPUT.md", "md_kspacing": 10, - "scale": [0.95], - "skip_relax": false, - "pert_numb": 2, - "md_nstep" : 3, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 10, - "_comment": "that's all" + "scale": [ + 0.95 + ], + "skip_relax": false, + "pert_numb": 2, + "md_nstep": 3, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 10, + "_comment3": "that's all" } diff --git a/tests/data/surf.json b/tests/data/surf.json index f0bcc45b1..d3f5afee4 100644 --- a/tests/data/surf.json +++ b/tests/data/surf.json @@ -1,46 +1,46 @@ { - "stages": [ - 1, - 2 - ], - "cell_type": "fcc", - "latt": 4.1, - "super_cell": [ - 1, - 1, - 1 - ], - "layer_numb": 3, - "vacuum_max": 9.0, - "vacuum_resol": [ - 0.5, - 1 - ], - "mid_point": 4.0, - "head_ratio": 0.6, - "vacuum_numb": 20, - "millers": [ - [ - 1, - 0, - 0 - ] - ], - "elements": [ - "Al" - ], - "potcars": [ - "./POTCAR" - ], - "relax_incar" : "INCAR_metal_rlx_low", - "scale": [ - 0.98, - 1.0 - ], - "skip_relax": true, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 5000, - "_comment": "that's all" + "stages": [ + 1, + 2 + ], + "cell_type": "fcc", + "latt": 4.1, + "super_cell": [ + 1, + 1, + 1 + ], + "layer_numb": 3, + "vacuum_max": 9.0, + "vacuum_resol": [ + 0.5, + 1 + ], + "mid_point": 4.0, + "head_ratio": 0.6, + "vacuum_numb": 20, + "millers": [ + [ + 1, + 0, + 0 + ] + ], + "elements": [ + "Al" + ], + "potcars": [ + "./POTCAR" + ], + "relax_incar": "INCAR_metal_rlx_low", + "scale": [ + 0.98, + 1.0 + ], + "skip_relax": true, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/tests/data/surf_poscar.json b/tests/data/surf_poscar.json index 3399b920f..2cfbc27a4 100644 --- a/tests/data/surf_poscar.json +++ b/tests/data/surf_poscar.json @@ -1,43 +1,46 @@ { - "stages": [ - 1, - 2 - ], - "cell_type": "fcc", - "from_poscar": true, - "from_poscar_path": "POSCAR", - "super_cell": [ - 1, - 1, - 1 - ], - "layer_numb": 3, - "vacuum_max": 5, - "vacuum_resol": [0.5,2], - "mid_point": 2.0, - "_head_ratio": 0.6, - "_vacuum_numb": 20, - "millers": [ - [ - 1, - 0, - 0 - ] - ], - "elements": [ - "Al" - ], - "potcars": [ - "./POTCAR" - ], - "relax_incar" : "INCAR_metal_rlx_low", - "scale": [ - 1.0 - ], - "skip_relax": true, - "pert_numb": 5, - "pert_box": 0.03, - "pert_atom": 0.01, - "coll_ndata": 5000, - "_comment": "that's all" + "stages": [ + 1, + 2 + ], + "cell_type": "fcc", + "from_poscar": true, + "from_poscar_path": "POSCAR", + "super_cell": [ + 1, + 1, + 1 + ], + "layer_numb": 3, + "vacuum_max": 5, + "vacuum_resol": [ + 0.5, + 2 + ], + "mid_point": 2.0, + "_head_ratio": 0.6, + "_vacuum_numb": 20, + "millers": [ + [ + 1, + 0, + 0 + ] + ], + "elements": [ + "Al" + ], + "potcars": [ + "./POTCAR" + ], + "relax_incar": "INCAR_metal_rlx_low", + "scale": [ + 1.0 + ], + "skip_relax": true, + "pert_numb": 5, + "pert_box": 0.03, + "pert_atom": 0.01, + "coll_ndata": 5000, + "_comment1": "that's all" } diff --git a/tests/database/param_Al.json b/tests/database/param_Al.json index 3295d8ce8..48f767d30 100644 --- a/tests/database/param_Al.json +++ b/tests/database/param_Al.json @@ -1,19 +1,100 @@ { - "path" : "./", - "calculator" : "vasp", - "_comment" : "vasp/pwscf/gaussian", - "output" : "dpgen_db.json", - "id_prefix" : "", - "config_info_dict" : { - "fcc-bulk" : [0,1,2,3,4,5,6,7], - "hcp-bulk" : [8,9,10,11,12,13,14,15], - "bcc-bulk" : [16,17,18,19,20,21,22,23], - "fcc-surf-100" : [24,25,26,27,28,29,30,31], - "fcc-surf-111" : [32,33,34,35,36,37,38,39], - "fcc-surf-110" : [40,41,42,43,44,45,46,47], - "hcp-surf-001" : [48,49,50,51,52,53,54,55], - "hcp-surf-100" : [56,57,58,59,60,61,62,63], - "hcp-surf-110" : [64,65,66,67,68,69,70,71] - }, - "skip_init" : true + "path": "./", + "calculator": "vasp", + "_comment1": "vasp/pwscf/gaussian", + "output": "dpgen_db.json", + "id_prefix": "", + "config_info_dict": { + "fcc-bulk": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "hcp-bulk": [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ], + "bcc-bulk": [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "fcc-surf-100": [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 + ], + "fcc-surf-111": [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39 + ], + "fcc-surf-110": [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47 + ], + "hcp-surf-001": [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55 + ], + "hcp-surf-100": [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63 + ], + "hcp-surf-110": [ + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71 + ] + }, + "skip_init": true } diff --git a/tests/generator/gromacs/model_devi_case/input.json b/tests/generator/gromacs/model_devi_case/input.json index 99449ec0d..bd68970d2 100644 --- a/tests/generator/gromacs/model_devi_case/input.json +++ b/tests/generator/gromacs/model_devi_case/input.json @@ -4,4 +4,4 @@ "type_file": "/data1/anguse/yuzhi/fep/DP_FF/tyk2/init_data/lig_ejm_31/type.raw", "index_file": "index.raw", "lambda": 1.0 -} \ No newline at end of file +} diff --git a/tests/generator/machine-local-v1.json b/tests/generator/machine-local-v1.json index 2218884f2..6ffac93a7 100644 --- a/tests/generator/machine-local-v1.json +++ b/tests/generator/machine-local-v1.json @@ -1,48 +1,51 @@ { "train_machine": { - "machine_type": "shell", - "lazy_local": true + "machine_type": "shell", + "lazy_local": true }, "train_resources": { - "numb_node": 1, - "numb_gpu": 0, - "task_per_node": 4, - "exclude_list": [], - "source_list": ["/home/wanghan/study/deep.md/venvs/py3.6-tf1.8/bin/active"], - "envs" : { - }, - "_comment": "that's All" + "numb_node": 1, + "numb_gpu": 0, + "task_per_node": 4, + "exclude_list": [], + "source_list": [ + "/home/wanghan/study/deep.md/venvs/py3.6-tf1.8/bin/active" + ], + "envs": {}, + "_comment1": "that's All" }, "python_path": "/home/wanghan/study/deep.md/venvs/py3.6-tf1.8/bin/python", - "model_devi_machine": { - "machine_type": "shell", - "work_path": "/home/wanghan/study/deep.md/dpgen/almg/tmp" + "machine_type": "shell", + "work_path": "/home/wanghan/study/deep.md/dpgen/almg/tmp" }, "model_devi_resources": { - "numb_node": 1, - "task_per_node": 4, - "with_mpi": true, - "module_list" : ["mpi"], - "exclude_list": [], - "source_list": [], - "_comment": "that's All" + "numb_node": 1, + "task_per_node": 4, + "with_mpi": true, + "module_list": [ + "mpi" + ], + "exclude_list": [], + "source_list": [], + "_comment2": "that's All" }, "model_devi_command": "/home/wanghan/local/bin/lmp_mpi_1_1_0", "model_devi_group_size": 10, - "fp_machine": { - "machine_type": "shell", - "work_path": "/home/wanghan/study/deep.md/dpgen/almg/tmp" + "machine_type": "shell", + "work_path": "/home/wanghan/study/deep.md/dpgen/almg/tmp" }, "fp_resources": { - "cvasp": false, - "task_per_node": 4, - "exclude_list": [], - "with_mpi": true, - "module_list" : ["mpi"], - "source_list": [], - "_comment": "that's All" + "cvasp": false, + "task_per_node": 4, + "exclude_list": [], + "with_mpi": true, + "module_list": [ + "mpi" + ], + "source_list": [], + "_comment3": "that's All" }, "fp_command": "/home/wanghan/local/bin/vasp_std", "fp_group_size": 5 diff --git a/tests/generator/machine-local.json b/tests/generator/machine-local.json index a4743c964..fb2d47073 100644 --- a/tests/generator/machine-local.json +++ b/tests/generator/machine-local.json @@ -1,54 +1,55 @@ { - "_comment": "training on localhost ", - "deepmd_path": "/home/wanghan/local/deepmd/0.10.1/", - "train_machine": { - "machine_type": "local", - "hostname" : "127.0.0.1", - "port" : 22, - "username": "wanghan", - "work_path" : "/home/wanghan/tmp/subs/", - "_comment" : "that's all" - }, - "train_resources": { - "envs": { - "PYTHONPATH" : "/home/wanghan/local/tensorflow/1.8.py/lib/python3.6/site-packages/" - }, - "_comment": "that's all" - }, - - - "_comment": "model_devi on localhost ", - "model_devi_command": "/home/wanghan/local/bin/lmp_mpi_010", + "_comment1": "training on localhost ", + "deepmd_path": "/home/wanghan/local/deepmd/0.10.1/", + "train_machine": { + "machine_type": "local", + "hostname": "127.0.0.1", + "port": 22, + "username": "wanghan", + "work_path": "/home/wanghan/tmp/subs/", + "_comment2": "that's all" + }, + "train_resources": { + "envs": { + "PYTHONPATH": "/home/wanghan/local/tensorflow/1.8.py/lib/python3.6/site-packages/" + }, + "_comment3": "that's all" + }, + "_comment4": "model_devi on localhost ", + "model_devi_command": "/home/wanghan/local/bin/lmp_mpi_010", "model_devi_group_size": 5, - "model_devi_machine": { - "machine_type": "local", - "hostname" : "127.0.0.1", - "port" : 22, - "username": "wanghan", - "work_path" : "/home/wanghan/tmp/subs/", - "_comment" : "that's all" - }, - "model_devi_resources": { - "_comment": "that's all" - }, - - "_comment": "fp on localhost ", - "fp_command": "/home/wanghan/local/bin/vasp_std", - "fp_group_size": 2, - "fp_machine": { - "machine_type": "local", - "hostname" : "127.0.0.1", - "port" : 22, - "username": "wanghan", - "work_path" : "/home/wanghan/tmp/subs/", - "_comment" : "that's all" - }, - "fp_resources": { - "module_list": ["mpi"], - "task_per_node":4, - "with_mpi": true, - "_comment": "that's all" + "model_devi_machine": { + "machine_type": "local", + "hostname": "127.0.0.1", + "port": 22, + "username": "wanghan", + "work_path": "/home/wanghan/tmp/subs/", + "_comment5": "that's all" + }, + "model_devi_resources": { + "_comment6": "that's all" + }, + "_comment7": "fp on localhost ", + "fp_command": "/home/wanghan/local/bin/vasp_std", + "fp_group_size": 2, + "fp_machine": { + "machine_type": "local", + "hostname": "127.0.0.1", + "port": 22, + "username": "wanghan", + "work_path": "/home/wanghan/tmp/subs/", + "_comment8": "that's all" + }, + "fp_resources": { + "module_list": [ + "mpi" + ], + "task_per_node": 4, + "with_mpi": true, + "_comment9": "that's all" }, - "fp_user_forward_files" : ["vdw_kernel.bindat"], - "_comment": " that's all " + "fp_user_forward_files": [ + "vdw_kernel.bindat" + ], + "_comment10": " that's all " } diff --git a/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000000/job.json b/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000000/job.json index e2f74b65b..660b8b34d 100644 --- a/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000000/job.json +++ b/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000000/job.json @@ -1 +1,3 @@ -{ "ele_temp": 0 } +{ + "ele_temp": 0 +} diff --git a/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000001/job.json b/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000001/job.json index ec49f8a06..4d97f09db 100644 --- a/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000001/job.json +++ b/tests/generator/out_data_post_fp_vasp/02.fp/task.000.000001/job.json @@ -1 +1,3 @@ -{ "ele_temp": 1 } +{ + "ele_temp": 1 +} diff --git a/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000000/job.json b/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000000/job.json index c4924f0bd..75362c521 100644 --- a/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000000/job.json +++ b/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000000/job.json @@ -1 +1,3 @@ -{ "ele_temp": 100000 } +{ + "ele_temp": 100000 +} diff --git a/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000001/job.json b/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000001/job.json index a393fb733..ce0542325 100644 --- a/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000001/job.json +++ b/tests/generator/out_data_post_fp_vasp/02.fp/task.001.000001/job.json @@ -1 +1,3 @@ -{ "ele_temp": 110000 } +{ + "ele_temp": 110000 +} diff --git a/tests/generator/param-amber.json b/tests/generator/param-amber.json index 69df44ed3..6dc97aee9 100644 --- a/tests/generator/param-amber.json +++ b/tests/generator/param-amber.json @@ -1,7 +1,9 @@ { "model_devi_jobs": [ { - "sys_idx": [0] + "sys_idx": [ + 0 + ] } ], "use_multi_systems": true, @@ -33,22 +35,32 @@ 0 ], "r": [ - [-1.20] + [ + -1.2 + ] ], "nsteps": [ 1000 ], - "type_map": ["C", "H", "O", "N", "P", "HW", "OW"], + "type_map": [ + "C", + "H", + "O", + "N", + "P", + "HW", + "OW" + ], "shuffle_poscar": false, "low_level": "DFTB2", "high_level": "PBE0", "cutoff": 6.0, "fp_task_max": 1000, "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.10, + "model_devi_f_trust_lo": 0.1, "model_devi_f_trust_hi": 0.25, "fp_params": { "low_level_mdin": "ml.mdin", "high_level_mdin": "ml.mdin" } -} \ No newline at end of file +} diff --git a/tests/generator/param-custom-fp.json b/tests/generator/param-custom-fp.json index f66cad71f..f62a48816 100644 --- a/tests/generator/param-custom-fp.json +++ b/tests/generator/param-custom-fp.json @@ -1,107 +1,321 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } ], - - "_comment": " 02.fp ", - "fp_style": "custom", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": [], - "fp_params": { - "input_fn": "input.h5", - "input_fmt": "deepmd/hdf5", - "output_fn": "output.h5", - "output_fmt": "deepmd/hdf5" + "_comment11": " 02.fp ", + "fp_style": "custom", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [], + "fp_params": { + "input_fn": "input.h5", + "input_fmt": "deepmd/hdf5", + "output_fn": "output.h5", + "output_fmt": "deepmd/hdf5" }, - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/generator/param-methane-abacus-diy.json b/tests/generator/param-methane-abacus-diy.json index f7dbbe3d3..da70ed645 100644 --- a/tests/generator/param-methane-abacus-diy.json +++ b/tests/generator/param-methane-abacus-diy.json @@ -1,138 +1,162 @@ { - "type_map": ["H", "C"], - "mass_map": [1.0, 12.0], - - "_comment": "initial data set for Training and the number of frames in each training batch", - "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", - "init_data_sys": [ - "abacus_init_data" - ], - "init_batch_size": [ - 8 - ], - - "_comment": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", - "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", - "sys_configs": [ - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + "type_map": [ + "H", + "C" ], - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8 - ], - - "_comment": " 00.train ", - "numb_models": 4, - - "default_training_param": { - "model": { - "type_map": ["H","C"], - "descriptor": { - "type": "se_a", - "sel": [16,4], - "rcut_smth": 0.5, - "rcut": 5.0, - "neuron": [10,20,40], - "resnet_dt": false, - "axis_neuron": 12, - "seed": 0 - }, - "fitting_net": { - "neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 180, - "decay_rate": 0.95 + "mass_map": [ + 1.0, + 12.0 + ], + "_comment1": "initial data set for Training and the number of frames in each training batch", + "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", + "init_data_sys": [ + "abacus_init_data" + ], + "init_batch_size": [ + 8 + ], + "_comment2": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", + "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", + "sys_configs": [ + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + ], + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "type_map": [ + "H", + "C" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 12, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 180, + "stop_lr": 3.505266624882874e-08 + }, + "training": { + "stop_batch": 36000, + "seed": 1, + "_comment4": "frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - "training": { - "systems": [], - "set_prefix": "set", - "stop_batch": 36000, - "batch_size": 1, - "seed": 1, - "_comment": "frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - - "_comment": " 01.model_devi ", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { - "sys_idx": [ + "_comment5": " 01.model_devi ", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment6": " 02.fp ", + "fp_style": "abacus", + "shuffle_poscar": false, + "fp_task_max": 30, + "fp_task_min": 8, + "fp_pp_path": ".", + "fp_pp_files": [ + "./H_HSCV_PBE-1.0.UPF", + "./C_HSCV_PBE-1.0.UPF" + ], + "fp_incar": "abacus/INPUT.diy", + "_k_points": [ + 3, + 3, + 3, + 0, + 0, 0 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 1000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 3000, - "ensemble": "nvt", - "_idx": "01" - } - ], - - "_comment": " 02.fp ", - "fp_style": "abacus", - "shuffle_poscar": false, - "fp_task_max": 30, - "fp_task_min": 8, - "fp_pp_path": ".", - "fp_pp_files": [ "./H_HSCV_PBE-1.0.UPF","./C_HSCV_PBE-1.0.UPF"], - "fp_incar": "abacus/INPUT.diy", - "_k_points": [3, 3, 3, 0, 0, 0], - "_fp_kpt_file": "./abacus/KPT" + ], + "_fp_kpt_file": "./abacus/KPT" } diff --git a/tests/generator/param-methane-abacus.json b/tests/generator/param-methane-abacus.json index 2f9ff1b96..50b21a0ec 100644 --- a/tests/generator/param-methane-abacus.json +++ b/tests/generator/param-methane-abacus.json @@ -1,160 +1,184 @@ { - "type_map": ["H", "C"], - "mass_map": [1.0, 12.0], - - "_comment": "initial data set for Training and the number of frames in each training batch", - "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", - "init_data_sys": [ - "abacus_init_data" - ], - "init_batch_size": [ - 8 - ], - - "_comment": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", - "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", - "sys_configs": [ - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + "type_map": [ + "H", + "C" ], - [ - "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" - ] - ], - "sys_batch_size": [ - 8, - 8 - ], - - "_comment": " 00.train ", - "numb_models": 4, - - "default_training_param": { - "model": { - "type_map": ["H","C"], - "descriptor": { - "type": "se_a", - "sel": [16,4], - "rcut_smth": 0.5, - "rcut": 5.0, - "neuron": [10,20,40], - "resnet_dt": false, - "axis_neuron": 12, - "seed": 0 - }, - "fitting_net": { - "neuron": [120,120,120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - "seed": 0 - } - }, - "loss": { - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - "learning_rate": { - "type": "exp", - "start_lr": 0.001, - "decay_steps": 180, - "decay_rate": 0.95 + "mass_map": [ + 1.0, + 12.0 + ], + "_comment1": "initial data set for Training and the number of frames in each training batch", + "init_data_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run_abacus/", + "init_data_sys": [ + "abacus_init_data" + ], + "init_batch_size": [ + 8 + ], + "_comment2": "configurations for starting MD in Exploration and batch sizes when traning snapshots derived from these configs (if they were selected)", + "sys_configs_prefix": "/home/mhchen_pkuhpc/mhchen_cls/lustre2/5_liurenxi/5_ABACUS_dpgen_interface/5_dpgen_examples/dpgen-example/run", + "sys_configs": [ + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000000/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/000001/POSCAR", + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00000[2-9]/POSCAR" + ], + [ + "CH4.POSCAR.01x01x01/01.scale_pert/sys-0004-0001/scale-1.000/00001*/POSCAR" + ] + ], + "sys_batch_size": [ + 8, + 8 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "type_map": [ + "H", + "C" + ], + "descriptor": { + "type": "se_a", + "sel": [ + 16, + 4 + ], + "rcut_smth": 0.5, + "rcut": 5.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 12, + "seed": 0 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "coord_norm": true, + "type_fitting_net": false, + "seed": 0 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "type": "exp", + "start_lr": 0.001, + "decay_steps": 180, + "stop_lr": 3.505266624882874e-08 + }, + "training": { + "stop_batch": 36000, + "seed": 1, + "_comment4": "frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - "training": { - "systems": [], - "set_prefix": "set", - "stop_batch": 36000, - "batch_size": 1, - "seed": 1, - "_comment": "frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 4, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json" - } - }, - - "_comment": " 01.model_devi ", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.15, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { - "sys_idx": [ + "_comment5": " 01.model_devi ", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "nvt", + "_idx": "00" + }, + { + "sys_idx": [ + 1 + ], + "temps": [ + 50 + ], + "press": [ + 1 + ], + "trj_freq": 10, + "nsteps": 3000, + "ensemble": "nvt", + "_idx": "01" + } + ], + "_comment6": " 02.fp ", + "fp_style": "abacus", + "shuffle_poscar": false, + "fp_task_max": 30, + "fp_task_min": 8, + "fp_pp_path": ".", + "fp_pp_files": [ + "./H_HSCV_PBE-1.0.UPF", + "./C_HSCV_PBE-1.0.UPF" + ], + "_fp_kpt_file": "./abacus/KPT", + "_k_points": [ + 3, + 3, + 3, + 0, + 0, 0 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 1000, - "ensemble": "nvt", - "_idx": "00" - }, - { - "sys_idx": [ - 1 - ], - "temps": [ - 50 - ], - "press": [ - 1 - ], - "trj_freq": 10, - "nsteps": 3000, - "ensemble": "nvt", - "_idx": "01" + ], + "user_fp_params": { + "ecutwfc": 80, + "scf_thr": 1e-07, + "scf_nmax": 50, + "basis_type": "pw", + "gamma_only": 1, + "_kspacing": 0.04, + "dft_functional": "pbe", + "mixing_type": "pulay", + "mixing_beta": 0.4, + "symmetry": 1, + "nbands": 5, + "nspin": 1, + "ks_solver": "cg", + "smearing_method": "fixed", + "smearing_sigma": 0.001, + "cal_force": 1, + "cal_stress": 1, + "deepks_out_labels": 0, + "deepks_descriptor_lmax": 0, + "deepks_scf": 0, + "deepks_model": "model.ptg" } - ], - - "_comment": " 02.fp ", - "fp_style": "abacus", - "shuffle_poscar": false, - "fp_task_max": 30, - "fp_task_min": 8, - "fp_pp_path": ".", - "fp_pp_files": [ "./H_HSCV_PBE-1.0.UPF","./C_HSCV_PBE-1.0.UPF"], - "_fp_kpt_file": "./abacus/KPT", - "_k_points": [3,3,3,0,0,0], - "user_fp_params":{ - "ecutwfc": 80, - "scf_thr": 1e-7, - "scf_nmax": 50, - "basis_type": "pw", - "gamma_only": 1, - "_kspacing": 0.04, - "dft_functional": "pbe", - "mixing_type": "pulay", - "mixing_beta": 0.4, - "symmetry": 1, - "nbands": 5, - "nspin": 1, - "ks_solver": "cg", - "smearing_method": "fixed", - "smearing_sigma": 0.001, - "cal_force":1, - "cal_stress":1, - "deepks_out_labels":0, - "deepks_descriptor_lmax":0, - "deepks_scf":0, - "deepks_model":"model.ptg" - } } diff --git a/tests/generator/param-mg-vasp-diy.json b/tests/generator/param-mg-vasp-diy.json index f095f85f1..d66e6fb19 100644 --- a/tests/generator/param-mg-vasp-diy.json +++ b/tests/generator/param-mg-vasp-diy.json @@ -1,89 +1,133 @@ { - "type_map": ["Mg", "Al"], - "mass_map": [24, 27], - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR"] + "type_map": [ + "Mg", + "Al" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,1], "temps": [50,100], "press": [1.0,2.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["vasp/potcars/POTCAR.mg", "vasp/potcars/POTCAR.al"], - "_comment": " user provided vasp script ", - "fp_incar" : "vasp/INCAR.diy", + "_comment12": " user provided vasp script ", + "fp_incar": "vasp/INCAR.diy", "fp_nbands_esti_data": "vasp/nbands_esti.out", - "_comment": " that's all " + "_comment13": " that's all " } diff --git a/tests/generator/param-mg-vasp-multi-trust.json b/tests/generator/param-mg-vasp-multi-trust.json index acd7e1865..b2cc9b5e1 100644 --- a/tests/generator/param-mg-vasp-multi-trust.json +++ b/tests/generator/param-mg-vasp-multi-trust.json @@ -1,111 +1,161 @@ -{ - "type_map": ["Mg", "Al"], - "mass_map": [24, 27], - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR"] +{ + "type_map": [ + "Mg", + "Al" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "train_param": "input.json", - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "train_param": "input.json", + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": [ + 0.0, + 0.05 + ], + "model_devi_f_trust_hi": { + "1": 0.1, + "0": 0.15 }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": [0.000, 0.050], - "model_devi_f_trust_hi": {"1": 0.100, "0": 0.150}, - "model_devi_e_trust_lo": 1e10, - "model_devi_e_trust_hi": 1e10, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0, 1], "temps": [50,100], "press": [1.0,2.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"} + "model_devi_e_trust_lo": 10000000000.0, + "model_devi_e_trust_hi": 10000000000.0, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["vasp/potcars/POTCAR.mg", "vasp/potcars/POTCAR.al"], - "_comment": " user provided vasp script ", + "_comment12": " user provided vasp script ", "user_fp_params": { - "PREC": "A", - "ENCUT": 600, - "ISYM": 0, - "ALGO": "fast", - "EDIFF": 1e-05, - "LREAL": "A", - "NPAR": 1, - "KPAR": 1, - "NELMIN": 4, - "ISIF": 2, - "ISMEAR": 1, - "SIGMA": 0.25, - "IBRION": -1, - "NSW": 0, - "LWAVE": false, - "LCHARG": false, - "PSTRESS": 0, - "KSPACING": 0.16, - "KGAMMA": false + "PREC": "A", + "ENCUT": 600, + "ISYM": 0, + "ALGO": "fast", + "EDIFF": 1e-05, + "LREAL": "A", + "NPAR": 1, + "KPAR": 1, + "NELMIN": 4, + "ISIF": 2, + "ISMEAR": 1, + "SIGMA": 0.25, + "IBRION": -1, + "NSW": 0, + "LWAVE": false, + "LCHARG": false, + "PSTRESS": 0, + "KSPACING": 0.16, + "KGAMMA": false }, - "_comment": " that's all " + "_comment13": " that's all " } diff --git a/tests/generator/param-mg-vasp-old.json b/tests/generator/param-mg-vasp-old.json index 3926876c2..83a86a439 100644 --- a/tests/generator/param-mg-vasp-old.json +++ b/tests/generator/param-mg-vasp-old.json @@ -1,103 +1,147 @@ -{ - "type_map": ["Mg", "Al"], - "mass_map": [24, 27], - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR"] +{ + "type_map": [ + "Mg", + "Al" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,1], "temps": [50,100], "press": [1.0,2.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["vasp/potcars/POTCAR.mg", "vasp/potcars/POTCAR.al"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 600, - "ediff": 1e-6, - "kspacing": 0.16, - "_comment": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", - "smearing": "mp", - "sigma": 0.25, - "_comment": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", - "metagga": "NONE", - "npar": 1, - "kpar": 1, - "user_vasp_params": { - "EDIFF" : 1e-5 - }, - "_comment": " that's all " + "fp_params": { + "_comment12": "given in unit depending on the fp method", + "ecut": 600, + "ediff": 1e-06, + "kspacing": 0.16, + "_comment13": "gauss, mp:N(methfessel-paxton:order by default order=1), fd(Fermi-Dirac)", + "smearing": "mp", + "sigma": 0.25, + "_comment14": "only for vasp, can be NONE, SCAN, TPSS, RTPSS, M06L or MBJ", + "metagga": "NONE", + "npar": 1, + "kpar": 1, + "user_vasp_params": { + "EDIFF": 1e-05 + }, + "_comment15": " that's all " }, - "_comment": " that's all " + "_comment16": " that's all " } diff --git a/tests/generator/param-mg-vasp-v1-et.json b/tests/generator/param-mg-vasp-v1-et.json index cfa8071d1..80c088102 100644 --- a/tests/generator/param-mg-vasp-v1-et.json +++ b/tests/generator/param-mg-vasp-v1-et.json @@ -1,96 +1,134 @@ { - "type_map": ["Al", "Mg"], - "mass_map": [27, 24], - "use_ele_temp": 2, - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR"] + "type_map": [ + "Al", + "Mg" ], - "sys_batch_size": [1,1], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "model" : { - "descriptor": { - "type": "se_a", - "sel": [90, 90], - "rcut_smth": 1.80, - "rcut": 6.00, - "neuron": [10, 20, 40], - "resnet_dt": false, - "axis_neuron": 4, - "seed": 1 - }, - "fitting_net" : { - "neuron": [120, 120, 120], - "resnet_dt": true, - "numb_fparam": 10, - "seed": 1 - } - }, - - "loss" : { - "start_pref_e": 0.02, - "limit_pref_e": 1, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - - "learning_rate" : { - "start_lr": 0.001, - "decay_steps": 5000, - "decay_rate": 0.95 - }, - - "training" : { - "systems": [], - "set_prefix": "set", - "stop_batch": 1000, - "batch_size": 1, - - "seed": 1, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training":true, - "time_training":true, - "profiling": false, - "profiling_file": "timeline.json" - } + "mass_map": [ + 27, + 24 + ], + "use_ele_temp": 2, + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR" + ] + ], + "sys_batch_size": [ + 1, + 1 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "type": "se_a", + "sel": [ + 90, + 90 + ], + "rcut_smth": 1.8, + "rcut": 6.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 4, + "seed": 1 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "numb_fparam": 10, + "seed": 1 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 1, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "start_lr": 0.001, + "decay_steps": 5000, + "stop_lr": 0.0009897937816869885 + }, + "training": { + "stop_batch": 1000, + "seed": 1, + "_comment2": " display and restart", + "_comment3": " frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json", + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { "_idx": 0, "ensemble": "npt", "nsteps": 50, "press": [1.0,2.0], "sys_idx": [0, 1], "temps": [50,100], "trj_freq": 10 } + "_comment4": " 01.model_devi ", + "_comment5": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 50, + "press": [ + 1.0, + 2.0 + ], + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "trj_freq": 10 + } + ], + "_comment6": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 8, + "fp_task_min": 2, + "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", + "fp_pp_files": [ + "POTCAR.Al", + "POTCAR.Mg" ], - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 8, - "fp_task_min": 2, - "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", - "fp_pp_files": ["POTCAR.Al", "POTCAR.Mg"], - "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", - "_comment": " that's all " + "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", + "_comment7": " that's all " } - diff --git a/tests/generator/param-mg-vasp-v1.json b/tests/generator/param-mg-vasp-v1.json index 9355bea0d..79b296b8f 100644 --- a/tests/generator/param-mg-vasp-v1.json +++ b/tests/generator/param-mg-vasp-v1.json @@ -1,95 +1,133 @@ { - "type_map": ["Al", "Mg"], - "mass_map": [27, 24], - "use_ele_temp": 0, - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR"] + "type_map": [ + "Al", + "Mg" ], - "sys_batch_size": [1,1], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "model" : { - "descriptor": { - "type": "se_a", - "sel": [90, 90], - "rcut_smth": 1.80, - "rcut": 6.00, - "neuron": [10, 20, 40], - "resnet_dt": false, - "axis_neuron": 4, - "seed": 1 - }, - "fitting_net" : { - "neuron": [120, 120, 120], - "resnet_dt": true, - "seed": 1 - } - }, - - "loss" : { - "start_pref_e": 0.02, - "limit_pref_e": 1, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0, - "limit_pref_v": 0 - }, - - "learning_rate" : { - "start_lr": 0.001, - "decay_steps": 5000, - "decay_rate": 0.95 - }, - - "training" : { - "systems": [], - "set_prefix": "set", - "stop_batch": 1000, - "batch_size": 1, - - "seed": 1, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training":true, - "time_training":true, - "profiling": false, - "profiling_file": "timeline.json" - } + "mass_map": [ + 27, + 24 + ], + "use_ele_temp": 0, + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000010/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/00000[8-9]/POSCAR" + ] + ], + "sys_batch_size": [ + 1, + 1 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "type": "se_a", + "sel": [ + 90, + 90 + ], + "rcut_smth": 1.8, + "rcut": 6.0, + "neuron": [ + 10, + 20, + 40 + ], + "resnet_dt": false, + "axis_neuron": 4, + "seed": 1 + }, + "fitting_net": { + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true, + "seed": 1 + } + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 1, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0, + "limit_pref_v": 0 + }, + "learning_rate": { + "start_lr": 0.001, + "decay_steps": 5000, + "decay_rate": 0.95 + }, + "training": { + "systems": [], + "set_prefix": "set", + "stop_batch": 1000, + "batch_size": 1, + "seed": 1, + "_comment2": " display and restart", + "_comment3": " frequencies counted in batch", + "disp_file": "lcurve.out", + "disp_freq": 1000, + "numb_test": 1, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "load_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "profiling_file": "timeline.json" + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { "_idx": 0, "ensemble": "npt", "nsteps": 50, "press": [1.0,2.0], "sys_idx": [0, 1], "temps": [50,100], "trj_freq": 10 } + "_comment4": " 01.model_devi ", + "_comment5": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 50, + "press": [ + 1.0, + 2.0 + ], + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "trj_freq": 10 + } + ], + "_comment6": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 8, + "fp_task_min": 2, + "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", + "fp_pp_files": [ + "POTCAR.Al", + "POTCAR.Mg" ], - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 8, - "fp_task_min": 2, - "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", - "fp_pp_files": ["POTCAR.Al", "POTCAR.Mg"], - "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", - "_comment": " that's all " + "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", + "_comment7": " that's all " } - diff --git a/tests/generator/param-mg-vasp.json b/tests/generator/param-mg-vasp.json index df2c86172..2de1d32a6 100644 --- a/tests/generator/param-mg-vasp.json +++ b/tests/generator/param-mg-vasp.json @@ -1,108 +1,152 @@ -{ - "type_map": ["Mg", "Al"], - "mass_map": [24, 27], - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR"] +{ + "type_map": [ + "Mg", + "Al" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,1], "temps": [50,100], "press": [1.0,2.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["vasp/potcars/POTCAR.mg", "vasp/potcars/POTCAR.al"], - "_comment": " user provided vasp script ", + "_comment12": " user provided vasp script ", "user_fp_params": { - "PREC": "A", - "ENCUT": 600, - "ISYM": 0, - "ALGO": "fast", - "EDIFF": 1e-05, - "LREAL": "A", - "NPAR": 1, - "KPAR": 1, - "NELMIN": 4, - "ISIF": 2, - "ISMEAR": 1, - "SIGMA": 0.25, - "IBRION": -1, - "NSW": 0, - "LWAVE": false, - "LCHARG": false, - "PSTRESS": 0, - "KSPACING": 0.16, - "KGAMMA": false + "PREC": "A", + "ENCUT": 600, + "ISYM": 0, + "ALGO": "fast", + "EDIFF": 1e-05, + "LREAL": "A", + "NPAR": 1, + "KPAR": 1, + "NELMIN": 4, + "ISIF": 2, + "ISMEAR": 1, + "SIGMA": 0.25, + "IBRION": -1, + "NSW": 0, + "LWAVE": false, + "LCHARG": false, + "PSTRESS": 0, + "KSPACING": 0.16, + "KGAMMA": false }, - "_comment": " that's all " + "_comment13": " that's all " } diff --git a/tests/generator/param-mg-vasp_merge_traj.json b/tests/generator/param-mg-vasp_merge_traj.json index 4d8f1c75f..0d51ffeb1 100644 --- a/tests/generator/param-mg-vasp_merge_traj.json +++ b/tests/generator/param-mg-vasp_merge_traj.json @@ -1,108 +1,152 @@ -{ - "type_map": ["Mg", "Al"], - "mass_map": [24, 27], - - "init_data_prefix": "data", - "init_data_sys": ["deepmd" - ], - "init_batch_size": [16], - "sys_configs": [ - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR"], - ["data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR"] +{ + "type_map": [ + "Mg", + "Al" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, "model_devi_merge_traj": true, - "model_devi_jobs": [ - {"sys_idx": [0,1], "temps": [50,100], "press": [1.0,2.0], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"} + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" ], - - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["vasp/potcars/POTCAR.mg", "vasp/potcars/POTCAR.al"], - "_comment": " user provided vasp script ", + "_comment12": " user provided vasp script ", "user_fp_params": { - "PREC": "A", - "ENCUT": 600, - "ISYM": 0, - "ALGO": "fast", - "EDIFF": 1e-05, - "LREAL": "A", - "NPAR": 1, - "KPAR": 1, - "NELMIN": 4, - "ISIF": 2, - "ISMEAR": 1, - "SIGMA": 0.25, - "IBRION": -1, - "NSW": 0, - "LWAVE": false, - "LCHARG": false, - "PSTRESS": 0, - "KSPACING": 0.16, - "KGAMMA": false + "PREC": "A", + "ENCUT": 600, + "ISYM": 0, + "ALGO": "fast", + "EDIFF": 1e-05, + "LREAL": "A", + "NPAR": 1, + "KPAR": 1, + "NELMIN": 4, + "ISIF": 2, + "ISMEAR": 1, + "SIGMA": 0.25, + "IBRION": -1, + "NSW": 0, + "LWAVE": false, + "LCHARG": false, + "PSTRESS": 0, + "KSPACING": 0.16, + "KGAMMA": false }, - "_comment": " that's all " + "_comment13": " that's all " } diff --git a/tests/generator/param-mgo-cp2k-exinput.json b/tests/generator/param-mgo-cp2k-exinput.json index 0c4f33b75..14aa22a41 100644 --- a/tests/generator/param-mgo-cp2k-exinput.json +++ b/tests/generator/param-mgo-cp2k-exinput.json @@ -1,102 +1,316 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } ], - - "_comment": " 02.fp ", - "fp_style": "cp2k", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": [], + "_comment11": " 02.fp ", + "fp_style": "cp2k", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [], "external_input_path": "./cp2k_make_fp_files/exinput/template.inp", - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/generator/param-pyridine-cp2k.json b/tests/generator/param-pyridine-cp2k.json index 1dd5f737c..911098807 100644 --- a/tests/generator/param-pyridine-cp2k.json +++ b/tests/generator/param-pyridine-cp2k.json @@ -1,105 +1,319 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } ], - - "_comment": " 02.fp ", - "fp_style": "cp2k", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": [], - "user_fp_params": { - "FORCE_EVAL":{ - "DFT":{ + "_comment11": " 02.fp ", + "fp_style": "cp2k", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [], + "user_fp_params": { + "FORCE_EVAL": { + "DFT": { "SCF": { "OT": { "MINIMIZER": "DIIS", @@ -107,15 +321,26 @@ } } }, - "SUBSYS":{ - "KIND":{ - "_": ["N","C","H"], - "POTENTIAL": ["GTH-PBE-q5","GTH-PBE-q4", "GTH-PBE-q1"], - "BASIS_SET": ["DZVP-MOLOPT-GTH","DZVP-MOLOPT-GTH","DZVP-MOLOPT-GTH"] - } - } - } - + "SUBSYS": { + "KIND": { + "_": [ + "N", + "C", + "H" + ], + "POTENTIAL": [ + "GTH-PBE-q5", + "GTH-PBE-q4", + "GTH-PBE-q1" + ], + "BASIS_SET": [ + "DZVP-MOLOPT-GTH", + "DZVP-MOLOPT-GTH", + "DZVP-MOLOPT-GTH" + ] + } + } + } }, - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/generator/param-pyridine-gaussian.json b/tests/generator/param-pyridine-gaussian.json index a92f6ee6f..a456b26fb 100644 --- a/tests/generator/param-pyridine-gaussian.json +++ b/tests/generator/param-pyridine-gaussian.json @@ -1,105 +1,319 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } ], - - "_comment": " 02.fp ", - "fp_style": "gaussian", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": [], - "user_fp_params": { - "nproc": 14, - "keywords": "force b3lyp/6-31g*" + "_comment11": " 02.fp ", + "fp_style": "gaussian", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [], + "user_fp_params": { + "nproc": 14, + "keywords": "force b3lyp/6-31g*" }, - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/generator/param-pyridine-pwmat.json b/tests/generator/param-pyridine-pwmat.json index d19f71289..ac73b09b6 100644 --- a/tests/generator/param-pyridine-pwmat.json +++ b/tests/generator/param-pyridine-pwmat.json @@ -1,120 +1,337 @@ -{ - "type_map": ["H", "C", "N"], - "mass_map": [2, 16, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "H", + "C", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 2, + 16, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } + ], + "_comment11": " 02.fp ", + "fp_style": "pwmat", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "C.SG15.PBE.UPF", + "H.SG15.PBE.UPF", + "N.SG15.PBE.UPF" ], - - "_comment": " 02.fp ", - "fp_style": "pwmat", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["C.SG15.PBE.UPF", "H.SG15.PBE.UPF", "N.SG15.PBE.UPF"], - "user_fp_params": { - "node1": 4, - "node2": 1, - "job": "SCF", - "in.atom": "atom.config", - "in.psp1": "C.SG15.PBE.UPF", - "in.psp2": "H.SG15.PBE.UPF", - "in.psp3": "N.SG15.PBE.UPF", - "ecut": 50, - "flag_symm": 2, - "e_error": 1.0E-4, - "rho_error": 1.0E-4, - "scf_iter0_1": "6 4 3 0.0000 0.025 2", - "scf_iter0_2": "94 4 3 1.0000 0.025 2", - "xcfunctional": "PBE", - "convergence": "EASY", - "kspacing": 0.1 - + "user_fp_params": { + "node1": 4, + "node2": 1, + "job": "SCF", + "in.atom": "atom.config", + "in.psp1": "C.SG15.PBE.UPF", + "in.psp2": "H.SG15.PBE.UPF", + "in.psp3": "N.SG15.PBE.UPF", + "ecut": 50, + "flag_symm": 2, + "e_error": 0.0001, + "rho_error": 0.0001, + "scf_iter0_1": "6 4 3 0.0000 0.025 2", + "scf_iter0_2": "94 4 3 1.0000 0.025 2", + "xcfunctional": "PBE", + "convergence": "EASY", + "kspacing": 0.1 }, - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/generator/param-pyridine-pwscf-old.json b/tests/generator/param-pyridine-pwscf-old.json index 145d9aadf..11a419f9e 100644 --- a/tests/generator/param-pyridine-pwscf-old.json +++ b/tests/generator/param-pyridine-pwscf-old.json @@ -1,110 +1,328 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } + ], + "_comment11": " 02.fp ", + "fp_style": "pwscf", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "C_HSCV_PBE-1.0.UPF", + "H_HSCV_PBE-1.0.UPF", + "N_HSCV_PBE-1.0.UPF" ], - - "_comment": " 02.fp ", - "fp_style": "pwscf", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["C_HSCV_PBE-1.0.UPF", "H_HSCV_PBE-1.0.UPF", "N_HSCV_PBE-1.0.UPF"], - "fp_params": { - "_comment": "given in unit depending on the fp method", - "ecut": 110, - "ediff": 1e-8, - "kspacing": 0.6, - "npar": 1, - "kpar": 1, - "_comment": " that's all " + "fp_params": { + "_comment12": "given in unit depending on the fp method", + "ecut": 110, + "ediff": 1e-08, + "kspacing": 0.6, + "npar": 1, + "kpar": 1, + "_comment13": " that's all " }, - "_comment": " that's all " + "_comment14": " that's all " } diff --git a/tests/generator/param-pyridine-pwscf.json b/tests/generator/param-pyridine-pwscf.json index 94af3e8b6..c6a7cd80a 100644 --- a/tests/generator/param-pyridine-pwscf.json +++ b/tests/generator/param-pyridine-pwscf.json @@ -1,123 +1,341 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } + ], + "_comment11": " 02.fp ", + "fp_style": "pwscf", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "C_HSCV_PBE-1.0.UPF", + "H_HSCV_PBE-1.0.UPF", + "N_HSCV_PBE-1.0.UPF" ], - - "_comment": " 02.fp ", - "fp_style": "pwscf", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["C_HSCV_PBE-1.0.UPF", "H_HSCV_PBE-1.0.UPF", "N_HSCV_PBE-1.0.UPF"], - "user_fp_params": { - "_comment": "pseudo_dir will be added automatically", - "control": { - "calculation": "scf", - "restart_mode": "from_scratch", - "outdir": "./OUT", - "tprnfor": true, - "tstress": true, - "disk_io": "none" - }, - "_comment": "ibrav, nat and ntyp will be added automatically", - "system": { - "vdw_corr": "TS", - "ecutwfc": 110, - "ts_vdw_econv_thr": 1e-8, - "nosym": true - }, - "electrons": { - "conv_thr": 1e-8 - }, - "kspacing": 0.6 + "user_fp_params": { + "_comment12": "pseudo_dir will be added automatically", + "control": { + "calculation": "scf", + "restart_mode": "from_scratch", + "outdir": "./OUT", + "tprnfor": true, + "tstress": true, + "disk_io": "none" + }, + "_comment13": "ibrav, nat and ntyp will be added automatically", + "system": { + "vdw_corr": "TS", + "ecutwfc": 110, + "ts_vdw_econv_thr": 1e-08, + "nosym": true + }, + "electrons": { + "conv_thr": 1e-08 + }, + "kspacing": 0.6 }, - "_comment": " that's all " + "_comment14": " that's all " } diff --git a/tests/generator/param-pyridine-siesta.json b/tests/generator/param-pyridine-siesta.json index d718d52ed..3667402fa 100644 --- a/tests/generator/param-pyridine-siesta.json +++ b/tests/generator/param-pyridine-siesta.json @@ -1,108 +1,326 @@ -{ - "type_map": ["C", "H", "N"], - "mass_map": [16, 2, 14], - - "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", - "init_data_sys": ["Pyridine-I", - "Pyridine-II" - ], - "init_batch_size": [1, 1], - "sys_configs": [ - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR"], - ["/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR"] +{ + "type_map": [ + "C", + "H", + "N" ], - "_comment": "0 1 2 3", - "_comment": "4 5 6 7", - "sys_batch_size": [1, 1, 1, 1, - 1, 1, 1, 1 - ], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [81, 81, 20], - "rcut_smth": 0.50, - "rcut": 6.50, - "filter_neuron": [25, 50, 100], - "filter_resnet_dt": false, - "n_axis_neuron": 12, - "n_neuron": [240, 240, 240], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 400000, - "batch_size": 1, - "start_lr": 0.002, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 2000, - "numb_test": 10, - "save_freq": 20000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "mass_map": [ + 16, + 2, + 14 + ], + "init_data_prefix": "/home/linfengz/SCR/wanghan/deepgen.pyridine/init", + "init_data_sys": [ + "Pyridine-I", + "Pyridine-II" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyI.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/00009?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[7-8]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[5-6]?/POSCAR" + ], + [ + "/home/linfengz/SCR/wanghan/data/pyridine/pyII.POSCAR.01x01x01/01.scale_pert/sys-0080-0080-0016/scale-1.000/0000[0-4]?/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 81, + 81, + 20 + ], + "rcut": 6.5, + "rcut_smth": 0.5, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.001, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.050, - "model_devi_f_trust_hi": 0.150, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "00"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "01"}, - {"sys_idx": [0,4], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "02"}, - {"sys_idx": [1,5], "temps": [ 50], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "03"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "04"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "05"}, - {"sys_idx": [0,4], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "06"}, - {"sys_idx": [1,5], "temps": [ 100], "press": [1e0,1e1,1e2,1e3,1e4,2e4,4e4], "trj_freq": 10, "nsteps": 1000, "ensemble": "npt", "_idx": "07"} + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.001, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "00" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "01" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "02" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 50 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "03" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "04" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "05" + }, + { + "sys_idx": [ + 0, + 4 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "06" + }, + { + "sys_idx": [ + 1, + 5 + ], + "temps": [ + 100 + ], + "press": [ + 1.0, + 10.0, + 100.0, + 1000.0, + 10000.0, + 20000.0, + 40000.0 + ], + "trj_freq": 10, + "nsteps": 1000, + "ensemble": "npt", + "_idx": "07" + } + ], + "_comment11": " 02.fp ", + "fp_style": "siesta", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "C.psf", + "H.psf", + "N.psf" ], - - "_comment": " 02.fp ", - "fp_style": "siesta", - "shuffle_poscar": false, - "fp_task_max": 100, - "fp_task_min": 10, - "fp_pp_path": ".", - "fp_pp_files": ["C.psf", "H.psf", "N.psf"], - "fp_params":{ - "ecut": 300, - "ediff": 1.0e-4, - "mixingWeight": 0.05, - "NumberPulay":5, - "kspacing": 0.5 + "fp_params": { + "ecut": 300, + "ediff": 0.0001, + "mixingWeight": 0.05, + "NumberPulay": 5, + "kspacing": 0.5 }, - "_comment": " that's all " + "_comment12": " that's all " } diff --git a/tests/sample.json b/tests/sample.json index c068f91ac..603a4ea06 100644 --- a/tests/sample.json +++ b/tests/sample.json @@ -1 +1,3 @@ -{"aa": "bb"} \ No newline at end of file +{ + "aa": "bb" +} diff --git a/tests/test_check_examples.py b/tests/test_check_examples.py index 976980b15..8522e8568 100644 --- a/tests/test_check_examples.py +++ b/tests/test_check_examples.py @@ -54,19 +54,19 @@ run_jdata, p_examples / "run" - / "dp1.x-lammps-vasp" + / "dp2.x-lammps-vasp" / "CH4" - / "param_CH4_deepmd-kit-1.1.0.json", + / "param_CH4_deepmd-kit-2.x.json", ), ( run_jdata, p_examples / "run" - / "dp1.x-lammps-vasp" + / "dp2.x-lammps-vasp" / "Al" - / "param_al_all_gpu-deepmd-kit-1.1.0.json", + / "param_al_all_gpu-deepmd-kit-2.x.json", ), - (run_jdata, p_examples / "run" / "dp1.x-lammps-vasp-et" / "param_elet.json"), + (run_jdata, p_examples / "run" / "dp2.x-lammps-vasp-et" / "param_elet.json"), ( run_jdata, p_examples / "run" / "dp2.x-lammps-ABACUS-lcao" / "fcc-al" / "run_param.json", @@ -77,19 +77,19 @@ ), ( run_jdata, - p_examples / "run" / "dp1.x-lammps-cp2k" / "methane" / "param-ch4.json", + p_examples / "run" / "dp2.x-lammps-cp2k" / "methane" / "param-ch4.json", ), ( run_jdata, - p_examples / "run" / "dp1.x-lammps-ABACUS-pw" / "methane" / "param.json", + p_examples / "run" / "dp2.x-lammps-ABACUS-pw" / "methane" / "param.json", ), ( run_jdata, - p_examples / "run" / "dp1.x-lammps-ABACUS-lcao-dpks" / "methane" / "param.json", + p_examples / "run" / "dp2.x-lammps-ABACUS-lcao-dpks" / "methane" / "param.json", ), ( run_jdata, - p_examples / "run" / "dp1.x_lammps_gaussian" / "dodecane" / "dodecane.json", + p_examples / "run" / "dp2.x_lammps_gaussian" / "dodecane" / "dodecane.json", ), (run_jdata, p_examples / "run" / "dp-lammps-enhance_sampling" / "param.json"), # (run_jdata, p_examples / "run" / "deprecated" / "param-mg-vasp.json"), @@ -101,17 +101,17 @@ p_examples / "run" / "deprecated" - / "dp0.12-lammps-cp2k" + / "dp2.x-lammps-cp2k" / "CH4" / "param_CH4.json", ), - # (run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-pwmat" / "param_CH4.json"), + # (run_jdata, p_examples / "run" / "deprecated" / "dp2.x-lammps-pwmat" / "param_CH4.json"), ( run_jdata, p_examples / "run" / "deprecated" - / "dp0.12-lammps-siesta" + / "dp2.x-lammps-siesta" / "dp-lammps-siesta" / "CH4" / "param_CH4.json", @@ -121,7 +121,7 @@ p_examples / "run" / "deprecated" - / "dp0.12-lammps-vasp" + / "dp2.x-lammps-vasp" / "Al" / "param_al_all_gpu.json", ), @@ -130,7 +130,7 @@ p_examples / "run" / "deprecated" - / "dp0.12-lammps-vasp" + / "dp2.x-lammps-vasp" / "CH4" / "param_CH4.json", ), diff --git a/tests/tools/machine_fp_single.json b/tests/tools/machine_fp_single.json index f998388eb..bb828fc32 100644 --- a/tests/tools/machine_fp_single.json +++ b/tests/tools/machine_fp_single.json @@ -1,15 +1,17 @@ { - "fp":[ - { - "command": "vasp_std", - "machine":{ - "batch_type": "PBS" - }, - "resources": { - "group_size" : 8 - }, - "_comments" : "In user_forward_files, define input files to be uploaded.", - "user_forward_files" : ["vdw_kernel.bindat"] - } + "fp": [ + { + "command": "vasp_std", + "machine": { + "batch_type": "PBS" + }, + "resources": { + "group_size": 8 + }, + "_comments": "In user_forward_files, define input files to be uploaded.", + "user_forward_files": [ + "vdw_kernel.bindat" + ] + } ] -} \ No newline at end of file +} diff --git a/tests/tools/machine_fp_single2.json b/tests/tools/machine_fp_single2.json index 8c2212927..772f655ca 100644 --- a/tests/tools/machine_fp_single2.json +++ b/tests/tools/machine_fp_single2.json @@ -1,14 +1,15 @@ { - "fp": - { - "command": "vasp_std", - "machine":{ - "batch_type": "PBS" - }, - "resources": { - "group_size" : 8 - }, - "_comments" : "In user_forward_files, define input files to be uploaded.", - "user_forward_files" : ["vdw_kernel.bindat"] + "fp": { + "command": "vasp_std", + "machine": { + "batch_type": "PBS" + }, + "resources": { + "group_size": 8 + }, + "_comments": "In user_forward_files, define input files to be uploaded.", + "user_forward_files": [ + "vdw_kernel.bindat" + ] } -} \ No newline at end of file +} diff --git a/tests/tools/run_report_test_output/param.json b/tests/tools/run_report_test_output/param.json index e8d11b9a8..397a785df 100644 --- a/tests/tools/run_report_test_output/param.json +++ b/tests/tools/run_report_test_output/param.json @@ -1,87 +1,132 @@ { - "type_map": ["Al", "Mg"], - "mass_map": [27, 24], - - "init_data_prefix": "/home/wanghan/study/deep.md/data/almgop.20/init//", - - "init_data_sys": [ - "al.fcc.01x01x01/02.md/sys-0004/deepmd", - "mg.fcc.01x01x01/02.md/sys-0004/deepmd" + "type_map": [ + "Al", + "Mg" ], - "init_batch_size": [1,1], - "sys_configs": [ - ["/home/wanghan/study/deep.md/data/almgop.20/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"], - ["/home/wanghan/study/deep.md/data/almgop.20/init/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR"] + "mass_map": [ + 27, + 24 ], - "sys_batch_size": [1,1], - - "_comment": " 00.train ", - "numb_models": 4, - "default_training_param" : { - "_comment": " model parameters", - "use_smooth": true, - "sel_a": [90, 90], - "rcut_smth": 2.00, - "rcut": 6.00, - "filter_neuron": [10, 20, 40], - "filter_resnet_dt": false, - "n_axis_neuron": 4, - "n_neuron": [120, 120, 120], - "resnet_dt": true, - "coord_norm": true, - "type_fitting_net": false, - - "_comment": " traing controls", - "systems": [], - "set_prefix": "set", - "stop_batch": 1000, - "batch_size": 1, - "start_lr": 0.001, - "decay_steps": 2000, - "decay_rate": 0.95, - "seed": 0, - - "start_pref_e": 0.02, - "limit_pref_e": 2, - "start_pref_f": 1000, - "limit_pref_f": 1, - "start_pref_v": 0.0, - "limit_pref_v": 0.0, - - "_comment": " display and restart", - "_comment": " frequencies counted in batch", - "disp_file": "lcurve.out", - "disp_freq": 1000, - "numb_test": 1, - "save_freq": 1000, - "save_ckpt": "model.ckpt", - "load_ckpt": "model.ckpt", - "disp_training": true, - "time_training": true, - "profiling": false, - "profiling_file": "timeline.json", - - "_comment": "that's all" + "init_data_prefix": "/home/wanghan/study/deep.md/data/almgop.20/init//", + "init_data_sys": [ + "al.fcc.01x01x01/02.md/sys-0004/deepmd", + "mg.fcc.01x01x01/02.md/sys-0004/deepmd" + ], + "init_batch_size": [ + 1, + 1 + ], + "sys_configs": [ + [ + "/home/wanghan/study/deep.md/data/almgop.20/init/al.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ], + [ + "/home/wanghan/study/deep.md/data/almgop.20/init/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale-1.000/00000[0-4]/POSCAR" + ] + ], + "sys_batch_size": [ + 1, + 1 + ], + "_comment1": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90, + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 10, + 20, + 40 + ], + "axis_neuron": 4, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 120, + 120, + 120 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.001, + "stop_lr": 0.0009746794344808964 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 1000, + "disp_file": "lcurve.out", + "disp_freq": 1000, + "save_freq": 1000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } }, - - "_comment": " 01.model_devi ", - "_comment": "model_devi_skip: the first x of the recorded frames", - "model_devi_dt": 0.002, - "model_devi_skip": 0, - "model_devi_f_trust_lo": 0.05, - "model_devi_f_trust_hi": 0.20, - "model_devi_clean_traj": false, - "model_devi_jobs": [ - { "_idx": 0, "ensemble": "npt", "nsteps": 50, "press": [1.0,2.0], "sys_idx": [0, 1], "temps": [50,100], "trj_freq": 10 } + "_comment7": " 01.model_devi ", + "_comment8": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.2, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "_idx": 0, + "ensemble": "npt", + "nsteps": 50, + "press": [ + 1.0, + 2.0 + ], + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "trj_freq": 10 + } + ], + "_comment9": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 8, + "fp_task_min": 2, + "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", + "fp_pp_files": [ + "POTCAR.Al", + "POTCAR.Mg" ], - "_comment": " 02.fp ", - "fp_style": "vasp", - "shuffle_poscar": false, - "fp_task_max": 8, - "fp_task_min": 2, - "fp_pp_path": "/home/wanghan/study/deep.md/dpgen/almg/vasp", - "fp_pp_files": ["POTCAR.Al", "POTCAR.Mg"], - "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", - "_comment": " that's all " + "fp_incar": "/home/wanghan/study/deep.md/dpgen/almg/vasp/INCAR", + "_comment10": " that's all " } - From 2b6fecff493c2f871b6a1ad9f09468671d59e42d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:43:55 +0800 Subject: [PATCH 61/86] [pre-commit.ci] pre-commit autoupdate (#1317) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.285...v0.0.286) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 904018833..aaf40472b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.285 + rev: v0.0.286 hooks: - id: ruff args: ["--fix"] From 1f0505d510c4f7c280536c20e28906ce57e91d5c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sat, 2 Sep 2023 10:39:12 -0400 Subject: [PATCH 62/86] simplify: support using true error as error indicator (#1321) i.e. Eq. B.2 in the DP-GEN paper. Requires DeePMD-kit version >=2.2.4. --- dpgen/simplify/arginfo.py | 32 +++++++ dpgen/simplify/simplify.py | 126 +++++++++++++++++++------ tests/simplify/test_post_model_devi.py | 26 +++++ tests/simplify/test_run_model_devi.py | 26 +++++ 4 files changed, 180 insertions(+), 30 deletions(-) diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 9aa8f0234..5db5b0812 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -34,6 +34,10 @@ def general_simplify_arginfo() -> Argument: ) doc_model_devi_e_trust_lo = "The lower bound of energy per atom for the selection for the model deviation. Requires DeePMD-kit version >=2.2.2." doc_model_devi_e_trust_hi = "The higher bound of energy per atom for the selection for the model deviation. Requires DeePMD-kit version >=2.2.2." + doc_true_error_f_trust_lo = "The lower bound of forces for the selection for the true error. Requires DeePMD-kit version >=2.2.4." + doc_true_error_f_trust_hi = "The higher bound of forces for the selection for the true error. Requires DeePMD-kit version >=2.2.4." + doc_true_error_e_trust_lo = "The lower bound of energy per atom for the selection for the true error. Requires DeePMD-kit version >=2.2.4." + doc_true_error_e_trust_hi = "The higher bound of energy per atom for the selection for the true error. Requires DeePMD-kit version >=2.2.4." return [ Argument("labeled", bool, optional=True, default=False, doc=doc_labeled), @@ -66,6 +70,34 @@ def general_simplify_arginfo() -> Argument: default=float("inf"), doc=doc_model_devi_e_trust_hi, ), + Argument( + "true_error_f_trust_lo", + float, + optional=True, + default=float("inf"), + doc=doc_true_error_f_trust_lo, + ), + Argument( + "true_error_f_trust_hi", + float, + optional=True, + default=float("inf"), + doc=doc_true_error_f_trust_hi, + ), + Argument( + "true_error_e_trust_lo", + float, + optional=True, + default=float("inf"), + doc=doc_true_error_e_trust_lo, + ), + Argument( + "true_error_e_trust_hi", + float, + optional=True, + default=float("inf"), + doc=doc_true_error_e_trust_hi, + ), ] diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index e5dc24d7c..c392adbf5 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -52,6 +52,7 @@ rest_data_name = "data.rest" accurate_data_name = "data.accurate" detail_file_name_prefix = "details" +true_error_file_name = "true_error" sys_name_fmt = "sys." + data_system_fmt sys_name_pattern = "sys.[0-9]*[0-9]" @@ -238,6 +239,18 @@ def run_model_devi(iter_index, jdata, mdata): forward_files = [system_file_name] backward_files = [detail_file_name] + f_trust_lo_err = jdata.get("true_error_f_trust_lo", float("inf")) + e_trust_lo_err = jdata.get("true_error_e_trust_lo", float("inf")) + if f_trust_lo_err < float("inf") or e_trust_lo_err < float("inf"): + command_true_error = "{dp} model-devi -m {model} -s {system} -o {detail_file} --real_error".format( + dp=mdata.get("model_devi_command", "dp"), + model=" ".join(task_model_list), + system=system_file_name, + detail_file=true_error_file_name, + ) + commands.append(command_true_error) + backward_files.append(true_error_file_name) + api_version = mdata.get("api_version", "1.0") if Version(api_version) < Version("1.0"): raise RuntimeError( @@ -270,6 +283,11 @@ def post_model_devi(iter_index, jdata, mdata): f_trust_hi = jdata["model_devi_f_trust_hi"] e_trust_lo = jdata["model_devi_e_trust_lo"] e_trust_hi = jdata["model_devi_e_trust_hi"] + f_trust_lo_err = jdata.get("true_error_f_trust_lo", float("inf")) + f_trust_hi_err = jdata.get("true_error_f_trust_hi", float("inf")) + e_trust_lo_err = jdata.get("true_error_e_trust_lo", float("inf")) + e_trust_hi_err = jdata.get("true_error_e_trust_hi", float("inf")) + use_true_error = f_trust_lo_err < float("inf") or e_trust_lo_err < float("inf") type_map = jdata.get("type_map", []) sys_accurate = dpdata.MultiSystems(type_map=type_map) @@ -282,38 +300,86 @@ def post_model_devi(iter_index, jdata, mdata): ) detail_file_name = detail_file_name_prefix - with open(os.path.join(work_path, detail_file_name)) as f: - for line in f: - if line.startswith("# data.rest.old"): - name = (line.split()[1]).split("/")[-1] - elif line.startswith("#"): - columns = line.split()[1:] - cidx_step = columns.index("step") - cidx_max_devi_f = columns.index("max_devi_f") - try: - cidx_devi_e = columns.index("devi_e") - except ValueError: - # DeePMD-kit < 2.2.2 - cidx_devi_e = None - else: - idx = int(line.split()[cidx_step]) - f_devi = float(line.split()[cidx_max_devi_f]) - if cidx_devi_e is not None: - e_devi = float(line.split()[cidx_devi_e]) + if not use_true_error: + with open(os.path.join(work_path, detail_file_name)) as f: + for line in f: + if line.startswith("# data.rest.old"): + name = (line.split()[1]).split("/")[-1] + elif line.startswith("#"): + columns = line.split()[1:] + cidx_step = columns.index("step") + cidx_max_devi_f = columns.index("max_devi_f") + try: + cidx_devi_e = columns.index("devi_e") + except ValueError: + # DeePMD-kit < 2.2.2 + cidx_devi_e = None else: - e_devi = 0.0 - subsys = sys_entire[name][idx] - if f_devi >= f_trust_hi or e_devi >= e_trust_hi: - sys_failed.append(subsys) - elif ( - f_trust_lo <= f_devi < f_trust_hi - or e_trust_lo <= e_devi < e_trust_hi - ): - sys_candinate.append(subsys) - elif f_devi < f_trust_lo and e_devi < e_trust_lo: - sys_accurate.append(subsys) + idx = int(line.split()[cidx_step]) + f_devi = float(line.split()[cidx_max_devi_f]) + if cidx_devi_e is not None: + e_devi = float(line.split()[cidx_devi_e]) + else: + e_devi = 0.0 + subsys = sys_entire[name][idx] + if f_devi >= f_trust_hi or e_devi >= e_trust_hi: + sys_failed.append(subsys) + elif ( + f_trust_lo <= f_devi < f_trust_hi + or e_trust_lo <= e_devi < e_trust_hi + ): + sys_candinate.append(subsys) + elif f_devi < f_trust_lo and e_devi < e_trust_lo: + sys_accurate.append(subsys) + else: + raise RuntimeError( + "reach a place that should NOT be reached..." + ) + else: + with open(os.path.join(work_path, detail_file_name)) as f, open( + os.path.join(work_path, true_error_file_name) + ) as f_err: + for line, line_err in zip(f, f_err): + if line.startswith("# data.rest.old"): + name = (line.split()[1]).split("/")[-1] + elif line.startswith("#"): + columns = line.split()[1:] + cidx_step = columns.index("step") + cidx_max_devi_f = columns.index("max_devi_f") + cidx_devi_e = columns.index("devi_e") else: - raise RuntimeError("reach a place that should NOT be reached...") + idx = int(line.split()[cidx_step]) + f_devi = float(line.split()[cidx_max_devi_f]) + f_err = float(line_err.split()[cidx_max_devi_f]) + e_devi = float(line.split()[cidx_devi_e]) + e_err = float(line_err.split()[cidx_devi_e]) + + subsys = sys_entire[name][idx] + if ( + f_devi >= f_trust_hi + or e_devi >= e_trust_hi + or f_err >= f_trust_hi_err + or e_err >= e_trust_hi_err + ): + sys_failed.append(subsys) + elif ( + f_trust_lo <= f_devi < f_trust_hi + or e_trust_lo <= e_devi < e_trust_hi + or f_trust_lo_err <= f_err < f_trust_hi_err + or e_trust_lo_err <= e_err < e_trust_hi_err + ): + sys_candinate.append(subsys) + elif ( + f_devi < f_trust_lo + and e_devi < e_trust_lo + and f_err < f_trust_lo_err + and e_err < e_trust_lo_err + ): + sys_accurate.append(subsys) + else: + raise RuntimeError( + "reach a place that should NOT be reached..." + ) counter = { "candidate": sys_candinate.get_nframes(), diff --git a/tests/simplify/test_post_model_devi.py b/tests/simplify/test_post_model_devi.py index 0eeac7fc2..539ad0f76 100644 --- a/tests/simplify/test_post_model_devi.py +++ b/tests/simplify/test_post_model_devi.py @@ -41,6 +41,14 @@ def setUp(self): + self.system.formula + "\n step max_devi_v min_devi_v avg_devi_v max_devi_f min_devi_f avg_devi_f devi_e", ) + np.savetxt( + self.work_path / "true_error", + model_devi, + fmt=["%12d"] + ["%19.6e" for _ in range(7)], + header="data.rest.old/" + + self.system.formula + + "\n step max_devi_v min_devi_v avg_devi_v max_devi_f min_devi_f avg_devi_f devi_e", + ) def tearDown(self): shutil.rmtree("iter.000001", ignore_errors=True) @@ -114,3 +122,21 @@ def test_post_model_devi_accurate(self): {}, ) assert (self.work_path / "data.accurate" / self.system.formula).exists() + + def test_post_model_devi_true_error_candidate(self): + dpgen.simplify.simplify.post_model_devi( + 1, + { + "model_devi_e_trust_lo": 0.15, + "model_devi_e_trust_hi": 0.25, + "model_devi_f_trust_lo": float("inf"), + "model_devi_f_trust_hi": float("inf"), + "true_error_e_trust_lo": float("inf"), + "true_error_e_trust_hi": float("inf"), + "true_error_f_trust_lo": 0.15, + "true_error_f_trust_hi": 0.25, + "iter_pick_number": 1, + }, + {}, + ) + assert (self.work_path / "data.picked" / self.system.formula).exists() diff --git a/tests/simplify/test_run_model_devi.py b/tests/simplify/test_run_model_devi.py index 2499a9f9c..e928afa8e 100644 --- a/tests/simplify/test_run_model_devi.py +++ b/tests/simplify/test_run_model_devi.py @@ -84,3 +84,29 @@ def test_one_h5(self): }, } dpgen.simplify.simplify.run_model_devi(0, jdata=jdata, mdata=mdata) + + def test_true_error(self): + jdata = { + "type_map": ["H"], + "true_error_f_trust_lo": 0.15, + "true_error_f_trust_hi": 0.25, + } + with tempfile.TemporaryDirectory() as remote_root: + mdata = { + "model_devi_command": ( + f"test -d {dpgen.simplify.simplify.rest_data_name}.old" + f"&& touch {dpgen.simplify.simplify.detail_file_name_prefix}" + f"&& touch {dpgen.simplify.simplify.true_error_file_name}" + "&& echo dp" + ), + "model_devi_machine": { + "context_type": "LocalContext", + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + }, + "model_devi_resources": { + "group_size": 1, + }, + } + dpgen.simplify.simplify.run_model_devi(0, jdata=jdata, mdata=mdata) From 317c6745bf1c8fc63be58a4b0a476a02e8d36d15 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 3 Sep 2023 22:53:14 -0400 Subject: [PATCH 63/86] dprc: add `restart_from_iter` option (#1322) Add the `restart_from_iter` option in each iteration of DPRc simulations to restart from a previous iteration instead of initial structures. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 4 ++ dpgen/generator/run.py | 21 +++++++-- tests/generator/amber/MON.parm7 | 0 tests/generator/amber/init_-1.20.disang | 0 tests/generator/param-amber.json | 2 +- tests/generator/test_make_md.py | 60 +++++++++++++++++++++++-- 6 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 tests/generator/amber/MON.parm7 create mode 100644 tests/generator/amber/init_-1.20.disang diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 33dd64c88..0ad63f22e 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -485,6 +485,7 @@ def model_devi_amber_args() -> list[Argument]: ) doc_model_devi_f_trust_lo = "Lower bound of forces for the selection. If dict, should be set for each index in sys_idx, respectively." doc_model_devi_f_trust_hi = "Upper bound of forces for the selection. If dict, should be set for each index in sys_idx, respectively." + doc_restart_from_iter = "The iteration index to restart the simulation from. If not given, the simulation is restarted from `sys_configs`." return [ # make model devi args @@ -497,6 +498,9 @@ def model_devi_amber_args() -> list[Argument]: sub_fields=[ Argument("sys_idx", list, optional=False, doc=doc_sys_idx), Argument("trj_freq", int, optional=False, doc=doc_trj_freq), + Argument( + "restart_from_iter", int, optional=True, doc=doc_restart_from_iter + ), ], ), Argument("low_level", str, optional=False, doc=doc_low_level), diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 46eea3f58..847cdb594 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -1775,10 +1775,23 @@ def _make_model_devi_amber( create_path(task_path) # link restart file loc_conf_name = "init.rst7" - os.symlink( - os.path.join(os.path.join("..", "confs"), conf_name + ".rst7"), - os.path.join(task_path, loc_conf_name), - ) + if cur_job.get("restart_from_iter") is None: + os.symlink( + os.path.join(os.path.join("..", "confs"), conf_name + ".rst7"), + os.path.join(task_path, loc_conf_name), + ) + else: + restart_from_iter = cur_job["restart_from_iter"] + restart_iter_name = make_iter_name(restart_from_iter) + os.symlink( + os.path.relpath( + os.path.join( + restart_iter_name, model_devi_name, task_name, "rc.rst7" + ), + task_path, + ), + os.path.join(task_path, loc_conf_name), + ) cwd_ = os.getcwd() # chdir to task path os.chdir(task_path) diff --git a/tests/generator/amber/MON.parm7 b/tests/generator/amber/MON.parm7 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/generator/amber/init_-1.20.disang b/tests/generator/amber/init_-1.20.disang new file mode 100644 index 000000000..e69de29bb diff --git a/tests/generator/param-amber.json b/tests/generator/param-amber.json index 6dc97aee9..905af9118 100644 --- a/tests/generator/param-amber.json +++ b/tests/generator/param-amber.json @@ -12,7 +12,7 @@ "numb_models": 4, "mdin_prefix": "amber", "parm7_prefix": "amber", - "sys_prefix": "amber", + "sys_configs_prefix": "amber", "disang_prefix": "amber", "sys_configs": [ [ diff --git a/tests/generator/test_make_md.py b/tests/generator/test_make_md.py index 165475939..c6138ee52 100644 --- a/tests/generator/test_make_md.py +++ b/tests/generator/test_make_md.py @@ -533,12 +533,66 @@ def test_make_model_devi(self): jdata = json.load(fp) with open(machine_file) as fp: mdata = json.load(fp) - jdata["sys_prefix"] = os.path.abspath(jdata["sys_prefix"]) + # TODO: these should be normalized in the main program + jdata["sys_configs_prefix"] = os.path.abspath(jdata["sys_configs_prefix"]) + jdata["disang_prefix"] = os.path.abspath(jdata["disang_prefix"]) + jdata["mdin_prefix"] = os.path.abspath(jdata["mdin_prefix"]) + jdata["parm7_prefix"] = os.path.abspath(jdata["mdin_prefix"]) _make_fake_models(0, jdata["numb_models"]) make_model_devi(0, jdata, mdata) _check_pb(self, 0) - _check_confs(self, 0, jdata) - _check_traj_dir(self, 0) + self._check_input(0) + + def test_restart_from_iter(self): + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + if os.path.isdir("iter.000001"): + shutil.rmtree("iter.000001") + with open(param_amber_file) as fp: + jdata = json.load(fp) + with open(machine_file) as fp: + mdata = json.load(fp) + jdata["model_devi_jobs"].append( + { + "sys_idx": [0], + "restart_from_iter": 0, + } + ) + jdata["sys_configs_prefix"] = os.path.abspath(jdata["sys_configs_prefix"]) + jdata["disang_prefix"] = os.path.abspath(jdata["disang_prefix"]) + jdata["mdin_prefix"] = os.path.abspath(jdata["mdin_prefix"]) + jdata["parm7_prefix"] = os.path.abspath(jdata["mdin_prefix"]) + _make_fake_models(0, jdata["numb_models"]) + make_model_devi(0, jdata, mdata) + _check_pb(self, 0) + self._check_input(0) + restart_text = "This is the fake restart file to test `restart_from_iter`" + with open( + os.path.join( + "iter.%06d" % 0, "01.model_devi", "task.000.000000", "rc.rst7" + ), + "w", + ) as fw: + fw.write(restart_text) + _make_fake_models(1, jdata["numb_models"]) + make_model_devi(1, jdata, mdata) + _check_pb(self, 1) + self._check_input(1) + with open( + os.path.join( + "iter.%06d" % 1, "01.model_devi", "task.000.000000", "init.rst7" + ) + ) as f: + assert f.read() == restart_text + + def _check_input(self, iter_idx: int): + md_dir = os.path.join("iter.%06d" % iter_idx, "01.model_devi") + assert os.path.isfile(os.path.join(md_dir, "init0.mdin")) + assert os.path.isfile(os.path.join(md_dir, "qmmm0.parm7")) + tasks = glob.glob(os.path.join(md_dir, "task.*")) + for tt in tasks: + assert os.path.isfile(os.path.join(tt, "init.rst7")) + assert os.path.isfile(os.path.join(tt, "TEMPLATE.disang")) if __name__ == "__main__": From 5b4c723bc6dc67265ee0983961808bf754380702 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 3 Sep 2023 22:53:48 -0400 Subject: [PATCH 64/86] skip Sphinx 7.2.5 (#1324) See https://github.com/sphinx-doc/sphinx/issues/11662. I hope it can be fixed in the next Sphinx version. --- doc/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 66be0d098..6c5e67fb2 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,5 @@ -sphinx>=4.0.2 +# https://github.com/sphinx-doc/sphinx/issues/11662 +sphinx>=4.0.2,!=7.2.5 recommonmark sphinx_rtd_theme sphinx_markdown_tables From beee7ef0b13e73687e84ec9946f99896aa918c86 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:09:08 +0800 Subject: [PATCH 65/86] [pre-commit.ci] pre-commit autoupdate (#1326) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.286 → v0.0.287](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.286...v0.0.287) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aaf40472b..aad5fa9e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.286 + rev: v0.0.287 hooks: - id: ruff args: ["--fix"] From 32ce9bf8311285f3e1219408238874a5ff07c7d3 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 10 Sep 2023 20:09:19 -0400 Subject: [PATCH 66/86] support electronic tempeture data used in simplify; refactor post_fp_vasp (#1329) Fix #1303. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/run.py | 56 +++++++++++++++++---------------- dpgen/simplify/simplify.py | 9 +++++- dpgen/util.py | 29 +++++++++++++++++ pyproject.toml | 2 +- tests/generator/context.py | 1 + tests/generator/test_post_fp.py | 9 ++++++ 6 files changed, 77 insertions(+), 29 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 847cdb594..d773cb861 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -95,6 +95,7 @@ normalize, sepline, set_directory, + setup_ele_temp, ) from .arginfo import run_jdata_arginfo @@ -4024,10 +4025,6 @@ def post_fp_vasp(iter_index, jdata, rfailed=None): _sys = dpdata.LabeledSystem() dlog.info("Failed fp path: %s" % oo.replace("OUTCAR", "")) if len(_sys) == 1: - if all_sys is None: - all_sys = _sys - else: - all_sys.append(_sys) # save ele_temp, if any if os.path.exists(oo.replace("OUTCAR", "job.json")): with open(oo.replace("OUTCAR", "job.json")) as fp: @@ -4036,6 +4033,27 @@ def post_fp_vasp(iter_index, jdata, rfailed=None): assert use_ele_temp ele_temp = job_data["ele_temp"] all_te.append(ele_temp) + if use_ele_temp == 0: + raise RuntimeError( + "should not get ele temp at setting: use_ele_temp == 0" + ) + elif use_ele_temp == 1: + _sys.data["fparam"] = np.array(ele_temp).reshape(1, 1) + elif use_ele_temp == 2: + tile_te = np.tile(ele_temp, [_sys.get_natoms()]) + _sys.data["aparam"] = tile_te.reshape( + 1, _sys.get_natoms(), 1 + ) + else: + raise RuntimeError( + "invalid setting of use_ele_temp " + str(use_ele_temp) + ) + # check if ele_temp shape is correct + _sys.check_data() + if all_sys is None: + all_sys = _sys + else: + all_sys.append(_sys) elif len(_sys) >= 2: raise RuntimeError("The vasp parameter NSW should be set as 1") else: @@ -4045,29 +4063,6 @@ def post_fp_vasp(iter_index, jdata, rfailed=None): sys_data_path = os.path.join(work_path, "data.%s" % ss) all_sys.to_deepmd_raw(sys_data_path) all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_outcars)) - if all_te.size > 0: - assert len(all_sys) == all_sys.get_nframes() - assert len(all_sys) == all_te.size - all_te = np.reshape(all_te, [-1, 1]) - if use_ele_temp == 0: - raise RuntimeError( - "should not get ele temp at setting: use_ele_temp == 0" - ) - elif use_ele_temp == 1: - np.savetxt(os.path.join(sys_data_path, "fparam.raw"), all_te) - np.save( - os.path.join(sys_data_path, "set.000", "fparam.npy"), all_te - ) - elif use_ele_temp == 2: - tile_te = np.tile(all_te, [1, all_sys.get_natoms()]) - np.savetxt(os.path.join(sys_data_path, "aparam.raw"), tile_te) - np.save( - os.path.join(sys_data_path, "set.000", "aparam.npy"), tile_te - ) - else: - raise RuntimeError( - "invalid setting of use_ele_temp " + str(use_ele_temp) - ) if tcount == 0: rfail = 0.0 @@ -4512,6 +4507,13 @@ def run_iter(param_file, machine_file): update_mass_map(jdata) + # set up electron temperature + use_ele_temp = jdata.get("use_ele_temp", 0) + if use_ele_temp == 1: + setup_ele_temp(False) + elif use_ele_temp == 2: + setup_ele_temp(True) + if jdata.get("pretty_print", False): from monty.serialization import dumpfn diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index c392adbf5..089545026 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -44,7 +44,7 @@ train_task_fmt, ) from dpgen.remote.decide_machine import convert_mdata -from dpgen.util import expand_sys_str, load_file, normalize, sepline +from dpgen.util import expand_sys_str, load_file, normalize, sepline, setup_ele_temp from .arginfo import simplify_jdata_arginfo @@ -519,6 +519,13 @@ def run_iter(param_file, machine_file): jdata_arginfo = simplify_jdata_arginfo() jdata = normalize(jdata_arginfo, jdata) + # set up electron temperature + use_ele_temp = jdata.get("use_ele_temp", 0) + if use_ele_temp == 1: + setup_ele_temp(False) + elif use_ele_temp == 2: + setup_ele_temp(True) + if mdata.get("handlers", None): if mdata["handlers"].get("smtp", None): que = queue.Queue(-1) diff --git a/dpgen/util.py b/dpgen/util.py index 896a3d504..cd38d1473 100644 --- a/dpgen/util.py +++ b/dpgen/util.py @@ -9,7 +9,9 @@ import dpdata import h5py +import numpy as np from dargs import Argument +from dpdata.data_type import Axis, DataType from dpgen import dlog @@ -215,3 +217,30 @@ def load_file(filename: Union[str, os.PathLike]) -> dict: else: raise ValueError(f"Unsupported file format: {filename}") return data + + +def setup_ele_temp(atomic: bool): + """Set electronic temperature as required input data. + + Parameters + ---------- + atomic : bool + Whether to use atomic temperature or frame temperature + """ + if atomic: + ele_temp_data_type = DataType( + "aparam", + np.ndarray, + shape=(Axis.NFRAMES, Axis.NATOMS, 1), + required=False, + ) + else: + ele_temp_data_type = DataType( + "fparam", + np.ndarray, + shape=(Axis.NFRAMES, 1), + required=False, + ) + + dpdata.System.register_data_type(ele_temp_data_type) + dpdata.LabeledSystem.register_data_type(ele_temp_data_type) diff --git a/pyproject.toml b/pyproject.toml index b89858ba6..2e80d1e61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ ] dependencies = [ 'numpy>=1.14.3', - 'dpdata>=0.2.6,!=0.2.11', + 'dpdata>=0.2.16', 'pymatgen>=2022.11.1', 'ase', 'monty>2.0.0', diff --git a/tests/generator/context.py b/tests/generator/context.py index 6da7932bc..7a6f1f2d3 100644 --- a/tests/generator/context.py +++ b/tests/generator/context.py @@ -17,6 +17,7 @@ _parse_calypso_input, # noqa: F401 ) from dpgen.generator.run import * # noqa: F403 +from dpgen.util import setup_ele_temp # noqa: F401 param_file = "param-mg-vasp.json" param_file_merge_traj = "param-mg-vasp_merge_traj.json" diff --git a/tests/generator/test_post_fp.py b/tests/generator/test_post_fp.py index 240ec99d6..a4f6adc5f 100644 --- a/tests/generator/test_post_fp.py +++ b/tests/generator/test_post_fp.py @@ -24,6 +24,7 @@ param_siesta_file, post_fp, post_fp_vasp, + setup_ele_temp, setUpModule, # noqa: F401 ) @@ -59,14 +60,21 @@ def setUp(self): self.ref_e = np.array(self.ref_e) self.ref_f = np.array(self.ref_f) self.ref_v = np.array(self.ref_v) + # backup dpdata system data type + self._system_dtypes = dpdata.System.DTYPES + self._labeled_system_dtypes = dpdata.LabeledSystem.DTYPES def tearDown(self): shutil.rmtree("iter.000000") + # recover + dpdata.System.DTYPES = self._system_dtypes + dpdata.LabeledSystem.DTYPES = self._labeled_system_dtypes def test_post_fp_vasp_0(self): with open(param_file) as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 2 + setup_ele_temp(True) post_fp_vasp(0, jdata, rfailed=0.3) sys = dpdata.LabeledSystem("iter.000000/02.fp/data.000/", fmt="deepmd/raw") @@ -117,6 +125,7 @@ def test_post_fp_vasp_1(self): with open(param_file) as fp: jdata = json.load(fp) jdata["use_ele_temp"] = 1 + setup_ele_temp(False) post_fp_vasp(0, jdata, rfailed=0.3) sys = dpdata.LabeledSystem("iter.000000/02.fp/data.001/", fmt="deepmd/raw") From ff402bb6a2b7c03f23dea632fabea4ad427ee194 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 11 Sep 2023 23:54:12 -0400 Subject: [PATCH 67/86] breaking: remove default values for training reuse arguments (#1330) It's not a good practice to have a default value to override the training parameters, as users may not be aware of these arguments. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 8 ++++---- dpgen/generator/run.py | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 0ad63f22e..d13d7f6c7 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -154,28 +154,28 @@ def training_args() -> list[Argument]: [None, int], alias=["training_reuse_stop_batch"], optional=True, - default=400000, + default=None, doc=doc_training_reuse_numb_steps, ), Argument( "training_reuse_start_lr", [None, float], optional=True, - default=1e-4, + default=None, doc=doc_training_reuse_start_lr, ), Argument( "training_reuse_start_pref_e", [None, float, int], optional=True, - default=0.1, + default=None, doc=doc_training_reuse_start_pref_e, ), Argument( "training_reuse_start_pref_f", [None, float, int], optional=True, - default=100, + default=None, doc=doc_training_reuse_start_pref_f, ), Argument( diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index d773cb861..cc5a9fc44 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -276,11 +276,11 @@ def make_train(iter_index, jdata, mdata): elif "training_reuse_numb_steps" in jdata.keys(): training_reuse_stop_batch = jdata["training_reuse_numb_steps"] else: - training_reuse_stop_batch = 400000 + training_reuse_stop_batch = None - training_reuse_start_lr = jdata.get("training_reuse_start_lr", 1e-4) - training_reuse_start_pref_e = jdata.get("training_reuse_start_pref_e", 0.1) - training_reuse_start_pref_f = jdata.get("training_reuse_start_pref_f", 100) + training_reuse_start_lr = jdata.get("training_reuse_start_lr") + training_reuse_start_pref_e = jdata.get("training_reuse_start_pref_e") + training_reuse_start_pref_f = jdata.get("training_reuse_start_pref_f") model_devi_activation_func = jdata.get("model_devi_activation_func", None) auto_ratio = False @@ -509,11 +509,18 @@ def make_train(iter_index, jdata, mdata): raise RuntimeError( "Unsupported DeePMD-kit version: %s" % mdata["deepmd_version"] ) - if jinput["loss"].get("start_pref_e") is not None: + if ( + jinput["loss"].get("start_pref_e") is not None + and training_reuse_start_pref_e is not None + ): jinput["loss"]["start_pref_e"] = training_reuse_start_pref_e - if jinput["loss"].get("start_pref_f") is not None: + if ( + jinput["loss"].get("start_pref_f") is not None + and training_reuse_start_pref_f is not None + ): jinput["loss"]["start_pref_f"] = training_reuse_start_pref_f - jinput["learning_rate"]["start_lr"] = training_reuse_start_lr + if training_reuse_start_lr is not None: + jinput["learning_rate"]["start_lr"] = training_reuse_start_lr input_files = [] for ii in range(numb_models): From 9a76b01ff3a716d66fca2a24c8b3a10b3640372c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 09:56:08 +0800 Subject: [PATCH 68/86] [pre-commit.ci] pre-commit autoupdate (#1331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) - [github.com/astral-sh/ruff-pre-commit: v0.0.287 → v0.0.288](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.287...v0.0.288) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aad5fa9e1..5b37f0e41 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,11 +28,11 @@ repos: # Python - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.287 + rev: v0.0.288 hooks: - id: ruff args: ["--fix"] From a714d791a007d349f575019365682188490e3e79 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 13 Sep 2023 21:47:18 -0400 Subject: [PATCH 69/86] rm old files when performing `dp model-devi` (#1332) `dp model-devi` appends output into the existing file instead of overwriting it, so if there is an existing file (maybe caused by restart), there might be errors in reading it. `rm -f` does not check if the file exists and always returns exit code 0. Signed-off-by: Jinzhe Zeng --- dpgen/simplify/simplify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 089545026..98de7c5a8 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -226,7 +226,7 @@ def run_model_devi(iter_index, jdata, mdata): labeled=False, ).to_deepmd_hdf5(system_path + ".hdf5") system_file_name += ".hdf5" - command = "{dp} model-devi -m {model} -s {system} -o {detail_file}".format( + command = "rm -f {detail_file} && {dp} model-devi -m {model} -s {system} -o {detail_file}".format( dp=mdata.get("model_devi_command", "dp"), model=" ".join(task_model_list), system=system_file_name, @@ -242,7 +242,7 @@ def run_model_devi(iter_index, jdata, mdata): f_trust_lo_err = jdata.get("true_error_f_trust_lo", float("inf")) e_trust_lo_err = jdata.get("true_error_e_trust_lo", float("inf")) if f_trust_lo_err < float("inf") or e_trust_lo_err < float("inf"): - command_true_error = "{dp} model-devi -m {model} -s {system} -o {detail_file} --real_error".format( + command_true_error = "rm -f {detail_file} && {dp} model-devi -m {model} -s {system} -o {detail_file} --real_error".format( dp=mdata.get("model_devi_command", "dp"), model=" ".join(task_model_list), system=system_file_name, From 9b44711dd3f662324764ec8ce9da7ea2495b3d69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:47:53 +0800 Subject: [PATCH 70/86] [pre-commit.ci] pre-commit autoupdate (#1338) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.288 → v0.0.290](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.288...v0.0.290) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b37f0e41..074c32ed0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.288 + rev: v0.0.290 hooks: - id: ruff args: ["--fix"] From 4a32867ff5a3f7990014a9d01131fcc9e47443f5 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 26 Sep 2023 21:18:13 -0400 Subject: [PATCH 71/86] support training with -f or -t argument (#1340) Fix #1122. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/arginfo.py | 14 ++++ dpgen/generator/run.py | 56 ++++++++++++++-- tests/generator/test_make_train.py | 102 +++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+), 6 deletions(-) diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index d13d7f6c7..971563059 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -108,6 +108,8 @@ def training_args() -> list[Argument]: doc_model_devi_activation_func = "The activation function in the model. The shape of list should be (N_models, 2), where 2 represents the embedding and fitting network. This option will override default parameters." doc_srtab_file_path = "The path of the table for the short-range pairwise interaction which is needed when using DP-ZBL potential" doc_one_h5 = "When using DeePMD-kit, all of the input data will be merged into one HDF5 file." + doc_training_init_frozen_model = "At interation 0, initilize the model parameters from the given frozen models. Number of element should be equal to numb_models." + doc_training_finetune_model = "At interation 0, finetune the model parameters from the given frozen models. Number of element should be equal to numb_models." return [ Argument("numb_models", int, optional=False, doc=doc_numb_models), @@ -186,6 +188,18 @@ def training_args() -> list[Argument]: ), Argument("srtab_file_path", str, optional=True, doc=doc_srtab_file_path), Argument("one_h5", bool, optional=True, default=False, doc=doc_one_h5), + Argument( + "training_init_frozen_model", + list, + optional=True, + doc=doc_training_init_frozen_model, + ), + Argument( + "training_finetune_model", + list, + optional=True, + doc=doc_training_finetune_model, + ), ] diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index cc5a9fc44..574de9f19 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -24,6 +24,7 @@ from collections import Counter from collections.abc import Iterable from pathlib import Path +from typing import Optional import dpdata import numpy as np @@ -282,6 +283,12 @@ def make_train(iter_index, jdata, mdata): training_reuse_start_pref_e = jdata.get("training_reuse_start_pref_e") training_reuse_start_pref_f = jdata.get("training_reuse_start_pref_f") model_devi_activation_func = jdata.get("model_devi_activation_func", None) + training_init_frozen_model = ( + jdata.get("training_init_frozen_model") if iter_index == 0 else None + ) + training_finetune_model = ( + jdata.get("training_finetune_model") if iter_index == 0 else None + ) auto_ratio = False if ( @@ -624,6 +631,17 @@ def make_train(iter_index, jdata, mdata): for ii in range(len(iter0_models)): old_model_files = glob.glob(os.path.join(iter0_models[ii], "model.ckpt*")) _link_old_models(work_path, old_model_files, ii) + copied_models = next( + ( + item + for item in (training_init_frozen_model, training_finetune_model) + if item is not None + ), + None, + ) + if copied_models is not None: + for ii in range(len(copied_models)): + _link_old_models(work_path, [copied_models[ii]], ii, basename="init.pb") # Copy user defined forward files symlink_user_forward_files(mdata=mdata, task_type="train", work_path=work_path) # HDF5 format for training data @@ -631,7 +649,7 @@ def make_train(iter_index, jdata, mdata): convert_training_data_to_hdf5(input_files, os.path.join(work_path, "data.hdf5")) -def _link_old_models(work_path, old_model_files, ii): +def _link_old_models(work_path, old_model_files, ii, basename: Optional[str] = None): """Link the `ii`th old model given by `old_model_files` to the `ii`th training task in `work_path`. """ @@ -641,7 +659,10 @@ def _link_old_models(work_path, old_model_files, ii): cwd = os.getcwd() for jj in old_model_files: absjj = os.path.abspath(jj) - basejj = os.path.basename(jj) + if basename is None: + basejj = os.path.basename(jj) + else: + basejj = basename os.chdir(task_old_path) os.symlink(os.path.relpath(absjj), basejj) os.chdir(cwd) @@ -676,6 +697,12 @@ def run_train(iter_index, jdata, mdata): train_input_file = default_train_input_file training_reuse_iter = jdata.get("training_reuse_iter") training_init_model = jdata.get("training_init_model", False) + training_init_frozen_model = ( + jdata.get("training_init_frozen_model") if iter_index == 0 else None + ) + training_finetune_model = ( + jdata.get("training_finetune_model") if iter_index == 0 else None + ) if "srtab_file_path" in jdata.keys(): zbl_file = os.path.basename(jdata.get("srtab_file_path", None)) @@ -687,6 +714,16 @@ def run_train(iter_index, jdata, mdata): except KeyError: mdata = set_version(mdata) + if ( + training_init_model + + (training_init_frozen_model is not None) + + (training_finetune_model is not None) + > 1 + ): + raise RuntimeError( + "training_init_model, training_init_frozen_model, and training_finetune_model are mutually exclusive." + ) + train_command = mdata.get("train_command", "dp") train_resources = mdata["train_resources"] @@ -712,13 +749,17 @@ def run_train(iter_index, jdata, mdata): ## train_command should not be None assert train_command extra_flags = "" + init_flag = "" if jdata.get("dp_train_skip_neighbor_stat", False): extra_flags += " --skip-neighbor-stat" - command = f"{train_command} train {train_input_file}{extra_flags}" if training_init_model: - command = f"{{ if [ ! -f model.ckpt.index ]; then {command} --init-model old/model.ckpt; else {command} --restart model.ckpt; fi }}" - else: - command = f"{{ if [ ! -f model.ckpt.index ]; then {command}; else {command} --restart model.ckpt; fi }}" + init_flag = " --init-model old/model.ckpt" + elif training_init_frozen_model is not None: + init_flag = " --init-frz-model old/init.pb" + elif training_finetune_model is not None: + init_flag = " --finetune old/init.pb" + command = f"{train_command} train {train_input_file}{extra_flags}" + command = f"{{ if [ ! -f model.ckpt.index ]; then {command}{init_flag}; else {command} --restart model.ckpt; fi }}" command = "/bin/sh -c '%s'" % command commands.append(command) command = "%s freeze" % train_command @@ -750,6 +791,9 @@ def run_train(iter_index, jdata, mdata): os.path.join("old", "model.ckpt.index"), os.path.join("old", "model.ckpt.data-00000-of-00001"), ] + elif training_init_frozen_model is not None or training_finetune_model is not None: + forward_files.append(os.path.join("old", "init.pb")) + backward_files = ["frozen_model.pb", "lcurve.out", "train.log"] backward_files += [ "model.ckpt.meta", diff --git a/tests/generator/test_make_train.py b/tests/generator/test_make_train.py index c9e78338d..04d091368 100644 --- a/tests/generator/test_make_train.py +++ b/tests/generator/test_make_train.py @@ -523,6 +523,108 @@ def test_1_data_v1_one_h5(self): shutil.rmtree("iter.000001") shutil.rmtree("iter.000000") + def test_training_finetune_model(self): + """Test `training_finetune_model`.""" + with open(param_file_v1) as fp: + jdata = json.load(fp) + jdata.pop("use_ele_temp", None) + numb_models = 4 + temp_file = "_temp.pb" + with open(temp_file, "w") as fw: + pass + jdata["training_finetune_model"] = [ + os.path.abspath(temp_file) for _ in range(numb_models) + ] + with open(machine_file_v1) as fp: + mdata = json.load(fp) + make_train(0, jdata, mdata) + # check file exists + for ii in range(numb_models): + self.assertTrue( + os.path.isfile( + os.path.join( + "iter.000000", "00.train", "%03d" % ii, "old", "init.pb" + ) + ) + ) + # test run_train -- confirm transferred files are correct + with tempfile.TemporaryDirectory() as remote_root: + run_train( + 0, + jdata, + { + "api_version": "1.0", + "train_command": ( + "test -f ./old/init.pb" + "&& touch frozen_model.pb lcurve.out model.ckpt.meta model.ckpt.index model.ckpt.data-00000-of-00001 checkpoint" + "&& echo dp" + ), + "train_machine": { + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + "context_type": "local", + }, + "train_resources": { + "group_size": 1, + }, + }, + ) + + # remove testing dirs + shutil.rmtree("iter.000000") + + def test_training_init_frozen_model(self): + """Test `training_init_frozen_model`.""" + with open(param_file_v1) as fp: + jdata = json.load(fp) + jdata.pop("use_ele_temp", None) + numb_models = 4 + temp_file = "_temp.pb" + with open(temp_file, "w") as fw: + pass + jdata["training_init_frozen_model"] = [ + os.path.abspath(temp_file) for _ in range(numb_models) + ] + with open(machine_file_v1) as fp: + mdata = json.load(fp) + make_train(0, jdata, mdata) + # check file exists + for ii in range(numb_models): + self.assertTrue( + os.path.isfile( + os.path.join( + "iter.000000", "00.train", "%03d" % ii, "old", "init.pb" + ) + ) + ) + # test run_train -- confirm transferred files are correct + with tempfile.TemporaryDirectory() as remote_root: + run_train( + 0, + jdata, + { + "api_version": "1.0", + "train_command": ( + "test -f ./old/init.pb" + "&& touch frozen_model.pb lcurve.out model.ckpt.meta model.ckpt.index model.ckpt.data-00000-of-00001 checkpoint" + "&& echo dp" + ), + "train_machine": { + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + "context_type": "local", + }, + "train_resources": { + "group_size": 1, + }, + }, + ) + + # remove testing dirs + shutil.rmtree("iter.000000") + if __name__ == "__main__": unittest.main() From 83f011e1bf20935d3f30f135f7e1d75abfa9edc3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:24:39 +0800 Subject: [PATCH 72/86] [pre-commit.ci] pre-commit autoupdate (#1343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.290 → v0.0.291](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.290...v0.0.291) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 074c32ed0..68ec856db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.290 + rev: v0.0.291 hooks: - id: ruff args: ["--fix"] From 8c47020432f6e30841d2530e0f4f94523fa470e2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 18:46:15 +0800 Subject: [PATCH 73/86] [pre-commit.ci] pre-commit autoupdate (#1345) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.291...v0.0.292) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68ec856db..6cbc35766 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.291 + rev: v0.0.292 hooks: - id: ruff args: ["--fix"] From 2d317cabf5a9edd9f2aeb19d8214514fd2cd12fa Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 8 Oct 2023 20:25:13 -0400 Subject: [PATCH 74/86] Add `dpgui` entry point and `dpgen gui` CLI (#1349) See https://github.com/deepmodeling/dpgui/issues/270 for details. --------- Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- doc/init/init-bulk-jdata.rst | 2 +- doc/init/init-bulk-mdata.rst | 2 +- doc/init/init-reaction-jdata.rst | 2 +- doc/init/init-reaction-mdata.rst | 2 +- doc/init/init-surf-jdata.rst | 2 +- doc/init/init-surf-mdata.rst | 2 +- doc/overview/cli.rst | 2 ++ doc/run/mdata.rst | 2 +- doc/run/param.rst | 2 +- doc/simplify/simplify-jdata.rst | 2 +- doc/simplify/simplify-mdata.rst | 2 +- dpgen/gui.py | 27 +++++++++++++++++++++++++++ dpgen/main.py | 24 ++++++++++++++++++++++++ dpgen/simplify/arginfo.py | 12 ++++++------ pyproject.toml | 24 +++++++++++++++++++++++- tests/test_gui.py | 11 +++++++++++ 17 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 dpgen/gui.py create mode 100644 tests/test_gui.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da2671502..f383c0cbf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: pip install coverage 'pymatgen-analysis-defects<2023.08.22' -e . + run: pip install -e .[test] - name: Test run: coverage run --source=./dpgen -m unittest -v && coverage report - uses: codecov/codecov-action@v3 diff --git a/doc/init/init-bulk-jdata.rst b/doc/init/init-bulk-jdata.rst index c3bb18d98..1cfccfdf5 100644 --- a/doc/init/init-bulk-jdata.rst +++ b/doc/init/init-bulk-jdata.rst @@ -2,7 +2,7 @@ dpgen init_bulk parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-bulk-mdata.rst b/doc/init/init-bulk-mdata.rst index 039a5afc2..63958089b 100644 --- a/doc/init/init-bulk-mdata.rst +++ b/doc/init/init-bulk-mdata.rst @@ -2,7 +2,7 @@ dpgen init_bulk machine parameters ================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-reaction-jdata.rst b/doc/init/init-reaction-jdata.rst index 34b1e87c0..829b9f955 100644 --- a/doc/init/init-reaction-jdata.rst +++ b/doc/init/init-reaction-jdata.rst @@ -2,7 +2,7 @@ dpgen init_reaction parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-reaction-mdata.rst b/doc/init/init-reaction-mdata.rst index 91bd638e8..42254a653 100644 --- a/doc/init/init-reaction-mdata.rst +++ b/doc/init/init-reaction-mdata.rst @@ -2,7 +2,7 @@ dpgen init_reaction machine parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-surf-jdata.rst b/doc/init/init-surf-jdata.rst index a88d3a582..c46bfc893 100644 --- a/doc/init/init-surf-jdata.rst +++ b/doc/init/init-surf-jdata.rst @@ -2,7 +2,7 @@ dpgen init_surf parameters ====================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/init/init-surf-mdata.rst b/doc/init/init-surf-mdata.rst index be9005e0b..361308361 100644 --- a/doc/init/init-surf-mdata.rst +++ b/doc/init/init-surf-mdata.rst @@ -2,7 +2,7 @@ dpgen init_surf machine parameters ================================== .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.data.arginfo diff --git a/doc/overview/cli.rst b/doc/overview/cli.rst index e57f1b064..f2d04b5bb 100644 --- a/doc/overview/cli.rst +++ b/doc/overview/cli.rst @@ -1,3 +1,5 @@ +.. _cli: + Command line interface ====================== diff --git a/doc/run/mdata.rst b/doc/run/mdata.rst index cad09bec8..1ce5dde35 100644 --- a/doc/run/mdata.rst +++ b/doc/run/mdata.rst @@ -1,7 +1,7 @@ dpgen run machine parameters ============================ .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.generator.arginfo diff --git a/doc/run/param.rst b/doc/run/param.rst index cbb2b75e5..cdbb2dde7 100644 --- a/doc/run/param.rst +++ b/doc/run/param.rst @@ -3,7 +3,7 @@ dpgen run param parameters ============================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.generator.arginfo diff --git a/doc/simplify/simplify-jdata.rst b/doc/simplify/simplify-jdata.rst index 3f44752c8..d98a64b26 100644 --- a/doc/simplify/simplify-jdata.rst +++ b/doc/simplify/simplify-jdata.rst @@ -2,7 +2,7 @@ dpgen simplify parameters ========================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.simplify.arginfo diff --git a/doc/simplify/simplify-mdata.rst b/doc/simplify/simplify-mdata.rst index f02f5a292..0008e0926 100644 --- a/doc/simplify/simplify-mdata.rst +++ b/doc/simplify/simplify-mdata.rst @@ -2,7 +2,7 @@ dpgen simplify machine parameters ================================= .. note:: - One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. + One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dpgen gui`. All parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file. .. dargs:: :module: dpgen.simplify.arginfo diff --git a/dpgen/gui.py b/dpgen/gui.py new file mode 100644 index 000000000..f116ee246 --- /dev/null +++ b/dpgen/gui.py @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later +"""DP-GUI entrypoint.""" +import argparse + + +def start_dpgui(args: argparse.Namespace): + """Host DP-GUI server. + + Parameters + ---------- + args : argparse.Namespace + Arguments from argparse. + + Raises + ------ + ModuleNotFoundError + The dpgui package is not installed + """ + try: + from dpgui import ( + start_dpgui, + ) + except ModuleNotFoundError as e: + raise ModuleNotFoundError( + "To use DP-GUI, please install the dpgui package:\npip install dpgui" + ) from e + start_dpgui(port=args.port, bind_all=args.bind_all) diff --git a/dpgen/main.py b/dpgen/main.py index 42b65c116..a0ac004e5 100644 --- a/dpgen/main.py +++ b/dpgen/main.py @@ -13,6 +13,7 @@ from dpgen.data.surf import gen_init_surf from dpgen.database.run import db_run from dpgen.generator.run import gen_run +from dpgen.gui import start_dpgui from dpgen.simplify.simplify import gen_simplify from dpgen.tools.auto_gen_param import auto_gen_param from dpgen.tools.run_report import run_report @@ -206,6 +207,29 @@ def main_parser() -> argparse.ArgumentParser: parser_db.add_argument("PARAM", type=str, help="parameter file, json format") parser_db.set_defaults(func=db_run) + + # gui + parser_gui = subparsers.add_parser( + "gui", + help="Serve DP-GUI.", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser_gui.add_argument( + "-p", + "--port", + type=int, + default=6042, + help="The port to serve DP-GUI on.", + ) + parser_gui.add_argument( + "--bind_all", + action="store_true", + help=( + "Serve on all public interfaces. This will expose your DP-GUI instance " + "to the network on both IPv4 and IPv6 (where available)." + ), + ) + parser_gui.set_defaults(func=start_dpgui) return parser diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 5db5b0812..412b5b255 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -60,42 +60,42 @@ def general_simplify_arginfo() -> Argument: "model_devi_e_trust_lo", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_model_devi_e_trust_lo, ), Argument( "model_devi_e_trust_hi", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_model_devi_e_trust_hi, ), Argument( "true_error_f_trust_lo", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_true_error_f_trust_lo, ), Argument( "true_error_f_trust_hi", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_true_error_f_trust_hi, ), Argument( "true_error_e_trust_lo", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_true_error_e_trust_lo, ), Argument( "true_error_e_trust_hi", float, optional=True, - default=float("inf"), + default=1e10, doc=doc_true_error_e_trust_hi, ), ] diff --git a/pyproject.toml b/pyproject.toml index 2e80d1e61..3eb456024 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,9 +43,31 @@ Homepage = "https://github.com/deepmodeling/dpgen" documentation = "https://docs.deepmodeling.com/projects/dpgen" repository = "https://github.com/deepmodeling/dpgen" -[project.entry-points.console_scripts] +[project.scripts] dpgen = "dpgen.main:main" +[project.entry-points."dpgui"] +"DP-GEN Run" = "dpgen.generator.arginfo:run_jdata_arginfo" +"DP-GEN Run Machine" = "dpgen.generator.arginfo:run_jdata_arginfo" +"DP-GEN Simplify" = "dpgen.simplify.arginfo:simplify_jdata_arginfo" +"DP-GEN Simplify Machine" = "dpgen.simplify.arginfo:simplify_mdata_arginfo" +"DP-GEN init_bulk" = "dpgen.data.arginfo:init_bulk_jdata_arginfo" +"DP-GEN init_bulk Machine" = "dpgen.data.arginfo:init_bulk_mdata_arginfo" +"DP-GEN init_surf" = "dpgen.data.arginfo:init_surf_jdata_arginfo" +"DP-GEN init_surf Machine" = "dpgen.data.arginfo:init_surf_mdata_arginfo" +"DP-GEN init_reaction" = "dpgen.data.arginfo:init_reaction_jdata_arginfo" +"DP-GEN init_reaction Machine" = "dpgen.data.arginfo:init_reaction_mdata_arginfo" + +[project.optional-dependencies] +test = [ + "dpgui", + "coverage", + "pymatgen-analysis-defects<2023.08.22", +] +gui = [ + "dpgui", +] + [tool.setuptools.packages.find] include = ["dpgen*"] diff --git a/tests/test_gui.py b/tests/test_gui.py new file mode 100644 index 000000000..25fd7e665 --- /dev/null +++ b/tests/test_gui.py @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later +import unittest + +from dpgui import ( + generate_dpgui_templates, +) + + +class TestDPGUI(unittest.TestCase): + def test_dpgui_entrypoints(self): + self.assertTrue(len(generate_dpgui_templates()) > 0) From d1475f2739f1fcf2e7741dc830a03482a7217fd0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:24:25 +0800 Subject: [PATCH 75/86] [pre-commit.ci] pre-commit autoupdate (#1350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6cbc35766..c1d992865 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: # there are many log files in tests # TODO: seperate py files and log files From 329104d180a9ac57a5c224dd1139a16eb712db90 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 10 Oct 2023 21:26:26 -0400 Subject: [PATCH 76/86] fix KeyError in init_reaction (#1352) Fix #1351. The old code seems to be wrong. Since the old dispatcher has been entirely removed, the code can be more simple. Signed-off-by: Jinzhe Zeng --- dpgen/data/reaction.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/dpgen/data/reaction.py b/dpgen/data/reaction.py index a76766846..f1d38bccd 100644 --- a/dpgen/data/reaction.py +++ b/dpgen/data/reaction.py @@ -116,13 +116,9 @@ def link_trj(jdata): def run_build_dataset(jdata, mdata, log_file="build_log"): work_path = build_path - # compatible with new dpdispatcher and old dpgen.dispatcher - build_ntasks = mdata["build_resources"].get( - "cpu_per_node", mdata["build_resources"]["task_per_node"] - ) - fp_ntasks = mdata["fp_resources"].get( - "cpu_per_node", mdata["fp_resources"]["task_per_node"] - ) + # only compatible with new dpdispatcher + build_ntasks = mdata["build_resources"]["cpu_per_node"] + fp_ntasks = mdata["fp_resources"]["cpu_per_node"] build_command = '{cmd} -n {dataset_name} -a {type_map} -d {lammpstrj} -c {cutoff} -s {dataset_size} -k "{qmkeywords}" --nprocjob {nprocjob} --nproc {nproc}'.format( cmd=mdata["build_command"], type_map=" ".join(jdata["type_map"]), From 066f13ac2862ee0246f1b724756e48f5ff921542 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:18:06 +0800 Subject: [PATCH 77/86] [pre-commit.ci] pre-commit autoupdate (#1362) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.9.1 → 23.10.1](https://github.com/psf/black/compare/23.9.1...23.10.1) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1d992865..7612f2a65 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,11 +28,11 @@ repos: # Python - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.10.1 hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.292 + rev: v0.1.1 hooks: - id: ruff args: ["--fix"] From 7a2251f18a3e9620596fdbe8478a7b70d11d7d60 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 24 Oct 2023 22:53:09 -0400 Subject: [PATCH 78/86] argcheck: restrict the type of elements in a list (#1364) Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/arginfo.py | 34 ------- dpgen/data/arginfo.py | 30 +++--- dpgen/generator/arginfo.py | 93 +++++++++++-------- dpgen/simplify/arginfo.py | 2 +- .../simplify_example/simplify.json | 4 +- examples/simplify/qm7.json | 4 +- pyproject.toml | 2 +- 7 files changed, 71 insertions(+), 98 deletions(-) diff --git a/dpgen/arginfo.py b/dpgen/arginfo.py index 9d1841ecb..3d82aada2 100644 --- a/dpgen/arginfo.py +++ b/dpgen/arginfo.py @@ -1,5 +1,3 @@ -from typing import Callable - from dargs import Argument from dpgen.dispatcher.Dispatcher import mdata_arginfo @@ -43,35 +41,3 @@ def general_mdata_arginfo(name: str, tasks: tuple[str]) -> Argument: ) ) return Argument(name, dict, sub_fields=sub_fields, doc=doc_run_mdata) - - -def check_nd_list(dimesion: int = 2) -> Callable: - """Return a method to check if the input is a nd list. - - Parameters - ---------- - dimesion : int, default=2 - dimension of the array - - Returns - ------- - callable - check function - """ - - def check(value, dimension=dimesion): - if value is None: - # do not check null - return True - if dimension: - if not isinstance(value, list): - return False - if dimension > 1: - if not all(check(v, dimension=dimesion - 1) for v in value): - return False - return True - - return check - - -errmsg_nd_list = "Must be a %d-dimension list." diff --git a/dpgen/data/arginfo.py b/dpgen/data/arginfo.py index 3b5793ea1..37c9b1fa9 100644 --- a/dpgen/data/arginfo.py +++ b/dpgen/data/arginfo.py @@ -47,7 +47,7 @@ def init_bulk_abacus_args() -> list[Argument]: return [ Argument("relax_kpt", str, optional=True, doc=doc_relax_kpt), Argument("md_kpt", str, optional=True, doc=doc_md_kpt), - Argument("atom_masses", list, optional=True, doc=doc_atom_masses), + Argument("atom_masses", list[float], optional=True, doc=doc_atom_masses), ] @@ -105,25 +105,25 @@ def init_bulk_jdata_arginfo() -> Argument: "init_bulk_jdata", dict, [ - Argument("stages", list, optional=False, doc=doc_stages), - Argument("elements", list, optional=False, doc=doc_elements), - Argument("potcars", list, optional=True, doc=doc_potcars), + Argument("stages", list[int], optional=False, doc=doc_stages), + Argument("elements", list[str], optional=False, doc=doc_elements), + Argument("potcars", list[str], optional=True, doc=doc_potcars), Argument("cell_type", str, optional=True, doc=doc_cell_type), - Argument("super_cell", list, optional=False, doc=doc_super_cell), + Argument("super_cell", list[int], optional=False, doc=doc_super_cell), Argument( "from_poscar", bool, optional=True, default=False, doc=doc_from_poscar ), Argument("from_poscar_path", str, optional=True, doc=doc_from_poscar_path), Argument("relax_incar", str, optional=True, doc=doc_relax_incar), Argument("md_incar", str, optional=True, doc=doc_md_incar), - Argument("scale", list, optional=False, doc=doc_scale), + Argument("scale", list[float], optional=False, doc=doc_scale), Argument("skip_relax", bool, optional=False, doc=doc_skip_relax), Argument("pert_numb", int, optional=False, doc=doc_pert_numb), Argument("pert_box", float, optional=False, doc=doc_pert_box), Argument("pert_atom", float, optional=False, doc=doc_pert_atom), Argument("md_nstep", int, optional=False, doc=doc_md_nstep), Argument("coll_ndata", int, optional=False, doc=doc_coll_ndata), - Argument("type_map", list, optional=True, doc=doc_type_map), + Argument("type_map", list[str], optional=True, doc=doc_type_map), ], sub_variants=init_bulk_variant_type_args(), doc=doc_init_bulk, @@ -171,11 +171,11 @@ def init_surf_jdata_arginfo() -> Argument: "init_surf_jdata", dict, [ - Argument("stages", list, optional=False, doc=doc_stages), - Argument("elements", list, optional=False, doc=doc_elements), - Argument("potcars", list, optional=True, doc=doc_potcars), + Argument("stages", list[int], optional=False, doc=doc_stages), + Argument("elements", list[str], optional=False, doc=doc_elements), + Argument("potcars", list[str], optional=True, doc=doc_potcars), Argument("cell_type", str, optional=True, doc=doc_cell_type), - Argument("super_cell", list, optional=False, doc=doc_super_cell), + Argument("super_cell", list[int], optional=False, doc=doc_super_cell), Argument( "from_poscar", bool, optional=True, default=False, doc=doc_from_poscar ), @@ -185,13 +185,13 @@ def init_surf_jdata_arginfo() -> Argument: Argument("z_min", int, optional=True, doc=doc_z_min), Argument("vacuum_max", float, optional=False, doc=doc_vacuum_max), Argument("vacuum_min", float, optional=True, doc=doc_vacuum_min), - Argument("vacuum_resol", list, optional=False, doc=doc_vacuum_resol), + Argument("vacuum_resol", list[float], optional=False, doc=doc_vacuum_resol), Argument("vacuum_numb", int, optional=True, doc=doc_vacuum_numb), Argument("mid_point", float, optional=True, doc=doc_mid_point), Argument("head_ratio", float, optional=True, doc=doc_head_ratio), - Argument("millers", list, optional=False, doc=doc_millers), + Argument("millers", list[list[int]], optional=False, doc=doc_millers), Argument("relax_incar", str, optional=True, doc=doc_relax_incar), - Argument("scale", list, optional=False, doc=doc_scale), + Argument("scale", list[float], optional=False, doc=doc_scale), Argument("skip_relax", bool, optional=False, doc=doc_skip_relax), Argument("pert_numb", int, optional=False, doc=doc_pert_numb), Argument("pert_box", float, optional=False, doc=doc_pert_box), @@ -233,7 +233,7 @@ def init_reaction_jdata_arginfo() -> Argument: "init_reaction_jdata", dict, [ - Argument("type_map", list, doc=doc_type_map), + Argument("type_map", list[str], doc=doc_type_map), Argument( "reaxff", dict, diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 971563059..5c6d5f49f 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -1,8 +1,9 @@ import textwrap +from typing import Union from dargs import Argument, Variant -from dpgen.arginfo import check_nd_list, errmsg_nd_list, general_mdata_arginfo +from dpgen.arginfo import general_mdata_arginfo def run_mdata_arginfo() -> Argument: @@ -26,9 +27,13 @@ def basic_args() -> list[Argument]: - 2: electron temperature as atom parameter." return [ - Argument("type_map", list, optional=False, doc=doc_type_map), + Argument("type_map", list[str], optional=False, doc=doc_type_map), Argument( - "mass_map", [list, str], optional=True, default="auto", doc=doc_mass_map + "mass_map", + [list[float], str], + optional=True, + default="auto", + doc=doc_mass_map, ), Argument("use_ele_temp", int, optional=True, default=0, doc=doc_use_ele_temp), ] @@ -45,23 +50,29 @@ def data_args() -> list[Argument]: return [ Argument("init_data_prefix", str, optional=True, doc=doc_init_data_prefix), - Argument("init_data_sys", list, optional=False, doc=doc_init_data_sys), + Argument("init_data_sys", list[str], optional=False, doc=doc_init_data_sys), Argument( "sys_format", str, optional=True, default="vasp/poscar", doc=doc_sys_format ), Argument( - "init_batch_size", [list, str], optional=True, doc=doc_init_batch_size + "init_batch_size", + [list[Union[int, str]], str], + optional=True, + doc=doc_init_batch_size, ), Argument("sys_configs_prefix", str, optional=True, doc=doc_sys_configs_prefix), Argument( "sys_configs", - list, + list[list[str]], optional=False, doc=doc_sys_configs, - extra_check=check_nd_list(2), - extra_check_errmsg=errmsg_nd_list % 2, ), - Argument("sys_batch_size", list, optional=True, doc=doc_sys_batch_size), + Argument( + "sys_batch_size", + list[Union[int, str]], + optional=True, + doc=doc_sys_batch_size, + ), ] @@ -115,7 +126,7 @@ def training_args() -> list[Argument]: Argument("numb_models", int, optional=False, doc=doc_numb_models), Argument( "training_iter0_model_path", - list, + list[str], optional=True, doc=doc_training_iter0_model_path, ), @@ -182,7 +193,7 @@ def training_args() -> list[Argument]: ), Argument( "model_devi_activation_func", - [None, list], + [None, list[list[str]]], optional=True, doc=doc_model_devi_activation_func, ), @@ -190,13 +201,13 @@ def training_args() -> list[Argument]: Argument("one_h5", bool, optional=True, default=False, doc=doc_one_h5), Argument( "training_init_frozen_model", - list, + list[str], optional=True, doc=doc_training_init_frozen_model, ), Argument( "training_finetune_model", - list, + list[str], optional=True, doc=doc_training_finetune_model, ), @@ -218,7 +229,7 @@ def model_devi_jobs_template_args() -> Argument: Argument("plm", str, optional=True, doc=doc_template_plm), ] return Argument( - "template", list, args, [], optional=True, repeat=False, doc=doc_template + "template", dict, args, [], optional=True, repeat=False, doc=doc_template ) @@ -235,7 +246,7 @@ def model_devi_jobs_rev_mat_args() -> Argument: Argument("plm", dict, optional=True, doc=doc_rev_mat_plm), ] return Argument( - "rev_mat", list, args, [], optional=True, repeat=False, doc=doc_rev_mat + "rev_mat", dict, args, [], optional=True, repeat=False, doc=doc_rev_mat ) @@ -264,9 +275,9 @@ def model_devi_jobs_args() -> list[Argument]: model_devi_jobs_template_args(), model_devi_jobs_rev_mat_args(), Argument("sys_rev_mat", dict, optional=True, doc=doc_sys_rev_mat), - Argument("sys_idx", list, optional=False, doc=doc_sys_idx), - Argument("temps", list, optional=True, doc=doc_temps), - Argument("press", list, optional=True, doc=doc_press), + Argument("sys_idx", list[int], optional=False, doc=doc_sys_idx), + Argument("temps", list[float], optional=True, doc=doc_temps), + Argument("press", list[float], optional=True, doc=doc_press), Argument("trj_freq", int, optional=False, doc=doc_trj_freq), Argument("nsteps", int, optional=True, doc=doc_nsteps), Argument("ensemble", str, optional=True, doc=doc_ensemble), @@ -342,26 +353,26 @@ def model_devi_lmp_args() -> list[Argument]: Argument("model_devi_skip", int, optional=False, doc=doc_model_devi_skip), Argument( "model_devi_f_trust_lo", - [float, list, dict], + [float, list[float], dict], optional=False, doc=doc_model_devi_f_trust_lo, ), Argument( "model_devi_f_trust_hi", - [float, list, dict], + [float, list[float], dict], optional=False, doc=doc_model_devi_f_trust_hi, ), Argument( "model_devi_v_trust_lo", - [float, list, dict], + [float, list[float], dict], optional=True, default=1e10, doc=doc_model_devi_v_trust_lo, ), Argument( "model_devi_v_trust_hi", - [float, list, dict], + [float, list[float], dict], optional=True, default=1e10, doc=doc_model_devi_v_trust_hi, @@ -510,7 +521,7 @@ def model_devi_amber_args() -> list[Argument]: repeat=True, doc=doc_model_devi_jobs, sub_fields=[ - Argument("sys_idx", list, optional=False, doc=doc_sys_idx), + Argument("sys_idx", list[int], optional=False, doc=doc_sys_idx), Argument("trj_freq", int, optional=False, doc=doc_trj_freq), Argument( "restart_from_iter", int, optional=True, doc=doc_restart_from_iter @@ -520,32 +531,30 @@ def model_devi_amber_args() -> list[Argument]: Argument("low_level", str, optional=False, doc=doc_low_level), Argument("cutoff", float, optional=False, doc=doc_cutoff), Argument("parm7_prefix", str, optional=True, doc=doc_parm7_prefix), - Argument("parm7", list, optional=False, doc=doc_parm7), + Argument("parm7", list[str], optional=False, doc=doc_parm7), Argument("mdin_prefix", str, optional=True, doc=doc_mdin_prefix), - Argument("mdin", list, optional=False, doc=doc_mdin), - Argument("qm_region", list, optional=False, doc=doc_qm_region), - Argument("qm_charge", list, optional=False, doc=doc_qm_charge), - Argument("nsteps", list, optional=False, doc=doc_nsteps), + Argument("mdin", list[str], optional=False, doc=doc_mdin), + Argument("qm_region", list[str], optional=False, doc=doc_qm_region), + Argument("qm_charge", list[int], optional=False, doc=doc_qm_charge), + Argument("nsteps", list[int], optional=False, doc=doc_nsteps), Argument( "r", - list, + list[list[Union[float, list[float]]]], optional=False, doc=doc_r, - extra_check=check_nd_list(2), - extra_check_errmsg=errmsg_nd_list % 2, ), Argument("disang_prefix", str, optional=True, doc=doc_disang_prefix), - Argument("disang", list, optional=False, doc=doc_disang), + Argument("disang", list[str], optional=False, doc=doc_disang), # post model devi args Argument( "model_devi_f_trust_lo", - [float, list, dict], + [float, list[float], dict], optional=False, doc=doc_model_devi_f_trust_lo, ), Argument( "model_devi_f_trust_hi", - [float, list, dict], + [float, list[float], dict], optional=False, doc=doc_model_devi_f_trust_hi, ), @@ -587,9 +596,11 @@ def fp_style_vasp_args() -> list[Argument]: return [ Argument("fp_pp_path", str, optional=False, doc=doc_fp_pp_path), - Argument("fp_pp_files", list, optional=False, doc=doc_fp_pp_files), + Argument("fp_pp_files", list[str], optional=False, doc=doc_fp_pp_files), Argument("fp_incar", str, optional=False, doc=doc_fp_incar), - Argument("fp_aniso_kspacing", list, optional=True, doc=doc_fp_aniso_kspacing), + Argument( + "fp_aniso_kspacing", list[float], optional=True, doc=doc_fp_aniso_kspacing + ), Argument("cvasp", bool, optional=True, doc=doc_cvasp), Argument("fp_skip_bad_box", str, optional=True, doc=doc_fp_skip_bad_box), ] @@ -610,13 +621,13 @@ def fp_style_abacus_args() -> list[Argument]: return [ Argument("fp_pp_path", str, optional=False, doc=doc_fp_pp_path), - Argument("fp_pp_files", list, optional=False, doc=doc_fp_pp_files), - Argument("fp_orb_files", list, optional=True, doc=doc_fp_orb_files), + Argument("fp_pp_files", list[str], optional=False, doc=doc_fp_pp_files), + Argument("fp_orb_files", list[str], optional=True, doc=doc_fp_orb_files), Argument("fp_incar", str, optional=True, doc=doc_fp_incar), Argument("fp_kpt_file", str, optional=True, doc=doc_fp_kpt_file), Argument("fp_dpks_descriptor", str, optional=True, doc=doc_fp_dpks_descriptor), Argument("user_fp_params", dict, optional=True, doc=doc_user_fp_params), - Argument("k_points", list, optional=True, doc=doc_k_points), + Argument("k_points", list[int], optional=True, doc=doc_k_points), ] @@ -646,7 +657,7 @@ def fp_style_gaussian_args() -> list[Argument]: ) args = [ - Argument("keywords", [str, list], optional=False, doc=doc_keywords), + Argument("keywords", [str, list[str]], optional=False, doc=doc_keywords), Argument( "multiplicity", [int, str], @@ -736,7 +747,7 @@ def fp_style_siesta_args() -> list[Argument]: Argument("cluster_cutoff", float, optional=True, doc=doc_cluster_cutoff), Argument("fp_params", dict, args, [], optional=False, doc=doc_fp_params_siesta), Argument("fp_pp_path", str, optional=False, doc=doc_fp_pp_path), - Argument("fp_pp_files", list, optional=False, doc=doc_fp_pp_files), + Argument("fp_pp_files", list[str], optional=False, doc=doc_fp_pp_files), ] diff --git a/dpgen/simplify/arginfo.py b/dpgen/simplify/arginfo.py index 412b5b255..2fb4547f7 100644 --- a/dpgen/simplify/arginfo.py +++ b/dpgen/simplify/arginfo.py @@ -41,7 +41,7 @@ def general_simplify_arginfo() -> Argument: return [ Argument("labeled", bool, optional=True, default=False, doc=doc_labeled), - Argument("pick_data", [str, list], doc=doc_pick_data), + Argument("pick_data", [str, list[str]], doc=doc_pick_data), Argument("init_pick_number", int, doc=doc_init_pick_number), Argument("iter_pick_number", int, doc=doc_iter_pick_number), Argument( diff --git a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json index 23d0f8083..1d664d39b 100644 --- a/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json +++ b/examples/simplify-MAPbI3-scan-lebesgue/simplify_example/simplify.json @@ -16,9 +16,7 @@ "pick_data": "../data", "init_data_prefix": "", "init_data_sys": [], - "sys_configs": [ - null - ], + "sys_configs": [], "sys_batch_size": [ 1 ], diff --git a/examples/simplify/qm7.json b/examples/simplify/qm7.json index bee5a1536..dd80c503f 100644 --- a/examples/simplify/qm7.json +++ b/examples/simplify/qm7.json @@ -16,9 +16,7 @@ "pick_data": "/scratch/jz748/simplify/qm7", "init_data_prefix": "", "init_data_sys": [], - "sys_configs": [ - null - ], + "sys_configs": [], "sys_batch_size": [ "auto" ], diff --git a/pyproject.toml b/pyproject.toml index 3eb456024..9baef3d77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ 'GromacsWrapper>=0.8.0', 'dpdispatcher>=0.3.11', 'netCDF4', - 'dargs>=0.3.5', + 'dargs>=0.4.0', 'h5py', 'pymatgen-analysis-defects', 'openbabel-wheel', From e05873ee5e2d1ee6252d36cd14d19e537858b660 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 30 Oct 2023 02:55:20 -0400 Subject: [PATCH 79/86] fix Python 3.12 compatibility (#1367) Signed-off-by: Jinzhe Zeng Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- dpgen/dispatcher/Dispatcher.py | 6 +++--- pyproject.toml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f383c0cbf..acb7d8a4b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.11"] + python-version: ["3.9", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/dpgen/dispatcher/Dispatcher.py b/dpgen/dispatcher/Dispatcher.py index 2c50f18c9..aad6ba6f8 100644 --- a/dpgen/dispatcher/Dispatcher.py +++ b/dpgen/dispatcher/Dispatcher.py @@ -1,9 +1,9 @@ import os -from distutils.version import LooseVersion # import dargs from dargs.dargs import Argument from dpdispatcher import Machine, Resources, Submission, Task +from packaging.version import Version def make_submission( @@ -136,12 +136,12 @@ def make_submission_compat( api_version : str, default=1.0 API version. 1.0 is required """ - if LooseVersion(api_version) < LooseVersion("1.0"): + if Version(api_version) < Version("1.0"): raise RuntimeError( "API version %s has been removed. Please upgrade to 1.0." % api_version ) - elif LooseVersion(api_version) >= LooseVersion("1.0"): + elif Version(api_version) >= Version("1.0"): submission = make_submission( machine, resources, diff --git a/pyproject.toml b/pyproject.toml index 9baef3d77..61b6ab46b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,8 @@ test = [ "dpgui", "coverage", "pymatgen-analysis-defects<2023.08.22", + # To be fixed: https://github.com/Becksteinlab/GromacsWrapper/issues/263 + 'setuptools; python_version >= "3.12"', ] gui = [ "dpgui", From f1376eebb8f54cfb5f87b68e18c598b742e7e657 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 30 Oct 2023 02:56:02 -0400 Subject: [PATCH 80/86] update issue templates (#1368) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/bug_report.md | 37 -------------- .github/ISSUE_TEMPLATE/bug_report.yml | 58 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 14 ++++++ .github/ISSUE_TEMPLATE/feature_request.md | 21 -------- .github/ISSUE_TEMPLATE/feature_request.yml | 33 ++++++++++++ .github/ISSUE_TEMPLATE/generic-issue.md | 25 ---------- .github/ISSUE_TEMPLATE/generic-issue.yml | 38 ++++++++++++++ .github/ISSUE_TEMPLATE/parameters.md | 25 ---------- .github/ISSUE_TEMPLATE/request-for-help.md | 21 -------- 9 files changed, 143 insertions(+), 129 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 .github/ISSUE_TEMPLATE/generic-issue.md create mode 100644 .github/ISSUE_TEMPLATE/generic-issue.yml delete mode 100644 .github/ISSUE_TEMPLATE/parameters.md delete mode 100644 .github/ISSUE_TEMPLATE/request-for-help.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 3ccc0966c..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: Bug report -about: Create a bug report to help us eliminate issues and improve dpgen. If this - doesn’t look right, [choose a different type](https://github.com/deepmodeling/dpgen/issues/new/choose). -title: "[BUG] _Replace With Suitable Title_" -labels: bug -assignees: '' - ---- - -**Summary** - - - -**DPGEN Version and Platform** - - - -**Job submission and computing cluster configuration** - - - -**Expected Behavior** - - - -**Actual Behavior** - - - -**Steps to Reproduce** - - - -**Further Information, Files, and Links** - - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..dc19d9c8f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: Bug report +description: Create a bug report to help us eliminate issues and improve deepmd-kit. +title: "[BUG] " +labels: bug +assignees: [] +body: + - type: textarea + id: summary + attributes: + label: Bug summary + description: Please provide a clear and concise description of what the bug is. + placeholder: + value: + validations: + required: true + - type: input + id: version + attributes: + label: DP-GEN Version + description: "`dpgen --version`" + validations: + required: true + - type: textarea + id: other-version + attributes: + label: Platform, Python Version, Remote Platform, etc + description: "If applicable, specify what platform you are running on." + placeholder: + value: + validations: + required: false + - type: textarea + id: log + attributes: + label: Input Files, Running Commands, Error Log, etc. + description: "Please provide necessary information including input file, running commands, error log , etc., AS DETAILED AS POSSIBLE to help locate and reproduce your problem. WARNING: Do not use image to show error log! Paste texts in a code block instead." + placeholder: + value: + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to Reproduce + description: "Describe the steps required to (quickly) reproduce the issue. You can attach (small) files to the section below or add URLs where to download an archive with all necessary files. Please try to create an input set that is as minimal and small as possible and reproduces the bug as quickly as possible. **NOTE:** the less effort and time it takes to reproduce your reported bug, the more likely it becomes, that somebody will look into it and fix the problem." + placeholder: + value: + validations: + required: true + - type: textarea + id: further + attributes: + label: Further Information, Files, and Links + description: Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications + placeholder: + value: + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..9d7a41f32 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: Submit DeePMD-kit issue + url: https://github.com/deepmodeling/deepmd-kit/issues + about: If the issue is related to DeePMD-kit (model training and inference), submit to deepmd-kit repository + - name: Submit dpdata issue + url: https://github.com/deepmodeling/dpdata/issues + about: If the issue is related to dpdata (format conversion), submit to dpdata repository + - name: Submit dpdispatcher issue + url: https://github.com/deepmodeling/dpdispatcher/issues + about: If the issue is related to dpdispatcher (job submission), submit to dpdispatcher repository + - name: Request for Help + url: https://github.com/deepmodeling/dpgen/discussions/new?category=q-a + about: If you have an usage question diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 162e9e7e3..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project. If this doesn’t work right, [choose a different - type]( https://github.com/deepmodeling/dpgen/issues/new/choose). -title: "[Feature Request] _Replace with Title_" -labels: new feature -assignees: '' - ---- - -**Summary** - - - -**Detailed Description** - - - -**Further Information, Files, and Links** - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..18781a841 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,33 @@ +name: Feature request +description: Suggest an idea for this project. +title: "[Feature Request] " +labels: enhancement +assignees: [] +body: + - type: textarea + id: summary + attributes: + label: Summary + description: "Please provide a brief and concise description of the suggested feature or change" + placeholder: + value: + validations: + required: true + - type: textarea + id: details + attributes: + label: Detailed Description + description: "Please explain how you would like to see deepmd-kit enhanced, what feature(s) you are looking for, what specific problems this will solve. If possible, provide references to relevant background information like publications or web pages, and whether you are planning to implement the enhancement yourself or would like to participate in the implementation. If applicable add a reference to an existing bug report or issue that this will address." + placeholder: + value: + validations: + required: true + - type: textarea + id: further + attributes: + label: Further Information, Files, and Links + description: Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications + placeholder: + value: + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/generic-issue.md b/.github/ISSUE_TEMPLATE/generic-issue.md deleted file mode 100644 index 4eca84778..000000000 --- a/.github/ISSUE_TEMPLATE/generic-issue.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Generic issue -about: For issues that do not fit any of the other categories. If this doesn’t work - right, [choose a different type]( https://github.com/deepmodeling/dpgen/issues/new/choose). -title: _Replace With a Descriptive Title_ -labels: wontfix -assignees: '' - ---- - -**Summary** - - - -**DPGEN Version and Platform** - - - -**Job submission and computing cluster configuration** - - - -**Details** - - diff --git a/.github/ISSUE_TEMPLATE/generic-issue.yml b/.github/ISSUE_TEMPLATE/generic-issue.yml new file mode 100644 index 000000000..0462bc3b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/generic-issue.yml @@ -0,0 +1,38 @@ +name: Generic issue +description: For issues that do not fit any of the other categories. +assignees: [] +body: + - type: textarea + id: summary + attributes: + label: Summary + description: "Please provide a clear and concise description of what the question is." + placeholder: + value: + validations: + required: true + - type: input + id: version + attributes: + label: DP-GEN Version + description: "`dpgen --version`" + validations: + required: true + - type: textarea + id: other-version + attributes: + label: Platform, Python Version, etc + description: "If applicable, specify what platform you are running on." + placeholder: + value: + validations: + required: false + - type: textarea + id: details + attributes: + label: Details + description: "Please explain the issue in detail here." + placeholder: + value: + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/parameters.md b/.github/ISSUE_TEMPLATE/parameters.md deleted file mode 100644 index 4fdf519aa..000000000 --- a/.github/ISSUE_TEMPLATE/parameters.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Parameters -about: Make a suggestion for a change of input parameters or a new output to dpgen. - If this doesn’t work right, [choose a different type]( https://github.com/deepmodeling/dpgen/issues/new/choose). -title: "[Parameters] _Replace With Suitable Title_" -labels: documentation, enhancement -assignees: '' - ---- - -**Summary** - - - -**Summary** - - - -**Detailed Description** - - - -**Further Information, Files, and Links** - - diff --git a/.github/ISSUE_TEMPLATE/request-for-help.md b/.github/ISSUE_TEMPLATE/request-for-help.md deleted file mode 100644 index 5f9b94e51..000000000 --- a/.github/ISSUE_TEMPLATE/request-for-help.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Request for Help -about: Don't post help requests here, go to [discussions](http://github.com/deepmodeling/dpgen/discussions) - instead. Or [choose a different type]( https://github.com/deepmodeling/dpgen/issues/new/choose). -title: '' -labels: '' -assignees: '' - ---- - -Before asking questions, you can - -search the previous issues or discussions -check [Manual](https://github.com/deepmodeling/dpgen). - -Please **do not** post requests for help (e.g. with installing or using dpgen) here. -Instead go to [discussions](https://github.com/deepmodeling/dpgen/discussions). - -This issue tracker is for tracking dpgen development related issues only. - -Thanks for your cooperation. From ad53c5ad1ecdd794816cfbf9172fac5ec4af1ff1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 08:53:22 +0800 Subject: [PATCH 81/86] [pre-commit.ci] pre-commit autoupdate (#1371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.1 → v0.1.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.1...v0.1.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7612f2a65..215b528f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.1 + rev: v0.1.3 hooks: - id: ruff args: ["--fix"] From 4ec90cacbf117d51923b99e990edb89ae9534409 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 30 Oct 2023 21:05:41 -0400 Subject: [PATCH 82/86] docs: update installation documentation (#1372) Since the dpgen conda package on the deepmodeling channel and the offline packages are not maintained anymore, this PR removes the related documentation. --- README.md | 20 ++++++-------------- doc/overview/overview.md | 23 ++++++----------------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 586ee3959..fb5ef39bc 100644 --- a/README.md +++ b/README.md @@ -23,22 +23,14 @@ Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and ## Download and Install -DP-GEN only supports Python 3.9 and above. +DP-GEN only supports Python 3.9 and above. You can use one of the following methods to install DP-GEN: + +- Install via pip: `pip install dpgen` +- Install via conda: `conda install -c conda-forge dpgen`` +- Install from source code: `git clone https://github.com/deepmodeling/dpgen && pip install ./dpgen` -One can download the source code of dpgen by -```bash -git clone https://github.com/deepmodeling/dpgen.git -``` -then you may install DP-GEN easily by: -```bash -cd dpgen -pip install --user . -``` -With this command, the dpgen executable is install to `$HOME/.local/bin/dpgen`. You may want to export the `PATH` by -```bash -export PATH=$HOME/.local/bin:$PATH -``` To test if the installation is successful, you may execute + ```bash dpgen -h ``` diff --git a/doc/overview/overview.md b/doc/overview/overview.md index cb184bccb..6916dcf15 100644 --- a/doc/overview/overview.md +++ b/doc/overview/overview.md @@ -5,7 +5,7 @@ [![GitHub release](https://img.shields.io/github/release/deepmodeling/dpgen.svg?maxAge=86400)](https://github.com/deepmodeling/dpgen/releases/) [![doi:10.1016/j.cpc.2020.107206](https://img.shields.io/badge/DOI-10.1016%2Fj.cpc.2020.107206-blue)](https://doi.org/10.1016/j.cpc.2020.107206) ![Citations](https://citations.njzjz.win/10.1016/j.cpc.2020.107206) -[![conda install](https://img.shields.io/conda/dn/deepmodeling/dpgen?label=conda%20install)](https://anaconda.org/deepmodeling/dpgen) +[![conda install](https://img.shields.io/conda/dn/conda-forge/dpgen?label=conda%20install)](https://anaconda.org/conda-forge/dpgen) [![pip install](https://img.shields.io/pypi/dm/dpgen?label=pip%20install)](https://pypi.org/project/dpgen) DP-GEN (Deep Generator) is a software written in Python, delicately designed to generate a deep learning based model of interatomic potential energy and force field. DP-GEN is dependent on [DeepMD-kit](https://github.com/deepmodeling/deepmd-kit/blob/master/README.md). With highly scalable interface with common softwares for molecular simulation, DP-GEN is capable to automatically prepare scripts and maintain job queues on HPC machines (High Performance Cluster) and analyze results. @@ -21,28 +21,17 @@ Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and ## Download and install -DP-GEN only supports Python 3.9 and above. - -Please follow our [GitHub](https://github.com/deepmodeling/dpgen) webpage to download the [latest released version](https://github.com/deepmodeling/dpgen/tree/master) and [development version](https://github.com/deepmodeling/dpgen/tree/devel). -One can download the source code of dpgen by -```bash -git clone https://github.com/deepmodeling/dpgen.git -``` - -DP-GEN offers multiple installation methods. It is recommend using easily methods like: -- offline packages: find them in [releases](https://github.com/deepmodeling/dpgen/releases/), -- pip: use `pip install dpgen`, see [dpgen-PyPI](https://pypi.org/project/dpgen/) -- conda: use `conda install -c deepmodeling dpgen`, see [dpgen-conda](https://anaconda.org/deepmodeling/dpgen) +DP-GEN only supports Python 3.9 and above. You can use one of the following methods to install DP-GEN: +- Install via pip: `pip install dpgen` +- Install via conda: `conda install -c conda-forge dpgen`` +- Install from source code: `git clone https://github.com/deepmodeling/dpgen && pip install ./dpgen` To test if the installation is successful, you may execute + ```bash dpgen -h ``` -or just -``` -dpgen -``` ## Use DP-GEN From 4b69200cd3d861e77df3dfa94a7fa353e4db4b15 Mon Sep 17 00:00:00 2001 From: Peng Xingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:07:06 +0800 Subject: [PATCH 83/86] abacus: fix bug of finding the final relax STRU (#1344) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/auto_test/lib/abacus.py | 31 +++++++++++++------------ dpgen/data/gen.py | 9 ++++--- tests/auto_test/test_abacus_property.py | 1 + 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index 6a90fea8f..34b53af62 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +import glob import os import dpdata @@ -309,23 +310,23 @@ def final_stru(abacus_path): out_stru = bool(line.split()[1]) logf = os.path.join(abacus_path, f"OUT.{suffix}/running_{calculation}.log") if calculation in ["relax", "cell-relax"]: - if not out_stru: + if os.path.isfile(os.path.join(abacus_path, "OUT.%s/STRU_ION_D" % suffix)): return "OUT.%s/STRU_ION_D" % suffix else: - with open(logf) as f1: - lines = f1.readlines() - for i in range(1, len(lines)): - max_step = "" - if "ALGORITHM --------------- ION=" in lines[-i]: - index_ben = lines[-i].index("ION=") + 4 - index_end = lines[-i].index("ELEC") - max_step = int(lines[-i][index_ben:index_end]) - if max_step < 2: - max_step = "" - else: - max_step -= 2 - break - return f"OUT.{suffix}/STRU_ION{str(max_step)}_D" + # find the final name by STRU_ION*_D, + # for abacus version < v3.2.2, there has no STRU_ION_D file but has STRU_ION0_D STRU_ION1_D ... STRU_ION10_D ... + # so we need to find the last STRU_ION*_D file + stru_ions = glob.glob( + os.path.join(abacus_path, f"OUT.{suffix}/STRU_ION*_D") + ) + if len(stru_ions) > 0: + # sort the file name by the number in the file name + stru_ions.sort(key=lambda x: int(x.split("_")[-2][3:])) + final_stru_ion = os.path.basename(stru_ions[-1]) + return f"OUT.{suffix}/{final_stru_ion}" + else: + # if there has no STRU_ION_D, return the input STRU + return "STRU" elif calculation == "md": with open(logf) as f1: lines = f1.readlines() diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index 4a2527f6d..27134ef64 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -710,13 +710,16 @@ def make_scale_ABACUS(jdata): assert os.path.isfile(pos_src) else: try: - pos_src = os.path.join( - os.path.join(init_path, ii), "OUT.ABACUS/STRU_ION_D" + from dpgen.auto_test.lib.abacus import ( + final_stru as abacus_final_stru, ) + + pos_src = abacus_final_stru(os.path.join(init_path, ii)) + pos_src = os.path.join(init_path, ii, pos_src) assert os.path.isfile(pos_src) except Exception: raise RuntimeError( - "not file %s, vasp relaxation should be run before scale poscar" + "Can not find STRU_ION_D in OUT.ABACUS!!!\nABACUS relaxation should be run before scale poscar" ) scale_path = os.path.join(work_path, ii) scale_path = os.path.join(scale_path, "scale-%.3f" % jj) diff --git a/tests/auto_test/test_abacus_property.py b/tests/auto_test/test_abacus_property.py index edcc3985c..764092258 100644 --- a/tests/auto_test/test_abacus_property.py +++ b/tests/auto_test/test_abacus_property.py @@ -174,6 +174,7 @@ def test_make_property_elastic(self): os.remove( os.path.realpath(os.path.join(self.equi_path, "OUT.ABACUS", "STRU_ION_D")) ) + os.remove(os.path.realpath(os.path.join(self.equi_path, "STRU"))) with self.assertRaises(RuntimeError): elastic.make_confs(work_path, self.equi_path, refine=False) From d58530bf0b7e422672d648d5641058e47d2f588f Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:07:52 +0800 Subject: [PATCH 84/86] Update {Elastic,run,surf,Vasp,vasp}.py: To be compatible with Pymatgen (#1302) To be compatible with old and new versions of Pymatgen (https://github.com/materialsproject/pymatgen/pull/3158) --------- Signed-off-by: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/auto_test/Elastic.py | 5 ++++- dpgen/auto_test/VASP.py | 5 ++++- dpgen/auto_test/lib/vasp.py | 10 ++++++++-- dpgen/data/surf.py | 5 ++++- dpgen/generator/run.py | 20 ++++++++++++++++---- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/dpgen/auto_test/Elastic.py b/dpgen/auto_test/Elastic.py index 389935a06..298d0983c 100644 --- a/dpgen/auto_test/Elastic.py +++ b/dpgen/auto_test/Elastic.py @@ -221,7 +221,10 @@ def post_process(self, task_list): kspacing = incar.get("KSPACING") kgamma = incar.get("KGAMMA", False) ret = vasp.make_kspacing_kpoints(poscar_start, kspacing, kgamma) - kp = Kpoints.from_string(ret) + try: + kp = Kpoints.from_string(ret) + except AttributeError: + kp = Kpoints.from_str(ret) if os.path.isfile("KPOINTS"): os.remove("KPOINTS") kp.write_file("KPOINTS") diff --git a/dpgen/auto_test/VASP.py b/dpgen/auto_test/VASP.py index e5b38d2e6..09c524ea6 100644 --- a/dpgen/auto_test/VASP.py +++ b/dpgen/auto_test/VASP.py @@ -194,7 +194,10 @@ def make_input_file(self, output_dir, task_type, task_param): os.symlink("../INCAR", "INCAR") os.chdir(cwd) ret = vasp.make_kspacing_kpoints(self.path_to_poscar, kspacing, kgamma) - kp = Kpoints.from_string(ret) + try: + kp = Kpoints.from_string(ret) + except AttributeError: + kp = Kpoints.from_str(ret) kp.write_file(os.path.join(output_dir, "KPOINTS")) def compute(self, output_dir): diff --git a/dpgen/auto_test/lib/vasp.py b/dpgen/auto_test/lib/vasp.py index 202cba4cb..1cf72f47e 100644 --- a/dpgen/auto_test/lib/vasp.py +++ b/dpgen/auto_test/lib/vasp.py @@ -510,7 +510,10 @@ def make_vasp_kpoints_from_incar(work_dir, jdata): assert os.path.exists("INCAR") with open("INCAR") as fp: incar = fp.read() - standard_incar = incar_upper(Incar.from_string(incar)) + try: + standard_incar = incar_upper(Incar.from_string(incar)) + except AttributeError: + standard_incar = incar_upper(Incar.from_str(incar)) if fp_aniso_kspacing is None: try: kspacing = standard_incar["KSPACING"] @@ -533,6 +536,9 @@ def make_vasp_kpoints_from_incar(work_dir, jdata): assert os.path.exists("POSCAR") # make kpoints ret = make_kspacing_kpoints("POSCAR", kspacing, gamma) - kp = Kpoints.from_string(ret) + try: + kp = Kpoints.from_string(ret) + except AttributeError: + kp = Kpoints.from_str(ret) kp.write_file("KPOINTS") os.chdir(cwd) diff --git a/dpgen/data/surf.py b/dpgen/data/surf.py index 75b2281d3..5194af5b3 100644 --- a/dpgen/data/surf.py +++ b/dpgen/data/surf.py @@ -410,7 +410,10 @@ def poscar_scale(poscar_in, poscar_out, scale): else: raise RuntimeError("Unknow poscar style at line 7: %s" % lines[7]) - poscar = Poscar.from_string("".join(lines)) + try: + poscar = Poscar.from_string("".join(lines)) + except AttributeError: + poscar = Poscar.from_str("".join(lines)) with open(poscar_out, "w") as fout: fout.write(poscar.get_string(direct=False)) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 574de9f19..266b7bd00 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -2924,14 +2924,20 @@ def make_pwmat_input(jdata, filename): def make_vasp_incar_ele_temp(jdata, filename, ele_temp, nbands_esti=None): with open(filename) as fp: incar = fp.read() - incar = incar_upper(Incar.from_string(incar)) + try: + incar = incar_upper(Incar.from_string(incar)) + except AttributeError: + incar = incar_upper(Incar.from_str(incar)) incar["ISMEAR"] = -1 incar["SIGMA"] = ele_temp * pc.Boltzmann / pc.electron_volt incar.write_file("INCAR") if nbands_esti is not None: nbands = nbands_esti.predict(".") with open(filename) as fp: - incar = Incar.from_string(fp.read()) + try: + incar = Incar.from_string(fp.read()) + except AttributeError: + incar = Incar.from_str(fp.read()) incar["NBANDS"] = nbands incar.write_file("INCAR") @@ -3008,7 +3014,10 @@ def make_fp_vasp_kp(iter_index, jdata): assert os.path.exists("INCAR") with open("INCAR") as fp: incar = fp.read() - standard_incar = incar_upper(Incar.from_string(incar)) + try: + standard_incar = incar_upper(Incar.from_string(incar)) + except AttributeError: + standard_incar = incar_upper(Incar.from_str(incar)) if fp_aniso_kspacing is None: try: kspacing = standard_incar["KSPACING"] @@ -3031,7 +3040,10 @@ def make_fp_vasp_kp(iter_index, jdata): assert os.path.exists("POSCAR") # make kpoints ret = make_kspacing_kpoints("POSCAR", kspacing, gamma) - kp = Kpoints.from_string(ret) + try: + kp = Kpoints.from_string(ret) + except AttributeError: + kp = Kpoints.from_str(ret) kp.write_file("KPOINTS") os.chdir(cwd) From 3da2472f65999aebff000ca15d3f1dde2489388e Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 1 Nov 2023 00:18:44 -0400 Subject: [PATCH 85/86] move to ruff formatter (#1375) See https://astral.sh/blog/the-ruff-formatter. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 5 +-- dpgen/auto_test/lib/lammps.py | 8 ++-- dpgen/generator/lib/abacus_scf.py | 51 +++++++++++++++----------- dpgen/generator/lib/calypso_run_opt.py | 6 +-- dpgen/generator/run.py | 45 ++++++++++++----------- dpgen/tools/auto_gen_param.py | 4 +- dpgen/tools/stat_iter.py | 12 ++---- dpgen/tools/stat_time.py | 8 +--- pyproject.toml | 4 +- 9 files changed, 71 insertions(+), 72 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 215b528f2..75592b2db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,15 +27,12 @@ repos: exclude: "^examples/CH4-lebesgue/.*$" # Python -- repo: https://github.com/psf/black - rev: 23.10.1 - hooks: - - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.3 hooks: - id: ruff args: ["--fix"] + - id: ruff-format # numpydoc - repo: https://github.com/Carreau/velin rev: 0.0.12 diff --git a/dpgen/auto_test/lib/lammps.py b/dpgen/auto_test/lib/lammps.py index d544d0d2b..a1e387232 100644 --- a/dpgen/auto_test/lib/lammps.py +++ b/dpgen/auto_test/lib/lammps.py @@ -189,7 +189,9 @@ def make_lammps_eval(conf, type_map, interaction, param): ret += ( "thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype\n" ) - ret += "dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz\n" # 06/09 give dump.relax + ret += ( + "dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz\n" + ) # 06/09 give dump.relax ret += "run 0\n" ret += "variable N equal count(all)\n" ret += "variable V equal vol\n" @@ -352,9 +354,7 @@ def make_lammps_press_relax( ret += "variable bp equal %f\n" % bp ret += "variable xx equal %f\n" % scale2equi ret += "variable yeta equal 1.5*(${bp}-1)\n" - ret += ( - "variable Px0 equal 3*${B0}*(1-${xx})/${xx}^2*exp(${yeta}*(1-${xx}))\n" - ) + ret += "variable Px0 equal 3*${B0}*(1-${xx})/${xx}^2*exp(${yeta}*(1-${xx}))\n" ret += "variable Px equal ${Px0}*${GPa2bar}\n" ret += "units metal\n" ret += "dimension 3\n" diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index 67f5d17bf..561d84500 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -45,10 +45,13 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): fp_params["kspacing"] = [ float(i) for i in fp_params["kspacing"].split() ] - assert len(fp_params["kspacing"]) in [ - 1, - 3, - ], "'kspacing' only accept a float, or a list of one or three float, or a string of one or three float" + assert ( + len(fp_params["kspacing"]) + in [ + 1, + 3, + ] + ), "'kspacing' only accept a float, or a list of one or three float, or a string of one or three float" ret += "kspacing " for ikspacing in fp_params["kspacing"]: assert ikspacing >= 0, "'kspacing' should be non-negative." @@ -116,25 +119,31 @@ def make_abacus_scf_input(fp_params, extra_file_path=""): ), "'nspin' can anly take 1, 2 or 4" ret += "nspin %d\n" % fp_params["nspin"] elif key == "ks_solver": - assert fp_params["ks_solver"] in [ - "cg", - "dav", - "lapack", - "genelpa", - "hpseps", - "scalapack_gvx", - ], "'ks_sover' should in 'cgx', 'dav', 'lapack', 'genelpa', 'hpseps', 'scalapack_gvx'." + assert ( + fp_params["ks_solver"] + in [ + "cg", + "dav", + "lapack", + "genelpa", + "hpseps", + "scalapack_gvx", + ] + ), "'ks_sover' should in 'cgx', 'dav', 'lapack', 'genelpa', 'hpseps', 'scalapack_gvx'." ret += "ks_solver %s\n" % fp_params["ks_solver"] elif key == "smearing_method": - assert fp_params["smearing_method"] in [ - "gauss", - "gaussian", - "fd", - "fixed", - "mp", - "mp2", - "mv", - ], "'smearing_method' should in 'gauss', 'gaussian', 'fd', 'fixed', 'mp', 'mp2', 'mv'. " + assert ( + fp_params["smearing_method"] + in [ + "gauss", + "gaussian", + "fd", + "fixed", + "mp", + "mp2", + "mv", + ] + ), "'smearing_method' should in 'gauss', 'gaussian', 'fd', 'fixed', 'mp', 'mp2', 'mv'. " ret += "smearing_method %s\n" % fp_params["smearing_method"] elif key == "smearing_sigma": fp_params["smearing_sigma"] = float(fp_params["smearing_sigma"]) diff --git a/dpgen/generator/lib/calypso_run_opt.py b/dpgen/generator/lib/calypso_run_opt.py index 9cb94f958..b87abe726 100644 --- a/dpgen/generator/lib/calypso_run_opt.py +++ b/dpgen/generator/lib/calypso_run_opt.py @@ -94,9 +94,9 @@ def read_stress_fmax(): try: f = open("input.dat") except Exception: - assert os.path.exists( - "../input.dat" - ), " now we are in %s, do not find ../input.dat" % (os.getcwd()) + assert os.path.exists("../input.dat"), ( + " now we are in %s, do not find ../input.dat" % (os.getcwd()) + ) f = open("../input.dat") lines = f.readlines() f.close() diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 266b7bd00..da1454244 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -493,24 +493,26 @@ def make_train(iter_index, jdata, mdata): ): jinput["training"]["stop_batch"] = training_reuse_stop_batch if Version("1") <= Version(mdata["deepmd_version"]) < Version("2"): - jinput["training"][ - "auto_prob_style" - ] = "prob_sys_size; 0:%d:%f; %d:%d:%f" % ( - old_range, - training_reuse_old_ratio, - old_range, - len(init_data_sys), - 1.0 - training_reuse_old_ratio, + jinput["training"]["auto_prob_style"] = ( + "prob_sys_size; 0:%d:%f; %d:%d:%f" + % ( + old_range, + training_reuse_old_ratio, + old_range, + len(init_data_sys), + 1.0 - training_reuse_old_ratio, + ) ) elif Version("2") <= Version(mdata["deepmd_version"]) < Version("3"): - jinput["training"]["training_data"][ - "auto_prob" - ] = "prob_sys_size; 0:%d:%f; %d:%d:%f" % ( - old_range, - training_reuse_old_ratio, - old_range, - len(init_data_sys), - 1.0 - training_reuse_old_ratio, + jinput["training"]["training_data"]["auto_prob"] = ( + "prob_sys_size; 0:%d:%f; %d:%d:%f" + % ( + old_range, + training_reuse_old_ratio, + old_range, + len(init_data_sys), + 1.0 - training_reuse_old_ratio, + ) ) else: raise RuntimeError( @@ -1003,11 +1005,12 @@ def revise_lmp_input_model(lmp_lines, task_model_list, trj_freq, deepmd_version= trj_freq, ) else: - lmp_lines[ - idx - ] = "pair_style deepmd %s out_freq %d out_file model_devi.out\n" % ( - graph_list, - trj_freq, + lmp_lines[idx] = ( + "pair_style deepmd %s out_freq %d out_file model_devi.out\n" + % ( + graph_list, + trj_freq, + ) ) return lmp_lines diff --git a/dpgen/tools/auto_gen_param.py b/dpgen/tools/auto_gen_param.py index 6d837dc47..bd6d0f79b 100755 --- a/dpgen/tools/auto_gen_param.py +++ b/dpgen/tools/auto_gen_param.py @@ -149,9 +149,7 @@ def get_system_list( map_list=map_list, data_list=data_list ) else: - origin_one, new_map_iterator = tee( - map_iterator - ) # pylint: disable=unused-variable + origin_one, new_map_iterator = tee(map_iterator) # pylint: disable=unused-variable # tee means copy;new_map_generator will become a copy of map_iterator system = System(system_prefix) for idx2 in range(sub_iteration_num): diff --git a/dpgen/tools/stat_iter.py b/dpgen/tools/stat_iter.py index 43a0617fa..1f0a6747e 100644 --- a/dpgen/tools/stat_iter.py +++ b/dpgen/tools/stat_iter.py @@ -26,14 +26,10 @@ def stat_iter(target_folder, param_file="param.json", verbose=True, mute=False): num, relative_path_doc = line.strip().split(" ") path_doc = os.path.abspath(relative_path_doc) num = int(num) - prefix, iter_dirname, stage, out_filename = path_doc.rsplit( - "/", 3 - ) # pylint: disable=unused-variable + prefix, iter_dirname, stage, out_filename = path_doc.rsplit("/", 3) # pylint: disable=unused-variable pk_id, out_filename = path_doc.rsplit("/", 1) iter = int(iter_dirname.split(".")[-1]) # pylint: disable=unused-variable - out_id = int( - out_filename.strip().split(".")[-2] - ) # pylint: disable=unused-variable + out_id = int(out_filename.strip().split(".")[-2]) # pylint: disable=unused-variable out_type = out_filename.strip().split(".")[0] iter_dict[pk_id][out_type] += num # for ii in @@ -52,9 +48,7 @@ def stat_iter(target_folder, param_file="param.json", verbose=True, mute=False): if line: # [/home/felix/workplace/SiC/iter.000002/02.fp/task.018.000040/OUTCAR] path_doc = os.path.abspath(line) - pk_id, task_dirname, OUTCAR_filename = path_doc.rsplit( - "/", 2 - ) # pylint: disable=unused-variable + pk_id, task_dirname, OUTCAR_filename = path_doc.rsplit("/", 2) # pylint: disable=unused-variable try: _sys = dpdata.LabeledSystem(path_doc, type_map=jdata["type_map"]) except Exception: diff --git a/dpgen/tools/stat_time.py b/dpgen/tools/stat_time.py index 5a2e129ac..e490a39ea 100755 --- a/dpgen/tools/stat_time.py +++ b/dpgen/tools/stat_time.py @@ -51,9 +51,7 @@ def stat_time(target_folder, param_file="param.json", verbose=True, mute=False): # log example : # .//iter.000000/00.train//003/train.log:# DEEPMD: wall time: 7960.265 s # print(log.split(':')) - file_path, text1, text2, wall_time = log.split( - ":" - ) # pylint: disable=unused-variable + file_path, text1, text2, wall_time = log.split(":") # pylint: disable=unused-variable abs_file_path = os.path.abspath(file_path) # stage=='00.train' @@ -122,9 +120,7 @@ def stat_time(target_folder, param_file="param.json", verbose=True, mute=False): # log example: # .//iter.000002/01.model_devi//task.018.000075/log.lammps:Total wall time: 0:00:39 # print(log) - file_path, text1, hour, min, sec = log.split( - ":" - ) # pylint: disable=unused-variable + file_path, text1, hour, min, sec = log.split(":") # pylint: disable=unused-variable abs_file_path = os.path.abspath(file_path) wall_time_sec = 3600 * int(hour) + 60 * int(min) + 1 * int(sec) total_core_sec += wall_time_sec * paral_cores diff --git a/pyproject.toml b/pyproject.toml index 61b6ab46b..4832355af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,6 @@ write_to = "dpgen/_version.py" profile = "black" [tool.ruff] -target-version = "py39" select = [ "I", # isort "E", # errors @@ -109,3 +108,6 @@ ignore = [ "D404", # TODO: first word of the docstring should not be This ] ignore-init-module-imports = true + +[tool.ruff.pydocstyle] +convention = "numpy" From 9ddef6ac3119c4bc20455f33847736e7f4774922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Thu, 2 Nov 2023 01:26:11 -0400 Subject: [PATCH 86/86] model_devi: add support for pimd (#1366) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for LAMMPS's fix pimd/langevin in model deviation tasks. --------- Signed-off-by: Yifan Li李一帆 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng --- dpgen/generator/arginfo.py | 2 + dpgen/generator/lib/lammps.py | 104 ++++++++++++---- dpgen/generator/run.py | 110 ++++++++++++++++- tests/generator/context.py | 1 + tests/generator/param-mg-pimd-vasp.json | 153 ++++++++++++++++++++++++ tests/generator/test_make_md.py | 88 +++++++++++++- 6 files changed, 426 insertions(+), 32 deletions(-) create mode 100644 tests/generator/param-mg-pimd-vasp.json diff --git a/dpgen/generator/arginfo.py b/dpgen/generator/arginfo.py index 5c6d5f49f..e1d220e42 100644 --- a/dpgen/generator/arginfo.py +++ b/dpgen/generator/arginfo.py @@ -262,6 +262,7 @@ def model_devi_jobs_args() -> list[Argument]: doc_press = "Pressure (Bar) in MD. Required when ensemble is npt." doc_trj_freq = "Frequecy of trajectory saved in MD." doc_nsteps = "Running steps of MD. It is not optional when not using a template." + doc_nbeads = "Number of beads in PIMD. If not given, classical MD will be performed. Only supported for LAMMPS version >= 20230615." doc_ensemble = "Determining which ensemble used in MD, options include “npt” and “nvt”. It is not optional when not using a template." doc_neidelay = "delay building until this many steps since last build." doc_taut = "Coupling time of thermostat (ps)." @@ -280,6 +281,7 @@ def model_devi_jobs_args() -> list[Argument]: Argument("press", list[float], optional=True, doc=doc_press), Argument("trj_freq", int, optional=False, doc=doc_trj_freq), Argument("nsteps", int, optional=True, doc=doc_nsteps), + Argument("nbeads", int, optional=True, doc=doc_nbeads), Argument("ensemble", str, optional=True, doc=doc_ensemble), Argument("neidelay", int, optional=True, doc=doc_neidelay), Argument("taut", float, optional=True, doc=doc_taut), diff --git a/dpgen/generator/lib/lammps.py b/dpgen/generator/lib/lammps.py index 0da9c8346..d9ff4a493 100644 --- a/dpgen/generator/lib/lammps.py +++ b/dpgen/generator/lib/lammps.py @@ -37,6 +37,7 @@ def make_lammps_input( max_seed=1000000, nopbc=False, deepmd_version="0.1", + nbeads=None, ): if (ele_temp_f is not None or ele_temp_a is not None) and Version( deepmd_version @@ -49,9 +50,22 @@ def make_lammps_input( "the frame style ele_temp and atom style ele_temp should not be set at the same time" ) ret = "variable NSTEPS equal %d\n" % nsteps + if nbeads is not None: + if nbeads <= 0: + raise ValueError( + "The number of beads should be positive. Check your nbeads setting." + ) + power = 1 + while power < nbeads: + power *= 10 + ret += "variable ibead uloop %d pad\n" % (power - 1) + if nbeads is not None: + ret += "atom_modify map yes\n" ret += "variable THERMO_FREQ equal %d\n" % trj_freq ret += "variable DUMP_FREQ equal %d\n" % trj_freq ret += "variable TEMP equal %f\n" % temp + if nbeads is not None: + ret += "variable TEMP_NBEADS equal %f\n" % (temp * nbeads) if ele_temp_f is not None: ret += "variable ELE_TEMP equal %f\n" % ele_temp_f if ele_temp_a is not None: @@ -72,10 +86,16 @@ def make_lammps_input( ret += "neigh_modify delay %d\n" % neidelay ret += "\n" ret += "box tilt large\n" - ret += ( - 'if "${restart} > 0" then "read_restart dpgen.restart.*" else "read_data %s"\n' - % conf_file - ) + if nbeads is None: + ret += ( + 'if "${restart} > 0" then "read_restart dpgen.restart.*" else "read_data %s"\n' + % conf_file + ) + else: + ret += ( + 'if "${restart} > 0" then "read_restart dpgen.restart${ibead}.*" else "read_data %s"\n' + % conf_file + ) ret += "change_box all triclinic\n" for jj in range(len(mass_map)): ret += "mass %d %f\n" % (jj + 1, mass_map[jj]) @@ -98,23 +118,43 @@ def make_lammps_input( keywords += "fparam ${ELE_TEMP}" if ele_temp_a is not None: keywords += "aparam ${ELE_TEMP}" - ret += f"pair_style deepmd {graph_list} out_freq ${{THERMO_FREQ}} out_file model_devi.out {keywords}\n" + if nbeads is None: + ret += f"pair_style deepmd {graph_list} out_freq ${{THERMO_FREQ}} out_file model_devi.out {keywords}\n" + else: + ret += f"pair_style deepmd {graph_list} out_freq ${{THERMO_FREQ}} out_file model_devi${{ibead}}.out {keywords}\n" ret += "pair_coeff * *\n" ret += "\n" ret += "thermo_style custom step temp pe ke etotal press vol lx ly lz xy xz yz\n" ret += "thermo ${THERMO_FREQ}\n" model_devi_merge_traj = jdata.get("model_devi_merge_traj", False) - if model_devi_merge_traj is True: - ret += "dump 1 all custom ${DUMP_FREQ} all.lammpstrj id type x y z fx fy fz\n" - ret += 'if "${restart} > 0" then "dump_modify 1 append yes"\n' + if nbeads is None: + if model_devi_merge_traj is True: + ret += "dump 1 all custom ${DUMP_FREQ} all.lammpstrj id type x y z fx fy fz\n" + ret += 'if "${restart} > 0" then "dump_modify 1 append yes"\n' + else: + ret += "dump 1 all custom ${DUMP_FREQ} traj/*.lammpstrj id type x y z fx fy fz\n" else: - ret += "dump 1 all custom ${DUMP_FREQ} traj/*.lammpstrj id type x y z fx fy fz\n" - ret += "restart 10000 dpgen.restart\n" + if model_devi_merge_traj is True: + ret += "dump 1 all custom ${DUMP_FREQ} all.lammpstrj${ibead} id type x y z fx fy fz\n" + ret += 'if "${restart} > 0" then "dump_modify 1 append yes"\n' + else: + ret += "dump 1 all custom ${DUMP_FREQ} traj/*.lammpstrj${ibead} id type x y z fx fy fz\n" + if nbeads is None: + ret += "restart 10000 dpgen.restart\n" + else: + ret += "restart 10000 dpgen.restart${ibead}\n" ret += "\n" if pka_e is None: - ret += 'if "${restart} == 0" then "velocity all create ${TEMP} %d"' % ( - random.randrange(max_seed - 1) + 1 - ) + if nbeads is None: + ret += ( + 'if "${restart} == 0" then "velocity all create ${TEMP} %d"' + % (random.randrange(max_seed - 1) + 1) + ) + else: + ret += ( + 'if "${restart} == 0" then "velocity all create ${TEMP_NBEADS} %d"' + % (random.randrange(max_seed - 1) + 1) + ) else: sys = dpdata.System(conf_file, fmt="lammps/lmp") sys_data = sys.data @@ -140,18 +180,34 @@ def make_lammps_input( assert pres is not None if nopbc: raise RuntimeError("ensemble %s is conflicting with nopbc" % ensemble) - if ensemble == "npt" or ensemble == "npt-i" or ensemble == "npt-iso": - ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P}\n" - elif ensemble == "npt-a" or ensemble == "npt-aniso": - ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} aniso ${PRES} ${PRES} ${TAU_P}\n" - elif ensemble == "npt-t" or ensemble == "npt-tri": - ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} tri ${PRES} ${PRES} ${TAU_P}\n" - elif ensemble == "nvt": - ret += "fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n" - elif ensemble == "nve": - ret += "fix 1 all nve\n" + if nbeads is None: + if ensemble == "npt" or ensemble == "npt-i" or ensemble == "npt-iso": + ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P}\n" + elif ensemble == "npt-a" or ensemble == "npt-aniso": + ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} aniso ${PRES} ${PRES} ${TAU_P}\n" + elif ensemble == "npt-t" or ensemble == "npt-tri": + ret += "fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} tri ${PRES} ${PRES} ${TAU_P}\n" + elif ensemble == "nvt": + ret += "fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n" + elif ensemble == "nve": + ret += "fix 1 all nve\n" + else: + raise RuntimeError("unknown emsemble " + ensemble) else: - raise RuntimeError("unknown emsemble " + ensemble) + if ensemble == "npt" or ensemble == "npt-i" or ensemble == "npt-iso": + ret += "fix 1 all pimd/langevin fmmode physical ensemble npt integrator obabo thermostat PILE_L ${ibead} temp ${TEMP} tau ${TAU_T} scale 1.0 barostat BZP iso ${PRES} taup ${TAU_P}\n" + elif ensemble == "npt-a" or ensemble == "npt-aniso": + ret += "fix 1 all pimd/langevin fmmode physical ensemble npt integrator obabo thermostat PILE_L ${ibead} temp ${TEMP} tau ${TAU_T} scale 1.0 barostat BZP aniso ${PRES} taup ${TAU_P}\n" + elif ensemble == "nvt": + ret += "fix 1 all pimd/langevin fmmode physical ensemble nvt integrator obabo thermostat PILE_L ${ibead} temp ${TEMP} tau ${TAU_T} scale 1.0\n" + elif ensemble == "nve": + ret += "fix 1 all pimd/langevin fmmode physical ensemble nve integrator obabo temp ${TEMP}\n" + else: + raise RuntimeError( + "unknown emsemble " + + ensemble + + " for fix pimd/langevin\nrefer to https://docs.lammps.org/fix_pimd.html for more information" + ) if nopbc: ret += "velocity all zero linear\n" ret += "fix fm all momentum 1 linear 1 1 1\n" diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index da1454244..034918efc 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -18,6 +18,7 @@ import os import queue import random +import re import shutil import sys import warnings @@ -915,7 +916,11 @@ def parse_cur_job(cur_job): dt = _get_param_alias(cur_job, ["dt"]) else: dt = None - return ensemble, nsteps, trj_freq, temps, press, pka_e, dt + if "nbeads" in cur_job: + nbeads = _get_param_alias(cur_job, ["nbeads"]) + else: + nbeads = None + return ensemble, nsteps, trj_freq, temps, press, pka_e, dt, nbeads def expand_matrix_values(target_list, cur_idx=0): @@ -1457,7 +1462,21 @@ def _make_model_devi_native(iter_index, jdata, mdata, conf_systems): if iter_index >= len(model_devi_jobs): return False cur_job = model_devi_jobs[iter_index] - ensemble, nsteps, trj_freq, temps, press, pka_e, dt = parse_cur_job(cur_job) + ensemble, nsteps, trj_freq, temps, press, pka_e, dt, nbeads = parse_cur_job(cur_job) + model_devi_f_avg_relative = jdata.get("model_devi_f_avg_relative", False) + model_devi_merge_traj = jdata.get("model_devi_merge_traj", False) + if (nbeads is not None) and model_devi_f_avg_relative: + raise RuntimeError( + "model_devi_f_avg_relative has not been supported for pimd. Set model_devi_f_avg_relative to False." + ) + if (nbeads is not None) and (model_devi_merge_traj): + raise RuntimeError( + "model_devi_merge_traj has not been supported for pimd. Set model_devi_merge_traj to False." + ) + if (nbeads is not None) and (not (nsteps % trj_freq == 0)): + raise RuntimeError( + "trj_freq should be a factor of nsteps for pimd. Please check your input." + ) if dt is not None: model_devi_dt = dt sys_idx = expand_idx(cur_job["sys_idx"]) @@ -1560,6 +1579,7 @@ def _make_model_devi_native(iter_index, jdata, mdata, conf_systems): ele_temp_a=te_a, nopbc=nopbc, deepmd_version=deepmd_version, + nbeads=nbeads, ) job = {} job["ensemble"] = ensemble @@ -1916,12 +1936,23 @@ def run_md_model_devi(iter_index, jdata, mdata): model_devi_engine = jdata.get("model_devi_engine", "lammps") if model_devi_engine == "lammps": - command = f"{{ if [ ! -f dpgen.restart.10000 ]; then {model_devi_exec} -i input.lammps -v restart 0; else {model_devi_exec} -i input.lammps -v restart 1; fi }}" - command = "/bin/sh -c '%s'" % command + nbeads = jdata["model_devi_jobs"][iter_index].get("nbeads") + if nbeads is None: + command = f"{{ if [ ! -f dpgen.restart.10000 ]; then {model_devi_exec} -i input.lammps -v restart 0; else {model_devi_exec} -i input.lammps -v restart 1; fi }}" + else: + command = f"{{ all_exist=true; for i in $(seq -w 1 {nbeads}); do [[ ! -f dpgen.restart${{i}}.10000 ]] && {{ all_exist=false; break; }}; done; $all_exist && {{ {model_devi_exec} -p {nbeads}x1 -i input.lammps -v restart 1; }} || {{ {model_devi_exec} -p {nbeads}x1 -i input.lammps -v restart 0; }} }}" + command = "/bin/bash -c '%s'" % command commands = [command] forward_files = ["conf.lmp", "input.lammps"] - backward_files = ["model_devi.out", "model_devi.log"] + backward_files = ["model_devi.log"] + if nbeads is None: + backward_files += ["model_devi.out"] + else: + num_digits = np.ceil(np.log10(nbeads + 1)).astype(int) + backward_files += [ + f"model_devi{i+1:0{num_digits}d}.out" for i in range(nbeads) + ] if model_devi_merge_traj: backward_files += ["all.lammpstrj"] else: @@ -2131,6 +2162,75 @@ def _read_model_devi_file( model_devi_f_avg_relative: bool = False, model_devi_merge_traj: bool = False, ): + model_devi_files = glob.glob(os.path.join(task_path, "model_devi*.out")) + model_devi_files_sorted = sorted( + model_devi_files, key=lambda x: int(re.search(r"(\d+)", x).group(1)) + ) + if len(model_devi_files_sorted) > 1: + with open(model_devi_files_sorted[0]) as f: + first_line = f.readline() + if not (first_line.startswith("#")): + first_line = "#" + num_beads = len(model_devi_files_sorted) + model_devi_contents = [] + for file in model_devi_files_sorted: + model_devi_contents.append(np.loadtxt(file)) + assert all( + model_devi_content.shape[0] == model_devi_contents[0].shape[0] + for model_devi_content in model_devi_contents + ), "Not all beads generated the same number of lines in the model_devi$\{ibead\}.out file. Check your pimd task carefully." + for file in model_devi_files_sorted: + os.remove(file) + last_step = model_devi_contents[0][-1, 0] + for ibead in range(1, num_beads): + model_devi_contents[ibead][:, 0] = model_devi_contents[ibead][ + :, 0 + ] + ibead * (last_step + 1) + model_devi = np.concatenate(model_devi_contents, axis=0) + num_columns = model_devi.shape[1] + formats = ["%12d"] + ["%22.6e"] * (num_columns - 1) + np.savetxt( + os.path.join(task_path, "model_devi.out"), + model_devi, + fmt=formats, + header=first_line.rstrip(), + comments="", + ) + + if not model_devi_merge_traj: + num_digits = np.ceil(np.log10(num_beads + 1)).astype(int) + traj_files_sorted = [] + for ibead in range(num_beads): + traj_files = glob.glob( + os.path.join( + task_path, "traj", f"*lammpstrj{ibead+1:0{num_digits}d}" + ) + ) + traj_files_sorted.append( + sorted( + traj_files, + key=lambda x: int( + re.search(r"^(\d+)\.lammpstrj", os.path.basename(x)).group( + 1 + ) + ), + ) + ) + assert all( + len(traj_list) == len(traj_files_sorted[0]) + for traj_list in traj_files_sorted + ), "Not all beads generated the same number of frames. Check your pimd task carefully." + for ibead in range(num_beads): + for itraj in range(len(traj_files_sorted[0])): + base_path, original_filename = os.path.split( + traj_files_sorted[ibead][itraj] + ) + frame_number = int(original_filename.split(".")[0]) + new_filename = os.path.join( + base_path, + f"{frame_number + ibead * (int(last_step)+1):d}.lammpstrj", + ) + os.rename(traj_files_sorted[ibead][itraj], new_filename) model_devi = np.loadtxt(os.path.join(task_path, "model_devi.out")) if model_devi_f_avg_relative: if model_devi_merge_traj is True: diff --git a/tests/generator/context.py b/tests/generator/context.py index 7a6f1f2d3..a58b0dddb 100644 --- a/tests/generator/context.py +++ b/tests/generator/context.py @@ -20,6 +20,7 @@ from dpgen.util import setup_ele_temp # noqa: F401 param_file = "param-mg-vasp.json" +param_pimd_file = "param-mg-pimd-vasp.json" param_file_merge_traj = "param-mg-vasp_merge_traj.json" param_file_v1 = "param-mg-vasp-v1.json" param_file_v1_et = "param-mg-vasp-v1-et.json" diff --git a/tests/generator/param-mg-pimd-vasp.json b/tests/generator/param-mg-pimd-vasp.json new file mode 100644 index 000000000..efd75dd5c --- /dev/null +++ b/tests/generator/param-mg-pimd-vasp.json @@ -0,0 +1,153 @@ +{ + "type_map": [ + "Mg", + "Al" + ], + "mass_map": [ + 24, + 27 + ], + "init_data_prefix": "data", + "init_data_sys": [ + "deepmd" + ], + "init_batch_size": [ + 16 + ], + "sys_configs": [ + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000000/POSCAR" + ], + [ + "data/mg.fcc.02x02x02/01.scale_pert/sys-0032/scale*/000001/POSCAR" + ] + ], + "_comment1": "0 1 2 3", + "_comment2": "4 5 6 7", + "sys_batch_size": [ + 1, + 1 + ], + "_comment3": " 00.train ", + "numb_models": 4, + "default_training_param": { + "model": { + "descriptor": { + "seed": 0, + "type": "se_a", + "sel": [ + 90 + ], + "rcut": 6.0, + "rcut_smth": 2.0, + "neuron": [ + 25, + 50, + 100 + ], + "axis_neuron": 12, + "resnet_dt": false + }, + "fitting_net": { + "seed": 0, + "neuron": [ + 240, + 240, + 240 + ], + "resnet_dt": true + } + }, + "learning_rate": { + "type": "exp", + "decay_steps": 2000, + "start_lr": 0.002, + "stop_lr": 7.010533249765748e-08 + }, + "loss": { + "start_pref_e": 0.02, + "limit_pref_e": 2, + "start_pref_f": 1000, + "limit_pref_f": 1, + "start_pref_v": 0.0, + "limit_pref_v": 0.0 + }, + "training": { + "seed": 0, + "stop_batch": 400000, + "disp_file": "lcurve.out", + "disp_freq": 2000, + "save_freq": 20000, + "save_ckpt": "model.ckpt", + "disp_training": true, + "time_training": true, + "profiling": false, + "training_data": { + "systems": [], + "set_prefix": "set", + "batch_size": 1 + } + } + }, + "_comment9": " 01.model_devi ", + "_comment10": "model_devi_skip: the first x of the recorded frames", + "model_devi_dt": 0.002, + "model_devi_skip": 0, + "model_devi_f_trust_lo": 0.05, + "model_devi_f_trust_hi": 0.15, + "model_devi_clean_traj": false, + "model_devi_jobs": [ + { + "sys_idx": [ + 0, + 1 + ], + "temps": [ + 50, + 100 + ], + "press": [ + 1.0, + 2.0 + ], + "nbeads": 4, + "trj_freq": 10, + "nsteps": 10, + "ensemble": "npt", + "_idx": "00" + } + ], + "_comment11": " 02.fp ", + "fp_style": "vasp", + "shuffle_poscar": false, + "fp_task_max": 100, + "fp_task_min": 10, + "fp_pp_path": ".", + "fp_pp_files": [ + "vasp/potcars/POTCAR.mg", + "vasp/potcars/POTCAR.al" + ], + "_comment12": " user provided vasp script ", + "user_fp_params": { + "PREC": "A", + "ENCUT": 600, + "ISYM": 0, + "ALGO": "fast", + "EDIFF": 1e-05, + "LREAL": "A", + "NPAR": 1, + "KPAR": 1, + "NELMIN": 4, + "ISIF": 2, + "ISMEAR": 1, + "SIGMA": 0.25, + "IBRION": -1, + "NSW": 0, + "LWAVE": false, + "LCHARG": false, + "PSTRESS": 0, + "KSPACING": 0.16, + "KGAMMA": false + }, + "_comment13": " that's all " +} diff --git a/tests/generator/test_make_md.py b/tests/generator/test_make_md.py index c6138ee52..bf09508ee 100644 --- a/tests/generator/test_make_md.py +++ b/tests/generator/test_make_md.py @@ -7,25 +7,31 @@ import unittest import dpdata +import numpy as np -from dpgen.generator.run import parse_cur_job_sys_revmat +from dpgen.generator.run import _read_model_devi_file, parse_cur_job_sys_revmat sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) __package__ = "generator" +import tempfile + from .comp_sys import test_atom_names, test_atom_types, test_cell, test_coord from .context import ( find_only_one_key, machine_file, + machine_file_v1, make_model_devi, my_file_cmp, param_amber_file, param_file, + param_pimd_file, parse_cur_job, parse_cur_job_revmat, revise_by_keys, revise_lmp_input_dump, revise_lmp_input_model, revise_lmp_input_plm, + run_model_devi, ) @@ -95,7 +101,7 @@ def _check_traj_dir(testCase, idx): def _get_lammps_pt(lmp_input): with open(lmp_input) as fp: for ii in fp: - if "variable" in ii and "TEMP" in ii: + if "variable" in ii and "TEMP" in ii and "TEMP_NBEADS" not in ii: lt = float(ii.split()[3]) if "variable" in ii and "PRES" in ii: lp = float(ii.split()[3]) @@ -107,7 +113,7 @@ def _check_pt(testCase, idx, jdata): tasks = glob.glob(os.path.join(md_dir, "task.*")) tasks.sort() cur_job = jdata["model_devi_jobs"][idx] - ensemble, nsteps, trj_freq, temps, press, pka_e, dt = parse_cur_job(cur_job) + ensemble, nsteps, trj_freq, temps, press, pka_e, dt, nbeads = parse_cur_job(cur_job) testCase.assertTrue(ensemble, "npt") # get poscars sys_idx = cur_job["sys_idx"] @@ -136,6 +142,8 @@ class TestMakeModelDevi(unittest.TestCase): def tearDown(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") + if os.path.isdir("test_model_devi_pimd"): + shutil.rmtree("test_model_devi_pimd") def test_make_model_devi(self): if os.path.isdir("iter.000000"): @@ -152,6 +160,20 @@ def test_make_model_devi(self): _check_pt(self, 0, jdata) # shutil.rmtree('iter.000000') + def test_make_model_devi_pimd(self): + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + with open(param_pimd_file) as fp: + jdata = json.load(fp) + with open(machine_file) as fp: + mdata = json.load(fp) + _make_fake_models(0, jdata["numb_models"]) + make_model_devi(0, jdata, mdata) + _check_pb(self, 0) + _check_confs(self, 0, jdata) + _check_traj_dir(self, 0) + _check_pt(self, 0, jdata) + def test_make_model_devi_nopbc_npt(self): if os.path.isdir("iter.000000"): shutil.rmtree("iter.000000") @@ -183,6 +205,66 @@ def test_make_model_devi_nopbc_nvt(self): _check_pt(self, 0, jdata) # shutil.rmtree('iter.000000') + def test_run_model_devi_pimd(self): + if os.path.isdir("iter.000000"): + shutil.rmtree("iter.000000") + with open(param_pimd_file) as fp: + jdata = json.load(fp) + with open(machine_file_v1) as fp: + mdata = json.load(fp) + _make_fake_models(0, jdata["numb_models"]) + make_model_devi(0, jdata, mdata) + with tempfile.TemporaryDirectory() as remote_root: + run_model_devi( + 0, + jdata, + { + "api_version": "1.0", + "model_devi_command": ( + "touch model_devi1.out model_devi2.out model_devi3.out model_devi4.out" + "&& echo lmp" + ), + "model_devi_machine": { + "batch_type": "shell", + "local_root": "./", + "remote_root": remote_root, + "context_type": "local", + }, + "model_devi_group_size": 1, + "model_devi_resources": { + "group_size": 1, + "cpu_per_node": 4, + }, + }, + ) + + def test_read_model_devi_file_pimd(self): + path = "test_model_devi_pimd" + if os.path.isdir(path): + shutil.rmtree(path) + os.makedirs(path, exist_ok=True) + os.makedirs(os.path.join(path, "traj"), exist_ok=True) + for i in range(4): + for j in range(0, 5, 2): + with open(os.path.join(path, f"traj/{j}.lammpstrj{i+1}"), "a"): + pass + model_devi_array = np.zeros([3, 7]) + model_devi_array[:, 0] = np.array([0, 2, 4]) + for i in range(4): + np.savetxt( + os.path.join(path, f"model_devi{i+1}.out"), model_devi_array, fmt="%d" + ) + _read_model_devi_file(path) + model_devi_total_array = np.zeros([12, 7]) + total_steps = np.array([0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19]) + model_devi_total_array[:, 0] = total_steps + model_devi_out = np.loadtxt(os.path.join(path, "model_devi.out")) + np.testing.assert_array_almost_equal(model_devi_out, model_devi_total_array) + for istep in total_steps: + self.assertTrue( + os.path.isfile(os.path.join(path, f"traj/{istep}.lammpstrj")) + ) + class TestMakeModelDeviRevMat(unittest.TestCase): def tearDown(self):