update from Adam
[unres.git] / source / unres / src-HCD-5D / elecont.f
index f43b037..00ce016 100644 (file)
@@ -12,6 +12,7 @@
       double precision app_(2,2),bpp_(2,2),rpp_(2,2)
       integer ncont,icont(2,maxcont)
       double precision econt(maxcont)
+      integer xshift,yshift,zshift
 *
 * Load the constants of peptide bond - peptide bond interactions.
 * Type 1 - ordinary peptide bond, type 2 - alkylated peptide bond (e.g.
@@ -52,12 +53,14 @@ c      data epp    / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
         xmedi=xi+0.5*dxi
         ymedi=yi+0.5*dyi
         zmedi=zi+0.5*dzi
+c        write (iout,*) "i",xmedi,ymedi,zmedi
           xmedi=mod(xmedi,boxxsize)
           if (xmedi.lt.0) xmedi=xmedi+boxxsize
           ymedi=mod(ymedi,boxysize)
           if (ymedi.lt.0) ymedi=ymedi+boxysize
           zmedi=mod(zmedi,boxzsize)
           if (zmedi.lt.0) zmedi=zmedi+boxzsize
+c        write (iout,*) "i",xmedi,ymedi,zmedi
         do 4 j=i+2,nct-1
           if (itype(j).eq.ntyp1 .or. itype(j+1).eq.ntyp1) goto 4
           ind=ind+1
@@ -75,15 +78,16 @@ c      data epp    / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
           xj=c(1,j)+0.5*dxj
           yj=c(2,j)+0.5*dyj
           zj=c(3,j)+0.5*dzj
+c          write (iout,*) "j",xj,yj,zj
           xj=mod(xj,boxxsize)
           if (xj.lt.0) xj=xj+boxxsize
           yj=mod(yj,boxysize)
           if (yj.lt.0) yj=yj+boxysize
           zj=mod(zj,boxzsize)
           if (zj.lt.0) zj=zj+boxzsize
-      dist_init=(xj-xi)**2+(yj-yi)**2+(zj-zi)**2
-      write (iout,*) "i",i,xi,yi,zi," j",j,xj,yj,xj,"dist",
-     &   dsqrt(dist_init)
+c          write (iout,*) "j",xj,yj,zj
+      dist_init=(xj-xmedi)**2+(yj-ymedi)**2+(zj-zmedi)**2
+c      write (iout,*) "dist",dsqrt(dist_init)
       xj_safe=xj
       yj_safe=yj
       zj_safe=zj
@@ -94,7 +98,9 @@ c      data epp    / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
           xj=xj_safe+xshift*boxxsize
           yj=yj_safe+yshift*boxysize
           zj=zj_safe+zshift*boxzsize
-          dist_temp=(xj-xi)**2+(yj-yi)**2+(zj-zi)**2
+          dist_temp=(xj-xmedi)**2+(yj-ymedi)**2+(zj-zmedi)**2
+c          write (iout,*) "shift",xshift,yshift,zshift," dist_temp",
+c     &      dist_temp," dist_init",dist_init
           if(dist_temp.lt.dist_init) then
             dist_init=dist_temp
             xj_temp=xj
@@ -143,7 +149,7 @@ c      data epp    / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
           endif
           ees=ees+eesij
           evdw=evdw+evdwij*sss
-          write (iout,*) "i"," j",j," rij",dsqrt(rij)," eesij",eesij
+c          write (iout,*) "i"," j",j," rij",dsqrt(rij)," eesij",eesij
     4   continue
     1 continue
       if (lprint) then