ERROR:Substitution for illegal variable file

Here is the input

#-----initialization-----
units         metal
dimension     3
boundary      f f f
atom_style    atomic
read_restart    restart_nt-Cu_sametemp_600000.restart
#-----mass-----
mass   1 63.55
mass   2 63.55
mass   3 12.0096   #carbon mass (amu)
#------ force field ------
pair_style hybrid eam/alloy tersoff lj/cut 3.615
pair_coeff * * eam/alloy Cu_zhou.eam.alloy Cu Cu NULL
pair_coeff * * tersoff SiC.tersoff NULL NULL C
pair_coeff 1*2 3 lj/cut 0.001034 2 3.615
#------ computation ------
compute        peratom all pe/atom
#-----variable-----
variable V equal 10.0
variable x equal vdisplace(0,0,$V)
#-----minimize-----
group top1 type 3
fix 1 top1 move variable v_x NULL NULL v_V NULL NULL
dump           1 all custom 50 ${file}_mini_*.dump id type xu yu zu c_peratom
#dump_modify  1 sort id scale no
thermo       50
thermo_style custom step temp pe
min_style cg
minimize 1.0e-5 1.0e-5 1000 100000
undump 1

Now I wanna make group top1 move downward.
The error says that it’s wrong with the variable command.
but the two variable commands were copied from the lammps documentation actually.
Is it possible that the problem comes from restart file?

The error is not from the variable commands, it is from using the variable “file” without defining it first.