From 748eb65c886a19d846f0f64b0b499b69d52d11af Mon Sep 17 00:00:00 2001 From: Han Wang Date: Thu, 11 Jul 2019 17:06:00 +0800 Subject: [PATCH 1/5] auto detect software version by git --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3b26c9855..f3bffc7f7 100755 --- a/setup.py +++ b/setup.py @@ -18,10 +18,10 @@ setuptools.setup( name=NAME, version_format='{tag}.dev{commitcount}+{gitsha}', - version="0.1.0", + setup_requires=['setuptools-git-version'], author="Han Wang", author_email="wang_han@iapcm.ac.cn", - description="Manipulating DeePMD-kit, VASP and LAMMPS data formats", + description="DPGen: The deep potential generator", long_description=readme, long_description_content_type="text/markdown", url="https://github.com/deepmodeling/dpgen", From aaa479dbc11fa9f37f899b8ffd20e2b990e7404b Mon Sep 17 00:00:00 2001 From: Han Wang Date: Sun, 11 Aug 2019 11:11:06 +0800 Subject: [PATCH 2/5] remove key train_param, always use input.json --- dpgen/generator/run.py | 15 +++++++++------ examples/generator/param_CH4.json | 1 - examples/generator/param_al_all_gpu.json | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index dc2e4fb80..ceb501830 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -53,6 +53,7 @@ train_name = '00.train' train_task_fmt = '%03d' train_tmpl_path = os.path.join(template_name, train_name) +default_train_input_file = 'input.json' data_system_fmt = '%03d' model_devi_name = '01.model_devi' model_devi_task_fmt = data_system_fmt + '.%06d' @@ -170,7 +171,8 @@ def make_train (iter_index, jdata, mdata) : # load json param - train_param = jdata['train_param'] + # train_param = jdata['train_param'] + train_input_file = default_train_input_file numb_models = jdata['numb_models'] init_data_prefix = jdata['init_data_prefix'] init_data_prefix = os.path.abspath(init_data_prefix) @@ -277,7 +279,7 @@ def make_train (iter_index, jinput['model']['descriptor']['seed'] = random.randrange(sys.maxsize) % (2**32) jinput['model']['fitting_net']['seed'] = random.randrange(sys.maxsize) % (2**32) jinput['training']['seed'] = random.randrange(sys.maxsize) % (2**32) - with open(os.path.join(task_path, train_param), 'w') as outfile: + with open(os.path.join(task_path, train_input_file), 'w') as outfile: json.dump(jinput, outfile, indent = 4) # link old models @@ -315,7 +317,8 @@ def run_train (iter_index, ssh_sess) : # load json param numb_models = jdata['numb_models'] - train_param = jdata['train_param'] + # train_param = jdata['train_param'] + train_input_file = default_train_input_file try: mdata["deepmd_version"] except: @@ -345,12 +348,12 @@ def run_train (iter_index, if LooseVersion(mdata["deepmd_version"]) < LooseVersion('1'): # 0.x command = os.path.join(deepmd_path, 'bin/dp_train') - command += ' %s && ' % train_param + command += ' %s && ' % train_input_file command += os.path.join(deepmd_path, 'bin/dp_frz') else: # 1.x command = '%s -m deepmd train' % python_path - command += ' %s && ' % train_param + command += ' %s && ' % train_input_file command += '%s -m deepmd freeze' % python_path #_tasks = [os.path.basename(ii) for ii in all_task] @@ -364,7 +367,7 @@ def run_train (iter_index, else: run_tasks.append(ii) - forward_files = [train_param] + forward_files = [train_input_file] backward_files = ['frozen_model.pb', 'lcurve.out'] init_data_sys_ = jdata['init_data_sys'] init_data_sys = [] diff --git a/examples/generator/param_CH4.json b/examples/generator/param_CH4.json index a6f422f63..1a894c8fe 100644 --- a/examples/generator/param_CH4.json +++ b/examples/generator/param_CH4.json @@ -24,7 +24,6 @@ "_comment": " 00.train ", "numb_models": 4, - "train_param": "input.json", "default_training_param" : { "_comment": " model parameters", "use_smooth": true, diff --git a/examples/generator/param_al_all_gpu.json b/examples/generator/param_al_all_gpu.json index 80febafb0..c25a63924 100644 --- a/examples/generator/param_al_all_gpu.json +++ b/examples/generator/param_al_all_gpu.json @@ -78,7 +78,6 @@ "_comment": " 00.train ", "numb_models": 4, - "train_param": "input.json", "default_training_param" : { "_comment": " model parameters", "use_smooth": true, From 9d032b36cb01321ada1440e210692744f80f7d71 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Sun, 11 Aug 2019 11:29:37 +0800 Subject: [PATCH 3/5] fix bug in pymatgen compatability --- tests/data/{surf-100.vasp => surf-100.POSCAR} | 0 tests/data/{surf-110.vasp => surf-110.POSCAR} | 0 tests/data/{surf-111.vasp => surf-111.POSCAR} | 0 tests/data/test_gen_surf.py | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename tests/data/{surf-100.vasp => surf-100.POSCAR} (100%) rename tests/data/{surf-110.vasp => surf-110.POSCAR} (100%) rename tests/data/{surf-111.vasp => surf-111.POSCAR} (100%) diff --git a/tests/data/surf-100.vasp b/tests/data/surf-100.POSCAR similarity index 100% rename from tests/data/surf-100.vasp rename to tests/data/surf-100.POSCAR diff --git a/tests/data/surf-110.vasp b/tests/data/surf-110.POSCAR similarity index 100% rename from tests/data/surf-110.vasp rename to tests/data/surf-110.POSCAR diff --git a/tests/data/surf-111.vasp b/tests/data/surf-111.POSCAR similarity index 100% rename from tests/data/surf-111.vasp rename to tests/data/surf-111.POSCAR diff --git a/tests/data/test_gen_surf.py b/tests/data/test_gen_surf.py index 7c5d7a5fd..1ba9e86a8 100644 --- a/tests/data/test_gen_surf.py +++ b/tests/data/test_gen_surf.py @@ -34,7 +34,7 @@ def test(self): poscars=glob.glob("surf.al.fcc.01x01x01/00.place_ele/surf*/sys*/POSCAR") for poscar in poscars: surf=poscar.split('/')[-3] - st1=Structure.from_file(surf+'.vasp') + st1=Structure.from_file(surf+'.POSCAR') st2=Structure.from_file(poscar) self.assertEqual(st1,st2) From bb2da4c765f7f493eb62536c0ed44d84024ff584 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Sun, 11 Aug 2019 11:32:59 +0800 Subject: [PATCH 4/5] check the version of monty --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0cc3c6d8d..5763c20c6 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with open(readme_file) as f: readme = f.read() -install_requires=['numpy>=1.14.3,<1.17', 'dpdata>=0.1.2', 'pymatgen', 'ase', 'monty', 'paramiko', 'custodian'] +install_requires=['numpy>=1.14.3,<1.17', 'dpdata>=0.1.2', 'pymatgen', 'ase', 'monty>2.0.0', 'paramiko', 'custodian'] setuptools.setup( name=NAME, From 3d63034483ebce286401055f282bb4bacf55e161 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Sun, 11 Aug 2019 12:31:42 +0800 Subject: [PATCH 5/5] remove freeze command in post_train --- dpgen/generator/run.py | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index ceb501830..448f53e60 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -477,16 +477,6 @@ def post_train (iter_index, mdata) : # load json param numb_models = jdata['numb_models'] - try: - mdata["deepmd_version"] - except: - mdata = set_version(mdata) - if LooseVersion(mdata["deepmd_version"]) < LooseVersion('1'): - # 0.x - deepmd_path = mdata['deepmd_path'] - else: - # 1.x - python_path = mdata['python_path'] # paths iter_name = make_iter_name(iter_index) work_path = os.path.join(iter_name, train_name) @@ -495,27 +485,13 @@ def post_train (iter_index, if os.path.isfile(copy_flag) : log_task('copied model, do not post train') return - all_task = [] - for ii in range(numb_models) : - task_path = os.path.join(work_path, train_task_fmt % ii) - all_task.append(task_path) - if LooseVersion(mdata["deepmd_version"]) < LooseVersion('1'): - # 0.x - command = os.path.join(deepmd_path, 'bin/dp_frz') - else: - # 1.x - command = python_path + ' -m deepmd freeze' - command = cmd_append_log(command, 'freeze.log') - command = 'CUDA_VISIBLE_DEVICES="" ' + command - # frz models - # exec_hosts(MachineLocal, command, 1, all_task, None) # symlink models for ii in range(numb_models) : task_file = os.path.join(train_task_fmt % ii, 'frozen_model.pb') ofile = os.path.join(work_path, 'graph.%03d.pb' % ii) if os.path.isfile(ofile) : os.remove(ofile) - os.symlink(task_file, ofile) + os.symlink(task_file, ofile) def _get_param_alias(jdata, names) :