- class matlantis_features.features.md.md.MDFeature(integrator: MDIntegratorBase, n_run: int, checkpoint_file_name: Optional[str] = None, checkpoint_freq: Optional[int] = 10, traj_file_name: Optional[str] = None, traj_freq: Optional[int] = 1, traj_props: Optional[List[str]] = None, traj_append: bool = False, traj_init_frame: bool = False, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, logger_interval: int = 100, estimator_fn: Optional[Callable[[], Estimator]] = None)#
-
Bases:
FeatureBase
The matlantis-feature for molecular dynamics simulation.
Methods
__init__
(integrator, n_run[, …])Initialize an instance.
__call__
(system[, extensions])Run the MD simulation.
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.
Create temperory directory.
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, checkpoint_file_name: Optional[str] = None, checkpoint_freq: Optional[int] = 10, traj_file_name: Optional[str] = None, traj_freq: Optional[int] = 1, traj_props: Optional[List[str]] = None, traj_append: bool = False, traj_init_frame: bool = False, show_progress_bar: bool = False, tqdm_options: Optional[Dict[str, Any]] = None, show_logger: bool = False, logger_interval: int = 100, estimator_fn: Optional[Callable[[], Estimator]] = None)#
-
Initialize an instance.
- Parameters
-
-
integrator (MDIntegratorBase) – Integrator object used for the simulation.
-
n_run (int) – Number or the steps to be run.
-
checkpoint_file_name (str or None, optional) – Checkpoint file name. If this value is None and checkpoint_freq>0,
checkpoint file name is automatically generated.
If relative path name is given,
the file is stored in the current working directory.
Defaults to None. -
checkpoint_freq (int or None, optional) – Checkpoint creation frequency.
If this value is None or non positive, no checkpoit file is created.
Defaults to 10. -
traj_file_name (str or None, optional) – Trajectory file name. If this value is None and traj_freq>0,
trajectory file name is automatically generated.
If relative path name is given,
the file is stored in the current working directory.
Defaults to None. -
traj_freq (int or None, optional) – Trajectory saving frequency.
If this value is None or non positive, no trajectory file is created.
Defaults to 1. -
traj_props (list[str] or None, optional) – Names of the properties stored in the trajectory file.
If None, energy, forces, and stress properties are stored.
Defaults to None. -
traj_append (bool, optional) – If True and trajectory file exists, trajectory will be
appended to the existing file. Defaults to False. -
traj_init_frame (bool, optional) – If True, the initial structure of the simulation is
also stored in the trajectory file. Defaults to False. -
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 100. -
estimator_fn (EstimatorFnType or None, optional) – A factory method to create a custom estimator.
Please refer Customizing estimator used in matlantis-features for detail.
-
- __call__(system: MDSystemBase, extensions: Optional[List[Tuple[MDExtensionBase, int]]] = None) MDFeatureResult #
-
Run the MD simulation.
- Parameters
-
-
system (MDSystemBase) – Target system of the MD simulation.
-
extensions (MDExtensionList or None, optional) – Extension list (tuple of extension object and interval) used for the simulation.
Defaults to None.
-
- Returns
-
Result object for the MD simulation.
- Return type
- 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
- get_temp_dir() Path #
-
Create temperory directory.
- Returns
-
The location of temperory directory.
- Return type
-
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]
Resource Library
matlantis_features.features.md.md.MDFeature