@@ -50,7 +50,7 @@ class MatPesStaticFlowMaker(Maker):
5050 ),
5151 )
5252 )
53- static2 : Maker = field (
53+ static2 : Maker | None = field (
5454 default_factory = lambda : MatPesMetaGGAStaticMaker (
5555 # start from pre-conditioned WAVECAR from static1 to speed up convergence
5656 # could copy CHGCAR too but is redundant since VASP can reconstruct it from
@@ -69,6 +69,11 @@ class MatPesStaticFlowMaker(Maker):
6969 )
7070 )
7171
72+ def __post_init__ (self ) -> None :
73+ """Validate flow."""
74+ if (self .static1 , self .static2 , self .static3 ) == (None , None , None ):
75+ raise ValueError ("Must provide at least one StaticMaker" )
76+
7277 def make (self , structure : Structure , prev_dir : str | Path | None = None ) -> Flow :
7378 """Create a flow with MatPES statics.
7479
@@ -89,10 +94,20 @@ def make(self, structure: Structure, prev_dir: str | Path | None = None) -> Flow
8994 Flow
9095 A flow containing 2 or 3 statics.
9196 """
92- static1 = self .static1 .make (structure , prev_dir = prev_dir )
93- static2 = self .static2 .make (structure , prev_dir = static1 .output .dir_name )
94- output = {"static1" : static1 .output , "static2" : static2 .output }
95- jobs = [static1 , static2 ]
97+ jobs = []
98+ output = {}
99+
100+ if self .static1 is not None :
101+ static1 = self .static1 .make (structure , prev_dir = prev_dir )
102+ jobs += [static1 ]
103+ output ["static1" ] = static1 .output
104+
105+ prev_dir = static1 .output .dir_name if self .static1 is not None else prev_dir
106+
107+ if self .static2 is not None :
108+ static2 = self .static2 .make (structure , prev_dir = prev_dir )
109+ jobs += [static2 ]
110+ output ["static2" ] = static2 .output
96111
97112 # only run 3rd static if set generator not None and structure contains at least
98113 # one element with Hubbard +U corrections
@@ -104,7 +119,7 @@ def make(self, structure: Structure, prev_dir: str | Path | None = None) -> Flow
104119 anion in elems and elems & {* cations }
105120 for anion , cations in u_corrections .items ()
106121 ):
107- static3 = self .static3 .make (structure , prev_dir = static1 . output . dir_name )
122+ static3 = self .static3 .make (structure , prev_dir = prev_dir )
108123 output ["static3" ] = static3 .output
109124 jobs += [static3 ]
110125
0 commit comments