diff --git a/Dipolar-Gas-Simulator/+Scripts/run_locally.m b/Dipolar-Gas-Simulator/+Scripts/run_locally.m index 16498e4..f01fb52 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_locally.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_locally.m @@ -60,13 +60,19 @@ OptionsStruct.ScatteringLength = 98.0676; % Critical point: 102.515; OptionsStruct.TrapFrequencies = [10, 10, 72.4]; OptionsStruct.TrapPotentialType = 'None'; -OptionsStruct.NumberOfGridPoints = [128, 128]; +OptionsStruct.NumberOfGridPoints = [256, 256]; OptionsStruct.Dimensions = [7.5, 7.5]; % Critical point: 6.996; Triangular phase: 7.5; Stripe phase: 6.972; Honeycomb phase: 6.239 for both for Atom Number fixed to 1E5 OptionsStruct.TimeStepSize = 200E-6; % in s OptionsStruct.TimeCutOff = 100; % in s OptionsStruct.EnergyTolerance = 5E-10; OptionsStruct.ResidualTolerance = 1E-05; +OptionsStruct.MaxIterations = 20; +OptionsStruct.VariationalWidth = 4; +OptionsStruct.WidthLowerBound = 5; +OptionsStruct.WidthUpperBound = 8; +OptionsStruct.WidthCutoff = 1e-3; + OptionsStruct.JobNumber = 1; OptionsStruct.RunOnGPU = false; OptionsStruct.SaveData = true; diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/DipolarGas.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/DipolarGas.m index b2446c7..54c5ff8 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/DipolarGas.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/DipolarGas.m @@ -17,6 +17,12 @@ classdef DipolarGas < handle & matlab.mixin.Copyable EnergyTolerance; ResidualTolerance; + MaxIterations; + VariationalWidth; + WidthLowerBound; + WidthUpperBound; + WidthCutoff; + Calculator; SimulationParameters; @@ -60,6 +66,16 @@ classdef DipolarGas < handle & matlab.mixin.Copyable @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'ResidualTolerance', 1e-10,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); + addParameter(p, 'MaxIterations', 20,... + @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); + addParameter(p, 'VariationalWidth', 4,... + @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); + addParameter(p, 'WidthLowerBound', 2,... + @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); + addParameter(p, 'WidthUpperBound', 12,... + @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); + addParameter(p, 'WidthCutoff', 1e-2,... + @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'JobNumber', 1,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'RunOnGPU', false,... @@ -86,6 +102,13 @@ classdef DipolarGas < handle & matlab.mixin.Copyable this.TimeCutOff = p.Results.TimeCutOff; this.EnergyTolerance = p.Results.EnergyTolerance; this.ResidualTolerance = p.Results.ResidualTolerance; + + this.MaxIterations = p.Results.MaxIterations; + this.VariationalWidth = p.Results.VariationalWidth; + this.WidthLowerBound = p.Results.WidthUpperBound; + this.WidthUpperBound = p.Results.WidthUpperBound; + this.WidthCutoff = p.Results.WidthCutoff; + this.JobNumber = p.Results.JobNumber; this.RunOnGPU = p.Results.RunOnGPU; this.DebugMode = p.Results.DebugMode; diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m index fbb6d4d..dcb0d86 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m @@ -1,4 +1,4 @@ -function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, V, t_idx, Observ) +function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, V, t_idx, Observ) set(0,'defaulttextInterpreter','latex') set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m index b283ca0..253203f 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m @@ -23,7 +23,6 @@ function [Params, Transf, psi, V, VDk] = run(this) mkdir(sprintf(this.SaveDirectory)) mkdir(sprintf('./Data/Run_%03i',Params.njob)) fminconoptions = optimoptions('fmincon','Display','off','StepTolerance',1e-8); - [psi,V,VDk] = this.initialize(Params,VParams,Transf); ells(1) = VParams.ell; @@ -49,7 +48,7 @@ function [Params, Transf, psi, V, VDk] = run(this) psi = psi + 0.25*noise; % --- Run --- - [psi] = this.propagateWavefunction(psi, Params, VParams, Transf, VDk, V, t_idx, Observ); + [psi, Observ] = this.propagateWavefunction(psi, Params, VParams, Transf, VDk, V, t_idx, Observ); psi = gather(psi); % --- Constrained minimization --- diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupParameters.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupParameters.m index 85e204e..e7fd853 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupParameters.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupParameters.m @@ -51,15 +51,15 @@ function [Params] = setupParameters(this) % ================ Variational method parameters ================ % % FMinCon Settings - Params.SelfConIter = 20; % Max number of iterations to perform self-consistent calculation - Params.ell = 4; % initial [ell], ell is the "width" - psi ~ e^(z^2/ell^2) + Params.SelfConIter = this.MaxIterations; % Max number of iterations to perform self-consistent calculation + Params.ell = this.VariationalWidth; % initial [ell], ell is the "width" - psi ~ e^(z^2/ell^2) % Window of optimization - Params.ell_lower = 0.2; - Params.ell_upper = 12; + Params.ell_lower = this.WidthLowerBound; + Params.ell_upper = this.WidthUpperBound; % Relative cutoffs - Params.ellcutoff = 1e-2; + Params.ellcutoff = this.WidthCutoff; % ================ Parameters defined by those above ================ %