File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,16 +214,14 @@ def __init__(
214214 # Configure optimizer dynamics
215215 self .set_optimizer ()
216216
217- def _get_constraint_args (self , constraint_class : object ) -> list [ Any ] :
217+ def _set_mandatory_constraint_kwargs (self ) -> None :
218218 """Inspect constraint class for mandatory arguments
219219
220220 For now we are just looking for the "atoms" parameter of FixSymmetry
221221 """
222- parameters = inspect .signature (constraint_class .__init__ ).parameters
222+ parameters = inspect .signature (self . constraint_func .__init__ ).parameters
223223 if "atoms" in parameters :
224- return [self .struct ]
225-
226- return []
224+ self .constraint_kwargs ["atoms" ] = self .struct
227225
228226 def set_optimizer (self ) -> None :
229227 """Set optimizer for geometry optimization."""
@@ -232,8 +230,8 @@ def set_optimizer(self) -> None:
232230 self .logger .info ("Using optimizer: %s" , self .optimizer .__name__ )
233231
234232 if self .constraint_func is not None :
235- constraint_args = self ._get_constraint_args ( self . constraint_func )
236- self .struct .set_constraint (self .constraint_func (* constraint_args , * *self .constraint_kwargs ))
233+ self ._set_mandatory_constraint_kwargs ( )
234+ self .struct .set_constraint (self .constraint_func (** self .constraint_kwargs ))
237235
238236 if self .logger :
239237 self .logger .info ("Using constraint: %s" , self .constraint_func .__name__ )
You can’t perform that action at this time.
0 commit comments