Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pymodels/BO_V06_01/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def create_lattice(energy=energy, optics_mode=None):
the_ring = _pyacc_lat.shift(the_ring, idx[0])

# -- sets rf frequency
set_rf_frequency(the_ring)
set_rf_frequency(the_ring, energy)

# -- sets rf voltage
set_rf_voltage(the_ring, energy)
Expand Down Expand Up @@ -344,10 +344,12 @@ def get_optics_mode(optics_mode, energy=energy):
return strengths


def set_rf_frequency(the_ring):
def set_rf_frequency(the_ring, energy):
"""Set RF frequency of the lattice."""
circumference = _pyacc_lat.length(the_ring)
velocity = _mp.constants.light_speed
_, beam_velocity, _, _, _ = _mp.beam_optics.beam_rigidity(energy=energy/1e9)
velocity = beam_velocity
# velocity = _mp.constants.light_speed
rev_frequency = velocity / circumference
rf_frequency = harmonic_number * rev_frequency
idx = _pyacc_lat.find_indices(the_ring, 'fam_name', 'P5Cav')
Expand Down
10 changes: 5 additions & 5 deletions pymodels/SI_V25_04/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def create_lattice(
the_ring = _pyacc_lat.shift(the_ring, idx[0])

# -- sets rf frequency
set_rf_frequency(the_ring)
set_rf_frequency(the_ring, energy)

# -- sets number of integration steps
set_num_integ_steps(the_ring)
Expand All @@ -634,12 +634,12 @@ def create_lattice(
return the_ring


def set_rf_frequency(the_ring):
def set_rf_frequency(the_ring, energy):
"""Set RF frequency of the lattice."""
circumference = _pyacc_lat.length(the_ring)
# _, beam_velocity, _, _, _ = _mp.beam_optics.beam_rigidity(energy=energy)
# velocity = beam_velocity
velocity = _mp.constants.light_speed
_, beam_velocity, _, _, _ = _mp.beam_optics.beam_rigidity(energy=energy/1e9)
velocity = beam_velocity
# velocity = _mp.constants.light_speed
rev_frequency = velocity / circumference
rf_frequency = harmonic_number * rev_frequency
idx = _pyacc_lat.find_indices(the_ring, 'fam_name', 'SRFCav')
Expand Down