Syntax error C shell

Hello,

I have a newbe syntax error but I cant find it

syntax error: unexpected end of file
#!/bin/csh

# pe request
#$ -pe mpi_16 32 
#### 16 core : 'mpi_16 16' || 24 core : 'mpi_24 24 '

# our Job name 
#$ -N test2MD

#$ -S /bin/sh

#$ -q dulce.q


#### 16 core : '2687wv2.q'  || 24 core : '2697v2.q'

#$ -V

#$ -cwd

# needs in 
#   $NSLOTS          
#      the number of tasks to be used
#   $TMPDIR/machines 
#       a valid machiche file to be passed to mpirun 
#   enables $TMPDIR/rsh to catch rsh calls if available

echo "Got $NSLOTS slots."
cat $TMPDIR/machines

################ mpi execute #############################
MPI_HOME=/opt/intel/impi/4.0.0.028
MPI_EXEC=$MPI_HOME/bin64/mpirun
 cd $SGE_O_WORKDIR

rm ./POTCAR
cat /share/VASP_POTCAR/PAW_PBE_VASP52/C/POTCAR >./POTCAR
cat /share/VASP_POTCAR/PAW_PBE_VASP52/Li/POTCAR >>./POTCAR

runVASP=/opt/vasp/vasp.5.4/vasp.5.4.1/bin/vasp_std
runVASP_NonCol=/opt/vasp/vasp.5.4/vasp.5.4.1/bin/vasp_ncl
runVASP_GAMMA=/opt/vasp/vasp.5.4/vasp.5.4.1/bin/vasp_gam

set i=1
while ( $i < 100 )
     cp POSCAR POSCAR.$i
     $MPI_EXEC -machinefile $TMPDIR/machines -n $NSLOTS $runVASP > stdout
     cp CONCAR POSCAR
     cp REPORT REPORT.$1
     cp HILLSPOT PENALTYPOT
     @ i++
end

Thanks!

I cannot see such an error.
Perhaps you have WinDOS format? Then convert with dos2unix or a similar tool.
Check syntax with

csh -nx scriptfile

Apparently some assignments are in sh syntax where csh needs the set keyword. For example

set MPI_EXEC=$MPI_HOME/bin64/mpirun
set runVASP=/opt/vasp/vasp.5.4/vasp.5.4.1/bin/vasp_std 

Also it is safer to "quote" variables in commands and in the command arguments. For example

  "$MPI_EXEC" -machinefile "$TMPDIR/machines" -n "$NSLOTS" "$runVASP" > stdout

Also it is safer to exit when a cd fails.

cd "$SGE_O_WORKDIR" || exit