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 pwr6kernel200
45 C Coulomb interaction: Reaction field
46 C VdW interaction: Not calculated
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel200(
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
100 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
102 gmxreal dx11,dy11,dz11,rsq11,rinv11
105 C Reset outer and inner iteration counters
109 C Loop over thread workunits
110 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
111 if(nn1.gt.nri) nn1=nri
113 C Start outer loop over neighborlists
117 C Load shift vector for this list
120 shY = shiftvec(is3+1)
121 shZ = shiftvec(is3+2)
123 C Load limits for loop over neighbors
127 C Get outer coordinate index
131 C Load i atom data, add shift vector
132 ix1 = shX + pos(ii3+0)
133 iy1 = shY + pos(ii3+1)
134 iz1 = shZ + pos(ii3+2)
136 C Load parameters for i atom
137 iq = facel*charge(ii)
139 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
166 C PowerPC intrinsics 1/sqrt lookup table
168 rinv11 = frsqrtes(rsq11)
170 rinv11 = frsqrte(dble(rsq11))
172 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
175 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
179 C Load parameters for j atom
181 rinvsq = rinv11*rinv11
183 C Coulomb reaction-field interaction
185 vcoul = qq*(rinv11+krsq-crf)
187 fscal = (qq*(rinv11-2.0*krsq))*rinvsq
189 C Calculate temporary vectorial force
194 C Increment i atom force
199 C Decrement j atom force
200 faction(j3+0) = faction(j3+0) - tx
201 faction(j3+1) = faction(j3+1) - ty
202 faction(j3+2) = faction(j3+2) - tz
204 C Inner loop uses 34 flops/iteration
208 C Add i forces to mem and shifted force list
209 faction(ii3+0) = faction(ii3+0) + fix1
210 faction(ii3+1) = faction(ii3+1) + fiy1
211 faction(ii3+2) = faction(ii3+2) + fiz1
212 fshift(is3) = fshift(is3)+fix1
213 fshift(is3+1) = fshift(is3+1)+fiy1
214 fshift(is3+2) = fshift(is3+2)+fiz1
216 C Add potential energies to the group for this list
218 Vc(ggid) = Vc(ggid) + vctot
220 C Increment number of inner iterations
221 ninner = ninner + nj1 - nj0
223 C Outer loop uses 11 flops/iteration
227 C Increment number of outer iterations
228 nouter = nouter + nn1 - nn0
229 if(nn1.lt.nri) goto 10
231 C Write outer/inner iteration count to pointers
243 C Gromacs nonbonded kernel pwr6kernel200nf
244 C Coulomb interaction: Reaction field
245 C VdW interaction: Not calculated
246 C water optimization: No
247 C Calculate forces: no
249 subroutine pwr6kernel200nf(
282 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
283 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
284 integer*4 gid(*),type(*),ntype
285 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
286 gmxreal Vvdw(*),tabscale,VFtab(*)
287 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
288 integer*4 nthreads,count,mtx,outeriter,inneriter
291 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
292 integer*4 nn0,nn1,nouter,ninner
295 gmxreal qq,vcoul,vctot
299 gmxreal dx11,dy11,dz11,rsq11,rinv11
302 C Reset outer and inner iteration counters
306 C Loop over thread workunits
307 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
308 if(nn1.gt.nri) nn1=nri
310 C Start outer loop over neighborlists
314 C Load shift vector for this list
317 shY = shiftvec(is3+1)
318 shZ = shiftvec(is3+2)
320 C Load limits for loop over neighbors
324 C Get outer coordinate index
328 C Load i atom data, add shift vector
329 ix1 = shX + pos(ii3+0)
330 iy1 = shY + pos(ii3+1)
331 iz1 = shZ + pos(ii3+2)
333 C Load parameters for i atom
334 iq = facel*charge(ii)
336 C Zero the potential energy for this list
339 C Clear i atom forces
343 C Get j neighbor index, and coordinate index
347 C load j atom coordinates
356 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
358 C Calculate 1/r and 1/r2
360 C PowerPC intrinsics 1/sqrt lookup table
362 rinv11 = frsqrtes(rsq11)
364 rinv11 = frsqrte(dble(rsq11))
366 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
369 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
373 C Load parameters for j atom
376 C Coulomb reaction-field interaction
378 vcoul = qq*(rinv11+krsq-crf)
381 C Inner loop uses 20 flops/iteration
385 C Add i forces to mem and shifted force list
387 C Add potential energies to the group for this list
389 Vc(ggid) = Vc(ggid) + vctot
391 C Increment number of inner iterations
392 ninner = ninner + nj1 - nj0
394 C Outer loop uses 5 flops/iteration
398 C Increment number of outer iterations
399 nouter = nouter + nn1 - nn0
400 if(nn1.lt.nri) goto 10
402 C Write outer/inner iteration count to pointers