Skip to content

Commit

Permalink
Merge pull request #546 from bmad-sim/devel/step21
Browse files Browse the repository at this point in the history
Added ktap conversion from MAD-X to Bmad.
  • Loading branch information
DavidSagan committed Oct 6, 2023
2 parents 69f1cc5 + 8756bf0 commit 68e3c2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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/10/05 02:03:56"
character(*), parameter :: tao_version_date = "2023/10/05 21:18:41"
end module
9 changes: 7 additions & 2 deletions util_programs/mad_to_bmad/madx_to_bmad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 68e3c2e

Please sign in to comment.