c Uses subroutines in debasix.f
c
      double precision function vheh2SK_cc( a2, y3, z3 )
c     --------------------------------------------------
c
c vheh2SK_cc returns the HeH2 potential of
c J.Schaefer and W.E.K\"ohler (1985), Physica 129A, 469-502.
c (Note: \"o is o with an umlaut above it.)
c
c          z3 +        O He     The H-atoms lie on the z-axis at +a2 and -a2,
c             |       /         and the He-atom is at (y3,z3).
c             | chi  /
c             |--_  / R         The H-atoms are separated by a distance
c             |   \/            r = 2 * a2, and the He-atom is at a distance
c             |   /             R = sqrt( y3**2 + z3**2 ) from the center of
c    a2  -  H 0  /              the H2-molecule, making an angle Chi relative
c        |    | /               to the H2-molecule, where cos(Chi) = z3 / R.
c        |    |/
c      r |  --+--------+-----
c        |    |        y3
c        |    |
c   -a2  -  H 0
c             |
c
      implicit double precision (a-h,o-z)
c
      R = sqrt( y3**2 + z3**2 )
      rHH = 2.d0 * a2
c
      if ( R .lt. 1.d-36 ) then
         cosChi = 0.d0
      else
         cosChi = z3 / R
      endif
c
      vheh2SK_cc = vheh2SK_ang(rHH,R,cosChi)
c
      return
      end
c
      double precision function vheh2SK_ang( rHH, R, cosChi )
c     -------------------------------------------------------
c
      implicit double precision (a-h,o-z)
c
      parameter ( nri = 5, nri3 = 3 * nri,
     $     nrim1 = nri - 1, nrim2 = nri - 2 )
c
      common /vheh2int_SK/ ri_SK(nri), vheh2int_ri_SK(nri),
     $     vheh2lam_ri_SK(nri,3), v2heh2int_ri_SK(nri), dVlo, dVhi
      save /vheh2int_SK/
c
      common /vheh2int_val_SK/ Vhh_schwenke, Vint_SK,
     $     R_prev, rHH_prev, cosChi_prev
      save /vheh2int_val_SK/
c
      data ri_SK / 0.9d0, 1.28d0, 1.449d0, 1.618d0, 2.d0 /
      data vheh2int_ri_SK / nri * 0.d0 /
      data vheh2lam_ri_SK / nri3 * 0.d0 /
      data v2heh2int_ri_SK / nri * 0.d0 /
      data Vhh_schwenke / 0.d0 /, Vint_SK / 0.d0 /,
     $     R_prev / -99.d0 /, rHH_prev / -99.d0 /,
     $     cosChi_prev / -99.d0 /
c
      if ( min( rHH , R ) .lt. 0.d0 ) stop
     $     ' STOP -- vheh2SK Error: rHH or R < 0. '
c
      if ( rHH .ne. rHH_prev )
     $     call vh2e3n(rHH,vk,Vhh_schwenke,e1,e2,e3)
c
      if ( R .ne. R_prev .or. cosChi .ne. cosChi_prev ) then
c
         cosChi_sq = cosChi**2
c-noneed;         P0_cosChi = 1.d0
         P2_cosChi = 1.5d0 * cosChi_sq - 0.5d0
         P4_cosChi = ( 4.375d0 * cosChi_sq - 3.75d0 ) * cosChi_sq
     $        + 0.375d0
c
         do i_r = 1, nri
            vheh2lam_ri_SK(i_r,1) = Vlam_ri_heh2_SK( 0, i_r, R )
            vheh2lam_ri_SK(i_r,2) = Vlam_ri_heh2_SK( 2, i_r, R )
            vheh2lam_ri_SK(i_r,3) = Vlam_ri_heh2_SK( 4, i_r, R )
            vheh2int_ri_SK(i_r) = vheh2lam_ri_SK(i_r,1)
     $           + vheh2lam_ri_SK(i_r,2) * P2_cosChi
     $           + vheh2lam_ri_SK(i_r,3) * P4_cosChi
         enddo
c
c-not;         call qderlo_SK( ri_SK(1), v, dVlo )
c-NOT;         call qderhi_SK( ri_SK(nri), v, dVhi )
c
c-not;         call spline(ri_SK,vheh2int_ri_SK,nri,dVlo,dVhi,
c-not;     $        v2heh2int_ri_SK)
c-NOT;         call spline(ri_SK,vheh2int_ri_SK,nri,1.d36,dVhi,
c-NOT;     $        v2heh2int_ri_SK)
         call spline(ri_SK,vheh2int_ri_SK,nri,1.d36,1.d36,
     $        v2heh2int_ri_SK)
c
      endif
c
c-not;      if ( rHH .le. ri_SK(1) ) then
c-not;         call qderlo_SK( rHH, Vint_SK, dv )
c-not;      else if ( rHH .ge. ri_SK(nri) ) then
c-not;         call qderhi_SK( rHH, Vint_SK, dv )
c-not;      else
         call splind(ri_SK,vheh2int_ri_SK,v2heh2int_ri_SK,nri,rHH,
     $        Vint_SK,dv,d2v)
c-not;      endif
c
      R_prev = R
      rHH_prev = rHH
      cosChi_prev = cosChi
c
      vheh2SK_ang = Vhh_schwenke + Vint_SK
c
      return
      end
c
      double precision function Vlam_ri_heh2_SK( lambda, i_r, R )
c     -----------------------------------------------------------
c
c Note HeH2 can have only even lambda values; so set array index k to be:
c  k = 1 for lambda = 0,  k = 2 for lambda = 2,  k = 3 for lambda = 3
c
c i_r is the array index for rHH, which has five allowed values ri_SK(i_r)
c
      implicit double precision (a-h,o-z)
c
      parameter ( nri = 5, nri3 = nri * 3 )
c
      common /vheh2int_SK/ ri_SK(nri), vheh2int_ri_SK(nri),
     $     vheh2lam_ri_SK(nri,3), v2heh2int_ri_SK(nri), dVlo, dVhi
      save /vheh2int_SK/
c
      parameter ( nSK = 48, nvlam = nSK * nri3 )
c
      common /mat_Vlam_ri_heh2_SK/ C_6(nri,3), C_8(nri,3), C10(nri,3),
     $     alpha(nri,3), Rval(nSK), Vlam(nSK,nri,3), V2lam(nSK,nri,3),
     $     init_mat
      save /mat_Vlam_ri_heh2_SK/
c
      dimension v10(nSK), v20(nSK), v30(nSK), v40(nSK), v50(nSK),
     $     v12(nSK), v22(nSK), v32(nSK), v42(nSK), v52(nSK),
     $     v14(nSK), v24(nSK), v34(nSK), v44(nSK), v54(nSK)
c
      equivalence (Vlam(1,1,1),v10(1)), (Vlam(1,2,1),v20(1)),
     $     (Vlam(1,3,1),v30(1)), (Vlam(1,4,1),v40(1)),
     $     (Vlam(1,5,1),v50(1)), (Vlam(1,1,2),v12(1)),
     $     (Vlam(1,2,2),v22(1)), (Vlam(1,3,2),v32(1)),
     $     (Vlam(1,4,2),v42(1)), (Vlam(1,5,2),v52(1)), 
     $     (Vlam(1,1,3),v14(1)), (Vlam(1,2,3),v24(1)),
     $     (Vlam(1,3,3),v34(1)), (Vlam(1,4,3),v44(1)),
     $     (Vlam(1,5,3),v54(1))
c
      data C_6 / -0.275417D+01, -0.362776D+01, -0.401759D+01,
     $     -0.440823D+01, -0.529420D+01, -0.128391D+00, -0.304313D+00,
     $     -0.391453D+00, -0.484073D+00, -0.713620D+00, nri * 0.d0 /
c
      data C_8 / -0.328262D+02, -0.482328D+02, -0.564065D+02,
     $     -0.653940D+02, -0.887076D+02, -0.575530D+01, -0.126285D+02,
     $     -0.182604D+02, -0.254778D+02, -0.476335D+02, nri * 0.d0 /
c
      data C10 / -0.629907D+03, -0.849355D+03, -0.103680D+04,
     $     -0.127957D+04, -0.203214D+04, -0.390540D+03, -0.287205D+03,
     $     -0.363639D+03, -0.515424D+03, -0.113617D+04, nri * 0.d0 /
c
      data alpha / nri3 * 0.d0 /
c
      data Rval /
     $     1.6d0, 1.8d0, 2.0d0, 2.2d0, 2.4d0, 2.6d0, 2.8d0, 3.0d0,
     $     3.2d0, 3.4d0, 3.6d0, 3.8d0, 4.0d0, 4.2d0, 4.4d0, 4.6d0,
     $     4.8d0, 5.0d0, 5.2d0, 5.4d0, 5.6d0, 5.8d0, 6.0d0, 6.2d0,
     $     6.4d0, 6.6d0, 6.8d0, 7.0d0, 7.2d0, 7.4d0, 7.6d0, 7.8d0,
     $     8.0d0, 8.2d0, 8.4d0, 8.6d0, 8.8d0, 9.0d0, 9.2d0, 9.4d0,
     $     9.6d0, 9.8d0,10.0d0,10.2d0,10.4d0,10.6d0,10.8d0,11.0d0 /
c
      data v10 /
     $     0.312109D+00,  0.214981D+00,  0.148084D+00,  0.100482D+00,
     $     0.681817D-01,  0.458599D-01,  0.305761D-01,  0.203760D-01,
     $     0.132005D-01,  0.855210D-02,  0.551269D-02,  0.352888D-02,
     $     0.224544D-02,  0.141460D-02,  0.842890D-03,  0.487356D-03,
     $     0.268324D-03,  0.135579D-03,  0.547533D-04, -0.725191D-05,
     $     -0.292696D-04, -0.392310D-04, -0.420855D-04, -0.411569D-04,
     $     -0.381670D-04, -0.342871D-04, -0.301921D-04, -0.262741D-04,
     $     -0.227506D-04, -0.196160D-04, -0.168776D-04, -0.145130D-04,
     $     -0.124860D-04, -0.107588D-04, -0.928611D-05, -0.803179D-05,
     $     -0.696345D-05, -0.605266D-05, -0.527716D-05, -0.461235D-05,
     $     -0.404189D-05, -0.355150D-05, -0.312900D-05, -0.276249D-05,
     $     -0.244571D-05, -0.217100D-05, -0.193202D-05, -0.173208D-05 /
c
      data v20 /
     $     0.320063D+00,  0.225269D+00,  0.158610D+00,  0.110417D+00,
     $     0.768675D-01,  0.530471D-01,  0.362903D-01,  0.248320D-01,
     $     0.165147D-01,  0.109779D-01,  0.727965D-02,  0.480500D-02,
     $     0.314951D-02,  0.197606D-02,  0.122330D-02,  0.741187D-03,
     $     0.433995D-03,  0.240016D-03,  0.114664D-03,  0.400144D-04,
     $     -0.338342D-05, -0.270659D-04, -0.383448D-04, -0.424516D-04,
     $     -0.423142D-04, -0.398868D-04, -0.363749D-04, -0.324945D-04,
     $     -0.286340D-04, -0.250221D-04, -0.217526D-04, -0.188543D-04,
     $     -0.163197D-04, -0.141203D-04, -0.122265D-04, -0.106013D-04,
     $     -0.920863D-05, -0.801581D-05, -0.699433D-05, -0.611743D-05,
     $     -0.536371D-05, -0.471475D-05, -0.415481D-05, -0.366827D-05,
     $     -0.324747D-05, -0.288237D-05, -0.256467D-05, -0.230553D-05 /
c
      data v30 /
     $     0.321813D+00,  0.228173D+00,  0.161935D+00,  0.113971D+00,
     $     0.802150D-01,  0.559696D-01,  0.387150D-01,  0.267676D-01,
     $     0.179995D-01,  0.121009D-01,  0.811779D-02,  0.542357D-02,
     $     0.360140D-02,  0.229278D-02,  0.144370D-02,  0.893112D-03,
     $     0.537475D-03,  0.309426D-03,  0.159292D-03,  0.679084D-04,
     $     0.131703D-04, -0.180326D-04, -0.341168D-04, -0.412647D-04,
     $     -0.429567D-04, -0.415640D-04, -0.385726D-04, -0.348878D-04,
     $     -0.310212D-04, -0.272928D-04, -0.238497D-04, -0.207538D-04,
     $     -0.180181D-04, -0.156244D-04, -0.135515D-04, -0.117647D-04,
     $     -0.102284D-04, -0.890895D-05, -0.777617D-05, -0.680260D-05,
     $     -0.596504D-05, -0.524339D-05, -0.462042D-05, -0.407815D-05,
     $     -0.360933D-05, -0.320275D-05, -0.284909D-05, -0.257094D-05 /
c
      data v40 /
     $     0.323318D+00,  0.230363D+00,  0.164496D+00,  0.116976D+00,
     $     0.831881D-01,  0.586567D-01,  0.410064D-01,  0.286269D-01,
     $     0.194718D-01,  0.132290D-01,  0.897037D-02,  0.606063D-02,
     $     0.407265D-02,  0.262635D-02,  0.167830D-02,  0.105672D-02,
     $     0.650370D-03,  0.386292D-03,  0.209577D-03,  0.100034D-03,
     $     0.328277D-04, -0.676879D-05, -0.283100D-04, -0.389927D-04,
     $     -0.428592D-04, -0.427406D-04, -0.404304D-04, -0.370515D-04,
     $     -0.332674D-04, -0.294813D-04, -0.259029D-04, -0.226341D-04,
     $     -0.197124D-04, -0.171340D-04, -0.148871D-04, -0.129408D-04,
     $     -0.112611D-04, -0.981443D-05, -0.856917D-05, -0.749751D-05,
     $     -0.657466D-05, -0.577899D-05, -0.509181D-05, -0.449236D-05,
     $     -0.397446D-05, -0.352560D-05, -0.313540D-05, -0.284273D-05 /
c
      data v50 /
     $     0.332861D+00,  0.234992D+00,  0.168070D+00,  0.121876D+00,
     $     0.884269D-01,  0.635860D-01,  0.454400D-01,  0.325870D-01,
     $     0.226363D-01,  0.157608D-01,  0.109567D-01,  0.757751D-02,
     $     0.520939D-02,  0.357020D-02,  0.235877D-02,  0.154559D-02,
     $     0.100074D-02,  0.637859D-03,  0.389638D-03,  0.240099D-03,
     $     0.886968D-04,  0.269107D-04, -0.936717D-05, -0.298585D-04,
     $     -0.399123D-04, -0.435555D-04, -0.433775D-04, -0.410957D-04,
     $     -0.378244D-04, -0.341250D-04, -0.303827D-04, -0.268135D-04,
     $     -0.235271D-04, -0.205670D-04, -0.179452D-04, -0.156463D-04,
     $     -0.136437D-04, -0.119066D-04, -0.104028D-04, -0.910412D-05,
     $     -0.798319D-05, -0.701527D-05, -0.617862D-05, -0.544459D-05,
     $     -0.481179D-05, -0.426443D-05, -0.378949D-05, -0.348061D-05 /
c
      data v12 /
     $     0.430440D-01,  0.265857D-01,  0.162280D-01,  0.108847D-01,
     $     0.729998D-02,  0.489571D-02,  0.328340D-02,  0.220092D-02,
     $     0.143484D-02,  0.935405D-03,  0.603597D-03,  0.384792D-03,
     $     0.243831D-03,  0.163274D-03,  0.109332D-03,  0.732110D-04,
     $     0.436801D-04,  0.252266D-04,  0.134234D-04,  0.644378D-05,
     $     0.246563D-05, -0.105817D-05, -0.244927D-05, -0.311484D-05,
     $     -0.319673D-05, -0.303924D-05, -0.279012D-05, -0.249842D-05,
     $     -0.217791D-05, -0.187130D-05, -0.159292D-05, -0.134805D-05,
     $     -0.113702D-05, -0.954646D-06, -0.802949D-06, -0.677354D-06,
     $     -0.573566D-06, -0.487791D-06, -0.424613D-06, -0.367122D-06,
     $     -0.316640D-06, -0.273115D-06, -0.235924D-06, -0.204200D-06,
     $     -0.177294D-06, -0.154422D-06, -0.134932D-06, -0.114379D-06 /
c
      data v22 /
     $     0.918804D-01,  0.544185D-01,  0.314545D-01,  0.216507D-01,
     $     0.149031D-01,  0.103427D-01,  0.723374D-02,  0.501519D-02,
     $     0.340139D-02,  0.231253D-02,  0.157152D-02,  0.106545D-02,
     $     0.719584D-03,  0.465951D-03,  0.299818D-03,  0.191034D-03,
     $     0.119984D-03,  0.737967D-04,  0.427048D-04,  0.232951D-04,
     $     0.112379D-04,  0.395811D-05, -0.205654D-06, -0.248338D-05,
     $     -0.356955D-05, -0.396007D-05, -0.394842D-05, -0.371746D-05,
     $     -0.338849D-05, -0.301565D-05, -0.264307D-05, -0.229379D-05,
     $     -0.197828D-05, -0.170296D-05, -0.146228D-05, -0.125479D-05,
     $     -0.107744D-05, -0.926576D-06, -0.804253D-06, -0.697160D-06,
     $     -0.604665D-06, -0.525349D-06, -0.457549D-06, -0.398680D-06,
     $     -0.348779D-06, -0.306320D-06, -0.270066D-06, -0.241763D-06 /
c
      data v32 /
     $     0.125356D+00,  0.719698D-01,  0.400077D-01,  0.276619D-01,
     $     0.191276D-01,  0.134106D-01,  0.952723D-02,  0.674233D-02,
     $     0.464727D-02,  0.320795D-02,  0.221323D-02,  0.152369D-02,
     $     0.104548D-02,  0.687887D-03,  0.450406D-03,  0.292657D-03,
     $     0.188058D-03,  0.118950D-03,  0.714510D-04,  0.412556D-04,
     $     0.220626D-04,  0.101359D-04,  0.304339D-05, -0.107508D-05,
     $     -0.327832D-05, -0.431027D-05, -0.463518D-05, -0.455249D-05,
     $     -0.426319D-05, -0.386359D-05, -0.342961D-05, -0.300360D-05,
     $     -0.260744D-05, -0.225499D-05, -0.194257D-05, -0.167044D-05,
     $     -0.143602D-05, -0.123545D-05, -0.107034D-05, -0.926630D-06,
     $     -0.802861D-06, -0.696864D-06, -0.606314D-06, -0.526856D-06,
     $     -0.459782D-06, -0.402941D-06, -0.354596D-06, -0.320171D-06 /
c
      data v42 /
     $     0.169071D+00,  0.934718D-01,  0.496204D-01,  0.342934D-01,
     $     0.237039D-01,  0.167353D-01,  0.120581D-01,  0.877873D-02,
     $     0.614780D-02,  0.431208D-02,  0.301797D-02,  0.210406D-02,
     $     0.146245D-02,  0.974310D-03,  0.646361D-03,  0.425975D-03,
     $     0.278103D-03,  0.179196D-03,  0.110089D-03,  0.656095D-04,
     $     0.369119D-04,  0.187438D-04,  0.767842D-05,  0.102738D-05,
     $     -0.270572D-05, -0.462395D-05, -0.542759D-05, -0.556785D-05,
     $     -0.534494D-05, -0.492025D-05, -0.441286D-05, -0.389147D-05,
     $     -0.339362D-05, -0.294201D-05, -0.253804D-05, -0.218388D-05,
     $     -0.187739D-05, -0.161434D-05, -0.139629D-05, -0.120701D-05,
     $     -0.104421D-05, -0.904909D-06, -0.785985D-06, -0.680695D-06,
     $     -0.592172D-06, -0.517457D-06, -0.454168D-06, -0.411974D-06 /
c
      data v52 /
     $     0.373623D+00,  0.184453D+00,  0.865720D-01,  0.578226D-01,
     $     0.386049D-01,  0.282741D-01,  0.207079D-01,  0.151664D-01,
     $     0.111078D-01,  0.813533D-02,  0.595829D-02,  0.436384D-02,
     $     0.312291D-02,  0.214002D-02,  0.146238D-02,  0.995127D-03,
     $     0.673398D-03,  0.452473D-03,  0.292476D-03,  0.187237D-03,
     $     0.118135D-03,  0.752236D-04,  0.232624D-04,  0.833746D-05,
     $     -0.374612D-06, -0.519838D-05, -0.760807D-05, -0.852735D-05,
     $     -0.855303D-05, -0.807776D-05, -0.736014D-05, -0.655446D-05,
     $     -0.574920D-05, -0.499228D-05, -0.430838D-05, -0.370478D-05,
     $     -0.318017D-05, -0.272876D-05, -0.235366D-05, -0.202836D-05,
     $     -0.174879D-05, -0.150978D-05, -0.130599D-05, -0.112299D-05,
     $     -0.970224D-06, -0.842240D-06, -0.734663D-06, -0.668838D-06 /
c
      data v14 /
     $     0.705272D-02,  0.328738D-02,  0.121100D-02,  0.686046D-03,
     $     0.373640D-03,  0.215962D-03,  0.137986D-03,  0.879569D-04,
     $     0.612708D-04,  0.424770D-04,  0.262421D-04,  0.215573D-04,
     $     0.177089D-04,  0.145475D-04,  0.119505D-04,  0.981709D-05,
     $     0.806454D-05,  0.662486D-05,  0.544219D-05,  0.447065D-05,
     $     0.367255D-05,  0.301692D-05,  0.247834D-05,  0.203591D-05,
     $     0.167246D-05,  0.137389D-05,  0.112862D-05,  0.927141D-06,
     $     0.761628D-06,  0.625662D-06,  0.513969D-06,  0.422215D-06,
     $     0.346841D-06,  0.284923D-06,  0.234058D-06,  0.192274D-06,
     $     0.157949D-06,  0.129752D-06,  0.106589D-06,  0.875607D-07,
     $     0.719293D-07,  0.590885D-07,  0.485400D-07,  0.398746D-07,
     $     0.327562D-07,  0.269086D-07,  0.221048D-07,  0.000000D+00 /
c
      data v24 /
     $     0.340667D-01,  0.154312D-01,  0.521168D-02,  0.287990D-02,
     $     0.148603D-02,  0.814880D-03,  0.513618D-03,  0.339648D-03,
     $     0.221894D-03,  0.146273D-03,  0.107371D-03,  0.788154D-04,
     $     0.578542D-04,  0.424677D-04,  0.311733D-04,  0.228827D-04,
     $     0.167969D-04,  0.123297D-04,  0.905061D-05,  0.664357D-05,
     $     0.487669D-05,  0.357972D-05,  0.262768D-05,  0.192884D-05,
     $     0.141586D-05,  0.103931D-05,  0.762901D-06,  0.560005D-06,
     $     0.411070D-06,  0.301745D-06,  0.221495D-06,  0.162588D-06,
     $     0.119347D-06,  0.876063D-07,  0.643071D-07,  0.472044D-07,
     $     0.346503D-07,  0.254349D-07,  0.186704D-07,  0.137050D-07,
     $     0.100601D-07,  0.738458D-08,  0.542063D-08,  0.397899D-08,
     $     0.292077D-08,  0.214398D-08,  0.157378D-08,  0.000000D+00 /
c
      data v34 /
     $     0.591309D-01,  0.264541D-01,  0.873365D-02,  0.477744D-02,
     $     0.240538D-02,  0.129112D-02,  0.817192D-03,  0.503540D-03,
     $     0.342344D-03,  0.234065D-03,  0.161515D-03,  0.112359D-03,
     $     0.783587D-04,  0.589256D-04,  0.450433D-04,  0.344315D-04,
     $     0.263198D-04,  0.201191D-04,  0.153792D-04,  0.117560D-04,
     $     0.898641D-05,  0.686930D-05,  0.525096D-05,  0.401388D-05,
     $     0.306825D-05,  0.234540D-05,  0.179285D-05,  0.137047D-05,
     $     0.104760D-05,  0.800795D-06,  0.612135D-06,  0.467922D-06,
     $     0.357684D-06,  0.273417D-06,  0.209003D-06,  0.159764D-06,
     $     0.122125D-06,  0.933534D-07,  0.713602D-07,  0.545484D-07,
     $     0.416973D-07,  0.318738D-07,  0.243647D-07,  0.186246D-07,
     $     0.142368D-07,  0.108828D-07,  0.831888D-08,  0.000000D+00 /
c
      data v44 /
     $     0.959039D-01,  0.422630D-01,  0.137081D-01,  0.743428D-02,
     $     0.366110D-02,  0.192892D-02,  0.123087D-02,  0.775414D-03,
     $     0.511107D-03,  0.337793D-03,  0.234188D-03,  0.171259D-03,
     $     0.127998D-03,  0.914509D-04,  0.695360D-04,  0.528727D-04,
     $     0.402025D-04,  0.305685D-04,  0.232432D-04,  0.176733D-04,
     $     0.134381D-04,  0.102179D-04,  0.776931D-05,  0.590751D-05,
     $     0.449186D-05,  0.341545D-05,  0.259698D-05,  0.197465D-05,
     $     0.150146D-05,  0.114165D-05,  0.868072D-06,  0.660051D-06,
     $     0.501879D-06,  0.381611D-06,  0.290163D-06,  0.220630D-06,
     $     0.167759D-06,  0.127558D-06,  0.969904D-07,  0.737481D-07,
     $     0.560754D-07,  0.426377D-07,  0.324202D-07,  0.246511D-07,
     $     0.187438D-07,  0.142522D-07,  0.108368D-07,  0.000000D+00 /
c
      data v54 /
     $     0.283931D+00,  0.119066D+00,  0.381600D-01,  0.199519D-01,
     $     0.910260D-02,  0.421441D-02,  0.256602D-02,  0.172515D-02,
     $     0.116414D-02,  0.849649D-03,  0.639757D-03,  0.469938D-03,
     $     0.246012D-03,  0.176571D-03,  0.126731D-03,  0.909595D-04,
     $     0.652847D-04,  0.468571D-04,  0.336309D-04,  0.241381D-04,
     $     0.173247D-04,  0.124346D-04,  0.892471D-05,  0.640557D-05,
     $     0.459750D-05,  0.329978D-05,  0.236837D-05,  0.169986D-05,
     $     0.122005D-05,  0.875669D-06,  0.628498D-06,  0.451095D-06,
     $     0.323766D-06,  0.232378D-06,  0.166786D-06,  0.119708D-06,
     $     0.859184D-07,  0.616666D-07,  0.442602D-07,  0.317671D-07,
     $     0.228003D-07,  0.163646D-07,  0.117454D-07,  0.843010D-08,
     $     0.605057D-08,  0.434270D-08,  0.311691D-08,  0.000000D+00 /
c
      data V2lam / nvlam * 0.d0 /
c
      data init_mat / 0 /
c					! initialize splines if necessary
      if ( init_mat .le. 0 ) then
c
         init_mat = 1
c
         dr12 = Rval(2) - Rval(1)
         dr23 = Rval(3) - Rval(2)
         rnsq = Rval(nSK)**2
         rn6 = rnsq * rnsq * rnsq
         rn7 = rn6 * Rval(nSK)
         rn10 = rn6 * rnsq**2
         nm1 = nSK - 1
         rnm1_10 = Rval(nm1)**10
c				 ! for V0, V2, V4:
         do k = 1, 3
c				 ! for each allowed H2 distance ri:
            do i = 1, nri
c			   ! set inwards extrap: for V0 (k=1), set
c			   ! V0(R) = V0(R1) * exp{ alpha * (R-R1) * (R+R1) } ;
c			   ! for V2 and V4 (k=2 and 3), set
c			   ! Vlam(R) = Vlam(R1) * (R/R1)**2 * exp{alpha*(R-R1)}
c			   ! Also set derivative dv1 at 1:
c
               dl12 = log( Vlam(2,i,k) / Vlam(1,i,k) ) / dr12
               dl23 = log( Vlam(3,i,k) / Vlam(2,i,k) ) / dr23
               dl1 = 1.5d0 * dl12 - 0.5d0 * dl23
               if ( k .eq. 1 ) then
                  alpha(i,k) = dl1 / ( 2.d0 * Rval(1) )
               else
                  alpha(i,k) = dl1 - 2.d0 / Rval(1)
               endif
               dv1 = dl1 * Vlam(1,i,k)
c						! extend V4 as C10/R**10
               if ( k .eq. 3 ) then
                  C10(i,k) = Vlam(nm1,i,k) * rnm1_10
                  Vlam(nSK,i,k) = C10(i,k) / rn10
               endif
c				! set value vn and derivative dvn at nSK:
c
               vn = ( ( C10(i,k) / rnsq + C_8(i,k) ) / rnsq
     $              + C_6(i,k) ) / rn6
               dvn = ( ( -10.d0 * C10(i,k) / rnsq - 8.d0 * C_8(i,k) )
     $              / rnsq - 6.d0 * C_6(i,k) ) / rn7
c-debug[
c-debug;               if ( k .lt. 3 ) then
c-debug;                  deln = Vlam(nSK,i,k) - vn
c-debug;               else
c-debug;                  deln = Vlam(nSK,i,k) * ( 1.d0 - C10(i,k)
c-debug;     $                 / ( Rval(nSK-2)**10 * Vlam(nSK-2,i,k) ) )
c-debug;               endif
c-debug;               write(6,10) i, 2*k-2, dl1, dl12, dl23, dv1,
c-debug;     $              Vlam(1,i,k), Vlam(2,i,k), Vlam(3,i,k),
c-debug;     $              Vlam(nSK,i,k), deln, dvn,
c-debug;     $              C_6(i,k), C_8(i,k), C10(i,k)
c-debug; 10            format(2i2,': dlV1,12,32=',3f10.6,' dV1=',f10.6,
c-debug;     $              ' V1,V2,V3=',3f10.7,' Vn,-VRn,dVn',
c-debug;     $              e14.6,e10.2,e16.8,' C6,8,10=',f11.6,f12.6,f14.6)
c-debug]
c					! make exact continuity at nSK
               Vlam(nSK,i,k) = vn
c								   ! set spline
               call spline(Rval,Vlam(1,i,k),nSK,dv1,dvn,V2lam(1,i,k))
c
            enddo
         enddo
c
      endif
c
      k = max( 1 , min( 3 , lambda ) )
c
      if ( R .le. Rval(1) ) then
         if ( k .eq. 1 ) then
            Vlam_ri_heh2_SK = Vlam(1,i_r,k) * exp( alpha(i_r,k)
     $           * ( R - Rval(1) ) * ( R + Rval(1) ) )
         else
            Vlam_ri_heh2_SK = Vlam(1,i_r,k) * ( R / Rval(1) )**2
     $           * exp( alpha(i_r,k) * ( R - Rval(1) ) )
         endif
      else if ( R .ge. Rval(nSK) ) then
         rsq = R**2
         Vlam_ri_heh2_SK = ( ( C10(i_r,k) / rsq + C_8(i_r,k) ) / rsq
     $        + C_6(i_r,k) ) / rsq**3
      else
         call splind(Rval,Vlam(1,i_r,k),V2lam(1,i_r,k),nSK,R,v,dv,d2v)
         Vlam_ri_heh2_SK = v
      endif
c
      return
      end
c
c-not;      subroutine qderlo_SK( rHH, quadval, quader )
c-not;c     --------------------------------------------
c-not;c
c-not;      implicit double precision (a-h,o-z)
c-not;c
c-not;      parameter ( nri = 5, nri3 = 3 * nri,
c-not;     $     nrim1 = nri - 1, nrim2 = nri - 2 )
c-not;c
c-not;      common /vheh2int_SK/ ri_SK(nri), vheh2int_ri_SK(nri),
c-not;     $     vheh2lam_ri_SK(nri,3), v2heh2int_ri_SK(nri), dVlo, dVhi
c-not;      save /vheh2int_SK/
c-not;c
c-not;      common /qderlo_stoSK/ x1, x2, x3, xx12, xx13, xx23, xx1pxx2, ic
c-not;      save /qderlo_stoSK/
c-not;c
c-not;      data ic / 0 /
c-not;c
c-not;      if ( ic .eq. 0 ) then
c-not;         x1 = ri_SK(1)
c-not;         x2 = ri_SK(2)
c-not;         x3 = ri_SK(3)
c-not;         xx12 = 1.d0 / ( x1 - x2 )
c-not;         xx13 = 1.d0 / ( x1 - x3 )
c-not;         xx23 = 1.d0 / ( x2 - x3 )
c-not;         xx1pxx2 = x1 + x2
c-not;         ic = 1
c-not;      endif
c-not;c
c-not;      c3 = ( (vheh2int_ri_SK(1)-vheh2int_ri_SK(2))*xx12
c-not;     $     - (vheh2int_ri_SK(2)-vheh2int_ri_SK(3))*xx23 ) * xx13
c-not;      c2 = (vheh2int_ri_SK(1)-vheh2int_ri_SK(2))*xx12
c-not;     $     - xx1pxx2 * c3
c-not;      c1 = vheh2int_ri_SK(1) - x1 * ( c2 + x1 * c3 )
c-not;      quader = c2+(rHH+rHH)*c3
c-not;      quadval = c1+rHH*(c2+rHH*c3)
c-not;c
c-not;      return
c-not;      end
c
c-NOT;      subroutine qderhi_SK( rHH, quadval, quader )
c-NOT;c     --------------------------------------------
c-NOT;c
c-NOT;      implicit double precision (a-h,o-z)
c-NOT;c
c-NOT;      parameter ( nri = 5, nri3 = 3 * nri,
c-NOT;     $     nrim1 = nri - 1, nrim2 = nri - 2 )
c-NOT;c
c-NOT;      common /vheh2int_SK/ ri_SK(nri), vheh2int_ri_SK(nri),
c-NOT;     $     vheh2lam_ri_SK(nri,3), v2heh2int_ri_SK(nri), dVlo, dVhi
c-NOT;      save /vheh2int_SK/
c-NOT;c
c-NOT;      common /qderhi_stoSK/ x1, x2, x3, xx12, xx13, xx23, xx1pxx2, ic
c-NOT;      save /qderhi_stoSK/
c-NOT;c
c-NOT;      data ic / 0 /
c-NOT;c
c-NOT;      if ( ic .eq. 0 ) then
c-NOT;         x1 = ri_SK(nrim2)
c-NOT;         x2 = ri_SK(nrim1)
c-NOT;         x3 = ri_SK(nri)
c-NOT;         xx12 = 1.d0 / ( x1 - x2 )
c-NOT;         xx13 = 1.d0 / ( x1 - x3 )
c-NOT;         xx23 = 1.d0 / ( x2 - x3 )
c-NOT;         xx1pxx2 = x1 + x2
c-NOT;         ic = 1
c-NOT;      endif
c-NOT;c
c-NOT;      c3 = ( (vheh2int_ri_SK(nrim2)-vheh2int_ri_SK(nrim1))*xx12
c-NOT;     $     - (vheh2int_ri_SK(nrim1)-vheh2int_ri_SK(nri))*xx23 )
c-NOT;     $     * xx13
c-NOT;      c2 = (vheh2int_ri_SK(nrim2)-vheh2int_ri_SK(nrim1))*xx12
c-NOT;     $     - xx1pxx2 * c3
c-NOT;      c1 = vheh2int_ri_SK(nrim2) - x1 * ( c2 + x1 * c3 )
c-NOT;      quader = c2+(rHH+rHH)*c3
c-NOT;      quadval = c1+rHH*(c2+rHH*c3)
c-NOT;c
c-NOT;      return
c-NOT;      end
