Skip to content

Commit

Permalink
Merge pull request #622 from bmad-sim/devel/49
Browse files Browse the repository at this point in the history
Fix multipole_test to not fail on Mac.
  • Loading branch information
DavidSagan authored Nov 6, 2023
2 parents 0db09c2 + bf08193 commit 4bf61a4
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

subroutine tao_hook_command (command_line, found)

use tao_command_mod, dummy => tao_hook_command
use tao_command_mod

implicit none

Expand Down Expand Up @@ -143,7 +143,7 @@ subroutine tao_hook_command (command_line, found)
return
endif

u => s%u(d2(1)%d2%ix_uni)
u => s%u(d2(1)%d2%ix_universe)
lat => u%design%lat
design_tune_a = lat%ele(lat%n_ele_track)%a%phi / twopi
design_tune_b = lat%ele(lat%n_ele_track)%b%phi / twopi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ program tao_program

implicit none

procedure(tao_hook_command_def) :: tao_hook_command

! Call tao_top_level and we are done.

tao_hook_command_ptr => tao_hook_command

call tao_top_level()

end program
1 change: 0 additions & 1 deletion bmad-doc/tutorial_bmad_tao/doc/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
\newcommand{\Eq}[1]{{Eq.~(\protect\ref{#1})}}
\newcommand{\Eqs}[1]{{Eqs.~(\protect\ref{#1})}}

\newcommand{\svn}{\vn{Subversion}\xspace}
\newcommand{\sref}[1]{\S\ref{#1}}
\newcommand{\Sref}[1]{Sec.~\sref{#1}}
\newcommand{\extref}[1]{\S\ref*{#1}} % No hyperlink. For external refs. \extref
Expand Down
14 changes: 10 additions & 4 deletions regression_tests/multipole_test/multipole_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ program multipole_test
real(rp) ae1(0:n_pole_maxx), ae2(0:n_pole_maxx), be1(0:n_pole_maxx), be2(0:n_pole_maxx)
real(rp) km1(0:n_pole_maxx), tm1(0:n_pole_maxx), km2(0:n_pole_maxx), tm2(0:n_pole_maxx)
real(rp) ke1(0:n_pole_maxx), te1(0:n_pole_maxx), ke2(0:n_pole_maxx), te2(0:n_pole_maxx)
real(rp) dtm, dte, fn, tilt
real(rp) dtm, dte, fn, tilt, max_km, max_ke

integer i, ie, iu, ik, ix_pole_max, include_kicks
integer, parameter :: inc_kick(2) = [no$, include_kicks$]
Expand Down Expand Up @@ -72,27 +72,33 @@ program multipole_test
call multipole_ab_to_kt (ae1, be1, ke1, te1)
call multipole_ab_to_kt (ae2, be2, ke2, te2)

dtm = 0
dte = 0
dtm = 0; dte = 0
max_km = 0; max_ke = 0

do i = 0, n_pole_maxx
fn = 2.0_rp * real(i+1, rp)
call flip_it(i, km1(i), tm1(i)); call flip_it(i, km2(i), tm2(i))
call flip_it(i, ke1(i), te1(i)); call flip_it(i, ke2(i), te2(i))

if (ele%key == sbend$) then
tilt = ele%value(ref_tilt$) / twopi
else
tilt = ele%value(tilt$) / twopi
endif

if (use_ele_tilt) then
if (km1(i) /= 0) dtm = max(dtm, modulo2(tm1(i)-tm2(i)-tilt, 1.0_rp/fn))
if (ke1(i) /= 0) dte = max(dte, modulo2(te1(i)-te2(i)-tilt, 1.0_rp/fn))
else
if (km1(i) /= 0) dtm = max(dtm, modulo2(tm1(i)-tm2(i)+tilt, 1.0_rp/fn))
if (ke1(i) /= 0) dte = max(dte, modulo2(te1(i)-te2(i)+tilt, 1.0_rp/fn))
endif

if (abs(km1(i)) + abs(km2(i)) /= 0) max_km = max(max_km, abs(km1(i)-km2(i)) / (abs(km1(i)) + abs(km2(i))))
if (abs(ke1(i)) + abs(ke2(i)) /= 0) max_ke = max(max_ke, abs(ke1(i)-ke2(i)) / (abs(ke1(i)) + abs(ke2(i))))
enddo

write (1, '(a, 6es12.4)') '"KT-' // str // trim(ele%name) // '" ABS 1E-12', maxval(abs(km1-km2)), maxval(abs(ke1-ke2)), dtm, dte
write (1, '(a, 6es12.4)') '"KT-' // str // trim(ele%name) // '" ABS 1E-12', max_km, max_ke, dtm, dte

!

Expand Down
56 changes: 28 additions & 28 deletions regression_tests/multipole_test/output.correct
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"Changed" ABS 0 -0.010000 0
"MULT-11-QQ#1" ABS 0 1.0000E+00 2.0000E+00 3.0000E+00 1.5000E-01 2.5000E-01 0.0000E+00 5
"DEL-11-QQ#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-QQ#1" ABS 1E-12 1.4211E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-11-QQ#1" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"MULT-12-QQ#1" ABS 0 1.0000E+00 2.0000E+00 3.0000E+00 1.5000E-01 2.5000E-01 0.0000E+00 5
"DEL-12-QQ#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-QQ#1" ABS 1E-12 1.4211E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-12-QQ#1" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"MULT-21-QQ#1" ABS 0 -1.0000E-01 -2.0000E+00 3.0000E-01 9.5459E-01 -1.9445E+00 0.0000E+00 5
"DEL-21-QQ#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-QQ#1" ABS 1E-12 1.4211E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-21-QQ#1" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"MULT-22-QQ#1" ABS 0 -1.0005E-01 -2.0000E+00 3.0000E-01 9.5459E-01 -1.9445E+00 0.0000E+00 5
"DEL-22-QQ#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-QQ#1" ABS 1E-12 1.4211E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-22-QQ#1" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"MULT-11-M1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 -1
"DEL-11-M1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-M1" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
Expand All @@ -25,28 +25,28 @@
"KT-22-M1" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-11-QQ#2" ABS 0 1.0000E+00 2.0000E+00 3.0000E+00 1.5000E-01 2.5000E-01 0.0000E+00 5
"DEL-11-QQ#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-QQ#2" ABS 1E-12 1.4211E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-11-QQ#2" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"MULT-12-QQ#2" ABS 0 1.0000E+00 2.0000E+00 3.0000E+00 1.5000E-01 2.5000E-01 0.0000E+00 5
"DEL-12-QQ#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-QQ#2" ABS 1E-12 1.4211E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-12-QQ#2" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"MULT-21-QQ#2" ABS 0 -1.0000E-01 -2.0000E+00 3.0000E-01 9.5459E-01 -1.9445E+00 0.0000E+00 5
"DEL-21-QQ#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-QQ#2" ABS 1E-12 1.4211E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-21-QQ#2" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"MULT-22-QQ#2" ABS 0 -1.0005E-01 -2.0000E+00 3.0000E-01 9.5459E-01 -1.9445E+00 0.0000E+00 5
"DEL-22-QQ#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-QQ#2" ABS 1E-12 1.4211E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-22-QQ#2" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"MULT-11-BB#1" ABS 0 1.0000E-05 2.0000E-05 3.0000E-05 1.5000E-06 2.5000E-06 0.0000E+00 5
"DEL-11-BB#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-BB#1" ABS 1E-12 4.3368E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-11-BB#1" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"MULT-12-BB#1" ABS 0 1.0000E-05 2.0000E-05 3.0000E-05 5.1500E-05 2.5000E-06 0.0000E+00 5
"DEL-12-BB#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-BB#1" ABS 1E-12 4.3368E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-12-BB#1" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"MULT-21-BB#1" ABS 0 -1.0000E-05 2.0000E-05 -3.0000E-05 -1.5000E-05 7.6540E-22 0.0000E+00 5
"DEL-21-BB#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-BB#1" ABS 1E-12 4.3368E-19 1.7764E-15 0.0000E+00 0.0000E+00
"KT-21-BB#1" ABS 1E-12 1.6857E-16 1.2275E-16 0.0000E+00 0.0000E+00
"MULT-22-BB#1" ABS 0 -1.0000E-05 2.0000E-05 -3.0000E-05 -1.5000E-05 7.6540E-22 0.0000E+00 5
"DEL-22-BB#1" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-BB#1" ABS 1E-12 4.3368E-19 1.7764E-15 1.9082E-17 0.0000E+00
"KT-22-BB#1" ABS 1E-12 1.6857E-16 1.2275E-16 1.9082E-17 0.0000E+00
"MULT-11-M2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 -1
"DEL-11-M2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-M2" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
Expand All @@ -61,16 +61,16 @@
"KT-22-M2" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-11-BB#2" ABS 0 1.0000E-05 2.0000E-05 3.0000E-05 1.5000E-06 2.5000E-06 0.0000E+00 5
"DEL-11-BB#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-BB#2" ABS 1E-12 4.3368E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-11-BB#2" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"MULT-12-BB#2" ABS 0 1.0000E-05 2.0000E-05 3.0000E-05 5.1500E-05 2.5000E-06 0.0000E+00 5
"DEL-12-BB#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-BB#2" ABS 1E-12 4.3368E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-12-BB#2" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"MULT-21-BB#2" ABS 0 -1.0000E-05 2.0000E-05 -3.0000E-05 -1.5000E-05 7.6540E-22 0.0000E+00 5
"DEL-21-BB#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-BB#2" ABS 1E-12 4.3368E-19 1.7764E-15 0.0000E+00 0.0000E+00
"KT-21-BB#2" ABS 1E-12 1.6857E-16 1.2275E-16 0.0000E+00 0.0000E+00
"MULT-22-BB#2" ABS 0 -1.0000E-05 2.0000E-05 -3.0000E-05 -1.5000E-05 7.6540E-22 0.0000E+00 5
"DEL-22-BB#2" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-BB#2" ABS 1E-12 4.3368E-19 1.7764E-15 1.9082E-17 0.0000E+00
"KT-22-BB#2" ABS 1E-12 1.6857E-16 1.2275E-16 1.9082E-17 0.0000E+00
"MULT-11-MM" ABS 0 -7.7884E-01 -6.6638E-01 2.2126E-02 9.3241E-01 -1.6690E-01 0.0000E+00 -1
"DEL-11-MM" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-MM" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
Expand All @@ -85,16 +85,16 @@
"KT-22-MM" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-11-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 5
"DEL-11-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-EE" ABS 1E-12 0.0000E+00 1.7764E-15 0.0000E+00 5.5511E-17
"KT-11-EE" ABS 1E-12 0.0000E+00 1.2275E-16 0.0000E+00 5.5511E-17
"MULT-12-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 5
"DEL-12-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-EE" ABS 1E-12 0.0000E+00 1.7764E-15 0.0000E+00 5.5511E-17
"KT-12-EE" ABS 1E-12 0.0000E+00 1.2275E-16 0.0000E+00 5.5511E-17
"MULT-21-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 5
"DEL-21-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-EE" ABS 1E-12 0.0000E+00 1.7764E-15 0.0000E+00 0.0000E+00
"KT-21-EE" ABS 1E-12 0.0000E+00 1.2275E-16 0.0000E+00 0.0000E+00
"MULT-22-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 5
"DEL-22-EE" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-EE" ABS 1E-12 0.0000E+00 1.7764E-15 0.0000E+00 0.0000E+00
"KT-22-EE" ABS 1E-12 0.0000E+00 1.2275E-16 0.0000E+00 0.0000E+00
"MULT-11-END" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 -1
"DEL-11-END" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-END" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
Expand All @@ -109,33 +109,33 @@
"KT-22-END" ABS 1E-12 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-11-QQ" ABS 0 2.0000E+00 4.0000E+00 6.0000E+00 3.0000E-01 5.0000E-01 0.0000E+00 5
"DEL-11-QQ" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-QQ" ABS 1E-12 2.8422E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-11-QQ" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"SLAVE-11-QQ" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-12-QQ" ABS 0 2.0000E+00 4.0000E+00 6.0000E+00 3.0000E-01 5.0000E-01 0.0000E+00 5
"DEL-12-QQ" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-QQ" ABS 1E-12 2.8422E-14 3.4694E-18 2.7756E-17 2.7756E-17
"KT-12-QQ" ABS 1E-12 1.1784E-16 8.6306E-17 2.7756E-17 2.7756E-17
"SLAVE-12-QQ" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-21-QQ" ABS 0 -2.0000E-01 -4.0000E+00 6.0000E-01 1.9092E+00 -3.8891E+00 0.0000E+00 5
"DEL-21-QQ" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-QQ" ABS 1E-12 2.8422E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-21-QQ" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"SLAVE-21-QQ" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-22-QQ" ABS 0 -2.0010E-01 -4.0000E+00 6.0000E-01 1.9092E+00 -3.8891E+00 0.0000E+00 5
"DEL-22-QQ" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-QQ" ABS 1E-12 2.8422E-14 3.4694E-18 6.9389E-18 6.9389E-18
"KT-22-QQ" ABS 1E-12 1.1784E-16 8.6306E-17 6.9389E-18 6.9389E-18
"SLAVE-22-QQ" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-11-BB" ABS 0 2.0000E-05 4.0000E-05 6.0000E-05 3.0000E-06 5.0000E-06 0.0000E+00 5
"DEL-11-BB" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-11-BB" ABS 1E-12 8.6736E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-11-BB" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"SLAVE-11-BB" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-12-BB" ABS 0 2.0000E-05 4.0000E-05 6.0000E-05 1.0300E-04 5.0000E-06 0.0000E+00 5
"DEL-12-BB" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-12-BB" ABS 1E-12 8.6736E-19 1.7764E-15 5.5511E-17 5.5511E-17
"KT-12-BB" ABS 1E-12 1.6857E-16 1.2275E-16 5.5511E-17 5.5511E-17
"SLAVE-12-BB" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-21-BB" ABS 0 -2.0000E-05 4.0000E-05 -6.0000E-05 -3.0000E-05 1.5308E-21 0.0000E+00 5
"DEL-21-BB" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-21-BB" ABS 1E-12 8.6736E-19 1.7764E-15 0.0000E+00 0.0000E+00
"KT-21-BB" ABS 1E-12 1.6857E-16 1.2275E-16 0.0000E+00 0.0000E+00
"SLAVE-21-BB" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"MULT-22-BB" ABS 0 -2.0000E-05 4.0000E-05 -6.0000E-05 -3.0000E-05 1.5308E-21 0.0000E+00 5
"DEL-22-BB" ABS 0 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
"KT-22-BB" ABS 1E-12 8.6736E-19 1.7764E-15 1.9082E-17 0.0000E+00
"KT-22-BB" ABS 1E-12 1.6857E-16 1.2275E-16 1.9082E-17 0.0000E+00
"SLAVE-22-BB" ABS 1E-14 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
2 changes: 1 addition & 1 deletion tao/version/tao_version_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
!-

module tao_version_mod
character(*), parameter :: tao_version_date = "2023/11/02 21:18:08"
character(*), parameter :: tao_version_date = "2023/11/04 03:26:16"
end module

0 comments on commit 4bf61a4

Please sign in to comment.