subroutine copy_twiss_to_lat(twiss, lat, nbranch) use bmad use muon_mod use muon_interface implicit none type (lat_struct), target :: lat type (branch_struct), pointer :: branch ! ring type (ele_struct) ele type (g2twiss_struct) twiss integer nbranch logical err lat%branch(nbranch)%ele(0)%a%beta = twiss%betax lat%branch(nbranch)%ele(0)%a%alpha = twiss%alphax lat%branch(nbranch)%ele(0)%b%beta = twiss%betay lat%branch(nbranch)%ele(0)%b%alpha = twiss%alphay lat%branch(nbranch)%ele(0)%x%eta = twiss%etax lat%branch(nbranch)%ele(0)%x%etap = twiss%etapx lat%branch(nbranch)%ele(0)%y%eta = twiss%etay lat%branch(nbranch)%ele(0)%y%etap = twiss%etapy return end subroutine copy_lat_to_twiss( lat, twiss, nbranch) use bmad use muon_mod use muon_interface implicit none type (lat_struct), target :: lat type (branch_struct), pointer :: branch ! ring type (ele_struct) ele type (g2twiss_struct) twiss integer nbranch logical err twiss%betax = lat%branch(nbranch)%ele(0)%a%beta twiss%alphax = lat%branch(nbranch)%ele(0)%a%alpha twiss%betay = lat%branch(nbranch)%ele(0)%b%beta twiss%alphay = lat%branch(nbranch)%ele(0)%b%alpha twiss%etax = lat%branch(nbranch)%ele(0)%x%eta twiss%etapx = lat%branch(nbranch)%ele(0)%x%etap twiss%etay = lat%branch(nbranch)%ele(0)%y%eta twiss%etapy = lat%branch(nbranch)%ele(0)%y%etap return end