!+ ! Subroutine bmad_lattice_bookkeeper(ix_lat, c_err) ! ! Calculates transfer matrix between two points. ! ! Input: ! ix_lat -- Integer: Index of lattice to create ! ! Output: ! c_err -- C_logical: Set True if there is an error. False otherwise. !- subroutine bmad_lattice_bookkeeper(ix_lat, c_err) use bmad_common_mod use bookkeeper_mod implicit none type (lat_struct), pointer :: lat integer ix_lat logical(c_bool) c_err character(28), parameter :: r_name = 'bmad_lattice_bookkeeper' logical err_flag ! c_err = c_logic(.true.) if (lat_status(ix_lat) /= init_done$) then call out_io (s_error$, r_name, "Lattice \i0\ not yet initialized!", ix_lat) return endif lat => bd_com(ix_lat)%lat call lattice_bookkeeper(lat) call track_all (lat, bd_com(ix_lat)%orb, 0, bd_com(ix_lat)%track_state, err_flag) if (err_flag) return call lat_make_mat6 (lat, -1, bd_com(ix_lat)%orb, err_flag = err_flag) if (err_flag) return call twiss_propagate_all (lat) c_err = c_logic(.false.) end subroutine