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 pwr6kernel430
45 C Coulomb interaction: Generalized-Born
46 C VdW interaction: Tabulated
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel430(
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
97 gmxreal qq,vcoul,vctot
100 gmxreal Vvdw6,Vvdwtot
102 gmxreal r,rt,eps,eps2
104 gmxreal Y,F,Geps,Heps2,Fp,VV
108 gmxreal isai,isaj,isaprod,gbscale,vgb
109 gmxreal dvdasum,dvdatmp,dvdaj,fgb
110 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
112 gmxreal dx11,dy11,dz11,rsq11,rinv11
116 C Reset outer and inner iteration counters
120 C Loop over thread workunits
121 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
122 if(nn1.gt.nri) nn1=nri
124 C Start outer loop over neighborlists
128 C Load shift vector for this list
131 shY = shiftvec(is3+1)
132 shZ = shiftvec(is3+2)
134 C Load limits for loop over neighbors
138 C Get outer coordinate index
142 C Load i atom data, add shift vector
143 ix1 = shX + pos(ii3+0)
144 iy1 = shY + pos(ii3+1)
145 iz1 = shZ + pos(ii3+2)
147 C Load parameters for i atom
148 iq = facel*charge(ii)
150 nti = 2*ntype*type(ii)
152 C Zero the potential energy for this list
157 C Clear i atom forces
164 C Get j neighbor index, and coordinate index
168 C load j atom coordinates
177 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
179 C Calculate 1/r and 1/r2
181 C PowerPC intrinsics 1/sqrt lookup table
183 rinv11 = frsqrtes(rsq11)
185 rinv11 = frsqrte(dble(rsq11))
187 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
190 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
194 C Load parameters for j atom
201 gbscale = isaprod*gbtabscale
202 tj = nti+2*type(jnr)+1
206 C Tabulated Generalized-Born interaction
210 C Calculate table index
218 Geps = eps*GBtab(nnn+2)
219 Heps2 = eps2*GBtab(nnn+3)
222 FF = Fp+Geps+2.0*Heps2
225 dvdatmp = -0.5*(vgb+fijC*r)
226 dvdasum = dvdasum + dvdatmp
227 dvda(jnr) = dvdaj+dvdatmp*isaj*isaj
228 vctot = vctot + vcoul
230 C Calculate table index
233 C Calculate table index
240 C Tabulated VdW interaction - dispersion
243 Geps = eps*VFtab(nnn+2)
244 Heps2 = eps2*VFtab(nnn+3)
247 FF = Fp+Geps+2.0*Heps2
251 C Tabulated VdW interaction - repulsion
255 Geps = eps*VFtab(nnn+2)
256 Heps2 = eps2*VFtab(nnn+3)
259 FF = Fp+Geps+2.0*Heps2
262 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12
263 fscal = -((fijD+fijR)*tabscale+fijC-fscal)
266 C Calculate temporary vectorial force
271 C Increment i atom force
276 C Decrement j atom force
277 faction(j3+0) = faction(j3+0) - tx
278 faction(j3+1) = faction(j3+1) - ty
279 faction(j3+2) = faction(j3+2) - tz
281 C Inner loop uses 81 flops/iteration
285 C Add i forces to mem and shifted force list
286 faction(ii3+0) = faction(ii3+0) + fix1
287 faction(ii3+1) = faction(ii3+1) + fiy1
288 faction(ii3+2) = faction(ii3+2) + fiz1
289 fshift(is3) = fshift(is3)+fix1
290 fshift(is3+1) = fshift(is3+1)+fiy1
291 fshift(is3+2) = fshift(is3+2)+fiz1
293 C Add potential energies to the group for this list
295 Vc(ggid) = Vc(ggid) + vctot
296 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
297 dvda(ii) = dvda(ii) + dvdasum*isai*isai
299 C Increment number of inner iterations
300 ninner = ninner + nj1 - nj0
302 C Outer loop uses 13 flops/iteration
306 C Increment number of outer iterations
307 nouter = nouter + nn1 - nn0
308 if(nn1.lt.nri) goto 10
310 C Write outer/inner iteration count to pointers
322 C Gromacs nonbonded kernel pwr6kernel430nf
323 C Coulomb interaction: Generalized-Born
324 C VdW interaction: Tabulated
325 C water optimization: No
326 C Calculate forces: no
328 subroutine pwr6kernel430nf(
361 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
362 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
363 integer*4 gid(*),type(*),ntype
364 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
365 gmxreal Vvdw(*),tabscale,VFtab(*)
366 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
367 integer*4 nthreads,count,mtx,outeriter,inneriter
370 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
371 integer*4 nn0,nn1,nouter,ninner
374 gmxreal qq,vcoul,vctot
377 gmxreal Vvdw6,Vvdwtot
379 gmxreal r,rt,eps,eps2
381 gmxreal Y,F,Geps,Heps2,Fp,VV
382 gmxreal isai,isaj,isaprod,gbscale,vgb
385 gmxreal dx11,dy11,dz11,rsq11,rinv11
389 C Reset outer and inner iteration counters
393 C Loop over thread workunits
394 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
395 if(nn1.gt.nri) nn1=nri
397 C Start outer loop over neighborlists
401 C Load shift vector for this list
404 shY = shiftvec(is3+1)
405 shZ = shiftvec(is3+2)
407 C Load limits for loop over neighbors
411 C Get outer coordinate index
415 C Load i atom data, add shift vector
416 ix1 = shX + pos(ii3+0)
417 iy1 = shY + pos(ii3+1)
418 iz1 = shZ + pos(ii3+2)
420 C Load parameters for i atom
421 iq = facel*charge(ii)
423 nti = 2*ntype*type(ii)
425 C Zero the potential energy for this list
429 C Clear i atom forces
433 C Get j neighbor index, and coordinate index
437 C load j atom coordinates
446 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
448 C Calculate 1/r and 1/r2
450 C PowerPC intrinsics 1/sqrt lookup table
452 rinv11 = frsqrtes(rsq11)
454 rinv11 = frsqrte(dble(rsq11))
456 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
459 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
463 C Load parameters for j atom
469 gbscale = isaprod*gbtabscale
470 tj = nti+2*type(jnr)+1
474 C Tabulated Generalized-Born interaction
477 C Calculate table index
485 Geps = eps*GBtab(nnn+2)
486 Heps2 = eps2*GBtab(nnn+3)
490 vctot = vctot + vcoul
492 C Calculate table index
495 C Calculate table index
502 C Tabulated VdW interaction - dispersion
505 Geps = eps*VFtab(nnn+2)
506 Heps2 = eps2*VFtab(nnn+3)
511 C Tabulated VdW interaction - repulsion
515 Geps = eps*VFtab(nnn+2)
516 Heps2 = eps2*VFtab(nnn+3)
520 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12
522 C Inner loop uses 50 flops/iteration
526 C Add i forces to mem and shifted force list
528 C Add potential energies to the group for this list
530 Vc(ggid) = Vc(ggid) + vctot
531 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
533 C Increment number of inner iterations
534 ninner = ninner + nj1 - nj0
536 C Outer loop uses 6 flops/iteration
540 C Increment number of outer iterations
541 nouter = nouter + nn1 - nn0
542 if(nn1.lt.nri) goto 10
544 C Write outer/inner iteration count to pointers