pwtools.crys.mean

pwtools.crys.mean(traj)[source]

Mean of Trajectory along timeaxis, like numpy.mean(array,axis=0).

Parameters:

traj (Trajectory)

Returns:

instance with extra velocity, temperature, ekin attrs which can hold the mean of the input traj

Return type:

Structure

Examples

>>> #  a slice of the Trajectory
>>> st = mean(tr[200:500])
>>> # Say we know that coords_frac is pbc-wrpapped for some reason but
>>> # coords is not. Make sure that we average only coords and force a
>>> # recalculation of coords_frac by setting it to None and calling
>>> # set_all() at the end.
>>> tr.coords_frac = None
>>> st = mean(tr)
>>> st.set_all()