From 0a1a2a984c067702232282ba0834953d5ff32618 Mon Sep 17 00:00:00 2001 From: David Sagan Date: Wed, 17 Jul 2024 20:40:01 -0400 Subject: [PATCH] Fix ele_to_fibre to better preserve Taylor map. (#1071) --- README.md | 2 +- bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex | 4 ++-- bmad/ptc/ele_to_fibre.f90 | 8 +++++--- tao/version/tao_version_mod.f90 | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bb17711299..3a214d5cdc 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The external packages repository is simply a set of libraries needed by Bmad. ```bash cd bmad-ecosystem rm ../bmad-external-packages/README.md # Do not copy this file -cp -r ../bmad-external-packages . +cp -r ../bmad-external-packages/\* . ``` To build everything: diff --git a/bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex b/bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex index 023805dc5b..23c0c6ea91 100644 --- a/bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex +++ b/bmad-doc/tutorial_bmad_tao/doc/tutorial_bmad_tao.tex @@ -5285,8 +5285,8 @@ \subsection{Exercises} set curve r23.g.y legend_text = "X" set curve r23.g.y component = design \end{code} -Note: By default, orbit plots have a non-blank legend_text which is why the legend_text needs to be changed. -What happens if, instead of setting to ``X'', the legend_text is set to a blank string? +Note: By default, orbit plots have a non-blank \vn{legend_text} which is why the \vn{legend_text} needs to be changed. +What happens if, instead of setting to ``X'', the \vn{legend_text} is set to a blank string? % \item \begin{code} diff --git a/bmad/ptc/ele_to_fibre.f90 b/bmad/ptc/ele_to_fibre.f90 index 3c0f26eaeb..6a6253677d 100644 --- a/bmad/ptc/ele_to_fibre.f90 +++ b/bmad/ptc/ele_to_fibre.f90 @@ -131,6 +131,7 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord endif use_taylor = (n_map == 0 .and. (key == wiggler$ .or. key == undulator$) .and. ele%field_calc == helical_model$) +use_taylor = use_taylor .or. (ele%tracking_method == taylor$ .and. associated(ele%spin_taylor(1)%term)) if (use_taylor) key = match$ ! @@ -209,7 +210,8 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord ! if (key == sbend$ .and. val(l$) == 0) key = kicker$ -if (ele2%field_calc == fieldmap$ .and. ele2%tracking_method /= bmad_standard$) key = wiggler$ +if (ele2%field_calc == fieldmap$ .and. ele2%tracking_method /= bmad_standard$ .and. & + .not. use_taylor) key = wiggler$ select case (key) @@ -898,8 +900,8 @@ subroutine ele_to_fibre (ele, ptc_fibre, param, use_offsets, err_flag, integ_ord ! FieldMap cartesian_map element. ! Include all wiggler elements even planar_model with field_calc = bmad_standard$ -if (.not. associated(ele2%gen_grad_map) .and. .not. associated(ele2%cylindrical_map) .and. (key == wiggler$ .or. & - key == undulator$ .or. (associated(ele2%cartesian_map) .and. ele2%field_calc == fieldmap$))) then +if (.not. use_taylor .and. .not. associated(ele2%gen_grad_map) .and. .not. associated(ele2%cylindrical_map) .and. & + (key == wiggler$ .or. key == undulator$ .or. (associated(ele2%cartesian_map) .and. ele2%field_calc == fieldmap$))) then is_planar_wiggler = ((key == wiggler$ .or. key == undulator$) .and. ele2%field_calc == planar_model$) diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 99bd5693f7..83be9b937f 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/15 21:04:15" +character(*), parameter :: tao_version_date = "2024/07/16 21:03:51" end module