#!/bin/bash
#SBATCH --job-name=BE_0
#SBATCH --exclusive  
#SBATCH --export=ALL
#SBATCH -t 2-0:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=128
#SBATCH -C rome
##SBATCH -p cmbas
#SBATCH -p preempt --qos=preempt

module purge
module load modules/2.1.1
module load slurm
module load gcc
module load openmpi
module load fftw/mpi-2
module load lib/openblas
module load lib/gsl
module load lib/hdf5

IC_code=/mnt/ceph/users/camels/Codes/2lpt/2LPTic
G3=/mnt/ceph/users/camels/Codes/Gadget_III/P-Gadget3


if [ ! -f ICs/ics.0 ]
then 
    cd ICs
    mpirun -np 8 $IC_code 2LPT.param >> logIC
    cd ..
fi

if [ ! -f snap_090.hdf5 ]
then
    if [ ! -f restartfiles/restart.0 ]
    then
        mpirun -np 122 $G3 G3.param >> logfile
    else
        mpirun -np 122 $G3 G3.param 1 >> logfile
    fi
fi
            

