60 #define State(theXInfo) (fpBrownianState->theXInfo)
70 #define GREEN_ON_BLUE "\033[1;32;44m"
71 #define RESET "\033[0m"
73 static double InvErf(
double x)
78 static double InvErfc(
double x)
112 if (
this == &rhs)
return *
this;
144 const double timeStep,
159 if(
GetIT(track)->GetTrackingInfo()->IsLeadingStep())
162 bool makeException =
true;
170 exceptionDescription <<
"ComputeStep is called while the track has the minimum interaction time";
171 exceptionDescription <<
" so it should not recompute a timeStep ";
172 G4Exception(
"G4DNABrownianTransportation::ComputeStep",
"G4DNABrownianTransportation001",
177 State(fGeometryLimitedStep) =
false;
188 while(spaceStep >
State(endpointDistance))
193 G4double x = G4RandGauss::shoot(0,sqrt(2*diffCoeff*timeStep));
194 G4double y = G4RandGauss::shoot(0,sqrt(2*diffCoeff*timeStep));
195 G4double z = G4RandGauss::shoot(0,sqrt(2*diffCoeff*timeStep));
197 spaceStep = sqrt(x*x + y*y + z*z);
212 State(fEndGlobalTimeComputed) = true ;
219 <<
"G4ITBrownianTransportation::ComputeStep() : "
221 <<
" : Molecule name: " << molecule-> GetName()
223 <<
"Diffusion length : " <<
G4BestUnit(spaceStep,
"Length")
224 <<
" within time step : " <<
G4BestUnit(timeStep,
"Time")
240 <<
"G4ITBrownianTransportation::PostStepDoIt() :"
262 << setw(18)<<
"G4DNABrownianTransportation::Diffusion :"
276 if(waterDensity == 0.0)
297 G4double xMomentum = cos(phi)* sin(theta);
298 G4double yMomentum = sin(theta)*sin(phi);
302 State(fMomentumChanged) =
true;
330 if(
State(fGeometryLimitedStep))
338 State(theInteractionTimeLeft) = (geometryStepLength*geometryStepLength)/(64 * diffusionCoefficient);
342 State(theInteractionTimeLeft) = 1/(4*diffusionCoefficient) * pow(geometryStepLength/InvErfc(
G4UniformRand()),2);
346 State(fPathLengthWasCorrected) =
false;
350 geometryStepLength = 2*sqrt(diffusionCoefficient*
State(theInteractionTimeLeft) ) *InvErf(
G4UniformRand());
351 State(fPathLengthWasCorrected) =
true;
352 State(endpointDistance) = geometryStepLength;
355 return geometryStepLength ;