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 pwr6kernel220
45 C Coulomb interaction: Reaction field
46 C VdW interaction: Buckingham
47 C water optimization: No
48 C Calculate forces: yes
50 subroutine pwr6kernel220(
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
105 gmxreal ix1,iy1,iz1,fix1,fiy1,fiz1
107 gmxreal dx11,dy11,dz11,rsq11,rinv11
108 gmxreal c6,cexp1,cexp2
111 C Reset outer and inner iteration counters
115 C Loop over thread workunits
116 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
117 if(nn1.gt.nri) nn1=nri
119 C Start outer loop over neighborlists
123 C Load shift vector for this list
126 shY = shiftvec(is3+1)
127 shZ = shiftvec(is3+2)
129 C Load limits for loop over neighbors
133 C Get outer coordinate index
137 C Load i atom data, add shift vector
138 ix1 = shX + pos(ii3+0)
139 iy1 = shY + pos(ii3+1)
140 iz1 = shZ + pos(ii3+2)
142 C Load parameters for i atom
143 iq = facel*charge(ii)
144 nti = 3*ntype*type(ii)
146 C Zero the potential energy for this list
150 C Clear i atom forces
157 C Get j neighbor index, and coordinate index
161 C load j atom coordinates
170 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
172 C Calculate 1/r and 1/r2
174 C PowerPC intrinsics 1/sqrt lookup table
176 rinv11 = frsqrtes(rsq11)
178 rinv11 = frsqrte(dble(rsq11))
180 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
183 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
187 C Load parameters for j atom
189 tj = nti+3*type(jnr)+1
191 cexp1 = vdwparam(tj+1)
192 cexp2 = vdwparam(tj+2)
193 rinvsq = rinv11*rinv11
195 C Coulomb reaction-field interaction
197 vcoul = qq*(rinv11+krsq-crf)
200 C Buckingham interaction
201 rinvsix = rinvsq*rinvsq*rinvsq
203 br = cexp2*rsq11*rinv11
204 Vvdwexp = cexp1*exp(-br)
205 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6
206 fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp
209 C Calculate temporary vectorial force
214 C Increment i atom force
219 C Decrement j atom force
220 faction(j3+0) = faction(j3+0) - tx
221 faction(j3+1) = faction(j3+1) - ty
222 faction(j3+2) = faction(j3+2) - tz
224 C Inner loop uses 71 flops/iteration
228 C Add i forces to mem and shifted force list
229 faction(ii3+0) = faction(ii3+0) + fix1
230 faction(ii3+1) = faction(ii3+1) + fiy1
231 faction(ii3+2) = faction(ii3+2) + fiz1
232 fshift(is3) = fshift(is3)+fix1
233 fshift(is3+1) = fshift(is3+1)+fiy1
234 fshift(is3+2) = fshift(is3+2)+fiz1
236 C Add potential energies to the group for this list
238 Vc(ggid) = Vc(ggid) + vctot
239 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
241 C Increment number of inner iterations
242 ninner = ninner + nj1 - nj0
244 C Outer loop uses 12 flops/iteration
248 C Increment number of outer iterations
249 nouter = nouter + nn1 - nn0
250 if(nn1.lt.nri) goto 10
252 C Write outer/inner iteration count to pointers
264 C Gromacs nonbonded kernel pwr6kernel220nf
265 C Coulomb interaction: Reaction field
266 C VdW interaction: Buckingham
267 C water optimization: No
268 C Calculate forces: no
270 subroutine pwr6kernel220nf(
303 integer*4 nri,iinr(*),jindex(*),jjnr(*),shift(*)
304 gmxreal shiftvec(*),fshift(*),pos(*),faction(*)
305 integer*4 gid(*),type(*),ntype
306 gmxreal charge(*),facel,krf,crf,Vc(*),vdwparam(*)
307 gmxreal Vvdw(*),tabscale,VFtab(*)
308 gmxreal invsqrta(*),dvda(*),gbtabscale,GBtab(*)
309 integer*4 nthreads,count,mtx,outeriter,inneriter
312 integer*4 n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid
313 integer*4 nn0,nn1,nouter,ninner
317 gmxreal qq,vcoul,vctot
321 gmxreal Vvdw6,Vvdwtot
326 gmxreal dx11,dy11,dz11,rsq11,rinv11
327 gmxreal c6,cexp1,cexp2
330 C Reset outer and inner iteration counters
334 C Loop over thread workunits
335 10 call pwr6kernelsync(mtx,count,nri,nthreads,nn0,nn1)
336 if(nn1.gt.nri) nn1=nri
338 C Start outer loop over neighborlists
342 C Load shift vector for this list
345 shY = shiftvec(is3+1)
346 shZ = shiftvec(is3+2)
348 C Load limits for loop over neighbors
352 C Get outer coordinate index
356 C Load i atom data, add shift vector
357 ix1 = shX + pos(ii3+0)
358 iy1 = shY + pos(ii3+1)
359 iz1 = shZ + pos(ii3+2)
361 C Load parameters for i atom
362 iq = facel*charge(ii)
363 nti = 3*ntype*type(ii)
365 C Zero the potential energy for this list
369 C Clear i atom forces
373 C Get j neighbor index, and coordinate index
377 C load j atom coordinates
386 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11
388 C Calculate 1/r and 1/r2
390 C PowerPC intrinsics 1/sqrt lookup table
392 rinv11 = frsqrtes(rsq11)
394 rinv11 = frsqrte(dble(rsq11))
396 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
399 rinv11 = (0.5*rinv11*(3.0-((rsq11*rinv11)
403 C Load parameters for j atom
405 tj = nti+3*type(jnr)+1
407 cexp1 = vdwparam(tj+1)
408 cexp2 = vdwparam(tj+2)
409 rinvsq = rinv11*rinv11
411 C Coulomb reaction-field interaction
413 vcoul = qq*(rinv11+krsq-crf)
416 C Buckingham interaction
417 rinvsix = rinvsq*rinvsq*rinvsq
419 br = cexp2*rsq11*rinv11
420 Vvdwexp = cexp1*exp(-br)
421 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6
423 C Inner loop uses 55 flops/iteration
427 C Add i forces to mem and shifted force list
429 C Add potential energies to the group for this list
431 Vc(ggid) = Vc(ggid) + vctot
432 Vvdw(ggid) = Vvdw(ggid) + Vvdwtot
434 C Increment number of inner iterations
435 ninner = ninner + nj1 - nj0
437 C Outer loop uses 6 flops/iteration
441 C Increment number of outer iterations
442 nouter = nouter + nn1 - nn0
443 if(nn1.lt.nri) goto 10
445 C Write outer/inner iteration count to pointers