!+ ! Subroutine bmad_clone_lat (ix_lat_in, ix_lat_clone, c_err) ! ! Clones a lattice. ! ! Input: ! ix_lat_in -- Integer: Index of lattice to clone. ! ix_lat_clone -- Integer: Index of clone. ! ! Output: ! c_err -- C_logical: Set True if there is an error. False otherwise. !- subroutine bmad_clone_lat (ix_lat_in, ix_lat_clone, c_err) use bmad_common_mod use transfer_map_mod use write_lat_file_mod implicit none type (lat_struct), pointer :: lat integer ix_lat_in, ix_lat_clone logical(c_bool) c_err character(28), parameter :: r_name = 'bmad_clone_lat' ! c_err = c_logic(.true.) if (lat_status(ix_lat_in) /= init_done$) then call out_io (s_error$, r_name, "Lattice \i0\ not yet initialized!", ix_lat_in) return endif if (lat_status(ix_lat_clone) == bad$) then call out_io (s_error$, r_name, "Lattice index for clone \i0\ out of range!", ix_lat_in) return endif bd_com(ix_lat_clone)%lat = bd_com(ix_lat_in)%lat bd_com(ix_lat_clone)%status = bd_com(ix_lat_in)%status call reallocate_coord (bd_com(ix_lat_clone)%orb, bd_com(ix_lat_clone)%lat) c_err = c_logic(.false.) end subroutine