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 if(itype(2).ne.10) then
32 gcart(j,2)=gcart(j,2)+gloc(ialph(2,1),icg)*dalpha(j,2,2)+
33 & gloc(ialph(2,1)+nside,icg)*domega(j,2,2)
35 if(itype(3).ne.10) then
36 gcart(j,2)=gcart(j,2)+gloc(ialph(3,1),icg)*dalpha(j,1,3)+
37 & gloc(ialph(3,1)+nside,icg)*domega(j,1,3)
40 gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
43 c If there are only five residues
46 gcart(j,3)=gcart(j,3)+gloc(1,icg)*dphi(j,3,4)+gloc(2,icg)*
47 & dphi(j,2,5)+gloc(nres-1,icg)*dtheta(j,2,4)+gloc(nres,icg)*
49 if(itype(3).ne.10) then
50 gcart(j,3)=gcart(j,3)+gloc(ialph(3,1),icg)*
51 & dalpha(j,2,3)+gloc(ialph(3,1)+nside,icg)*domega(j,2,3)
53 if(itype(4).ne.10) then
54 gcart(j,3)=gcart(j,3)+gloc(ialph(4,1),icg)*
55 & dalpha(j,1,4)+gloc(ialph(4,1)+nside,icg)*domega(j,1,4)
59 c If there are more than five residues
63 gcart(j,i)=gcart(j,i)+gloc(i-2,icg)*dphi(j,3,i+1)
64 & +gloc(i-1,icg)*dphi(j,2,i+2)+
65 & gloc(i,icg)*dphi(j,1,i+3)+gloc(nres+i-4,icg)*dtheta(j,2,i+1)+
66 & gloc(nres+i-3,icg)*dtheta(j,1,i+2)
67 if(itype(i).ne.10) then
68 gcart(j,i)=gcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,2,i)+
69 & gloc(ialph(i,1)+nside,icg)*domega(j,2,i)
71 if(itype(i+1).ne.10) then
72 gcart(j,i)=gcart(j,i)+gloc(ialph(i+1,1),icg)*dalpha(j,1,i+1)
73 & +gloc(ialph(i+1,1)+nside,icg)*domega(j,1,i+1)
81 gcart(j,nres-2)=gcart(j,nres-2)+gloc(nres-4,icg)*
82 & dphi(j,3,nres-1)+gloc(nres-3,icg)*dphi(j,2,nres)
83 & +gloc(2*nres-6,icg)*
84 & dtheta(j,2,nres-1)+gloc(2*nres-5,icg)*dtheta(j,1,nres)
85 if(itype(nres-2).ne.10) then
86 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-2,1),icg)*
87 & dalpha(j,2,nres-2)+gloc(ialph(nres-2,1)+nside,icg)*
90 if(itype(nres-1).ne.10) then
91 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-1,1),icg)*
92 & dalpha(j,1,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
99 gcart(j,nres-1)=gcart(j,nres-1)+gloc(nres-3,icg)*dphi(j,3,nres)+
100 & gloc(2*nres-5,icg)*dtheta(j,2,nres)
101 if(itype(nres-1).ne.10) then
102 gcart(j,nres-1)=gcart(j,nres-1)+gloc(ialph(nres-1,1),icg)*
103 & dalpha(j,2,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
107 c The side-chain vector derivatives
109 if(itype(i).ne.10) then
111 gxcart(j,i)=gxcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,3,i)
112 & +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)
116 C INTERTYP=1 SC...Ca...Ca...Ca
117 c calculating dE/ddc1
119 if (nres.lt.2) return
120 if ((nres.lt.3).and.(itype(1).eq.1)) return
121 if (itype(1).ne.10) then
123 gxcart(j,1)=gxcart(j,1)+gloc_sc(intertyp,1,icg)*
125 c As potetnial DO NOT
126 c & +gloc_sc(intertyp,nres-2,icg)*dtheta(j,1,3)
129 c Calculating the remainder of dE/ddc2
131 gcart(j,2)=gcart(j,2)+gloc(1,icg)*dphi(j,2,4)+
132 & gloc(nres-2,icg)*dtheta(j,2,3)+gloc(nres-1,icg)*dtheta(j,1,4)
133 if(itype(2).ne.10) then
134 gcart(j,2)=gcart(j,2)+gloc(ialph(2,1),icg)*dalpha(j,2,2)+
135 & gloc(ialph(2,1)+nside,icg)*domega(j,2,2)
137 if(itype(3).ne.10) then
138 gcart(j,2)=gcart(j,2)+gloc(ialph(3,1),icg)*dalpha(j,1,3)+
139 & gloc(ialph(3,1)+nside,icg)*domega(j,1,3)
142 gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
145 c If there are only five residues
148 gcart(j,3)=gcart(j,3)+gloc(1,icg)*dphi(j,3,4)+gloc(2,icg)*
149 & dphi(j,2,5)+gloc(nres-1,icg)*dtheta(j,2,4)+gloc(nres,icg)*
151 if(itype(3).ne.10) then
152 gcart(j,3)=gcart(j,3)+gloc(ialph(3,1),icg)*
153 & dalpha(j,2,3)+gloc(ialph(3,1)+nside,icg)*domega(j,2,3)
155 if(itype(4).ne.10) then
156 gcart(j,3)=gcart(j,3)+gloc(ialph(4,1),icg)*
157 & dalpha(j,1,4)+gloc(ialph(4,1)+nside,icg)*domega(j,1,4)
161 c If there are more than five residues
165 gcart(j,i)=gcart(j,i)+gloc(i-2,icg)*dphi(j,3,i+1)
166 & +gloc(i-1,icg)*dphi(j,2,i+2)+
167 & gloc(i,icg)*dphi(j,1,i+3)+gloc(nres+i-4,icg)*dtheta(j,2,i+1)+
168 & gloc(nres+i-3,icg)*dtheta(j,1,i+2)
169 if(itype(i).ne.10) then
170 gcart(j,i)=gcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,2,i)+
171 & gloc(ialph(i,1)+nside,icg)*domega(j,2,i)
173 if(itype(i+1).ne.10) then
174 gcart(j,i)=gcart(j,i)+gloc(ialph(i+1,1),icg)*dalpha(j,1,i+1)
175 & +gloc(ialph(i+1,1)+nside,icg)*domega(j,1,i+1)
180 c Setting dE/ddnres-2
183 gcart(j,nres-2)=gcart(j,nres-2)+gloc(nres-4,icg)*
184 & dphi(j,3,nres-1)+gloc(nres-3,icg)*dphi(j,2,nres)
185 & +gloc(2*nres-6,icg)*
186 & dtheta(j,2,nres-1)+gloc(2*nres-5,icg)*dtheta(j,1,nres)
187 if(itype(nres-2).ne.10) then
188 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-2,1),icg)*
189 & dalpha(j,2,nres-2)+gloc(ialph(nres-2,1)+nside,icg)*
192 if(itype(nres-1).ne.10) then
193 gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-1,1),icg)*
194 & dalpha(j,1,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
199 c Settind dE/ddnres-1
201 gcart(j,nres-1)=gcart(j,nres-1)+gloc(nres-3,icg)*dphi(j,3,nres)+
202 & gloc(2*nres-5,icg)*dtheta(j,2,nres)
203 if(itype(nres-1).ne.10) then
204 gcart(j,nres-1)=gcart(j,nres-1)+gloc(ialph(nres-1,1),icg)*
205 & dalpha(j,2,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
209 c The side-chain vector derivatives
211 if(itype(i).ne.10) then
213 gxcart(j,i)=gxcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,3,i)
214 & +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)