class matlantis_features.features.phonon.band.PostPhononBandFeature#

Bases: FeatureBase

The matlantis-feature for calculating the phonon band structure.

References

For more information, please refer to Matlantis Guidebook.

Methods

__init__()

Initiate an instance.

__call__(force_constant[, labels, …])

Calculates the phonon band structure from the force constant.

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__() None#

Initiate an instance.

__call__(force_constant: ForceConstantFeatureResult, labels: Optional[List[str]] = None, special_kpts: Optional[ndarray] = None, n_kpts: Optional[List[int]] = None, total_n_kpts: int = 100, unit: str = ‘meV’, style: str = ‘ase’) PostPhononBandFeatureResult#

Calculates the phonon band structure from the force constant.

Parameters
  • force_constant (ForceConstantFeatureResult) – The calculation result of
    the ForceConstantFeature.

  • labels (list[str] or None, optional) – The labels of special points that form the band
    path. Please use ‘,’ ‘|’ or ‘/’ to represent a discontinuous jump. If None is
    provided, the band path will be automatically generated according to the type of
    bravais lattice. Defaults to None.

  • special_kpts (np.ndarray or None, optional) – The coordinates of special points in
    reciprocal space. The ‘special_kpts’ should be a numpy.ndarray in the shape of
    (N, 3), where N is the same as the length of ‘labels’. If ‘None’ is provided,
    the automatically generated special points will be used. Defaults to None.

  • n_kpts (list[int] or None, optional) – The number of interpolated points in each
    segment of the path. If None is provided, the values will be estimated from
    ‘total_n_kpts’. Defaults to None.

  • total_n_kpts (int, optional) – The number of interpolated points along the whole band
    path. This parameter will be ignored if ‘n_kpts’ is specified. Defaults to 100.

  • unit (str, optional) – The unit of phonon frequency. Must be one of: ‘meV’, ‘eV’, ‘THz’
    or ‘cm^-1’. Defaults to ‘meV’.

  • style (str, optional) – If ‘labels’ and ‘special_kpts’ are all not provided,
    the default k-point path will be used. The parameter ‘style’ can control which
    kind of default path to use. Currently, ‘ase’, which is ASE style, and ‘phonon_db’,
    which follows the Phonon database (http://phonondb.mtl.kyoto-u.ac.jp/), are
    supported. Defaults to “ase”.

Returns

The calculation results of the phonon band structure.

Return type

PostPhononBandFeatureResult

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]