#!/bin/bash
#SBATCH --partition=gpu-single
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --gres=gpu:1
#SBATCH --mem=32G
#SBATCH --time=36:00:00
#SBATCH --job-name=polar_scan
#SBATCH --output=polar_scan.out
#SBATCH --error=polar_scan.err

# ----------- Load MATLAB -----------
module load math/matlab/R2023a

# ----------- Set common environment variables -----------
export SCATTERING_LENGTH_RANGE="[95.62]"
export AZIMUTHAL_ANGLE_RANGE="[0.0]"
export NUM_ATOMS_LIST="[500000]"

# Loop over POLAR_ANGLE_RANGE values
polar_angles=(0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0)

for theta in "${polar_angles[@]}"; do
    export POLAR_ANGLE="$theta"
    echo "Running MATLAB for POLAR_ANGLE = $theta"

    matlab -nodisplay -nosplash -r "Scripts.run_on_cluster_wrapper(); exit"

    echo "Completed run for POLAR_ANGLE = $theta"
done
