Error: Mismatched compute in variable formula

Hello all,
I am trying to dump atomic stresses but in dump command getting mismatch error.

################## stress per atom
variable rCu equal 1.28
variable vol_Cu equal (4/3)PIv_rCu^3/10000
compute S_work work stress/atom NULL
variable S_atomCu atom -c_S_work/v_vol_Cu

dump 1 all custom 50 alldy.*.dump id type x y z vx vy vz fx fy fz v_S_atomCu

ERROR: Mismatched compute in variable formula (…/variable.cpp:1364)

Should I compute all 6 components of stresses one by one in variable command?

or is there any other way?

Hello all,
I am trying to dump atomic stresses but in dump command getting mismatch
error.

################## stress per atom
variable rCu equal 1.28
variable vol_Cu equal (4/3)*PI*v_rCu^3/10000
compute S_work work stress/atom NULL
variable S_atomCu atom -c_S_work/v_vol_Cu

dump 1 all custom 50 alldy.*.dump id type x y z vx vy vz fx fy fz
v_S_atomCu

ERROR: Mismatched compute in variable formula (../variable.cpp:1364)

from the compute stress/atom documentation:

Output info:

This compute calculates a per-atom array with 6 columns, which can be
accessed by indices 1-6 by any command that uses per-atom values from
a compute as input. See Section 6.15 for an overview of LAMMPS output
options.

Should I compute all 6 components of stresses one by one in variable
command?

no. if you want the scalar stress, you have to compute it as the
average of the 3 diagonal elements of the stress tensor. please see
the example for computing this globally.

axel.