This kind of problem was reported and answered very recently: Why does my LAMMPS script fail with 'Illegal variable command