Problem 1221 - Infinite loop (no convergence) in G4GoudsmitSaundersonMscModel
Summary: Infinite loop (no convergence) in G4GoudsmitSaundersonMscModel
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/electromagnetic (show other problems)
Version: 9.4
Hardware: All All
: P3 normal
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2011-06-10 22:50 CEST by Andreas
Modified: 2011-06-14 13:05 CEST (History)
0 users

See Also:


Attachments
Root script showing the convergence issues with an example (676 bytes, text/x-c++src)
2011-06-10 22:50 CEST, Andreas
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Andreas 2011-06-10 22:50:29 CEST
Created attachment 121 [details]
Root script showing the convergence issues with an example

Hello,

In the class G4GoudsmitSaundersonMscModel under certain conditions the exit conditions for the following infinite loop can never be met (around line 200 in G4GoudsmitSaundersonMscModel.cxx)

  do
    {  
      logx0=std::log(1.+1./x0);
      x1 = x0-(x0*((1.+x0)*logx0-1.0)-g1/2.)/( (1.+2.*x0)*logx0-2.0);
      delta = std::abs( x1 - x0 );    
      x0 = x1;
    } while (delta > 1.0e-12);

Adding a simple check into the code, which aborts the loop after a certain amount of loops is not possible, since for certain input values (which I do see in my simulation) the code can diverge instead of converge.

Attached is a small ROOT script, which shows a case where convergence is not reached and a case where we have divergence. Both values are obtained from my simulations.

Thanks,
Andreas
Comment 1 Vladimir.Ivantchenko 2011-06-14 13:05:40 CEST
Thanks for the report. The protection is added, so the loop is finite and exit condition is improved.

VI