Skip to content

model_devi_clean_traj support int type #583

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

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
| 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
17 changes: 13 additions & 4 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2840,15 +2840,24 @@ def post_fp (iter_index,
else :
raise RuntimeError ("unsupported fp style")
# clean traj
iter_name = make_iter_name(iter_index)
clean_traj = True
if 'model_devi_clean_traj' in jdata :
clean_traj = jdata['model_devi_clean_traj']
if clean_traj:
modd_path = os.path.join(iter_name, model_devi_name)
modd_path = None
if isinstance(clean_traj, bool):
iter_name = make_iter_name(iter_index)
if clean_traj:
modd_path = os.path.join(iter_name, model_devi_name)
elif isinstance(clean_traj, int):
clean_index = iter_index - clean_traj
if clean_index >= 0:
modd_path = os.path.join(make_iter_name(clean_index), model_devi_name)
if modd_path is not None:
md_trajs = glob.glob(os.path.join(modd_path, 'task*/traj'))
for ii in md_trajs :
for ii in md_trajs:
shutil.rmtree(ii)



def set_version(mdata):

Expand Down