How to calculate the user-defined atom attribute?

Hi there,
I would like to add an atom attribute, like flag1 and flag2, as following.
Then I calculated the flag1=type+id and flag2=x+y.
But in the dumped file, c_111[1] and c_111[2] are all 0 indicating they are not calculated.
My question is how to calculate the user-defined attribute.

fix prop all property/atom i_flag1 d_flag2
variable flag1 atom type+id
variable flag2 atom x+y
compute 111 all property/atom i_flag1 d_flag2
dump 1 all custom 100 tmp.dump id x y z c_111[1] c_111[2]

Best,

Haidong Fan

These lines:

variable flag1 atom type+id
variable flag2 atom x+y

have nothing to do with the atom attributes

you defined. They create atom-style varaibles

which are not the same thing.

See the set command which can set values for

the i/d attributes. There is an example of this

on the fix property/atom doc page:

fix prop all property/atom mol
variable cluster atom ((id-1)/10)+1
set id * mol v_cluster

Steve

Hi there,
I would like to add an atom attribute, like flag1 and flag2, as following.
Then I calculated the flag1=type+id and flag2=x+y.
But in the dumped file, c_111[1] and c_111[2] are all 0 indicating they are not calculated.
My question is how to calculate the user-defined attribute.

There is no need to use fix property/atom for this. Just output the atom style variable directly to the dump file.

Axel

Thank you, guys.

I made it with the following commands.

variable nodump atom type+id
dump 1 all custom 100 tmp.dump id x y z v_nodump

Best,

Haidong