#!/bin/bash -x

#====================================================================
# USAGE:
#    clean                      (erase results of previous runs)
#    nano INCAR,POSCAR,KPOINTS  (edit by hand)
#    buildPOTCAR Y Ba Cu O      (use ~yenlee.loh/bin/buildPOTCAR tool)
#    sbatch script      (launch script on compute nodes using SLURM)
#    squeue             (check status in queue)
#
#    Examine CONTCAR,XDATCAR,OSZICAR,OUTCAR,CHGCAR, and other files
#
#  Example:
#    grep F= OSZICAR
#    grep F= OSZICAR | cut -d ' ' -f 6
#
#====================================================================

#---------------- SLURM SETTINGS
#SBATCH --job-name=VASP
#SBATCH --partition=talon
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=16
#SBATCH --time=0:30:00 
#SBATCH --output=job.out
#PROCNUM=8

#---------------- SET UP ENVIRONMENT FOR VASP
export FI_PROVIDER=tcp
module load intel/mkl/64
module load intel/mpi/64
module load intel/compiler/64
ulimit -s unlimited

#---------------- RECORD JOB ID AND HOSTNAME
THEHOSTNAME=`srun -n $SLURM_NTASKS hostname | sort -u`
echo "Job $SLURM_JOB_ID was launched on $THEHOSTNAME" > hosts.out

#---------------- LAUNCH VASP
#mpirun /home/export/apps/vasp.5.4.1/bin/vasp_std >& script.out
mpirun /home/export/apps/vasp.5.4.1/bin/vasp_ncl >& script.out
