File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -178,11 +178,25 @@ def make( # type: ignore[override]
178178 if len (list (os .scandir (mcsqs_dir ))) == 0 :
179179 mcsqs_dir .unlink ()
180180
181+ # For MCSQS, check whether the `perfect_match` was found
182+ # otherwise, SQSTask will throw a validation error
183+ found_perfect_match = False
184+ if (
185+ isinstance (best_objective , str )
186+ and best_objective .lower () == "perfect_match"
187+ ):
188+ best_objective = None
189+ found_perfect_match = True
190+
181191 sqs_structures = None
182192 sqs_scores = None
183193 if isinstance (sqs_structs , list ) and len (sqs_structs ) > 1 :
184194 sqs_structures = [entry ["structure" ] for entry in sqs_structs [1 :]]
185195 sqs_scores = [entry ["objective_function" ] for entry in sqs_structs [1 :]]
196+ for i , score in enumerate (sqs_scores ):
197+ if isinstance (score , str ) and score .lower () == "perfect_match" :
198+ sqs_scores [i ] = None
199+ found_perfect_match = True
186200
187201 return SQSTask (
188202 transformation = self .transformation ,
@@ -192,4 +206,5 @@ def make( # type: ignore[override]
192206 sqs_structures = sqs_structures ,
193207 sqs_scores = sqs_scores ,
194208 sqs_method = self .transformation .sqs_method ,
209+ found_perfect_match = found_perfect_match ,
195210 )
Original file line number Diff line number Diff line change @@ -43,15 +43,23 @@ class SQSTask(TransformTask):
4343 None ,
4444 description = (
4545 "The minimum value of the SQS obejective function, "
46- "corresponding to the structure in `final_structure`"
46+ "corresponding to the structure in `final_structure`."
47+ "If None, but `found_perfect_match` is True, then the "
48+ "ideal SQS structure was found."
4749 ),
4850 )
4951 sqs_structures : list [Structure ] | None = Field (
5052 None , description = "A list of other good SQS candidates."
5153 )
52- sqs_scores : list [float ] | None = Field (
54+ sqs_scores : list [float | None ] | None = Field (
5355 None ,
5456 description = (
55- "The objective function values for the structures in `sqs_structures`"
57+ "The objective function values for the structures in `sqs_structures`."
58+ "If any value is `None` and `found_perfect_match` is True, then the "
59+ "ideal SQS structure was found."
5660 ),
5761 )
62+ found_perfect_match : bool = Field (
63+ default = False ,
64+ description = "Whether the lowest possible SQS objective was attained." ,
65+ )
You can’t perform that action at this time.
0 commit comments