2 implicit real*8 (a-h,o-z)
3 ***********************************************************************
4 * This subroutine calculates the derivatives of the consecutive virtual
5 * bond vectors and the SC vectors in the virtual-bond angles theta and
6 * virtual-torsional angles phi, as well as the derivatives of SC vectors
7 * in the angles alpha and omega, describing the location of a side chain
8 * in its local coordinate system.
10 * The derivatives are stored in the following arrays:
12 * DDCDV - the derivatives of virtual-bond vectors DC in theta and phi.
13 * The structure is as follows:
15 * dDC(x,2)/dT(3),...,dDC(z,2)/dT(3),0, 0, 0
16 * dDC(x,3)/dT(4),...,dDC(z,3)/dT(4),dDC(x,3)/dP(4),dDC(y,4)/dP(4),dDC(z,4)/dP(4)
17 * . . . . . . . . . . . . . . . . . .
18 * dDC(x,N-1)/dT(4),...,dDC(z,N-1)/dT(4),dDC(x,N-1)/dP(4),dDC(y,N-1)/dP(4),dDC(z,N-1)/dP(4)
22 * dDC(x,N-1)/dT(N),...,dDC(z,N-1)/dT(N),dDC(x,N-1)/dP(N),dDC(y,N-1)/dP(N),dDC(z,N-1)/dP(N)
24 * DXDV - the derivatives of the side-chain vectors in theta and phi.
25 * The structure is same as above.
27 * DCDS - the derivatives of the side chain vectors in the local spherical
28 * andgles alph and omega:
30 * dX(x,2)/dA(2),dX(y,2)/dA(2),dX(z,2)/dA(2),dX(x,2)/dO(2),dX(y,2)/dO(2),dX(z,2)/dO(2)
31 * dX(x,3)/dA(3),dX(y,3)/dA(3),dX(z,3)/dA(3),dX(x,3)/dO(3),dX(y,3)/dO(3),dX(z,3)/dO(3)
35 * dX(x,N-1)/dA(N-1),dX(y,N-1)/dA(N-1),dX(z,N-1)/dA(N-1),dX(x,N-1)/dO(N-1),dX(y,N-1)/dO(N-1),dX(z,N-1)/dO(N-1)
37 * Version of March '95, based on an early version of November '91.
39 ***********************************************************************
41 include 'DIMENSIONS.ZSCOPT'
43 include 'COMMON.CHAIN'
44 include 'COMMON.DERIV'
46 include 'COMMON.LOCAL'
47 include 'COMMON.INTERACT'
48 dimension drt(3,3,maxres),rdt(3,3,maxres),dp(3,3),temp(3,3),
49 & fromto(3,3,maxdim),prordt(3,3,maxres),prodrt(3,3,maxres)
50 dimension xx(3),xx1(3)
51 * get the position of the jth ijth fragment of the chain coordinate system
52 * in the fromto array.
53 indmat(i,j)=((2*(nres-2)-i)*(i-1))/2+j-1
55 * calculate the derivatives of transformation matrix elements in theta
83 * generate the matrix products of type r(i)t(i)...r(j)t(j)
94 fromto(k,l,ind)=temp(k,l)
103 dpkl=dpkl+temp(k,m)*rt(m,l,j)
117 * Calculate derivatives.
123 * Derivatives of DC(i+1) in theta(i+2)
129 dpjk=dpjk+prod(j,l,i)*rdt(l,k,i)
132 prordt(j,k,i)=dp(j,k)
135 dcdv(j,ind1)=vbl*dp(j,1)
138 * Derivatives of SC(i+1) in theta(i+2)
140 xx1(1)=-0.5D0*xloc(2,i+1)
141 xx1(2)= 0.5D0*xloc(1,i+1)
145 xj=xj+r(j,k,i)*xx1(k)
152 rj=rj+prod(j,k,i)*xx(k)
157 * Derivatives of SC(i+1) in theta(i+3). The have to be handled differently
158 * than the other off-diagonal derivatives.
163 dxoiij=dxoiij+dp(j,k)*xrot(k,i+2)
165 dxdv(j,ind1+1)=dxoiij
167 cd print *,ind1+1,(dxdv(j,ind1+1),j=1,3)
169 * Derivatives of DC(i+1) in phi(i+2)
175 dpjk=dpjk+prod(j,l,i)*drt(l,k,i)
178 prodrt(j,k,i)=dp(j,k)
180 dcdv(j+3,ind1)=vbl*dp(j,1)
183 * Derivatives of SC(i+1) in phi(i+2)
186 xx(3)= xloc(2,i+1)*r(2,2,i)+xloc(3,i+1)*r(2,3,i)
187 xx(2)=-xloc(2,i+1)*r(3,2,i)-xloc(3,i+1)*r(3,3,i)
191 rj=rj+prod(j,k,i)*xx(k)
196 * Derivatives of SC(i+1) in phi(i+3).
201 dxoiij=dxoiij+dp(j,k)*xrot(k,i+2)
203 dxdv(j+3,ind1+1)=dxoiij
206 * Calculate the derivatives of DC(i+1) and SC(i+1) in theta(i+3) thru
207 * theta(nres) and phi(i+3) thru phi(nres).
212 cd print *,'i=',i,' j=',j,' ind=',ind,' ind1=',ind1
217 tempkl=tempkl+prordt(k,m,i)*fromto(m,l,ind)
222 cd print '(9f8.3)',((fromto(k,l,ind),l=1,3),k=1,3)
223 cd print '(9f8.3)',((prod(k,l,i),l=1,3),k=1,3)
224 cd print '(9f8.3)',((temp(k,l),l=1,3),k=1,3)
225 * Derivatives of virtual-bond vectors in theta
227 dcdv(k,ind1)=vbl*temp(k,1)
229 cd print '(3f8.3)',(dcdv(k,ind1),k=1,3)
230 * Derivatives of SC vectors in theta
234 dxoijk=dxoijk+temp(k,l)*xrot(l,j+2)
236 dxdv(k,ind1+1)=dxoijk
239 *--- Calculate the derivatives in phi
245 tempkl=tempkl+prodrt(k,m,i)*fromto(m,l,ind)
251 dcdv(k+3,ind1)=vbl*temp(k,1)
256 dxoijk=dxoijk+temp(k,l)*xrot(l,j+2)
258 dxdv(k+3,ind1+1)=dxoijk
263 * Derivatives in alpha and omega:
266 dsci=dsc(iabs(itype(i)))
269 cd print *,'i=',i,' dsci=',dsci,' alphi=',alphi,' omegi=',omegi
274 temp(1,1)=-dsci*sinalphi
275 temp(2,1)= dsci*cosalphi*cosomegi
276 temp(3,1)=-dsci*cosalphi*sinomegi
278 temp(2,2)=-dsci*sinalphi*sinomegi
279 temp(3,2)=-dsci*sinalphi*cosomegi
280 theta2=pi-0.5D0*theta(i+1)
284 cd print *,((temp(l,k),l=1,3),k=1,2)
288 xxp= xp*cost2+yp*sint2
289 yyp=-xp*sint2+yp*cost2
292 xx(2)=yyp*r(2,2,i-1)+zzp*r(2,3,i-1)
293 xx(3)=yyp*r(3,2,i-1)+zzp*r(3,3,i-1)
297 dj=dj+prod(k,l,i-1)*xx(l)