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 pwr6kernel100
45 C Coulomb interaction: Normal Coulomb
46 C VdW interaction: Not calculated
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel100(
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
99 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
101 gmxreal dx11,dy11,dz11,rsq11,rinv11
104 C Reset outer and inner iteration counters
108 C Loop over thread workunits
109 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
110 if(nn1.gt.nri) nn1=nri
112 C Start outer loop over neighborlists
116 C Load shift vector for this list
119 shY = shiftvec(is3+1)
120 shZ = shiftvec(is3+2)
122 C Load limits for loop over neighbors
126 C Get outer coordinate index
130 C Load i atom data, add shift vector
131 ix1 = shX + pos(ii3+0)
132 iy1 = shY + pos(ii3+1)
133 iz1 = shZ + pos(ii3+2)
135 C Load parameters for i atom
136 iq = facel*charge(ii)
138 C Zero the potential energy for this list
141 C Clear i atom forces
148 C Get j neighbor index, and coordinate index
152 C load j atom coordinates
161 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
163 C Calculate 1/r and 1/r2
165 C PowerPC intrinsics 1/sqrt lookup table
167 rinv11 = frsqrtes(rsq11)
169 rinv11 = frsqrte(dble(rsq11))
171 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
174 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
178 C Load parameters for j atom
180 rinvsq = rinv11*rinv11
182 C Coulomb interaction
185 fscal = (vcoul)*rinvsq
187 C Calculate temporary vectorial force
192 C Increment i atom force
197 C Decrement j atom force
198 faction(j3+0) = faction(j3+0) - tx
199 faction(j3+1) = faction(j3+1) - ty
200 faction(j3+2) = faction(j3+2) - tz
202 C Inner loop uses 28 flops/iteration
206 C Add i forces to mem and shifted force list
207 faction(ii3+0) = faction(ii3+0) + fix1
208 faction(ii3+1) = faction(ii3+1) + fiy1
209 faction(ii3+2) = faction(ii3+2) + fiz1
210 fshift(is3) = fshift(is3)+fix1
211 fshift(is3+1) = fshift(is3+1)+fiy1
212 fshift(is3+2) = fshift(is3+2)+fiz1
214 C Add potential energies to the group for this list
216 Vc(ggid) = Vc(ggid) + vctot
218 C Increment number of inner iterations
219 ninner = ninner + nj1 - nj0
221 C Outer loop uses 11 flops/iteration
225 C Increment number of outer iterations
226 nouter = nouter + nn1 - nn0
227 if(nn1.lt.nri) goto 10
229 C Write outer/inner iteration count to pointers
241 C Gromacs nonbonded kernel pwr6kernel100nf
242 C Coulomb interaction: Normal Coulomb
243 C VdW interaction: Not calculated
244 C water optimization: No
245 C Calculate forces: no
247 subroutine pwr6kernel100nf(
280 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
281 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
282 integer*4 gid(*),type(*),ntype
283 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
284 gmxreal Vvdw(*),tabscale,VFtab(*)
285 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
286 integer*4 nthreads,count,mtx,outeriter,inneriter
289 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
290 integer*4 nn0,nn1,nouter,ninner
293 gmxreal qq,vcoul,vctot
296 gmxreal dx11,dy11,dz11,rsq11,rinv11
299 C Reset outer and inner iteration counters
303 C Loop over thread workunits
304 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
305 if(nn1.gt.nri) nn1=nri
307 C Start outer loop over neighborlists
311 C Load shift vector for this list
314 shY = shiftvec(is3+1)
315 shZ = shiftvec(is3+2)
317 C Load limits for loop over neighbors
321 C Get outer coordinate index
325 C Load i atom data, add shift vector
326 ix1 = shX + pos(ii3+0)
327 iy1 = shY + pos(ii3+1)
328 iz1 = shZ + pos(ii3+2)
330 C Load parameters for i atom
331 iq = facel*charge(ii)
333 C Zero the potential energy for this list
336 C Clear i atom forces
340 C Get j neighbor index, and coordinate index
344 C load j atom coordinates
353 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
355 C Calculate 1/r and 1/r2
357 C PowerPC intrinsics 1/sqrt lookup table
359 rinv11 = frsqrtes(rsq11)
361 rinv11 = frsqrte(dble(rsq11))
363 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
366 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
370 C Load parameters for j atom
373 C Coulomb interaction
377 C Inner loop uses 17 flops/iteration
381 C Add i forces to mem and shifted force list
383 C Add potential energies to the group for this list
385 Vc(ggid) = Vc(ggid) + vctot
387 C Increment number of inner iterations
388 ninner = ninner + nj1 - nj0
390 C Outer loop uses 5 flops/iteration
394 C Increment number of outer iterations
395 nouter = nouter + nn1 - nn0
396 if(nn1.lt.nri) goto 10
398 C Write outer/inner iteration count to pointers