vasp_has_nlep = False
################## QDEL definition ################
mpirun_exe = "srun --mpi=pmi2 -n {n} {program}" # Kestrel requires --mpi=pmi2 for vasp
qdel_exe = "scancel"
qsub_exe = "sbatch"
################### QSTAT definition ##############
def ipython_qstat(self, arg):
""" Prints jobs of current user. """
from subprocess import Popen, PIPE
from IPython.utils.text import SList
# get user jobs ids
jobs = Popen(['squeue', '-u', '[user name]','--format','%.18i %.9P %j %.8u %.2t %.10M %.6D %R'], stdout=PIPE, encoding='utf-8').communicate()[0].split('\n')
names = [lines.strip().split()[2] for lines in jobs[1:-1]]
mpps = [lines.strip().split()[0] for lines in jobs[1:-1]]
states = [lines.strip().split()[4] for lines in jobs[1:-1]]
ids = [lines.strip().split()[0] for lines in jobs[1:-1]]
return SList([ "{0:>10} {1:>4} {2:>3} -- {3}".format(id, mpp, state, name) \
for id, mpp, state, name in zip(ids, mpps, states, names)])
## return SList([ "{0}".format(name) \
## for id, mpp, state, name in zip(ids, mpps, states, names)])
##################### PBSSCRIPT #####################
pbs_string = '''#!/bin/bash -x
#SBATCH --account={account}
#SBATCH --nodes={nnodes}
#SBATCH --ntasks-per-node={ppn}
#SBATCH --export=ALL
#SBATCH --time={walltime}
#SBATCH --job-name={name}
###SBATCH --mem=176G. # uncomment to requrest specific memory (usually not needed)
#SBATCH --partition={queue}
####SBATCH --qos=high # uncommented if high qos is needed (usually not needed)
###SBATCH -o out
###SBATCH -e err
# Go to the directoy from which our job was launched
cd {directory}
# Make sure the library are loaded properly for vasp
source /nopt/nrel/apps/env.sh
module purge
module load anaconda3/2022.05
module load PrgEnv-intel/8.5.0
module swap cray-mpich cray-mpich-abi
module unload cray-libsci
module load intel-oneapi-compilers/2023.2.0
module load intel-oneapi-mkl/2023.2.0
module load intel-oneapi-mpi/2021.10.0-intel
source activate [path to virtual environment]
export OMP_NUM_THREADS=1 #turns off multithreading, needed for VASP
{header}
python {scriptcommand}
{footer}
'''