# Question about MSD calculation

Hello all,

I would like to calculate MSD of oxygen in water. I created a water box with periodic boundary condition for the calculation. The oxygen atoms were specified as group OXY. I tried to use the following commands in the input file to get MSD results according to the manual:

compute MSDCWater OXY msd
fix MSDCWater_store_state OXY store/state xu yu zu
fix msdwater water ave/time 5 1 5 c_MSDCWater[1] c_MSDCWater[2] c_MSDCWater[3] c_MSDCWater[4] file msd-water.txt

But I’m really confusing if I should use the second command in the input file (fix MSDCWater_store_state OXY store/state xu yu zu). I was confusing because I got totally different results depending on the usage of this command. Please let me know if I missed anything in the manual. I appreciate any comment and suggestion.

Thanks so much in advance,

Hang

You should not specify the fix store/state command yourself.
Compute msd does this for you, behind the scenes.

Steve

Hi Steve,

Thanks for your help.

So, you mean I should not use the command: fix MSDCWater_store_state OXY store/state xu yu zu, right?

The other thing is, I think I should put the fix store/state command before compute msd. In order to understand what you said, I did a test and tried to figure out if the command compute MSD calculate MSD by using the original coordinates. When I change the order of the three commands like this:

fix MSDCWater_store_state OXY store/state xu yu zu
compute MSDCWater OXY msd
fix msdwater OXY ave/time 5 1 5 c_MSDCWater[1] c_MSDCWater[2] c_MSDCWater[3] c_MSDCWater[4] file msd-water.txt

I got the exact same result comparing with using the two commands:

compute MSDCWater OXY msd
fix msdwater OXY ave/time 5 1 5 c_MSDCWater[1] c_MSDCWater[2] c_MSDCWater[3] c_MSDCWater[4] file msd-water.txt

That is to say, no matter if I use fix store/state command. I should get the same results. Just like what you said, I should not specify fix store/state command because compute MSD command did this for me.

Thanks very much,

Hang

2012/7/28 Steve Plimpton <[email protected]>

So, you mean I should not use the command: fix
MSDCWater_store_state OXY store/state xu yu zu, right?

yes, do not use it at all. The compute msd command is invoking
that command internally with the same fix ID you are using,
so they will conflict. Please read the doc page for compute msd
again. It says this. It does not say that you should put that
fix line in your input script.

Steve

Thanks so much, Steve. I got it.

Hang

2012/7/30 Steve Plimpton <[email protected]>