#!/bin/bash -l

module load intel/19 intel-mpi/2019.4.243
module load quantum-espresso/6.4.1

name=`basename $0`

if [ $# -ne 3 ]; then 
        echo "Usage: $name [number of processors {1 - 256}] [inputfile] [outputfile]"
	echo 
	echo "Example: $name 4 data.in results.out"
	exit -1
fi

#export I_MPI_PMI_LIBRARY=/cm/shared/applications/slurm/current/lib/libpmi.so

nohup /shared/apps/common/slurm/current/bin/salloc \
        --job-name=QE-SUB \
        --ntasks=$1 \
        --exclusive \
	srun -n $1 pw.x -i $2 > $3 &

disown