-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inputs: Rename to Kinetic Beam Energy #446
Conversation
dd3e139
to
22d98bc
Compare
22d98bc
to
10015d0
Compare
@@ -192,6 +192,6 @@ def read_beam(ref: RefPart, madx_file): | |||
|
|||
ref.set_charge_qe(ref_particle_dict["charge"]) | |||
ref.set_mass_MeV(ref_particle_dict["mass"]) | |||
ref.set_energy_MeV(ref_particle_dict["energy"]) | |||
ref.set_kin_energy_MeV(ref_particle_dict["energy"] - ref_particle_dict["mass"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug-fix for low-energy particles in MAD-X files.
MAD-X specifies total particle energy in GeV.
energy_MeV = 1e3 # reference energy | ||
energy_gamma = energy_MeV / 0.510998950 | ||
kin_energy_MeV = 1e3 # reference energy | ||
energy_gamma = kin_energy_MeV / 0.510998950 + 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this test uses 1 GeV electrons, this is a tiny sub-percentage precision fix and has no big influence for the reference particle energy used here. Mainly added for clarity for readers that might want to use it as a template and might adjust it to lower energies.
Total energy, not kinetic energy.
7084579
to
6b403c5
Compare
@@ -1,4 +1,4 @@ | |||
beam, particle=proton, energy=0.250; | |||
beam, particle=proton, energy=1.188272; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix: Added proton rest mass to MAD-X file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take it this is the bug that you mentioned. Here "energy" was modified to give the total energy in GeV (as required by MAD-X).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's it, yes :)
@cemitch99 let me know if you are ok if we merge this. It's a small change, but better explicit than sorry, I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks.
Rename the inputs:
beam.energy
->beam.kin_energy
set_kin_energy_MeV
->set_kin_energy_MeV
for clarity.
Spotted and fixed an issue in our MAD-X reader, which forgot to add the rest mass. Fixes a few examples.
Follow-up to #444
Close #435