c subroutine KpInit(er1, er2, ner, ei1, ei2, nei, n_fit, & ftol, xtol, epsfcn) c c*********************************************************************** c Kpinit does the necessary initialization for the kpfit program c*********************************************************************** c LOCAL variables integer i, nch c SHARED variables integer ner, nei, n_fit, Nifty, Isheet, Fidx integer npts, nnuc, ncoul double precision er1, er2, ei1, ei2, P, W, pcoul, pnuc, zero double precision ftol, xtol, epsfcn, rcbm double precision f0, mgb, alpha, Mbare, mpion, Mass, c1, c2 c common /control/ Nifty(15) common /mass/ mpion, Mass(2) common /bag/ rcbm,f0,mgb,alpha,c1,c2,Mbare(3),Fidx(3) common /grid/ P(64), W(64), npts common /sheet/ Isheet(2) c parameter (zero = 0.0d0) c c*********************************************************************** c open(unit = 7, file = 'input', status = 'old') c read Nifty parameters and print out their meaning read (7, *) (Nifty(i), i = 1, 15) nch = Nifty(2) call PrtNif c initialize the mass vectors, and coupling const call SetUp c initial potential paramenters, only first 3 adjustable read(7, *) f0, Mbare(1), Mbare(2), rcbm, mpion read(7, *) (Fidx(i), i = 1, 3) c read in more inputs read(7, *) er1, er2, ner read(7, *) ei1, ei2, nei c if (Nifty(4) .eq. 2) er1 = mpion + Mass(1) read(7, *) pcoul, pnuc, ncoul, nnuc npts = ncoul + nnuc c check if number of grid points exceeds the capacity of the code if (npts+1 .gt. 64) then write(8, 900) npts+1 stop 'kpinit, npts too big' endif c read in initial Isheet array read(7, *) (Isheet(i), i = 1, nch) write(8, 910) (Isheet(i), i = 1, nch) c reading parameters for snls1 read(7, *) ftol, xtol, epsfcn c calculate grid points for either potential or T-matrix calculation call Gauss(ncoul, 0, zero, pcoul, P, W) call Gauss(nnuc, 2, pcoul, pnuc, P(ncoul+1), W(ncoul+1)) write(8, 920) pcoul, pnuc, ncoul, nnuc c print out grid points and weights only if we are not fitting if (Nifty(4) .ne. 3) then write(8, *) 'K-SPACE GRID POINTS:' write(8, 925) (P(i), i = 1, npts) write(8, *) 'Weights:' write(8, 925) (W(i), i = 1, npts) endif c close(7) c n_fit = 0 c 900 format('0', 'Total, i5, 1x, grid points for one channel', & 1x, 'exceeds the capacity of the program.') 910 format('0', 'Initial Isheet Values:', 5i4) 920 format('0', 'PCOUL = ', e12.5, 3x, 'PNUC = ', e12.5, 5x, & 'NCOUL = ', i4, 3x, 'NNUC = ', i4) 925 format(5(1x, e15.8)) 926 format(5x, 2e15.8) c return end