Skip to content

Commit

Permalink
expand init data system if it is a str (#55)
Browse files Browse the repository at this point in the history
Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
  • Loading branch information
wanghan-iapcm and Han Wang committed Jul 17, 2022
1 parent 42de137 commit 12a0fcb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dpgen2/entrypoint/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
}
)

def expand_sys_str(root_dir: Union[str, Path]) -> List[str]:
root_dir = Path(root_dir)
matches = [str(d) for d in root_dir.rglob("*") if (d / "type.raw").is_file()]
if (root_dir / "type.raw").is_file():
matches.append(str(root_dir))
return matches

def make_concurrent_learning_op (
train_style : str = 'dp',
explore_style : str = 'lmp',
Expand Down Expand Up @@ -329,7 +336,10 @@ def workflow_concurrent_learning(
)
fp_arti = upload_artifact(
dump_object_to_file(fp_inputs, 'vasp_inputs.dat'))
init_data = upload_artifact(config['init_data_sys'])
init_data = config['init_data_sys']
if isinstance(init_data,str):
init_data = expand_sys_str(init_data)
init_data = upload_artifact(init_data)
iter_data = upload_artifact([])
if init_models_paths is not None:
init_models = upload_artifact(init_models_paths)
Expand Down

0 comments on commit 12a0fcb

Please sign in to comment.