#!/bin/bash

#SBATCH --time=5:00:00   # walltime
#SBATCH --ntasks=1   # number of processor cores (i.e. tasks)
#SBATCH --nodes=1   # number of nodes
#SBATCH --mem-per-cpu=8192M   # memory per CPU core
#SBATCH -J "vina"   # job name
#SBATCH --array=0-5

#script to run all receptor/ligand combo docking runs in parallel using slurm. If your system doesn't use slurm, ignore this file.

receptors=("6XTV_dock" "6XTV_A219L_dock")

ligands=("histidine" "arginine" "lysine")

idx=0
for rec in "${receptors[@]}"; do
    for lig in "${ligands[@]}"; do
        if [ $idx -eq $SLURM_ARRAY_TASK_ID ]; then
            echo $rec
            echo $lig
            ./run_vina.sh -l ../ligands/${lig}.pdbqt -r ../receptors/${rec}.pdbqt
            exit
        fi 
        idx=$((idx+1))
    done
done
