[LAMMPS ERROR] Substitution for illegal variable

Hi everyone, I’m trying to conduct a shear simulation on a bicrystal using velocity command and want to get the shear stress of the mobile area, namely stress_yz. But I got the error massage: “Substitution for illegal variable syz_grain”. I read the manual but still don’t know what was wrong with my code. Could you please tell me how to fix this problem. Here is my code and illustration of the bicrystal. Thanks in advance.

compute peratom all stress/atom new2d
compute vatom all voronoi/atom
#compute vonmises stress
variable sigma_x atom c_peratom[1]/(c_vatom[1]*10000)
variable sigma_y atom c_peratom[2]/(c_vatom[1]*10000)
variable sigma_z atom c_peratom[3]/(c_vatom[1]*10000)
variable sigma_xy atom c_peratom[4]/(c_vatom[1]*10000)
variable sigma_xz atom c_peratom[5]/(c_vatom[1]*10000)
variable sigma_yz atom c_peratom[6]/(c_vatom[1]*10000)
variable vonmises atom sqrt(((v_sigma_x-v_sigma_y)^2+(v_sigma_x-v_sigma_z)^2+(v_sigma_y-v_sigma_z)^2+(v_sigma_xy^2+v_sigma_xz^2+v_sigma_yz^2)*6)/2)
#compute shear stress of mobile area
compute syz_strain mobile reduce sum v_sigma_yz

There is no reference to a variable syz_grain anywhere in the input you quoted.

The error message means that you are trying to use results from a variable that does not exist.

Thanks for your enlightening reply. I checked the code and found I mistakenly quoted syz_grain with variable quoting format ${syz_grain}, where syz_grain is actually in compute format and should be quated as c_syz_grain.

Sorry to make such a stupid mistake and thanks again.

I made a mistake when pasting code, this line:

was actually

compute syz_grain mobile reduce sum v_sigma_yz

in my input script.