From 8756bf0d24a71d70f42f5ba599e89a1ad0a4ac2c Mon Sep 17 00:00:00 2001 From: David Sagan Date: Fri, 6 Oct 2023 00:43:44 -0400 Subject: [PATCH] Added ktap conversion from MAD-X to Bmad. --- tao/version/tao_version_mod.f90 | 2 +- util_programs/mad_to_bmad/madx_to_bmad.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index ff6a10d4b9..a51d502a38 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/10/05 02:03:56" +character(*), parameter :: tao_version_date = "2023/10/05 21:18:41" end module diff --git a/util_programs/mad_to_bmad/madx_to_bmad.py b/util_programs/mad_to_bmad/madx_to_bmad.py index 7f63c4ef59..5638744334 100644 --- a/util_programs/mad_to_bmad/madx_to_bmad.py +++ b/util_programs/mad_to_bmad/madx_to_bmad.py @@ -148,7 +148,7 @@ def __init__(self): } ignore_madx_param = ['lrad', 'slot_id', 'aper_tol', 'apertype', 'thick', 'add_angle', 'assembly_id', - 'mech_sep', 'betrf', 'tfill', 'shunt', 'pg'] + 'mech_sep', 'betrf', 'tfill', 'shunt', 'pg', 'model'] ignore_madx_ele_param = {} ignore_madx_ele_param['beambeam'] = ['particle', 'pc'] @@ -543,7 +543,8 @@ def parse_and_write_element(dlist, write_to_file, command): if 'kill_ent_fringe' in params: kill_ent = (params['kill_ent_fringe'] == 'true') if 'kill_exi_fringe' in params: kill_exi = (params['kill_exi_fringe'] == 'true') if 'k0' in params: params['dg'] = params.pop('k0') - if 'k0s' in params and 'l' in params: params['a0'] = params.pop('k0s') + ' * ' + params['l'] + if 'k0s' in params: params['a0'] = params.pop('k0s') + ' * ' + ele.name + '[angle]' + if 'ktap' in params: params['dg'] = params.pop('ktap') + ' * ' + ele.name + '[angle] / ' + ele.name + '[l]' if kill_ent and kill_exi: params['fringe_at'] = 'no_end' @@ -567,6 +568,8 @@ def parse_and_write_element(dlist, write_to_file, command): params['tilt'] = '-pi/4' params.pop('k1s') + if 'ktap' in params: params['k1'] = ele.name + '[k1] * (1 + ' + params.pop('ktap') + ')' + elif ele.madx_base_type == 'sextupole': if 'k2' in params and 'k2s' in params: if 'tilt' in params: @@ -582,6 +585,8 @@ def parse_and_write_element(dlist, write_to_file, command): params['tilt'] = '-pi/6' params.pop('k2s') + if 'ktap' in params: params['k2'] = ele.name + '[k2] * (1 + ' + params.pop('ktap') + ')' + elif ele.madx_base_type == 'octupole': if 'k3' in params and 'k3s' in params: