2 c--------------------------------------------------------------
3 c This subroutine converts the energy derivatives from internal
4 c coordinates to cartesian coordinates
5 c-------------------------------------------------------------
6 implicit real*8 (a-h,o-z)
10 include 'COMMON.DERIV'
12 include 'COMMON.LOCAL'
13 include 'COMMON.INTERACT'
15 include 'COMMON.IOUNITS'
20 gcart(j,1)=gcart(j,1)+gloc(1,icg)*dphi(j,1,4)
21 & +gloc(nres-2,icg)*dtheta(j,1,3)
22 if(itype(2).ne.10) then
23 gcart(j,1)=gcart(j,1)+gloc(ialph(2,1),icg)*dalpha(j,1,2)+
24 & gloc(ialph(2,1)+nside,icg)*domega(j,1,2)
27 c Calculating the remainder of dE/ddc2
29 gcart(j,2)=gcart(j,2)+gloc(1,icg)*dphi(j,2,4)+
30 & gloc(nres-2,icg)*dtheta(j,2,3)+gloc(nres-1,icg)*dtheta(j,1,4)
31 & +gloc(nres-2,icg)*dtheta(j,1,3)
32 if(itype(2).ne.10) then
33 gcart(j,2)=gcart(j,2)+gloc(ialph(2,1),icg)*dalpha(j,2,2)+
34 & gloc(ialph(2,1)+nside,icg)*domega(j,2,2)
36 if(itype(3).ne.10) then
37 gcart(j,2)=gcart(j,2)+gloc(ialph(3,1),icg)*dalpha(j,1,3)+
38 & gloc(ialph(3,1)+nside,icg)*domega(j,1,3)
41 gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
44 c If there are only five residues
47 gcart(j,3)=gcart(j,3)+gloc(1,icg)*dphi(j,3,4)+gloc(2,icg)*
48 & dphi(j,2,5)+gloc(nres-1,icg)*dtheta(j,2,4)+gloc(nres,icg)*
50 if(itype(3).ne.10) then
51 gcart(j,3)=gcart(j,3)+gloc(ialph(3,1),icg)*
52 & dalpha(j,2,3)+gloc(ialph(3,1)+nside,icg)*domega(j,2,3)
54 if(itype(4).ne.10) then
55 gcart(j,3)=gcart(j,3)+gloc(ialph(4,1),icg)*
56 & dalpha(j,1,4)+gloc(ialph(4,1)+nside,icg)*domega(j,1,4)
60 c If there are more than five residues
64 gcart(j,i)=gcart(j,i)+gloc(i-2,icg)*dphi(j,3,i+1)
65 & +gloc(i-1,icg)*dphi(j,2,i+2)+
66 & gloc(i,icg)*dphi(j,1,i+3)+gloc(nres+i-4,icg)*dtheta(j,2,i+1)+
67 & gloc(nres+i-3,icg)*dtheta(j,1,i+2)
68 if(itype(i).ne.10) then
69 gcart(j,i)=gcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,2,i)+
70 & gloc(ialph(i,1)+nside,icg)*domega(j,2,i)
72 if(itype(i+1).ne.10) then
73 gcart(j,i)=gcart(j,i)+gloc(ialph(i+1,1),icg)*dalpha(j,1,i+1)
74 & +gloc(ialph(i+1,1)+nside,icg)*domega(j,1,i+1)
82 gcart(j,nres-2)=gcart(j,nres-2)+gloc(nres-4,icg)*
83 & dphi(j,3,nres-1)+gloc(nres-3,icg)*dphi(j,2,nres)
84 & +gloc(2*nres-6,icg)*
85 & dtheta(j,2,nres-1)+gloc(2*nres-5,icg)*dtheta(j,1,nres)
86 if(itype(nres-2).ne.10) then
87 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-2,1),icg)*
88 & dalpha(j,2,nres-2)+gloc(ialph(nres-2,1)+nside,icg)*
91 if(itype(nres-1).ne.10) then
92 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-1,1),icg)*
93 & dalpha(j,1,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
100 gcart(j,nres-1)=gcart(j,nres-1)+gloc(nres-3,icg)*dphi(j,3,nres)+
101 & gloc(2*nres-5,icg)*dtheta(j,2,nres)
102 if(itype(nres-1).ne.10) then
103 gcart(j,nres-1)=gcart(j,nres-1)+gloc(ialph(nres-1,1),icg)*
104 & dalpha(j,2,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
108 c The side-chain vector derivatives
110 if(itype(i).ne.10) then
112 gxcart(j,i)=gxcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,3,i)
113 & +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)