2021-07-14 20:04:54 +02:00
|
|
|
function [LoadingRate, StandardError, ConfidenceInterval] = calculateLoadingRate(this)
|
2021-07-11 14:47:13 +02:00
|
|
|
switch this.SimulationMode
|
|
|
|
case "2D"
|
|
|
|
n = this.NumberOfAtoms;
|
2021-07-14 20:04:54 +02:00
|
|
|
DynamicalQuantities = this.ParticleDynamicalQuantities;
|
2021-07-11 14:47:13 +02:00
|
|
|
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
|
2021-07-14 20:04:54 +02:00
|
|
|
TimeCounts(AtomIndex) = this.computeTimeSpentInInteractionRegion(squeeze(DynamicalQuantities(AtomIndex,:,1:3)));
|
2021-07-11 14:47:13 +02:00
|
|
|
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
|
2021-07-14 20:04:54 +02:00
|
|
|
Position = squeeze(DynamicalQuantities(AtomIndex, TimeIndex, 1:3))';
|
|
|
|
Velocity = squeeze(DynamicalQuantities(AtomIndex, TimeIndex, 4:6))';
|
2021-07-11 14:47:13 +02:00
|
|
|
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
|