Page 390 - Handbook Of Multiphase Flow Assurance
P. 390

Computer code (Makogon, 1994, 1997)              389

            C
                     Rsqred = Rhb(ndon)*Rhb(ndon)/Rsq
                     Ehb = Dhb(ndon)*Rsqred**5*(5.D0*Rsqred -6.D0)*Chbsq*Swtchr
                     nhbpoly=nhbpoly+1
                   ENDIF
                  ENDIF
                10   Ener = Ener + Ecou + Elj + Ehb
                  end do
                  end do
                  Epoly(i,ii) = Ener
                  end do
                  end do
            C
            C
            C Calculate interaction of polymer with the surface
                  Erun = 0.D0
            C outer loop over all polymer segments
                  DO j=1,nbackbone
                  Esurf(j)=0.d0
                  do jj=1,monocount(j)
                  natom1 = monodata(j,jj)
                  nhbcount=0
                  Ener=0.D0
            C ...inner loop over water molecules
                  DO 20 Iw = 1, Nwatrs
            C ... loop over all atoms on each water molecule
                  DO 20 I = 1, 3
                  Ehb = 0.D0
                  Elj = 0.D0
                  Xi = xw(Iw,I)
                  Yi = yw(Iw,I)
                  Zi = zw(Iw,I)
                  Qi = qw(I)
            C
                  Xij = Xi - xn(natom1)
                  Yij = Yi - yn(natom1)
                  Zij = Zi - zn(natom1)
            C
            C ... minimum image distances in x & y to keep surface under chain
                  if (ap.eq.1.or.ap.eq.3) then
            C we are dealing with the [100] or [110] hydrate surface-rectangular box
                  IF (Yij .GT. ymaxh) Yij = Yij - ymax
                  IF (Yij .LT.-ymaxh) Yij = Yij + ymax
                  IF (Xij .GT. xmaxh) Xij = Xij - xmax
   385   386   387   388   389   390   391   392   393   394   395