Calculations/MOT Capture Process Simulation/@MOTSimulator/runSimulation.m

24 lines
1.0 KiB
Matlab

function [LoadingRate, StandardError, ConfidenceInterval] = runSimulation(this)
%% - Sampling for initial positions and velocities
% - sampling the position distribution
Positions = this.initialPositionSampling();
% - sampling the velocity distribution
Velocities = this.initialVelocitySampling();
%% Solve ODE
progressbar = Helper.parforNotifications();
progressbar.PB_start(this.NumberOfAtoms,'Message',['Simulating 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();
end