From 4af0ce726a4ceb51b05fd831693bc745aee25069 Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Mon, 17 Mar 2025 15:07:05 +0100 Subject: [PATCH] Latest execution scripts, minor modification to analysis script for finding optimal system sizes. --- ...nalyzeGSWavefunction_optimal_system_size.m | 2 +- Dipolar-Gas-Simulator/+Scripts/run_locally.m | 17 ++-- .../run_on_cluster_optimal_system_size.m | 93 ++++++++++--------- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_optimal_system_size.m b/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_optimal_system_size.m index 1bdc761..b8bc491 100644 --- a/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_optimal_system_size.m +++ b/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_optimal_system_size.m @@ -68,5 +68,5 @@ function MinEnergyDataArray = analyzeGSWavefunction_optimal_system_size(folder_p ylabel(cbar1,'$E_{var}$','FontSize',16,'Rotation',270) xlabel('$L_x$','fontsize',16,'interpreter','latex'); ylabel('$L_y$','fontsize',16,'interpreter','latex'); - title('Minimum variational energy for different system sizes', 'FontSize', 16); + title('Minimum variational energy for different unit cell sizes', 'FontSize', 16); end diff --git a/Dipolar-Gas-Simulator/+Scripts/run_locally.m b/Dipolar-Gas-Simulator/+Scripts/run_locally.m index 7aa7ac4..32a7e59 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_locally.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_locally.m @@ -326,18 +326,23 @@ JobNumber = 1; [contrast, period_X, period_Y] = Scripts.analyzeGSWavefunction_in_plane_trap(SaveDirectory, JobNumber); %% -SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree0'; +SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree15'; % Define the desired range for Lx and Ly -Lx_Range = 2:0.4:6; % Extend Lx from 5 to 10 -Ly_Range = 2:0.4:6; % Extend Ly from 5 to 10 +Lx_Range = 4:0.4:11; % Extend Lx from 5 to 10 +Ly_Range = 4:0.4:11; % Extend Ly from 5 to 10 MinEnergyDataArray = Scripts.analyzeGSWavefunction_optimal_system_size(SaveDirectory, Lx_Range, Ly_Range); %% - Analysis SaveDirectory = './Results/Data_TiltingOfDipoles/HarmonicTrap/AspectRatio/AR2_8'; -JobNumber = 0; +JobNumber = 0; % 79 +% JobNumber = 1; % 80 +% JobNumber = 2; % 81 Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber) [contrast, period_X, period_Y] = Scripts.analyzeGSWavefunction_in_plane_trap(SaveDirectory, JobNumber); %% - Analysis -SaveDirectory = './Results/Data_TiltingOfDipoles/HarmonicTrap/AspectRatio/AR4_0'; -JobNumber = 0; +SaveDirectory = './Results/Data_TiltingOfDipoles/HarmonicTrap/AspectRatio/AR3_7'; +% JobNumber = 0; % 80 +% JobNumber = 1; % 81 +JobNumber = 2; % 82 +% JobNumber = 3; % 83 Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber) [contrast, period_X, period_Y] = Scripts.analyzeGSWavefunction_in_plane_trap(SaveDirectory, JobNumber); \ No newline at end of file diff --git a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_optimal_system_size.m b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_optimal_system_size.m index 37a4df6..a0ea3e2 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_optimal_system_size.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_optimal_system_size.m @@ -5,56 +5,61 @@ ppum = 1250; %% theta = 0 -idx = 0; +Lx = 8:0.4:11; +Ly = 4:0.4:11; +cluster = parcluster; -% Loop over Lx and Ly values -for Lx = 2:0.4:6 - for Ly = 2:0.4:6 +% Create a combined index for all i, j pairs +[I, J] = ndgrid(1:numel(Lx), 1:numel(Ly)); +totalIterations = numel(I); - % Initialize OptionsStruct - OptionsStruct = struct; +% Parallel loop over all combinations of i, j +parfor (k = 1:totalIterations, cluster) + i = I(k); + j = J(k); + lx = Lx(i); + ly = Ly(j); - % Assign values to OptionsStruct - OptionsStruct.NumberOfAtoms = ppum * (Lx*Ly); - OptionsStruct.DipolarPolarAngle = 0; - OptionsStruct.DipolarAzimuthAngle = 0; - OptionsStruct.ScatteringLength = 75.00; + % Initialize OptionsStruct + OptionsStruct = struct; - OptionsStruct.TrapFrequencies = [0, 0, 500]; - OptionsStruct.TrapPotentialType = 'None'; + % Assign values to OptionsStruct + OptionsStruct.NumberOfAtoms = ppum * (lx*ly); + OptionsStruct.DipolarPolarAngle = deg2rad(15); + OptionsStruct.DipolarAzimuthAngle = 0; + OptionsStruct.ScatteringLength = 75.00; - OptionsStruct.NumberOfGridPoints = [128, 128]; - OptionsStruct.Dimensions = [Lx, Ly]; - OptionsStruct.TimeStepSize = 1E-4; % in s - OptionsStruct.MinimumTimeStepSize = 1E-5; % in s - OptionsStruct.TimeCutOff = 1E6; % in s - OptionsStruct.EnergyTolerance = 5E-10; - OptionsStruct.ResidualTolerance = 1E-05; - OptionsStruct.NoiseScaleFactor = 0.05; - OptionsStruct.IncludeDDICutOff = false; - - OptionsStruct.MaxIterations = 10; - OptionsStruct.VariationalWidth = 1.00; - OptionsStruct.WidthLowerBound = 0.01; - OptionsStruct.WidthUpperBound = 12; - OptionsStruct.WidthCutoff = 1e-2; + OptionsStruct.TrapFrequencies = [0, 0, 500]; + OptionsStruct.TrapPotentialType = 'None'; - OptionsStruct.PlotLive = false; - OptionsStruct.JobNumber = idx; - OptionsStruct.RunOnGPU = true; - OptionsStruct.SaveData = true; - OptionsStruct.SaveDirectory = sprintf('./Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree%i', rad2deg(OptionsStruct.DipolarPolarAngle)); - - options = Helper.convertstruct2cell(OptionsStruct); - clear OptionsStruct + OptionsStruct.NumberOfGridPoints = [128, 128]; + OptionsStruct.Dimensions = [lx, ly]; + OptionsStruct.TimeStepSize = 1E-3; % in s + OptionsStruct.MinimumTimeStepSize = 1E-5; % in s + OptionsStruct.TimeCutOff = 2E6; % in s + OptionsStruct.EnergyTolerance = 5E-10; + OptionsStruct.ResidualTolerance = 1E-05; + OptionsStruct.NoiseScaleFactor = 0.05; + OptionsStruct.IncludeDDICutOff = false; - solver = VariationalSolver2D.DipolarGas(options{:}); - pot = VariationalSolver2D.Potentials(options{:}); - solver.Potential = pot.trap(); - - % Run Solver - [Params, Transf, psi, V, VDk] = solver.run(); + OptionsStruct.MaxIterations = 10; + OptionsStruct.VariationalWidth = 1.20; + OptionsStruct.WidthLowerBound = 0.01; + OptionsStruct.WidthUpperBound = 12; + OptionsStruct.WidthCutoff = 1e-2; - idx = idx + 1; - end + OptionsStruct.PlotLive = false; + OptionsStruct.JobNumber = (i - 1) * num_inner + j; + OptionsStruct.RunOnGPU = true; + OptionsStruct.SaveData = true; + OptionsStruct.SaveDirectory = sprintf('./Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree%i', round(rad2deg(OptionsStruct.DipolarPolarAngle))); + + options = Helper.convertstruct2cell(OptionsStruct); + + solver = VariationalSolver2D.DipolarGas(options{:}); + pot = VariationalSolver2D.Potentials(options{:}); + solver.Potential = pot.trap(); + + % Run Solver + [Params, Transf, psi, V, VDk] = solver.run(); end