How to compute an average coordinate of a group of atoms

Hello,

I want to compute an average x coordinate of a group of atoms and then compute the running average of the averaged coordinated. So I used the following commands,

compute x1 sf1 property/atom x
fix 3 sf1 ave/time 1 50000 50000 c_x1 mode scaler ave running file sf.xfile

But it reflected as
ERROR: Illegal fix ave/time command (../fix_ave_time.cpp:1049)

Can anyone help me with this?

Thanks

Regards,
Andy

Hello,

I want to compute an average x coordinate of a group of atoms and then compute the running average of the averaged coordinated. So I used the following commands,

compute x1 sf1 property/atom x
fix 3 sf1 ave/time 1 50000 50000 c_x1 mode scaler ave running file sf.xfile

But it reflected as
ERROR: Illegal fix ave/time command (../fix_ave_time.cpp:1049)

Can anyone help me with this?

there are two problems:

a) your input doesn't do what you say it does. to get the average of a
group, you need to use compute reduce with the flag ave. compute
property/atom doesn't produce a scalar.

b) your fix ave/time command has a typo

axel.

Thanks. Now it is running well.

I change it like this.

compute x_sf1 sf1 property/atom x
compute ave_x_sf1 sf1 reduce ave c_x_sf1
fix 3 sf1 ave/time 1 50000 50000 c_ave_x_sf1 mode scalar ave running file sf1.xfile

Am I right if I say the following?
Compute property/atom only stores the atom and its x coordinates in a vector. And compute reduce produces a global scalar averaged from the stored vector. Then the fix ave/time gives me the average of the global scalar over some time steps.

Thanks
Andy

Thanks. Now it is running well.

I change it like this.

compute x_sf1 sf1 property/atom x
compute ave_x_sf1 sf1 reduce ave c_x_sf1
fix 3 sf1 ave/time 1 50000 50000 c_ave_x_sf1 mode scalar ave running file sf1.xfile

Am I right if I say the following?
Compute property/atom only stores the atom and its x coordinates in a vector. And compute reduce produces a global scalar averaged from the stored vector. Then the fix ave/time gives me the average of the global scalar over some time steps.

isn't this what the documentation of those commands says?

axel.