Skip to content

Commit

Permalink
make more examples pass argument tests (#870)
Browse files Browse the repository at this point in the history
* make more examples pass argument tests

* fix kspace
  • Loading branch information
njzjz authored Aug 17, 2022
1 parent 0a197f2 commit d55d400
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 27 deletions.
22 changes: 13 additions & 9 deletions dpgen/generator/arginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def data_args() -> List[Argument]:
Argument("init_data_sys", list,
optional=False, doc=doc_init_data_sys),
Argument("sys_format", str, optional=True, default='vasp/poscar', doc=doc_sys_format),
Argument("init_batch_size", str, optional=True,
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),
Expand Down Expand Up @@ -105,7 +105,7 @@ def model_devi_jobs_args() -> List[Argument]:
# this may be not correct
doc_sys_idx = 'Systems to be selected as the initial structure of MD and be explored. The index corresponds exactly to the sys_configs.'
doc_temps = 'Temperature (K) in MD.'
doc_press = 'Pressure (Bar) in MD.'
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.'
doc_ensemble = 'Determining which ensemble used in MD, options include “npt” and “nvt”.'
Expand All @@ -120,7 +120,7 @@ def model_devi_jobs_args() -> List[Argument]:
args = [
Argument("sys_idx", list, optional=False, doc=doc_sys_idx),
Argument("temps", list, optional=False, doc=doc_temps),
Argument("press", list, optional=False, doc=doc_press),
Argument("press", list, optional=True, doc=doc_press),
Argument("trj_freq", int, optional=False, doc=doc_trj_freq),
Argument("nsteps", int, optional=False, doc=doc_nsteps),
Argument("ensemble", str, optional=False, doc=doc_ensemble),
Expand Down Expand Up @@ -285,9 +285,9 @@ def fp_style_gaussian_args() -> List[Argument]:
Argument("multiplicity", [int, str],
optional=True, default="auto", doc=doc_multiplicity),
Argument("nproc", int, optional=False, doc=doc_nproc),
Argument("charge", int, optional=True, default=0, doc=doc_nproc),
Argument("charge", int, optional=True, default=0, doc=doc_charge),
Argument("fragment_guesses", bool, optional=True, default=False, doc=doc_fragment_guesses),
Argument("basis_set", str, optional=True, doc=doc_fragment_guesses),
Argument("basis_set", str, optional=True, doc=doc_basis_set),
Argument("keywords_high_multiplicity", str, optional=True, doc=doc_keywords_high_multiplicity),
]

Expand Down Expand Up @@ -321,12 +321,14 @@ def fp_style_siesta_args() -> List[Argument]:
doc_kspacing = 'Sample factor in Brillouin zones.'
doc_mixingweight = 'Proportion a of output Density Matrix to be used for the input Density Matrix of next SCF cycle (linear mixing).'
doc_NumberPulay = 'Controls the Pulay convergence accelerator.'
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.'

args = [
Argument("ecut", int, optional=False, doc=doc_ecut),
Argument("ediff", float, optional=False, doc=doc_ediff),
Argument("kspacing", float, optional=False, doc=doc_kspacing),
Argument("mixingweight", float, optional=False, doc=doc_mixingweight),
Argument("mixingWeight", float, optional=False, doc=doc_mixingweight),
Argument("NumberPulay", int, optional=False, doc=doc_NumberPulay),
]

Expand All @@ -335,11 +337,13 @@ def fp_style_siesta_args() -> List[Argument]:
doc_fp_params_siesta = 'Parameters for siesta calculation.'

return [
Argument("use_clusters", bool, optional=False, doc=doc_use_clusters),
Argument("use_clusters", bool, optional=True, doc=doc_use_clusters),
Argument("cluster_cutoff", float,
optional=False, doc=doc_cluster_cutoff),
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),
]

# cp2k
Expand All @@ -352,7 +356,7 @@ def fp_style_cp2k_args() -> List[Argument]:

return [
Argument("user_fp_params", dict, optional=True,
doc=doc_user_fp_params),
doc=doc_user_fp_params, alias=["fp_params"]),
Argument("external_input_path", str, optional=True,
doc=doc_external_input_path),
Argument("ratio_failed", float, optional=True,
Expand Down
2 changes: 0 additions & 2 deletions examples/run/deprecated/dp0.12-lammps-cp2k/CH4/param_CH4.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
"shuffle_poscar": false,
"fp_task_max": 20,
"fp_task_min": 5,
"fp_pp_path": ".",
"fp_pp_files": [],
"fp_params": {
"cutoff": "400",
"rel_cutoff": "50",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
],
"_comment": " that's all ",
"numb_models": 4,
"train_param": "input.json",
"default_training_param": {
"_comment": "that's all",
"use_smooth": true,
Expand Down Expand Up @@ -126,7 +125,7 @@
"fp_params": {
"ecut": 300,
"ediff": 1e-4,
"kspacing": 1,
"kspacing": 1.0,
"mixingWeight": 0.05,
"NumberPulay": 5,
"_comment": " that's all "
Expand Down
3 changes: 0 additions & 3 deletions examples/run/dp1.x-lammps-cp2k/methane/param-ch4.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
],
"_comment": " that's all ",
"numb_models": 4,
"train_param": "input.json",
"default_training_param": {
"model": {
"descriptor": {
Expand Down Expand Up @@ -131,7 +130,5 @@
"shuffle_poscar": false,
"fp_task_max": 20,
"fp_task_min": 5,
"fp_pp_path": ".",
"fp_pp_files": [],
"external_input_path": "/data/ybzhuang/methane-dpgen/dpgen-tutorial-2020-08-23/dpgen-tutorial-mathane/cp2k_dpgen/template.inp"
}
3 changes: 0 additions & 3 deletions examples/run/dp1.x_lammps_gaussian/dodecane/dodecane.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"mass_map": [12.011, 1.008],
"init_data_prefix": "/home/jzzeng/0719dodecane/gen/",
"init_data_sys": ["init_data"],
"init_multi_systems": true,
"sys_configs": [
["/home/jzzeng/0719dodecane/gen/data.dodecane.atomic"]
],
Expand Down Expand Up @@ -77,8 +76,6 @@
"shuffle_poscar": false,
"fp_task_max": 1000,
"fp_task_min": 10,
"fp_pp_path": "/home/jzzeng/",
"fp_pp_files": [],
"fp_params": {
"keywords": "force mn15/6-31g**",
"nproc": 4,
Expand Down
16 changes: 8 additions & 8 deletions tests/test_check_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
(run_jdata, p_examples / "run" / "dp1.x-lammps-vasp-et" / "param_elet.json"),
(run_jdata, p_examples / "run" / "dp2.x-lammps-ABACUS-lcao" / "fcc-al" / "run_param.json"),
(run_jdata, p_examples / "run" / "dp2.x-lammps-ABACUS-pw" / "fcc-al" / "run_param.json"),
#(run_jdata, p_examples / "run" / "dp1.x-lammps-cp2k" / "methane" / "param-ch4.json"),
#(run_jdata, p_examples / "run" / "dp1.x-lammps-ABACUS-pw" / "methane" / "param.json"),
#(run_jdata, p_examples / "run" / "dp1.x-lammps-ABACUS-lcao-dpks" / "methane" / "param.json"),
#(run_jdata, p_examples / "run" / "dp1.x_lammps_gaussian" / "dodecane" / "dodecane.json"),
(run_jdata, p_examples / "run" / "dp1.x-lammps-cp2k" / "methane" / "param-ch4.json"),
(run_jdata, p_examples / "run" / "dp1.x-lammps-ABACUS-pw" / "methane" / "param.json"),
(run_jdata, p_examples / "run" / "dp1.x-lammps-ABACUS-lcao-dpks" / "methane" / "param.json"),
(run_jdata, p_examples / "run" / "dp1.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"),
#(run_jdata, p_examples / "run" / "deprecated" / "param-mg-vasp-ucloud.json"),
#(run_jdata, p_examples / "run" / "deprecated" / "param-pyridine-pwscf.json"),
#(run_jdata, p_examples / "run" / "deprecated" / "param-h2oscan-vasp.json"),
#(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-cp2k" / "CH4" / "param_CH4.json"),
(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-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" / "dp0.12-lammps-siesta" / "dp-lammps-siesta" / "CH4" / "param_CH4.json"),
#(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-vasp" / "Al" / "param_al_all_gpu.json"),
#(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-vasp" / "CH4" / "param_CH4.json"),
(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-siesta" / "dp-lammps-siesta" / "CH4" / "param_CH4.json"),
(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-vasp" / "Al" / "param_al_all_gpu.json"),
(run_jdata, p_examples / "run" / "deprecated" / "dp0.12-lammps-vasp" / "CH4" / "param_CH4.json"),
# machines
#(run_mdata, p_examples / "machine" / "DeePMD-kit-2.x" / "lebesgue_v2_machine.json"),
#(run_mdata, p_examples / "machine" / "DeePMD-kit-1.x" / "machine-ali.json"),
Expand Down

0 comments on commit d55d400

Please sign in to comment.