Latest version of solver with additions to initialize with modulated states to bias the solver.

This commit is contained in:
Karthik 2025-03-20 16:09:37 +01:00
parent 10ed5472af
commit 684f419cdd
2 changed files with 32 additions and 19 deletions

View File

@ -18,6 +18,9 @@ classdef DipolarGas < handle & matlab.mixin.Copyable
ResidualTolerance; ResidualTolerance;
NoiseScaleFactor; NoiseScaleFactor;
BiasWithAnsatz;
Ansatz;
MaxIterations; MaxIterations;
VariationalWidth; VariationalWidth;
WidthLowerBound; WidthLowerBound;
@ -85,6 +88,10 @@ classdef DipolarGas < handle & matlab.mixin.Copyable
@(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); @(x) assert(isnumeric(x) && isscalar(x) && (x > 0)));
addParameter(p, 'JobNumber', 0,... addParameter(p, 'JobNumber', 0,...
@(x) assert(isnumeric(x) && isscalar(x) && (x >= 0))); @(x) assert(isnumeric(x) && isscalar(x) && (x >= 0)));
addParameter(p, 'BiasWithAnsatz', false,...
@islogical);
addParameter(p, 'Ansatz', 'None',...
@ischar);
addParameter(p, 'IncludeDDICutOff', true,... addParameter(p, 'IncludeDDICutOff', true,...
@islogical); @islogical);
addParameter(p, 'PlotLive', false,... addParameter(p, 'PlotLive', false,...
@ -115,6 +122,9 @@ classdef DipolarGas < handle & matlab.mixin.Copyable
this.ResidualTolerance = p.Results.ResidualTolerance; this.ResidualTolerance = p.Results.ResidualTolerance;
this.NoiseScaleFactor = p.Results.NoiseScaleFactor; this.NoiseScaleFactor = p.Results.NoiseScaleFactor;
this.BiasWithAnsatz = p.Results.BiasWithAnsatz;
this.Ansatz = p.Results.Ansatz;
this.MaxIterations = p.Results.MaxIterations; this.MaxIterations = p.Results.MaxIterations;
this.VariationalWidth = p.Results.VariationalWidth; this.VariationalWidth = p.Results.VariationalWidth;
this.WidthLowerBound = p.Results.WidthLowerBound; this.WidthLowerBound = p.Results.WidthLowerBound;

View File

@ -1,20 +1,23 @@
function [psi] = setupWavefunction(~,Params,Transf) function [psi] = setupWavefunction(this, Params, Transf)
format long if this.BiasWithAnsatz
psi = this.setupCosineModulatedAnsatz(Params, Transf);
else
format long
X = Transf.X; X = Transf.X;
Y = Transf.Y; Y = Transf.Y;
ellx = sqrt(Params.hbar/(Params.m*Params.wx))/Params.l0; ellx = sqrt(Params.hbar/(Params.m*Params.wx))/Params.l0;
elly = sqrt(Params.hbar/(Params.m*Params.wy))/Params.l0; elly = sqrt(Params.hbar/(Params.m*Params.wy))/Params.l0;
Rx = 8*sqrt(2)*ellx; Rx = 8*sqrt(2)*ellx;
Ry = 8*sqrt(2)*elly; Ry = 8*sqrt(2)*elly;
X0 = 0.0*Transf.Xmax; X0 = 0.0*Transf.Xmax;
Y0 = 0.0*Transf.Ymax; Y0 = 0.0*Transf.Ymax;
psi = exp(-(X-X0).^2/Rx^2-(Y-Y0).^2/Ry^2);
Norm = sum(abs(psi(:)).^2)*Transf.dx*Transf.dy;
psi = sqrt(Params.N)*psi/sqrt(Norm);
psi = exp(-(X-X0).^2/Rx^2-(Y-Y0).^2/Ry^2);
Norm = sum(abs(psi(:)).^2)*Transf.dx*Transf.dy;
psi = sqrt(Params.N)*psi/sqrt(Norm);
end
end end