From e22a27d96e556ddd87dec52229319b70dfb1ca4d Mon Sep 17 00:00:00 2001 From: David Sagan Date: Mon, 10 Feb 2025 20:49:39 -0500 Subject: [PATCH] Tao version update. (#1386) * Added tao%global%cmd_file_abort_on_error. * Tao version update. --- tao/code/tao_abort_command_file.f90 | 13 +++++++++---- tao/code/tao_call_cmd.f90 | 2 +- tao/code/tao_interface.f90 | 5 +++++ tao/code/tao_show_this.f90 | 1 + tao/code/tao_struct.f90 | 2 +- tao/doc/cover-page.tex | 2 +- tao/doc/initialization.tex | 9 ++++++++- tao/version/tao_version_mod.f90 | 2 +- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/tao/code/tao_abort_command_file.f90 b/tao/code/tao_abort_command_file.f90 index 1dc34fe07..9985cdc68 100644 --- a/tao/code/tao_abort_command_file.f90 +++ b/tao/code/tao_abort_command_file.f90 @@ -1,10 +1,14 @@ !+ -! Subroutine tao_abort_command_file() +! Subroutine tao_abort_command_file(force_abort) ! ! Routine to close all open command files. +! +! Input: +! force_abort -- Logical, optional :: If present and True, ignore s%global%cmd_file_abort_on_error +! and abort any open command files. !- -subroutine tao_abort_command_file() +subroutine tao_abort_command_file(force_abort) use tao_struct @@ -12,14 +16,15 @@ subroutine tao_abort_command_file() integer i character(40) :: r_name = 'tao_abort_command_file' +logical, optional :: force_abort ! -call tao_quiet_set('cmd-file-end') +if (.not. (logic_option(.false., force_abort) .or. s%global%cmd_file_abort_on_error)) return do i = s%com%cmd_file_level, 1, -1 if (s%com%cmd_file(i)%paused .or. s%global%single_step) return - call out_io (s_warn$, r_name, 'ABORTING COMMAND FILE DUE TO DETECTED ERROR: ' // s%com%cmd_file(i)%full_name) + call out_io (s_error$, r_name, 'ABORTING COMMAND FILE DUE TO DETECTED ERROR: ' // s%com%cmd_file(i)%full_name) call tao_close_command_file() enddo diff --git a/tao/code/tao_call_cmd.f90 b/tao/code/tao_call_cmd.f90 index eaed2e003..b434f4de4 100644 --- a/tao/code/tao_call_cmd.f90 +++ b/tao/code/tao_call_cmd.f90 @@ -60,7 +60,7 @@ subroutine tao_call_cmd (file_name, cmd_arg) nl = nl0 + 1 if (nl > 30) then call out_io (s_error$, r_name, 'COMMAND FILE LEVEL > 30 INDICATES INFINITE LOOP. CLOSING ALL COMMAND FILES.') - call tao_abort_command_file() + call tao_abort_command_file(force_abort = .true.) return endif diff --git a/tao/code/tao_interface.f90 b/tao/code/tao_interface.f90 index 70c0c1b0c..3c21c6c28 100644 --- a/tao/code/tao_interface.f90 +++ b/tao/code/tao_interface.f90 @@ -44,6 +44,11 @@ module tao_interface interface +subroutine tao_abort_command_file(force_abort) + implicit none + logical, optional :: force_abort +end subroutine + subroutine tao_alias_cmd (alias, string) implicit none character(*) :: alias diff --git a/tao/code/tao_show_this.f90 b/tao/code/tao_show_this.f90 index 4d95f6f8b..ad4022a02 100644 --- a/tao/code/tao_show_this.f90 +++ b/tao/code/tao_show_this.f90 @@ -2123,6 +2123,7 @@ subroutine tao_show_this (what, result_id, lines, nl) nl=nl+1; write(lines(nl), lmt) ' %beam_timer_on = ', s%global%beam_timer_on nl=nl+1; write(lines(nl), imt) ' %bunch_to_plot = ', s%global%bunch_to_plot nl=nl+1; write(lines(nl), imt) ' %datum_err_messages_max = ', s%global%datum_err_messages_max + nl=nl+1; write(lines(nl), lmt) ' %cmd_file_abort_on_error = ', s%global%cmd_file_abort_on_error nl=nl+1; write(lines(nl), lmt) ' %concatenate_maps = ', s%global%concatenate_maps nl=nl+1; write(lines(nl), rmt) ' %beam_dead_cutoff = ', s%global%beam_dead_cutoff nl=nl+1; write(lines(nl), rmt) ' %delta_e_chrom = ', s%global%delta_e_chrom diff --git a/tao/code/tao_struct.f90 b/tao/code/tao_struct.f90 index 9a1de326c..b87a101e9 100644 --- a/tao/code/tao_struct.f90 +++ b/tao/code/tao_struct.f90 @@ -674,7 +674,7 @@ module tao_struct character(100) :: history_file = '~/.history_tao' logical :: beam_timer_on = .false. ! For timing the beam tracking calculation. logical :: box_plots = .false. ! For debugging plot layout issues. - logical :: command_file_print_on = .true. ! Depracated. No longer used. + logical :: cmd_file_abort_on_error = .true. ! Abort open command files if there is an error? logical :: concatenate_maps = .false. ! False => tracking using DA. logical :: debug_on = .false. ! For debugging. logical :: derivative_recalc = .true. ! Recalc before each optimizer run? diff --git a/tao/doc/cover-page.tex b/tao/doc/cover-page.tex index 58232263b..e383891c4 100644 --- a/tao/doc/cover-page.tex +++ b/tao/doc/cover-page.tex @@ -2,7 +2,7 @@ \begin{flushright} \large -Revision: February 7, 2025 \\ +Revision: February 10, 2025 \\ \end{flushright} \vfill diff --git a/tao/doc/initialization.tex b/tao/doc/initialization.tex index f143ec6f6..9071b1af8 100644 --- a/tao/doc/initialization.tex +++ b/tao/doc/initialization.tex @@ -622,9 +622,9 @@ \subsection{Tao\_global\_struct Structure} \begin{example} type tao_global_struct: beam_dead_cutoff = 0.99 ! Dead particle cutoff for stopping beam tracking. - lm_opt_deriv_reinit = -1 ! Derivative matrix cutoff. -1 => ignore this. de_lm_step_ratio = 1 ! Step sizes between DE and LM optimizers. de_var_to_population_factor = 5 + lm_opt_deriv_reinit = -1 ! Derivative matrix cutoff. -1 => ignore this. lmdif_eps = 1e-12 ! Tolerance for lmdif optimizer. lmdif_negligible_merit = 1d-30 ! lmdif stops if merit is smaller. svd_cutoff = 1e-5 ! SVD singular value cutoff limit. @@ -651,6 +651,7 @@ \subsection{Tao\_global\_struct Structure} var_out_file = "var#.out" history_file = "\(\sim\)/.history_tao" ! Command history file. beam_timer_on = F ! For timing the beam tracking calculation. + cmd_file_abort_on_error = T ! Close all open command files when there is an error? concatenate_maps = F ! False => tracking using DA. derivative_recalc = T ! Recalc derivatives before each optimizer loop? derivative_uses_design = F ! Derivative matrix uses the design lattice? @@ -684,6 +685,12 @@ \subsection{Tao\_global\_struct Structure} \begin{description} \item{\vn{global%beam_dead_cutoff}} \Newline Percentage of dead particles at which beam tracking is stopped. +% + \item{\vn{global%cmd_file_abort_on_error}} \Newline +The default is \vn{True}. With this setting, if there is an error, any open command files (and there +can be multiple ones since command files can call other files), are closed if a command in a command +file generates an error. If this parameter is set \vn{False}, most errors will not result in any +open command files being closed. The exception is if infinite command file recursion is detected. % \item{\vn{global%concatenate_maps}} \Newline When constructing transfer Taylor maps the default method, used with \vn{global%concatenate_maps} = diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 459f05604..09569cb24 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 = "2025/02/08 20:26:28" +character(*), parameter :: tao_version_date = "2025/02/10 20:33:00" end module