Compute to variable Invalid compute ID in variable formula | Compute used in variable between runs is not current

Dears ,

From a data file I wish to calculate the mass of an atom type and store it in a variable. I’m trying the following:

read_data ./data

compute 1 all property/atom mass
compute 11 group_A reduce ave c_1
compute 12 group_B reduce ave c_1

variable m_A equal c_11
variable m_A equal c_12

uncompute 1
uncompute 11
uncompute 12

print ${m_A}

#other commands

run 100

I get the follow error message:

Invalid compute ID in variable formula

I want to take the compute , get the information , move to a variable and turn off the compute .

if I use :
variable m_A equal $(c_11)
I get the follow error message:
Compute used in variable between runs is not current

How can I do that?

Regards.

Dears ,

From a data file I wish to calculate the mass of an atom type and store it
in a variable. I'm trying the following:

read_data ./data

compute 1 all property/atom mass
compute 11 group_A reduce ave c_1
compute 12 group_B reduce ave c_1

variable m_A equal c_11
variable m_A equal c_12

uncompute 1
uncompute 11
uncompute 12

print ${m_A}
#other commands

run 100

I get the follow error message:

Invalid compute ID in variable formula

I want to take the compute , get the information , move to a variable and
turn off the compute .

you cannot do this with an equal style variable this way anyway. as
you noticed. equal style variables are always re-evaluated when
referenced and immediate variables ($(...) expressions) evaluated
immediately. but you don't need to use the three computes for what you
are doing. how about the following?

variable m_A index \(mass\(group\_A\)/count\(group\_A\)\) variable m\_B index (mass(group_B)/count(group_B))

axel.

thanks Mr. Axel

The commands that you give me helped to resolve my problem .

Cheers