unres src_MD-M from branch Multichain
[unres.git] / source / unres / src_MD-M / int_to_cart.f
index e178afe..d3a8a92 100644 (file)
@@ -14,7 +14,9 @@ c-------------------------------------------------------------
       include 'COMMON.MD'
       include 'COMMON.IOUNITS'
       include 'COMMON.SCCOR' 
-c   calculating dE/ddc1      
+      include 'COMMON.CONTROL'
+c   calculating dE/ddc1     
+C       print *,"wchodze22",ialph(2,1) 
        if (nres.lt.3) go to 18
        do j=1,3
          gcart(j,1)=gcart(j,1)+gloc(1,icg)*dphi(j,1,4)
@@ -24,16 +26,16 @@ c   calculating dE/ddc1
      &    gloc(ialph(2,1)+nside,icg)*domega(j,1,2)             
         endif
        enddo
-C      write (iout,*) "????A CO TO??"
+C       print *,"wchodze22",ialph(2,1)
 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).and.(itype(2).ne.ntyp1)) then
+        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).and.(itype(3).ne.21)) then
+               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
@@ -41,6 +43,7 @@ c     Calculating the remainder of dE/ddc2
           gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
         endif                  
        enddo
+C       print *,"wchodze22",ialph(2,1)
 c  If there are only five residues       
        if(nres.eq.5) then
          do j=1,3
@@ -57,10 +60,11 @@ c  If there are only five residues
          endif
        enddo
        endif
-C      write (iout,*) "Poniezej blad??",ialph(3,1),nside,ialph(4,1)
 c    If there are more than five residues
       if(nres.gt.5) then                          
+C       print *,"wchodze22",ialph(2,1)
         do i=3,nres-3
+C        print *,i,ialph(i,1)+nside
          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)+
@@ -77,20 +81,21 @@ c    If there are more than five residues
          enddo
         enddo
       endif    
-c  Setting dE/ddnres-2      
-      write(iout,*) "ATUCHUJ?" 
+C       print *,"wchodze22",ialph(2,1)
+
+c  Setting dE/ddnres-2       
       if(nres.gt.5) 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).and.(itype(nres-2).ne.ntyp1)) then
+          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)
           endif
-          if((itype(nres-1).ne.10).and.(itype(nres-1).ne.ntyp1)) then
+          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)
@@ -101,7 +106,7 @@ c  Settind dE/ddnres-1
        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).and.(itype(nres-1).ne.ntyp1)) then
+        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)
@@ -115,9 +120,7 @@ c   The side-chain vector derivatives
      &        +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)
             enddo
          endif     
-       enddo
-       write(iout,*) "TU DOCHODZE"
-                                                                                                                                                       
+       enddo                                                                                                                                                   
 c----------------------------------------------------------------------
 C INTERTYP=1 SC...Ca...Ca...Ca
 C INTERTYP=2 Ca...Ca...Ca...SC
@@ -128,6 +131,7 @@ c       do i=1,nres
 c       gloc(i,icg)=0.0D0
 c          write (iout,*) "poczotkoawy",i,gloc_sc(1,i,icg)
 c       enddo
+C       print *,"tu dochodze??"
        if (nres.lt.2) return
        if ((nres.lt.3).and.(itype(1).eq.10)) return
        if ((itype(1).ne.10).and.(itype(1).ne.ntyp1)) then
@@ -272,6 +276,13 @@ c  Settind dE/ddnres
         enddo
        endif
 c   The side-chain vector derivatives
+C      if (SELFGUIDE.gt.0) then
+C      do j=1,3
+C       gcart(j,afmbeg)=gcart(j,afmbeg)+gcart(j,afmend)
+C       gcart(j,afmbeg)=0.0d0
+C       gcart(j,afmend)=0.0d0
+C      enddo
+C      endif
       return
       end