Problem 1741 - Heavy ion simulations get stuck in an infinite loop inside G4FTFModel
Summary: Heavy ion simulations get stuck in an infinite loop inside G4FTFModel
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/parton_string/diffraction (show other problems)
Version: 10.0
Hardware: PC Linux
: P5 major
Assignee: Alberto.Ribon
URL:
Depends on:
Blocks:
 
Reported: 2015-04-28 14:19 CEST by Nicola Mori
Modified: 2015-06-30 10:49 CEST (History)
3 users (show)

See Also:


Attachments
Test program to reproduce the issue (2.01 KB, application/gzip)
2015-04-28 14:19 CEST, Nicola Mori
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Nicola Mori 2015-04-28 14:19:28 CEST
Created attachment 342 [details]
Test program to reproduce the issue

I'm simulating Fe56 @ 10 GeV/n with FTFP_BERT and Geant4 10.00.p02. The simulation gets stuck inside G4FTFModel::PutOnMassShell. More specifically, the do-while loop starting at line 1145 of G4FTFModel.cc never ends for some events. The check at the end of the loop (while ( SqrtS < std::sqrt( M2proj ) + std::sqrt( M2target ) ) fails many times, triggering a rescale of the scale factor (line 1151). This happens many times until the scale factor becomes 0 so that subsequent iterations are equivalent and the loop never ends.

I attach a simple example program, showing the block when shooting one Fe56 ion on a cube made of light materials. Shooting C12 @ 10GeV/n instead of iron the issue seems to disappear (I've gone trough a couple of long runs without problems). Some colleagues reported the same issue with Geant4 10.01.p01, although I had no chance to investigate it as deeply as I did wit 10.00.p02.
Comment 1 Alberto.Ribon 2015-05-18 16:28:59 CEST
I am not able to reproduce the problem by using the latest public version G4 10.1.p04.
I have run 10'000 interactions of Fe56 @ GeV/n on the following light materials: G4_Be, G4_C, G4_Al, G4_Ar.
Could you please try out this version?
Comment 2 Alberto.Ribon 2015-05-18 16:31:37 CEST
Sorry, I made a mistake in my previous post: I mean "G4 10.0.p04" not "10.1.p04".
Comment 3 Nicola Mori 2015-05-18 18:38:48 CEST
I tried the attached test program with 10.00.04 and it gets blocked on my system as with 10.00.p02. Did you try my test program or another program written by yourself? At which energy (it is missing in your post)? If you tried a different program then it's no surprise that it didn't block. It happens quite seldom, that's why I put together a test program to showcase it.
Comment 4 Alberto.Ribon 2015-05-18 19:02:28 CEST
The energy I have tried out is the same you have specified: 10 GeV per nucleon.
I have used my own test, because I would like to debug real problems of Geant4, not user-specific applications.
Could you please tell me which target material you are considering, and how many interactions (more or less) you run in order to see the problem?
Unfortunately, I don't have enough time to debug your program, so I need to reproduce the problem with my own test...
Comment 5 Nicola Mori 2015-05-19 09:46:33 CEST
The target of my original program is a complicated cosmic ray detector, not easy to describe it. That's why I prepared a test program with a very simple geometry. In this program the target is a (50 cm)^3 cube made of PVT defined in this way:

  a = 1.01 * g / mole;
  G4Element *H = new G4Element(name = "Hydrogen", symbol = "H", z = 1., a);
  a = 12.01 * g / mole;
  G4Element * C = new G4Element(name = "Carbon", symbol = "C", z = 6., a);
  density = 1.032 * g / cm3; // PVT
  G4Material *PVT = new G4Material(name = "PVTMaterial", density, ncomponents = 2);
  PVT->AddElement(C, natoms = 9);
  PVT->AddElement(H, natoms = 10);

The generation parameters have been chosen in order to trigger the block at the first event. In my original cosmic ray simulation I see the block every few hundreds - few thousands of events.

I understand your point of not wanting to debug user's programs but only G4 problems, but I assure you that my test program is absolutely minimal (a cube and a gun generator). Please give a look at tit and possibly run it, just to confirm that the block is reproduced on your machine.
Thanks
Comment 6 Alberto.Ribon 2015-05-28 09:12:25 CEST
I managed to reproduce the problem using the test included in attachment.
And I confirm that there is an infinite loop in the method G4FTFModel::PutOnMassShell.

We are testing now a fix, which will be included in the coming patch G4 10.1.p02 (which we recommend to use), and also in the development beta release G4 10.2.beta. Both of them are expected by the end of June.
I am going to post a message here as soon as they are ready, and then I wait for the confirmation that the bug is fixed before closing this ticket.

Many thanks for reporting this bug - not easy to reproduce - and for providing the test which allowed to investigate the problem!
Comment 7 Alberto.Ribon 2015-06-29 16:58:14 CEST
The second patch of the G4 10.1 series, 10.1.p02 (recommended for production), and the beta release 10.2.beta, have been released last week.
Both of them should not have the problem reported.
Could you please give a try and let us know, so that we can close the ticket?
Thanks!
Comment 8 Nicola Mori 2015-06-30 10:40:00 CEST
One of my colleagues tried 10.01.p02 to simulate Fe56 @ 10 Gev/n, and he reported that no simulation job got stuck. He simulated 30k events with no problem, so it seems that the patch fixed the problem. We didn't try 10.02.beta.

I think that the bug report can be closed. We plan to simulate higher energies and if the problem will rise up again I will ask for reopening. Thanks Alberto for your support.