From 5fcb4d05a5aff2c22f3ca0da5d632328f2ab1a2c Mon Sep 17 00:00:00 2001 From: David Sagan Date: Wed, 8 Nov 2023 22:24:52 -0500 Subject: [PATCH] New Match element syntax. --- bmad/doc/cover-page.tex | 2 +- bmad/low_level/match_ele_to_mat6.f90 | 2 +- regression_tests/TESTS.LIST | 1 + regression_tests/match_test/match_test.bmad | 30 ++++++++++++++++++--- regression_tests/match_test/match_test.f90 | 14 +++++++--- tao/version/tao_version_mod.f90 | 2 +- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/bmad/doc/cover-page.tex b/bmad/doc/cover-page.tex index efc767ffa2..e62539ffe9 100644 --- a/bmad/doc/cover-page.tex +++ b/bmad/doc/cover-page.tex @@ -3,7 +3,7 @@ \begin{flushright} \large - Revision: November 4, 2023 \\ + Revision: November 8, 2023 \\ \end{flushright} \pdfbookmark[0]{Preamble}{Preamble} diff --git a/bmad/low_level/match_ele_to_mat6.f90 b/bmad/low_level/match_ele_to_mat6.f90 index 4a64e7ace6..ee3c50b5b2 100644 --- a/bmad/low_level/match_ele_to_mat6.f90 +++ b/bmad/low_level/match_ele_to_mat6.f90 @@ -64,7 +64,7 @@ subroutine match_ele_to_mat6 (ele, start_orb, mat6, vec0, err_flag, include_delt v(pz0$) = start_orb%vec(6) endif -if (m_val == identity$ .or. t_ele%a%beta == 0 .or. t_ele%b%beta == 0) then +if (m_val == identity$ .or. ((t_ele%a%beta == 0 .or. t_ele%b%beta == 0) .and. (do_twiss .or. do_trombone))) then v(mode_flip0$) = int_logic(t_ele%mode_flip) v(mode_flip1$) = int_logic(t_ele%mode_flip) call mat_make_unit(mat6) diff --git a/regression_tests/TESTS.LIST b/regression_tests/TESTS.LIST index 3cbba98e47..f977f80c8f 100644 --- a/regression_tests/TESTS.LIST +++ b/regression_tests/TESTS.LIST @@ -17,6 +17,7 @@ girder_test hdf5_test long_term_tracking_test mat6_calc_method_test +match_test mode_flip_test mode3_test multipass_test diff --git a/regression_tests/match_test/match_test.bmad b/regression_tests/match_test/match_test.bmad index 3911315fa9..34d6859e16 100644 --- a/regression_tests/match_test/match_test.bmad +++ b/regression_tests/match_test/match_test.bmad @@ -21,11 +21,35 @@ particle_start[spin_z] = 0.5 m0: match, delta_time = 1e-9, beta_a0 = 1, beta_b0 = 2, beta_a1 = 2, beta_b1 = 3, c11_mat0 = 0.1, c12_mat0 = 0.2, c21_mat0 = 0.3, c22_mat0 = 0.4, - c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1 + c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1, + x0 = 0.01, px0 = 0.02, y0 = 0.03, py0 = 0.04, z0 = 0.05, pz0 = 0.06, + x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03 + +m1: match, beta_a1 = 20, beta_b1 = 15, matrix = match_twiss, kick0 = match_orbit, + c11_mat1 = 0.4, c12_mat1 = 0.3, c21_mat1 = 0.2, c22_mat1 = 0.1, + x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03 + +m2: match, matrix = phase_trombone, dphi_a = 1, dphi_b = 2, kick0 = zero, + x1 = 0.07, px1 = 0.08, y1 = 0.09, py1 = 0.01, z1 = 0.02, pz1 = 0.03 -!m1: match, beta_a1 = 20, beta_b1 = 15, matrix = match_twiss l0: line = (m0) -use, l0 + +l1: line = (m1) +l1[beta_a] = 10 +l1[alpha_a] = -1 +l1[beta_b] = 20 +l1[alpha_b] = 1 +l1[geometry] = open + +l2: line = (m1) +l2[beta_a] = 10 +l2[alpha_a] = -1 +l2[beta_b] = 20 +l2[alpha_b] = 1 +l2[geometry] = open + + +use, l0, l1, l2 diff --git a/regression_tests/match_test/match_test.f90 b/regression_tests/match_test/match_test.f90 index d11d1a390d..85bcde1e69 100644 --- a/regression_tests/match_test/match_test.f90 +++ b/regression_tests/match_test/match_test.f90 @@ -7,8 +7,9 @@ program match_test type (lat_struct), target :: lat type (branch_struct), pointer :: branch type (ele_struct), pointer :: ele +type (coord_struct) orb0, orb1 -integer ib, ie +integer i, ib, ie character(100) lat_file ! @@ -22,9 +23,16 @@ program match_test do ib = 0, ubound(lat%branch, 1) branch => lat%branch(ib) - ele => branch%ele(ie) - + ele => branch%ele(1) + call init_coord(orb0, lat%particle_start, ele, upstream_end$) + call make_mat6(ele, branch%param, lat%particle_start, orb0) + + write (1, '(a, i0, a, 6es16.8)') '"Vec0-', ib, '" ABS 1E-10', ele%vec0 + do i = 1, 6 + write (1, '(2(a, i0), a, 6es16.8)') '"Mat', i, '-', ib, '" ABS 1E-10', ele%mat6(i,:) + enddo enddo +close(1) end program diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 27531414bb..ec172cceee 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/11/08 13:48:34" +character(*), parameter :: tao_version_date = "2023/11/08 20:53:59" end module