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

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

View File

@ -1,20 +1,23 @@
function [psi] = setupWavefunction(~,Params,Transf)
format long
X = Transf.X;
Y = Transf.Y;
ellx = sqrt(Params.hbar/(Params.m*Params.wx))/Params.l0;
elly = sqrt(Params.hbar/(Params.m*Params.wy))/Params.l0;
Rx = 8*sqrt(2)*ellx;
Ry = 8*sqrt(2)*elly;
X0 = 0.0*Transf.Xmax;
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);
function [psi] = setupWavefunction(this, Params, Transf)
if this.BiasWithAnsatz
psi = this.setupCosineModulatedAnsatz(Params, Transf);
else
format long
X = Transf.X;
Y = Transf.Y;
ellx = sqrt(Params.hbar/(Params.m*Params.wx))/Params.l0;
elly = sqrt(Params.hbar/(Params.m*Params.wy))/Params.l0;
Rx = 8*sqrt(2)*ellx;
Ry = 8*sqrt(2)*elly;
X0 = 0.0*Transf.Xmax;
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);
end
end