Hi. I want to do some sensitive diffusion measurements on some smallish systems and subtract out the center of mass motion (which I believe is induced by the Langevin thermostat?). Will the following work?
1) In fix_msd.h define
double xcmorig[3]
2) In fix_msd.cpp's constructor, add a line
group->xcm(igroup,masstotal,xcmorig);
3) In fix_msd.cpp's End of Step, add
double xcm[3];
group->xcm(igroup,masstotal,xcm);
and change
dx = x[i][0] + xbox*xprd - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - xoriginal[i][2];
to
dx = x[i][0] + xbox*xprd - xoriginal[i][0] - (xcm[0] - xcmorig[0]);
dy = x[i][1] + ybox*yprd - xoriginal[i][1] - (xcm[1] - xcmorig[1]);
dz = x[i][2] + zbox*zprd - xoriginal[i][2] - (xcm[2] - xcmorig[2]);
Will that handle things correctly, or will there be complications if e. g. the center if mass crosses a periodic boundary? Or am I overlooking something else?
I would think someone has done the subtracting out the center of mass motion before.
Thanks,
Rob