classdef DipolarGas < handle & matlab.mixin.Copyable properties (Access = public) NumberOfAtoms; DipolarAngle; ScatteringLength; TrapFrequencies; NumberOfPoints; Dimensions; CutoffType; PotentialType; SimulationMode; TimeStep; SimulationTime; %Flags DebugMode; DoSave; SaveDirectory; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %- Methods methods function this = DipolarGas(varargin) p = inputParser; p.KeepUnmatched = true; addParameter(p, 'NumberOfAtoms', 1E6,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'DipolarAngle', pi/2,... @(x) assert(isnumeric(x) && isscalar(x) && (x > -2*pi) && (x < 2*pi))); addParameter(p, 'ScatteringLength', 120,... @(x) assert(isnumeric(x) && isscalar(x) && (x > -150) && (x < 150))); addParameter(p, 'TrapFrequencies', 100 * ones(1,3),... @(x) assert(isnumeric(x) && isvector(x) && all(x > 0))); addParameter(p, 'NumberOfPoints', 128 * ones(1,3),... @(x) assert(isnumeric(x) && isvector(x) && all(x > 0))); addParameter(p, 'Dimensions', 10 * ones(1,3),... @(x) assert(isnumeric(x) && isvector(x) && all(x > 0))); addParameter(p, 'SimulationMode', 'ImaginaryTimeEvolution',... @(x) any(strcmpi(x,{'ImaginaryTimeEvolution','RealTimeEvolution'}))); addParameter(p, 'TimeStep', 5E-4,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'SimulationTime', 3,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'DebugMode', false,... @islogical); addParameter(p, 'SaveData', false,... @islogical); addParameter(p, 'SaveDirectory', './Data',... @ischar); p.parse(varargin{:}); this.NumberOfAtoms = p.Results.NumberOfAtoms; this.DipolarAngle = p.Results.DipolarAngle; this.ScatteringLength = p.Results.ScatteringLength; this.TrapFrequencies = p.Results.TrapFrequencies; this.NumberOfPoints = p.Results.NumberOfPoints; this.Dimensions = p.Results.Dimensions; this.SimulationMode = p.Results.SimulationMode; this.TimeStep = p.Results.TimeStep; this.SimulationTime = p.Results.SimulationTime; this.DebugMode = p.Results.DebugMode; this.DoSave = p.Results.SaveData; this.SaveDirectory = p.Results.SaveDirectory; switch this.SimulationMode case "ImaginaryTimeEvolution" % Development In progress case "RealTimeEvolution" % Development In progress end end end methods function set.TimeStep(this, val) assert(val > 1e-06, 'Not time efficient to compute for time steps smaller than 1 microsecond!'); this.TimeStep = val; end function ret = get.TimeStep(this) ret = this.TimeStep; end function set.SimulationTime(this, val) % assert(val <= 5e-03, 'Not time efficient to compute for time spans longer than 5 milliseconds!'); this.SimulationTime = val; end function ret = get.SimulationTime(this) ret = this.SimulationTime; end function set.NumberOfAtoms(this, val) assert(val <= 1E6, '!!Not time efficient to compute for atom numbers larger than 1,000,000!!'); this.NumberOfAtoms = val; end function ret = get.NumberOfAtoms(this) ret = this.NumberOfAtoms; end function set.DebugMode(this, val) this.DebugMode = val; end function ret = get.DebugMode(this) ret = this.DebugMode; end function set.DoSave(this, val) this.DoSave = val; end function ret = get.DoSave(this) ret = this.DoSave; end function set.SaveDirectory(this, val) this.SaveDirectory = val; end function ret = get.SaveDirectory(this) ret = this.SaveDirectory; end end % - setters and getters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %- Methods methods(Access = protected) function cp = copyElement(this) % Shallow copy object cp = copyElement@matlab.mixin.Copyable(this); % Forces the setter to redefine the function handles to the new copied object pl = properties(this); for k = 1:length(pl) sc = superclasses(this.(pl{k})); if any(contains(sc,{'matlab.mixin.Copyable'})) cp.(pl{k}) = this.(pl{k}).copy(); end end end end methods (Static) % Creates an Instance of Class, ensures singleton behaviour (that there % can only be one Instance of this class function singleObj = getInstance(varargin) % Creates an Instance of Class, ensures singleton behaviour persistent localObj; if isempty(localObj) || ~isvalid(localObj) localObj = Simulator.DipolarGas(varargin{:}); end singleObj = localObj; end end end