Skip to content

Commit

Permalink
Merge pull request #601 from bmad-sim/devel/41
Browse files Browse the repository at this point in the history
Fix translation to MADX for RF lag parameter (needed neg sign).
  • Loading branch information
DavidSagan authored Oct 28, 2023
2 parents 85b606c + b9fc90d commit fa978c7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.pdf
bmad-doc/cookbook_bmad_tao/doc/cookbook_bmad_tao.toc
bmad-doc/tao_examples/csr_beam_tracking/csr_wake.dat

tao/doc/tao.pdf
bmad/doc/bmad.pdf
bsim/**/doc/*.pdf

Expand Down
2 changes: 1 addition & 1 deletion bmad/doc/elements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3271,7 +3271,7 @@ \section{Match}
If the \vn{phase_trombone} is set True, when running a program, the \bmad bookkeeping code will
appropriately set the values of \vn{beta_a0}, \vn{beta_a1}, \vn{alpha_b0}, etc. to match the desired
transfer matrix. The \bmad bookkeeping code will then set \vn{phase_trombone} to False to freeze the
transfer matrix against change if the parameters in the lattice are varied.
transfer matrix against variation of any lattice parameters.

When a lattice is read in, the \vn{phase_trombone_input} attribute is set by \bmad to be equal to
\vn{phase_trombone}. This attribute does not affect any computations and is not settable by the
Expand Down
38 changes: 0 additions & 38 deletions regression_tests/scripts/svn_regression.py

This file was deleted.

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/27 23:43:51"
character(*), parameter :: tao_version_date = "2023/10/28 02:30:40"
end module
24 changes: 0 additions & 24 deletions util/searchf.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ def print_help_message ():
code_examples tao
forest util_programs
Additionally, at Cornell, the following directories are searched:
bmadz genplt
bsim_cesr instr_utils
cesr_programs mpm_utils
cesr_utils mpmnet
cesrv nonlin_bpm
univ_tune_tracker
''')
sys.exit()

Expand Down Expand Up @@ -622,24 +615,7 @@ def search_all (doc_type):

if len(dir_list) == 0: # If no -d command line arg
choose_path (dir_list, root_dir, 'univ_tune_tracker', '/code/tt_acq_sub.f90', '')
choose_path (dir_list, root_dir, 'cesr_utils', '/modules/cesr_utils.f90', '')
choose_path (dir_list, root_dir, 'mpm_utils', '/code/butout.f90', '')
choose_path (dir_list, root_dir, 'bmadz', '/modules/bmadz_struct.f90', '')
choose_path (dir_list, root_dir, 'bsim_cesr', '/modules/bsim_cesr_interface.f90', '')
choose_path (dir_list, root_dir, 'cesr_programs', '/bmad_to_ing_knob/bmad_to_ing_knob.f90', '')
choose_path (dir_list, root_dir, 'cesrv', '/code/cesrv_struct.f90', '')
choose_path (dir_list, root_dir, 'util_programs', '/mad_to_bmad/madx_to_bmad.py', '')
choose_path (dir_list, root_dir, 'nonlin_bpm', '/code/nonlin_bpm_init.f90', '')
choose_path (dir_list, root_dir, 'mpmnet', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'genplt', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'instr_utils', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'rfnet', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'rf', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'timing', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'hard', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'save', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'vac', '/CMakeLists.txt', '')
choose_path (dir_list, root_dir, 'recipes_f-90_LEPP', '/lib_src/nr.f90', '/packages/')
choose_path (dir_list, root_dir, 'forest', '/code/i_tpsa.f90', '')
choose_path (dir_list, root_dir, 'bsim', '/code/bsim_interface.f90', '')
choose_path (dir_list, root_dir, 'code_examples', '/simple_bmad_program/simple_bmad_program.f90', '')
Expand Down
12 changes: 10 additions & 2 deletions util_programs/mad_to_bmad/madx_to_bmad.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def __init__(self):
'lag': ' - 0.5',
}

negate_param = ['lag']

const_trans = {
'e': 'e_log',
'nmass': 'm_neutron * 1e9',
Expand Down Expand Up @@ -338,7 +340,7 @@ def parameter_dictionary(word_lst):
# To convert <expression> a construct that look like "<target_param> = <expression>".

def bmad_expression(line, target_param):
global const_trans, ele_param_factor
global const_trans, ele_param_factor, negate_param, ele_inv_param_factor

# Remove {, and } chars for something like "kn := {a, b, c}". Also remove leading and ending quote marks
line = line.replace('{', '').replace('}', '').strip('"\'')
Expand Down Expand Up @@ -369,7 +371,13 @@ def bmad_expression(line, target_param):

# End while

if target_param in ele_inv_param_factor: out = add_parens(out, True) + ele_inv_param_factor[target_param]
if target_param in ele_inv_param_factor:
if target_param in negate_param:
out = '-' + add_parens(out, True) + ele_inv_param_factor[target_param]
else:
out = add_parens(out, True) + ele_inv_param_factor[target_param]


return out

#-------------------------------------------------------------------
Expand Down

0 comments on commit fa978c7

Please sign in to comment.