When one particle causes one or more other particles to be created, these are called secondary particles. Typical mechanisms include fragmentation, ionization, and secondary emission. The secondary particles may be created in space (e.g. Ion-Gas Collisions) or on surfaces (secondary emission).
There’s a few ways to approach this.
If during the Fly’m, a particle changes into another particle (or dies and created a new particle or splits into two particles but you only care about one of the fragments), then you can just transform the primary particle into the secondary particle you are interested in. An other_actions segment that modifies the ion_charge, ion_mass and ion_vx_mm/ion_vy_mm/ion_vz_mm reserved variables in a user program can do this. Be sure to properly set the kinetic energies of the secondary particles too: Get/set kinetic energy of current particle.
If you need to trace more than one secondary particle, then there are two options:
- Create two identical primary particles and convert one into the first type of secondary particle and the other into the second type of secondary particle, using the same method described above.
- An even more flexible approach is the new particles API available in the 8.2 early access mode to create particles during the Fly’m: simion.experimental.add_particles().
Some relevant examples include SIMION Example: child_particles (uses 8.2 early access). The various collision model examples Collision Model HS1 (SIMION Example: collision_hs1) are also related and can be adapted to things like a randomized probability of collision or fragmentation over time.
Here’s some very basic code:
simion.workbench_program() function segment.other_actions() if ion_splat ~= 0 then ion_splat = 0 ion_vx_mm = -ion_vx_mm ion_vy_mm = -ion_vy_mm ion_vz_mm = -ion_vz_mm ion_mass = .....some new mass value.... ion_charge = .....some new charge value.... end end
When ion_splat is non-zero, that means it is about to splat. You can change it back to zero and then alter the particle’s mass/charge/velocity properties to allow it to continue on.
That is checking whether the particle is hitting the points in the PA. If your surfaces are curved and the PA doesn’t represent curved curves as precisely as you want (e.g. surface normals for secondary emission statistics), there are alternates for getting the surface information such as using equipotential curves slightly away from the surface or querying the original GEM file from workbench user program. SIMION Example: secondary takes some approaches but SIMION 8.1 has new features that could improve this example.