subroutine write_single_particle_by_element(i, ele_name, coord, s_frac,s_tot, Q) use bmad use parameters_bmad implicit none type(coord_struct) coord integer i integer, save :: lun29 real(rp) s_frac, s_tot ! fractional turn, total turns real(rp) Q(3) logical first/.true./ character*16 ele_name if(first)then lun29 = lunget() open(unit=lun29, file = trim(directory)//'/'//'single_particle_by_element.dat') first=.false. write(lun29,'(a10,1x,a16,9a14,2a10,1x,12x,a12,12x)')' turn ','Element','x','xp','y','yp','z','pz','t','s','s total','state','muon','polarization' endif write(lun29,'(i10,1x,a16,1x,9es14.6,i10,1x,3es12.4)')i,ele_name,coord%vec, coord%t, s_frac, s_tot, coord%state, Q return end