ERROR: Compute used in variable between runs is not current

Hello, lammps-users,

I use the command compute msd to compute the self-diffusion of methane. The error ‘Compute used in variable between runs is not current’ was triggered. The manual doc gives the method, add ‘run 0’ before the variable refering compute. And I write my input as the example in.msd.2d. But the error is still there. The commad line which trigger the error is attached below. Anyone can help me? Thanks in advance.

variable temp equal 333
fix metnvt methane nvt temp {temp} {temp} 100

thermo_style custom step time temp press pe ke etotal
thermo 1000

run 2000

reset_timestep 0

compute msd1 layer1 msd com no average no
compute msd2 layer2 msd com no average no
compute msd3 layer3 msd com no average no
compute msd4 layer4 msd com no average no

#variable dxdx1 equal c_msd1[1]
#variable dydy1 equal c_msd1[2]
#variable dzdz1 equal c_msd1[3]
variable dxdxdydy1 equal $(c_msd1[1]+c_msd1[2])
variable dxdx2 equal c_msd2[1]
variable dydy2 equal c_msd2[2]
variable dzdz2 equal c_msd2[3]

Best regard

Dongbo Wang

the input you are showing makes no sense.
you cannot define a compute after having run a simulation.
computes like compute msd are special, since they need to be triggered during a run.

the best way to have access to their data is to trigger them during a run through one of the averaging fixes and then access the data of the fix (which is persistent until updated).
if you set the value for repeat to 1, there would be no averaging (normally).
axel.