mdgo.residence_time module
This module calculates species correlation lifetime (residence time).
- mdgo.residence_time.neighbors_one_atom(nvt_run, center_atom, species, select_dict, distance, run_start, run_end)[source]
Create adjacency matrix for one center atom.
- Parameters
nvt_run (
Universe) – An MDAnalysisUniverse.center_atom (
Atom) – The center atom object.species (
str) – The neighbor species in the select_dict.select_dict (
Dict[str,str]) – A dictionary of atom species selection, where each atom species name is a key and the corresponding values are the selection language.distance (
float) – The neighbor cutoff distance.run_start (
int) – Start frame of analysis.run_end (
int) – End frame of analysis.
- Return type
Dict[str,ndarray]- Returns
A neighbor dict with neighbor atom id as keys and arrays of adjacent boolean (0/1) as values.
- mdgo.residence_time.calc_acf(a_values)[source]
Calculate auto-correlation function (ACF)
- Parameters
a_values (
Dict[str,ndarray]) – A dict of adjacency matrix with neighbor atom id as keys and arraysboolean (of adjacent) –
- Return type
List[ndarray]- Returns
A list of auto-correlation functions for each neighbor species.
- mdgo.residence_time.exponential_func(x, a, b, c)[source]
An exponential decay function
- Parameters
x (
Union[float,floating,ndarray]) – Independent variable.a (
Union[float,floating,ndarray]) – Initial quantity.b (
Union[float,floating,ndarray]) – Exponential decay constant.c (
Union[float,floating,ndarray]) – Constant.
- Return type
Union[floating,ndarray]- Returns
The acf
- mdgo.residence_time.calc_neigh_corr(nvt_run, distance_dict, select_dict, time_step, run_start, run_end, center_atom='cation')[source]
Calculates the neighbor auto-correlation function (ACF) of selected species around center atom.
- Parameters
nvt_run (
Universe) – An MDAnalysisUniverse.distance_dict (
Dict[str,float]) –select_dict (
Dict[str,str]) –time_step (
float) –run_start (
int) – Start frame of analysis.run_end (
int) – End frame of analysis.center_atom (
str) – The center atom to calculate the ACF for. Default to “cation”.
- Return type
Tuple[ndarray,Dict[str,ndarray]]- Returns
A tuple containing the time series, and a dict of acf of neighbor species.
- mdgo.residence_time.fit_residence_time(times, acf_avg_dict, cutoff_time, time_step)[source]
Use the ACF to fit the residence time (Exponential decay constant). TODO: allow defining the residence time according to a threshold value of the decay
- Parameters
times (
ndarray) – A time series.acf_avg_dict (
Dict[str,ndarray]) – A dict containing the ACFs of the species.cutoff_time (
int) – Fitting cutoff time.time_step (
float) – The time step between each frame, in ps.
- Return type
Dict[str,floating]- Returns
A dict containing residence time of each species