207{
208
209
210
211
212
213
214
215
216
217
218
219
220
221 if(
GetIT(track)->GetTrackingInfo()->IsLeadingStep())
222 {
225 bool makeException = true;
226
228
229 if(makeException)
230 {
231
233 exceptionDescription << "ComputeStep is called while the track has"
234 "the minimum interaction time";
235 exceptionDescription << " so it should not recompute a timeStep ";
236 G4Exception(
"G4DNABrownianTransportation::ComputeStep",
238 exceptionDescription);
239 }
240 }
241
242 State(fGeometryLimitedStep) =
false;
243
245
246 if(timeStep > 0)
247 {
249
250
253
254 static double sqrt_2 = sqrt(2.);
255 double sqrt_Dt = sqrt(diffCoeff*timeStep);
256 double sqrt_2Dt = sqrt_2*sqrt_Dt;
257
258 if(
State(fTimeStepReachedLimit)==
true)
259 {
260
261 State(fGeometryLimitedStep) =
true;
262
263 spaceStep =
State(fEndPointDistance);
264
265 }
266 else
267 {
268 G4double x = G4RandGauss::shoot(0,sqrt_2Dt);
269 G4double y = G4RandGauss::shoot(0,sqrt_2Dt);
270 G4double z = G4RandGauss::shoot(0,sqrt_2Dt);
271
272 spaceStep = sqrt(x*x + y*y + z*z);
273
274 if(spaceStep >=
State(fEndPointDistance))
275 {
276
277
278 State(fGeometryLimitedStep) =
true;
279
280
281
282
283
284
285
286
288 {
289#ifdef G4VERBOSE
291 {
293 << "G4ITBrownianTransportation::ComputeStep() : "
294 << "Step was limited to boundary"
297 }
298#endif
299
300 if(
State(fRandomNumber)>=0)
301 {
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
320 double invErfc = InvErfc(value);
321 spaceStep = invErfc*2*sqrt_Dt;
322
323 if(
State(fTimeStepReachedLimit)==
false)
324 {
325
326 State(fGeometryLimitedStep) =
false;
327
328 }
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344 }
346 {
347 double min_randomNumber = Erfc(
State(fEndPointDistance)/2*sqrt_Dt);
348 double value = min_randomNumber+(1-min_randomNumber)*
G4UniformRand();
349 double invErfc = InvErfc(value);
350 spaceStep = invErfc*2*sqrt_Dt;
351 if(spaceStep >=
State(fEndPointDistance))
352 {
353
354 State(fGeometryLimitedStep) =
true;
355
356 }
357 else if(
State(fTimeStepReachedLimit)==
false)
358 {
359
360 State(fGeometryLimitedStep) =
false;
361
362 }
363 }
364 else
365 {
366
367 State(fGeometryLimitedStep) =
true;
368
369 spaceStep =
State(fEndPointDistance);
370
371
372
373
374
375
376
377
378
379
380
381
382
383 }
384 }
385
386 State(fTransportEndPosition)= spaceStep*
387
390 }
391 else
392 {
393
394 State(fGeometryLimitedStep) =
false;
395
398 }
399 }
400 }
401 else
402 {
403 spaceStep = 0.;
405 State(fGeometryLimitedStep) =
false;
406 }
407
409 + timeStep;
410 State(fEndGlobalTimeComputed) =
true;
411
412#ifdef G4VERBOSE
413
415 {
417 << "G4ITBrownianTransportation::ComputeStep() : "
418 <<
" trackID : " << track.
GetTrackID() <<
" : Molecule name: "
423 <<
"Final position:" <<
G4BestUnit(
State(fTransportEndPosition),
"Length")
427 <<
"Final magnitude:" <<
G4BestUnit(
State(fTransportEndPosition).mag(),
"Length")
429 << "Diffusion length : "
431 <<
" within time step : " <<
G4BestUnit(timeStep,
"Time")
433 <<
"State(fTimeStepReachedLimit)= " <<
State(fTimeStepReachedLimit) <<
G4endl
434 <<
"State(fGeometryLimitedStep)=" <<
State(fGeometryLimitedStep) <<
G4endl
435 <<
"End point distance was: " <<
G4BestUnit(
State(fEndPointDistance),
"Length")
439 }
440#endif
441
442
443
444
445
446
447
448}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double GetTemperature() const
const G4String & GetName() const
G4double GetGlobalTime() const
const G4VProcess * GetProcessDefinedStep() const
G4StepPoint * GetPostStepPoint() const
G4Material * GetMaterial() const
G4bool ProposesTimeStep() const