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 f77dkernel310
33 C Coulomb interaction: Tabulated
34 C VdW interaction: Lennard-Jones
35 C water optimization: No
36 C Calculate forces: yes
38 subroutine f77dkernel310
(
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
94 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
97 real*8 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
99 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
103 C Reset outer and inner iteration counters
107 C Loop over thread workunits
108 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
109 if(nn1
.gt
.nri
) nn1
=nri
111 C Start outer loop over neighborlists
115 C Load shift vector for this list
118 shY
= shiftvec
(is3
+1)
119 shZ
= shiftvec
(is3
+2)
121 C Load limits for loop over neighbors
125 C Get outer coordinate index
129 C Load i atom data, add shift vector
130 ix1
= shX
+ pos
(ii3
+0)
131 iy1
= shY
+ pos
(ii3
+1)
132 iz1
= shZ
+ pos
(ii3
+2)
134 C Load parameters for i atom
135 iq
= facel*charge
(ii
)
136 nti
= 2*ntype*type
(ii
)
138 C Zero the potential energy for this list
142 C Clear i atom forces
149 C Get j neighbor index, and coordinate index
153 C load j atom coordinates
162 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
164 C Calculate 1/r and 1/r2
165 rinv11
= 1.0/sqrt
(rsq11
)
167 C Load parameters for j atom
169 tj
= nti
+2*type
(jnr
)+1
172 rinvsq
= rinv11*rinv11
174 C Calculate table index
177 C Calculate table index
184 C Tabulated coulomb interaction
187 Geps
= eps*VFtab
(nnn
+2)
188 Heps2
= eps2*VFtab
(nnn
+3)
191 FF
= Fp
+Geps
+2.0*Heps2
194 vctot
= vctot
+ vcoul
196 C Lennard-Jones interaction
197 rinvsix
= rinvsq*rinvsq*rinvsq
199 Vvdw12
= c12*rinvsix*rinvsix
200 Vvdwtot
= Vvdwtot
+Vvdw12
-Vvdw6
201 fscal
= (12.0*Vvdw12
-6.0*Vvdw6
)*rinvsq
202 & -((fijC
)*tabscale
)*rinv11
204 C Calculate temporary vectorial force
209 C Increment i atom force
214 C Decrement j atom force
215 faction
(j3
+0) = faction
(j3
+0) - tx
216 faction
(j3
+1) = faction
(j3
+1) - ty
217 faction
(j3
+2) = faction
(j3
+2) - tz
219 C Inner loop uses 60 flops/iteration
223 C Add i forces to mem and shifted force list
224 faction
(ii3
+0) = faction
(ii3
+0) + fix1
225 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
226 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
227 fshift
(is3
) = fshift
(is3
)+fix1
228 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
229 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
231 C Add potential energies to the group for this list
233 Vc
(ggid
) = Vc
(ggid
) + vctot
234 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
236 C Increment number of inner iterations
237 ninner
= ninner
+ nj1
- nj0
239 C Outer loop uses 12 flops/iteration
243 C Increment number of outer iterations
244 nouter
= nouter
+ nn1
- nn0
245 if(nn1
.lt
.nri
) goto 10
247 C Write outer/inner iteration count to pointers
259 C Gromacs nonbonded kernel f77dkernel310nf
260 C Coulomb interaction: Tabulated
261 C VdW interaction: Lennard-Jones
262 C water optimization: No
263 C Calculate forces: no
265 subroutine f77dkernel310nf
(
298 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
299 real*8 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
300 integer*4 gid
(*),type
(*),ntype
301 real*8 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
302 real*8 Vvdw
(*),tabscale
,VFtab
(*)
303 real*8 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
304 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
307 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
308 integer*4 nn0
,nn1
,nouter
,ninner
312 real*8 qq
,vcoul
,vctot
320 real*8 Y
,F
,Geps
,Heps2
,Fp
,VV
323 real*8 dx11
,dy11
,dz11
,rsq11
,rinv11
327 C Reset outer and inner iteration counters
331 C Loop over thread workunits
332 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
333 if(nn1
.gt
.nri
) nn1
=nri
335 C Start outer loop over neighborlists
339 C Load shift vector for this list
342 shY
= shiftvec
(is3
+1)
343 shZ
= shiftvec
(is3
+2)
345 C Load limits for loop over neighbors
349 C Get outer coordinate index
353 C Load i atom data, add shift vector
354 ix1
= shX
+ pos
(ii3
+0)
355 iy1
= shY
+ pos
(ii3
+1)
356 iz1
= shZ
+ pos
(ii3
+2)
358 C Load parameters for i atom
359 iq
= facel*charge
(ii
)
360 nti
= 2*ntype*type
(ii
)
362 C Zero the potential energy for this list
366 C Clear i atom forces
370 C Get j neighbor index, and coordinate index
374 C load j atom coordinates
383 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
385 C Calculate 1/r and 1/r2
386 rinv11
= 1.0/sqrt
(rsq11
)
388 C Load parameters for j atom
390 tj
= nti
+2*type
(jnr
)+1
393 rinvsq
= rinv11*rinv11
395 C Calculate table index
398 C Calculate table index
405 C Tabulated coulomb interaction
408 Geps
= eps*VFtab
(nnn
+2)
409 Heps2
= eps2*VFtab
(nnn
+3)
413 vctot
= vctot
+ vcoul
415 C Lennard-Jones interaction
416 rinvsix
= rinvsq*rinvsq*rinvsq
418 Vvdw12
= c12*rinvsix*rinvsix
419 Vvdwtot
= Vvdwtot
+Vvdw12
-Vvdw6
421 C Inner loop uses 39 flops/iteration
425 C Add i forces to mem and shifted force list
427 C Add potential energies to the group for this list
429 Vc
(ggid
) = Vc
(ggid
) + vctot
430 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
432 C Increment number of inner iterations
433 ninner
= ninner
+ nj1
- nj0
435 C Outer loop uses 6 flops/iteration
439 C Increment number of outer iterations
440 nouter
= nouter
+ nn1
- nn0
441 if(nn1
.lt
.nri
) goto 10
443 C Write outer/inner iteration count to pointers