#!/bin/bash

# Without sourcing the  oneapi-vars.sh  script, the intel mpirun executable would not be found.
source /opt/intel/oneapi/2026.1/oneapi-vars.sh

source /dalsie/cp2k-2026.2/install/cp2k_env

# The following two settings are needed at least for hybrid-functional calculations.
# They are even necessary for any (small) pure OpenMP tasks on a machine with 16 GB RAM.
# See https://groups.google.com/g/cp2k/c/gxwY8WvJqTw/m/RScS0Q4vAQAJ?utm_medium=email&utm_source=footer&pli=1
export OMP_STACKSIZE=4G
ulimit -s 4194304

# For user's convenience write environment variables etc into the "info_on_paths_used" file.
rm -f info_on_paths_used
which mpirun > info_on_paths_used
which cp2k.psmp >> info_on_paths_used
ldd /dalsie/cp2k-2026.2/install/bin/cp2k.psmp >> info_on_paths_used

export OMP_NUM_THREADS=1
export I_MPI_PIN=1
export I_MPI_PIN_PROCESSOR_LIST=0-5
mpirun -np 6 cp2k.psmp -i cp2k.inp -o cp2k.out
