module calcf_interface interface subroutine calcf(lat,nconstraints,nparams, chis, yfit,grid_half_width) ! compute the electric field over a grid (+-4.5 X +-4.5cm) using the grid map quadrupole element (which is ele(1)) in this lattice) ! then compute the electric field over the same grid using the multipole quadrupole element (ele(2) in this lattic) ! then take the sum of the squares of the difference of Ex and Ey over the entire grid. ! That sum is chis2 use bmad implicit none type (lat_struct) lat integer nparams, nconstraints real(rp) chis real(rp), allocatable:: yfit(:) real(rp), optional::grid_half_width ! something less than 0.042 m end subroutine end interface interface subroutine calcf_dyda(lat,nconstraints,nparams,chis, yfit, dyda) use bmad implicit none type(lat_struct) lat real(rp), allocatable :: yfit(:) real(rp), dimension(:,:) :: dyda real(rp) chis integer nconstraints, nparams end subroutine end interface end module