diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index dc2e4fb80..448f53e60 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 = [] @@ -474,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) @@ -492,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) : 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, diff --git a/setup.py b/setup.py index 0e93869e4..5763c20c6 100755 --- a/setup.py +++ b/setup.py @@ -13,15 +13,15 @@ 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, 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", 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)