Skip to content

Commit 33cf245

Browse files
Cloudac7amcadmusfelix5572shazj99Zhengju Sha
authored
Adapt different trust level for different sys_configs (#609)
* fix typo in github actions release to conda * Get from_poscar_path only when from_poscar is true (#537) Change-Id: I17774bee345634e4e72bd783e8112eefaaf9f0d3 Co-authored-by: Zhengju Sha <jenny@bytedance.com> * adapt different trust level for different sys_configs Co-authored-by: Han Wang <amcadmus@gmail.com> Co-authored-by: felix5572 <felix5572@github.com> Co-authored-by: shazj99 <shazj99@gmail.com> Co-authored-by: Zhengju Sha <jenny@bytedance.com>
1 parent 43d1a0d commit 33cf245

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
549549
| *#Exploration*
550550
| **model_devi_dt** | Float | 0.002 (recommend) | Timestep for MD |
551551
| **model_devi_skip** | Integer | 0 | Number of structures skipped for fp in each MD
552-
| **model_devi_f_trust_lo** | Float | 0.05 | Lower bound of forces for the selection.
553-
| **model_devi_f_trust_hi** | Float | 0.15 | Upper bound of forces for the selection
554-
| **model_devi_v_trust_lo** | Float | 1e10 | Lower bound of virial for the selection. Should be used with DeePMD-kit v2.x |
555-
| **model_devi_v_trust_hi** | Float | 1e10 | Upper bound of virial for the selection. Should be used with DeePMD-kit v2.x |
552+
| **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. |
553+
| **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. |
554+
| **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. |
555+
| **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. |
556556
| 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|
557557
| model_devi_numb_candi_f | Int | 10 | See `model_devi_adapt_trust_lo`.|
558558
| model_devi_numb_candi_v | Int | 0 | See `model_devi_adapt_trust_lo`.|

dpgen/generator/run.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,18 +1593,32 @@ def _make_fp_vasp_inner (modd_path,
15931593
skip_bad_box = jdata.get('fp_skip_bad_box')
15941594
# skip discrete structure in cluster
15951595
fp_cluster_vacuum = jdata.get('fp_cluster_vacuum',None)
1596-
for ss in system_index :
1596+
1597+
def _trust_limitation_check(sys_idx, lim):
1598+
if isinstance(lim, list):
1599+
sys_lim = lim[sys_idx]
1600+
else:
1601+
sys_lim = lim
1602+
return sys_lim
1603+
1604+
for ss in system_index:
15971605
modd_system_glob = os.path.join(modd_path, 'task.' + ss + '.*')
15981606
modd_system_task = glob.glob(modd_system_glob)
15991607
modd_system_task.sort()
16001608

1609+
# convert global trust limitations to local ones
1610+
f_trust_lo_sys = _trust_limitation_check(ss, f_trust_lo)
1611+
f_trust_hi_sys = _trust_limitation_check(ss, f_trust_hi)
1612+
v_trust_lo_sys = _trust_limitation_check(ss, v_trust_lo)
1613+
v_trust_hi_sys = _trust_limitation_check(ss, v_trust_hi)
1614+
16011615
# assumed e -> v
16021616
if not model_devi_adapt_trust_lo:
16031617
fp_rest_accurate, fp_candidate, fp_rest_failed, counter \
16041618
= _select_by_model_devi_standard(
16051619
modd_system_task,
1606-
f_trust_lo, f_trust_hi,
1607-
v_trust_lo, v_trust_hi,
1620+
f_trust_lo_sys, f_trust_hi_sys,
1621+
v_trust_lo_sys, v_trust_hi_sys,
16081622
cluster_cutoff,
16091623
model_devi_skip,
16101624
model_devi_f_avg_relative = model_devi_f_avg_relative,
@@ -1618,8 +1632,8 @@ def _make_fp_vasp_inner (modd_path,
16181632
fp_rest_accurate, fp_candidate, fp_rest_failed, counter, f_trust_lo_ad, v_trust_lo_ad \
16191633
= _select_by_model_devi_adaptive_trust_low(
16201634
modd_system_task,
1621-
f_trust_hi, numb_candi_f, perc_candi_f,
1622-
v_trust_hi, numb_candi_v, perc_candi_v,
1635+
f_trust_hi_sys, numb_candi_f, perc_candi_f,
1636+
v_trust_hi_sys, numb_candi_v, perc_candi_v,
16231637
model_devi_skip = model_devi_skip,
16241638
model_devi_f_avg_relative = model_devi_f_avg_relative,
16251639
)

0 commit comments

Comments
 (0)