2 C This source code is part of
6 C Copyright (c) 1991-2000, University of Groningen, The Netherlands.
7 C Copyright (c) 2001-2009, The GROMACS Development Team
9 C Gromacs is a library for molecular simulation and trajectory analysis,
10 C written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
11 C a full list of developers and information, check out http://www.gromacs.org
13 C This program is free software; you can redistribute it and/or modify it under
14 C the terms of the GNU Lesser General Public License as published by the Free
15 C Software Foundation; either version 2 of the License, or (at your option) any
17 C As a special exception, you may use this file as part of a free software
18 C library without restriction. Specifically, if other files instantiate
19 C templates or use macros or inline functions from this file, or you compile
20 C this file and link it with other files to produce an executable, this
21 C file does not by itself cause the resulting executable to be covered by
22 C the GNU Lesser General Public License.
24 C In plain-speak: do not worry about classes/macros/templates either - only
25 C changes to the library have to be LGPL, not an application linking with it.
27 C To help fund GROMACS development, we humbly ask that you cite
28 C the papers people have written on it - you can find them on the website!
32 C Gromacs nonbonded kernel f77dkernel201
33 C Coulomb interaction: Reaction field
34 C VdW interaction: Not calculated
35 C water optimization: SPC/TIP3P - other atoms
36 C Calculate forces: yes
38 subroutine f77dkernel201
(
71 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
72 real*8 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
73 integer*4 gid
(*),type
(*),ntype
74 real*8 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
75 real*8 Vvdw
(*),tabscale
,VFtab
(*)
76 real*8 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
77 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
80 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
81 integer*4 nn0
,nn1
,nouter
,ninner
88 real*8 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
89 real*8 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
90 real*8 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
91 real*8 jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
92 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
93 real*8 dx21
,dy21
,dz21
,rsq21
,rinv21
94 real*8 dx31
,dy31
,dz31
,rsq31
,rinv31
98 C Initialize water data
100 qO
= facel*charge
(ii
)
101 qH
= facel*charge
(ii
+1)
104 C Reset outer and inner iteration counters
108 C Loop over thread workunits
109 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
110 if(nn1
.gt
.nri
) nn1
=nri
112 C Start outer loop over neighborlists
116 C Load shift vector for this list
119 shY
= shiftvec
(is3
+1)
120 shZ
= shiftvec
(is3
+2)
122 C Load limits for loop over neighbors
126 C Get outer coordinate index
130 C Load i atom data, add shift vector
131 ix1
= shX
+ pos
(ii3
+0)
132 iy1
= shY
+ pos
(ii3
+1)
133 iz1
= shZ
+ pos
(ii3
+2)
134 ix2
= shX
+ pos
(ii3
+3)
135 iy2
= shY
+ pos
(ii3
+4)
136 iz2
= shZ
+ pos
(ii3
+5)
137 ix3
= shX
+ pos
(ii3
+6)
138 iy3
= shY
+ pos
(ii3
+7)
139 iz3
= shZ
+ pos
(ii3
+8)
141 C Zero the potential energy for this list
144 C Clear i atom forces
157 C Get j neighbor index, and coordinate index
161 C load j atom coordinates
170 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
174 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
178 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
180 C Calculate 1/r and 1/r2
181 rinv11
= 1.0/sqrt
(rsq11
)
182 rinv21
= 1.0/sqrt
(rsq21
)
183 rinv31
= 1.0/sqrt
(rsq31
)
185 C Load parameters for j atom
188 rinvsq
= rinv11*rinv11
190 C Coulomb reaction-field interaction
192 vcoul
= qq*
(rinv11
+krsq
-crf
)
194 fscal
= (qq*
(rinv11
-2.0*krsq
))*rinvsq
196 C Calculate temporary vectorial force
201 C Increment i atom force
206 C Decrement j atom force
207 fjx1
= faction
(j3
+0) - tx
208 fjy1
= faction
(j3
+1) - ty
209 fjz1
= faction
(j3
+2) - tz
211 C Load parameters for j atom
213 rinvsq
= rinv21*rinv21
215 C Coulomb reaction-field interaction
217 vcoul
= qq*
(rinv21
+krsq
-crf
)
219 fscal
= (qq*
(rinv21
-2.0*krsq
))*rinvsq
221 C Calculate temporary vectorial force
226 C Increment i atom force
231 C Decrement j atom force
236 C Load parameters for j atom
237 rinvsq
= rinv31*rinv31
239 C Coulomb reaction-field interaction
241 vcoul
= qq*
(rinv31
+krsq
-crf
)
243 fscal
= (qq*
(rinv31
-2.0*krsq
))*rinvsq
245 C Calculate temporary vectorial force
250 C Increment i atom force
255 C Decrement j atom force
256 faction
(j3
+0) = fjx1
- tx
257 faction
(j3
+1) = fjy1
- ty
258 faction
(j3
+2) = fjz1
- tz
260 C Inner loop uses 113 flops/iteration
264 C Add i forces to mem and shifted force list
265 faction
(ii3
+0) = faction
(ii3
+0) + fix1
266 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
267 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
268 faction
(ii3
+3) = faction
(ii3
+3) + fix2
269 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
270 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
271 faction
(ii3
+6) = faction
(ii3
+6) + fix3
272 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
273 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
274 fshift
(is3
) = fshift
(is3
)+fix1
+fix2
+fix3
275 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
+fiy2
+fiy3
276 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
+fiz2
+fiz3
278 C Add potential energies to the group for this list
280 Vc
(ggid
) = Vc
(ggid
) + vctot
282 C Increment number of inner iterations
283 ninner
= ninner
+ nj1
- nj0
285 C Outer loop uses 28 flops/iteration
289 C Increment number of outer iterations
290 nouter
= nouter
+ nn1
- nn0
291 if(nn1
.lt
.nri
) goto 10
293 C Write outer/inner iteration count to pointers
305 C Gromacs nonbonded kernel f77dkernel201nf
306 C Coulomb interaction: Reaction field
307 C VdW interaction: Not calculated
308 C water optimization: SPC/TIP3P - other atoms
309 C Calculate forces: no
311 subroutine f77dkernel201nf
(
344 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
345 real*8 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
346 integer*4 gid
(*),type
(*),ntype
347 real*8 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
348 real*8 Vvdw
(*),tabscale
,VFtab
(*)
349 real*8 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
350 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
353 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
354 integer*4 nn0
,nn1
,nouter
,ninner
357 real*8 qq
,vcoul
,vctot
363 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
364 real*8 dx21
,dy21
,dz21
,rsq21
,rinv21
365 real*8 dx31
,dy31
,dz31
,rsq31
,rinv31
369 C Initialize water data
371 qO
= facel*charge
(ii
)
372 qH
= facel*charge
(ii
+1)
375 C Reset outer and inner iteration counters
379 C Loop over thread workunits
380 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
381 if(nn1
.gt
.nri
) nn1
=nri
383 C Start outer loop over neighborlists
387 C Load shift vector for this list
390 shY
= shiftvec
(is3
+1)
391 shZ
= shiftvec
(is3
+2)
393 C Load limits for loop over neighbors
397 C Get outer coordinate index
401 C Load i atom data, add shift vector
402 ix1
= shX
+ pos
(ii3
+0)
403 iy1
= shY
+ pos
(ii3
+1)
404 iz1
= shZ
+ pos
(ii3
+2)
405 ix2
= shX
+ pos
(ii3
+3)
406 iy2
= shY
+ pos
(ii3
+4)
407 iz2
= shZ
+ pos
(ii3
+5)
408 ix3
= shX
+ pos
(ii3
+6)
409 iy3
= shY
+ pos
(ii3
+7)
410 iz3
= shZ
+ pos
(ii3
+8)
412 C Zero the potential energy for this list
415 C Clear i atom forces
419 C Get j neighbor index, and coordinate index
423 C load j atom coordinates
432 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
436 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
440 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
442 C Calculate 1/r and 1/r2
443 rinv11
= 1.0/sqrt
(rsq11
)
444 rinv21
= 1.0/sqrt
(rsq21
)
445 rinv31
= 1.0/sqrt
(rsq31
)
447 C Load parameters for j atom
451 C Coulomb reaction-field interaction
453 vcoul
= qq*
(rinv11
+krsq
-crf
)
456 C Load parameters for j atom
459 C Coulomb reaction-field interaction
461 vcoul
= qq*
(rinv21
+krsq
-crf
)
464 C Load parameters for j atom
466 C Coulomb reaction-field interaction
468 vcoul
= qq*
(rinv31
+krsq
-crf
)
471 C Inner loop uses 71 flops/iteration
475 C Add i forces to mem and shifted force list
477 C Add potential energies to the group for this list
479 Vc
(ggid
) = Vc
(ggid
) + vctot
481 C Increment number of inner iterations
482 ninner
= ninner
+ nj1
- nj0
484 C Outer loop uses 10 flops/iteration
488 C Increment number of outer iterations
489 nouter
= nouter
+ nn1
- nn0
490 if(nn1
.lt
.nri
) goto 10
492 C Write outer/inner iteration count to pointers