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 f77dkernel430
33 C Coulomb interaction: Generalized-Born
34 C VdW interaction: Tabulated
35 C water optimization: No
36 C Calculate forces: yes
38 subroutine f77dkernel430
(
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
92 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
96 real*8 isai
,isaj
,isaprod
,gbscale
,vgb
97 real*8 dvdasum
,dvdatmp
,dvdaj
,fgb
98 real*8 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
100 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
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)
135 C Load parameters for i atom
136 iq
= facel*charge
(ii
)
138 nti
= 2*ntype*type
(ii
)
140 C Zero the potential energy for this list
145 C Clear i atom forces
152 C Get j neighbor index, and coordinate index
156 C load j atom coordinates
165 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
167 C Calculate 1/r and 1/r2
168 rinv11
= 1.0/sqrt
(rsq11
)
170 C Load parameters for j atom
177 gbscale
= isaprod*gbtabscale
178 tj
= nti
+2*type
(jnr
)+1
182 C Tabulated Generalized-Born interaction
186 C Calculate table index
194 Geps
= eps*GBtab
(nnn
+2)
195 Heps2
= eps2*GBtab
(nnn
+3)
198 FF
= Fp
+Geps
+2.0*Heps2
201 dvdatmp
= -0.5*(vgb
+fijC*r
)
202 dvdasum
= dvdasum
+ dvdatmp
203 dvda
(jnr
) = dvdaj
+dvdatmp*isaj*isaj
204 vctot
= vctot
+ vcoul
206 C Calculate table index
209 C Calculate table index
216 C Tabulated VdW interaction - dispersion
219 Geps
= eps*VFtab
(nnn
+2)
220 Heps2
= eps2*VFtab
(nnn
+3)
223 FF
= Fp
+Geps
+2.0*Heps2
227 C Tabulated VdW interaction - repulsion
231 Geps
= eps*VFtab
(nnn
+2)
232 Heps2
= eps2*VFtab
(nnn
+3)
235 FF
= Fp
+Geps
+2.0*Heps2
238 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
239 fscal
= -((fijD
+fijR
)*tabscale
+fijC
-fscal
)
242 C Calculate temporary vectorial force
247 C Increment i atom force
252 C Decrement j atom force
253 faction
(j3
+0) = faction
(j3
+0) - tx
254 faction
(j3
+1) = faction
(j3
+1) - ty
255 faction
(j3
+2) = faction
(j3
+2) - tz
257 C Inner loop uses 85 flops/iteration
261 C Add i forces to mem and shifted force list
262 faction
(ii3
+0) = faction
(ii3
+0) + fix1
263 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
264 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
265 fshift
(is3
) = fshift
(is3
)+fix1
266 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
267 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
269 C Add potential energies to the group for this list
271 Vc
(ggid
) = Vc
(ggid
) + vctot
272 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
273 dvda
(ii
) = dvda
(ii
) + dvdasum*isai*isai
275 C Increment number of inner iterations
276 ninner
= ninner
+ nj1
- nj0
278 C Outer loop uses 13 flops/iteration
282 C Increment number of outer iterations
283 nouter
= nouter
+ nn1
- nn0
284 if(nn1
.lt
.nri
) goto 10
286 C Write outer/inner iteration count to pointers
298 C Gromacs nonbonded kernel f77dkernel430nf
299 C Coulomb interaction: Generalized-Born
300 C VdW interaction: Tabulated
301 C water optimization: No
302 C Calculate forces: no
304 subroutine f77dkernel430nf
(
337 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
338 real*8 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
339 integer*4 gid
(*),type
(*),ntype
340 real*8 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
341 real*8 Vvdw
(*),tabscale
,VFtab
(*)
342 real*8 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
343 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
346 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
347 integer*4 nn0
,nn1
,nouter
,ninner
350 real*8 qq
,vcoul
,vctot
357 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
358 real*8 isai
,isaj
,isaprod
,gbscale
,vgb
361 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
365 C Reset outer and inner iteration counters
369 C Loop over thread workunits
370 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
371 if(nn1
.gt
.nri
) nn1
=nri
373 C Start outer loop over neighborlists
377 C Load shift vector for this list
380 shY
= shiftvec
(is3
+1)
381 shZ
= shiftvec
(is3
+2)
383 C Load limits for loop over neighbors
387 C Get outer coordinate index
391 C Load i atom data, add shift vector
392 ix1
= shX
+ pos
(ii3
+0)
393 iy1
= shY
+ pos
(ii3
+1)
394 iz1
= shZ
+ pos
(ii3
+2)
396 C Load parameters for i atom
397 iq
= facel*charge
(ii
)
399 nti
= 2*ntype*type
(ii
)
401 C Zero the potential energy for this list
405 C Clear i atom forces
409 C Get j neighbor index, and coordinate index
413 C load j atom coordinates
422 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
424 C Calculate 1/r and 1/r2
425 rinv11
= 1.0/sqrt
(rsq11
)
427 C Load parameters for j atom
433 gbscale
= isaprod*gbtabscale
434 tj
= nti
+2*type
(jnr
)+1
438 C Tabulated Generalized-Born interaction
441 C Calculate table index
449 Geps
= eps*GBtab
(nnn
+2)
450 Heps2
= eps2*GBtab
(nnn
+3)
454 vctot
= vctot
+ vcoul
456 C Calculate table index
459 C Calculate table index
466 C Tabulated VdW interaction - dispersion
469 Geps
= eps*VFtab
(nnn
+2)
470 Heps2
= eps2*VFtab
(nnn
+3)
475 C Tabulated VdW interaction - repulsion
479 Geps
= eps*VFtab
(nnn
+2)
480 Heps2
= eps2*VFtab
(nnn
+3)
484 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
486 C Inner loop uses 54 flops/iteration
490 C Add i forces to mem and shifted force list
492 C Add potential energies to the group for this list
494 Vc
(ggid
) = Vc
(ggid
) + vctot
495 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
497 C Increment number of inner iterations
498 ninner
= ninner
+ nj1
- nj0
500 C Outer loop uses 6 flops/iteration
504 C Increment number of outer iterations
505 nouter
= nouter
+ nn1
- nn0
506 if(nn1
.lt
.nri
) goto 10
508 C Write outer/inner iteration count to pointers