Evaluation of dynamic properties

Dynamic properties like mean square displacement are calculated with the function mdevaluate.correlation.shifted_correlation(). This function takes a correlation function and calculates the averaged time series of it, by shifting a time interval over the trajectory.

from mdevaluate import correlation

time, msd_amim = correlation.shifted_correlation(correlation.msd, com_amim, average=True)
plot(time,msd_amim)

The result of shifted_correlation() are two lists, the first one (time) contains the times of the frames that have been used for the correlation. The second list msd_amim is the correlation function at these times. If the keyword average=False is given, the correlation function for each shifted time window will be returned.

Arguments of shifted_correlation

The function mdevaluate.correlation.shifted_correlation() accepts several keyword arguments. With those arguments, the calculation of the correlation function may be controlled in detail. The mathematical expression for a correlation function is the following:

\[S(t) = \frac{1}{N} \sum_{i=1}^N C(f, R, t_i, t)\]

Here \(S(t)\) denotes the correlation function at time t, \(R\) are the coordinates of all atoms and \(t_i\) are the onset times (\(N\) is the number of onset times or time windows). Note that the outer sum and division by \(N\) is only carried out if average=True. The onset times are defined by the keywords segments and window, with \(N = segments\) and \(t_i = \frac{ (1 - window) \cdot t_{max}}{N} (i - 1)\) with the total simulation time \(t_{max}\). As can be seen segments gives the number of onset times and window defines the part of the simulation time the correlation is calculated for, hence window - 1 is the part of the simulation the onset times a distributed over.

\(C(f, R, t_0, t)\) is the function that actually correlates the function \(f\). For standard correlations the functions \(C(...)\) and \(f\) are defined as:

\[C(f, R, t_0, t) = f(R(t_0), R(t_0 + t))\]
\[f(r_0, r) = \langle s(r_0, r) \rangle\]

Here the brackets denote an ensemble average, small \(r\) are coordinates of one frame and \(s(r_0, r)\) is the value that is correlated, e.g. for the MSD \(s(r_0, r) = (r - r_0)^2\).

The function \(C(f, R, t_0, t)\) is specified by the keyword correlation, the function \(f(r_0, r)\) is given by function.