25 lines
1.2 KiB
Matlab
25 lines
1.2 KiB
Matlab
function [LoadingRate, StandardError, ConfidenceInterval] = runSimulation(this, ovenObj)
|
|
if this.NumberOfAtoms ~= ovenObj.NumberOfAtoms
|
|
ovenObj.NumberOfAtoms = this.NumberOfAtoms;
|
|
end
|
|
%% - Sampling for initial positions and velocities
|
|
% - sampling the position distribution
|
|
Positions = ovenObj.initialPositionSampling();
|
|
% - sampling the velocity distribution
|
|
Velocities = ovenObj.initialVelocitySampling(this);
|
|
%% Solve ODE
|
|
progressbar = Helper.parforNotifications();
|
|
progressbar.PB_start(this.NumberOfAtoms,'Message',['Simulating 2-D MOT capture process for ' num2str(this.NumberOfAtoms,'%.0f') ' atoms:']);
|
|
|
|
% calculate the final position of the atoms
|
|
DynamicalQuantities = zeros(this.NumberOfAtoms,int64(this.SimulationTime/this.TimeStep),6);
|
|
parfor Index = 1:this.NumberOfAtoms
|
|
DynamicalQuantities(Index,:, :) = this.solver(Positions(Index,:), Velocities(Index,:));
|
|
progressbar.PB_iterate();
|
|
end
|
|
clear Index
|
|
this.ParticleDynamicalQuantities = DynamicalQuantities;
|
|
|
|
%% Calculate the Loading Rate
|
|
[LoadingRate, StandardError, ConfidenceInterval] = this.calculateLoadingRate(ovenObj);
|
|
end |