I’m running a simple simulation based on Geant4’s exampleB4a to detect photoneutrons from targets illuminated by gamma rays < 20 MeV. The geometry is simple with a monoenergetic general particle source of gammas, a block target of solid nitrogen-14 (density 2g/cc) at a distance embedded in an air half space and a detector. Data is collected when a gamma ray intersects the detector volume. I use gtools Root analysis tools to store various properties of the emitted neutron. I am running Geant4 10.5 patch 01 on an i7 PC with 16GB RAM and 64bit Linux (Fedora 30).
I am using ShieldingLEND physics list and there appears to be some problem with it. With an incident gamma ray energy of 11.668 MeV, almost every event generates errors of the form (the energy E(initial - final) below changes from event to event but the error is the same):
…
G4WT1 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : had012
issued by : G4HadronicProcess:CheckResult()
Warning: Bad energy non-conservation detected, will re-sample the interaction
Process / Model: photonNuclear / LENDorBERTModel
Primary: gamma (22), E= 11.668, target nucleus (7, 14)
E(initial - final) = -12108.5 MeV.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
…
With an incident gamma ray energy of 16.107 MeV, I get the same types of errors, e.g.,:
G4WT2 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : had012
issued by : G4HadronicProcess:CheckResult()
Warning: Bad energy non-conservation detected, will re-sample the interaction
Process / Model: photonNuclear / LENDorBERTModel
Primary: gamma (22), E= 16.107, target nucleus (7, 15)
E(initial - final) = -2787.09 MeV.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Also, at 16.107 MeV I infrequently (~1 per 2 billion events) get a segmentation fault. When I run the code with the gdb debugger on the seg fault, I get the following:
Thread 4 “exampleB4a” received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffede63700 (LWP 31599)]
0x00007ffff2a09d6c in G4HadronicProcess::CheckResult(G4HadProjectile const&, G4Nucleus const&, G4HadFinalState*) ()
from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4processes.so
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.6-29.fc30.x86_64 expat-2.2.6-2.fc30.x86_64 freetype-2.9.1-7.fc30.x86_64 glib2-2.60.4-1.fc30.x86_64 glibc-2.29-15.fc30.x86_64 graphite2-1.3.10-7.fc30.x86_64 harfbuzz-2.3.1-1.fc30.x86_64 libICE-1.0.9-15.fc30.x86_64 libSM-1.2.3-2.fc30.x86_64 libX11-1.6.7-1.fc30.x86_64 libXau-1.0.9-1.fc30.x86_64 libXext-1.3.3-11.fc30.x86_64 libXmu-1.1.2-13.fc30.x86_64 libXt-1.1.5-11.20190424gitba4ec9376.fc30.x86_64 libgcc-9.1.1-1.fc30.x86_64 libgcrypt-1.8.4-3.fc30.x86_64 libglvnd-glx-1.1.0-4.gitf92208b.fc30.x86_64 libgpg-error-1.33-2.fc30.x86_64 libicu-63.2-2.fc30.x86_64 libpng-1.6.36-1.fc30.x86_64 libstdc+±9.1.1-1.fc30.x86_64 libuuid-2.33.2-1.fc30.x86_64 libxcb-1.13.1-2.fc30.x86_64 lz4-libs-1.8.3-2.fc30.x86_64 mesa-libGLU-9.0.0-17.fc30.x86_64 pcre2-utf16-10.33-4.fc30.x86_64 qt5-qtbase-5.12.1-7.fc30.x86_64 qt5-qtbase-gui-5.12.1-7.fc30.x86_64 xz-libs-5.2.4-5.fc30.x86_64 zlib-1.2.11-15.fc30.x86_64
(gdb) backtrace
#0 0x00007ffff2a09d6c in G4HadronicProcess::CheckResult(G4HadProjectile const&, G4Nucleus const&, G4HadFinalState*) ()
from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4processes.so
#1 0x00007ffff2a0c127 in G4HadronicProcess::PostStepDoIt(G4Track const&, G4Step const&) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4processes.so
#2 0x00007ffff62b04de in G4SteppingManager::InvokePSDIP(unsigned long) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4tracking.so
#3 0x00007ffff62b0c1b in G4SteppingManager::InvokePostStepDoItProcs() () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4tracking.so
#4 0x00007ffff62addc4 in G4SteppingManager::Stepping() () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4tracking.so
#5 0x00007ffff62b92fc in G4TrackingManager::ProcessOneTrack(G4Track*) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4tracking.so
#6 0x00007ffff62f8a46 in G4EventManager::DoProcessing(G4Event*) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4event.so
#7 0x00007ffff63a123c in G4WorkerRunManager::DoEventLoop(int, char const*, int) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4run.so
#8 0x00007ffff639550e in G4RunManager::BeamOn(int, char const*, int) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4run.so
#9 0x00007ffff63a29bc in G4WorkerRunManager::DoWork() () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4run.so
#10 0x00007ffff63abeca in G4MTRunManagerKernel::StartThread(G4WorkerThread*) () from /home/jmcfee/geant4/geant4.10.5.p01-install/lib64/libG4run.so
#11 0x00007ffff1306474 in ?? () from /lib64/libstdc++.so.6
#12 0x00007ffff10b55a2 in start_thread () from /lib64/libpthread.so.0
#13 0x00007ffff0fe2303 in clone () from /lib64/libc.so.6
So it seems that G4HadronicProcess::CheckResult(G4HadProjectile const&, G4Nucleus const&, G4HadFinalState*) () is causing a segmentation fault.
Is there a bug in photonNuclear LENDorBERTModel or G4HadronicProcess?
As always, any help is gratefully appreciated. Thanks.