- class matlantis_features.features.common.opt.FireASEOptFeature(n_run: int = 200, fmax: float = 0.01, attach_methods: Optional[List[Tuple[Callable[[], None], int]]] = None, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, logger_interval: int = 10, filter: Union[bool, MatlantisFilter] = False, trajectory: Optional[str] = None, estimator_fn: Optional[Callable[[], Estimator]] = None, maxstep: float = 0.2)#
-
Bases:
ASEOptFeature
The matlantis-feature that uses the Fast Inertial Relaxation Engine (FIRE), as implemented within ASE.
For details of the FIRE algorithm, please see:
Guénolé et al., Comput. Mater. Sci. 175 (2020) 109584.Methods
__init__
([n_run, fmax, attach_methods, …])Initialize an instance.
__call__
(atoms)Call function.
attach
(extn, interval)Used for attaching a function to the ASE optimizer.
attach_ctx
([ctx])Attach the feature to matlantis_features.utils.Context.
check_estimator_fn
(estimator_fn)Checks if the given estimator function is None and output a warning if so.
cost_estimate
([atoms])Estimate the cost of the feature.
from_dict
(res)Construct a FeatureBase object from serialized dict.
Get the temporary save directory from the context.
Context manager that enable to set attribution of the feature.
repeat
(n_repeat)Set the maximum number of times that allowed to run the __call__ function.
to_dict
()Dictionary representation of the FireASEOptFeature.
- __init__(n_run: int = 200, fmax: float = 0.01, attach_methods: Optional[List[Tuple[Callable[[], None], int]]] = None, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, logger_interval: int = 10, filter: Union[bool, MatlantisFilter] = False, trajectory: Optional[str] = None, estimator_fn: Optional[Callable[[], Estimator]] = None, maxstep: float = 0.2)#
-
Initialize an instance.
- Parameters
-
-
n_run (int, optional) – The maximum number of optimization steps performed to try to
reach force convergence (specified by fmax). Defaults to 200. -
fmax (float, optional) – The maximum force (in eV/Angstrom) for convergence of optimization.
Defaults to 0.01. -
attach_methods (list[tuple[ -> None, int]] or None, optional) – Functions to be called by the optimizer. A list of tuples must be specified,
where the first element of each tuple is a callable function, and the second element
is an integer N. The optimizer will call the function every N steps.
If None, no functions will be attached. Defaults to None. -
show_progress_bar (bool, optional) – Show progress bar. Defaults to False.
-
tqdm_options (dict[str, Any] or None, optional) – Options for tqdm.
-
show_logger (bool, optional) – Show log information. Defaults to False.
-
logger_interval (int, optional) – The interval of when to print out logger information.
Defaults to 10. -
filter (bool or MatlantisFilter, optional) – The MatlantisFilter used in the optimization. If True, the default filter, i.e.
UnitCellASEFilter, will be used for the cell shape optimization. If False, no
filter is used.
Note: The filter is only applicable in the optimization of ASEAtoms and MatlantisAtoms,
not NEB class.
Defaults to False. -
trajectory (str or None, optional) – Filename for trajectory file. If None, no trajectory file will be saved. Defaults
to None. -
estimator_fn (EstimatorFnType or None, optional) – A factory method to create a custom estimator.
Please refer Customizing estimator used in matlantis-features for detail. -
maxstep (float, optional) – The maximum distance an atom can move per iteration. The unit is angstrom.
Defaults to 0.2.
-
- __call__(atoms: Union[Atoms, MatlantisAtoms, NEB, Filter]) OptFeatureResult #
-
Call function.
- Parameters
-
atoms (ASEAtoms or MatlantisAtoms or NEB or Filter) – The system to be optimized. In addition to ASEAtoms and MatlantisAtoms,
NEB (Matlantis) and Filter (ASE) objects are also supported.
Note: the support of ASE Filter class will be deprecated in the future.
Please use the ‘filter’ parameter in the __init__ function. - Returns
-
A dataclass containing information about the result of optimization.
- Return type
- attach(extn: Callable[[], None], interval: int) None #
-
Used for attaching a function to the ASE optimizer.
- Parameters
-
-
extn (-> None) – The function to be attached.
-
interval (int) – The interval (in optimization steps) of when the optimizer will call the function.
-
- attach_ctx(ctx: Optional[Context] = None) None #
-
Attach the feature to matlantis_features.utils.Context.
- Parameters
-
ctx (Context or None, optional) – The matlantis_features.utils.Context object. Defaults to None.
- check_estimator_fn(estimator_fn: Optional[Callable[[], Estimator]]) None #
-
Checks if the given estimator function is None and output a warning if so.
- Parameters
-
estimator_fn (EstimatorFnType or None, optional) – A factory method to create a custom estimator.
Please refer Customizing estimator used in matlantis-features for detail. Defaults to None.
- cost_estimate(atoms: Optional[Union[Atoms, MatlantisAtoms]] = None) FeatureCost #
-
Estimate the cost of the feature.
- Parameters
-
atoms (ASEAtoms or MatlantisAtoms or None, optional) – The input atoms. Defaults to None.
- Returns
-
The cost of the feature.
- Return type
-
FeatureCost
- classmethod from_dict(res: Dict[str, Any]) FeatureBase #
-
Construct a FeatureBase object from serialized dict.
- Parameters
-
res (dict[str, Any]) – A dict containing a serialized FeatureBase from to_dict().
- Returns
-
The deserialized object from provided dict.
- Return type
- get_savedir_from_ctx() Path #
-
Get the temporary save directory from the context.
- Returns
-
The temporary save directory .
- Return type
-
pathlib.Path
- init_scope() Iterator[None] #
-
Context manager that enable to set attribution of the feature.
- Returns
-
Init_scope context manager.
- Return type
-
Iterator[None]
- repeat(n_repeat: int) Self #
-
Set the maximum number of times that allowed to run the __call__ function.
- Parameters
-
n_repeat (int) – The maximum number of repeats.
- Returns
-
The feature.
- Return type
-
Self
- to_dict() Dict[str, Any] #
-
Dictionary representation of the FireASEOptFeature.
- Returns
-
A dict containing a serialized FireASEOptFeature.
- Return type
-
dict[str, Any]
Resource Library
matlantis_features.features.common.opt.FireASEOptFeature