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

24 lines
1.0 KiB
Mathematica
Raw Normal View History

function [LoadingRate, StandardError, ConfidenceInterval] = runSimulation(this)
%% - Sampling for initial positions and velocities
% - sampling the position distribution
2021-07-14 20:07:40 +02:00
Positions = this.initialPositionSampling();
% - sampling the velocity distribution
2021-07-14 20:07:40 +02:00
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
2021-07-14 20:07:40 +02:00
DynamicalQuantities = zeros(this.NumberOfAtoms,int64(this.SimulationTime/this.TimeStep),6);
parfor Index = 1:this.NumberOfAtoms
2021-07-14 20:07:40 +02:00
DynamicalQuantities(Index,:, :) = this.solver(Positions(Index,:), Velocities(Index,:));
progressbar.PB_iterate();
end
clear Index
2021-07-14 20:07:40 +02:00
this.ParticleDynamicalQuantities = DynamicalQuantities;
%% Calculate the Loading Rate
2021-07-14 20:07:40 +02:00
[LoadingRate, StandardError, ConfidenceInterval] = this.calculateLoadingRate();
end