From 10ed5472afd07794d7988b1459d90422989ddabc Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Thu, 20 Mar 2025 16:06:41 +0100 Subject: [PATCH] Latest version of solver with additions to initialize with modulated states to bias the solver. --- ...function_constrained_optimal_system_size.m | 79 +++++ Dipolar-Gas-Simulator/+Scripts/run_locally.m | 32 +- .../+Scripts/run_on_cluster.m | 4 +- .../run_on_cluster_adjusted_system_size.m | 299 ++++-------------- .../run_on_cluster_optimal_system_size.m | 2 + .../@DipolarGas/setupCosineModulatedAnsatz.m | 49 +++ 6 files changed, 221 insertions(+), 244 deletions(-) create mode 100644 Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_constrained_optimal_system_size.m create mode 100644 Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupCosineModulatedAnsatz.m diff --git a/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_constrained_optimal_system_size.m b/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_constrained_optimal_system_size.m new file mode 100644 index 0000000..9ac2427 --- /dev/null +++ b/Dipolar-Gas-Simulator/+Scripts/analyzeGSWavefunction_constrained_optimal_system_size.m @@ -0,0 +1,79 @@ +function MinEnergyDataArray = analyzeGSWavefunction_constrained_optimal_system_size(folder_path, LatticeSpacing) + + % Initialize matrix to store [Lx, Ly, minEnergy] + MinEnergyDataArray = []; + + % Get a list of all subfolders in the parent folder + subfolders = dir(fullfile(folder_path, 'Run_*')); + + % Loop through each subfolder + for i = 1:length(subfolders) + % Get the full path of the current subfolder + subfolder_path = fullfile(subfolders(i).folder, subfolders(i).name); + + % Check if the current item is a folder + if subfolders(i).isdir + % Load the data file from the current folder + data_file = fullfile(subfolder_path, 'psi_gs.mat'); + if isfile(data_file) + % Load required variables from the .mat file + Data = load(data_file, 'Params', 'VParams'); + + % Extract Lx and Ly from Params.Dimensions + Lx = Data.Params.Lx; + Ly = Data.Params.Ly; + + % Extract the minimum energy from VParams.E_vs_iter + try + minEnergy = min(gather(Data.VParams.E_vs_iter)); + catch + minEnergy = NaN; + end + + % Append [Lx, Ly, minEnergy] to the results array + MinEnergyDataArray(end + 1, :) = [Lx, Ly, minEnergy]; + else + fprintf('Warning: File psi_gs.mat not found in %s\n', subfolder_path); + end + end + end + + % Initialize arrays to store values + Lx_Range = zeros(1, length(LatticeSpacing)); + Ly_Range = zeros(1, length(LatticeSpacing)); + MinEnergyDataValues = zeros(1, length(LatticeSpacing)); + + % Loop through the values of LatticeSpacing + for i = 1:length(LatticeSpacing) + a = LatticeSpacing(i); + % Calculate Lx and Ly based on the given conditions + lx = a; + ly = sqrt(3) * a; + for idx = 1:size(MinEnergyDataArray, 1) + Lx = MinEnergyDataArray(idx, 1); + Ly = MinEnergyDataArray(idx, 2); + energy = MinEnergyDataArray(idx, 3); + tolerance = 1e-10; % Define a small tolerance + if (abs(Lx - lx) < tolerance) && (abs(Ly - ly) < tolerance) + Lx_Range(i) = Lx; + Ly_Range(i) = Ly; + MinEnergyDataValues(i) = energy; + elseif MinEnergyDataValues(i)==0 || isnan(MinEnergyDataValues(i)) + Lx_Range(i) = NaN; + Ly_Range(i) = NaN; + MinEnergyDataValues(i) = NaN; + end + end + end + + figure + clf + set(gcf,'Position',[50 50 950 750]) + set(gca,'FontSize',16,'Box','On','Linewidth',2); + plot(LatticeSpacing, MinEnergyDataValues, Marker = "o", LineWidth=2.0); + xlim([min(LatticeSpacing) max(LatticeSpacing)]) + xlabel('$a$','fontsize',16,'interpreter','latex'); + ylabel('$E_{var}$','fontsize',16,'interpreter','latex'); + title('Minimum variational energy for different (constrained) unit cell sizes', 'FontSize', 16); + grid on +end diff --git a/Dipolar-Gas-Simulator/+Scripts/run_locally.m b/Dipolar-Gas-Simulator/+Scripts/run_locally.m index 1c9acfc..444987f 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_locally.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_locally.m @@ -337,8 +337,36 @@ SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSys % Define the desired range LatticeSpacing = 1.0:0.05:4.0; MinEnergyDataArray = Scripts.analyzeGSWavefunction_constrained_optimal_system_size(SaveDirectory, LatticeSpacing); -% Plotter.visualizeGSWavefunction2D(SaveDirectory, 1) - +% Plotter.visualizeGSWavefunction2D(SaveDirectory, 17) +% [contrast, periodX, periodY] = Scripts.analyzeGSWavefunction(SaveDirectory, 17); +%% +SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree5'; +% Define the desired range +LatticeSpacing = 1.0:0.05:4.0; +% MinEnergyDataArray = Scripts.analyzeGSWavefunction_constrained_optimal_system_size(SaveDirectory, LatticeSpacing); +% Plotter.visualizeGSWavefunction2D(SaveDirectory, 17) +[contrast, periodX, periodY] = Scripts.analyzeGSWavefunction(SaveDirectory, 17); +%% +SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree7_5'; +% Define the desired range +LatticeSpacing = 1.0:0.05:4.0; +% MinEnergyDataArray = Scripts.analyzeGSWavefunction_constrained_optimal_system_size(SaveDirectory, LatticeSpacing); +% Plotter.visualizeGSWavefunction2D(SaveDirectory, 17) +[contrast, periodX, periodY] = Scripts.analyzeGSWavefunction(SaveDirectory, 17); +%% +SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree10'; +% Define the desired range +LatticeSpacing = 1.0:0.05:4.0; +MinEnergyDataArray = Scripts.analyzeGSWavefunction_constrained_optimal_system_size(SaveDirectory, LatticeSpacing); +% Plotter.visualizeGSWavefunction2D(SaveDirectory, 17) +[contrast, periodX, periodY] = Scripts.analyzeGSWavefunction(SaveDirectory, 22); +%% +SaveDirectory = './Results/Data_TiltingOfDipoles/TransitionAngle/OptimalSystemSize/Hz500/Degree15'; +% Define the desired range +LatticeSpacing = 1.0:0.05:4.0; +MinEnergyDataArray = Scripts.analyzeGSWavefunction_constrained_optimal_system_size(SaveDirectory, LatticeSpacing); +% Plotter.visualizeGSWavefunction2D(SaveDirectory, 17) +% [contrast, periodX, periodY] = Scripts.analyzeGSWavefunction(SaveDirectory, 22); %% - Analysis SaveDirectory = './Results/Data_TiltingOfDipoles/HarmonicTrap/AspectRatio/AR2_8'; JobNumber = 0; % 79 diff --git a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster.m b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster.m index 0477329..1cb045f 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster.m @@ -48,6 +48,8 @@ parfor (k = 1:totalIterations, cluster) OptionsStruct.EnergyTolerance = 5E-10; OptionsStruct.ResidualTolerance = 1E-05; OptionsStruct.NoiseScaleFactor = 0.05; + OptionsStruct.BiasWithAnsatz = true; + OptionsStruct.Ansatz = 'triangular'; OptionsStruct.IncludeDDICutOff = false; OptionsStruct.MaxIterations = 10; @@ -71,4 +73,4 @@ parfor (k = 1:totalIterations, cluster) % Run Solver [Params, Transf, psi, V, VDk] = solver.run(); -end \ No newline at end of file +end diff --git a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_adjusted_system_size.m b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_adjusted_system_size.m index 18385dc..c1ce511 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_adjusted_system_size.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_on_cluster_adjusted_system_size.m @@ -1,39 +1,49 @@ %% Tilting of the dipoles % Atom Number = 1250 ppum -% System size = [5 * l_rot, 5 * l_rot] +% System size = [sf * unitcell_x, sf * unitcell_x] -%% v_z = 500, theta = 0: a_s = 76.41 +ppum = 1250; % Atom Number Density in per micrometers -OptionsStruct = struct; +%% v_z = 500, theta = 0: a_s = 76.00 -OptionsStruct.NumberOfAtoms = 101250; -OptionsStruct.DipolarPolarAngle = 0; +a = 1.8; +scalingfactor = 5; +lx = scalingfactor*a; +ly = scalingfactor*sqrt(3)*a; + +% Initialize OptionsStruct +OptionsStruct = struct; + +% Assign values to OptionsStruct +OptionsStruct.NumberOfAtoms = ppum * (lx*ly); +OptionsStruct.DipolarPolarAngle = deg2rad(0); OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 76.41; +OptionsStruct.ScatteringLength = 76.00; OptionsStruct.TrapFrequencies = [0, 0, 500]; OptionsStruct.TrapPotentialType = 'None'; OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [9, 9]; -OptionsStruct.TimeStepSize = 0.005; % in s +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; OptionsStruct.MaxIterations = 10; -OptionsStruct.VariationalWidth = 1.2; +OptionsStruct.VariationalWidth = 1.15; OptionsStruct.WidthLowerBound = 0.01; OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; +OptionsStruct.WidthCutoff = 1e-2; OptionsStruct.PlotLive = false; OptionsStruct.JobNumber = 0; OptionsStruct.RunOnGPU = true; OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz500'; +OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/SystemSize100squm/Hz500'; options = Helper.convertstruct2cell(OptionsStruct); clear OptionsStruct @@ -44,38 +54,46 @@ solver.Potential = pot.trap(); %-% Run Solver %-% [Params, Transf, psi, V, VDk] = solver.run(); -%% v_z = 500, theta = 15: a_s = 77.45 +%% v_z = 500, theta = 7.5: a_s = 76.00 -OptionsStruct = struct; +a = 1.5; +scalingfactor = 5; +lx = scalingfactor*a; +ly = scalingfactor*sqrt(3)*a; -OptionsStruct.NumberOfAtoms = 101250; -OptionsStruct.DipolarPolarAngle = deg2rad(15); +% Initialize OptionsStruct +OptionsStruct = struct; + +% Assign values to OptionsStruct +OptionsStruct.NumberOfAtoms = ppum * (lx*ly); +OptionsStruct.DipolarPolarAngle = deg2rad(7.5); OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 77.45; +OptionsStruct.ScatteringLength = 76.00; OptionsStruct.TrapFrequencies = [0, 0, 500]; OptionsStruct.TrapPotentialType = 'None'; OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [9, 9]; -OptionsStruct.TimeStepSize = 0.005; % in s +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; OptionsStruct.MaxIterations = 10; -OptionsStruct.VariationalWidth = 1.2; +OptionsStruct.VariationalWidth = 1.15; OptionsStruct.WidthLowerBound = 0.01; OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; +OptionsStruct.WidthCutoff = 1e-2; OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 1; +OptionsStruct.JobNumber = 2; OptionsStruct.RunOnGPU = true; OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz500'; +OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/SystemSize100squm/Hz500'; options = Helper.convertstruct2cell(OptionsStruct); clear OptionsStruct @@ -86,80 +104,46 @@ solver.Potential = pot.trap(); %-% Run Solver %-% [Params, Transf, psi, V, VDk] = solver.run(); -%% v_z = 750, theta = 0: a_s = 70.5 +%% v_z = 500, theta = 15: a_s = 76.00 -OptionsStruct = struct; +a = 1.05; +scalingfactor = 5; +lx = scalingfactor*a; +ly = scalingfactor*sqrt(3)*a; -OptionsStruct.NumberOfAtoms = 61250; -OptionsStruct.DipolarPolarAngle = 0; -OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 70.5; +% Initialize OptionsStruct +OptionsStruct = struct; -OptionsStruct.TrapFrequencies = [0, 0, 750]; -OptionsStruct.TrapPotentialType = 'None'; - -OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [7, 7]; -OptionsStruct.TimeStepSize = 0.005; % 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.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.85; -OptionsStruct.WidthLowerBound = 0.01; -OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; - -OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 0; -OptionsStruct.RunOnGPU = true; -OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz750'; -options = Helper.convertstruct2cell(OptionsStruct); -clear OptionsStruct - -solver = VariationalSolver2D.DipolarGas(options{:}); -pot = VariationalSolver2D.Potentials(options{:}); -solver.Potential = pot.trap(); - -%-% Run Solver %-% -[Params, Transf, psi, V, VDk] = solver.run(); - -%% v_z = 750, theta = 15: a_s = 72.5 - -OptionsStruct = struct; - -OptionsStruct.NumberOfAtoms = 61250; +% Assign values to OptionsStruct +OptionsStruct.NumberOfAtoms = ppum * (lx*ly); OptionsStruct.DipolarPolarAngle = deg2rad(15); OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 72.5; +OptionsStruct.ScatteringLength = 76.00; -OptionsStruct.TrapFrequencies = [0, 0, 750]; +OptionsStruct.TrapFrequencies = [0, 0, 500]; OptionsStruct.TrapPotentialType = 'None'; OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [7, 7]; -OptionsStruct.TimeStepSize = 0.005; % in s +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; OptionsStruct.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.85; +OptionsStruct.VariationalWidth = 1.15; OptionsStruct.WidthLowerBound = 0.01; OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; +OptionsStruct.WidthCutoff = 1e-2; OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 1; +OptionsStruct.JobNumber = 2; OptionsStruct.RunOnGPU = true; OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz750'; +OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/SystemSize100squm/Hz500'; options = Helper.convertstruct2cell(OptionsStruct); clear OptionsStruct @@ -170,170 +154,3 @@ solver.Potential = pot.trap(); %-% Run Solver %-% [Params, Transf, psi, V, VDk] = solver.run(); -%% v_z = 1000, theta = 0: a_s = 65.95 - -OptionsStruct = struct; - -OptionsStruct.NumberOfAtoms = 45000; -OptionsStruct.DipolarPolarAngle = 0; -OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 65.95; - -OptionsStruct.TrapFrequencies = [0, 0, 1000]; -OptionsStruct.TrapPotentialType = 'None'; - -OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [6, 6]; -OptionsStruct.TimeStepSize = 0.005; % 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.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.7; -OptionsStruct.WidthLowerBound = 0.01; -OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; - -OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 0; -OptionsStruct.RunOnGPU = true; -OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz1000'; -options = Helper.convertstruct2cell(OptionsStruct); -clear OptionsStruct - -solver = VariationalSolver2D.DipolarGas(options{:}); -pot = VariationalSolver2D.Potentials(options{:}); -solver.Potential = pot.trap(); - -%-% Run Solver %-% -[Params, Transf, psi, V, VDk] = solver.run(); - -%% v_z = 1000, theta = 15: a_s = 67.25 - -OptionsStruct = struct; - -OptionsStruct.NumberOfAtoms = 45000; -OptionsStruct.DipolarPolarAngle = deg2rad(15); -OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 67.25; - -OptionsStruct.TrapFrequencies = [0, 0, 1000]; -OptionsStruct.TrapPotentialType = 'None'; - -OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [6, 6]; -OptionsStruct.TimeStepSize = 0.005; % 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.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.7; -OptionsStruct.WidthLowerBound = 0.01; -OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; - -OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 1; -OptionsStruct.RunOnGPU = true; -OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz1000'; -options = Helper.convertstruct2cell(OptionsStruct); -clear OptionsStruct - -solver = VariationalSolver2D.DipolarGas(options{:}); -pot = VariationalSolver2D.Potentials(options{:}); -solver.Potential = pot.trap(); - -%-% Run Solver %-% -[Params, Transf, psi, V, VDk] = solver.run(); - -%% v_z = 2000, theta = 0: a_s = 54.90 - -OptionsStruct = struct; - -OptionsStruct.NumberOfAtoms = 31250; -OptionsStruct.DipolarPolarAngle = 0; -OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 54.90; - -OptionsStruct.TrapFrequencies = [0, 0, 2000]; -OptionsStruct.TrapPotentialType = 'None'; - -OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [5, 5]; -OptionsStruct.TimeStepSize = 0.005; % 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.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.5; -OptionsStruct.WidthLowerBound = 0.01; -OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; - -OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 0; -OptionsStruct.RunOnGPU = true; -OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz2000'; -options = Helper.convertstruct2cell(OptionsStruct); -clear OptionsStruct - -solver = VariationalSolver2D.DipolarGas(options{:}); -pot = VariationalSolver2D.Potentials(options{:}); -solver.Potential = pot.trap(); - -%-% Run Solver %-% -[Params, Transf, psi, V, VDk] = solver.run(); - -%% v_z = 2000, theta = 15: a_s = 55.5 - -OptionsStruct = struct; - -OptionsStruct.NumberOfAtoms = 31250; -OptionsStruct.DipolarPolarAngle = deg2rad(15); -OptionsStruct.DipolarAzimuthAngle = 0; -OptionsStruct.ScatteringLength = 55.5; - -OptionsStruct.TrapFrequencies = [0, 0, 2000]; -OptionsStruct.TrapPotentialType = 'None'; - -OptionsStruct.NumberOfGridPoints = [128, 128]; -OptionsStruct.Dimensions = [5, 5]; -OptionsStruct.TimeStepSize = 0.005; % 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.MaxIterations = 10; -OptionsStruct.VariationalWidth = 0.5; -OptionsStruct.WidthLowerBound = 0.01; -OptionsStruct.WidthUpperBound = 12; -OptionsStruct.WidthCutoff = 5e-3; - -OptionsStruct.PlotLive = false; -OptionsStruct.JobNumber = 1; -OptionsStruct.RunOnGPU = true; -OptionsStruct.SaveData = true; -OptionsStruct.SaveDirectory = './Results/Data_TiltingOfDipoles/AdjustedSystemSize/Hz2000'; -options = Helper.convertstruct2cell(OptionsStruct); -clear OptionsStruct - -solver = VariationalSolver2D.DipolarGas(options{:}); -pot = VariationalSolver2D.Potentials(options{:}); -solver.Potential = pot.trap(); - -%-% Run Solver %-% -[Params, Transf, psi, V, VDk] = solver.run(); \ 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 e68b4f5..998b317 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 @@ -52,6 +52,8 @@ parfor (k = 1:totalIterations, cluster) OptionsStruct.EnergyTolerance = 5E-10; OptionsStruct.ResidualTolerance = 1E-05; OptionsStruct.NoiseScaleFactor = 0.05; + OptionsStruct.BiasWithAnsatz = true; + OptionsStruct.Ansatz = 'triangular'; OptionsStruct.IncludeDDICutOff = false; OptionsStruct.MaxIterations = 10; diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupCosineModulatedAnsatz.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupCosineModulatedAnsatz.m new file mode 100644 index 0000000..3a13cd1 --- /dev/null +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupCosineModulatedAnsatz.m @@ -0,0 +1,49 @@ +function [psi] = setupCosineModulatedAnsatz(this, Params, Transf) + + format long + + % Extract transformation coordinates + X = Transf.X; + Y = Transf.Y; + + % Check the BiasAnsatz and apply the corresponding function + if strcmp(this.Ansatz, 'stripe') + % STRIPES 2-D + % Parameters + c = 1; % Fourier coefficient + k = 2 * pi / Params.Lx; % Wavenumber + n = 2; % Order + % Define the 2D function for stripes + psi = (1 + (c * cos(n * k * Y))) / (1 + (0.5 * c^2)); + + elseif strcmp(this.Ansatz, 'triangular') + % TRIANGULAR LATTICE 2-D + % Parameters + c1 = 0.2; + c2 = 0.2; + k = 2 * pi / Params.Lx; % Wavenumber + n = 1; + % Define the 2D function for a triangular lattice + psi = 1 + (c1 * cos(n * k * (2/sqrt(3)) * Y)) + ... + (2 * c2 * cos(n * k * (1/sqrt(3)) * Y) .* cos(n * k * X)); + + elseif strcmp(this.Ansatz, 'honeycomb') + % HONEYCOMB LATTICE 2-D + % Parameters + c1 = 0.2; + c2 = 0.2; + k = 2 * pi / Params.Lx; % Wavenumber + n = 1; + % Define the 2D function for a honeycomb lattice + psi = 1 - (c1 * cos(n * k * (2/sqrt(3)) * X)) - ... + (2 * c2 * cos(n * k * (1/sqrt(3)) * X) .* cos(n * k * Y)); + + else + error('Unknown Ansatz type'); + end + + % Normalize the result + Norm = sum(abs(psi(:)).^2) * Transf.dx * Transf.dy; + psi = sqrt(Params.N) * psi / sqrt(Norm); + +end