Thank you for your help. Your modification is very helpful to me.With your help,I have solved the main problem.
At present, there is another problem I want to ask you.After the program is modified, I also want to record energy or dose, but there is no data in the recorded results（all the data are zero）. What is the reason.
This is my USRBIN card settings(
) and output results(
Look forward to your reply.
the energy density is not zero unless you are running with all set to vacuum. Try the following.
In the Run tab click on the Add button and add another run (I have called it run/proton for example). Then untick the check-trajectory define: this resets the materials as you defined them (see the #if-#else-#endif in the input file). Set the number of primaries, cycles, select the executable and run.
You should be able to see the scored energy density. Let me know if this works
A post was split to a new topic: How to get plot of beam profile