compute com/molecule

Dear all,

I am trying to calculate the center of mass of the molecules present in my system during the lammps run and want to output the same to a file at some interval of time. I am using
compute com/molecule command to do that and then accessing them through variable assignment. Finally I am trying to print them to a file using fix print command. But an error occurs while doing so. The error is “ERROR: Compute used in variable between runs is not current”. I have tried to use running 0 step before accessing the compute through the
variables. Still the same problem. Below is the script I am using. Any comments will be highly appreciated.

units real
atom_style full
boundary p p p

pair_style lj/class2/coul/cut 13.3 13.3
pair_modify mix sixthpower
dielectric 1.0
special_bonds lj 0.0 0.0 1.0 coul 0.0 0.0 1.0
bond_style class2
angle_style class2
dihedral_style class2

read_data molecule.data

group MOVING molecule > 1

timestep 1.0 #femto seconds
velocity MOVING create 300 2309483 mom yes rot yes dist gaussian

fix NVE MOVING nve
fix TEMPRESCALE MOVING temp/rescale 1 300 300 0.0 1.0

compute TEMP_C4 MOVING temp

thermo 10
thermo_style custom step c_TEMP_C4 press vol ke pe etotal ecoul
thermo_modify flush yes

compute COM_C4 MOVING com/molecule

run 0

variable comx equal c_COM_C4[1][1]
variable comy equal c_COM_C4[1][2]
variable comz equal c_COM_C4[1][3]

fix comvalues MOVING print 10 {comx} {comy} ${comz} com.dat

run 2000

kind regards
bhaskar

The argument to fix print needs to be a single string, enclosed in quotes.
This will prevent the variables from being evaluated immediately (outside
the run) which is why you're getting the error. See the examples
on the fix print doc page.

Steve