Page 393 - Handbook Of Multiphase Flow Assurance
P. 393

392                          10.  Research methods in flow assurance

                        nii= nbackbone
                      endif
                      endif
                 C   outer loop over polymer segments
                      DO j = ni , nii
                      Es(j)=0.d0
                      nhbcount=0
                      do jj=1,monocount(j)
                      natom1 = monodata(j,jj)
                      Ener=0.D0
                 C ...inner loop over water molecules
                      DO 200 Iw = 1, Nwatrs
                 C ... loop over all atoms on each water molecule
                      DO 200 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
                      IF (Xij .LT.-xmaxh) Xij = Xij + xmax
                      endif

                      if(ap.eq.2) then
                 C We are using [111] surface - rhombic boundaries
                      if (Yij .GT. ymaxh) then
                        Yij = Yij - ymax
                        Xij = Xij - xmaxh
                      endif
                      if (Yij .LT.-ymaxh) then
                        Yij = Yij + ymax
                        Xij = Xij + xmaxh
                      endif
                      IF (Xij .GT. xmaxh) Xij = Xij - xmax
   388   389   390   391   392   393   394   395   396   397   398