I am running a molecular dynamics simulation of water in TIP3P, and I am storing the positions of my particles in a 2D array called
relevant_positions. The number of particles in my simulation is
numPart. I am running a simulation from
t=n_time_points-1. In effect, I have snapshots of positions of particles at
n_time_points time points.
I am trying to evaluate the MSD of my simulation, and this is the code I am using:
for d in range(1, n_time_points): for i in range(0, n_time_points-d): msd[d] += np.sum(np.square(\ relevant_positions[numPart*(d+i):numPart*(d+i+1),:] -\ relevant_positions[numPart*i:numPart*(i+1),:])) msd[d] = msd[d]/(n_time_points-d) msd = msd/numPart
I expect this to be a straight line, but it clearly is not. What am I doing incorrectly here?