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 f77dkernel131
33 C Coulomb interaction: Normal Coulomb
34 C VdW interaction: Tabulated
35 C water optimization: SPC/TIP3P - other atoms
36 C Calculate forces: yes
38 subroutine f77dkernel131
(
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
93 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
96 real*8 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
97 real*8 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
98 real*8 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
99 real*8 jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
100 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
101 real*8 dx21
,dy21
,dz21
,rsq21
,rinv21
102 real*8 dx31
,dy31
,dz31
,rsq31
,rinv31
107 C Initialize water data
109 qO
= facel*charge
(ii
)
110 qH
= facel*charge
(ii
+1)
111 nti
= 2*ntype*type
(ii
)
114 C Reset outer and inner iteration counters
118 C Loop over thread workunits
119 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
120 if(nn1
.gt
.nri
) nn1
=nri
122 C Start outer loop over neighborlists
126 C Load shift vector for this list
129 shY
= shiftvec
(is3
+1)
130 shZ
= shiftvec
(is3
+2)
132 C Load limits for loop over neighbors
136 C Get outer coordinate index
140 C Load i atom data, add shift vector
141 ix1
= shX
+ pos
(ii3
+0)
142 iy1
= shY
+ pos
(ii3
+1)
143 iz1
= shZ
+ pos
(ii3
+2)
144 ix2
= shX
+ pos
(ii3
+3)
145 iy2
= shY
+ pos
(ii3
+4)
146 iz2
= shZ
+ pos
(ii3
+5)
147 ix3
= shX
+ pos
(ii3
+6)
148 iy3
= shY
+ pos
(ii3
+7)
149 iz3
= shZ
+ pos
(ii3
+8)
151 C Zero the potential energy for this list
155 C Clear i atom forces
168 C Get j neighbor index, and coordinate index
172 C load j atom coordinates
181 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
185 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
189 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
191 C Calculate 1/r and 1/r2
192 rinv11
= 1.0/sqrt
(rsq11
)
193 rinv21
= 1.0/sqrt
(rsq21
)
194 rinv31
= 1.0/sqrt
(rsq31
)
196 C Load parameters for j atom
199 tj
= nti
+2*type
(jnr
)+1
202 rinvsq
= rinv11*rinv11
204 C Coulomb interaction
208 C Calculate table index
211 C Calculate table index
218 C Tabulated VdW interaction - dispersion
221 Geps
= eps*VFtab
(nnn
+2)
222 Heps2
= eps2*VFtab
(nnn
+3)
225 FF
= Fp
+Geps
+2.0*Heps2
229 C Tabulated VdW interaction - repulsion
233 Geps
= eps*VFtab
(nnn
+2)
234 Heps2
= eps2*VFtab
(nnn
+3)
237 FF
= Fp
+Geps
+2.0*Heps2
240 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
241 fscal
= (vcoul
)*rinvsq
-((fijD
+fijR
)
244 C Calculate temporary vectorial force
249 C Increment i atom force
254 C Decrement j atom force
255 fjx1
= faction
(j3
+0) - tx
256 fjy1
= faction
(j3
+1) - ty
257 fjz1
= faction
(j3
+2) - tz
259 C Load parameters for j atom
261 rinvsq
= rinv21*rinv21
263 C Coulomb interaction
266 fscal
= (vcoul
)*rinvsq
268 C Calculate temporary vectorial force
273 C Increment i atom force
278 C Decrement j atom force
283 C Load parameters for j atom
284 rinvsq
= rinv31*rinv31
286 C Coulomb interaction
289 fscal
= (vcoul
)*rinvsq
291 C Calculate temporary vectorial force
296 C Increment i atom force
301 C Decrement j atom force
302 faction
(j3
+0) = fjx1
- tx
303 faction
(j3
+1) = fjy1
- ty
304 faction
(j3
+2) = fjz1
- tz
306 C Inner loop uses 127 flops/iteration
310 C Add i forces to mem and shifted force list
311 faction
(ii3
+0) = faction
(ii3
+0) + fix1
312 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
313 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
314 faction
(ii3
+3) = faction
(ii3
+3) + fix2
315 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
316 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
317 faction
(ii3
+6) = faction
(ii3
+6) + fix3
318 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
319 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
320 fshift
(is3
) = fshift
(is3
)+fix1
+fix2
+fix3
321 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
+fiy2
+fiy3
322 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
+fiz2
+fiz3
324 C Add potential energies to the group for this list
326 Vc
(ggid
) = Vc
(ggid
) + vctot
327 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
329 C Increment number of inner iterations
330 ninner
= ninner
+ nj1
- nj0
332 C Outer loop uses 29 flops/iteration
336 C Increment number of outer iterations
337 nouter
= nouter
+ nn1
- nn0
338 if(nn1
.lt
.nri
) goto 10
340 C Write outer/inner iteration count to pointers
352 C Gromacs nonbonded kernel f77dkernel131nf
353 C Coulomb interaction: Normal Coulomb
354 C VdW interaction: Tabulated
355 C water optimization: SPC/TIP3P - other atoms
356 C Calculate forces: no
358 subroutine f77dkernel131nf
(
391 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
392 real*8 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
393 integer*4 gid
(*),type
(*),ntype
394 real*8 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
395 real*8 Vvdw
(*),tabscale
,VFtab
(*)
396 real*8 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
397 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
400 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
401 integer*4 nn0
,nn1
,nouter
,ninner
404 real*8 qq
,vcoul
,vctot
411 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
416 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
417 real*8 dx21
,dy21
,dz21
,rsq21
,rinv21
418 real*8 dx31
,dy31
,dz31
,rsq31
,rinv31
423 C Initialize water data
425 qO
= facel*charge
(ii
)
426 qH
= facel*charge
(ii
+1)
427 nti
= 2*ntype*type
(ii
)
430 C Reset outer and inner iteration counters
434 C Loop over thread workunits
435 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
436 if(nn1
.gt
.nri
) nn1
=nri
438 C Start outer loop over neighborlists
442 C Load shift vector for this list
445 shY
= shiftvec
(is3
+1)
446 shZ
= shiftvec
(is3
+2)
448 C Load limits for loop over neighbors
452 C Get outer coordinate index
456 C Load i atom data, add shift vector
457 ix1
= shX
+ pos
(ii3
+0)
458 iy1
= shY
+ pos
(ii3
+1)
459 iz1
= shZ
+ pos
(ii3
+2)
460 ix2
= shX
+ pos
(ii3
+3)
461 iy2
= shY
+ pos
(ii3
+4)
462 iz2
= shZ
+ pos
(ii3
+5)
463 ix3
= shX
+ pos
(ii3
+6)
464 iy3
= shY
+ pos
(ii3
+7)
465 iz3
= shZ
+ pos
(ii3
+8)
467 C Zero the potential energy for this list
471 C Clear i atom forces
475 C Get j neighbor index, and coordinate index
479 C load j atom coordinates
488 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
492 rsq21
= dx21*dx21
+dy21*dy21
+dz21*dz21
496 rsq31
= dx31*dx31
+dy31*dy31
+dz31*dz31
498 C Calculate 1/r and 1/r2
499 rinv11
= 1.0/sqrt
(rsq11
)
500 rinv21
= 1.0/sqrt
(rsq21
)
501 rinv31
= 1.0/sqrt
(rsq31
)
503 C Load parameters for j atom
506 tj
= nti
+2*type
(jnr
)+1
510 C Coulomb interaction
514 C Calculate table index
517 C Calculate table index
524 C Tabulated VdW interaction - dispersion
527 Geps
= eps*VFtab
(nnn
+2)
528 Heps2
= eps2*VFtab
(nnn
+3)
533 C Tabulated VdW interaction - repulsion
537 Geps
= eps*VFtab
(nnn
+2)
538 Heps2
= eps2*VFtab
(nnn
+3)
542 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
544 C Load parameters for j atom
547 C Coulomb interaction
551 C Load parameters for j atom
553 C Coulomb interaction
557 C Inner loop uses 82 flops/iteration
561 C Add i forces to mem and shifted force list
563 C Add potential energies to the group for this list
565 Vc
(ggid
) = Vc
(ggid
) + vctot
566 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
568 C Increment number of inner iterations
569 ninner
= ninner
+ nj1
- nj0
571 C Outer loop uses 11 flops/iteration
575 C Increment number of outer iterations
576 nouter
= nouter
+ nn1
- nn0
577 if(nn1
.lt
.nri
) goto 10
579 C Write outer/inner iteration count to pointers