Skip to content

Commit

Permalink
Tao version update. (#1386)
Browse files Browse the repository at this point in the history
* Added tao%global%cmd_file_abort_on_error.

* Tao version update.
  • Loading branch information
DavidSagan authored Feb 11, 2025
1 parent c681ba3 commit e22a27d
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 9 deletions.
13 changes: 9 additions & 4 deletions tao/code/tao_abort_command_file.f90
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
!+
! 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

implicit none

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

Expand Down
2 changes: 1 addition & 1 deletion tao/code/tao_call_cmd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions tao/code/tao_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tao/code/tao_show_this.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tao/code/tao_struct.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion tao/doc/cover-page.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

\begin{flushright}
\large
Revision: February 7, 2025 \\
Revision: February 10, 2025 \\
\end{flushright}

\vfill
Expand Down
9 changes: 8 additions & 1 deletion tao/doc/initialization.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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?
Expand Down Expand Up @@ -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} =
Expand Down
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 = "2025/02/08 20:26:28"
character(*), parameter :: tao_version_date = "2025/02/10 20:33:00"
end module

0 comments on commit e22a27d

Please sign in to comment.