UDALO SIE TERAZ DEBUG
authorAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Tue, 5 Jun 2012 10:40:34 +0000 (06:40 -0400)
committerAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Tue, 5 Jun 2012 10:40:34 +0000 (06:40 -0400)
source/unres/src_MD/energy_p_new_barrier.F
source/unres/src_MD/int_to_cart.f
source/unres/src_MD/intcartderiv.F

index daf4d6f..3257273 100644 (file)
@@ -5899,7 +5899,7 @@ c   3 = SC...Ca...Ca...SC
           esccor=esccor+v1ij*cosphi+v2ij*sinphi
           gloci=gloci+j*(v2ij*cosphi-v1ij*sinphi)
         enddo
-        gloc_sc(intertyp,i-3,icg)=gloc_sc(intertyp,i-3,icg)+wtor*gloci
+        gloc_sc(intertyp,i-3,icg)=gloc_sc(intertyp,i-3,icg)+wsccor*gloci
         if (lprn)
      &  write (iout,'(2(a3,2x,i3,2x),2i3,6f8.3/26x,6f8.3/)')
      &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,itori,itori1,
index 4b2f3b5..149e86f 100644 (file)
@@ -15,7 +15,7 @@ c-------------------------------------------------------------
       include 'COMMON.IOUNITS'
       
 c   calculating dE/ddc1      
-       if (nres.lt.3) return
+       if (nres.lt.3) goto 18
        do j=1,3
          gcart(j,1)=gcart(j,1)+gloc(1,icg)*dphi(j,1,4)
      &     +gloc(nres-2,icg)*dtheta(j,1,3)      
@@ -118,8 +118,9 @@ C INTERTYP=1 SC...Ca...Ca...Ca
 C INTERTYP=2 Ca...Ca...Ca...SC
 C INTERTYP=3 SC...Ca...Ca...SC
 c   calculating dE/ddc1      
+  18   continue
        if (nres.lt.2) return
-       if ((nres.lt.3).and.(itype(1).eq.1)) return
+       if ((nres.lt.3).and.(itype(1).eq.10)) return
        if (itype(1).ne.10) then
         do j=1,3
 cc Derviative was calculated for oposite vector of side chain therefore
@@ -134,105 +135,110 @@ c there is "-" sign before gloc_sc
          gcart(j,1)=gcart(j,1)+gloc_sc(3,0,icg)*
             dtauangle(j,3,2,3)
           endif
+       enddo
+       endif
+         if (nres.ge.3).and.(itype(3).ne.10) then
+         do j=1,3
+         gcart(j,1)=gcart(j,1)+gloc_sc(2,1,icg)*dtauangle(j,2,1,4)
+         enddo
+         endif
 c   As potetnial DO NOT depend on omicron anlge their derivative is
 c   ommited 
 c     &     +gloc_sc(intertyp,nres-2,icg)*dtheta(j,1,3)         
-        enddo
-       endif
-       if (itype(3).ne.10) then
-       do j=1,3
-       gcart(j,1)=gcart(j,1)+
-     & gloc_sc(2,1,icg)*dtauangle(j,2,2,4)
-       enddo
+     
 c     Calculating the remainder of dE/ddc2
        do j=1,3
-         gcart(j,2)=gcart(j,2)+gloc(1,icg)*dphi(j,2,4)+
-     &  gloc(nres-2,icg)*dtheta(j,2,3)+gloc(nres-1,icg)*dtheta(j,1,4)
-        if(itype(2).ne.10) then
-          gcart(j,2)=gcart(j,2)+gloc(ialph(2,1),icg)*dalpha(j,2,2)+
-     &    gloc(ialph(2,1)+nside,icg)*domega(j,2,2)
-        endif
-               if(itype(3).ne.10) then
-         gcart(j,2)=gcart(j,2)+gloc(ialph(3,1),icg)*dalpha(j,1,3)+
-     &    gloc(ialph(3,1)+nside,icg)*domega(j,1,3)
-        endif
-        if(nres.gt.4) then
-          gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
-        endif                  
-       enddo
-c  If there are only five residues       
-       if(nres.eq.5) then
-         do j=1,3
-           gcart(j,3)=gcart(j,3)+gloc(1,icg)*dphi(j,3,4)+gloc(2,icg)*
-     &     dphi(j,2,5)+gloc(nres-1,icg)*dtheta(j,2,4)+gloc(nres,icg)*
-     &     dtheta(j,1,5)
-         if(itype(3).ne.10) then
-          gcart(j,3)=gcart(j,3)+gloc(ialph(3,1),icg)*
-     &    dalpha(j,2,3)+gloc(ialph(3,1)+nside,icg)*domega(j,2,3)
+         if(itype(2).ne.10) then
+           if (itype(1).ne.10) gxcart=(j,2)=gxcart(j,2)+
+     &                         gloc_sc(3,0,icg)*dtauangle(j,3,3,3)
+          if ((itype(3).ne.10).and.(nres.ge.3)) then
+           gxcart(j,2)=gxcart(j,2)-gloc_sc(3,1,icg)*dtauangle(j,3,1,4)
+cc                  the   - above is due to different vector direction
+           gcart(j,2)=gcart(j,2)+gloc_sc(3,1,icg)*dtauangle(j,3,2,4)
+          endif
+          if (nres.gt.3) then
+           gxcart(j,2)=gxcart(j,2)-gloc_sc(2,1,icg)*dtauangle(j,1,1,4)
+cc                  the   - above is due to different vector direction
+           gcart(j,2)=gcart(j,2)+gloc_sc(2,1,icg)*dtauangle(j,1,2,4)
+          endif
          endif
-        if(itype(4).ne.10) then
-          gcart(j,3)=gcart(j,3)+gloc(ialph(4,1),icg)*
-     &    dalpha(j,1,4)+gloc(ialph(4,1)+nside,icg)*domega(j,1,4)
+         if (itype(1).ne.10) then
+          gcart(j,2)=gcart(j,2)+gloc_sc(1,0,icg)*dtauangle(j,1,3,3)
+         endif
+         if ((itype(3).ne.10).and(nres.ge.3)) then
+          gcart(j,2)=gcart(j,2)+gloc_sc(2,1,icg)*dtauangle(j,2,2,4)
          endif
-       enddo
-       endif
 c    If there are more than five residues
-      if(nres.gt.5) then                          
-        do i=3,nres-3
+      if(nres.ge.5) then                          
+        do i=3,nres-2
          do j=1,3
-          gcart(j,i)=gcart(j,i)+gloc(i-2,icg)*dphi(j,3,i+1)
-     &    +gloc(i-1,icg)*dphi(j,2,i+2)+
-     &    gloc(i,icg)*dphi(j,1,i+3)+gloc(nres+i-4,icg)*dtheta(j,2,i+1)+
-     &    gloc(nres+i-3,icg)*dtheta(j,1,i+2)
-          if(itype(i).ne.10) then
-           gcart(j,i)=gcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,2,i)+
-     &     gloc(ialph(i,1)+nside,icg)*domega(j,2,i)
+          if (itype(i).ne.10) then
+          gxcart(j,i)=gxcart(j,i)+gloc_sc(2,i-2,icg)
+     &    *dtauangle(j,2,3,i+1)
+     &    -gloc_sc(1,i-1,icg)*dtauangle(j,1,1i+2)
+          gcart(j,i)=gcart(j,i)+gloc_sc(1,i-1,icg)*
+     &    *dtauangle(j,1,2,i+2)
+          if (itype(i-1).ne.10) then
+           gxcart(j,i)=gxcart(j,i)+gloc_sc(3,i-2,icg)
+     &*dtauangle(j,3,3,i+1)
           endif
-          if(itype(i+1).ne.10) then
-           gcart(j,i)=gcart(j,i)+gloc(ialph(i+1,1),icg)*dalpha(j,1,i+1)
-     &     +gloc(ialph(i+1,1)+nside,icg)*domega(j,1,i+1)
+          if (itype(i+1).ne.10) then
+           gxcart(j,i)=gxcart(j,i)-gloc_sc(3,i-1,icg)
+     &*dtauangle(j,3,1,i+2)
+           gcart(j,i)=gcart(j,i)+gloc_sc(3,i-1,icg)
+     &*dtauangle(j,3,2,i+2)
+          endif
+          endif
+          if (itype(i-1).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(1,i-2,icg)*
+     &     dtauangle(j,1,3,i+1)
+          endif
+          if (itype(i+1).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(2,i-1,icg)*
+     &     dtauangle(j,2,2,i+2)
+          endif
+          if (itype(i+2).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(2,i,icg)*
+     &     dtauangle(j,2,1,i+3)
           endif
          enddo
         enddo
       endif    
-c  Setting dE/ddnres-2       
-      if(nres.gt.5) then
+c  Setting dE/ddnres-1       
+      if(nres.ge.4) then
          do j=1,3
-           gcart(j,nres-2)=gcart(j,nres-2)+gloc(nres-4,icg)*
-     &    dphi(j,3,nres-1)+gloc(nres-3,icg)*dphi(j,2,nres)
-     &     +gloc(2*nres-6,icg)*
-     &     dtheta(j,2,nres-1)+gloc(2*nres-5,icg)*dtheta(j,1,nres)
-          if(itype(nres-2).ne.10) then
-              gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-2,1),icg)*
-     &       dalpha(j,2,nres-2)+gloc(ialph(nres-2,1)+nside,icg)*
-     &        domega(j,2,nres-2)
+         if (itype(nres-1).ne.10) then
+         gxcart(j,nres-1)=gxcart(j,nres-1)+gloc_sc(2,nres-3,icg)
+     &    *dtauangle(j,2,3,nres)
+         if (itype(nres-2).ne.10) then
+        gxcart(j,nres-1)=gxcart(j,nres-1)+gloc_sc(3,nres-3,icg)
+     &    *dtauangle(j,3,3,nres)
           endif
-          if(itype(nres-1).ne.10) then
-             gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-1,1),icg)*
-     &      dalpha(j,1,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
-     &       domega(j,1,nres-1)
+         if (itype(nres).ne.10) then
+        gxcart(j,nres-1)=gxcart(j,nres-1)-gloc_sc(3,nres-2,icg)
+     &    *dtauangle(j,3,1,nres+1)
+        gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(3,nres-2,icg)
+     &    *dtauangle(j,3,2,nres+1)
           endif
+         endif
+         if (itype(nres-2).ne.10) then
+            gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(2,nres-3,icg)*
+     &   *dtauangle(j,2,3,nres)
+         endif
+          if (itype(nres).ne.10) then
+            gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(2,nres-2,icg)*
+          *dtauangle(j,2,2,nres+1)
+           endif
          enddo
       endif 
-c  Settind dE/ddnres-1       
+c  Settind dE/ddnres       
+       if (nres.ge.3).and(itype(nres).ne.10)then
        do j=1,3
-        gcart(j,nres-1)=gcart(j,nres-1)+gloc(nres-3,icg)*dphi(j,3,nres)+
-     & gloc(2*nres-5,icg)*dtheta(j,2,nres)
-        if(itype(nres-1).ne.10) then
-          gcart(j,nres-1)=gcart(j,nres-1)+gloc(ialph(nres-1,1),icg)*
-     &   dalpha(j,2,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
-     &    domega(j,2,nres-1)
-        endif
+        gxcart(j,nres)=gxcart(j,nres)+gloc_sc(3,nres-2,icg)
+     & *dtauangle(j,3,3,nres+1)+gloc_sc(2,nres-2,icg)
+     & *dtauangle(j,2,3,nres+1)
         enddo
 c   The side-chain vector derivatives
-        do i=2,nres-1
-         if(itype(i).ne.10) then       
-            do j=1,3   
-              gxcart(j,i)=gxcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,3,i)
-     &        +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)
-            enddo
-         endif     
-       enddo                                                                                                                                                   
       return
       end      
        
index d029e18..8f4a71e 100644 (file)
@@ -230,10 +230,10 @@ c the conventional case
         cost=dcos(omicron(1,i)
         cost1=dcos(theta(i-1))
         cosg=dcos(tauangle(2,i))
-        do j=1,3
-        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
-        enddo
-        scalp=scalar(dc_norm(1,i-3),dc_norm2(1,i-1+nres))
+c        do j=1,3
+c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
+c        enddo
+        scalp=scalar(dc_norm(1,i-3),dc_norm(1,i-1+nres))
         fac0=1.0d0/(sint1*sint)
         fac1=cost*fac0
         fac2=cost1*fac0
@@ -244,7 +244,7 @@ c    Obtaining the gamma derivatives from sine derivative
      &     tauangle(2,i).gt.pi34.and.tauangle(2,i).le.pi.or.
      &     tauangle(2,i).gt.-pi.and.tauangle(2,i).le.-pi34) then
          call vecpr(dc_norm2(1,i-1+nres),dc_norm(1,i-2),vp1)
-         call vecpr(dc_norm(1,i-3),dc_norm2(1,i-1+nres),vp2)
+         call vecpr(dc_norm(1,i-3),dc_norm(1,i-1+nres),vp2)
          call vecpr(dc_norm(1,i-3),dc_norm(1,i-2),vp3)
         do j=1,3
             ctgt=cost/sint
@@ -259,7 +259,7 @@ c    Obtaining the gamma derivatives from sine derivative
             dphi(j,2,i)=cosg_inv*dsintau(j,2,2,i)
 c Bug fixed 3/24/05 (AL)
             dsintau(j,2,3,i)=-sing*ctgt*domicron(j,1,2,i)
-     &        +(fac0*vp3(j)-sing*dc_norm2(j,i-1+nres))*vbld_inv(i)
+     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1+nres))*vbld_inv(i)
 c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
             dtauangle(j,2,3,i)=cosg_inv*dsinphi(j,2,3,i)
          enddo                                          
@@ -267,7 +267,7 @@ c   Obtaining the gamma derivatives from cosine derivative
         else
            do j=1,3
            dcostau(j,2,1,i)=fac1*dcostheta(j,1,i-1)+fac3*
-     &     dcostheta(j,1,i-1)-fac0*(dc_norm2(j,i-1+nres)-scalp*
+     &     dcostheta(j,1,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
      &     dc_norm(j,i-3))/vbld(i-2)
            dtauangle(j,2,1,i)=-1/sing*dcostau(j,2,1,i)
            dcostau(j,2,2,i)=fac1*dcostheta(j,2,i-1)+fac2*
@@ -276,7 +276,7 @@ c   Obtaining the gamma derivatives from cosine derivative
            dtauanlge(j,2,2,i)=-1/sing*dcostau(j,2,2,i)
            dcostau(j,2,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
      &     dcostheta(j,1,2,i)-fac0*(dc_norm(j,i-3)-scalp*
-     &     dc_norm2(j,i-1+nres))/vbld(i-1+nres)
+     &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
            dtauanlge(j,2,3,i)=-1/sing*dcosphi(j,3,i)
          enddo
         endif                                                                                            
@@ -299,9 +299,9 @@ c the conventional case
         cosg=dcos(tauangle(3,i))
         do j=1,3
         dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
-        dc_norm2(j,i-1+nres)=-dc_norm(j,i-2+nres)
+c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
         enddo
-        scalp=scalar(dc_norm2(1,i-2+nres),dc_norm2(1,i-1+nres))
+        scalp=scalar(dc_norm2(1,i-2+nres),dc_norm(1,i-1+nres))
         fac0=1.0d0/(sint1*sint)
         fac1=cost*fac0
         fac2=cost1*fac0
@@ -311,8 +311,8 @@ c    Obtaining the gamma derivatives from sine derivative
        if (tauangle(3,i).gt.-pi4.and.tauangle(3,i).le.pi4.or.
      &     tauangle(3,i).gt.pi34.and.tauangle(3,i).le.pi.or.
      &     tauangle(3,i).gt.-pi.and.tauangle(3,i).le.-pi34) then
-         call vecpr(dc_norm2(1,i-1+nres),dc_norm(1,i-2),vp1)
-         call vecpr(dc_norm2(1,i-2+nres),dc_norm2(1,i-1+nres),vp2)
+         call vecpr(dc_norm(1,i-1+nres),dc_norm(1,i-2),vp1)
+         call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-1+nres),vp2)
          call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-2),vp3)
         do j=1,3
             ctgt=cost/sint
@@ -328,7 +328,7 @@ c    Obtaining the gamma derivatives from sine derivative
             dtauangle(j,3,2,i)=cosg_inv*dsintau(j,3,2,i)
 c Bug fixed 3/24/05 (AL)
             dsintau(j,3,3,i)=-sing*ctgt*domicron(j,1,2,i)
-     &        +(fac0*vp3(j)-sing*dc_norm2(j,i-1+nres))
+     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1+nres))
      &        *vbld_inv(i-1+nres)
 c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
             dphi(j,3,3,i)=cosg_inv*dsintau(j,3,3,i)
@@ -337,7 +337,7 @@ c   Obtaining the gamma derivatives from cosine derivative
         else
            do j=1,3
            dcostau(j,3,1,i)=fac1*dcosomicron(j,2,1,i-1)+fac3*
-     &     dcostheta(j,1,i-1)-fac0*(dc_norm2(j,i-1+nres)-scalp*
+     &     dcostheta(j,1,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
      &     dc_norm2(j,i-2+nres))/vbld(i-2+nres)
            dtauangle(j,3,1,i)=-1/sing*dcostau(j,3,1,i)
            dcostau(j,3,2,i)=fac1*dcosomicron(j,2,2,i-1)+fac2*
@@ -346,7 +346,7 @@ c   Obtaining the gamma derivatives from cosine derivative
            dtauangle(j,3,2,i)=-1/sing*dcostau(j,3,2,i)
            dcostau(j,3,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
      &     dcostau(j,3,2,i)-fac0*(dc_norm2(j,i-2+nres)-scalp*
-     &     dc_norm2(j,i-1+nres))/vbld(i-1+nres)
+     &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
            dtauangle(j,3,3,i)=-1/sing*dcostau(j,3,3,i)
          enddo
         endif