First time you run a VASP job?

This page contains info aimed at first time users of VASP on in one of our workstations, but may also be useful to more experienced users. Please look carefully through the provided examples. Also note that the job-script example is rather richly commented to provide additional and relevant info.

If you want to run this testjob, download the copies of the scripts and put them into your test job folder (which I assume you have created in advance).

VASP input example

Download the tarred job CeO2job-files.

move this file to your test job folder and type

tar -zxf CeO2.tar.gz

Then; download the job-script as seen here:

#!/bin/bash -l

################### VASP Job Batch Script Example ###################
# Section for defining queue-system variables:
#-------------------------------------
# This script asks for Triumphant Coal and 64 cores .  
# Runtime for this job is 59 minutes; syntax is hh:mm:ss.
#-------------------------------------
# SLURM-section
## Select triumphant-coal
#SBATCH --partition=triumphant-coal
## 64 Threads
#SBATCH --ntasks=64
##Name of the job
#SBATCH --job-name=vasp_runex
##Two ours
#SBATCH --time=02:00:00
## asks SLURM to send the USR1 signal 10 minutes before the end of the time limit
#SBATCH --signal=B:USR1@600
##Log
#SBATCH --output=vasp_runex.log

######################################
# Section for defining job variables and settings:

# We load all the default program system settings with module load:

module --quiet purge
module load nvhpc/21.3 triumphant-coal/vasp/nvhpc/6.1-openACC
# You may check other available versions with "module avail VASP"


#Don't forget to set this to 1, if you do not setup your run for OMP parallelization! 
export OMP_NUM_THREADS=1

# A unique file tag for the created files
file_tag=$( date +"%d%m%y-%H%M" )

# Define and create a unique scratch directory for this job
SCRATCH_DIRECTORY=/scratch/${USER}/${SLURM_JOBID}.$file_tag
mkdir -p ${SCRATCH_DIRECTORY}
cd ${SCRATCH_DIRECTORY}

# You can copy everything you need to the scratch directory
# ${SLURM_SUBMIT_DIR} points to the path where this script was submitted from
cp ${SLURM_SUBMIT_DIR}/INCAR ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/POSCAR ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/POTCAR ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/KPOINTS ${SCRATCH_DIRECTORY}


######################################
# Running the job


# define the handler function
# note that this is not executed here, but rather
# when the associated signal is sent
cleanup_function()
{
        cd ${SCRATCH_DIRECTORY}
        echo "function your_cleanup_function called at $(date)"
        tar cvf ${SLURM_SUBMIT_DIR}/results-${SLURM_JOBID}-$file_tag.tar CONTCAR CHGCAR CHG WAVECAR WAVEDER EIGENVAL DOSCAR PROCAR OSZICAR PCDAT XDATCAR LOCPOT ELFCAR PROOUT OPTIC *.xml *.tmp UNK* wannier90.*
        gzip  ${SLURM_SUBMIT_DIR}/results-${SLURM_JOBID}-$file_tag.tar 
}

# call cleanup_function once we receive USR1 signal
trap 'cleanup_function' USR1



echo "starting calculation at $(date)"

# Running the program:
# the "&" after the compute step and "wait" are important
mpirun vasp_std &
wait

echo "Job finished at"
date
cleanup_function
################### Job Ended ###################
exit 0

Download it here job_vasp.sh.