How to define H- ions in Geant4 with GPS or G4ParticleGun

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:v11.3
_Operating System: Ubuntu 22.04
_Compiler/Version:gcc
_CMake Version: cmake
Hi experts,
—I want define H-(hydrogen atom with an e-) with G4GeneralParticleSource,

/gps/particle ion
/gps/ion 1 1 -1

I configured an ion source as described above using Geant4, but during runtime, G4 displays protons instead of my defined ions. Could there be limitations in G4’s ion definition capability? (Note: When attempting to define H- ions through the G4ParticleDefinition class, G4 indicates this ion has already been predefined.)

What do you mean by “displays”? Do you mean the particle name string? Since the proton is a specifically defined particle type (G4Proton) it has a name string and that’s what gets printed out. Strings like “Ge72[0.0]” are generated on the fly when a particular heavy ion is requested.

If you’re worried about the charge state, that’s not a separate particle type, and is not pare of the particle name string. The instantaneous charge for ions is a property of G4DynamicParticle, which is owned by G4Track.

Thank you for your help, it’s a good idea for me to solve my problem.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.