From 83f26e65d0f65fd0cbe28425f96e7646915b10d7 Mon Sep 17 00:00:00 2001 From: David Sagan Date: Fri, 26 Jul 2024 11:19:00 -0400 Subject: [PATCH] More bmad_to_julia devel. (#1083) * Minor doc tweaks. * More bmad_to_julia devel. --- bmad/code/multipass_all_info.f90 | 4 +-- bmad/doc/bmad.tex | 2 +- bmad/output/write_lat_file_mod.f90 | 2 +- bmad/output/write_lattice_in_julia.f90 | 26 +++++++++---------- bmad/photon/track1_photon_mod.f90 | 1 + bsim/ibs_ring/doc/ibs_ring.tex | 2 +- bsim/synrad/doc/synrad.tex | 2 +- bsim/synrad3d/doc/synrad3d.tex | 2 +- .../doc/touschek_background.tex | 2 +- lux/doc/lux.tex | 2 +- tao/doc/tao.tex | 4 +-- tao/version/tao_version_mod.f90 | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/bmad/code/multipass_all_info.f90 b/bmad/code/multipass_all_info.f90 index e52b506386..86aba8de36 100644 --- a/bmad/code/multipass_all_info.f90 +++ b/bmad/code/multipass_all_info.f90 @@ -43,10 +43,10 @@ subroutine multipass_all_info (lat, info) allocate (info%lord(n_multi_lord), info%branch(0:ubound(lat%branch, 1))) do ib = 0, ubound(lat%branch, 1) branch => lat%branch(ib) - allocate (info%branch(ib)%ele(branch%n_ele_max)) + allocate (info%branch(ib)%ele(0:branch%n_ele_max)) info%branch(ib)%ele(:)%multipass = .false. info%branch(ib)%ele(:)%ix_pass = -1 - do i = 1, branch%n_ele_max + do i = 0, branch%n_ele_max s_info => info%branch(ib)%ele(i) allocate (s_info%ix_lord(0)) allocate (s_info%ix_super(0)) diff --git a/bmad/doc/bmad.tex b/bmad/doc/bmad.tex index 3c8bf6ef13..4f672694dd 100644 --- a/bmad/doc/bmad.tex +++ b/bmad/doc/bmad.tex @@ -45,7 +45,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/bmad/output/write_lat_file_mod.f90 b/bmad/output/write_lat_file_mod.f90 index f8400f418b..ed1606bf51 100644 --- a/bmad/output/write_lat_file_mod.f90 +++ b/bmad/output/write_lat_file_mod.f90 @@ -47,7 +47,7 @@ subroutine multipass_region_info(lat, mult_lat, m_info) allocate (mult_lat%branch(0:ubound(lat%branch, 1))) do ib = 0, ubound(lat%branch, 1) branch => lat%branch(ib) - allocate (mult_lat%branch(ib)%ele(branch%n_ele_max)) + allocate (mult_lat%branch(ib)%ele(0:branch%n_ele_max)) mult_lat%branch(ib)%ele(:)%ix_region = 0 mult_lat%branch(ib)%ele(:)%region_start_pt = .false. mult_lat%branch(ib)%ele(:)%region_stop_pt = .false. diff --git a/bmad/output/write_lattice_in_julia.f90 b/bmad/output/write_lattice_in_julia.f90 index 7fe539c8f2..ed1210e363 100644 --- a/bmad/output/write_lattice_in_julia.f90 +++ b/bmad/output/write_lattice_in_julia.f90 @@ -119,17 +119,17 @@ subroutine write_lattice_in_julia(bmad_file, lat, julia_file) if (ie == 0) then line = trim(line) // ', pc_ref = ' // re_str(ele%value(p0c$)) - line = trim(line) // ', species_ref = ' // trim(openpmd_species_name(ele%ref_species)) - if (ele%a%beta /= 0) line = trim(line) // ', twiss.a.beta = ' // re_str(ele%a%beta) - if (ele%b%beta /= 0) line = trim(line) // ', twiss.b.beta = ' // re_str(ele%b%beta) - if (ele%a%alpha /= 0) line = trim(line) // ', twiss.a.alpha = ' // re_str(ele%a%alpha) - if (ele%b%alpha /= 0) line = trim(line) // ', twiss.b.alpha = ' // re_str(ele%b%alpha) - if (ele%x%eta /= 0) line = trim(line) // ', twiss.x.eta = ' // re_str(ele%x%eta) - if (ele%y%eta /= 0) line = trim(line) // ', twiss.y.eta = ' // re_str(ele%y%eta) - if (ele%x%etap /= 0) line = trim(line) // ', twiss.x.etap = ' // re_str(ele%x%etap) - if (ele%y%etap /= 0) line = trim(line) // ', twiss.y.etap = ' // re_str(ele%y%etap) - if (any(ele%c_mat /= 0)) line = trim(line) // ', twiss.c_mat = [' // re_str(ele%c_mat(1,1)) // ', ' // re_str(ele%c_mat(1,2)) // & - '; ' // re_str(ele%c_mat(2,1)) // ', ' // re_str(ele%c_mat(2,2)) // ']' + line = trim(line) // ', species_ref = species(' // quote(openpmd_species_name(ele%ref_species)) // ')' + if (ele%a%beta /= 0) line = trim(line) // ', beta_a = ' // re_str(ele%a%beta) + if (ele%b%beta /= 0) line = trim(line) // ', beta_b = ' // re_str(ele%b%beta) + if (ele%a%alpha /= 0) line = trim(line) // ', alpha_a = ' // re_str(ele%a%alpha) + if (ele%b%alpha /= 0) line = trim(line) // ', alpha_b = ' // re_str(ele%b%alpha) + if (ele%x%eta /= 0) line = trim(line) // ', eta_x = ' // re_str(ele%x%eta) + if (ele%y%eta /= 0) line = trim(line) // ', eta_y = ' // re_str(ele%y%eta) + if (ele%x%etap /= 0) line = trim(line) // ', etap_x = ' // re_str(ele%x%etap) + if (ele%y%etap /= 0) line = trim(line) // ', etap_y = ' // re_str(ele%y%etap) + !! if (any(ele%c_mat /= 0)) line = trim(line) // ', c_mat = [' // re_str(ele%c_mat(1,1)) // ', ' // re_str(ele%c_mat(1,2)) // & + !! '; ' // re_str(ele%c_mat(2,1)) // ', ' // re_str(ele%c_mat(2,2)) // ']' orb => lat%particle_start if (any(orb%vec /= 0)) line = trim(line) // ', particle.orbit = [' // re_str(orb%vec(1)) // ', ' // re_str(orb%vec(2)) // ', ' // & re_str(orb%vec(3)) // ', ' // re_str(orb%vec(4)) // ', ' // re_str(orb%vec(5)) // ', ' // re_str(orb%vec(6)) // ']' @@ -236,14 +236,14 @@ subroutine write_lattice_in_julia(bmad_file, lat, julia_file) ! if (ele%key == lcavity$) then - if (ele%value(rf_frequency$) /= 0) line = trim(line) // ', rf_frequency = ' // re_str(ele%value(rf_frequency$)) + if (ele%value(rf_frequency$) /= 0) line = trim(line) // ', frequency = ' // re_str(ele%value(rf_frequency$)) if (ele%value(voltage$) /= 0) line = trim(line) // ', voltage_ref = ' // re_str(ele%value(voltage$)) if (ele%value(voltage_err$) /= 0) line = trim(line) // ', voltage_err = ' // re_str(ele%value(voltage_err$)) if (ele%value(phi0$) /= 0) line = trim(line) // ', phase_ref = ' // re_str(ele%value(phi0$)) if (ele%value(phi0_err$) /= 0) line = trim(line) // ', phase_err = ' // re_str(ele%value(phi0_err$)) elseif (has_attribute(ele, 'RF_FREQUENCY')) then - if (ele%value(rf_frequency$) /= 0) line = trim(line) // ', rf_frequency = ' // re_str(ele%value(rf_frequency$)) + if (ele%value(rf_frequency$) /= 0) line = trim(line) // ', frequency = ' // re_str(ele%value(rf_frequency$)) if (ele%value(voltage$) /= 0) line = trim(line) // ', voltage = ' // re_str(ele%value(voltage$)) if (ele%value(phi0$) /= 0) line = trim(line) // ', phase = ' // re_str(ele%value(phi0$)) endif diff --git a/bmad/photon/track1_photon_mod.f90 b/bmad/photon/track1_photon_mod.f90 index 843bf5a78d..7269c88c4a 100644 --- a/bmad/photon/track1_photon_mod.f90 +++ b/bmad/photon/track1_photon_mod.f90 @@ -897,6 +897,7 @@ subroutine track1_crystal (ele, param, orbit) h_bar = h_norm * cp%wavelength / ele%value(d_spacing$) ! H-vector B&C Eq (1) normalized by the wavelength. ! cp%new_vvec is the normalized outgoing wavevector outside the crystal +! See B&C Eq (27) and paragraph after equation as well as Fig 10. cp%old_vvec = orbit%vec(2:6:2) ! Incomming K-vector (real part) normalized by the wavelength cp%new_vvec = orbit%vec(2:6:2) + h_bar ! Outgoing K-vector (real part) normalized by the wavelength diff --git a/bsim/ibs_ring/doc/ibs_ring.tex b/bsim/ibs_ring/doc/ibs_ring.tex index c32c8f5dbf..9dd5d9b794 100644 --- a/bsim/ibs_ring/doc/ibs_ring.tex +++ b/bsim/ibs_ring/doc/ibs_ring.tex @@ -54,7 +54,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/bsim/synrad/doc/synrad.tex b/bsim/synrad/doc/synrad.tex index 647a01ab0f..7a0c399ce0 100644 --- a/bsim/synrad/doc/synrad.tex +++ b/bsim/synrad/doc/synrad.tex @@ -48,7 +48,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/bsim/synrad3d/doc/synrad3d.tex b/bsim/synrad3d/doc/synrad3d.tex index b741351a1c..28f9885426 100644 --- a/bsim/synrad3d/doc/synrad3d.tex +++ b/bsim/synrad3d/doc/synrad3d.tex @@ -80,7 +80,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/bsim/touschek_background/doc/touschek_background.tex b/bsim/touschek_background/doc/touschek_background.tex index c061c635fe..617933bb63 100644 --- a/bsim/touschek_background/doc/touschek_background.tex +++ b/bsim/touschek_background/doc/touschek_background.tex @@ -53,7 +53,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/lux/doc/lux.tex b/lux/doc/lux.tex index fdbfa1b4c0..d1a6ca403d 100644 --- a/lux/doc/lux.tex +++ b/lux/doc/lux.tex @@ -44,7 +44,7 @@ \setlength{\textwidth}{6.25in} \setlength{\hoffset}{0.0in} -\setlength{\oddsidemargin}{0.25in} +\setlength{\oddsidemargin}{0.0in} \setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} diff --git a/tao/doc/tao.tex b/tao/doc/tao.tex index 80bb72b613..2eafedb3f5 100644 --- a/tao/doc/tao.tex +++ b/tao/doc/tao.tex @@ -30,8 +30,8 @@ \externaldocument[B-]{../../bmad/doc/lattice-file} \setlength{\textwidth}{6.25in} -\setlength{\oddsidemargin}{0.25in} -\setlength{\evensidemargin}{0.00in} +\setlength{\oddsidemargin}{0.0in} +\setlength{\evensidemargin}{0.0in} \setlength{\textheight}{8.5in} \setlength{\topmargin}{0in} \setlength{\skip\footins}{6pt} diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 00ebcb1c15..5c1a3a9347 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 = "2024/07/24 00:47:55" +character(*), parameter :: tao_version_date = "2024/07/24 20:44:28" end module