Adam's unres update
[unres.git] / source / unres / src-HCD-5D / chainbuild.F
index 7902f15..a60e2bd 100644 (file)
@@ -108,11 +108,11 @@ C
       include 'COMMON.VAR'
       cost=dcos(theta(3))
       sint=dsin(theta(3))
-      t(1,1,1)=-cost
+      t(1,1,1)=cost
       t(1,2,1)=-sint 
       t(1,3,1)= 0.0D0
-      t(2,1,1)=-sint
-      t(2,2,1)= cost
+      t(2,1,1)=sint
+      t(2,2,1)=cost
       t(2,3,1)= 0.0D0
       t(3,1,1)= 0.0D0
       t(3,2,1)= 0.0D0
@@ -170,7 +170,7 @@ C
 C Locate CA(i) and SC(i-1)
 C
       implicit none
-      integer i,j
+      integer i,j,k
       double precision theti,phii,cost,sint,cosphi,sinphi
       include 'DIMENSIONS'
       include 'COMMON.CHAIN'
@@ -196,14 +196,15 @@ C
       sint=dsin(theti)
       cosphi=dcos(phii)
       sinphi=dsin(phii)
+c      write (iout,*) "locate_next_res i",i
 * Define the matrices of the rotation about the virtual-bond valence angles
 * theta, T(i,j,k), virtual-bond dihedral angles gamma (miscalled PHI in this
 * program), R(i,j,k), and, the cumulative matrices of rotation RT
       t(1,1,i-2)=-cost
-      t(1,2,i-2)=-sint 
+      t(1,2,i-2)= sint 
       t(1,3,i-2)= 0.0D0
       t(2,1,i-2)=-sint
-      t(2,2,i-2)= cost
+      t(2,2,i-2)=-cost
       t(2,3,i-2)= 0.0D0
       t(3,1,i-2)= 0.0D0
       t(3,2,i-2)= 0.0D0
@@ -212,26 +213,36 @@ C
       r(1,2,i-2)= 0.0D0
       r(1,3,i-2)= 0.0D0
       r(2,1,i-2)= 0.0D0
-      r(2,2,i-2)=-cosphi
-      r(2,3,i-2)= sinphi
+      r(2,2,i-2)= cosphi
+      r(2,3,i-2)=-sinphi
       r(3,1,i-2)= 0.0D0
       r(3,2,i-2)= sinphi
       r(3,3,i-2)= cosphi
       rt(1,1,i-2)=-cost
-      rt(1,2,i-2)=-sint
+      rt(1,2,i-2)= sint
       rt(1,3,i-2)=0.0D0
-      rt(2,1,i-2)=sint*cosphi
+      rt(2,1,i-2)=-sint*cosphi
       rt(2,2,i-2)=-cost*cosphi
-      rt(2,3,i-2)=sinphi
+      rt(2,3,i-2)=-sinphi
       rt(3,1,i-2)=-sint*sinphi
-      rt(3,2,i-2)=cost*sinphi
-      rt(3,3,i-2)=cosphi
+      rt(3,2,i-2)=-cost*sinphi
+      rt(3,3,i-2)= cosphi
       call matmult(prod(1,1,i-2),rt(1,1,i-2),prod(1,1,i-1))
+c      write (iout,*) "prod",i-2
+c      do j=1,3
+c        write (iout,*) (prod(j,k,i-2),k=1,3)
+c      enddo
+c      write (iout,*) "prod",i-1
+c      do j=1,3
+c        write (iout,*) (prod(j,k,i-1),k=1,3)
+c      enddo
       do j=1,3
         dc_norm(j,i-1)=prod(j,1,i-1)
         dc(j,i-1)=vbld(i)*prod(j,1,i-1)
         c(j,i)=c(j,i-1)+dc(j,i-1)
       enddo
+c      write (iout,*) "dc",i-1,(dc(j,i-1),j=1,3)
+c      write (iout,*) "c",i,(dc(j,i),j=1,3)
 cd    print '(2i3,2(3f10.5,5x))', i-1,i,(dc(j,i-1),j=1,3),(c(j,i),j=1,3)
 C 
 C Now calculate the coordinates of SC(i-1)