60#define State(theXInfo) (fpBrownianState->theXInfo)
70#define GREEN_ON_BLUE "\033[1;32;44m"
71#define RESET "\033[0m"
73static double InvErf(
double x)
78static 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 ;
G4IT * GetIT(const G4Track *track)
G4Molecule * GetMolecule(const G4Track &track)
#define InitProcessState(destination, source)
G4DLLIMPORT std::ostream G4cout
static double inverseErf(double t)
{ The transportation method implemented is the one from Ermak-McCammon : J. Chem. Phys....
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &)
void Diffusion(const G4Track &track)
G4DNABrownianTransportation & operator=(const G4DNABrownianTransportation &other)
const std::vector< G4double > * fpWaterDensity
virtual void ComputeStep(const G4Track &, const G4Step &, const double, double &)
G4DNABrownianTransportation(const G4String &aName="DNABrownianTransportation", G4int verbosityLevel=1)
virtual void StartTracking(G4Track *aTrack)
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
G4bool fUseMaximumTimeBeforeReachingBoundary
virtual ~G4DNABrownianTransportation()
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const std::vector< double > * GetDensityTableFor(const G4Material *) const
static G4DNAMolecularMaterial * Instance()
G4ParticleChangeForTransport fParticleChange
void SetInstantiateProcessState(G4bool flag)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
virtual void StartTracking(G4Track *aTrack)
virtual const G4String & GetName() const =0
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
const G4String & GetName() const
G4double GetDiffusionCoefficient() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
void SetMomentumChanged(G4bool b)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4String & GetParticleName() const
G4double GetGlobalTime() const
const G4VProcess * GetProcessDefinedStep() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetDeltaTime() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4int GetCurrentStepNumber() const
G4double GetLocalTime() const
G4Material * GetMaterial() const
G4bool ProposesTimeStep() const
void ProposeTrackStatus(G4TrackStatus status)
void SetProcessSubType(G4int)
G4int GetProcessSubType() const
const G4String & GetProcessName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription
G4bool fPathLengthWasCorrected