From 88ccfb700fbd17826d755fd34e4a79b0275573b9 Mon Sep 17 00:00:00 2001 From: David Sagan Date: Fri, 26 Jul 2024 10:48:37 -0400 Subject: [PATCH] More bmad_to_julia devel. --- bmad/code/multipass_all_info.f90 | 4 ++-- bmad/output/write_lat_file_mod.f90 | 2 +- bmad/output/write_lattice_in_julia.f90 | 26 +++++++++++++------------- tao/version/tao_version_mod.f90 | 2 +- 4 files changed, 17 insertions(+), 17 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/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/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