Problem 780 - nan-producing operation in ionization models
Summary: nan-producing operation in ionization models
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/electromagnetic (show other problems)
Version: 7.1
Hardware: PC Linux
: P2 normal
Assignee: Michel.Maire
URL:
Depends on:
Blocks:
 
Reported: 2005-08-10 16:07 CEST by dennis.herbert.wright
Modified: 2005-09-23 04:36 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description dennis.herbert.wright 2005-08-10 16:07:27 CEST
On both Linux and Sun, I encountered program aborts which I traced back to
a NAN-producing operation in G4BraggModel::SampleSecondaries and
G4BetheBlochModel::SampleSecondaries.  The problem is in the lines:

G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
                                   (deltaMomentum * totMomentum);
G4double sint = sqrt(1.0 - cost*cost);

cost is occaisionally > 1 by a small amount, causing the argument of sqrt to be
negative.  My temporary fix was to protect the calculation of cost by taking
the std::min of the calculated value and 1.0.

The same problem also occurs in G4BraggIonModel and G4MollerBhabhaModel.
Comment 1 Michel.Maire 2005-09-23 04:34:59 CEST
Bug fixed and commited
Comment 2 Michel.Maire 2005-09-23 04:35:59 CEST
Bug fixed and commited
Comment 3 Michel.Maire 2005-09-23 04:36:59 CEST
Bug fixed and commited