boxshift &readpdb
[unres.git] / source / unres / src-HCD-5D / stochfric.F
index dc0b088..c8a3a0d 100644 (file)
@@ -70,6 +70,9 @@ c          write (iout,*) "friction_force j",j," ichain",ichain,
 c     &       " n",n," iposc",iposc,iposc+n-1
           innt=chain_border(1,ichain)
           inct=chain_border(2,ichain)
+c diagnostics
+c          innt=chain_border(1,1)
+c          inct=chain_border(2,1)
           do i=innt,inct
             vvec(ind+1)=v_work(j,i)
             ind=ind+1
@@ -79,19 +82,25 @@ c     &       " n",n," iposc",iposc,iposc+n-1
             endif
           enddo
 #ifdef DEBUG
-          write (iout,*) "vvec ind",ind
+          write (iout,*) "vvec ind",ind," n",n
           write (iout,'(f10.5)') (vvec(i),i=iposc,ind)
 #endif
 c          write (iout,*) "chain",i," ind",ind," n",n
           call fivediagmult(n,DMfric(iposc),DU1fric(iposc),
-     &     DU2fric(iposc),vvec,rs)
+     &     DU2fric(iposc),vvec(iposc),rs)
+#ifdef DEBUG
+          write (iout,*) "rs"
+          write (iout,'(f10.5)') (rs(i),i=1,n)
+#endif
           do i=iposc,iposc+n-1
-            fric_work(3*(i-1)+j)=-rs(i)
+c            write (iout,*) "ichain",ichain," i",i," j",j,
+c     &       "index",3*(i-1)+j,"rs",rs(i-iposc+1)
+            fric_work(3*(i-1)+j)=-rs(i-iposc+1)
           enddo  
         enddo
       enddo
 #ifdef DEBUG
-      write (iout,*) "Vector fric_work"
+      write (iout,*) "Vector fric_work dimen3",dimen3
       write (iout,'(3f10.5)') (fric_work(j),j=1,dimen3)
 #endif
 #else
@@ -282,6 +291,9 @@ c-----------------------------------------------------
 #endif
 c Compute the stochastic forces acting on bodies. Store in force.
       do i=nnt,nct-1
+#ifdef FIVEDIAG
+        if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1) cycle
+#endif
         sig=stdforcp(i)
         lowb=-5*sig
         highb=5*sig
@@ -315,6 +327,10 @@ c Compute the stochastic forces acting on bodies. Store in force.
         innt=chain_border(1,ichain)
         inct=chain_border(2,ichain)
         iposc=iposd_chain(ichain)
+c for debugging only
+c        innt=chain_border(1,1)
+c        inct=chain_border(2,1)
+c        iposc=iposd_chain(1)
 c        write (iout,*)"stochastic_force ichain=",ichain," innt",innt,
 c     &    " inct",inct," iposc",iposc
         do j=1,3
@@ -417,7 +433,6 @@ c Compute the stochastic forces acting on virtual-bond vectors.
           ind=ind+3
         endif
       enddo
-#endif
       if (lprn) then
         write (iout,*) "stochforcvec"
         do i=1,3*dimen
@@ -468,8 +483,8 @@ c Compute the stochastic forces acting on virtual-bond vectors.
         enddo
         ind=ind+3
       enddo
-
       endif
+#endif
       return
       end
 c------------------------------------------------------------------
@@ -542,8 +557,8 @@ C      gamsc(ntyp1)=1.0d0
       enddo
       if (surfarea) call sdarea(gamvec)
       if (lprn) then
-        write (iout,*) "Vector gamvec"
-        do i=1,dimen1
+        write (iout,*) "Vector gamvec ii",ii
+        do i=1,ii
           write (iout,'(i5,f10.5)') i, gamvec(i)
         enddo
       endif