Modified Potentials class to have only either no potential or a harmonic one, as for other trapping potentials, the rest of the solver would need modification.

This commit is contained in:
Karthik 2024-11-20 15:22:26 +01:00
parent 34a11f0c6a
commit 10ccf5ac0a
2 changed files with 2 additions and 31 deletions

View File

@ -3,16 +3,12 @@ classdef Potentials < handle & matlab.mixin.Copyable
properties (Access = private)
PotentialDefaults = struct('TrapPotentialType', 'Harmonic', ...
'TrapFrequencies', 100 * ones(1,3), ...
'TrapDepth', 10, ...
'BoxSize', 5);
'TrapFrequencies', 100 * ones(1,2));
end
properties (Access = public)
TrapPotentialType;
TrapFrequencies;
TrapDepth;
BoxSize;
NumberOfGridPoints;
Dimensions;
SimulationParameters;
@ -31,10 +27,6 @@ classdef Potentials < handle & matlab.mixin.Copyable
@(x) assert(any(strcmpi(x,{'None','Harmonic','SquareBox','RoundBox'}))));
addParameter(p, 'TrapFrequencies', this.PotentialDefaults.TrapFrequencies,...
@(x) assert(isnumeric(x) && isvector(x) && all(x > 0)));
addParameter(p, 'TrapDepth', this.PotentialDefaults.TrapDepth,...
@(x) assert(isnumeric(x) && isscalar(x) && (x > 0)));
addParameter(p, 'BoxSize', this.PotentialDefaults.BoxSize,...
@(x) assert(isnumeric(x) && isscalar(x) && (x > 0)));
addParameter(p, 'NumberOfGridPoints', 128 * ones(1,3),...
@(x) assert(isnumeric(x) && isvector(x) && all(x > 0)));
addParameter(p, 'Dimensions', 10 * ones(1,3),...
@ -44,8 +36,6 @@ classdef Potentials < handle & matlab.mixin.Copyable
this.TrapPotentialType = p.Results.TrapPotentialType;
this.TrapFrequencies = p.Results.TrapFrequencies;
this.TrapDepth = p.Results.TrapDepth;
this.BoxSize = p.Results.BoxSize;
this.NumberOfGridPoints = p.Results.NumberOfGridPoints;
this.Dimensions = p.Results.Dimensions;
@ -67,21 +57,6 @@ classdef Potentials < handle & matlab.mixin.Copyable
[X,Y] = ndgrid(x,y);
ret = 0.5*(this.SimulationParameters.gx.*X.^2+this.SimulationParameters.gy.*Y.^2);
case 'SquareBox'
x = linspace(-0.5*this.SimulationParameters.Lx,0.5*this.SimulationParameters.Lx-this.SimulationParameters.Lx/this.SimulationParameters.Nx,this.SimulationParameters.Nx);
y = linspace(-0.5*this.SimulationParameters.Ly,0.5*this.SimulationParameters.Ly-this.SimulationParameters.Ly/this.SimulationParameters.Ny,this.SimulationParameters.Ny);
[X,Y] = ndgrid(x,y);
heaviside_X = this.custom_heaviside(-abs(X) + this.SimulationParameters.boxsize/2);
heaviside_Y = this.custom_heaviside(-abs(Y) + this.SimulationParameters.boxsize/2);
ret = this.SimulationParameters.boxdepth * (1 - heaviside_X .* heaviside_Y);
case 'RoundBox'
x = linspace(-0.5*this.SimulationParameters.Lx,0.5*this.SimulationParameters.Lx-this.SimulationParameters.Lx/this.SimulationParameters.Nx,this.SimulationParameters.Nx);
y = linspace(-0.5*this.SimulationParameters.Ly,0.5*this.SimulationParameters.Ly-this.SimulationParameters.Ly/this.SimulationParameters.Ny,this.SimulationParameters.Ny);
[X,Y] = ndgrid(x,y);
ret = this.SimulationParameters.boxdepth * (1 - this.custom_heaviside((this.SimulationParameters.boxsize/2)^2 - X.^2 - Y.^2));
end
end
@ -100,7 +75,7 @@ classdef Potentials < handle & matlab.mixin.Copyable
ret = this.TrapFrequencies;
end
function set.TrapPotentialType(this, val)
assert(any(strcmpi(val,{'None','Harmonic','SquareBox','RoundBox'})), 'Trap potential of the specified type cannot be generated!');
assert(any(strcmpi(val,{'None','Harmonic'})), 'Trap potential of the specified type cannot be generated!');
this.TrapPotentialType = val;
end
function ret = get.TrapPotentialType(this)

View File

@ -20,10 +20,6 @@ function [Params] = setupParameters(this)
Params.wy = 2*pi*this.TrapFrequencies(2);
Params.wz = 2*pi*this.TrapFrequencies(3);
% Trap depth and box size for box potentials
Params.boxdepth = this.TrapDepth; % The depth of the box
Params.boxsize = this.BoxSize; % The size of the box
% ================ Parameters defined by those above ================ %
% Trap gamma