It's a bit weird, but because of the way LAMMPS's parser works, if your
variable name is more than one letter you have to surround it with braces
when using it as a substitution.
So your script should read:
variable runtime index 5000
.
.
run ${runtime}
The reason for this is that the parser works a character at a time when
initially parsing a line, it needs to know when a variable name
starts and ends. You might think it could use spaces to delimit
variable names, but then you can't do this:
variable prefix index somefile
dump 1 all atom 1 $prefix.dump