Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ktap conversion from MAD-X to Bmad. #546

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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