Skip to content

Commit 9c8fe94

Browse files
committed
fix(generator): document CALYPSO model deviation args
Add CALYPSO-specific arginfo without accepting list-valued settings that the generator currently cannot consume, and keep the common model-deviation selection keys valid for CALYPSO runs. Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
1 parent 7af5246 commit 9c8fe94

1 file changed

Lines changed: 224 additions & 1 deletion

File tree

dpgen/generator/arginfo.py

Lines changed: 224 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,239 @@ def model_devi_amber_args() -> list[Argument]:
621621
]
622622

623623

624+
def model_devi_calypso_args() -> list[Argument]:
625+
"""CALYPSO engine arguments."""
626+
doc_model_devi_jobs = (
627+
"Settings for CALYPSO structure generation and model deviation. "
628+
"Each dict in the list describes the CALYPSO input used for one or more "
629+
"iterations selected by `times`."
630+
)
631+
doc_times = "List of iteration indices when this CALYPSO job should be executed."
632+
doc_nameofatoms = "Element symbols of the chemical species."
633+
doc_numberofatoms = "Number of atoms for each chemical species in one formula unit."
634+
doc_numberofformula = "Range of formula units per cell as [min, max]."
635+
doc_volume = "Volume per formula unit in angstrom^3. If not provided, CALYPSO determines it automatically."
636+
doc_distanceofion = "Minimal distances between atom types in angstrom. Shape should match the number of species."
637+
doc_psoratio = (
638+
"Proportion of structures generated by the PSO algorithm, between 0.0 and 1.0."
639+
)
640+
doc_popsize = "Population size for structure generation."
641+
doc_maxstep = "Maximum number of CALYPSO optimization steps."
642+
doc_icode = "CALYPSO interface code for local optimization, such as 1 for VASP."
643+
doc_split = "Whether to split calculations. Use 'T' or 'F'."
644+
doc_vsc = "Variable stoichiometry control. Use 'T' to enable or 'F' to disable."
645+
doc_maxnumatom = (
646+
"Maximum number of atoms in the unit cell. Required when VSC is 'T'."
647+
)
648+
doc_ctrlrange = "Variation range for each atom type. Required when VSC is 'T'."
649+
doc_pstress = "Target pressure list in GPa. One CALYPSO input directory is created for each pressure."
650+
doc_fmax = "Force convergence criterion for local optimization, in eV/angstrom."
651+
doc_calypso_input_path = (
652+
"Path to a directory containing pre-existing CALYPSO input.dat files. "
653+
"When set, DP-GEN copies those files instead of generating input.dat from "
654+
"the CALYPSO fields in model_devi_jobs."
655+
)
656+
doc_model_devi_max_iter = "Maximum iteration index when using calypso_input_path."
657+
doc_vsc_mode = (
658+
"Enable variable stoichiometry mode when using external CALYPSO input files."
659+
)
660+
doc_model_devi_dt = (
661+
"Timestep retained for compatibility with existing CALYPSO parameter files."
662+
)
663+
doc_model_devi_skip = (
664+
"Number of structures skipped during model deviation selection."
665+
)
666+
doc_model_devi_f_trust_lo = "Lower bound of force model deviation for selection."
667+
doc_model_devi_f_trust_hi = "Upper bound of force model deviation for selection."
668+
doc_model_devi_v_trust_lo = "Lower bound of virial model deviation for selection."
669+
doc_model_devi_v_trust_hi = "Upper bound of virial model deviation for selection."
670+
doc_model_devi_e_trust_lo = "Lower bound of energy model deviation for selection."
671+
doc_model_devi_e_trust_hi = "Upper bound of energy model deviation for selection."
672+
doc_model_devi_clean_traj = (
673+
"Whether to clean large trajectory folders after model deviation."
674+
)
675+
doc_model_devi_adapt_trust_lo = (
676+
"Adaptively determine the lower force and virial trust levels."
677+
)
678+
doc_model_devi_numb_candi_f = "See model_devi_adapt_trust_lo."
679+
doc_model_devi_numb_candi_v = "See model_devi_adapt_trust_lo."
680+
doc_model_devi_perc_candi_f = "See model_devi_adapt_trust_lo."
681+
doc_model_devi_perc_candi_v = "See model_devi_adapt_trust_lo."
682+
doc_model_devi_f_avg_relative = (
683+
"Normalize force model deviations by the RMS force magnitude."
684+
)
685+
doc_use_relative = "Calculate relative force model deviation."
686+
doc_epsilon = "Level parameter for computing the relative force model deviation."
687+
doc_use_relative_v = "Calculate relative virial model deviation."
688+
doc_epsilon_v = "Level parameter for computing the relative virial model deviation."
689+
690+
return [
691+
Argument(
692+
"model_devi_jobs",
693+
list,
694+
optional=False,
695+
repeat=True,
696+
doc=doc_model_devi_jobs,
697+
sub_fields=[
698+
Argument("times", list[int], optional=False, doc=doc_times),
699+
Argument("NameOfAtoms", list[str], optional=False, doc=doc_nameofatoms),
700+
Argument(
701+
"NumberOfAtoms", list[int], optional=False, doc=doc_numberofatoms
702+
),
703+
Argument(
704+
"NumberOfFormula",
705+
list[int],
706+
optional=True,
707+
default=[1, 1],
708+
doc=doc_numberofformula,
709+
),
710+
Argument("Volume", float, optional=True, doc=doc_volume),
711+
Argument(
712+
"DistanceOfIon",
713+
list[list[float]],
714+
optional=False,
715+
doc=doc_distanceofion,
716+
),
717+
Argument(
718+
"PsoRatio",
719+
float,
720+
optional=True,
721+
default=0.6,
722+
doc=doc_psoratio,
723+
),
724+
Argument("PopSize", int, optional=True, default=30, doc=doc_popsize),
725+
Argument("MaxStep", int, optional=True, default=5, doc=doc_maxstep),
726+
Argument("ICode", int, optional=True, default=1, doc=doc_icode),
727+
Argument("Split", str, optional=True, default="T", doc=doc_split),
728+
Argument("VSC", str, optional=True, default="F", doc=doc_vsc),
729+
Argument("MaxNumAtom", int, optional=True, doc=doc_maxnumatom),
730+
Argument(
731+
"CtrlRange", list[list[int]], optional=True, doc=doc_ctrlrange
732+
),
733+
Argument(
734+
"PSTRESS",
735+
list[float],
736+
optional=True,
737+
default=[0.001],
738+
doc=doc_pstress,
739+
),
740+
Argument("fmax", float, optional=True, default=0.01, doc=doc_fmax),
741+
],
742+
),
743+
Argument("calypso_input_path", str, optional=True, doc=doc_calypso_input_path),
744+
Argument(
745+
"model_devi_max_iter", int, optional=True, doc=doc_model_devi_max_iter
746+
),
747+
Argument("vsc", bool, optional=True, default=False, doc=doc_vsc_mode),
748+
Argument("model_devi_dt", float, optional=True, doc=doc_model_devi_dt),
749+
Argument("model_devi_skip", int, optional=False, doc=doc_model_devi_skip),
750+
Argument(
751+
"model_devi_f_trust_lo",
752+
[float, list[float], dict],
753+
optional=False,
754+
doc=doc_model_devi_f_trust_lo,
755+
),
756+
Argument(
757+
"model_devi_f_trust_hi",
758+
[float, list[float], dict],
759+
optional=False,
760+
doc=doc_model_devi_f_trust_hi,
761+
),
762+
Argument(
763+
"model_devi_v_trust_lo",
764+
[float, list[float], dict],
765+
optional=True,
766+
default=1e10,
767+
doc=doc_model_devi_v_trust_lo,
768+
),
769+
Argument(
770+
"model_devi_v_trust_hi",
771+
[float, list[float], dict],
772+
optional=True,
773+
default=1e10,
774+
doc=doc_model_devi_v_trust_hi,
775+
),
776+
Argument(
777+
"model_devi_e_trust_lo",
778+
[float, list[float], dict],
779+
optional=True,
780+
default=1e10,
781+
doc=doc_model_devi_e_trust_lo,
782+
),
783+
Argument(
784+
"model_devi_e_trust_hi",
785+
[float, list[float], dict],
786+
optional=True,
787+
default=1e10,
788+
doc=doc_model_devi_e_trust_hi,
789+
),
790+
Argument(
791+
"model_devi_adapt_trust_lo",
792+
bool,
793+
optional=True,
794+
doc=doc_model_devi_adapt_trust_lo,
795+
),
796+
Argument(
797+
"model_devi_numb_candi_f",
798+
int,
799+
optional=True,
800+
doc=doc_model_devi_numb_candi_f,
801+
),
802+
Argument(
803+
"model_devi_numb_candi_v",
804+
int,
805+
optional=True,
806+
doc=doc_model_devi_numb_candi_v,
807+
),
808+
Argument(
809+
"model_devi_perc_candi_f",
810+
float,
811+
optional=True,
812+
doc=doc_model_devi_perc_candi_f,
813+
),
814+
Argument(
815+
"model_devi_perc_candi_v",
816+
float,
817+
optional=True,
818+
doc=doc_model_devi_perc_candi_v,
819+
),
820+
Argument(
821+
"model_devi_f_avg_relative",
822+
bool,
823+
optional=True,
824+
doc=doc_model_devi_f_avg_relative,
825+
),
826+
Argument(
827+
"model_devi_clean_traj",
828+
[bool, int],
829+
optional=True,
830+
default=True,
831+
doc=doc_model_devi_clean_traj,
832+
),
833+
Argument(
834+
"use_relative", bool, optional=True, default=False, doc=doc_use_relative
835+
),
836+
Argument("epsilon", float, optional=True, doc=doc_epsilon),
837+
Argument(
838+
"use_relative_v", bool, optional=True, default=False, doc=doc_use_relative_v
839+
),
840+
Argument("epsilon_v", float, optional=True, doc=doc_epsilon_v),
841+
]
842+
843+
624844
def model_devi_args() -> list[Variant]:
625845
doc_model_devi_engine = "Engine for the model deviation task."
626846
doc_amber = "Amber DPRc engine. The command argument in the machine file should be path to sander."
847+
doc_calypso = (
848+
"CALYPSO structure generation engine for crystal structure prediction."
849+
)
627850
return [
628851
Variant(
629852
"model_devi_engine",
630853
[
631854
Argument("lammps", dict, model_devi_lmp_args(), doc="LAMMPS"),
632855
Argument("amber", dict, model_devi_amber_args(), doc=doc_amber),
633-
Argument("calypso", dict, [], doc="TODO: add doc"),
856+
Argument("calypso", dict, model_devi_calypso_args(), doc=doc_calypso),
634857
Argument("gromacs", dict, [], doc="TODO: add doc"),
635858
],
636859
default_tag="lammps",

0 commit comments

Comments
 (0)