1 double precision function qwolynes(seg1,seg2,flag,seg3,seg4)
2 implicit real*8 (a-h,o-z)
4 include 'COMMON.IOUNITS'
6 include 'COMMON.INTERACT'
8 integer i,j,jl,k,l,il,kl,nl,np,ip,kp,seg1,seg2,seg3,seg4,
11 double precision dist,qm
12 double precision qq,qqij,qqijCM,dij,d0ij,dijCM,d0ijCM
13 logical lprn /.false./
15 double precision sigm,x
18 write (iout,*) "qwolynes: nperm",nperm," flag",flag,
19 & " seg1",seg1," seg2",seg2," nsep",nsep
25 if (itype(il).eq.ntyp1) cycle
27 if (itype(jl).eq.ntyp1) cycle
29 d0ij=dsqrt((cref(1,jl)-cref(1,il))**2+
30 & (cref(2,jl)-cref(2,il))**2+
31 & (cref(3,jl)-cref(3,il))**2)
33 qqij = dexp(-0.5d0*((dij-d0ij)/(sigm(d0ij)))**2)
35 if (itype(il).ne.10 .or. itype(jl).ne.10) then
38 & (cref(1,jl+nres)-cref(1,il+nres))**2+
39 & (cref(2,jl+nres)-cref(2,il+nres))**2+
40 & (cref(3,jl+nres)-cref(3,il+nres))**2)
41 dijCM=dist(il+nres,jl+nres)
42 qqijCM = dexp(-0.5d0*((dijCM-d0ijCM)/(sigm(d0ijCM)))**2)
45 c write (iout,*) "il",il,itype(il)," jl",jl,itype(jl),
46 c & " qqiij",qqij," qqijCM",qqijCM
50 write (iout,*) "qwolynes: nl",nl
55 if (itype(il).eq.ntyp1) cycle
56 if((seg3-il).lt.3) then
62 if (itype(jl).eq.ntyp1) cycle
64 d0ij=dsqrt((cref(1,jl)-cref(1,il))**2+
65 & (cref(2,jl)-cref(2,il))**2+
66 & (cref(3,jl)-cref(3,il))**2)
68 qqij = dexp(-0.5d0*((dij-d0ij)/(sigm(d0ij)))**2)
70 if (itype(il).ne.10 .or. itype(jl).ne.10) then
73 & (cref(1,jl+nres)-cref(1,il+nres))**2+
74 & (cref(2,jl+nres)-cref(2,il+nres))**2+
75 & (cref(3,jl+nres)-cref(3,il+nres))**2)
76 dijCM=dist(il+nres,jl+nres)
77 qqijCM = dexp(-0.5d0*((dijCM-d0ijCM)/(sigm(d0ijCM)))**2)
79 c write (iout,*) "il",il,itype(il)," jl",jl,itype(jl),
80 c & " qqiij",qqij," qqijCM",qqijCM
86 c write (iout,*) "qq",qq
90 c-------------------------------------------------------------------
91 subroutine qwolynes_prim(seg1,seg2,flag,seg3,seg4)
92 implicit real*8 (a-h,o-z)
94 include 'COMMON.IOUNITS'
95 include 'COMMON.CHAIN'
96 include 'COMMON.INTERACT'
99 include 'COMMON.QRESTR'
100 integer i,j,jl,k,l,il,nl,seg1,seg2,seg3,seg4,
103 double precision dist
104 double precision dij,d0ij,dijCM,d0ijCM
105 logical lprn /.false./
107 double precision sigm,x,sim,dd0,fac,ddqij
110 write (iout,*) "qwolynes: flag",flag," seg1 seg1",seg1,seg2,
112 write (iout,*) "nperm",nperm
123 if (itype(il).eq.ntyp1) cycle
125 if (itype(jl).eq.ntyp1) cycle
127 d0ij=dsqrt((cref(1,jl)-cref(1,il))**2+
128 & (cref(2,jl)-cref(2,il))**2+
129 & (cref(3,jl)-cref(3,il))**2)
131 sim = 1.0d0/sigm(d0ij)
134 fac = dd0*sim/dij*dexp(-0.5d0*dd0*dd0*sim)
136 ddqij = (c(k,il)-c(k,jl))*fac
137 dqwol(k,il)=dqwol(k,il)+ddqij
138 dqwol(k,jl)=dqwol(k,jl)-ddqij
140 if (itype(il).ne.10 .or. itype(jl).ne.10) then
143 & (cref(1,jl+nres)-cref(1,il+nres))**2+
144 & (cref(2,jl+nres)-cref(2,il+nres))**2+
145 & (cref(3,jl+nres)-cref(3,il+nres))**2)
146 dijCM=dist(il+nres,jl+nres)
147 sim = 1.0d0/sigm(d0ijCM)
150 fac=dd0*sim/dijCM*dexp(-0.5d0*dd0*dd0*sim)
152 ddqij = (c(k,il+nres)-c(k,jl+nres))*fac
153 dxqwol(k,il)=dxqwol(k,il)+ddqij
154 dxqwol(k,jl)=dxqwol(k,jl)-ddqij
158 write (iout,*) "prim il",il,itype(il)," jl",jl,itype(jl),
159 & " dqwol",(dqwol(k,il),k=1,3)," dxqwol",(dxqwol(k,il),k=1,3)
165 if (itype(il).eq.ntyp1) cycle
166 if((seg3-il).lt.3) then
172 if (itype(jl).eq.ntyp1) cycle
174 d0ij=dsqrt((cref(1,jl)-cref(1,il))**2+
175 & (cref(2,jl)-cref(2,il))**2+
176 & (cref(3,jl)-cref(3,il))**2)
178 sim = 1.0d0/sigm(d0ij)
181 fac = dd0*sim/dij*dexp(-0.5d0*dd0*dd0*sim)
183 ddqij = (c(k,il)-c(k,jl))*fac
184 dqwol(k,il)=dqwol(k,il)+ddqij
185 dqwol(k,jl)=dqwol(k,jl)-ddqij
187 if (itype(il).ne.10 .or. itype(jl).ne.10) then
190 & (cref(1,jl+nres)-cref(1,il+nres))**2+
191 & (cref(2,jl+nres)-cref(2,il+nres))**2+
192 & (cref(3,jl+nres)-cref(3,il+nres))**2)
193 dijCM=dist(il+nres,jl+nres)
194 sim = 1.0d0/sigm(d0ijCM)
197 fac = dd0*sim/dijCM*dexp(-0.5d0*dd0*dd0*sim)
199 ddqij = (c(k,il+nres)-c(k,jl+nres))*fac
200 dxqwol(k,il)=dxqwol(k,il)+ddqij
201 dxqwol(k,jl)=dxqwol(k,jl)-ddqij
208 write (iout,*) "qwolynes: nl",nl
212 dqwol(j,i)=dqwol(j,i)/nl
213 dxqwol(j,i)=dxqwol(j,i)/nl
218 c-------------------------------------------------------------------
219 subroutine qwol_num(seg1,seg2,flag,seg3,seg4)
220 implicit real*8 (a-h,o-z)
222 include 'COMMON.IOUNITS'
223 include 'COMMON.CHAIN'
224 include 'COMMON.INTERACT'
226 integer seg1,seg2,seg3,seg4
228 double precision qwolan(3,0:maxres),cdummy(3,0:maxres2),
229 & qwolxan(3,0:maxres),q1,q2
230 double precision delta /1.0d-10/
233 q1=qwolynes(seg1,seg2,flag,seg3,seg4)
236 q2=qwolynes(seg1,seg2,flag,seg3,seg4)
237 qwolan(j,i)=(q2-q1)/delta
243 q1=qwolynes(seg1,seg2,flag,seg3,seg4)
244 cdummy(j,i+nres)=c(j,i+nres)
245 c(j,i+nres)=c(j,i+nres)+delta
246 q2=qwolynes(seg1,seg2,flag,seg3,seg4)
247 qwolxan(j,i)=(q2-q1)/delta
248 c(j,i+nres)=cdummy(j,i+nres)
251 c write(iout,*) "Numerical Q carteisan gradients backbone: "
253 c write(iout,'(i5,3e15.5)') i, (qwolan(j,i),j=1,3)
255 c write(iout,*) "Numerical Q carteisan gradients side-chain: "
257 c write(iout,'(i5,3e15.5)') i, (qwolxan(j,i),j=1,3)
261 c------------------------------------------------------------------------