Skip to content

Commit

Permalink
feat: add args
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzyphysics committed May 31, 2024
1 parent a13fe8a commit 3d0fba5
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 3 deletions.
88 changes: 86 additions & 2 deletions dpgen2/entrypoint/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,100 @@ def lmp_args():
]


def run_expl_caly_conf_args():
doc_caly_model_devi_group_size = "group size for model deviation."
doc_run_calypso_command = "command of running calypso."
doc_caly_run_dp_opt_command = "command of running optimization with dp."
return [
Argument(
"model_devi_group_size",
int,
optional=True,
doc=doc_caly_model_devi_group_size,
),
Argument(
"run_calypso_command",
str,
optional=True,
default="calypso.x",
doc=doc_run_calypso_command,
),
Argument(
"run_opt_command",
str,
optional=True,
doc=doc_caly_run_dp_opt_command,
),
]


def caly_args():
doc_config = "Configuration of calypso exploration"
doc_max_numb_iter = "Maximum number of iterations per stage"
doc_fatal_at_max = (
"Fatal when the number of iteration per stage reaches the `max_numb_iter`"
)
doc_output_nopbc = "Remove pbc of the output configurations"
doc_convergence = "The method of convergence check."
doc_configuration = "A list of initial configurations."
doc_stages = (
"The definition of exploration stages of type `List[List[ExplorationTaskGroup]`. "
"The outer list provides the enumeration of the exploration stages. "
"Then each stage is defined by a list of exploration task groups. "
"Each task group is described in :ref:`the task group definition<task_group_sec>` "
)

return [
Argument(
"config",
dict,
run_expl_caly_conf_args(),
optional=True,
default=RunLmp.normalize_config({}),
doc=doc_config,
),
Argument(
"max_numb_iter", int, optional=True, default=10, doc=doc_max_numb_iter
),
Argument(
"fatal_at_max", bool, optional=True, default=True, doc=doc_fatal_at_max
),
Argument(
"output_nopbc", bool, optional=True, default=False, doc=doc_output_nopbc
),
Argument(
"convergence",
dict,
[],
[variant_conv()],
optional=False,
doc=doc_convergence,
),
Argument(
"configurations",
list,
[],
[variant_conf()],
optional=False,
repeat=True,
doc=doc_configuration,
alias=["configuration"],
),
Argument("stages", List[List[dict]], optional=False, doc=doc_stages),
]


def variant_explore():
# TODO: add calypso_args
doc = "The type of the exploration"
doc_lmp = "The exploration by LAMMPS simulations"
doc_calypso = "The exploration by CALYPSO structure prediction"
return Variant(
"type",
[
Argument("lmp", dict, lmp_args(), doc=doc_lmp),
Argument("calypso", dict, lmp_args(), doc=doc_calypso),
Argument("calypso", dict, caly_args(), doc=doc_calypso),
Argument("calypso:default", dict, caly_args(), doc=doc_calypso),
Argument("calypso:merge", dict, caly_args(), doc=doc_calypso),
],
doc=doc,
)
Expand Down
2 changes: 1 addition & 1 deletion dpgen2/op/run_caly_dp_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def execute(

config = ip["config"] if ip["config"] is not None else {}
command = config.get(
f"run_opt_command", "python -u calypso_run_opt.py {model_name}"
"run_opt_command", "python -u calypso_run_opt.py model.ckpt.pt"
)

work_dir = Path(ip["task_name"])
Expand Down

0 comments on commit 3d0fba5

Please sign in to comment.