-
-ct if ( 1.0/rij .lt. redfac*rcomp .or.
-ct & rij_shift.le.0.0D0 ) then
- if ( rij_shift.le.0.0D0 ) then
-cd write (iout,'(a,i3,a,i3,a,f10.5,a,3f10.5)')
-cd & 'overlap SC-SC: i=',i,' j=',j,
-cd & ' dist=',dist(nres+i,nres+j),' rcomp=',
-cd & rcomp,1.0/rij,rij_shift
- ioverlap_last=ioverlap_last+1
- ioverlap(ioverlap_last)=i
- do k=1,ioverlap_last-1
- if (ioverlap(k).eq.i) ioverlap_last=ioverlap_last-1
- enddo
- ioverlap_last=ioverlap_last+1
- ioverlap(ioverlap_last)=j
- do k=1,ioverlap_last-1
- if (ioverlap(k).eq.j) ioverlap_last=ioverlap_last-1
- enddo
- endif
+c write (iout,*) "rij",1.0d0/rij," rij_shift",rij_shift,
+c & " sig",sig," sig0ij",sig0ij
+c if ( rij_shift.le.0.0D0 ) then
+ if ( rij_shift/sig0ij.le.0.1D0 ) then
+c write (iout,*) "overlap",i,j
+ if (lprn) then
+ write (iout,'(a,i5,a,i5,a,f10.5,a,3f10.5)')
+ & 'overlap SC-SC: i=',i,' j=',j,
+ & ' dist=',dist(nres+i,nres+j),' rcomp=',
+ & rcomp,1.0/rij,rij_shift
+ write (*,'(a,i2,a,i5,a,i5,a,f10.5,a,3f10.5)')
+ & 'FG processor',fg_rank,' overlap SC-SC: i=',i,' j=',j,
+ & ' dist=',dist(nres+i,nres+j),' rcomp=',
+ & rcomp,1.0/rij,rij_shift
+ endif
+ ioverlap_last=ioverlap_last+1
+ ioverlap(ioverlap_last)=i
+ do k=1,ioverlap_last-1
+ if (ioverlap(k).eq.i) ioverlap_last=ioverlap_last-1
+ enddo
+ ioverlap_last=ioverlap_last+1
+ ioverlap(ioverlap_last)=j
+ do k=1,ioverlap_last-1
+ if (ioverlap(k).eq.j) ioverlap_last=ioverlap_last-1
+ enddo
+c write(*,*) "FG processor",fg_rank,i,j," ioverlap_last",
+c & ioverlap_last," ioverlap",(ioverlap(k),k=1,ioverlap_last)
+ endif
+c enddo
+c enddo
+ enddo
+#ifdef MPI
+#ifdef DEBUG
+ write (iout,*) "FG Processor",fg_rank," ioverlap_last",
+ & ioverlap_last," ioverlap",(ioverlap(i),i=1,ioverlap_last)
+ write (*,*) "FG Processor",fg_rank," ioverlap_last",ioverlap_last,
+ & " ioverlap",(ioverlap(i),i=1,ioverlap_last)
+ call flush(iout)
+#endif
+ if (nfgtasks.eq.1) return
+#ifdef DEBUG
+ write (iout,*) "Before MPI_Gather"
+ call flush(iout)
+#endif
+ call MPI_Gather(ioverlap_last,1,MPI_INTEGER,ioverlap_last_tab,
+ & 1,MPI_INTEGER,king,FG_COMM,IERROR)
+#ifdef DEBUG
+ write (iout,*) "After MPI_Gather"
+ call flush(iout)
+#endif
+#ifdef DEBUG
+ if (myrank.eq.king)
+ & write (iout,*) "FG Processor",fg_rank,"ioverlap_last_tab",
+ & (ioverlap_last_tab(i),i=0,nfgtasks-1)
+ call flush(iout)
+#endif
+ displs(0)=0
+ do i=1,nfgtasks-1
+ displs(i)=displs(i-1)+ioverlap_last_tab(i-1)
+ enddo
+ call MPI_Gatherv(ioverlap,ioverlap_last,MPI_INTEGER,
+ & ioverlap_all,ioverlap_last_tab,displs,MPI_INTEGER,king,
+ & FG_COMM,IERROR)
+#ifdef DEBUG
+ write (iout,*) "After Gatherv"
+ call flush(iout)
+#endif
+ if (fg_rank.gt.0) return
+ ioverlap_last=0
+ do i=0,nfgtasks-1
+ ioverlap_last=ioverlap_last+ioverlap_last_tab(i)
+ enddo
+#ifdef DEBUG
+ write (iout,*) "ioverlap_last",ioverlap_last," ioverlap_last",
+ & (ioverlap_all(i),i=1,ioverlap_last)
+ call flush(iout)
+#endif
+ ii=0
+ do i=1,ioverlap_last
+ ioverlap(ii+1)=ioverlap_all(i)
+ do j=ii,1,-1
+ if (ioverlap(ii+1).eq.ioverlap(j)) goto 11