Minor modifications

This commit is contained in:
Karthik 2025-06-02 01:41:48 +02:00
parent f17628a23c
commit ef2eab89ec
2 changed files with 22 additions and 29 deletions

View File

@ -12,14 +12,15 @@ function run_on_cluster(batchParams, batchIdx)
phi_rad = deg2rad(phi_deg);
% Create unique save directory
parentDir = './Results/Data_3D/Tilt';
jobName = sprintf('aS_%03d_theta_%03d_phi_%03d_N_%d', a_s, theta_deg, phi_deg, N_atoms);
saveDir = fullfile('./Results/Data_3D/PhaseDiagram', jobName);
saveDir = fullfile(parentDir, jobName);
if ~exist(saveDir, 'dir')
mkdir(saveDir);
end
% Copy psi_init.mat from the parent folder into saveDir
srcFile = fullfile('./Results/Data_3D/PhaseDiagram', 'psi_init.mat');
srcFile = fullfile(parentDir, 'psi_init.mat');
destFile = fullfile(saveDir, 'psi_init.mat');
if exist(srcFile, 'file')
copyfile(srcFile, destFile);
@ -45,7 +46,7 @@ function run_on_cluster(batchParams, batchIdx)
OptionsStruct.MaxIterationsForGD = 15000;
OptionsStruct.TimeStepSize = 1E-3;
OptionsStruct.MinimumTimeStepSize = 1E-6;
OptionsStruct.TimeCutOff = 2E6;
OptionsStruct.TimeCutOff = 5E5;
OptionsStruct.EnergyTolerance = 5E-08;
OptionsStruct.ResidualTolerance = 1E-05;
OptionsStruct.NoiseScaleFactor = 0.010;
@ -65,7 +66,7 @@ function run_on_cluster(batchParams, batchIdx)
NumberOfOutputs = 5;
try
[Params, Transf, psi, ~, ~, stats] = Helper.runWithProfiling(@() sim.run(), NumberOfOutputs, saveDir);
save(fullfile('./Results/Data_3D/PhaseDiagram', 'psi_init.mat'), 'psi', 'Transf', 'Params');
save(fullfile(parentDir, 'psi_init.mat'), 'psi', 'Transf', 'Params');
catch ME
fprintf('ERROR in job %d:\n%s\n', k, getReport(ME, 'extended'));
continue;

View File

@ -5,35 +5,27 @@
#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
#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
# ----------- Define scan ranges -----------
# ----------- Set common environment variables -----------
export SCATTERING_LENGTH_RANGE="[95.62]"
export AZIMUTHAL_ANGLE_RANGE="[0.0]"
export NUM_ATOMS_LIST="[500000]"
# 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]"
# 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)
# Strip brackets and spaces for looping
polarAngles=($(echo "$POLAR_ANGLE_RANGE" | tr -d '[],'))
for theta in "${polar_angles[@]}"; do
export POLAR_ANGLE="$theta"
echo "Running MATLAB for POLAR_ANGLE = $theta"
# ----------- Run all polar angle jobs sequentially within one SLURM job -----------
matlab -nodisplay -nosplash -r "Scripts.run_on_cluster_wrapper(); exit"
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
echo "Completed run for POLAR_ANGLE = $theta"
done