@@ -621,6 +621,11 @@ def model_devi_amber_args() -> list[Argument]:
621621 ]
622622
623623
624+ def _is_scalar_or_singleton (value ) -> bool :
625+ """Accept legacy one-item lists while rejecting ambiguous CALYPSO values."""
626+ return not isinstance (value , list ) or len (value ) == 1
627+
628+
624629def model_devi_calypso_args () -> list [Argument ]:
625630 """CALYPSO engine arguments."""
626631 doc_model_devi_jobs = (
@@ -707,7 +712,14 @@ def model_devi_calypso_args() -> list[Argument]:
707712 default = [1 , 1 ],
708713 doc = doc_numberofformula ,
709714 ),
710- Argument ("Volume" , float , optional = True , doc = doc_volume ),
715+ Argument (
716+ "Volume" ,
717+ [float , int , list [float ], list [int ]],
718+ optional = True ,
719+ extra_check = _is_scalar_or_singleton ,
720+ extra_check_errmsg = "Volume must be a scalar or a one-item list." ,
721+ doc = doc_volume ,
722+ ),
711723 Argument (
712724 "DistanceOfIon" ,
713725 list [list [float ]],
@@ -716,17 +728,50 @@ def model_devi_calypso_args() -> list[Argument]:
716728 ),
717729 Argument (
718730 "PsoRatio" ,
719- float ,
731+ [ float , int , list [ float ], list [ int ]] ,
720732 optional = True ,
721733 default = 0.6 ,
734+ extra_check = _is_scalar_or_singleton ,
735+ extra_check_errmsg = "PsoRatio must be a scalar or a one-item list." ,
722736 doc = doc_psoratio ,
723737 ),
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 ),
738+ Argument (
739+ "PopSize" ,
740+ [int , list [int ]],
741+ optional = True ,
742+ default = 30 ,
743+ extra_check = _is_scalar_or_singleton ,
744+ extra_check_errmsg = "PopSize must be an integer or a one-item list." ,
745+ doc = doc_popsize ,
746+ ),
747+ Argument (
748+ "MaxStep" ,
749+ [int , list [int ]],
750+ optional = True ,
751+ default = 5 ,
752+ extra_check = _is_scalar_or_singleton ,
753+ extra_check_errmsg = "MaxStep must be an integer or a one-item list." ,
754+ doc = doc_maxstep ,
755+ ),
756+ Argument (
757+ "ICode" ,
758+ [int , list [int ]],
759+ optional = True ,
760+ default = 1 ,
761+ extra_check = _is_scalar_or_singleton ,
762+ extra_check_errmsg = "ICode must be an integer or a one-item list." ,
763+ doc = doc_icode ,
764+ ),
727765 Argument ("Split" , str , optional = True , default = "T" , doc = doc_split ),
728766 Argument ("VSC" , str , optional = True , default = "F" , doc = doc_vsc ),
729- Argument ("MaxNumAtom" , int , optional = True , doc = doc_maxnumatom ),
767+ Argument (
768+ "MaxNumAtom" ,
769+ [int , list [int ]],
770+ optional = True ,
771+ extra_check = _is_scalar_or_singleton ,
772+ extra_check_errmsg = "MaxNumAtom must be an integer or a one-item list." ,
773+ doc = doc_maxnumatom ,
774+ ),
730775 Argument (
731776 "CtrlRange" , list [list [int ]], optional = True , doc = doc_ctrlrange
732777 ),
@@ -737,7 +782,15 @@ def model_devi_calypso_args() -> list[Argument]:
737782 default = [0.001 ],
738783 doc = doc_pstress ,
739784 ),
740- Argument ("fmax" , float , optional = True , default = 0.01 , doc = doc_fmax ),
785+ Argument (
786+ "fmax" ,
787+ [float , int , list [float ], list [int ]],
788+ optional = True ,
789+ default = 0.01 ,
790+ extra_check = _is_scalar_or_singleton ,
791+ extra_check_errmsg = "fmax must be a scalar or a one-item list." ,
792+ doc = doc_fmax ,
793+ ),
741794 ],
742795 ),
743796 Argument ("calypso_input_path" , str , optional = True , doc = doc_calypso_input_path ),
0 commit comments