Error Aborted (Core dump)

When I run the simulation it shows an error as shown below. How do I fix this?

just avoid simulating runs with more than 2^31-1 = 2147483647 events, as this is the max value for eventID, which is of type G4int.

Dear Sir,
As you say then if I want to simulate with 1E10 history I have to split it into 5 runs. But I don’t know if doing so will all the results from each simulation count towards the total? Below is my macro file, can you take a look and give me some advice?

/score/create/boxMesh Tumor
/score/mesh/boxSize 2.025 2.025 0.025 cm
/score/mesh/translate/xyz 0. 0. 0. cm
/score/mesh/rotate/rotateX 0 deg # Note: Hack to enable rotations
/score/mesh/nBin 81 81 1
/score/quantity/energyDeposit eDep
#/score/quantity/cellFlux cellFlux
/score/close
/score/list
#primary generator
/run/initialize
/calorimeter/helmetSize 18
#Source
/control/execute GPS.in

#/control/execute vis.mac
/run/printProgress 1

/run/beamOn 2000000000
/run/beamOn 2000000000
/run/beamOn 2000000000
/run/beamOn 2000000000
/run/beamOn 2000000000

/score/dumpQuantityToFile Tumor eDep eDep.txt
#/score/dumpQuantityToFile Tumor cellFlux cellflux.txt

it will not count toward the total, you should dump all quantities to file inbetween runs.
however, the values are additive, you can simply add up all the colums (except the index columns of course) in your eDep.txt elementwise

take a look at the control options,

/control/loop <macroFile> <counterName> <initialValue> <finalValue> [<stepSize>] 

e.g.,

/control/loop run.mac runID 0 4

with run.mac containing

/run/beamOn 2000000000
/score/dumpQuantityToFile Tumor eDep eDep_{runID}.txt

Thank you, but I still have one more question, can you explain it to me?.
In my opinion, to run the full 1E10 histories, we have to do the loop run 5 times. But will the results of each of those 5 runs be exactly the same? If it is identical, then the randomness is not guaranteed.

It is not identical, if the random number generator is not seeded for each run with the same seed.
When you initialize the RNG at the launch of your application, and then do 5 runs one after another, the state of the RNG is different for each run.

maybe someone knows the default engine, but MixMaxRng has a period length that is way way above the number of random decisions I would expect in a typical simulation.

...
    //Choose the Random engine and reset the seed (before the RunManager)
    CLHEP::MixMaxRng* randomEngine = new CLHEP::MixMaxRng();
    G4Random::setTheEngine(randomEngine);
    CLHEP::HepRandom::setTheSeed(time(NULL));

    // Construct the default run manager
    auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::MT);
...

if unsure, just make 5 short runs and check the files :slight_smile:

Thank you, I also used the Random engine in my simulation. I will try again as you said to check the results.
image

Thank you, I checked the result and found it different in the 5 output files. Thanks again for your help.

Dear Sir,
I did the simulation as you said, but the result doesn’t seem to be as expected, it shows an abnormal peak when I aggregate the results. I also attached another result with the PHITS code. Can you help me check why?

Figure 1. Geant4 results

Figure 2. the run.mac file
image

Figure 3. the simulation.mac file
image

Figure 4. PHITS results with 1E10 histories
image