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 f77skernel303
33 C Coulomb interaction: Tabulated
34 C VdW interaction: Not calculated
35 C water optimization: TIP4P - other atoms
36 C Calculate forces: yes
38 subroutine f77skernel303
(
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 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
92 real*4 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
93 real*4 ix4
,iy4
,iz4
,fix4
,fiy4
,fiz4
94 real*4 jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
95 real*4 dx21
,dy21
,dz21
,rsq21
,rinv21
96 real*4 dx31
,dy31
,dz31
,rsq31
,rinv31
97 real*4 dx41
,dy41
,dz41
,rsq41
,rinv41
101 C Initialize water data
103 qH
= facel*charge
(ii
+1)
104 qM
= facel*charge
(ii
+3)
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 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)
140 ix4
= shX
+ pos
(ii3
+9)
141 iy4
= shY
+ pos
(ii3
+10)
142 iz4
= shZ
+ pos
(ii3
+11)
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 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
177 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
181 rsq41
= dx41*dx41
+dy41*dy41
+dz41*dz41
183 C Calculate 1/r and 1/r2
184 rinv21
= 1.0/sqrt
(rsq21
)
185 rinv31
= 1.0/sqrt
(rsq31
)
186 rinv41
= 1.0/sqrt
(rsq41
)
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
)*rinv21
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
232 C Calculate table index
235 C Calculate table index
242 C Tabulated coulomb interaction
245 Geps
= eps*VFtab
(nnn
+2)
246 Heps2
= eps2*VFtab
(nnn
+3)
249 FF
= Fp
+Geps
+2.0*Heps2
252 vctot
= vctot
+ vcoul
253 fscal
= -((fijC
)*tabscale
)*rinv31
255 C Calculate temporary vectorial force
260 C Increment i atom force
265 C Decrement j atom force
270 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
)*rinv41
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
+3) = faction
(ii3
+3) + fix2
317 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
318 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
319 faction
(ii3
+6) = faction
(ii3
+6) + fix3
320 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
321 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
322 faction
(ii3
+9) = faction
(ii3
+9) + fix4
323 faction
(ii3
+10) = faction
(ii3
+10) + fiy4
324 faction
(ii3
+11) = faction
(ii3
+11) + fiz4
325 fshift
(is3
) = fshift
(is3
)+fix2
+fix3
+fix4
326 fshift
(is3
+1) = fshift
(is3
+1)+fiy2
+fiy3
+fiy4
327 fshift
(is3
+2) = fshift
(is3
+2)+fiz2
+fiz3
+fiz4
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 f77skernel303nf
357 C Coulomb interaction: Tabulated
358 C VdW interaction: Not calculated
359 C water optimization: TIP4P - other atoms
360 C Calculate forces: no
362 subroutine f77skernel303nf
(
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 dx21
,dy21
,dz21
,rsq21
,rinv21
417 real*4 dx31
,dy31
,dz31
,rsq31
,rinv31
418 real*4 dx41
,dy41
,dz41
,rsq41
,rinv41
422 C Initialize water data
424 qH
= facel*charge
(ii
+1)
425 qM
= facel*charge
(ii
+3)
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 ix2
= shX
+ pos
(ii3
+3)
456 iy2
= shY
+ pos
(ii3
+4)
457 iz2
= shZ
+ pos
(ii3
+5)
458 ix3
= shX
+ pos
(ii3
+6)
459 iy3
= shY
+ pos
(ii3
+7)
460 iz3
= shZ
+ pos
(ii3
+8)
461 ix4
= shX
+ pos
(ii3
+9)
462 iy4
= shY
+ pos
(ii3
+10)
463 iz4
= shZ
+ pos
(ii3
+11)
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 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
489 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
493 rsq41
= dx41*dx41
+dy41*dy41
+dz41*dz41
495 C Calculate 1/r and 1/r2
496 rinv21
= 1.0/sqrt
(rsq21
)
497 rinv31
= 1.0/sqrt
(rsq31
)
498 rinv41
= 1.0/sqrt
(rsq41
)
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
526 C Calculate table index
529 C Calculate table index
536 C Tabulated coulomb interaction
539 Geps
= eps*VFtab
(nnn
+2)
540 Heps2
= eps2*VFtab
(nnn
+3)
544 vctot
= vctot
+ vcoul
546 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