diff --git a/bmad-doc/other_manuals/dynamic_aperture.pdf b/bmad-doc/other_manuals/dynamic_aperture.pdf index d76326a93c..71cd734934 100644 Binary files a/bmad-doc/other_manuals/dynamic_aperture.pdf and b/bmad-doc/other_manuals/dynamic_aperture.pdf differ diff --git a/bsim/dynamic_aperture/doc/dynamic_aperture.tex b/bsim/dynamic_aperture/doc/dynamic_aperture.tex index 57089bf316..7e5ef0edbe 100644 --- a/bsim/dynamic_aperture/doc/dynamic_aperture.tex +++ b/bsim/dynamic_aperture/doc/dynamic_aperture.tex @@ -76,7 +76,7 @@ \title{Dynamic_Aperture Program} \author{} -\date{David Sagan \\ September 24, 2022} +\date{David Sagan \\ June 28, 2024} \begin{document} \pdfbookmark[1]{Contents}{contents} @@ -285,7 +285,7 @@ bmad_com%radiation_damping_on = F bmad_com%radiation_fluctuations_on = F - dpz = 0.000, 0.005, 0.010 + pz = 0.000, 0.005, 0.010 da_param%min_angle = 0 da_param%max_angle = 3.1415926 da_param%n_angle = 0 @@ -348,10 +348,10 @@ \item[dat_file] \Newline Name of the data output file. This name is required. % -\item[dpz] \Newline -The \vn{dpz} parameter array is a list of $p_z$ values to use. The number of scans (dynamic aperture curves) -that are produced is equal to the number of \vn{pz} values. - +\item[pz] \Newline +The \vn{pz} parameter array is a list of $p_z$ values to use. The number of scans (dynamic aperture +curves) that are produced is equal to the number of \vn{pz} values. Note: \vn{pz} used to be named +\vn{dpz}. The program is backwards compatible and will accept the old name. % \item[ele_start] \Newline @@ -604,7 +604,7 @@ # gnuplot plotting command: # plot for [IDX=1:3] "da.dat" index (IDX-1) u 1:2 w lines ... -"dpz = 0.000000" +"pz = 0.000000" "x_ref_orb = 0.000124" "y_ref_orb = 0.000037" 0.068125 0.000000 544 Hit +X Side Q11E @@ -615,7 +615,7 @@ 0.034006 0.014403 855 Hit +Y Side SEX_21W ... etc. ... -dpz = 0.005000" +pz = 0.005000" "x_ref_orb = 0.006591" "y_ref_orb = 0.006591" 0.073979 0.000000 904 Hit -Y Side SEX_16W @@ -627,7 +627,7 @@ \end{code} The top part of the data file will be a record of input parameter values. This is followed by a number of -data blocks, one for each setting of \vn{dpz}. The five columns of these data blocks are: +data blocks, one for each setting of \vn{pz}. The five columns of these data blocks are: \begin{code} 1 & 2: x_aperture, y_aperture 3: Number of turns a particle initially at the aperture limit survived. diff --git a/bsim/dynamic_aperture/dynamic_aperture.f90 b/bsim/dynamic_aperture/dynamic_aperture.f90 index 5960c92404..05a1d60718 100644 --- a/bsim/dynamic_aperture/dynamic_aperture.f90 +++ b/bsim/dynamic_aperture/dynamic_aperture.f90 @@ -29,16 +29,16 @@ program dynamic_aperture_program procedure(track_many_hook_def) :: track_many_hook -real(rp) dpz(20), vec(6) +real(rp) dpz(20), pz(20), vec(6) real(rp) :: ramping_start_time = 0 -integer nargs, ios, i, j, n_dpz, nt +integer nargs, ios, i, j, n_pz, nt logical :: ramping_on = .false., set_rf_off = .false. logical err character(200) :: in_file, lat_file = '', dat_file, gnu_command, line -namelist / params / bmad_com, ltt, da_param, set_rf_off, dpz, dat_file, & +namelist / params / bmad_com, ltt, da_param, set_rf_off, dpz, pz, dat_file, & ramping_start_time, lat_file, ramping_on ! @@ -52,6 +52,7 @@ program dynamic_aperture_program bmad_com%auto_bookkeeper = .false. ! Makes tracking faster bmad_com%absolute_time_tracking = .true. dpz = real_garbage$ +pz = real_garbage$ ! Read parameters ! Read the master input file again after bmad_parser is called so that bmad_com parameters @@ -130,8 +131,17 @@ program dynamic_aperture_program ! Read in lattice -n_dpz = count(dpz /= real_garbage$) -print *, 'Note: Number of dpz points: ', n_dpz +n_pz = count(dpz /= real_garbage$) +if (n_pz /= 0) then + print * + print *, 'Note: "dpz" has been renamed to "pz" to be compatable with Tao.' + print *, ' The program will run normally...' + print * + pz = dpz +endif + +n_pz = count(pz /= real_garbage$) +print *, 'Number of pz points: ', n_pz if (.not. bmad_com%absolute_time_tracking) then print *, 'Note: absolute time tracking is OFF!' @@ -139,7 +149,7 @@ program dynamic_aperture_program print *, 'Data file: ', trim(dat_file) -write (gnu_command, '(a, i0, 3a)') 'plot for [IDX=1:', n_dpz, '] "', & +write (gnu_command, '(a, i0, 3a)') 'plot for [IDX=1:', n_pz, '] "', & trim(dat_file), '" index (IDX-1) u 1:2 w lines title columnheader(1)' ! Scan @@ -179,9 +189,9 @@ program dynamic_aperture_program write (1, '(2a)') '## gnuplot plotting command:' write (1, '(2a)') '## ', trim(gnu_command) -call dynamic_aperture_scan (aperture_scan, da_param, dpz(1:n_dpz), ltt_com%tracking_lat) +call dynamic_aperture_scan (aperture_scan, da_param, pz(1:n_pz), ltt_com%tracking_lat) -do i = 1, n_dpz +do i = 1, n_pz da => aperture_scan(i) nt = 10 @@ -191,7 +201,7 @@ program dynamic_aperture_program write (1, *) write (1, *) - write (1, '(a, f14.9, a)') '"dpz =', dpz(i), '"' + write (1, '(a, f14.9, a)') '"pz =', pz(i), '"' write (1, '(a, f14.9, a)') '"x_ref_orb =', da%ref_orb%vec(1), '" # (x, y) below is with respect to the reference orbit.' write (1, '(a, f14.9, a)') '"y_ref_orb =', da%ref_orb%vec(3), '"' write (1, '(a, 6(f14.9, a))') '# ref_orb = (', (da%ref_orb%vec(j), ',', j = 1, 5), da%ref_orb%vec(6), ')' diff --git a/bsim/dynamic_aperture/example/dynamic_aperture.init b/bsim/dynamic_aperture/example/dynamic_aperture.init index 434c3b2549..fccb4feefb 100644 --- a/bsim/dynamic_aperture/example/dynamic_aperture.init +++ b/bsim/dynamic_aperture/example/dynamic_aperture.init @@ -4,7 +4,7 @@ ltt%lat_file = 'chess_arc_pretzel_20150106.lat' ltt%rfcavity_on = F - dpz = 0, 0.005, 0.01 + pz = 0, 0.005, 0.01 da_param%min_angle = 0 da_param%max_angle = 3.1415926 da_param%abs_accuracy = 1e-5 diff --git a/util_programs/generalized_gradient_fit/gg_fit_mod.f90 b/util_programs/generalized_gradient_fit/gg_fit_mod.f90 index 1d6b510a7a..91b39f2fd2 100644 --- a/util_programs/generalized_gradient_fit/gg_fit_mod.f90 +++ b/util_programs/generalized_gradient_fit/gg_fit_mod.f90 @@ -1022,7 +1022,7 @@ subroutine write_gg_bmad() write (1, '(3a)') ' kind = ', sincos_name(gg%sincos), ',' write (1, '(a, i2)') ' derivs = {' - write (fmt, '(a, i0, a)') '(f15.4, a, ', size(gg%deriv,2), 'es20.12, a)' + write (fmt, '(a, i0, a)') '(f15.6, a, ', size(gg%deriv,2), 'es20.12, a)' do iz = iz_min, iz_max-1 write (1, fmt) iz*del_meters(3), ':', gg%deriv(iz,:), ',' enddo