29.2. Physics List Performance
Table of Contents
Understanding Physics List Performance
Physics lists control which physical processes Geant4 simulates and how detailed those simulations are. This has a very strong impact on run time and memory use. For many applications, the physics list is the single most important factor for performance, sometimes more important than multithreading or hardware.
This chapter focuses on how your choice and configuration of physics lists affects performance, and how to optimize that choice without sacrificing the physics you really need.
How Physics Lists Affect Speed
A physics list defines which particles exist, which processes they can undergo, and what models are used in which energy ranges. Every time a particle takes a step, Geant4 must:
- Consider all processes attached to that particle type.
- For each process, sample an interaction length or step limit.
- Decide whether an interaction happens and, if so, run the corresponding physics model.
- Possibly create secondary particles and propagate them.
The more processes and models you enable, the more work is done per step. If you add processes you do not need, you pay a performance cost for no gain in physics relevance.
Two basic rules follow.
Always include all physics that matters for your results, but no more.
Unnecessary particles, processes, and very detailed models slow the simulation without improving the outcome.
Choosing an Appropriate Reference List
Reference physics lists such as FTFP_BERT or QGSP_BIC_HP are combinations of electromagnetic, hadronic, and other physics that are tested and maintained by the Geant4 collaboration. For beginners, you should almost always start from one of these lists, not from a fully custom list.
From a performance point of view, there is an approximate spectrum:
| Physics list family | Typical content (very simplified) | Relative speed | Notes |
|---|---|---|---|
| FTFP_BERT | General purpose hadronic, standard EM | Fast | Good default for many detector simulations |
| QGSP_BERT | Older general purpose, more legacy use | Similar | Often comparable to FTFP_BERT |
| \_EMV, \_EMX, \_EMZ | Variants with different EM detail levels | Varies | Some faster, some slower |
| \_HP lists | High precision neutrons below ~20 MeV | Slower | Necessary only for detailed neutron work |
| Livermore / Penelope EM | Low energy EM with detailed atomic effects | Slower | For low energy photons and electrons |
For performance, you should:
- Start with a general purpose list without high precision options, for instance FTFP_BERT.
- Only switch to a more detailed variant if you have clear physics reasons, such as low energy neutron transport in shielding design, or sub keV photon interactions in detector response studies.
- If you are unsure whether you need a high precision or low energy specialized model, run a small test with the faster list and compare the impact on your key observables.
Do not use high precision or very low energy specialized physics just because it sounds more accurate.
Use it only when it is necessary for the quantities you analyze.
Electromagnetic Models and Performance
Electromagnetic physics is often the main performance driver, especially if you simulate many electrons, positrons, or photons in complex geometries. Geant4 provides several EM “options,” which are different tuned sets of models.
Roughly, you can think in terms of:
| EM option | Typical features | Relative speed | Typical use case |
|---|---|---|---|
| Standard EM (default) | Good accuracy, wide energy range | Fast | General HEP, most detectors |
| EM Opt1 / Opt2 | Similar, slightly different step limits/tuning | Fast–medium | Tradeoffs in precision vs CPU |
| EM Opt3 / Opt4 | More detailed, more accurate for some observables | Slower | Dosimetry, medical physics, precision EM |
| Livermore / Penelope EM | Detailed low energy atomic effects | Slower | Sub MeV photons/electrons, X ray physics |
If you do not need very detailed low energy EM, use a standard EM option. If your simulation is dominated by electrons and photons of energies above a few tens of keV and you are not studying fine atomic effects, the default EM physics in FTFP_BERT is often sufficient and significantly faster than more specialized options.
A practical strategy is:
- Use a fast standard EM configuration while you develop geometry and analysis.
- When the setup is stable, run a small number of events with a more detailed EM option and compare the key observables.
- If differences are small relative to your required accuracy, stay with the faster option.
Hadronic Physics and Neutron Options
Hadronic physics can be very expensive, especially for low energy neutrons. High precision neutron models track many interaction channels and require large cross section datasets.
You should:
- Avoid high precision neutron physics lists, such as QGSP_BERT_HP, unless you explicitly need accurate neutron transport and spectra at thermal and epithermal energies.
- For applications where neutrons are not crucial, or where only high energy secondaries matter, use a reference list without the _HP suffix.
- Consider the energy spectrum and type of your primary particles. For purely electromagnetic simulations, a hadronic list with complex low energy models adds overhead with little benefit.
High precision neutron physics is very slow.
Use it only when you are specifically studying low energy neutrons and their detailed interactions.
Avoiding Unnecessary Particles and Processes
Every extra particle type and every extra process attached to that particle adds overhead. Even if a process is rarely used, Geant4 still has to consider it at each step.
Some common ways to reduce overhead are:
- Do not include particles that will never be produced. For example, if your beam energies are far below pion production threshold and you are not interested in cosmic rays, you may not need many exotic hadrons.
- Avoid optical photon physics if your simulation does not track scintillation light or Cherenkov photons. Optical photons generate many very small steps and can slow simulations dramatically.
- Remove or disable processes that are not relevant to your observables. For instance, if you never use detailed polarized Compton scattering, there is no need to enable polarized EM processes.
- Be careful when adding specialized processes through user code or modular lists; each new process should be justified by a clear physics need.
In more advanced setups, you can create a custom modular physics list that starts from a reference list and then removes unneeded components. For beginners, it is often enough to avoid turning on optional, advanced modules that are not part of the standard list.
Balancing Accuracy and Speed
Physics list performance is always a tradeoff between speed and physical detail. You should think in terms of your target observables, not just in terms of “more accurate is better.”
For example:
If you are computing overall dose distribution in a water phantom, standard EM physics might already provide sufficient accuracy in depth dose, while a more detailed low energy model only adds small corrections at a large CPU cost.
If you are simulating shielding against fast neutrons and only need integrated transmission, you might not need detailed resonance structure from high precision neutron libraries.
If you are studying fine spectral lines in X ray detectors, a low energy EM model might be essential even if it is slower.
An effective method is to perform a physics sensitivity study:
- Select a faster baseline physics list.
- Choose one more detailed variant that could potentially improve accuracy.
- Run a small reference sample with both lists, using the same random seeds for better comparison.
- Compare the main observables and their statistical uncertainties.
If the difference between the lists is smaller than your statistical uncertainty or smaller than your required systematic precision, the faster list is acceptable for that observable.
Only pay for physics detail that affects your key observables by more than your required precision.
Extra detail that does not change your results is wasted computing time.
Practical Workflow for Performance Tuning
To integrate physics list performance considerations into your overall workflow, follow a staged approach:
First, during development, use a light, general purpose list without high precision add ons. This keeps iteration cycles short while you fix geometry, I/O, and logic.
Next, when the application is stable, identify which parts of the physics are essential. For example, clarify whether your results depend mainly on EM energy deposition, on neutron fluxes below 20 MeV, or on specific reaction channels.
Then, test appropriate physics list variants that improve only the relevant parts. For instance, switch to a list with better electromagnetic low energy physics if you care about X rays, or add high precision neutron physics if thermal neutrons are central.
Finally, fix a well justified physics configuration and document the reasons. This avoids future random changes that might lower performance without clear benefit, and supports reproducibility and later validation.
Throughout these steps, monitor both physics outputs and performance metrics such as CPU time per event, memory usage, and secondary particle multiplicities. Overly large numbers of low energy secondaries can often point to overly detailed or unnecessary physics that you might be able to simplify.
By treating the physics list as a tunable component, not a fixed choice, you can achieve simulations that are both physically adequate and efficient enough for realistic production runs.
Views: 9
KAHIBARO