30 lines
1.5 KiB
Matlab
30 lines
1.5 KiB
Matlab
function [LoadingRate, StandardError, ConfidenceInterval] = calculateLoadingRate(this, ovenObj)
|
|
n = this.NumberOfAtoms;
|
|
DynamicalQuantities = this.ParticleDynamicalQuantities;
|
|
NumberOfTimeSteps = int64(this.SimulationTime/this.TimeStep);
|
|
NumberOfLoadedAtoms = zeros(1, NumberOfTimeSteps);
|
|
CollisionEvents = zeros(1, n);
|
|
|
|
% Include the stochastic process of background collisions
|
|
for AtomIndex = 1:n
|
|
this.TimeSpentInInteractionRegion(AtomIndex) = this.computeTimeSpentInInteractionRegion(squeeze(DynamicalQuantities(AtomIndex,:,1:3)));
|
|
CollisionEvents(AtomIndex) = this.computeCollisionProbability(ovenObj, this.TimeSpentInInteractionRegion(AtomIndex));
|
|
end
|
|
|
|
% 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(DynamicalQuantities(AtomIndex, TimeIndex, 1:3))';
|
|
Velocity = squeeze(DynamicalQuantities(AtomIndex, TimeIndex, 4:6))';
|
|
if this.exitCondition(ovenObj, Position, Velocity, CollisionEvents(AtomIndex))
|
|
NumberOfLoadedAtoms(TimeIndex) = NumberOfLoadedAtoms(TimeIndex) + 1;
|
|
end
|
|
end
|
|
end
|
|
|
|
[LoadingRate, StandardError, ConfidenceInterval] = this.bootstrapErrorEstimation(ovenObj, NumberOfLoadedAtoms);
|
|
end
|