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

add simplify example of MAPbI3-scan based on lebesgue #840

Merged
merged 12 commits into from
Aug 14, 2022
Merged
6 changes: 6 additions & 0 deletions dpgen/generator/arginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def fp_style_vasp_args() -> List[Argument]:
doc_fp_incar = 'Input file for VASP. INCAR must specify KSPACING and KGAMMA.'
doc_fp_aniso_kspacing = 'Set anisotropic kspacing. Usually useful for 1-D or 2-D materials. Only support VASP. If it is setting the KSPACING key in INCAR will be ignored.'
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'

return [
Argument("fp_pp_path", str, optional=False, doc=doc_fp_pp_path),
Expand All @@ -226,6 +228,10 @@ def fp_style_vasp_args() -> List[Argument]:
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),
]

# abacus
Expand Down
8 changes: 8 additions & 0 deletions dpgen/simplify/arginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def general_simplify_arginfo() -> Argument:
doc_iter_pick_number = "The number of pick data in each iteration."
doc_model_devi_f_trust_lo = "The lower bound of forces for the selection for the model deviation."
doc_model_devi_f_trust_hi = "The higher bound of forces for the selection for the model deviation."
doc_shuffle_poscar = 'Shuffle atoms of each frame before running simulations. The purpose is to sample the element occupation of alloys.'
HuangJiameng marked this conversation as resolved.
Show resolved Hide resolved

return [
Argument("labeled", bool, optional=True, default=False, doc=doc_labeled),
Expand All @@ -33,6 +34,7 @@ def general_simplify_arginfo() -> Argument:
Argument("iter_pick_number", int, doc=doc_iter_pick_number),
Argument("model_devi_f_trust_lo", float, optional=False, doc=doc_model_devi_f_trust_lo),
Argument("model_devi_f_trust_hi", float, optional=False, doc=doc_model_devi_f_trust_hi),
Argument("shuffle_poscar", bool, optional=True, default=False, doc=doc_shuffle_poscar),
]


Expand Down Expand Up @@ -71,10 +73,16 @@ def fp_args() -> List[Argument]:
"""
doc_fp_task_max = 'Maximum of structures to be calculated in 02.fp of each iteration.'
doc_fp_task_min = 'Minimum of structures to be calculated in 02.fp of each iteration.'
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.'

return [
Argument("fp_task_max", int, optional=True, doc=doc_fp_task_max),
Argument("fp_task_min", int, optional=True, doc=doc_fp_task_min),
Argument("fp_accurate_threshold", float,
optional=True, doc=doc_fp_accurate_threshold),
Argument("fp_accurate_soft_threshold", float,
optional=True, doc=doc_fp_accurate_soft_threshold),
]


Expand Down
7 changes: 7 additions & 0 deletions examples/simplify-MAPbI3-scan-lebesgue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is an example for `dpgen simplify`. `data` contains a simplistic data set based on MAPbI3-scan case. Since it has been greatly reduced, do not take it seriously. It is just a demo.
`simplify_example` is the work path, which contains `INCAR` and templates for `simplify.json` and `machine.json`. You can use the command `nohup dpgen simplify simplify.json machine.json 1>log 2>err &` here to test if `dpgen simplify` can run normally.

Kindly reminder:
1. `machine.json` is supported by `dpdispatcher 0.4.15`, please check https://docs.deepmodeling.com/projects/dpdispatcher/en/latest/ to update the parameters according to your `dpdispatcher` version.
2. `POTCAR` should be prepared by the user.
3. Please check the path and files name and make sure they are correct.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
48 changes: 48 additions & 0 deletions examples/simplify-MAPbI3-scan-lebesgue/data/sys.000/type.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
2
2
2
2
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
I
Pb
C
N
H
38 changes: 38 additions & 0 deletions examples/simplify-MAPbI3-scan-lebesgue/simplify_example/INCAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#Parameters
SYSTEM = dpgen_rlx
PREC = A
ISTART = 0
ICHARG = 2
IWAVPR = 11
#Electronic Relaxation
ENCUT = 500
NELM = 100
NELMIN = 6
NELMDL = -5
EDIFF = 1e-06
LREAL = .False.
ALGO = Normal
# GGA = PE
METAGGA = SCAN
#Ionic Relaxation
IBRION = 2
POTIM = 0.2
ISIF = 3
EDIFFG = -0.005
ISYM = 0
NSW = 0
ISMEAR = 0
SIGMA = 0.1
#vdW correction
# IVDW = 12 #D3-BJ
# Write flags
LWAVE = .False.
LCHARG = .False.

KSPACING = 0.16
KGAMMA = .TRUE.
#KPAR = 1
NPAR = 2

PSTRESS = 0.0
# NCORE = 4
112 changes: 112 additions & 0 deletions examples/simplify-MAPbI3-scan-lebesgue/simplify_example/machine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"api_version": "1.0",
"_comment": "dependent on dpdispatcher 0.4.15",
"train" :[
{
"command": "dp",
"machine": {
"batch_type": "Lebesgue",
"context_type": "LebesgueContext",
"local_root" : "./",
"remote_profile":{
"email": "",
"password": "",
"program_id": ,
"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": {
"number_node": 15,
"cpu_per_node": 4,
"gpu_per_node": 1,
"queue_name": "V100_8_32",
"group_size": 1
}
}],
"model_devi":
[{
"command": "dp",
"machine": {
"batch_type": "Lebesgue",
"context_type": "LebesgueContext",
"local_root" : "./",
"remote_profile":{
"email": "",
"password": "",
"program_id": ,
"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": {
"number_node": 15,
"cpu_per_node": 4,
"gpu_per_node": 1,
"queue_name": "V100_8_32",
"group_size": 10
}
}],
"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": ,
"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": {
"number_node": 15,
"cpu_per_node": 32,
"gpu_per_node": 0,
"queue_name": "CPU",
"group_size": 10,
"source_list": ["/opt/intel/oneapi/setvars.sh"]
}
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
HuangJiameng marked this conversation as resolved.
Show resolved Hide resolved
"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":
[
20,
8,
8,
8,
48
],
"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
},
"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.95,
"fp_accurate_soft_threshold": 0.90,
"shuffle_poscar": false,
"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
}
1 change: 1 addition & 0 deletions tests/test_check_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
input_files = (
(init_reaction_jdata, p_examples / "init" / "reaction.json"),
(simplify_jdata, p_examples / "simplify" / "qm7.json"),
(simplify_jdata, p_examples / "simplify-MAPbI3-scan-lebesgue" / "simplify_example" / "simplify.json"),
(run_jdata, p_examples / "run" / "dp2.x-lammps-vasp" / "param_CH4_deepmd-kit-2.0.1.json"),
#(run_jdata, p_examples / "run" / "dp2.x-gromacs-gaussian" / "param.json"),
(run_jdata, p_examples / "run" / "dp1.x-lammps-vasp" / "CH4" / "param_CH4_deepmd-kit-1.1.0.json"),
Expand Down