Source code for scm.glompo.exitconditions.maxoptimizersstarted

from .baseexitcondition import BaseExitCondition
from ...plams.core.settings import Settings

__all__ = ("MaxOptimizersStarted",)


[docs]class MaxOptimizersStarted(BaseExitCondition): """Returns ``True`` after ``omax`` optimizers have been started.""" def __init__(self, omax: int): super().__init__() self.omax = omax def __amssettings__(self, s: Settings) -> Settings: s.input.ams.ExitCondition.Type = "MaxOptimizersStarted" s.input.ams.ExitCondition.MaxOptimizersStarted = self.omax return s def __call__(self, manager: "GloMPOManager") -> bool: self.last_result = manager.o_counter >= self.omax return self.last_result