diff --git a/bmad-doc/other_manuals/long_term_tracking.pdf b/bmad-doc/other_manuals/long_term_tracking.pdf index e79913b0f2..07c028b2d3 100644 Binary files a/bmad-doc/other_manuals/long_term_tracking.pdf and b/bmad-doc/other_manuals/long_term_tracking.pdf differ diff --git a/bmad/low_level/symp_lie_bmad.f90 b/bmad/low_level/symp_lie_bmad.f90 index 3e39964cb8..36eeafb842 100644 --- a/bmad/low_level/symp_lie_bmad.f90 +++ b/bmad/low_level/symp_lie_bmad.f90 @@ -142,9 +142,9 @@ subroutine symp_lie_bmad (ele, param, orbit, track, mat6, make_matrix, offset_el ! select the element key = ele%key -if (associated(ele%cartesian_map)) key = wiggler$ +if (associated(ele%cartesian_map) .and. ele%field_calc == fieldmap$) key = wiggler$ -select case (ele%key) +select case (key) !------------------------------------------------------------------ ! Wiggler @@ -365,8 +365,8 @@ subroutine symp_lie_bmad (ele, param, orbit, track, mat6, make_matrix, offset_el case default - call out_io (s_fatal$, r_name, 'TRACKING NOT YET IMPLEMENTED FOR: ' // key_name(ele%key), & - 'FOR ELEMENT: ', ele%name) + call out_io (s_fatal$, r_name, 'TRACKING NOT YET IMPLEMENTED FOR ELEMENT OF TYPE: ' // key_name(ele%key), & + 'FOR ELEMENT: ' // ele%name) end select diff --git a/bmad/low_level/track_a_bend.f90 b/bmad/low_level/track_a_bend.f90 index fe95071081..08ab105fba 100644 --- a/bmad/low_level/track_a_bend.f90 +++ b/bmad/low_level/track_a_bend.f90 @@ -345,17 +345,20 @@ subroutine apply_multipole_kicks (coef, step_len, r_step, ix_mag_max, an, bn, ix real(rp) an(0:n_pole_maxx), bn(0:n_pole_maxx), an_elec(0:n_pole_maxx), bn_elec(0:n_pole_maxx) integer i, charge, ix_mag_max, ix_elec_max +logical exact ! Calculate field charge = charge_of(orbit%species) if (nint(ele%value(exact_multipoles$)) /= off$ .and. ele%value(g$) /= 0) then + exact = .true. call bend_exact_multipole_field (ele, param, orbit, .true., field, make_matrix) else + exact = .false. field = em_field_struct() - f_p0c = r_step * ele%value(p0c$) / (step_len * c_light * charge_of(param%particle)) + f_p0c = r_step * ele%value(p0c$) / (c_light * charge_of(param%particle)) do i = 0, ix_mag_max if (an(i) == 0 .and. bn(i) == 0) cycle @@ -389,12 +392,14 @@ subroutine apply_multipole_kicks (coef, step_len, r_step, ix_mag_max, an, bn, ix if (ix_mag_max > -1) then orb0 = orbit - f_coef = step_len * coef * c_dir * (1 + ele%value(g$) * orbit%vec(1)) * c_light / orb0%p0c + f_coef = coef * c_dir * (1 + ele%value(g$) * orbit%vec(1)) * c_light / orb0%p0c + if (exact) f_coef = f_coef * step_len orbit%vec(2) = orbit%vec(2) - f_coef * field%B(2) orbit%vec(4) = orbit%vec(4) + f_coef * field%B(1) if (logic_option(.false., make_matrix)) then - df_coef_dx = step_len * coef * c_dir * ele%value(g$) * c_light / orb0%p0c + df_coef_dx = coef * c_dir * ele%value(g$) * c_light / orb0%p0c + if (exact) df_coef_dx = f_coef * step_len mat6(2,:) = mat6(2,:) - (f_coef * field%dB(2,1) + df_coef_dx * field%B(2)) * mat6(1,:) - & (f_coef * field%dB(2,2)) * mat6(3,:) diff --git a/bsim/long_term_tracking/doc/long_term_tracking.tex b/bsim/long_term_tracking/doc/long_term_tracking.tex index 87d3669446..1944ad4801 100644 --- a/bsim/long_term_tracking/doc/long_term_tracking.tex +++ b/bsim/long_term_tracking/doc/long_term_tracking.tex @@ -85,7 +85,7 @@ \title{Long Term Tracking Program} \author{} -\date{David Sagan \\ July 10, 2023} +\date{David Sagan \\ October 30, 2023} \begin{document} \pdfbookmark[1]{Contents}{contents} @@ -433,7 +433,7 @@ To simulate noise, use the \vn{ran()} or \vn{ran_gauss()} functions in a slave expression. Example: \begin{code} quake: ramper = \{*[y_offset]: 1e-5*ran_gauss()\}, var = \{\} -\end +\end{code} In this case no ramper variable is needed. When a bunch passes through an element, the slave expression \vn{1e-5*ran_gauss()} is evaluated just once. That is, it is assumed that the frequency spectrum of the noise falls below 1/\vn{dt_bunch} diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 661ed1965d..c14e50ebe1 100644 --- a/tao/version/tao_version_mod.f90 +++ b/tao/version/tao_version_mod.f90 @@ -6,5 +6,5 @@ !- module tao_version_mod -character(*), parameter :: tao_version_date = "2023/10/29 01:05:04" +character(*), parameter :: tao_version_date = "2023/10/29 18:44:34" end module