subroutine sw(x,y,z,v) implicit real*8(a-h,o-z) integer pnmx parameter(nmx=198,pnmx=12,mmaxp=9) common/cparm/ a(nmx),p(pnmx) common/cint/ ix(nmx),iy(nmx),iz(nmx),mmax dimension xex(0:mmaxp),xey(0:mmaxp),xez(0:mmaxp) c c.... calculates potential of the Stark-Werner surface for F+H2 c.... x,y,z(Input) are the internal coordinates of F-H1-H2 : c.... x = r(F-H1) y= r(H1-H2) z= r(F-H2) c.... v(output) is the potential in a.u. if(mmaxp.ne.mmax) then write(0,*)' mmaxp ne mmax:',mmaxp,mmax stop 'sw' endif ma=nmx np=pnmx c.... initializing the non-linear parameters b1 = a(ma-5) b2 = a(ma-4) b3 = a(ma-3) x0 = a(ma-2) y0 = a(ma-1) z0 = a(ma) fit = 0.0d0 xexpon = b1*(x-x0) yexpon = b2*(y-y0) zexpon = b3*(z-z0) exponx=dexp(-xexpon) expony=dexp(-yexpon) exponz=dexp(-zexpon) fex = x*exponx fey = y*expony fez = z*exponz xex(0)=1 xey(0)=1 xez(0)=1 xex(1)=fex xey(1)=fey xez(1)=fez do m=2,mmax-1 xex(m)=xex(m-1)*fex xey(m)=xey(m-1)*fey xez(m)=xez(m-1)*fez enddo c c.... Aguado-Paniagua-Fit for the threebody-terms c.... Method seems to be a bit confusing c.... But this type of programming was chosen to avoid c.... terms like x**b(i)*y**c(j)*z**d(k), which c.... cost much more CPU-time ! c do 1010 i=1,ma-6 fit=fit+xex(ix(i))*xey(iy(i))*xez(iz(i))*a(i) 1010 continue c c.... Two-Body-Potential : Extended-Rydberg-Functional c xr = x-p(3) yr = y-p(9) zr = z-p(3) xr2=xr*xr xr3=xr2*xr yr2=yr*yr yr3=yr2*yr zr2=zr*zr zr3=zr2*zr fx = dexp(-p(2)*xr) fy = dexp(-p(8)*yr) fz = dexp(-p(2)*zr) ux = -p(1)*(1.0d0+p(2)*xr+p(4)*xr2+p(5)*xr3) uy = -p(7)*(1.0d0+p(8)*yr+p(10)*yr2+p(11)*yr3) uz = -p(1)*(1.0d0+p(2)*zr+p(4)*zr2+p(5)*zr3) xval=ux*fx+p(6) yval=uy*fy+p(12) zval=uz*fz+p(6) c c... Resulting Potential in atomic untis c v=fit+xval+yval+zval return end