class matlantis_features.features.common.vibration.VibrationFeature(delta: float = 0.01, nfree: int = 2, method: str = ‘standard’, direction: str = ‘central’, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, estimator_fn: Optional[Callable[[], Estimator]] = None, num_threads: int = 20)#

Bases: FeatureBase

The matlantis-feature for calculating molecular vibration.

The vibration properties, including the force constant, vibration frequencies and vibration modes are calculated with the finite displacement method.

References

For more information, please refer to Matlantis Guidebook.

Methods

__init__([delta, nfree, method, direction, …])

Initialize an instance.

__call__(atoms[, indices])

Run the vibration calculation.

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_savedir_from_ctx()

Get the temporary save directory from the context.

init_scope()

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 FeatureBase.

__init__(delta: float = 0.01, nfree: int = 2, method: str = ‘standard’, direction: str = ‘central’, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, estimator_fn: Optional[Callable[[], Estimator]] = None, num_threads: int = 20) None#

Initialize an instance.

Parameters
  • delta (float, optional) – The distance of finite displacement applied to each atom.
    The unit is Angstrom. Defaults to 0.01.

  • nfree (int, optional) – The number of displacements per atom. Must be 2 or 4. Defaults
    to 2.

  • method (str, optional) – The method to calculate the force constant from the displaced
    supercells and their forces. This parameter can be ‘Standard’ or ‘Frederiksen’.
    Defaults to ‘standard’.

  • direction (str, optional) – This parameter discribe how the displacment is found. Must
    be When ‘direction=forward’/’direction=backward’, each atom is displaced along the
    positive/negative direction of the axis. When ‘direction=center’, each atom is
    displaced along both positive and negative directions of the axis. Defaults to
    ‘central’.

  • 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.

  • estimator_fn (EstimatorFnType or None, optional) – A factory method to create a custom estimator.
    Please refer Customizing estimator used in matlantis-features for detail.

  • num_threads (int, optional) – Number of threads for parallel calculation. Defaults to 10.

__call__(atoms: Union[MatlantisAtoms, Atoms], indices: Optional[List[int]] = None) VibrationFeatureResult#

Run the vibration calculation.

Parameters
  • atoms (MatlantisAtoms or ASEAtoms) – The input structure.

  • indices (list[int] or None, optional) – List of indices of atoms allowed to vibrate.
    If ‘None’ is provided, all atoms are allowed to vibrate. Defaults to None.

Returns

The vibration calculation results, which include the force constant, vibration
frequencies and vibration modes.

Return type

VibrationFeatureResult

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

FeatureBase

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 FeatureBase.

Returns

A dict containing a serialized FeatureBase.

Return type

dict[str, Any]