source: esolan.f

Last change on this file was 38d77eb, checked in by baerbaer <baerbaer@…>, 14 years ago

Redirected standard out to logString.

SMMP produced a lot of log messages. This became an issue when run in massively
parallel environments. I replaced all writes to standard out to a write to logString.
The next step is to pass this string to a function that writes the messages to a log
file according to their importance and the chosen log level.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@34 26dc1dd8-5c4e-0410-9ffe-d298b4865968

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