#!/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=48:00:00 #SBATCH --job-name=theta_scan_serial #SBATCH --output=log_theta_scan.out #SBATCH --error=log_theta_scan.err module load math/matlab/R2023a # ----------- Define scan ranges ----------- # Use space-separated floating-point/integer values SCATTERING_LENGTH_RANGE="[95.62]" POLAR_ANGLE_RANGE="[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0]" AZIMUTHAL_ANGLE_RANGE="[0.0]" NUM_ATOMS_LIST="[500000]" # Strip brackets and spaces for looping polarAngles=($(echo "$POLAR_ANGLE_RANGE" | tr -d '[],')) # ----------- Run all polar angle jobs sequentially within one SLURM job ----------- for theta in "${polarAngles[@]}"; do echo "Running MATLAB for polar angle θ = $theta°" matlab -nodisplay -nosplash -r "\ setenv('SCATTERING_LENGTH_RANGE', '$SCATTERING_LENGTH_RANGE'); \ setenv('POLAR_ANGLE', '$theta'); \ setenv('AZIMUTHAL_ANGLE_RANGE', '$AZIMUTHAL_ANGLE_RANGE'); \ setenv('NUM_ATOMS_LIST', '$NUM_ATOMS_LIST'); \ Scripts.run_on_cluster_wrapper(); exit" echo "Finished MATLAB job for θ = $theta°" done