Added a switch to change between 2D and 3D MOT cases to allow for this code to be expanded and generalized in the future.
This commit is contained in:
parent
ba621f3c32
commit
1a8975c218
@ -1,14 +1,15 @@
|
|||||||
function ret = calculateCaptureVelocity(this, PositionVector, VelocityVector)
|
function ret = calculateCaptureVelocity(this, PositionVector, VelocityVector)
|
||||||
|
|
||||||
VelocityVector = VelocityVector./norm(VelocityVector);
|
switch this.SimulationMode
|
||||||
|
case "2D"
|
||||||
|
VelocityUnitVector = VelocityVector./norm(VelocityVector);
|
||||||
UpperLimit = 500;
|
UpperLimit = 500;
|
||||||
LowerLimit = 0;
|
LowerLimit = 0;
|
||||||
this.AtomicBeamCollision = false;
|
|
||||||
|
|
||||||
for Index = 1:500
|
for Index = 1:500
|
||||||
InitialVelocity = 0.5 * (UpperLimit + LowerLimit) * VelocityVector;
|
InitialVelocity = (0.5 * (UpperLimit + LowerLimit)) * VelocityUnitVector;
|
||||||
[~, FinalDynamicalQuantities] = this.solver(PositionVector, InitialVelocity);
|
ParticleDynamicalQuantities = this.solver(PositionVector, InitialVelocity);
|
||||||
FinalPositionVector = FinalDynamicalQuantities(1:3);
|
FinalPositionVector = ParticleDynamicalQuantities(end, 1:3);
|
||||||
if rssq(FinalPositionVector) <= this.OvenDistance
|
if rssq(FinalPositionVector) <= this.OvenDistance
|
||||||
LowerLimit = 0.5 * (UpperLimit + LowerLimit);
|
LowerLimit = 0.5 * (UpperLimit + LowerLimit);
|
||||||
else
|
else
|
||||||
@ -16,9 +17,12 @@ function ret = calculateCaptureVelocity(this, PositionVector, VelocityVector)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if UpperLimit - LowerLimit < 1
|
if UpperLimit - LowerLimit < 1
|
||||||
ret = InitialVelocity;
|
ret = (0.5 * (UpperLimit + LowerLimit)) * VelocityUnitVector;
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
case "3D"
|
||||||
|
% Development In progress
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user