subroutine write_log(lat, chrom_x, chrom_y) use bmad use parameters_bmad implicit none type(lat_struct) lat integer lun, nbranch, j real(rp) chrom_x, chrom_y lun=lunget() print *,' write to file:', trim(directory)//'/'//'log.dat' open(unit=lun, file=trim(directory)//'/'//'log.dat',access='append') write (lun, '(4a)') 'parameter[particle] = ', trim(species_name(lat%param%particle)) print '(a,es12.4,a,es12.4)','Horizontal tune = ',lat%a%tune/twopi,' Vertical tune = ',lat%b%tune/twopi print '(a,es12.4,a,es12.4)','Horiz chromaticity = ' ,chrom_x,' Vertical chromaticity = ',chrom_y write(lun,'(a,es12.4,a,es12.4)')'Horizontal tune = ',lat%a%tune/twopi,' Vertical tune = ',lat%b%tune/twopi write(lun,'(a,es12.4,a,es12.4)')'Horiz chromaticity = ' ,chrom_x,' Vertical chromaticity = ',chrom_y write(lun,'(a16,1x,4a12,a12)')'Name','x1_limit','x2_limit','y1_limit','y2_limit','limit_on' do nbranch=0,size(lat%branch)-1 if(nbranch==0)write(lun,'(a)')'Injection line' if(nbranch==1)write(lun,'(a)')'Ring' do j=1,lat%branch(nbranch)%n_ele_track write(lun,'(a16,1x,4es12.4,5x,l)')lat%branch(nbranch)%ele(j)%name, lat%branch(nbranch)%ele(j)%value(x1_limit$), lat%branch(nbranch)%ele(j)%value(x2_limit$), & lat%branch(nbranch)%ele(j)%value(y1_limit$), lat%branch(nbranch)%ele(j)%value(y2_limit$), bmad_com%aperture_limit_on end do end do close(unit=lun) return end