msd (source code available here) calculates the Mean Squared Displacement of a set of atoms as determined by their starting and instantaneous positions read from a COR or RCV file.
Here is the help info printed by the MSD program.
msd [..options..] FREF [ {FMSD | *} [STEP] ] FREF is input RCV or COR file with reference step FMSD is input RCV or COR file with steps to calculate Mean Squared Displacement * instructs program to use same file as FREF If FMSD not specified, program uses same name as FREF step is step number to use as reference step OPTIONS -3 Output xx,yy,zz components of MSD -6 Output xx,yy,zz,yz,zx,xy components of MSD -r Calculate MSD relative to previous step -i filist Use ILIST file (first line: ILIST n - followed by indices) to select atoms for MSD calculation. -b x0 y0 z0 x1 y1 z1 Only use atoms within box -d Displace selected atoms to minimize MSD -h Print output column headers -m Switch atom order to minimize MSD. -p Print out displacment obtained with previous option -w Do not print warnings Calculates Mean Square Displacement for each step in file FMSD relative to step STEP in file FREF (default step is first in file).