Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #18

Merged
merged 39 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e9d5952
Merge pull request #523 from deepmodeling/devel
amcadmus Aug 27, 2021
fb30edf
fix typo in github actions release to conda
Aug 27, 2021
9dbac8d
Merge pull request #524 from felix5572/master
amcadmus Aug 28, 2021
02037ad
Get from_poscar_path only when from_poscar is true (#537)
shazj99 Sep 8, 2021
931f3e7
Fix bug in make_submission of Auto-test (#577)
AnguseZhang Oct 18, 2021
a28f26e
update abacus-scf generator (#575)
maki49 Oct 20, 2021
cceeba7
Add ase, custodian, GromacsWrapper in conda packages. (#578)
AnguseZhang Oct 21, 2021
90ea59e
add lebesgue ch4 example (#571)
KZHIWEI Oct 21, 2021
2fd6c7e
remove jr.json to allow rerun in autotest make (#579)
shazj99 Oct 26, 2021
7aec091
will convert local_root's './' to abspath to avoid hash conflict in n…
felix5572 Nov 2, 2021
5ce256c
model_devi_clean_traj support int type (#583)
KZHIWEI Nov 5, 2021
23054a1
add a citation badge (#589)
njzjz Nov 11, 2021
c6ce120
fix bug issue:597 (#598)
robinzyb Nov 25, 2021
08cf615
bump dpdata version to 0.2.4 (#595)
wanghan-iapcm Nov 25, 2021
58c7674
init_bulk: skip relax if skip_relax is true (#594)
shazj99 Nov 30, 2021
df9095d
change compress level to 6 from default 9 to accelerate compress (#593)
taipinghu Nov 30, 2021
43d1a0d
support `dp compress` (#607)
njzjz Nov 30, 2021
33cf245
Adapt different trust level for different sys_configs (#609)
Cloudac7 Dec 2, 2021
5c8faa6
bug_fix | to support multi-element cases (#608)
Vibsteamer Dec 2, 2021
7692835
bug_fix | typo in setting default KSPACING (#611)
Vibsteamer Dec 8, 2021
6de10d0
model_devi | sort models in default&support user-defined order (#610)
Vibsteamer Dec 8, 2021
eb6449c
Merge branch 'master' into devel
Dec 10, 2021
93b833a
Merge pull request #613 from amcadmus/master
amcadmus Dec 10, 2021
591d26c
add the workflow of releasing to pypi (#620)
njzjz Dec 15, 2021
7a8ae82
bug_fix | previous patch crashed (#626)
Vibsteamer Dec 30, 2021
b3db59d
Added ABACUS pw interface for dpgen init_bulk (#590)
Liu-RX Jan 4, 2022
1564080
Add `convert_mdata` definition to fix simplify bug. (#634)
AnguseZhang Jan 22, 2022
38f01c2
Add `minimize` step with `fix 1 all box/relax tri 0.0` to autotest/…
tuoping Feb 8, 2022
304c7f7
fix cp2k post fp numerical mismatch (#644)
robinzyb Feb 20, 2022
7d2c1de
bug fix (#650)
salinelake Feb 24, 2022
9e3f176
Merge remote-tracking branch 'upstream/devel' into devel
Mar 2, 2022
6304b66
Update simplify.py for api > 1.0, and fix multi-suffixes bug . (#670)
cherushui Mar 15, 2022
8cd50da
Make Autotest compatible with the new version of `dpdispatcher`. (#667)
AnguseZhang Mar 24, 2022
d30d557
add deepmodeling banner to doc (#688)
njzjz Mar 30, 2022
be18580
set the seed of type_embedding network (#689)
njzjz Mar 30, 2022
00a74ed
Merge remote-tracking branch 'upstream/devel' into devel
Mar 30, 2022
cedd26b
Merge branch 'devel'
Mar 30, 2022
9857833
Merge pull request #691 from amcadmus/devel
amcadmus Mar 30, 2022
9e3b958
Update param_CH4_deepmd-kit-2.0.1.json (#694)
LiangWenshuo1118 Apr 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ jobs:
repository: ${{ env.GITHUB_REPOSITORY }}
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 }}
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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/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)

Expand Down Expand Up @@ -188,6 +189,10 @@ If you want to specify a structure as starting point for `init_bulk`, you may se
"from_poscar": true,
"from_poscar_path": "....../C_mp-47_conventional.POSCAR",
```
`init_bulk` support both VASP and ABACUS for first-principle calculation. You can choose the software by specifying the key `init_fp_style`. If `init_fp_style` is not specified, the default software will be VASP.

When using ABACUS for `init_fp_style`, the keys of the paths of `INPUT` files for relaxation and MD simulations are the same as `INCAR` for VASP, which are `relax_incar` and `md_incar` respectively. You have to additionally specify `relax_kspacing` and `md_kspacing` for k points spacing, and dpgen will automatically generate `KPT` files according to them. You may also use `relax_kpt` and `md_kpt` instead of them for the relative path for `KPT` files of relaxation and MD simulations. However, either `relax_kspacing` and `md_kspacing`, or `relax_kpt` and `md_kpt` is needed. If `from_poscar` is set to `false`, you have to specify `atom_masses` in the same order as `elements`.

The following table gives explicit descriptions on keys in `PARAM`.

The bold notation of key (such as **Elements**) means that it's a necessary key.
Expand All @@ -199,9 +204,9 @@ The bold notation of key (such as **Elements**) means that it's a necessary key.
| cell_type | String | "hcp" | Specifying which typical structure to be generated. **Options** include fcc, hcp, bcc, sc, diamond.
| latt | Float | 4.479 | Lattice constant for single cell.
| from_poscar | Boolean | True | Deciding whether to use a given poscar as the beginning of relaxation. If it's true, keys (`cell_type`, `latt`) will be aborted. Otherwise, these two keys are **necessary**.
| from_poscar_path | String | "....../C_mp-47_conventional.POSCAR" | Path of POSCAR. **Necessary** if `from_poscar` is true.
| relax_incar | String | "....../INCAR" | Path of INCAR for relaxation in VASP. **Necessary** if `stages` include 1.
| md_incar | String | "....../INCAR" | Path of INCAR for MD in VASP. **Necessary** if `stages` include 3.|
| from_poscar_path | String | "....../C_mp-47_conventional.POSCAR" | Path of POSCAR for VASP or STRU for ABACUS. **Necessary** if `from_poscar` is true.
| relax_incar | String | "....../INCAR" | Path of INCAR for VASP or INPUT for ABACUS for relaxation in VASP. **Necessary** if `stages` include 1.
| md_incar | String | "....../INCAR" | Path of INCAR for VASP or INPUT for ABACUS for MD in VASP. **Necessary** if `stages` include 3.|
| **scale** | List of float | [0.980, 1.000, 1.020] | Scales for transforming cells.
| **skip_relax** | Boolean | False | If it's true, you may directly run stage 2 (pertub and scale) using an unrelaxed POSCAR.
| **pert_numb** | Integer | 30 | Number of pertubations for each POSCAR.
Expand All @@ -210,6 +215,12 @@ The bold notation of key (such as **Elements**) means that it's a necessary key.
| **md_nstep** | Integer | 10 | Steps of AIMD in stage 3. If it's not equal to settings via `NSW` in `md_incar`, DP-GEN will follow `NSW`.
| **coll_ndata** | Integer | 5000 | Maximal number of collected data.
| type_map | List | [ "Mg", "Al"] | The indices of elements in deepmd formats will be set in this order.
| init_fp_style | String | "ABACUS" or "VASP" | First-principle software. If this key is abscent, the default value will be "VASP".
| relax_kpt | String | "....../KPT" | Path of `KPT` file for relaxation in stage 1. Only useful if `init_fp_style` is "ABACUS".
| relax_kspacing | Integer or List of 3 integers | 10 | kspacing parameter for relaxation in stage 1. Only useful if `init_fp_style` is "ABACUS".
| md_kpt | String | "....../KPT" | Path of `KPT` file for MD simulations in stage 3. Only useful if `init_fp_style` is "ABACUS".
| md_kspacing | Integer or List of 3 integers | 10 | kspacing parameter for MD simulations in stage 3. Only useful if `init_fp_style` is "ABACUS".
| atom_masses | List of float | [24] | List of atomic masses of elements. The order should be the same as `Elements`. Only useful if `init_fp_style` is "ABACUS".

### Init_surf

Expand Down Expand Up @@ -544,20 +555,21 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
| training_iter0_model_path | list of string | ["/path/to/model0_ckpt/", ...] | The model used to init the first iter training. Number of element should be equal to `numb_models` |
| training_init_model | bool | False | 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`. |
| **default_training_param** | Dict | | Training parameters for `deepmd-kit` in `00.train`. <br /> You can find instructions from here: (https://github.com/deepmodeling/deepmd-kit)..<br /> |
| dp_compress | bool | false | Use `dp compress` to compress the model. Default is false. |
| *#Exploration*
| **model_devi_dt** | Float | 0.002 (recommend) | Timestep for MD |
| **model_devi_skip** | Integer | 0 | Number of structures skipped for fp in each MD
| **model_devi_f_trust_lo** | Float | 0.05 | Lower bound of forces for the selection.
| **model_devi_f_trust_hi** | Float | 0.15 | Upper bound of forces for the selection
| **model_devi_v_trust_lo** | Float | 1e10 | Lower bound of virial for the selection. Should be used with DeePMD-kit v2.x |
| **model_devi_v_trust_hi** | Float | 1e10 | Upper bound of virial for the selection. Should be used with DeePMD-kit v2.x |
| **model_devi_f_trust_lo** | Float or List of float | 0.05 | Lower bound of forces for the selection. If List, should be set for each index in `sys_configs`, respectively. |
| **model_devi_f_trust_hi** | Float or List of float | 0.15 | Upper bound of forces for the selection. If List, should be set for each index in `sys_configs`, respectively. |
| **model_devi_v_trust_lo** | Float or List of float | 1e10 | Lower bound of virial for the selection. If List, should be set for each index in `sys_configs`, respectively. Should be used with DeePMD-kit v2.x. |
| **model_devi_v_trust_hi** | Float or List of float | 1e10 | Upper bound of virial for the selection. If List, should be set for each index in `sys_configs`, respectively. Should be used with DeePMD-kit v2.x. |
| model_devi_adapt_trust_lo | Boolean | False | Adaptively determines the lower trust levels of force and virial. This option should be used together with `model_devi_numb_candi_f`, `model_devi_numb_candi_v` and optionally with `model_devi_perc_candi_f` and `model_devi_perc_candi_v`. `dpgen` will make two sets: 1. From the frames with force model deviation lower than `model_devi_f_trust_hi`, select `max(model_devi_numb_candi_f, model_devi_perc_candi_f*n_frames)` frames with largest force model deviation. 2. From the frames with virial model deviation lower than `model_devi_v_trust_hi`, select `max(model_devi_numb_candi_v, model_devi_perc_candi_v*n_frames)` frames with largest virial model deviation. The union of the two sets is made as candidate dataset|
| model_devi_numb_candi_f | Int | 10 | See `model_devi_adapt_trust_lo`.|
| model_devi_numb_candi_v | Int | 0 | See `model_devi_adapt_trust_lo`.|
| model_devi_perc_candi_f | Float | 0.0 | See `model_devi_adapt_trust_lo`.|
| model_devi_perc_candi_v | Float | 0.0 | See `model_devi_adapt_trust_lo`.|
| model_devi_f_avg_relative | Boolean | False | Normalized the force model deviations by the RMS force magnitude along the trajectory. This key should not be used with `use_relative`. |
| **model_devi_clean_traj** | Boolean | true | Deciding whether to clean traj folders in MD since they are too large. |
| **model_devi_clean_traj** | Boolean or Int | true | If type of model_devi_clean_traj is boolean type then it denote whether to clean traj folders in MD since they are too large. If it is Int type, then the most recent n iterations of traj folders will be retained, others will be removed. |
| **model_devi_nopbc** | Boolean | False | Assume open boundary condition in MD simulations. |
| model_devi_activation_func | List of list of string | [["tanh","tanh"],["tanh","gelu"],["gelu","tanh"],["gelu","gelu"]] | Set activation functions for models, length of the List should be the same as `numb_models`, and two elements in the list of string respectively assign activation functions to the embedding and fitting nets within each model. *Backward compatibility*: the orginal "List of String" format is still supported, where embedding and fitting nets of one model use the same activation function, and the length of the List should be the same as `numb_models`|
| **model_devi_jobs** | [<br/>{<br/>"sys_idx": [0], <br/>"temps": <br/>[100],<br/>"press":<br/>[1],<br/>"trj_freq":<br/>10,<br/>"nsteps":<br/> 1000,<br/> "ensembles": <br/> "nvt" <br />},<br />...<br />] | List of dict | Settings for exploration in `01.model_devi`. Each dict in the list corresponds to one iteration. The index of `model_devi_jobs` exactly accord with index of iterations |
Expand Down
6 changes: 6 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ requirements:
- requests
- dpdata
- dpdispatcher
- ase
- GromacsWrapper
- custodian

run:
- python >=3.6
Expand All @@ -34,6 +37,9 @@ requirements:
- dpdata
- dpdispatcher
- pymatgen
- ase
- GromacsWrapper
- custodian

test:
imports:
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# ]

extensions = [
'deepmodeling_sphinx',
"sphinx_rtd_theme",
'myst_parser',
'sphinx.ext.autosummary',
Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ recommonmark==0.7.1
sphinx_rtd_theme==0.5.2
sphinx_markdown_tables==0.0.15
myst-parser==0.13.7
deepmodeling_sphinx
4 changes: 2 additions & 2 deletions dpgen/auto_test/EOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def _compute_lower(self,
# vol = self.vol_start + ii * self.vol_step
vol = loadfn(os.path.join(all_tasks[ii], 'eos.json'))['volume']
task_result = loadfn(all_res[ii])
res_data[vol] = task_result['energies'][-1] / task_result['atom_numbs'][0]
ptr_data += '%7.3f %8.4f \n' % (vol, task_result['energies'][-1] / task_result['atom_numbs'][0])
res_data[vol] = task_result['energies'][-1] / sum(task_result['atom_numbs'])
ptr_data += '%7.3f %8.4f \n' % (vol, task_result['energies'][-1] / sum(task_result['atom_numbs']))
# res_data[vol] = all_res[ii]['energy'] / len(all_res[ii]['force'])
# ptr_data += '%7.3f %8.4f \n' % (vol, all_res[ii]['energy'] / len(all_res[ii]['force']))

Expand Down
4 changes: 2 additions & 2 deletions dpgen/auto_test/VASP.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def make_input_file(self,
incar['ENCUT'] = cal_setting['encut']

if 'kspacing' in cal_setting:
dlog.info("%s setting KSAPCING to %s" % (self.make_input_file.__name__, cal_setting['kspacing']))
incar['KSAPCING'] = cal_setting['kspacing']
dlog.info("%s setting KSPACING to %s" % (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']))
Expand Down
115 changes: 43 additions & 72 deletions dpgen/auto_test/common_equi.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def make_equi(confs,
poscar = os.path.abspath(os.path.join(ii, 'POSCAR'))
if not os.path.exists(poscar):
raise FileNotFoundError('no configuration for autotest')
if os.path.exists(os.path.join(ii, 'relaxation', 'jr.json')):
os.remove(os.path.join(ii, 'relaxation', 'jr.json'))

relax_dirs = os.path.abspath(os.path.join(ii, 'relaxation', 'relax_task')) # to be consistent with property in make dispatcher
create_path(relax_dirs)
task_dirs.append(relax_dirs)
Expand Down Expand Up @@ -111,46 +114,6 @@ def make_equi(confs,
inter.make_input_file(ii, 'relaxation', relax_param)


def worker(work_path,
run_task,
forward_common_files,
forward_files,
backward_files,
mdata,
inter_type):
machine, resources, command, group_size = util.get_machine_info(mdata, inter_type)
disp = make_dispatcher(machine, resources, work_path, [run_task], group_size)
print("%s --> Runing... " % (work_path))

api_version = mdata.get('api_version', '0.9')
if LooseVersion(api_version) < LooseVersion('1.0'):
warnings.warn(f"the dpdispatcher will be updated to new version."
f"And the interface may be changed. Please check the documents for more details")
disp.run_jobs(resources,
command,
work_path,
[run_task],
group_size,
forward_common_files,
forward_files,
backward_files,
outlog='outlog',
errlog='errlog')
elif LooseVersion(api_version) >= LooseVersion('1.0'):
submission = make_submission(
mdata_machine=machine,
mdata_resource=resources,
commands=[command],
work_path=work_path,
run_tasks=run_task,
group_size=group_size,
forward_common_files=forward_common_files,
forward_files=forward_files,
backward_files=backward_files,
outlog='outlog',
errlog='errlog'
)
submission.run_submission()

def run_equi(confs,
inter_param,
Expand All @@ -163,18 +126,16 @@ def run_equi(confs,
conf_dirs.sort()

processes = len(conf_dirs)
pool = Pool(processes=processes)
print("Submit job via %d processes" % processes)

# generate a list of task names like mp-xxx/relaxation/relax_task
# ...
work_path_list = []
for ii in conf_dirs:
work_path_list.append(os.path.abspath(os.path.join(ii, 'relaxation')))
work_path_list.append(os.path.join(ii, 'relaxation'))
all_task = []
for ii in work_path_list:
all_task.append(os.path.join(ii, 'relax_task'))

run_tasks = all_task
inter_type = inter_param['type']
# vasp
if inter_type == "vasp":
Expand All @@ -183,41 +144,51 @@ def run_equi(confs,
mdata = convert_mdata(mdata, ["model_devi"])
else:
raise RuntimeError("unknown task %s, something wrong" % inter_type)

# dispatch the tasks
# POSCAR here is useless
virtual_calculator = make_calculator(inter_param, "POSCAR")
forward_files = virtual_calculator.forward_files()
forward_common_files = virtual_calculator.forward_common_files()
backward_files = virtual_calculator.backward_files()
# backward_files += logs
# ...
run_tasks = util.collect_task(all_task, inter_type)
if len(run_tasks) == 0:
return
else:
run_tasks = [os.path.basename(ii) for ii in all_task]
machine, resources, command, group_size = util.get_machine_info(mdata, inter_type)
print('%d tasks will be submited '%len(run_tasks))
multiple_ret = []
for ii in range(len(work_path_list)):
work_path = work_path_list[ii]

ret = pool.apply_async(worker, (work_path,
run_tasks[ii],
forward_common_files,
forward_files,
backward_files,
mdata,
inter_type,
))
multiple_ret.append(ret)
pool.close()
pool.join()
for ii in range(len(multiple_ret)):
if not multiple_ret[ii].successful():
raise RuntimeError("Task %d is not successful! work_path: %s " % (ii, work_path_list[ii]))
print('finished')
machine, resources, command, group_size = util.get_machine_info(mdata, inter_type)
work_path = os.getcwd()
print("%s --> Runing... " % (work_path))

api_version = mdata.get('api_version', '0.9')
if LooseVersion(api_version) < LooseVersion('1.0'):
warnings.warn(f"the dpdispatcher will be updated to new version."
f"And the interface may be changed. Please check the documents for more details")
disp = make_dispatcher(machine, resources, work_path, run_tasks, group_size)
disp.run_jobs(resources,
command,
work_path,
run_tasks,
group_size,
forward_common_files,
forward_files,
backward_files,
outlog='outlog',
errlog='errlog')
elif LooseVersion(api_version) >= LooseVersion('1.0'):

submission = make_submission(
mdata_machine=machine,
mdata_resources=resources,
commands=[command],
work_path=work_path,
run_tasks=run_tasks,
group_size=group_size,
forward_common_files=forward_common_files,
forward_files=forward_files,
backward_files=backward_files,
outlog='outlog',
errlog='errlog'
)
submission.run_submission()



def post_equi(confs, inter_param):
# find all POSCARs and their name like mp-xxx
Expand Down
5 changes: 3 additions & 2 deletions dpgen/auto_test/common_prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def run_property(confs,
pool.join()
for ii in range(len(multiple_ret)):
if not multiple_ret[ii].successful():
print("ERROR:", multiple_ret[ii].get())
raise RuntimeError("Job %d is not successful!" % ii)
print('%d jobs are finished' % len(multiple_ret))

Expand All @@ -186,11 +187,11 @@ def worker(work_path,
inter_type):
run_tasks = [os.path.basename(ii) for ii in all_task]
machine, resources, command, group_size = util.get_machine_info(mdata, inter_type)
disp = make_dispatcher(machine, resources, work_path, run_tasks, group_size)
api_version = mdata.get('api_version', '0.9')
if LooseVersion(api_version) < LooseVersion('1.0'):
warnings.warn(f"the dpdispatcher will be updated to new version."
f"And the interface may be changed. Please check the documents for more details")
disp = make_dispatcher(machine, resources, work_path, run_tasks, group_size)
disp.run_jobs(resources,
command,
work_path,
Expand All @@ -204,7 +205,7 @@ def worker(work_path,
elif LooseVersion(api_version) >= LooseVersion('1.0'):
submission = make_submission(
mdata_machine=machine,
mdata_resource=resources,
mdata_resources=resources,
commands=[command],
work_path=work_path,
run_tasks=run_tasks,
Expand Down
Loading