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!
/gps/ion 6 12 2
/gps/energy 60 keV
/gps/pos/centre 0. 0. -200 mm
/gps/pos/radius 1. um
/gps/direction 0 0 1
Above is my code to generate 12C2+ run.mac file, but it doesn’t seem to produce the ions I want successfully, and when I change the charge state of the ions, there seems to be no significant change in my simulation, may I ask how I need to change my code if I want to correctly generate 12C2+ ions? Thank you in advance
Your definition of the ion looks okay. If you find that changing the charge state has no effect, it may be because the specified charge state is in fact being replaced by an effective charge state at the start of tracking. The effective charge state is used to represent (in the aggregate) the accumulated ionization effects as the ion traverses various materials. I am not an expert in this but have observed that the initial effective charge state is the same regardless of what charge state you have defined for the gps. I think this is the default behavior and works okay for most applications, maybe including yours, but if e.g. you want to track ions in vacuum with a magnetic field present, it will obviously give wrong results. If you want to check that gps is working correctly you can temporarily disable the process (/process/inactivate ionIoni) and the initial gps charge state will be preserved.
Maybe someone from the EM group will elaborate or comment on this.