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!
36 # define gmxreal real*8
38 # define gmxreal real*4
44 C Gromacs nonbonded kernel pwr6kernel230
45 C Coulomb interaction: Reaction field
46 C VdW interaction: Tabulated
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel230(
83 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
84 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
85 integer*4 gid(*),type(*),ntype
86 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
87 gmxreal Vvdw(*),tabscale,VFtab(*)
88 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
89 integer*4 nthreads,count,mtx,outeriter,inneriter
92 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
93 integer*4 nn0,nn1,nouter,ninner
95 gmxreal fscal,tx,ty,tz
98 gmxreal qq,vcoul,vctot
101 gmxreal Vvdw6,Vvdwtot
103 gmxreal r,rt,eps,eps2
105 gmxreal Y,F,Geps,Heps2,Fp,VV
109 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
111 gmxreal dx11,dy11,dz11,rsq11,rinv11
115 C Reset outer and inner iteration counters
119 C Loop over thread workunits
120 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
121 if(nn1.gt.nri) nn1=nri
123 C Start outer loop over neighborlists
127 C Load shift vector for this list
130 shY = shiftvec(is3+1)
131 shZ = shiftvec(is3+2)
133 C Load limits for loop over neighbors
137 C Get outer coordinate index
141 C Load i atom data, add shift vector
142 ix1 = shX + pos(ii3+0)
143 iy1 = shY + pos(ii3+1)
144 iz1 = shZ + pos(ii3+2)
146 C Load parameters for i atom
147 iq = facel*charge(ii)
148 nti = 2*ntype*type(ii)
150 C Zero the potential energy for this list
154 C Clear i atom forces
161 C Get j neighbor index, and coordinate index
165 C load j atom coordinates
174 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
176 C Calculate 1/r and 1/r2
178 C PowerPC intrinsics 1/sqrt lookup table
180 rinv11 = frsqrtes(rsq11)
182 rinv11 = frsqrte(dble(rsq11))
184 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
187 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
191 C Load parameters for j atom
193 tj = nti+2*type(jnr)+1
196 rinvsq = rinv11*rinv11
198 C Coulomb reaction-field interaction
200 vcoul = qq*(rinv11+krsq-crf)
203 C Calculate table index
206 C Calculate table index
213 C Tabulated VdW interaction - dispersion
216 Geps = eps*VFtab(nnn+2)
217 Heps2 = eps2*VFtab(nnn+3)
220 FF = Fp+Geps+2.0*Heps2
224 C Tabulated VdW interaction - repulsion
228 Geps = eps*VFtab(nnn+2)
229 Heps2 = eps2*VFtab(nnn+3)
232 FF = Fp+Geps+2.0*Heps2
235 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12
236 fscal = (qq*(rinv11-2.0*krsq))*rinvsq
237 & -((fijD+fijR)*tabscale)*rinv11
239 C Calculate temporary vectorial force
244 C Increment i atom force
249 C Decrement j atom force
250 faction(j3+0) = faction(j3+0) - tx
251 faction(j3+1) = faction(j3+1) - ty
252 faction(j3+2) = faction(j3+2) - tz
254 C Inner loop uses 66 flops/iteration
258 C Add i forces to mem and shifted force list
259 faction(ii3+0) = faction(ii3+0) + fix1
260 faction(ii3+1) = faction(ii3+1) + fiy1
261 faction(ii3+2) = faction(ii3+2) + fiz1
262 fshift(is3) = fshift(is3)+fix1
263 fshift(is3+1) = fshift(is3+1)+fiy1
264 fshift(is3+2) = fshift(is3+2)+fiz1
266 C Add potential energies to the group for this list
268 Vc(ggid) = Vc(ggid) + vctot
269 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
271 C Increment number of inner iterations
272 ninner = ninner + nj1 - nj0
274 C Outer loop uses 12 flops/iteration
278 C Increment number of outer iterations
279 nouter = nouter + nn1 - nn0
280 if(nn1.lt.nri) goto 10
282 C Write outer/inner iteration count to pointers
294 C Gromacs nonbonded kernel pwr6kernel230nf
295 C Coulomb interaction: Reaction field
296 C VdW interaction: Tabulated
297 C water optimization: No
298 C Calculate forces: no
300 subroutine pwr6kernel230nf(
333 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
334 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
335 integer*4 gid(*),type(*),ntype
336 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
337 gmxreal Vvdw(*),tabscale,VFtab(*)
338 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
339 integer*4 nthreads,count,mtx,outeriter,inneriter
342 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
343 integer*4 nn0,nn1,nouter,ninner
346 gmxreal qq,vcoul,vctot
349 gmxreal Vvdw6,Vvdwtot
351 gmxreal r,rt,eps,eps2
353 gmxreal Y,F,Geps,Heps2,Fp,VV
357 gmxreal dx11,dy11,dz11,rsq11,rinv11
361 C Reset outer and inner iteration counters
365 C Loop over thread workunits
366 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
367 if(nn1.gt.nri) nn1=nri
369 C Start outer loop over neighborlists
373 C Load shift vector for this list
376 shY = shiftvec(is3+1)
377 shZ = shiftvec(is3+2)
379 C Load limits for loop over neighbors
383 C Get outer coordinate index
387 C Load i atom data, add shift vector
388 ix1 = shX + pos(ii3+0)
389 iy1 = shY + pos(ii3+1)
390 iz1 = shZ + pos(ii3+2)
392 C Load parameters for i atom
393 iq = facel*charge(ii)
394 nti = 2*ntype*type(ii)
396 C Zero the potential energy for this list
400 C Clear i atom forces
404 C Get j neighbor index, and coordinate index
408 C load j atom coordinates
417 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
419 C Calculate 1/r and 1/r2
421 C PowerPC intrinsics 1/sqrt lookup table
423 rinv11 = frsqrtes(rsq11)
425 rinv11 = frsqrte(dble(rsq11))
427 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
430 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
434 C Load parameters for j atom
436 tj = nti+2*type(jnr)+1
440 C Coulomb reaction-field interaction
442 vcoul = qq*(rinv11+krsq-crf)
445 C Calculate table index
448 C Calculate table index
455 C Tabulated VdW interaction - dispersion
458 Geps = eps*VFtab(nnn+2)
459 Heps2 = eps2*VFtab(nnn+3)
464 C Tabulated VdW interaction - repulsion
468 Geps = eps*VFtab(nnn+2)
469 Heps2 = eps2*VFtab(nnn+3)
473 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12
475 C Inner loop uses 40 flops/iteration
479 C Add i forces to mem and shifted force list
481 C Add potential energies to the group for this list
483 Vc(ggid) = Vc(ggid) + vctot
484 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
486 C Increment number of inner iterations
487 ninner = ninner + nj1 - nj0
489 C Outer loop uses 6 flops/iteration
493 C Increment number of outer iterations
494 nouter = nouter + nn1 - nn0
495 if(nn1.lt.nri) goto 10
497 C Write outer/inner iteration count to pointers