1 | ! **************************************************************
|
---|
2 | !
|
---|
3 | ! This file contains the subroutines: esolan
|
---|
4 | !
|
---|
5 | ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
6 | ! Shura Hayryan, Chin-Ku
|
---|
7 | ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
8 | ! Jan H. Meinke, Sandipan Mohanty
|
---|
9 | !
|
---|
10 | ! **************************************************************
|
---|
11 |
|
---|
12 | real*8 function esolan(nmol)
|
---|
13 |
|
---|
14 | ! -----------------------------------------------------------------
|
---|
15 | !
|
---|
16 | ! Calculates the solvation energy of the protein with
|
---|
17 | ! solavtion parameters model E=\sum\sigma_iA_i.
|
---|
18 | ! The solvent accessible surface area per atom
|
---|
19 | ! and its gradients with respect to the Cartesian coordinates of
|
---|
20 | ! the atoms are calculated using the projection method described in
|
---|
21 | !
|
---|
22 | ! J Comp Phys 26, 334-343, 2005
|
---|
23 | !
|
---|
24 | ! USAGE: eysl=esolan(nmol)-Returns the value of the solvation energy
|
---|
25 | !
|
---|
26 | ! INPUT: nmol - the order number of the protein chain.
|
---|
27 | ! The atomic coordinates, radii and solvation parameters
|
---|
28 | ! are taken from the global arrays of SMMP
|
---|
29 | !
|
---|
30 | ! OUTPUT: global array gradan(mxat,3) contains the gradients of
|
---|
31 | ! solvation energy per atom
|
---|
32 | ! local array as(mxat) contains accessible surface area per atom
|
---|
33 | !
|
---|
34 | ! Output file "solvation.dat' conatains detailed data.
|
---|
35 | !
|
---|
36 | ! Correctness of this program was last time rechecked with GETAREA
|
---|
37 | !
|
---|
38 | ! CALLS: none
|
---|
39 | !
|
---|
40 | ! ----------------------------------------------------------------------
|
---|
41 | ! TODO Test the solvent energy for multiple molecules
|
---|
42 |
|
---|
43 | include 'INCL.H'
|
---|
44 |
|
---|
45 |
|
---|
46 | integer nmol, ks0, ks2
|
---|
47 | Cf2py intent(in) nmol
|
---|
48 |
|
---|
49 | parameter (ks0=mxat*(mxat+1))
|
---|
50 | parameter (ks2=mxat+mxat)
|
---|
51 | ! Functions
|
---|
52 | real*8 grnd
|
---|
53 |
|
---|
54 | integer neib, neibp, ivrx, iv, ial, i, ij, j, iii, idi,ivr, ifu,
|
---|
55 | & ita2, ita3, ine, kk, j2, jkk, jjj, jj, jk, k, l, ll,
|
---|
56 | & nb, numat, nyx
|
---|
57 | real*8 vertex, ax, pol, as, ayx, ayx1, probe, dd, ddat, dadx, gp,
|
---|
58 | & dalp,dbet, daalp, dabet, vrx, dv, dx, dy, dz, dt, di,
|
---|
59 | & dii, ss, dta, dtb, di1, di2, gs, xold, yold, zold,
|
---|
60 | & energy, sss, a1, a, ab1, a2, aa, ac2, ac1, ab2, am2,
|
---|
61 | & am, aia, ak, alp, am1, ap1, amibe, amabe, amaal, amial,
|
---|
62 | & ang, D, ddp, cf, b2, arg2, arg1, ap2, b, b1, b2c2, ca,
|
---|
63 | & ba, bcd, bc, bet, c1, c, c2, cc, sfcg, caba, cg, cfsg,
|
---|
64 | & cfcg, daba, ct, cs, d1, d2, dbe, dal, dcotbma, dcbet,
|
---|
65 | & dcalp, dcbetmalp, dcbetpalp, ddp2, div, dsbetmalp,
|
---|
66 | & dsalp, dsbet, yy, dsbetpalp, enr, p1, p2, r42, r22,
|
---|
67 | & r22p, r2, pom, prob, r, r42p, ratom, rr, s, sfsg, sf,
|
---|
68 | & sg, vv1, t, ufi, tt, uga, uv, vv, vv2, wv, xx, xv, yv,
|
---|
69 | & zz, zv
|
---|
70 | dimension neib(0:mxat),neibp(0:mxat),ivrx(ks0)
|
---|
71 | dimension vertex(ks0,4),ax(ks0,2),
|
---|
72 | & pol(mxat),as(mxat),ayx(ks0,2),
|
---|
73 | & ayx1(ks0),probe(ks0),dd(mxat),ddat(mxat,4)
|
---|
74 | dimension dadx(4,3),gp(4),dalp(4),dbet(4),
|
---|
75 | & daalp(4),dabet(4),vrx(ks0,4),dv(4),dx(4),dy(4),dz(4),dt(4),
|
---|
76 | & di(4),dii(4,3),ss(mxat),dta(4),dtb(4),di1(4),di2(4),gs(3)
|
---|
77 | dimension xold(-1:mxat),yold(-1:mxat),zold(-1:mxat)
|
---|
78 | integer ta2(0:mxat),ta3(0:mxat),fullarc(0:mxat),al(0:ks2)
|
---|
79 | real*8 neibor(mxat,4)
|
---|
80 |
|
---|
81 | real*8, dimension(:, :, :), allocatable :: grad
|
---|
82 |
|
---|
83 | allocate(grad(mxat, mxat, 3))
|
---|
84 |
|
---|
85 |
|
---|
86 | ! open(3,file='solvation.dat')! Output file with solvation data
|
---|
87 |
|
---|
88 | energy=0.0d0 ! Total solvation energy
|
---|
89 | sss=0.0d0 ! Total solvent accessible surface area
|
---|
90 | if (nmol.eq.0) then
|
---|
91 | numat=iatrs2(irsml2(ntlml))-iatrs1(irsml1(1))+1 ! Number of atoms
|
---|
92 | else
|
---|
93 | numat=iatrs2(irsml2(nmol))-iatrs1(irsml1(nmol))+1 ! Number of atoms
|
---|
94 | endif
|
---|
95 |
|
---|
96 | do i=1,numat
|
---|
97 | do j=1,3
|
---|
98 | gradan(i,j)=0.0d0
|
---|
99 | end do
|
---|
100 | end do
|
---|
101 |
|
---|
102 | do i=1,numat
|
---|
103 | xold(i)=xat(i)! Redefine the coordinates just for safety
|
---|
104 | yold(i)=yat(i)!
|
---|
105 | zold(i)=zat(i)!
|
---|
106 | pol(i)=rvdw(i)*rvdw(i)!The water radius is already added in 'main'
|
---|
107 | As(i)=pi4*pol(i)! Initially the whole surface of the atom is accessible.
|
---|
108 | end do
|
---|
109 |
|
---|
110 | do iii=1,numat
|
---|
111 | do jjj=1,numat
|
---|
112 | grad(iii,jjj,1)=0.d0
|
---|
113 | grad(iii,jjj,2)=0.d0
|
---|
114 | grad(iii,jjj,3)=0.d0
|
---|
115 | enddo
|
---|
116 | enddo
|
---|
117 |
|
---|
118 | !***************************
|
---|
119 | ! Start the computations *
|
---|
120 | !***************************
|
---|
121 |
|
---|
122 | do 1 i=1,numat ! Lop over atoms "i"
|
---|
123 | ! ----------------------------------------------------
|
---|
124 |
|
---|
125 | R=rvdw(i)
|
---|
126 | jj=0
|
---|
127 | do j=1,numat !Find the neighbours of "i"
|
---|
128 | if(i.ne.j) then
|
---|
129 | ddp=(xold(j)-xold(i))**2+(yold(j)-yold(i))**2
|
---|
130 | & +(zold(j)-zold(i))**2! Distance between atom i and j
|
---|
131 | if(ddp.lt.1e-10) then
|
---|
132 | write(*,*)'ERROR in data: centres of two atoms coincide!'
|
---|
133 | write(*,*)i,j,xold(i),yold(i),zold(i),rvdw(i),
|
---|
134 | & xold(j),yold(j),zold(j),rvdw(j)
|
---|
135 | stop 'Centres of atoms coincide!'
|
---|
136 | endif
|
---|
137 | ddp=dsqrt(ddp)
|
---|
138 | if(ddp+R.le.rvdw(j)) then! Atom "i" is enclosed within "j"
|
---|
139 | As(i)=0.d0 ! no accessible surface
|
---|
140 | goto 1
|
---|
141 | endif
|
---|
142 | if(.not.(ddp.le.R-rvdw(j).or.ddp.ge.R+rvdw(j))) then
|
---|
143 | jj=jj+1 ! The next neighbour of ith atom
|
---|
144 | neib(jj)=j ! and its order number
|
---|
145 | endif
|
---|
146 | end if
|
---|
147 | end do!Neighbours
|
---|
148 |
|
---|
149 | neib(0)=jj ! The number of neighbors of "i"
|
---|
150 |
|
---|
151 | if(neib(0).eq.0) goto 1 !Finish the atom i if it doesn't have neighbors
|
---|
152 |
|
---|
153 | !----
|
---|
154 | R2=R*R ! R square
|
---|
155 | R22=R2+R2 ! 2 * R square
|
---|
156 | R42=R22+R22 ! 4 * R square
|
---|
157 | R22p=R22*pi ! 2 pi R square
|
---|
158 | R42p=R22p+R22p ! 4 pi R square
|
---|
159 |
|
---|
160 | do j=1,neib(0)
|
---|
161 | k=neib(j)
|
---|
162 | ddat(k,2)=xold(k)-xold(i)
|
---|
163 | ddat(k,3)=yold(k)-yold(i)
|
---|
164 | ddat(k,4)=zold(k)-zold(i)
|
---|
165 | ddat(k,1)=rvdw(k)
|
---|
166 | enddo
|
---|
167 | ddat(i,2)=0d0
|
---|
168 | ddat(i,3)=0d0
|
---|
169 | ddat(i,4)=0d0
|
---|
170 | ddat(i,1)=R
|
---|
171 | !
|
---|
172 | ! Verification of the north point of ith sphere
|
---|
173 | !
|
---|
174 | jjj=0
|
---|
175 | !
|
---|
176 | ! If jjj=0 then - no transformation
|
---|
177 | ! else the transformation is necessary
|
---|
178 | !
|
---|
179 | k=neib(1) ! The order number of the first neighbour
|
---|
180 | ! ddp - the square minimal distance of NP from the neighboring surfaces
|
---|
181 | ddp=dabs((ddat(k,2))**2+(ddat(k,3))**2+
|
---|
182 | & (R-ddat(k,4))**2-pol(k))
|
---|
183 |
|
---|
184 | do j=2,neib(0)
|
---|
185 | k=neib(j)
|
---|
186 | ddp2=dabs((ddat(k,2))**2+(ddat(k,3))**2+
|
---|
187 | & (R-ddat(k,4))**2-pol(k))
|
---|
188 | if(ddp2.lt.ddp) ddp=ddp2
|
---|
189 | enddo
|
---|
190 | !
|
---|
191 | ! Check whether the NP of ith sphere is too close to the intersection line
|
---|
192 | !
|
---|
193 | do while (ddp.lt.1.d-6)
|
---|
194 | jjj=jjj+1
|
---|
195 | !
|
---|
196 | ! generate grndom numbers
|
---|
197 | !
|
---|
198 | uga=grnd() ! Random \gamma angle
|
---|
199 | ufi=grnd() ! Random \pi angle
|
---|
200 | uga=pi*uga/2
|
---|
201 | ufi=pi*ufi/2
|
---|
202 | cf=dcos(ufi)
|
---|
203 | sf=dsin(ufi)
|
---|
204 | cg=dcos(uga)
|
---|
205 | sg=dsin(uga)
|
---|
206 | cfsg=cf*sg
|
---|
207 | cfcg=cf*cg
|
---|
208 | xx=R*cfsg
|
---|
209 | yy=R*sf
|
---|
210 | zz=R*cfcg
|
---|
211 | k=neib(1)
|
---|
212 | ddp=dabs((xx-ddat(k,2))**2+(yy-ddat(k,3))**2+
|
---|
213 | & (zz-ddat(k,4))**2-pol(k))
|
---|
214 | do j=2,neib(0)
|
---|
215 | k=neib(j)
|
---|
216 | ddp2=dabs((xx-ddat(k,2))**2+(yy-ddat(k,3))**2+
|
---|
217 | & (zz-ddat(k,4))**2-pol(k))
|
---|
218 | if(ddp2.lt.ddp) ddp=ddp2
|
---|
219 | end do
|
---|
220 | end do
|
---|
221 | !
|
---|
222 |
|
---|
223 | if(jjj.ne.0) then ! Rotation is necessary
|
---|
224 | sfsg=sf*sg
|
---|
225 | sfcg=sf*cg
|
---|
226 | do j=1,neib(0)
|
---|
227 | k=neib(j)
|
---|
228 | xx=ddat(k,2)
|
---|
229 | yy=ddat(k,3)
|
---|
230 | zz=ddat(k,4)
|
---|
231 | ddat(k,2)=xx*cg-zz*sg ! (x) Coordinates
|
---|
232 | ddat(k,3)=-xx*sfsg+yy*cf-zz*sfcg ! (y) after
|
---|
233 | ddat(k,4)=xx*cfsg+yy*sf+zz*cfcg ! (z) rotation
|
---|
234 | enddo
|
---|
235 | endif
|
---|
236 |
|
---|
237 | ! iiiiiiiiiii
|
---|
238 |
|
---|
239 | pom=8.d0*pol(i)
|
---|
240 |
|
---|
241 | ! In this loop the parameters a,b,c,d for the equation
|
---|
242 | ! a*(t^2+s^2)+b*t+c*s+d=0 are calculated (see the reference article)
|
---|
243 | do jj=1,neib(0)
|
---|
244 | j=neib(jj)
|
---|
245 | neibor(j,1)=(ddat(j,2))**2+(ddat(j,3))**2+
|
---|
246 | & (ddat(j,4)-R)**2-pol(j) ! a
|
---|
247 | neibor(j,2)=-pom*ddat(j,2) ! b
|
---|
248 | neibor(j,3)=-pom*ddat(j,3) ! c
|
---|
249 | neibor(j,4)=4d0*pol(i)*((ddat(j,2))**2+
|
---|
250 | & (ddat(j,3))**2+(R+ddat(j,4))**2-pol(j)) ! d
|
---|
251 | enddo
|
---|
252 |
|
---|
253 | ! end of the 1st cleaning
|
---|
254 |
|
---|
255 | iv=0
|
---|
256 |
|
---|
257 | nb=neib(0)
|
---|
258 | k=neib(0)
|
---|
259 | do while(k.gt.1) ! B
|
---|
260 | k=k-1
|
---|
261 | ! Analyse mutual disposition of every pair of neighbours
|
---|
262 | do 13 L=neib(0),k+1,-1 ! A
|
---|
263 |
|
---|
264 | if(neibor(neib(k),1).gt.0d0.and.neibor(neib(L),1).gt.0d0) then ! 03 a01
|
---|
265 |
|
---|
266 | b1=neibor(neib(k),2)/neibor(neib(k),1)
|
---|
267 | c1=neibor(neib(k),3)/neibor(neib(k),1)
|
---|
268 | d1=neibor(neib(k),4)/neibor(neib(k),1)
|
---|
269 | b2=neibor(neib(L),2)/neibor(neib(L),1)
|
---|
270 | c2=neibor(neib(L),3)/neibor(neib(L),1)
|
---|
271 | d2=neibor(neib(L),4)/neibor(neib(L),1)
|
---|
272 | D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
|
---|
273 | & (d1-d2)**2)+(b1*c2-b2*c1)**2
|
---|
274 | ! if D<0 then the circles neib(k) and neib(L) don't intersect
|
---|
275 | if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a01 01
|
---|
276 | & dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 04
|
---|
277 | ! Circle neib(L) encloses circle neib(k) and the later is discarded
|
---|
278 | neib(0)=neib(0)-1
|
---|
279 | do j=k,neib(0)
|
---|
280 | neib(j)=neib(j+1)
|
---|
281 | enddo
|
---|
282 | goto 12
|
---|
283 | elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a01 02
|
---|
284 | & -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
|
---|
285 | ! The circle neib(k) encloses circle neib(L) and the later is discarded
|
---|
286 | neib(0)=neib(0)-1
|
---|
287 | do j=L,neib(0)
|
---|
288 | neib(j)=neib(j+1)
|
---|
289 | enddo
|
---|
290 | elseif(D.gt.0d0) then ! a01 03
|
---|
291 | ! The circles nieb(L) and neib(k) have two intersection points (IP)
|
---|
292 | am=2d0*((b1-b2)**2+(c1-c2)**2)
|
---|
293 | t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
|
---|
294 | s=-2d0*(c1-c2)*(d1-d2)+(b2*c1-b1*c2)*(b1-b2)
|
---|
295 | iv=iv+1
|
---|
296 | pom=dsqrt(D)
|
---|
297 | p1=(c1-c2)*pom
|
---|
298 | p2=(b1-b2)*pom
|
---|
299 | vertex(iv,1)=(t+p1)/am ! t coordinate of the first IP
|
---|
300 | vertex(iv,2)=(s-p2)/am ! s coordinate of the first IP
|
---|
301 | vertex(iv,3)=neib(k) ! the order number of the first circle
|
---|
302 | vertex(iv,4)=neib(L) ! the order number of the second circle
|
---|
303 | iv=iv+1
|
---|
304 | vertex(iv,1)=(t-p1)/am ! t coordinate of the second IP
|
---|
305 | vertex(iv,2)=(s+p2)/am ! s coordinate of the second IP
|
---|
306 | vertex(iv,3)=neib(k) ! the order number of the first circle
|
---|
307 | vertex(iv,4)=neib(L) ! the order number of the second circle
|
---|
308 | endif ! 04
|
---|
309 |
|
---|
310 | elseif(neibor(neib(k),1).gt.0d0.and. ! a03
|
---|
311 | & neibor(neib(L),1).lt.0d0) then
|
---|
312 | b1=neibor(neib(k),2)/neibor(neib(k),1)
|
---|
313 | c1=neibor(neib(k),3)/neibor(neib(k),1)
|
---|
314 | d1=neibor(neib(k),4)/neibor(neib(k),1)
|
---|
315 | b2=neibor(neib(L),2)/neibor(neib(L),1)
|
---|
316 | c2=neibor(neib(L),3)/neibor(neib(L),1)
|
---|
317 | d2=neibor(neib(L),4)/neibor(neib(L),1)
|
---|
318 | D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
|
---|
319 | & (d1-d2)**2)+(b1*c2-b2*c1)**2
|
---|
320 | ! if D<0 then neib(k) and neib(L) don't intersect
|
---|
321 | if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a03 01
|
---|
322 | & -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 06
|
---|
323 | ! Neighbours neib(k) and neib(L) cover fully the atom "i" and as(i)=0
|
---|
324 | As(i)=0.d0
|
---|
325 | goto 11
|
---|
326 | elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).ge. ! a03 02
|
---|
327 | & dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
|
---|
328 | ! Don't exclude neib(k)
|
---|
329 | neib(0)=neib(0)-1
|
---|
330 | do j=k,neib(0)
|
---|
331 | neib(j)=neib(j+1)
|
---|
332 | enddo
|
---|
333 | goto 12
|
---|
334 | elseif(D.gt.0.d0) then ! a03 03
|
---|
335 | ! Circles neib(L) and neib(k) have two intersection points.
|
---|
336 | am=2d0*((b1-b2)**2+(c1-c2)**2)
|
---|
337 | t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
|
---|
338 | s=-2d0*(c1-c2)*(d1-d2)+(b2*c1-b1*c2)*(b1-b2)
|
---|
339 | iv=iv+1
|
---|
340 | pom=dsqrt(D)
|
---|
341 | p1=(c1-c2)*pom
|
---|
342 | p2=(b1-b2)*pom
|
---|
343 | vertex(iv,1)=(t+p1)/am ! t coordinate of the first IP
|
---|
344 | vertex(iv,2)=(s-p2)/am ! s coordinate of the first IP
|
---|
345 | vertex(iv,3)=neib(k) ! order number of the first circle
|
---|
346 | vertex(iv,4)=neib(L) ! order number of the second circle
|
---|
347 | iv=iv+1
|
---|
348 | vertex(iv,1)=(t-p1)/am ! t coordinate of the second IP
|
---|
349 | vertex(iv,2)=(s+p2)/am ! s coordinate of the second IP
|
---|
350 | vertex(iv,3)=neib(k) ! order number of the first circle
|
---|
351 | vertex(iv,4)=neib(L) ! order number of the second circle
|
---|
352 | endif ! 06
|
---|
353 |
|
---|
354 | elseif(neibor(neib(k),1).lt.0d0.and.neibor(neib(L),1).gt.0d0)! a07
|
---|
355 | & then
|
---|
356 | b1=neibor(neib(k),2)/neibor(neib(k),1)
|
---|
357 | c1=neibor(neib(k),3)/neibor(neib(k),1)
|
---|
358 | d1=neibor(neib(k),4)/neibor(neib(k),1)
|
---|
359 | b2=neibor(neib(L),2)/neibor(neib(L),1)
|
---|
360 | c2=neibor(neib(L),3)/neibor(neib(L),1)
|
---|
361 | d2=neibor(neib(L),4)/neibor(neib(L),1)
|
---|
362 | D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
|
---|
363 | & (d1-d2)**2)+(b1*c2-b2*c1)**2
|
---|
364 | ! If D<0 then the circles neib(k) and neib(L) don't intersect
|
---|
365 | if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a07 01
|
---|
366 | & dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 10
|
---|
367 | ! atom "i" is covered fully by neib(k) and neib(L) and as(i)=0.
|
---|
368 | As(i)=0.d0
|
---|
369 | goto 12
|
---|
370 | elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).ge. ! a07 02
|
---|
371 | & dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
|
---|
372 | ! discard the circle neib(L)
|
---|
373 | neib(0)=neib(0)-1
|
---|
374 | do j=L,neib(0)
|
---|
375 | neib(j)=neib(j+1)
|
---|
376 | enddo
|
---|
377 | elseif(D.gt.0d0) then ! a07 03
|
---|
378 | ! There are two IP's between neib(k) and neib(L).
|
---|
379 | am=2d0*((b1-b2)**2+(c1-c2)**2)
|
---|
380 | t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
|
---|
381 | s=-2d0*(c1-c2)*(d1-d2)+(b2*c1-b1*c2)*(b1-b2)
|
---|
382 | iv=iv+1
|
---|
383 | pom=dsqrt(D)
|
---|
384 | p1=(c1-c2)*pom
|
---|
385 | p2=(b1-b2)*pom
|
---|
386 | !-- Assign t and s coordinates and the order number of circles
|
---|
387 | vertex(iv,1)=(t+p1)/am
|
---|
388 | vertex(iv,2)=(s-p2)/am
|
---|
389 | vertex(iv,3)=neib(k)
|
---|
390 | vertex(iv,4)=neib(L)
|
---|
391 | iv=iv+1
|
---|
392 | vertex(iv,1)=(t-p1)/am
|
---|
393 | vertex(iv,2)=(s+p2)/am
|
---|
394 | vertex(iv,3)=neib(k)
|
---|
395 | vertex(iv,4)=neib(L)
|
---|
396 | !--
|
---|
397 | endif ! 10
|
---|
398 |
|
---|
399 | elseif(neibor(neib(k),1).lt.0d0.and.neibor(neib(L),1).lt.0d0) ! a09
|
---|
400 | & then
|
---|
401 | b1=neibor(neib(k),2)/neibor(neib(k),1)
|
---|
402 | c1=neibor(neib(k),3)/neibor(neib(k),1)
|
---|
403 | d1=neibor(neib(k),4)/neibor(neib(k),1)
|
---|
404 | b2=neibor(neib(L),2)/neibor(neib(L),1)
|
---|
405 | c2=neibor(neib(L),3)/neibor(neib(L),1)
|
---|
406 | d2=neibor(neib(L),4)/neibor(neib(L),1)
|
---|
407 | D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
|
---|
408 | & (d1-d2)**2)+(b1*c2-b2*c1)**2
|
---|
409 | ! D<0 - no intersection poit between neib(k) and neib(L)
|
---|
410 | if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.
|
---|
411 | & dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then!12 ! a09 01
|
---|
412 | ! omit the circle neib(L)
|
---|
413 | neib(0)=neib(0)-1
|
---|
414 | do j=L,neib(0)
|
---|
415 | neib(j)=neib(j+1)
|
---|
416 | enddo
|
---|
417 | elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a09 02
|
---|
418 | & -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
|
---|
419 | ! Omit the circle neib(k)
|
---|
420 | neib(0)=neib(0)-1
|
---|
421 | do j=k,neib(0)
|
---|
422 | neib(j)=neib(j+1)
|
---|
423 | enddo
|
---|
424 | goto 12
|
---|
425 | elseif(D.le.0.d0) then ! a09 03
|
---|
426 | ! The whole surface of atom "i" is covered fully, and as(i)=0.
|
---|
427 | As(i)=0.d0
|
---|
428 | goto 11
|
---|
429 | else ! a09 04
|
---|
430 | ! Two intersection points
|
---|
431 | am=2.d0*((b1-b2)**2+(c1-c2)**2)
|
---|
432 | t=-2.d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
|
---|
433 | s=-2.d0*(c1-c2)*(d1-d2)+(b2*c1-b1*c2)*(b1-b2)
|
---|
434 | iv=iv+1
|
---|
435 | pom=dsqrt(D)
|
---|
436 | p1=(c1-c2)*pom
|
---|
437 | p2=(b1-b2)*pom
|
---|
438 | ! Assign the t and s coordinates and order numbers of the circles
|
---|
439 | vertex(iv,1)=(t+p1)/am
|
---|
440 | vertex(iv,2)=(s-p2)/am
|
---|
441 | vertex(iv,3)=neib(k)
|
---|
442 | vertex(iv,4)=neib(L)
|
---|
443 | iv=iv+1
|
---|
444 | vertex(iv,1)=(t-p1)/am
|
---|
445 | vertex(iv,2)=(s+p2)/am
|
---|
446 | vertex(iv,3)=neib(k)
|
---|
447 | vertex(iv,4)=neib(L)
|
---|
448 | endif ! 12
|
---|
449 |
|
---|
450 | endif ! 03
|
---|
451 | 13 continue
|
---|
452 | 12 continue ! A
|
---|
453 | enddo ! B
|
---|
454 |
|
---|
455 | ita2=0
|
---|
456 | ita3=0
|
---|
457 | do j=1,neib(0)
|
---|
458 | if(neibor(neib(j),1).eq.0.d0) then
|
---|
459 | ! Collect the lines (after rotation it is empty).
|
---|
460 | ita2=ita2+1
|
---|
461 | ta2(ita2)=j
|
---|
462 | endif
|
---|
463 | if(neibor(neib(j),1).lt.0.d0) then
|
---|
464 | ! Collect the neighbours with inner part
|
---|
465 | ita3=ita3+1
|
---|
466 | ta3(ita3)=j
|
---|
467 | endif
|
---|
468 | enddo
|
---|
469 |
|
---|
470 | !*** Consider to remove this part.
|
---|
471 | if(ita2.gt.0.and.ita3.lt.1) then
|
---|
472 | As(i)=R22p
|
---|
473 | if(ita2.gt.1) then
|
---|
474 | amial=pi
|
---|
475 | amaal=-pi
|
---|
476 | amibe=pi
|
---|
477 | amabe=-pi
|
---|
478 | do j=1,ita2
|
---|
479 | jj=ta2(j)
|
---|
480 | p1=neibor(neib(jj),3)
|
---|
481 | p2=neibor(neib(jj),2)
|
---|
482 | alp=datan2(p1,p2)
|
---|
483 | bet=alp
|
---|
484 | if(alp.le.0d0) bet=bet+pi2
|
---|
485 | if(amial.gt.alp) amial=alp
|
---|
486 | if(amaal.lt.alp) amaal=alp
|
---|
487 | if(amibe.gt.bet) amibe=bet
|
---|
488 | if(amabe.lt.bet) amabe=bet
|
---|
489 | enddo
|
---|
490 | dal=amaal-amial
|
---|
491 | dbe=amabe-amibe
|
---|
492 | if(dal.lt.pi) then
|
---|
493 | As(i)=R22*(pi-dal)
|
---|
494 | elseif(dbe.lt.pi) then
|
---|
495 | As(i)=R22*(pi-dbe)
|
---|
496 | else
|
---|
497 | As(i)=0d0
|
---|
498 | endif
|
---|
499 | endif
|
---|
500 | elseif((nb.gt.0.and.neib(0).lt.1).or.ita3.gt.0) then
|
---|
501 | As(i)=0d0
|
---|
502 | endif
|
---|
503 | !****** End of could-be-removed part
|
---|
504 |
|
---|
505 | neibp(0)=neib(0)
|
---|
506 | ifu=0 ! Full arcs (without intersection points).
|
---|
507 | ine=0 ! Circles with intersection points.
|
---|
508 | do j=1,neib(0)
|
---|
509 | neibp(j)=neib(j)
|
---|
510 | enddo
|
---|
511 | do j=1,neib(0)
|
---|
512 | ! "iv" is the number of intersection point.
|
---|
513 | do k=1,iv
|
---|
514 | if(neibp(j).eq.vertex(k,3).or.neibp(j).eq.vertex(k,4)) goto 30
|
---|
515 | enddo
|
---|
516 | ifu=ifu+1
|
---|
517 | ! Arrays with the ordering numbers of full arcs.
|
---|
518 | fullarc(ifu)=neibp(j)
|
---|
519 | al(ifu)=neibp(j)
|
---|
520 | goto 31
|
---|
521 | 30 continue
|
---|
522 | ine=ine+1
|
---|
523 | neib(ine)=neibp(j) !Array containing the intersection points.
|
---|
524 | 31 continue
|
---|
525 |
|
---|
526 | enddo
|
---|
527 | neib(0)=ine ! Number of IP.
|
---|
528 | fullarc(0)=ifu ! Number of full arcs.
|
---|
529 | al(0)=ifu
|
---|
530 |
|
---|
531 | ! Loop over full arcs.
|
---|
532 | do k=1,ifu
|
---|
533 | a=neibor(fullarc(k),1)
|
---|
534 | if(a.lt.0.d0) then
|
---|
535 | aia=-1.d0
|
---|
536 | else
|
---|
537 | aia=1.d0
|
---|
538 | endif
|
---|
539 | b=neibor(fullarc(k),2)
|
---|
540 | c=neibor(fullarc(k),3)
|
---|
541 | d=neibor(fullarc(k),4)
|
---|
542 | if(a.ne.0d0) then !True if rotation has taken place.
|
---|
543 | ! Remove the part of the atomic surface covered cut by this full arc
|
---|
544 | As(i)=As(i)-aia*R22p*(1d0+(-d/a-R42)*dabs(a)/dsqrt((R42*a-
|
---|
545 | & d)**2+R42*(b*b+c*c)))
|
---|
546 | dadx(1,1)=2d0*ddat(fullarc(k),2)
|
---|
547 | dadx(1,2)=2d0*ddat(fullarc(k),3)
|
---|
548 | dadx(1,3)=2d0*(ddat(fullarc(k),4)-R)
|
---|
549 | dadx(2,1)=-8d0*pol(i)
|
---|
550 | dadx(2,2)=0d0
|
---|
551 | dadx(2,3)=0d0
|
---|
552 | dadx(3,1)=0d0
|
---|
553 | dadx(3,2)=dadx(2,1)
|
---|
554 | dadx(3,3)=0d0
|
---|
555 | dadx(4,1)=8d0*pol(i)*ddat(fullarc(k),2)
|
---|
556 | dadx(4,2)=8d0*pol(i)*ddat(fullarc(k),3)
|
---|
557 | dadx(4,3)=8d0*pol(i)*(ddat(fullarc(k),4)+R)
|
---|
558 | div=R22*R42p/((R42*a-d)**2+R42*(b*b+c*c))**(1.5)
|
---|
559 | gp(1)=(R42*(b*b+c*c-2d0*a*d)+2d0*d*d)*div
|
---|
560 | gp(2)=-b*(d+R42*a)*div
|
---|
561 | gp(3)=-c*(d+R42*a)*div
|
---|
562 | gp(4)=(b*b+c*c-2d0*a*d+(R42+R42)*a*a)*div
|
---|
563 | grad(i,fullarc(k),1)=gp(1)*dadx(1,1)+gp(2)*dadx(2,1)+
|
---|
564 | & gp(3)*dadx(3,1)+gp(4)*dadx(4,1)
|
---|
565 | grad(i,fullarc(k),2)=gp(1)*dadx(1,2)+gp(2)*dadx(2,2)+
|
---|
566 | & gp(3)*dadx(3,2)+gp(4)*dadx(4,2)
|
---|
567 | grad(i,fullarc(k),3)=gp(1)*dadx(1,3)+gp(2)*dadx(2,3)+
|
---|
568 | & gp(3)*dadx(3,3)+gp(4)*dadx(4,3)
|
---|
569 |
|
---|
570 | else
|
---|
571 | As(i)=As(i)+R22p*d/dsqrt(R42*(b*b+c*c)+d*d)
|
---|
572 | endif
|
---|
573 | enddo
|
---|
574 |
|
---|
575 | ! Loop over the circles with intersection points.
|
---|
576 | do k=1,ine
|
---|
577 | jk=neib(k) ! The order number of kth neighbour.
|
---|
578 | a=neibor(jk,1) ! a>0 - outer part, a<0-inner part
|
---|
579 | ak=a*a
|
---|
580 | daba=dabs(a)
|
---|
581 | if(a.lt.0d0) then
|
---|
582 | aia=-1d0
|
---|
583 | else
|
---|
584 | aia=1d0
|
---|
585 | endif
|
---|
586 | b=neibor(jk,2)
|
---|
587 | c=neibor(jk,3)
|
---|
588 | d=neibor(jk,4)
|
---|
589 | b2c2=b*b+c*c
|
---|
590 | vv=dsqrt((R42*a-d)**2+R42*b2c2)
|
---|
591 | vv1=1d0/vv
|
---|
592 | vv2=vv1*vv1
|
---|
593 | wv=dsqrt(b2c2-4d0*a*d)
|
---|
594 | nyx=0 ! The number of IP's which lie on this circle.
|
---|
595 | ivr=0
|
---|
596 | do j=1,iv
|
---|
597 | if(vertex(j,3).eq.jk) then
|
---|
598 | nyx=nyx+1
|
---|
599 | ayx(nyx,1)=vertex(j,1) ! t coordinate of IP
|
---|
600 | ayx(nyx,2)=vertex(j,2) ! s coordinate
|
---|
601 | ivr=ivr+1
|
---|
602 | ivrx(ivr)=j
|
---|
603 | endif
|
---|
604 | if(vertex(j,4).eq.jk) then
|
---|
605 | nyx=nyx+1
|
---|
606 | ayx(nyx,1)=vertex(j,1) ! t coordinate
|
---|
607 | ayx(nyx,2)=vertex(j,2) ! s coordinate
|
---|
608 | aa=vertex(j,3)
|
---|
609 | vertex(j,3)=vertex(j,4)! make the fixed ordering number as the third
|
---|
610 | vertex(j,4)=aa ! component in vertex if it was the 4th.
|
---|
611 | ivr=ivr+1
|
---|
612 | ivrx(ivr)=j
|
---|
613 | endif
|
---|
614 | enddo
|
---|
615 |
|
---|
616 | ial=ifu
|
---|
617 | do j=1,ine
|
---|
618 | if(neib(j).ne.jk) then
|
---|
619 | ial=ial+1
|
---|
620 | al(ial)=neib(j) ! Add other neighbours with IP's to this array
|
---|
621 | endif
|
---|
622 | enddo
|
---|
623 | al(0)=ial ! The number of all "active" circles.
|
---|
624 |
|
---|
625 | if(a.ne.0.d0) then ! True after rotation
|
---|
626 | aa=0.5d0/a
|
---|
627 | ba=b*aa
|
---|
628 | ca=c*aa
|
---|
629 | bcd=b2c2-2d0*a*d
|
---|
630 | xv=(d+R42*a)*vv1
|
---|
631 | yv=(bcd+2d0*R42*ak)/daba*vv1
|
---|
632 | zv=wv/a*vv1
|
---|
633 | ! Move the (t,s) origo into the centre of this circle.
|
---|
634 | ! Modify t and s coordinates of IP.
|
---|
635 | do j=1,nyx
|
---|
636 | ayx(j,1)=ayx(j,1)+ba ! t
|
---|
637 | ayx(j,2)=ayx(j,2)+ca ! s
|
---|
638 | enddo
|
---|
639 |
|
---|
640 | ct=-ba
|
---|
641 | cs=-ca
|
---|
642 | rr=0.5d0*wv/daba
|
---|
643 | ! Calculate the polar angle of IP.
|
---|
644 | do j=1,nyx
|
---|
645 | ayx1(j)=datan2(ayx(j,2),ayx(j,1))
|
---|
646 | enddo
|
---|
647 | ! Sort the angles in ascending order.
|
---|
648 | do j=1,nyx-1
|
---|
649 | a1=ayx1(j)
|
---|
650 | jj=j
|
---|
651 | do ij=j+1,nyx
|
---|
652 | if(a1.gt.ayx1(ij)) then
|
---|
653 | a1=ayx1(ij)
|
---|
654 | jj=ij
|
---|
655 | endif
|
---|
656 | enddo
|
---|
657 | if(jj.ne.j) then
|
---|
658 | a1=ayx1(jj)
|
---|
659 | ayx1(jj)=ayx1(j)
|
---|
660 | ayx1(j)=a1
|
---|
661 | ivr=ivrx(jj)
|
---|
662 | ivrx(jj)=ivrx(j)
|
---|
663 | ivrx(j)=ivr
|
---|
664 | endif
|
---|
665 | enddo
|
---|
666 |
|
---|
667 | ayx1(nyx+1)=ayx1(1)+pi2
|
---|
668 |
|
---|
669 | do j=1,nyx
|
---|
670 | do jkk=1,4
|
---|
671 | vrx(j,jkk)=vertex(ivrx(j),jkk) ! vrx-helping array
|
---|
672 | enddo
|
---|
673 | enddo
|
---|
674 |
|
---|
675 | do jkk=1,4
|
---|
676 | vrx(nyx+1,jkk)=vrx(1,jkk)
|
---|
677 | enddo
|
---|
678 |
|
---|
679 | do j=1,nyx
|
---|
680 |
|
---|
681 | !
|
---|
682 | ! Escape 'bad' intersections.
|
---|
683 | if(dabs(ayx1(j+1)-ayx1(j)).lt.1d-8) goto 40
|
---|
684 |
|
---|
685 | prob=(ayx1(j)+ayx1(j+1))/2.d0
|
---|
686 | ap1=ct+rr*dcos(prob) ! The middle point of the arc.
|
---|
687 | ap2=cs+rr*dsin(prob)
|
---|
688 | ! Verify if the middle point belongs to a covered part.
|
---|
689 | ! If yes then omit.
|
---|
690 | do ij=1,ial
|
---|
691 | if(neibor(al(ij),1)*(ap1*ap1+ap2*ap2)+neibor(al(ij),2)*ap1+
|
---|
692 | & neibor(al(ij),3)*ap2+neibor(al(ij),4).lt.0d0) goto 40
|
---|
693 | enddo
|
---|
694 | alp=ayx1(j)
|
---|
695 | bet=ayx1(j+1)
|
---|
696 | dsalp=dsin(alp)
|
---|
697 | dcalp=dcos(alp)
|
---|
698 | dsbet=dsin(bet)
|
---|
699 | dcbet=dcos(bet)
|
---|
700 | dcbetmalp=dcos(5d-1*(bet-alp))
|
---|
701 | dcbetpalp=dcos(5d-1*(bet+alp))
|
---|
702 | dsbetmalp=dsin(5d-1*(bet-alp))
|
---|
703 | dsbetpalp=dsin(5d-1*(bet+alp))
|
---|
704 | dcotbma=1.d0/dtan(5d-1*(bet-alp))
|
---|
705 | uv=daba*(bcd+2d0*R42*ak)*dcbetmalp
|
---|
706 | & -a*dsqrt(b2c2-4d0*a*d)*(b*dcbetpalp+c*dsbetpalp)
|
---|
707 | As(i)=As(i)+R2*(aia*(alp-bet)+(d+R42*a)*vv1*(pi-2d0*
|
---|
708 | & datan(uv/(2d0*ak*vv*dsbetmalp))))
|
---|
709 | kk=vrx(j,4)
|
---|
710 | LL=vrx(j+1,4)
|
---|
711 | tt=yv*dcotbma-zv*(b*dcbetpalp+c*dsbetpalp)/dsbetmalp
|
---|
712 | a1=neibor(kk,1)
|
---|
713 | b1=neibor(kk,2)
|
---|
714 | c1=neibor(kk,3)
|
---|
715 | d1=neibor(kk,4)
|
---|
716 | a2=neibor(LL,1)
|
---|
717 | b2=neibor(LL,2)
|
---|
718 | c2=neibor(LL,3)
|
---|
719 | d2=neibor(LL,4)
|
---|
720 | ab1=a*b1-b*a1
|
---|
721 | ac1=a*c1-c*a1
|
---|
722 | ab2=a*b2-b*a2
|
---|
723 | ac2=a*c2-c*a2
|
---|
724 | am1=wv*aia*a1*(ab1*dsalp-ac1*dcalp)
|
---|
725 | am2=wv*aia*a2*(ab2*dsbet-ac2*dcbet)
|
---|
726 | dalp(1)=(b1*ab1+c1*ac1-2d0*d*a1*a1-a*
|
---|
727 | & (b1*b1+c1*c1-4d0*a1*d1)-2d0*d*aia*a1*(ab1*
|
---|
728 | & dcalp+ac1*dsalp)/wv+wv*aia*a1*
|
---|
729 | & (b1*dcalp+c1*dsalp))/am1
|
---|
730 | dalp(2)=(-a1*ab1+b*a1*a1+b*aia*a1*(ab1*
|
---|
731 | & dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dcalp)/am1
|
---|
732 | dalp(3)=(-a1*ac1+c*a1*a1+c*aia*a1*(ab1*
|
---|
733 | & dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dsalp)/am1
|
---|
734 | dalp(4)=(-2d0*a*a1*a1-2d0*daba*a1*(ab1*
|
---|
735 | & dcalp+ac1*dsalp)/wv)/am1
|
---|
736 | dbet(1)=(b2*ab2+c2*ac2-2d0*d*a2*a2-a*
|
---|
737 | & (b2*b2+c2*c2-4d0*a2*d2)-2d0*d*aia*a2*(ab2*
|
---|
738 | & dcbet+ac2*dsbet)/wv+wv*aia*a2*
|
---|
739 | & (b2*dcbet+c2*dsbet))/am2
|
---|
740 | dbet(2)=(-a2*ab2+b*a2*a2+b*aia*a2*(ab2*
|
---|
741 | & dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dcbet)/am2
|
---|
742 | dbet(3)=(-a2*ac2+c*a2*a2+c*aia*a2*(ab2*
|
---|
743 | & dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dsbet)/am2
|
---|
744 | dbet(4)=(-2d0*a*a2*a2-2d0*daba*a2*(ab2*
|
---|
745 | & dcbet+ac2*dsbet)/wv)/am2
|
---|
746 | daalp(1)=(-b*ab1-c*ac1+wv*wv*a1+2d0*ak*d1+
|
---|
747 | & wv*aia*((ab1-b*a1)*dcalp+(ac1-c*a1)*dsalp))/am1
|
---|
748 | daalp(2)=(a*ab1-ak*b1+wv*daba*a1*dcalp)/am1
|
---|
749 | daalp(3)=(a*ac1-ak*c1+wv*daba*a1*dsalp)/am1
|
---|
750 | daalp(4)=(2d0*ak*a1)/am1
|
---|
751 | dabet(1)=(-b*ab2-c*ac2+wv*wv*a2+2d0*ak*d2+
|
---|
752 | & wv*aia*((ab2-b*a2)*dcbet+(ac2-c*a2)*dsbet))/am2
|
---|
753 | dabet(2)=(a*ab2-ak*b2+wv*daba*a2*dcbet)/am2
|
---|
754 | dabet(3)=(a*ac2-ak*c2+wv*daba*a2*dsbet)/am2
|
---|
755 | dabet(4)=(2d0*ak*a2)/am2
|
---|
756 | dv(2)=R42*b*vv1
|
---|
757 | dv(3)=R42*c*vv1
|
---|
758 | dv(4)=(d-R42*a)*vv1
|
---|
759 | dv(1)=-dv(4)*R42
|
---|
760 | dx(1)=R42*vv1-(d+R42*a)*dv(1)*vv2
|
---|
761 | dx(2)=-(d+R42*a)*dv(2)*vv2
|
---|
762 | dx(3)=-(d+R42*a)*dv(3)*vv2
|
---|
763 | dx(4)=1d0*vv1-(d+R42*a)*dv(4)*vv2
|
---|
764 | dy(1)=(-2d0*d+4d0*R42*a)/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
|
---|
765 | & R42*ak)*(aia*vv+daba*dv(1))/ak*vv2
|
---|
766 | dy(2)=2d0*b/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
|
---|
767 | & R42*ak)*aia*dv(2)/a*vv2
|
---|
768 | dy(3)=2d0*c/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
|
---|
769 | & R42*ak)*aia*dv(3)/a*vv2
|
---|
770 | dy(4)=-2.d0*a/daba*vv1-(b*b+c*c-2.d0*a*d+2.d0*
|
---|
771 | & R42*ak)*aia*dv(4)/a*vv2
|
---|
772 | dz(1)=-2d0*d/wv/a*vv1-wv*(vv+a*dv(1))/ak*vv2
|
---|
773 | dz(2)=b/wv/a*vv1-wv*dv(2)/a*vv2
|
---|
774 | dz(3)=c/wv/a*vv1-wv*dv(3)/a*vv2
|
---|
775 | dz(4)=-2d0/wv*vv1-wv*dv(4)/a*vv2
|
---|
776 | dt(1)=dcotbma*dy(1)-5d-1*yv*
|
---|
777 | & (dbet(1)-dalp(1))/dsbetmalp**2-((b*dcbetpalp+
|
---|
778 | & c*dsbetpalp)/dsbetmalp)*dz(1)-
|
---|
779 | & 5d-1*zv*(((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp)*
|
---|
780 | & (dalp(1)+dbet(1))-((b*dcbetpalp+c*dsbetpalp)*
|
---|
781 | & dcbetmalp)*(dbet(1)-dalp(1)))/dsbetmalp**2
|
---|
782 | dt(2)=dcotbma*dy(2)-5d-1*yv*
|
---|
783 | & (dbet(2)-dalp(2))/dsbetmalp**2-(b*dcbetpalp+
|
---|
784 | & c*dsbetpalp)/dsbetmalp*dz(2)-
|
---|
785 | & 5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
|
---|
786 | & (dalp(2)+dbet(2))-(b*dcbetpalp+c*dsbetpalp)*
|
---|
787 | & dcbetmalp*(dbet(2)-dalp(2))+dcbetpalp
|
---|
788 | & *2d0*dsbetmalp)/dsbetmalp**2
|
---|
789 | dt(3)=dcotbma*dy(3)-5d-1*yv*
|
---|
790 | & (dbet(3)-dalp(3))/dsbetmalp**2-(b*dcbetpalp+
|
---|
791 | & c*dsbetpalp)/dsbetmalp*dz(3)-
|
---|
792 | & 5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
|
---|
793 | & (dalp(3)+dbet(3))-(b*dcbetpalp+c*dsbetpalp)*
|
---|
794 | & dcbetmalp*(dbet(3)-dalp(3))+dsbetpalp*2d0*
|
---|
795 | & dsbetmalp)/dsbetmalp**2
|
---|
796 | dt(4)=dcotbma*dy(4)-5d-1*yv*
|
---|
797 | & (dbet(4)-dalp(4))/dsbetmalp**2-(b*dcbetpalp+
|
---|
798 | & c*dsbetpalp)/dsbetmalp*dz(4)-
|
---|
799 | & 5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
|
---|
800 | & (dalp(4)+dbet(4))-(b*dcbetpalp+c*dsbetpalp)*
|
---|
801 | & dcbetmalp*(dbet(4)-dalp(4)))/dsbetmalp**2
|
---|
802 | di(1)=R2*(aia*(dalp(1)-dbet(1))+(pi-2d0*datan(5d-1*tt))*
|
---|
803 | & dx(1)-4d0*xv*dt(1)/(4d0+tt**2))
|
---|
804 | di(2)=R2*(aia*(dalp(2)-dbet(2))+(pi-2d0*datan(5d-1*tt))*
|
---|
805 | & dx(2)-4d0*xv*dt(2)/(4d0+tt**2))
|
---|
806 | di(3)=R2*(aia*(dalp(3)-dbet(3))+(pi-2d0*datan(5d-1*tt))*
|
---|
807 | & dx(3)-4d0*xv*dt(3)/(4d0+tt**2))
|
---|
808 | di(4)=R2*(aia*(dalp(4)-dbet(4))+(pi-2d0*datan(5d-1*tt))*
|
---|
809 | & dx(4)-4d0*xv*dt(4)/(4d0+tt**2))
|
---|
810 | dii(1,1)=2d0*ddat(jk,2)
|
---|
811 | dii(1,2)=2d0*ddat(jk,3)
|
---|
812 | dii(1,3)=2d0*(ddat(jk,4)-R)
|
---|
813 | dii(2,1)=-R42-R42
|
---|
814 | dii(2,2)=0d0
|
---|
815 | dii(2,3)=0d0
|
---|
816 | dii(3,1)=0d0
|
---|
817 | dii(3,2)=dii(2,1)
|
---|
818 | dii(3,3)=0d0
|
---|
819 | dii(4,1)=dii(1,1)*R42
|
---|
820 | dii(4,2)=dii(1,2)*R42
|
---|
821 | dii(4,3)=2d0*(ddat(jk,4)+R)*R42
|
---|
822 |
|
---|
823 | do idi=1,3
|
---|
824 | grad(i,jk,idi)=grad(i,jk,idi)+
|
---|
825 | & di(1)*dii(1,idi)+di(2)*dii(2,idi)+
|
---|
826 | & di(3)*dii(3,idi)+di(4)*dii(4,idi)
|
---|
827 |
|
---|
828 | enddo
|
---|
829 | do idi=1,4
|
---|
830 | dta(idi)=5d-1*daalp(idi)*(((yv-zv*((-b*dsbetpalp
|
---|
831 | & +c*dcbetpalp)*dsbetmalp+
|
---|
832 | & (b*dcbetpalp+c*dsbetpalp)*
|
---|
833 | & dcbetmalp))/dsbetmalp**2))
|
---|
834 | dtb(idi)=5d-1*dabet(idi)*(((-yv-zv*((-b*dsbetpalp
|
---|
835 | & +c*dcbetpalp)*dsbetmalp-
|
---|
836 | & (b*dcbetpalp+c*dsbetpalp)*
|
---|
837 | & dcbetmalp))/dsbetmalp**2))
|
---|
838 | di1(idi)=R2*(aia*daalp(idi)-4d0*xv*dta(idi)/(4d0+tt*tt))
|
---|
839 | di2(idi)=R2*(-aia*dabet(idi)-4d0*xv*dtb(idi)/(4d0+tt*tt))
|
---|
840 | enddo
|
---|
841 |
|
---|
842 | dii(1,1)=2d0*ddat(kk,2)
|
---|
843 | dii(1,2)=2d0*ddat(kk,3)
|
---|
844 | dii(1,3)=2d0*(ddat(kk,4)-R)
|
---|
845 | dii(4,1)=dii(1,1)*R42
|
---|
846 | dii(4,2)=dii(1,2)*R42
|
---|
847 | dii(4,3)=2d0*(ddat(kk,4)+R)*R42
|
---|
848 | do idi=1,3
|
---|
849 | grad(i,kk,idi)=grad(i,kk,idi)+
|
---|
850 | & di1(1)*dii(1,idi)+di1(2)*dii(2,idi)+
|
---|
851 | & di1(3)*dii(3,idi)+di1(4)*dii(4,idi)
|
---|
852 | enddo
|
---|
853 |
|
---|
854 | dii(1,1)=2d0*ddat(LL,2)
|
---|
855 | dii(1,2)=2d0*ddat(LL,3)
|
---|
856 | dii(1,3)=2d0*(ddat(LL,4)-R)
|
---|
857 | dii(4,1)=dii(1,1)*R42
|
---|
858 | dii(4,2)=dii(1,2)*R42
|
---|
859 | dii(4,3)=2d0*(ddat(LL,4)+R)*R42
|
---|
860 | do idi=1,3
|
---|
861 | grad(i,LL,idi)=grad(i,LL,idi)+
|
---|
862 | & di2(1)*dii(1,idi)+di2(2)*dii(2,idi)+
|
---|
863 | & di2(3)*dii(3,idi)+di2(4)*dii(4,idi)
|
---|
864 | enddo
|
---|
865 |
|
---|
866 | 40 continue
|
---|
867 | enddo
|
---|
868 |
|
---|
869 | else ! analyse the case with lines (not necessary after rotation).
|
---|
870 |
|
---|
871 | ang=datan2(b,c)
|
---|
872 | a1=dsin(ang)
|
---|
873 | a2=dcos(ang)
|
---|
874 | ! Rotate the intersection points by the angle "ang".
|
---|
875 | ! After rotation the position of IP will be defined
|
---|
876 | ! by its first coordinate "ax(.,1)".
|
---|
877 | do j=1,nyx
|
---|
878 | ax(j,1)=ayx(j,1)*a2-ayx(j,2)*a1
|
---|
879 | ax(j,2)=ayx(j,1)*a1+ayx(j,2)*a2
|
---|
880 | enddo
|
---|
881 | ! Sorting by acsending order.
|
---|
882 | do j=1,nyx-1
|
---|
883 | a1=ax(j,1)
|
---|
884 | jj=j
|
---|
885 | do L=j+1,nyx
|
---|
886 | if(a1.gt.ax(L,1)) then
|
---|
887 | a1=ax(L,1)
|
---|
888 | jj=L
|
---|
889 | endif
|
---|
890 | enddo
|
---|
891 | if(jj.ne.j) then
|
---|
892 | a1=ax(jj,1)
|
---|
893 | a2=ax(jj,2)
|
---|
894 | ax(jj,1)=ax(j,1)
|
---|
895 | ax(jj,2)=ax(j,2)
|
---|
896 | ax(j,1)=a1
|
---|
897 | ax(j,2)=a2
|
---|
898 | a1=ayx(jj,1)
|
---|
899 | a2=ayx(jj,2)
|
---|
900 | ayx(jj,1)=ayx(j,1)
|
---|
901 | ayx(jj,2)=ayx(j,2)
|
---|
902 | ayx(j,1)=a1
|
---|
903 | ayx(j,2)=a2
|
---|
904 | endif
|
---|
905 | enddo
|
---|
906 |
|
---|
907 | if(c.ne.0d0) then
|
---|
908 | do j=1,nyx
|
---|
909 | ayx1(j)=(ayx(j,1)-ayx(1,1))/c
|
---|
910 | enddo
|
---|
911 | else
|
---|
912 | do j=1,nyx
|
---|
913 | ayx1(j)=-(ayx(j,2)-ayx(1,2))/b
|
---|
914 | enddo
|
---|
915 | endif
|
---|
916 |
|
---|
917 | probe(1)=-1d0
|
---|
918 | do j=1,nyx-1
|
---|
919 | probe(j+1)=(ayx1(j)+ayx1(j+1))/2d0
|
---|
920 | enddo
|
---|
921 | probe(nyx+1)=ayx1(nyx)+1d0
|
---|
922 |
|
---|
923 |
|
---|
924 | bc=b*b+c*c
|
---|
925 | cc=dsqrt(R42*(bc)+d*d)
|
---|
926 | caba=c*ayx(1,1)-b*ayx(1,2)
|
---|
927 |
|
---|
928 | p1=ayx(1,1)+c*probe(1)
|
---|
929 | p2=ayx(1,2)-b*probe(1)
|
---|
930 | ! Verify if the middle point belongs to a covered part.
|
---|
931 | ! Omit, if yes.
|
---|
932 | do L=1,ial
|
---|
933 | if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
|
---|
934 | & neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 20
|
---|
935 | enddo
|
---|
936 | arg2=bc*ayx1(1)+caba
|
---|
937 | As(i)=As(i)+R22*d*(datan(arg2/cc)+pi/2d0)/cc
|
---|
938 | 20 continue
|
---|
939 |
|
---|
940 | do j=2,nyx
|
---|
941 | p1=ayx(1,1)+c*probe(j)
|
---|
942 | p2=ayx(1,2)-b*probe(j)
|
---|
943 | do L=1,ial
|
---|
944 | if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
|
---|
945 | & neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 21
|
---|
946 | enddo
|
---|
947 | arg1=bc*ayx1(j-1)+caba
|
---|
948 | arg2=bc*ayx1(j)+caba
|
---|
949 | As(i)=As(i)+R22*d*(datan(arg2/cc)-datan(arg1/cc))/cc
|
---|
950 | 21 continue
|
---|
951 | enddo
|
---|
952 | p1=ayx(1,1)+c*probe(nyx+1)
|
---|
953 | p2=ayx(1,2)-b*probe(nyx+1)
|
---|
954 | do L=1,ial
|
---|
955 | if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
|
---|
956 | & neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 22
|
---|
957 | enddo
|
---|
958 | arg1=bc*ayx1(nyx)+caba
|
---|
959 | As(i)=As(i)+R22*d*(pi/2d0-datan(arg1/cc))/cc
|
---|
960 | 22 continue
|
---|
961 | endif
|
---|
962 | enddo
|
---|
963 | 11 continue
|
---|
964 |
|
---|
965 | !
|
---|
966 | ! changed in 2004
|
---|
967 |
|
---|
968 | do j=1,ine
|
---|
969 | al(ifu+j)=neib(j)
|
---|
970 | enddo
|
---|
971 | al(0)=ifu+ine
|
---|
972 |
|
---|
973 | do k=1,3
|
---|
974 | ss(k)=0d0
|
---|
975 | do j2=1,al(0)
|
---|
976 | j=al(j2)
|
---|
977 | ss(k)=ss(k)+grad(i,j,k)
|
---|
978 | enddo
|
---|
979 | grad(i,i,k)=-ss(k)
|
---|
980 | enddo
|
---|
981 |
|
---|
982 | if(jjj.ne.0) then
|
---|
983 | ! Restore the original configuration if the molecule has been rotated.
|
---|
984 | ! This is necessary for calculation of gradients.
|
---|
985 | xx=grad(i,i,1)
|
---|
986 | yy=grad(i,i,2)
|
---|
987 | zz=grad(i,i,3)
|
---|
988 | grad(i,i,1)=xx*cg-yy*sfsg+zz*cfsg
|
---|
989 | grad(i,i,2)=yy*cf+zz*sf
|
---|
990 | grad(i,i,3)=-xx*sg-yy*sfcg+zz*cfcg
|
---|
991 |
|
---|
992 | do j2=1,al(0)
|
---|
993 | j=al(j2)
|
---|
994 | xx=grad(i,j,1)
|
---|
995 | yy=grad(i,j,2)
|
---|
996 | zz=grad(i,j,3)
|
---|
997 | grad(i,j,1)=xx*cg-yy*sfsg+zz*cfsg
|
---|
998 | grad(i,j,2)=yy*cf+zz*sf
|
---|
999 | grad(i,j,3)=-xx*sg-yy*sfcg+zz*cfcg
|
---|
1000 | enddo
|
---|
1001 |
|
---|
1002 | endif
|
---|
1003 |
|
---|
1004 |
|
---|
1005 | 1 sss=sss+As(i)*sigma(i)
|
---|
1006 |
|
---|
1007 | do j=1,numat
|
---|
1008 | do k=1,3
|
---|
1009 | gs(k)=0.d0
|
---|
1010 | do i=1,numat
|
---|
1011 | gs(k)=gs(k)+sigma(i)*grad(i,j,k)
|
---|
1012 | enddo
|
---|
1013 | gradan(j,k)=gs(k)
|
---|
1014 | enddo
|
---|
1015 | enddo
|
---|
1016 |
|
---|
1017 | 111 continue
|
---|
1018 |
|
---|
1019 | ! write(3,*)' No Area sigma Enrg gradx grady',
|
---|
1020 | ! & ' gradz Rad Atom'
|
---|
1021 | ! write(3,*)
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | do i=1,numat
|
---|
1025 | enr=As(i)*sigma(i)
|
---|
1026 | energy=energy+enr
|
---|
1027 | ratom=rvdw(i)-rwater
|
---|
1028 |
|
---|
1029 | if (nmat(i)(1:1).eq.'h') ratom=0.0
|
---|
1030 |
|
---|
1031 | ! write(3,700),i,As(i),sigma(i),
|
---|
1032 | ! & enr,(gradan(i,k),k=1,3),ratom,nmat(i)
|
---|
1033 |
|
---|
1034 | enddo
|
---|
1035 |
|
---|
1036 | ! write(3,*)'Total Area: ',sss
|
---|
1037 | ! write(3,*)'Total solvation energy: ',energy
|
---|
1038 |
|
---|
1039 | esolan=sss
|
---|
1040 |
|
---|
1041 | deallocate(grad)
|
---|
1042 | ! close(3)
|
---|
1043 | return
|
---|
1044 |
|
---|
1045 | 100 format(20i4)
|
---|
1046 | 200 format(2i4,3f16.6)
|
---|
1047 | 700 format(i5,7f8.3,5x,a4)
|
---|
1048 |
|
---|
1049 | end
|
---|