class matlantis_features.features.md.post_features.nemd_viscosity.ComplexNEMDViscosityFeature(integrator: MDIntegratorBase, n_run: int, rnemd_n_slab: int = 20, rnemd_interval: int = 100, init_time: float = 0.0, md_feature_args: Optional[Dict[str, Any]] = None)#

Bases: FeatureBase

The matlantis-feature for calculating viscosity related properties.

This feature calls both MDFeature with RNEMDExtension and PostNEMDViscosityFeature.

Methods

__init__(integrator, n_run[, rnemd_n_slab, …])

Initialize an instance.

__call__(system)

Run the rNEMD simulation and calculate the viscosity.

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__(integrator: MDIntegratorBase, n_run: int, rnemd_n_slab: int = 20, rnemd_interval: int = 100, init_time: float = 0.0, md_feature_args: Optional[Dict[str, Any]] = None)#

Initialize an instance.

Parameters
  • integrator (MDIntegratorBase) – Integrator used for the MD simulation run.

  • n_run (int) – Number of time steps of the MD simulation.

  • rnemd_n_slab (int, optional) – Number of the slabs used for the rNEMD calculation. Defaults to 20.

  • rnemd_interval (int, optional) – Number of the timestep interval for the rNEMD calculation.
    Defaults to 100.

  • init_time (float, optional) – Trajectory frames before this time (in fs) is ignored for the calculation.
    Defaults to 0.0 (i.e., all frames are used for calculation).

  • md_feature_args (dict[str, Any] or None, optional) – Additional options for MDFeature

__call__(system: MDSystemBase) ComplexNEMDViscosityFeatureResult#

Run the rNEMD simulation and calculate the viscosity.

Parameters

system (MDSystemBase) – Target system to calculate the viscosity.

Returns

Result dataclass object.

Return type

ComplexNEMDViscosityFeatureResult

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]