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 pwr6kernel410
45 C Coulomb interaction: Generalized-Born
46 C VdW interaction: Lennard-Jones
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel410(
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
102 gmxreal Vvdw6,Vvdwtot
104 gmxreal r,rt,eps,eps2
106 gmxreal Y,F,Geps,Heps2,Fp,VV
109 gmxreal isai,isaj,isaprod,gbscale,vgb
110 gmxreal dvdasum,dvdatmp,dvdaj,fgb
111 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
113 gmxreal dx11,dy11,dz11,rsq11,rinv11
117 C Reset outer and inner iteration counters
121 C Loop over thread workunits
122 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
123 if(nn1.gt.nri) nn1=nri
125 C Start outer loop over neighborlists
129 C Load shift vector for this list
132 shY = shiftvec(is3+1)
133 shZ = shiftvec(is3+2)
135 C Load limits for loop over neighbors
139 C Get outer coordinate index
143 C Load i atom data, add shift vector
144 ix1 = shX + pos(ii3+0)
145 iy1 = shY + pos(ii3+1)
146 iz1 = shZ + pos(ii3+2)
148 C Load parameters for i atom
149 iq = facel*charge(ii)
151 nti = 2*ntype*type(ii)
153 C Zero the potential energy for this list
158 C Clear i atom forces
165 C Get j neighbor index, and coordinate index
169 C load j atom coordinates
178 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
180 C Calculate 1/r and 1/r2
182 C PowerPC intrinsics 1/sqrt lookup table
184 rinv11 = frsqrtes(rsq11)
186 rinv11 = frsqrte(dble(rsq11))
188 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
191 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
195 C Load parameters for j atom
202 gbscale = isaprod*gbtabscale
203 tj = nti+2*type(jnr)+1
206 rinvsq = rinv11*rinv11
208 C Tabulated Generalized-Born interaction
212 C Calculate table index
220 Geps = eps*GBtab(nnn+2)
221 Heps2 = eps2*GBtab(nnn+3)
224 FF = Fp+Geps+2.0*Heps2
227 dvdatmp = -0.5*(vgb+fijC*r)
228 dvdasum = dvdasum + dvdatmp
229 dvda(jnr) = dvdaj+dvdatmp*isaj*isaj
230 vctot = vctot + vcoul
232 C Lennard-Jones interaction
233 rinvsix = rinvsq*rinvsq*rinvsq
235 Vvdw12 = c12*rinvsix*rinvsix
236 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6
237 fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq
238 & -(fijC-fscal)*rinv11
240 C Calculate temporary vectorial force
245 C Increment i atom force
250 C Decrement j atom force
251 faction(j3+0) = faction(j3+0) - tx
252 faction(j3+1) = faction(j3+1) - ty
253 faction(j3+2) = faction(j3+2) - tz
255 C Inner loop uses 63 flops/iteration
259 C Add i forces to mem and shifted force list
260 faction(ii3+0) = faction(ii3+0) + fix1
261 faction(ii3+1) = faction(ii3+1) + fiy1
262 faction(ii3+2) = faction(ii3+2) + fiz1
263 fshift(is3) = fshift(is3)+fix1
264 fshift(is3+1) = fshift(is3+1)+fiy1
265 fshift(is3+2) = fshift(is3+2)+fiz1
267 C Add potential energies to the group for this list
269 Vc(ggid) = Vc(ggid) + vctot
270 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
271 dvda(ii) = dvda(ii) + dvdasum*isai*isai
273 C Increment number of inner iterations
274 ninner = ninner + nj1 - nj0
276 C Outer loop uses 13 flops/iteration
280 C Increment number of outer iterations
281 nouter = nouter + nn1 - nn0
282 if(nn1.lt.nri) goto 10
284 C Write outer/inner iteration count to pointers
296 C Gromacs nonbonded kernel pwr6kernel410nf
297 C Coulomb interaction: Generalized-Born
298 C VdW interaction: Lennard-Jones
299 C water optimization: No
300 C Calculate forces: no
302 subroutine pwr6kernel410nf(
335 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
336 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
337 integer*4 gid(*),type(*),ntype
338 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
339 gmxreal Vvdw(*),tabscale,VFtab(*)
340 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
341 integer*4 nthreads,count,mtx,outeriter,inneriter
344 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
345 integer*4 nn0,nn1,nouter,ninner
349 gmxreal qq,vcoul,vctot
353 gmxreal Vvdw6,Vvdwtot
355 gmxreal r,rt,eps,eps2
357 gmxreal Y,F,Geps,Heps2,Fp,VV
358 gmxreal isai,isaj,isaprod,gbscale,vgb
361 gmxreal dx11,dy11,dz11,rsq11,rinv11
365 C Reset outer and inner iteration counters
369 C Loop over thread workunits
370 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
371 if(nn1.gt.nri) nn1=nri
373 C Start outer loop over neighborlists
377 C Load shift vector for this list
380 shY = shiftvec(is3+1)
381 shZ = shiftvec(is3+2)
383 C Load limits for loop over neighbors
387 C Get outer coordinate index
391 C Load i atom data, add shift vector
392 ix1 = shX + pos(ii3+0)
393 iy1 = shY + pos(ii3+1)
394 iz1 = shZ + pos(ii3+2)
396 C Load parameters for i atom
397 iq = facel*charge(ii)
399 nti = 2*ntype*type(ii)
401 C Zero the potential energy for this list
405 C Clear i atom forces
409 C Get j neighbor index, and coordinate index
413 C load j atom coordinates
422 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
424 C Calculate 1/r and 1/r2
426 C PowerPC intrinsics 1/sqrt lookup table
428 rinv11 = frsqrtes(rsq11)
430 rinv11 = frsqrte(dble(rsq11))
432 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
435 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
439 C Load parameters for j atom
445 gbscale = isaprod*gbtabscale
446 tj = nti+2*type(jnr)+1
449 rinvsq = rinv11*rinv11
451 C Tabulated Generalized-Born interaction
454 C Calculate table index
462 Geps = eps*GBtab(nnn+2)
463 Heps2 = eps2*GBtab(nnn+3)
467 vctot = vctot + vcoul
469 C Lennard-Jones interaction
470 rinvsix = rinvsq*rinvsq*rinvsq
472 Vvdw12 = c12*rinvsix*rinvsix
473 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6
475 C Inner loop uses 38 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