2021-07-11 14:47:13 +02:00
|
|
|
function [LoadingRate, StandardError, ConfidenceInterval] = calculateLoadingRate(this, ParticleDynamicalQuantities)
|
|
|
|
switch this.SimulationMode
|
|
|
|
case "2D"
|
|
|
|
n = this.NumberOfAtoms;
|
|
|
|
NumberOfTimeSteps = int64(this.SimulationTime/this.TimeStep);
|
|
|
|
NumberOfLoadedAtoms = zeros(1, NumberOfTimeSteps);
|
|
|
|
TimeCounts = zeros(1, n);
|
|
|
|
CollisionEvents = zeros(1, n);
|
|
|
|
|
|
|
|
% Include the stochastic process of background collisions
|
|
|
|
for AtomIndex = 1:n
|
|
|
|
TimeCounts(AtomIndex) = this.computeTimeSpentInInteractionRegion(squeeze(ParticleDynamicalQuantities(AtomIndex,:,1:3)));
|
|
|
|
end
|
|
|
|
this.TimeSpentInInteractionRegion = mean(TimeCounts);
|
|
|
|
for AtomIndex = 1:n
|
|
|
|
CollisionEvents(AtomIndex) = this.computeCollisionProbability();
|
2021-06-29 15:44:28 +02:00
|
|
|
end
|
|
|
|
|
2021-07-11 14:47:13 +02:00
|
|
|
% Count the number of loaded atoms subject to conditions
|
|
|
|
for TimeIndex = 1:NumberOfTimeSteps
|
|
|
|
if TimeIndex ~= 1
|
|
|
|
NumberOfLoadedAtoms(TimeIndex) = NumberOfLoadedAtoms(TimeIndex-1);
|
|
|
|
end
|
|
|
|
for AtomIndex = 1:n
|
|
|
|
Position = squeeze(ParticleDynamicalQuantities(AtomIndex, TimeIndex, 1:3))';
|
|
|
|
Velocity = squeeze(ParticleDynamicalQuantities(AtomIndex, TimeIndex, 4:6))';
|
|
|
|
if this.exitCondition(Position, Velocity, CollisionEvents(AtomIndex))
|
|
|
|
NumberOfLoadedAtoms(TimeIndex) = NumberOfLoadedAtoms(TimeIndex) + 1;
|
|
|
|
end
|
|
|
|
end
|
2021-06-29 15:44:28 +02:00
|
|
|
end
|
2021-07-11 14:47:13 +02:00
|
|
|
|
|
|
|
[LoadingRate, StandardError, ConfidenceInterval] = this.bootstrapErrorEstimation(NumberOfLoadedAtoms);
|
|
|
|
|
|
|
|
case "3D"
|
|
|
|
% Development In progress
|
2021-06-29 15:44:28 +02:00
|
|
|
end
|
|
|
|
end
|