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 f77skernel301
33 C Coulomb interaction: Tabulated
34 C VdW interaction: Not calculated
35 C water optimization: SPC/TIP3P - other atoms
36 C Calculate forces: yes
38 subroutine f77skernel301
(
71 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
72 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
73 integer*4 gid
(*),type
(*),ntype
74 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
75 real*4 Vvdw
(*),tabscale
,VFtab
(*)
76 real*4 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*4 Y
,F
,Geps
,Heps2
,Fp
,VV
91 real*4 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
92 real*4 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
93 real*4 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
94 real*4 jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
95 real*4 dx11
,dy11
,dz11
,rsq11
,rinv11
96 real*4 dx21
,dy21
,dz21
,rsq21
,rinv21
97 real*4 dx31
,dy31
,dz31
,rsq31
,rinv31
101 C Initialize water data
103 qO
= facel*charge
(ii
)
104 qH
= facel*charge
(ii
+1)
107 C Reset outer and inner iteration counters
111 C Loop over thread workunits
112 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
113 if(nn1
.gt
.nri
) nn1
=nri
115 C Start outer loop over neighborlists
119 C Load shift vector for this list
122 shY
= shiftvec
(is3
+1)
123 shZ
= shiftvec
(is3
+2)
125 C Load limits for loop over neighbors
129 C Get outer coordinate index
133 C Load i atom data, add shift vector
134 ix1
= shX
+ pos
(ii3
+0)
135 iy1
= shY
+ pos
(ii3
+1)
136 iz1
= shZ
+ pos
(ii3
+2)
137 ix2
= shX
+ pos
(ii3
+3)
138 iy2
= shY
+ pos
(ii3
+4)
139 iz2
= shZ
+ pos
(ii3
+5)
140 ix3
= shX
+ pos
(ii3
+6)
141 iy3
= shY
+ pos
(ii3
+7)
142 iz3
= shZ
+ pos
(ii3
+8)
144 C Zero the potential energy for this list
147 C Clear i atom forces
160 C Get j neighbor index, and coordinate index
164 C load j atom coordinates
173 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
177 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
181 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
183 C Calculate 1/r and 1/r2
184 rinv11
= 1.0/sqrt
(rsq11
)
185 rinv21
= 1.0/sqrt
(rsq21
)
186 rinv31
= 1.0/sqrt
(rsq31
)
188 C Load parameters for j atom
192 C Calculate table index
195 C Calculate table index
202 C Tabulated coulomb interaction
205 Geps
= eps*VFtab
(nnn
+2)
206 Heps2
= eps2*VFtab
(nnn
+3)
209 FF
= Fp
+Geps
+2.0*Heps2
212 vctot
= vctot
+ vcoul
213 fscal
= -((fijC
)*tabscale
)*rinv11
215 C Calculate temporary vectorial force
220 C Increment i atom force
225 C Decrement j atom force
226 fjx1
= faction
(j3
+0) - tx
227 fjy1
= faction
(j3
+1) - ty
228 fjz1
= faction
(j3
+2) - tz
230 C Load parameters for j atom
233 C Calculate table index
236 C Calculate table index
243 C Tabulated coulomb interaction
246 Geps
= eps*VFtab
(nnn
+2)
247 Heps2
= eps2*VFtab
(nnn
+3)
250 FF
= Fp
+Geps
+2.0*Heps2
253 vctot
= vctot
+ vcoul
254 fscal
= -((fijC
)*tabscale
)*rinv21
256 C Calculate temporary vectorial force
261 C Increment i atom force
266 C Decrement j atom force
271 C Load parameters for j atom
273 C Calculate table index
276 C Calculate table index
283 C Tabulated coulomb interaction
286 Geps
= eps*VFtab
(nnn
+2)
287 Heps2
= eps2*VFtab
(nnn
+3)
290 FF
= Fp
+Geps
+2.0*Heps2
293 vctot
= vctot
+ vcoul
294 fscal
= -((fijC
)*tabscale
)*rinv31
296 C Calculate temporary vectorial force
301 C Increment i atom force
306 C Decrement j atom force
307 faction
(j3
+0) = fjx1
- tx
308 faction
(j3
+1) = fjy1
- ty
309 faction
(j3
+2) = fjz1
- tz
311 C Inner loop uses 125 flops/iteration
315 C Add i forces to mem and shifted force list
316 faction
(ii3
+0) = faction
(ii3
+0) + fix1
317 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
318 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
319 faction
(ii3
+3) = faction
(ii3
+3) + fix2
320 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
321 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
322 faction
(ii3
+6) = faction
(ii3
+6) + fix3
323 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
324 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
325 fshift
(is3
) = fshift
(is3
)+fix1
+fix2
+fix3
326 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
+fiy2
+fiy3
327 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
+fiz2
+fiz3
329 C Add potential energies to the group for this list
331 Vc
(ggid
) = Vc
(ggid
) + vctot
333 C Increment number of inner iterations
334 ninner
= ninner
+ nj1
- nj0
336 C Outer loop uses 28 flops/iteration
340 C Increment number of outer iterations
341 nouter
= nouter
+ nn1
- nn0
342 if(nn1
.lt
.nri
) goto 10
344 C Write outer/inner iteration count to pointers
356 C Gromacs nonbonded kernel f77skernel301nf
357 C Coulomb interaction: Tabulated
358 C VdW interaction: Not calculated
359 C water optimization: SPC/TIP3P - other atoms
360 C Calculate forces: no
362 subroutine f77skernel301nf
(
395 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
396 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
397 integer*4 gid
(*),type
(*),ntype
398 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
399 real*4 Vvdw
(*),tabscale
,VFtab
(*)
400 real*4 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
401 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
404 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
405 integer*4 nn0
,nn1
,nouter
,ninner
408 real*4 qq
,vcoul
,vctot
411 real*4 Y
,F
,Geps
,Heps2
,Fp
,VV
416 real*4 dx11
,dy11
,dz11
,rsq11
,rinv11
417 real*4 dx21
,dy21
,dz21
,rsq21
,rinv21
418 real*4 dx31
,dy31
,dz31
,rsq31
,rinv31
422 C Initialize water data
424 qO
= facel*charge
(ii
)
425 qH
= facel*charge
(ii
+1)
428 C Reset outer and inner iteration counters
432 C Loop over thread workunits
433 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
434 if(nn1
.gt
.nri
) nn1
=nri
436 C Start outer loop over neighborlists
440 C Load shift vector for this list
443 shY
= shiftvec
(is3
+1)
444 shZ
= shiftvec
(is3
+2)
446 C Load limits for loop over neighbors
450 C Get outer coordinate index
454 C Load i atom data, add shift vector
455 ix1
= shX
+ pos
(ii3
+0)
456 iy1
= shY
+ pos
(ii3
+1)
457 iz1
= shZ
+ pos
(ii3
+2)
458 ix2
= shX
+ pos
(ii3
+3)
459 iy2
= shY
+ pos
(ii3
+4)
460 iz2
= shZ
+ pos
(ii3
+5)
461 ix3
= shX
+ pos
(ii3
+6)
462 iy3
= shY
+ pos
(ii3
+7)
463 iz3
= shZ
+ pos
(ii3
+8)
465 C Zero the potential energy for this list
468 C Clear i atom forces
472 C Get j neighbor index, and coordinate index
476 C load j atom coordinates
485 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
489 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
493 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
495 C Calculate 1/r and 1/r2
496 rinv11
= 1.0/sqrt
(rsq11
)
497 rinv21
= 1.0/sqrt
(rsq21
)
498 rinv31
= 1.0/sqrt
(rsq31
)
500 C Load parameters for j atom
504 C Calculate table index
507 C Calculate table index
514 C Tabulated coulomb interaction
517 Geps
= eps*VFtab
(nnn
+2)
518 Heps2
= eps2*VFtab
(nnn
+3)
522 vctot
= vctot
+ vcoul
524 C Load parameters for j atom
527 C Calculate table index
530 C Calculate table index
537 C Tabulated coulomb interaction
540 Geps
= eps*VFtab
(nnn
+2)
541 Heps2
= eps2*VFtab
(nnn
+3)
545 vctot
= vctot
+ vcoul
547 C Load parameters for j atom
549 C Calculate table index
552 C Calculate table index
559 C Tabulated coulomb interaction
562 Geps
= eps*VFtab
(nnn
+2)
563 Heps2
= eps2*VFtab
(nnn
+3)
567 vctot
= vctot
+ vcoul
569 C Inner loop uses 77 flops/iteration
573 C Add i forces to mem and shifted force list
575 C Add potential energies to the group for this list
577 Vc
(ggid
) = Vc
(ggid
) + vctot
579 C Increment number of inner iterations
580 ninner
= ninner
+ nj1
- nj0
582 C Outer loop uses 10 flops/iteration
586 C Increment number of outer iterations
587 nouter
= nouter
+ nn1
- nn0
588 if(nn1
.lt
.nri
) goto 10
590 C Write outer/inner iteration count to pointers