File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwCSTab_GeomW4W4_c.c |
Location: | line 787, column 5 |
Description: | Value stored to 'gid' is never read |
1 | /* |
2 | * This file is part of the GROMACS molecular simulation package. |
3 | * |
4 | * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by |
5 | * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, |
6 | * and including many others, as listed in the AUTHORS file in the |
7 | * top-level source directory and at http://www.gromacs.org. |
8 | * |
9 | * GROMACS is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU Lesser General Public License |
11 | * as published by the Free Software Foundation; either version 2.1 |
12 | * of the License, or (at your option) any later version. |
13 | * |
14 | * GROMACS is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Lesser General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU Lesser General Public |
20 | * License along with GROMACS; if not, see |
21 | * http://www.gnu.org/licenses, or write to the Free Software Foundation, |
22 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
23 | * |
24 | * If you want to redistribute modifications to GROMACS, please |
25 | * consider that scientific software is very special. Version |
26 | * control is crucial - bugs must be traceable. We will be happy to |
27 | * consider code for inclusion in the official distribution, but |
28 | * derived work must not be called official GROMACS. Details are found |
29 | * in the README & COPYING files - if they are missing, get the |
30 | * official version at http://www.gromacs.org. |
31 | * |
32 | * To help us fund GROMACS development, we humbly ask that you cite |
33 | * the research papers on the package. Check out http://www.gromacs.org. |
34 | */ |
35 | /* |
36 | * Note: this file was generated by the GROMACS c kernel generator. |
37 | */ |
38 | #ifdef HAVE_CONFIG_H1 |
39 | #include <config.h> |
40 | #endif |
41 | |
42 | #include <math.h> |
43 | |
44 | #include "../nb_kernel.h" |
45 | #include "types/simple.h" |
46 | #include "gromacs/math/vec.h" |
47 | #include "nrnb.h" |
48 | |
49 | /* |
50 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4W4_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: CubicSplineTable |
53 | * Geometry: Water4-Water4 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEw_VdwCSTab_GeomW4W4_VF_c |
58 | (t_nblist * gmx_restrict__restrict nlist, |
59 | rvec * gmx_restrict__restrict xx, |
60 | rvec * gmx_restrict__restrict ff, |
61 | t_forcerec * gmx_restrict__restrict fr, |
62 | t_mdatoms * gmx_restrict__restrict mdatoms, |
63 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
64 | t_nrnb * gmx_restrict__restrict nrnb) |
65 | { |
66 | int i_shift_offset,i_coord_offset,j_coord_offset; |
67 | int j_index_start,j_index_end; |
68 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
69 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
70 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
71 | real *shiftvec,*fshift,*x,*f; |
72 | int vdwioffset0; |
73 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
74 | int vdwioffset1; |
75 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
76 | int vdwioffset2; |
77 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
78 | int vdwioffset3; |
79 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
80 | int vdwjidx0; |
81 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
82 | int vdwjidx1; |
83 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
84 | int vdwjidx2; |
85 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
86 | int vdwjidx3; |
87 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
88 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
89 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
90 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
91 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
92 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
93 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
94 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
95 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
96 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
97 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
98 | real velec,felec,velecsum,facel,crf,krf,krf2; |
99 | real *charge; |
100 | int nvdwtype; |
101 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
102 | int *vdwtype; |
103 | real *vdwparam; |
104 | int vfitab; |
105 | real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF; |
106 | real *vftab; |
107 | int ewitab; |
108 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
109 | real *ewtab; |
110 | |
111 | x = xx[0]; |
112 | f = ff[0]; |
113 | |
114 | nri = nlist->nri; |
115 | iinr = nlist->iinr; |
116 | jindex = nlist->jindex; |
117 | jjnr = nlist->jjnr; |
118 | shiftidx = nlist->shift; |
119 | gid = nlist->gid; |
120 | shiftvec = fr->shift_vec[0]; |
121 | fshift = fr->fshift[0]; |
122 | facel = fr->epsfac; |
123 | charge = mdatoms->chargeA; |
124 | nvdwtype = fr->ntype; |
125 | vdwparam = fr->nbfp; |
126 | vdwtype = mdatoms->typeA; |
127 | |
128 | vftab = kernel_data->table_vdw->data; |
129 | vftabscale = kernel_data->table_vdw->scale; |
130 | |
131 | sh_ewald = fr->ic->sh_ewald; |
132 | ewtab = fr->ic->tabq_coul_FDV0; |
133 | ewtabscale = fr->ic->tabq_scale; |
134 | ewtabhalfspace = 0.5/ewtabscale; |
135 | |
136 | /* Setup water-specific parameters */ |
137 | inr = nlist->iinr[0]; |
138 | iq1 = facel*charge[inr+1]; |
139 | iq2 = facel*charge[inr+2]; |
140 | iq3 = facel*charge[inr+3]; |
141 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
142 | |
143 | jq1 = charge[inr+1]; |
144 | jq2 = charge[inr+2]; |
145 | jq3 = charge[inr+3]; |
146 | vdwjidx0 = 2*vdwtype[inr+0]; |
147 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
148 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
149 | qq11 = iq1*jq1; |
150 | qq12 = iq1*jq2; |
151 | qq13 = iq1*jq3; |
152 | qq21 = iq2*jq1; |
153 | qq22 = iq2*jq2; |
154 | qq23 = iq2*jq3; |
155 | qq31 = iq3*jq1; |
156 | qq32 = iq3*jq2; |
157 | qq33 = iq3*jq3; |
158 | |
159 | outeriter = 0; |
160 | inneriter = 0; |
161 | |
162 | /* Start outer loop over neighborlists */ |
163 | for(iidx=0; iidx<nri; iidx++) |
164 | { |
165 | /* Load shift vector for this list */ |
166 | i_shift_offset = DIM3*shiftidx[iidx]; |
167 | shX = shiftvec[i_shift_offset+XX0]; |
168 | shY = shiftvec[i_shift_offset+YY1]; |
169 | shZ = shiftvec[i_shift_offset+ZZ2]; |
170 | |
171 | /* Load limits for loop over neighbors */ |
172 | j_index_start = jindex[iidx]; |
173 | j_index_end = jindex[iidx+1]; |
174 | |
175 | /* Get outer coordinate index */ |
176 | inr = iinr[iidx]; |
177 | i_coord_offset = DIM3*inr; |
178 | |
179 | /* Load i particle coords and add shift vector */ |
180 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
181 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
182 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
183 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
184 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
185 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
186 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
187 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
188 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
189 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
190 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
191 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
192 | |
193 | fix0 = 0.0; |
194 | fiy0 = 0.0; |
195 | fiz0 = 0.0; |
196 | fix1 = 0.0; |
197 | fiy1 = 0.0; |
198 | fiz1 = 0.0; |
199 | fix2 = 0.0; |
200 | fiy2 = 0.0; |
201 | fiz2 = 0.0; |
202 | fix3 = 0.0; |
203 | fiy3 = 0.0; |
204 | fiz3 = 0.0; |
205 | |
206 | /* Reset potential sums */ |
207 | velecsum = 0.0; |
208 | vvdwsum = 0.0; |
209 | |
210 | /* Start inner kernel loop */ |
211 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
212 | { |
213 | /* Get j neighbor index, and coordinate index */ |
214 | jnr = jjnr[jidx]; |
215 | j_coord_offset = DIM3*jnr; |
216 | |
217 | /* load j atom coordinates */ |
218 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
219 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
220 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
221 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
222 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
223 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
224 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
225 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
226 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
227 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
228 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
229 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
230 | |
231 | /* Calculate displacement vector */ |
232 | dx00 = ix0 - jx0; |
233 | dy00 = iy0 - jy0; |
234 | dz00 = iz0 - jz0; |
235 | dx11 = ix1 - jx1; |
236 | dy11 = iy1 - jy1; |
237 | dz11 = iz1 - jz1; |
238 | dx12 = ix1 - jx2; |
239 | dy12 = iy1 - jy2; |
240 | dz12 = iz1 - jz2; |
241 | dx13 = ix1 - jx3; |
242 | dy13 = iy1 - jy3; |
243 | dz13 = iz1 - jz3; |
244 | dx21 = ix2 - jx1; |
245 | dy21 = iy2 - jy1; |
246 | dz21 = iz2 - jz1; |
247 | dx22 = ix2 - jx2; |
248 | dy22 = iy2 - jy2; |
249 | dz22 = iz2 - jz2; |
250 | dx23 = ix2 - jx3; |
251 | dy23 = iy2 - jy3; |
252 | dz23 = iz2 - jz3; |
253 | dx31 = ix3 - jx1; |
254 | dy31 = iy3 - jy1; |
255 | dz31 = iz3 - jz1; |
256 | dx32 = ix3 - jx2; |
257 | dy32 = iy3 - jy2; |
258 | dz32 = iz3 - jz2; |
259 | dx33 = ix3 - jx3; |
260 | dy33 = iy3 - jy3; |
261 | dz33 = iz3 - jz3; |
262 | |
263 | /* Calculate squared distance and things based on it */ |
264 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
265 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
266 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
267 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
268 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
269 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
270 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
271 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
272 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
273 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
274 | |
275 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
276 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
277 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
278 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
279 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
280 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
281 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
282 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
283 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
284 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
285 | |
286 | rinvsq11 = rinv11*rinv11; |
287 | rinvsq12 = rinv12*rinv12; |
288 | rinvsq13 = rinv13*rinv13; |
289 | rinvsq21 = rinv21*rinv21; |
290 | rinvsq22 = rinv22*rinv22; |
291 | rinvsq23 = rinv23*rinv23; |
292 | rinvsq31 = rinv31*rinv31; |
293 | rinvsq32 = rinv32*rinv32; |
294 | rinvsq33 = rinv33*rinv33; |
295 | |
296 | /************************** |
297 | * CALCULATE INTERACTIONS * |
298 | **************************/ |
299 | |
300 | r00 = rsq00*rinv00; |
301 | |
302 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
303 | rt = r00*vftabscale; |
304 | vfitab = rt; |
305 | vfeps = rt-vfitab; |
306 | vfitab = 2*4*vfitab; |
307 | |
308 | /* CUBIC SPLINE TABLE DISPERSION */ |
309 | vfitab += 0; |
310 | Y = vftab[vfitab]; |
311 | F = vftab[vfitab+1]; |
312 | Geps = vfeps*vftab[vfitab+2]; |
313 | Heps2 = vfeps*vfeps*vftab[vfitab+3]; |
314 | Fp = F+Geps+Heps2; |
315 | VV = Y+vfeps*Fp; |
316 | vvdw6 = c6_00*VV; |
317 | FF = Fp+Geps+2.0*Heps2; |
318 | fvdw6 = c6_00*FF; |
319 | |
320 | /* CUBIC SPLINE TABLE REPULSION */ |
321 | Y = vftab[vfitab+4]; |
322 | F = vftab[vfitab+5]; |
323 | Geps = vfeps*vftab[vfitab+6]; |
324 | Heps2 = vfeps*vfeps*vftab[vfitab+7]; |
325 | Fp = F+Geps+Heps2; |
326 | VV = Y+vfeps*Fp; |
327 | vvdw12 = c12_00*VV; |
328 | FF = Fp+Geps+2.0*Heps2; |
329 | fvdw12 = c12_00*FF; |
330 | vvdw = vvdw12+vvdw6; |
331 | fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00; |
332 | |
333 | /* Update potential sums from outer loop */ |
334 | vvdwsum += vvdw; |
335 | |
336 | fscal = fvdw; |
337 | |
338 | /* Calculate temporary vectorial force */ |
339 | tx = fscal*dx00; |
340 | ty = fscal*dy00; |
341 | tz = fscal*dz00; |
342 | |
343 | /* Update vectorial force */ |
344 | fix0 += tx; |
345 | fiy0 += ty; |
346 | fiz0 += tz; |
347 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
348 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
349 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
350 | |
351 | /************************** |
352 | * CALCULATE INTERACTIONS * |
353 | **************************/ |
354 | |
355 | r11 = rsq11*rinv11; |
356 | |
357 | /* EWALD ELECTROSTATICS */ |
358 | |
359 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
360 | ewrt = r11*ewtabscale; |
361 | ewitab = ewrt; |
362 | eweps = ewrt-ewitab; |
363 | ewitab = 4*ewitab; |
364 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
365 | velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
366 | felec = qq11*rinv11*(rinvsq11-felec); |
367 | |
368 | /* Update potential sums from outer loop */ |
369 | velecsum += velec; |
370 | |
371 | fscal = felec; |
372 | |
373 | /* Calculate temporary vectorial force */ |
374 | tx = fscal*dx11; |
375 | ty = fscal*dy11; |
376 | tz = fscal*dz11; |
377 | |
378 | /* Update vectorial force */ |
379 | fix1 += tx; |
380 | fiy1 += ty; |
381 | fiz1 += tz; |
382 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
383 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
384 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
385 | |
386 | /************************** |
387 | * CALCULATE INTERACTIONS * |
388 | **************************/ |
389 | |
390 | r12 = rsq12*rinv12; |
391 | |
392 | /* EWALD ELECTROSTATICS */ |
393 | |
394 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
395 | ewrt = r12*ewtabscale; |
396 | ewitab = ewrt; |
397 | eweps = ewrt-ewitab; |
398 | ewitab = 4*ewitab; |
399 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
400 | velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
401 | felec = qq12*rinv12*(rinvsq12-felec); |
402 | |
403 | /* Update potential sums from outer loop */ |
404 | velecsum += velec; |
405 | |
406 | fscal = felec; |
407 | |
408 | /* Calculate temporary vectorial force */ |
409 | tx = fscal*dx12; |
410 | ty = fscal*dy12; |
411 | tz = fscal*dz12; |
412 | |
413 | /* Update vectorial force */ |
414 | fix1 += tx; |
415 | fiy1 += ty; |
416 | fiz1 += tz; |
417 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
418 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
419 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
420 | |
421 | /************************** |
422 | * CALCULATE INTERACTIONS * |
423 | **************************/ |
424 | |
425 | r13 = rsq13*rinv13; |
426 | |
427 | /* EWALD ELECTROSTATICS */ |
428 | |
429 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
430 | ewrt = r13*ewtabscale; |
431 | ewitab = ewrt; |
432 | eweps = ewrt-ewitab; |
433 | ewitab = 4*ewitab; |
434 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
435 | velec = qq13*(rinv13-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
436 | felec = qq13*rinv13*(rinvsq13-felec); |
437 | |
438 | /* Update potential sums from outer loop */ |
439 | velecsum += velec; |
440 | |
441 | fscal = felec; |
442 | |
443 | /* Calculate temporary vectorial force */ |
444 | tx = fscal*dx13; |
445 | ty = fscal*dy13; |
446 | tz = fscal*dz13; |
447 | |
448 | /* Update vectorial force */ |
449 | fix1 += tx; |
450 | fiy1 += ty; |
451 | fiz1 += tz; |
452 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
453 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
454 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
455 | |
456 | /************************** |
457 | * CALCULATE INTERACTIONS * |
458 | **************************/ |
459 | |
460 | r21 = rsq21*rinv21; |
461 | |
462 | /* EWALD ELECTROSTATICS */ |
463 | |
464 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
465 | ewrt = r21*ewtabscale; |
466 | ewitab = ewrt; |
467 | eweps = ewrt-ewitab; |
468 | ewitab = 4*ewitab; |
469 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
470 | velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
471 | felec = qq21*rinv21*(rinvsq21-felec); |
472 | |
473 | /* Update potential sums from outer loop */ |
474 | velecsum += velec; |
475 | |
476 | fscal = felec; |
477 | |
478 | /* Calculate temporary vectorial force */ |
479 | tx = fscal*dx21; |
480 | ty = fscal*dy21; |
481 | tz = fscal*dz21; |
482 | |
483 | /* Update vectorial force */ |
484 | fix2 += tx; |
485 | fiy2 += ty; |
486 | fiz2 += tz; |
487 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
488 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
489 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
490 | |
491 | /************************** |
492 | * CALCULATE INTERACTIONS * |
493 | **************************/ |
494 | |
495 | r22 = rsq22*rinv22; |
496 | |
497 | /* EWALD ELECTROSTATICS */ |
498 | |
499 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
500 | ewrt = r22*ewtabscale; |
501 | ewitab = ewrt; |
502 | eweps = ewrt-ewitab; |
503 | ewitab = 4*ewitab; |
504 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
505 | velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
506 | felec = qq22*rinv22*(rinvsq22-felec); |
507 | |
508 | /* Update potential sums from outer loop */ |
509 | velecsum += velec; |
510 | |
511 | fscal = felec; |
512 | |
513 | /* Calculate temporary vectorial force */ |
514 | tx = fscal*dx22; |
515 | ty = fscal*dy22; |
516 | tz = fscal*dz22; |
517 | |
518 | /* Update vectorial force */ |
519 | fix2 += tx; |
520 | fiy2 += ty; |
521 | fiz2 += tz; |
522 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
523 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
524 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
525 | |
526 | /************************** |
527 | * CALCULATE INTERACTIONS * |
528 | **************************/ |
529 | |
530 | r23 = rsq23*rinv23; |
531 | |
532 | /* EWALD ELECTROSTATICS */ |
533 | |
534 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
535 | ewrt = r23*ewtabscale; |
536 | ewitab = ewrt; |
537 | eweps = ewrt-ewitab; |
538 | ewitab = 4*ewitab; |
539 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
540 | velec = qq23*(rinv23-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
541 | felec = qq23*rinv23*(rinvsq23-felec); |
542 | |
543 | /* Update potential sums from outer loop */ |
544 | velecsum += velec; |
545 | |
546 | fscal = felec; |
547 | |
548 | /* Calculate temporary vectorial force */ |
549 | tx = fscal*dx23; |
550 | ty = fscal*dy23; |
551 | tz = fscal*dz23; |
552 | |
553 | /* Update vectorial force */ |
554 | fix2 += tx; |
555 | fiy2 += ty; |
556 | fiz2 += tz; |
557 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
558 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
559 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
560 | |
561 | /************************** |
562 | * CALCULATE INTERACTIONS * |
563 | **************************/ |
564 | |
565 | r31 = rsq31*rinv31; |
566 | |
567 | /* EWALD ELECTROSTATICS */ |
568 | |
569 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
570 | ewrt = r31*ewtabscale; |
571 | ewitab = ewrt; |
572 | eweps = ewrt-ewitab; |
573 | ewitab = 4*ewitab; |
574 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
575 | velec = qq31*(rinv31-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
576 | felec = qq31*rinv31*(rinvsq31-felec); |
577 | |
578 | /* Update potential sums from outer loop */ |
579 | velecsum += velec; |
580 | |
581 | fscal = felec; |
582 | |
583 | /* Calculate temporary vectorial force */ |
584 | tx = fscal*dx31; |
585 | ty = fscal*dy31; |
586 | tz = fscal*dz31; |
587 | |
588 | /* Update vectorial force */ |
589 | fix3 += tx; |
590 | fiy3 += ty; |
591 | fiz3 += tz; |
592 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
593 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
594 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
595 | |
596 | /************************** |
597 | * CALCULATE INTERACTIONS * |
598 | **************************/ |
599 | |
600 | r32 = rsq32*rinv32; |
601 | |
602 | /* EWALD ELECTROSTATICS */ |
603 | |
604 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
605 | ewrt = r32*ewtabscale; |
606 | ewitab = ewrt; |
607 | eweps = ewrt-ewitab; |
608 | ewitab = 4*ewitab; |
609 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
610 | velec = qq32*(rinv32-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
611 | felec = qq32*rinv32*(rinvsq32-felec); |
612 | |
613 | /* Update potential sums from outer loop */ |
614 | velecsum += velec; |
615 | |
616 | fscal = felec; |
617 | |
618 | /* Calculate temporary vectorial force */ |
619 | tx = fscal*dx32; |
620 | ty = fscal*dy32; |
621 | tz = fscal*dz32; |
622 | |
623 | /* Update vectorial force */ |
624 | fix3 += tx; |
625 | fiy3 += ty; |
626 | fiz3 += tz; |
627 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
628 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
629 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
630 | |
631 | /************************** |
632 | * CALCULATE INTERACTIONS * |
633 | **************************/ |
634 | |
635 | r33 = rsq33*rinv33; |
636 | |
637 | /* EWALD ELECTROSTATICS */ |
638 | |
639 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
640 | ewrt = r33*ewtabscale; |
641 | ewitab = ewrt; |
642 | eweps = ewrt-ewitab; |
643 | ewitab = 4*ewitab; |
644 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
645 | velec = qq33*(rinv33-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
646 | felec = qq33*rinv33*(rinvsq33-felec); |
647 | |
648 | /* Update potential sums from outer loop */ |
649 | velecsum += velec; |
650 | |
651 | fscal = felec; |
652 | |
653 | /* Calculate temporary vectorial force */ |
654 | tx = fscal*dx33; |
655 | ty = fscal*dy33; |
656 | tz = fscal*dz33; |
657 | |
658 | /* Update vectorial force */ |
659 | fix3 += tx; |
660 | fiy3 += ty; |
661 | fiz3 += tz; |
662 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
663 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
664 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
665 | |
666 | /* Inner loop uses 415 flops */ |
667 | } |
668 | /* End of innermost loop */ |
669 | |
670 | tx = ty = tz = 0; |
671 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
672 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
673 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
674 | tx += fix0; |
675 | ty += fiy0; |
676 | tz += fiz0; |
677 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
678 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
679 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
680 | tx += fix1; |
681 | ty += fiy1; |
682 | tz += fiz1; |
683 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
684 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
685 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
686 | tx += fix2; |
687 | ty += fiy2; |
688 | tz += fiz2; |
689 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
690 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
691 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
692 | tx += fix3; |
693 | ty += fiy3; |
694 | tz += fiz3; |
695 | fshift[i_shift_offset+XX0] += tx; |
696 | fshift[i_shift_offset+YY1] += ty; |
697 | fshift[i_shift_offset+ZZ2] += tz; |
698 | |
699 | ggid = gid[iidx]; |
700 | /* Update potential energies */ |
701 | kernel_data->energygrp_elec[ggid] += velecsum; |
702 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
703 | |
704 | /* Increment number of inner iterations */ |
705 | inneriter += j_index_end - j_index_start; |
706 | |
707 | /* Outer loop uses 41 flops */ |
708 | } |
709 | |
710 | /* Increment number of outer iterations */ |
711 | outeriter += nri; |
712 | |
713 | /* Update outer/inner flops */ |
714 | |
715 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*415)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_VF] += outeriter*41 + inneriter*415; |
716 | } |
717 | /* |
718 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4W4_F_c |
719 | * Electrostatics interaction: Ewald |
720 | * VdW interaction: CubicSplineTable |
721 | * Geometry: Water4-Water4 |
722 | * Calculate force/pot: Force |
723 | */ |
724 | void |
725 | nb_kernel_ElecEw_VdwCSTab_GeomW4W4_F_c |
726 | (t_nblist * gmx_restrict__restrict nlist, |
727 | rvec * gmx_restrict__restrict xx, |
728 | rvec * gmx_restrict__restrict ff, |
729 | t_forcerec * gmx_restrict__restrict fr, |
730 | t_mdatoms * gmx_restrict__restrict mdatoms, |
731 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
732 | t_nrnb * gmx_restrict__restrict nrnb) |
733 | { |
734 | int i_shift_offset,i_coord_offset,j_coord_offset; |
735 | int j_index_start,j_index_end; |
736 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
737 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
738 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
739 | real *shiftvec,*fshift,*x,*f; |
740 | int vdwioffset0; |
741 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
742 | int vdwioffset1; |
743 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
744 | int vdwioffset2; |
745 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
746 | int vdwioffset3; |
747 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
748 | int vdwjidx0; |
749 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
750 | int vdwjidx1; |
751 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
752 | int vdwjidx2; |
753 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
754 | int vdwjidx3; |
755 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
756 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
757 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
758 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
759 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
760 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
761 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
762 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
763 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
764 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
765 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
766 | real velec,felec,velecsum,facel,crf,krf,krf2; |
767 | real *charge; |
768 | int nvdwtype; |
769 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
770 | int *vdwtype; |
771 | real *vdwparam; |
772 | int vfitab; |
773 | real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF; |
774 | real *vftab; |
775 | int ewitab; |
776 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
777 | real *ewtab; |
778 | |
779 | x = xx[0]; |
780 | f = ff[0]; |
781 | |
782 | nri = nlist->nri; |
783 | iinr = nlist->iinr; |
784 | jindex = nlist->jindex; |
785 | jjnr = nlist->jjnr; |
786 | shiftidx = nlist->shift; |
787 | gid = nlist->gid; |
Value stored to 'gid' is never read | |
788 | shiftvec = fr->shift_vec[0]; |
789 | fshift = fr->fshift[0]; |
790 | facel = fr->epsfac; |
791 | charge = mdatoms->chargeA; |
792 | nvdwtype = fr->ntype; |
793 | vdwparam = fr->nbfp; |
794 | vdwtype = mdatoms->typeA; |
795 | |
796 | vftab = kernel_data->table_vdw->data; |
797 | vftabscale = kernel_data->table_vdw->scale; |
798 | |
799 | sh_ewald = fr->ic->sh_ewald; |
800 | ewtab = fr->ic->tabq_coul_F; |
801 | ewtabscale = fr->ic->tabq_scale; |
802 | ewtabhalfspace = 0.5/ewtabscale; |
803 | |
804 | /* Setup water-specific parameters */ |
805 | inr = nlist->iinr[0]; |
806 | iq1 = facel*charge[inr+1]; |
807 | iq2 = facel*charge[inr+2]; |
808 | iq3 = facel*charge[inr+3]; |
809 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
810 | |
811 | jq1 = charge[inr+1]; |
812 | jq2 = charge[inr+2]; |
813 | jq3 = charge[inr+3]; |
814 | vdwjidx0 = 2*vdwtype[inr+0]; |
815 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
816 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
817 | qq11 = iq1*jq1; |
818 | qq12 = iq1*jq2; |
819 | qq13 = iq1*jq3; |
820 | qq21 = iq2*jq1; |
821 | qq22 = iq2*jq2; |
822 | qq23 = iq2*jq3; |
823 | qq31 = iq3*jq1; |
824 | qq32 = iq3*jq2; |
825 | qq33 = iq3*jq3; |
826 | |
827 | outeriter = 0; |
828 | inneriter = 0; |
829 | |
830 | /* Start outer loop over neighborlists */ |
831 | for(iidx=0; iidx<nri; iidx++) |
832 | { |
833 | /* Load shift vector for this list */ |
834 | i_shift_offset = DIM3*shiftidx[iidx]; |
835 | shX = shiftvec[i_shift_offset+XX0]; |
836 | shY = shiftvec[i_shift_offset+YY1]; |
837 | shZ = shiftvec[i_shift_offset+ZZ2]; |
838 | |
839 | /* Load limits for loop over neighbors */ |
840 | j_index_start = jindex[iidx]; |
841 | j_index_end = jindex[iidx+1]; |
842 | |
843 | /* Get outer coordinate index */ |
844 | inr = iinr[iidx]; |
845 | i_coord_offset = DIM3*inr; |
846 | |
847 | /* Load i particle coords and add shift vector */ |
848 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
849 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
850 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
851 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
852 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
853 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
854 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
855 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
856 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
857 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
858 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
859 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
860 | |
861 | fix0 = 0.0; |
862 | fiy0 = 0.0; |
863 | fiz0 = 0.0; |
864 | fix1 = 0.0; |
865 | fiy1 = 0.0; |
866 | fiz1 = 0.0; |
867 | fix2 = 0.0; |
868 | fiy2 = 0.0; |
869 | fiz2 = 0.0; |
870 | fix3 = 0.0; |
871 | fiy3 = 0.0; |
872 | fiz3 = 0.0; |
873 | |
874 | /* Start inner kernel loop */ |
875 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
876 | { |
877 | /* Get j neighbor index, and coordinate index */ |
878 | jnr = jjnr[jidx]; |
879 | j_coord_offset = DIM3*jnr; |
880 | |
881 | /* load j atom coordinates */ |
882 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
883 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
884 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
885 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
886 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
887 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
888 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
889 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
890 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
891 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
892 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
893 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
894 | |
895 | /* Calculate displacement vector */ |
896 | dx00 = ix0 - jx0; |
897 | dy00 = iy0 - jy0; |
898 | dz00 = iz0 - jz0; |
899 | dx11 = ix1 - jx1; |
900 | dy11 = iy1 - jy1; |
901 | dz11 = iz1 - jz1; |
902 | dx12 = ix1 - jx2; |
903 | dy12 = iy1 - jy2; |
904 | dz12 = iz1 - jz2; |
905 | dx13 = ix1 - jx3; |
906 | dy13 = iy1 - jy3; |
907 | dz13 = iz1 - jz3; |
908 | dx21 = ix2 - jx1; |
909 | dy21 = iy2 - jy1; |
910 | dz21 = iz2 - jz1; |
911 | dx22 = ix2 - jx2; |
912 | dy22 = iy2 - jy2; |
913 | dz22 = iz2 - jz2; |
914 | dx23 = ix2 - jx3; |
915 | dy23 = iy2 - jy3; |
916 | dz23 = iz2 - jz3; |
917 | dx31 = ix3 - jx1; |
918 | dy31 = iy3 - jy1; |
919 | dz31 = iz3 - jz1; |
920 | dx32 = ix3 - jx2; |
921 | dy32 = iy3 - jy2; |
922 | dz32 = iz3 - jz2; |
923 | dx33 = ix3 - jx3; |
924 | dy33 = iy3 - jy3; |
925 | dz33 = iz3 - jz3; |
926 | |
927 | /* Calculate squared distance and things based on it */ |
928 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
929 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
930 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
931 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
932 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
933 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
934 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
935 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
936 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
937 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
938 | |
939 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
940 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
941 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
942 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
943 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
944 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
945 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
946 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
947 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
948 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
949 | |
950 | rinvsq11 = rinv11*rinv11; |
951 | rinvsq12 = rinv12*rinv12; |
952 | rinvsq13 = rinv13*rinv13; |
953 | rinvsq21 = rinv21*rinv21; |
954 | rinvsq22 = rinv22*rinv22; |
955 | rinvsq23 = rinv23*rinv23; |
956 | rinvsq31 = rinv31*rinv31; |
957 | rinvsq32 = rinv32*rinv32; |
958 | rinvsq33 = rinv33*rinv33; |
959 | |
960 | /************************** |
961 | * CALCULATE INTERACTIONS * |
962 | **************************/ |
963 | |
964 | r00 = rsq00*rinv00; |
965 | |
966 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
967 | rt = r00*vftabscale; |
968 | vfitab = rt; |
969 | vfeps = rt-vfitab; |
970 | vfitab = 2*4*vfitab; |
971 | |
972 | /* CUBIC SPLINE TABLE DISPERSION */ |
973 | vfitab += 0; |
974 | F = vftab[vfitab+1]; |
975 | Geps = vfeps*vftab[vfitab+2]; |
976 | Heps2 = vfeps*vfeps*vftab[vfitab+3]; |
977 | Fp = F+Geps+Heps2; |
978 | FF = Fp+Geps+2.0*Heps2; |
979 | fvdw6 = c6_00*FF; |
980 | |
981 | /* CUBIC SPLINE TABLE REPULSION */ |
982 | F = vftab[vfitab+5]; |
983 | Geps = vfeps*vftab[vfitab+6]; |
984 | Heps2 = vfeps*vfeps*vftab[vfitab+7]; |
985 | Fp = F+Geps+Heps2; |
986 | FF = Fp+Geps+2.0*Heps2; |
987 | fvdw12 = c12_00*FF; |
988 | fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00; |
989 | |
990 | fscal = fvdw; |
991 | |
992 | /* Calculate temporary vectorial force */ |
993 | tx = fscal*dx00; |
994 | ty = fscal*dy00; |
995 | tz = fscal*dz00; |
996 | |
997 | /* Update vectorial force */ |
998 | fix0 += tx; |
999 | fiy0 += ty; |
1000 | fiz0 += tz; |
1001 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
1002 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
1003 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
1004 | |
1005 | /************************** |
1006 | * CALCULATE INTERACTIONS * |
1007 | **************************/ |
1008 | |
1009 | r11 = rsq11*rinv11; |
1010 | |
1011 | /* EWALD ELECTROSTATICS */ |
1012 | |
1013 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1014 | ewrt = r11*ewtabscale; |
1015 | ewitab = ewrt; |
1016 | eweps = ewrt-ewitab; |
1017 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1018 | felec = qq11*rinv11*(rinvsq11-felec); |
1019 | |
1020 | fscal = felec; |
1021 | |
1022 | /* Calculate temporary vectorial force */ |
1023 | tx = fscal*dx11; |
1024 | ty = fscal*dy11; |
1025 | tz = fscal*dz11; |
1026 | |
1027 | /* Update vectorial force */ |
1028 | fix1 += tx; |
1029 | fiy1 += ty; |
1030 | fiz1 += tz; |
1031 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1032 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1033 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1034 | |
1035 | /************************** |
1036 | * CALCULATE INTERACTIONS * |
1037 | **************************/ |
1038 | |
1039 | r12 = rsq12*rinv12; |
1040 | |
1041 | /* EWALD ELECTROSTATICS */ |
1042 | |
1043 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1044 | ewrt = r12*ewtabscale; |
1045 | ewitab = ewrt; |
1046 | eweps = ewrt-ewitab; |
1047 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1048 | felec = qq12*rinv12*(rinvsq12-felec); |
1049 | |
1050 | fscal = felec; |
1051 | |
1052 | /* Calculate temporary vectorial force */ |
1053 | tx = fscal*dx12; |
1054 | ty = fscal*dy12; |
1055 | tz = fscal*dz12; |
1056 | |
1057 | /* Update vectorial force */ |
1058 | fix1 += tx; |
1059 | fiy1 += ty; |
1060 | fiz1 += tz; |
1061 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1062 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1063 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1064 | |
1065 | /************************** |
1066 | * CALCULATE INTERACTIONS * |
1067 | **************************/ |
1068 | |
1069 | r13 = rsq13*rinv13; |
1070 | |
1071 | /* EWALD ELECTROSTATICS */ |
1072 | |
1073 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1074 | ewrt = r13*ewtabscale; |
1075 | ewitab = ewrt; |
1076 | eweps = ewrt-ewitab; |
1077 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1078 | felec = qq13*rinv13*(rinvsq13-felec); |
1079 | |
1080 | fscal = felec; |
1081 | |
1082 | /* Calculate temporary vectorial force */ |
1083 | tx = fscal*dx13; |
1084 | ty = fscal*dy13; |
1085 | tz = fscal*dz13; |
1086 | |
1087 | /* Update vectorial force */ |
1088 | fix1 += tx; |
1089 | fiy1 += ty; |
1090 | fiz1 += tz; |
1091 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1092 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1093 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1094 | |
1095 | /************************** |
1096 | * CALCULATE INTERACTIONS * |
1097 | **************************/ |
1098 | |
1099 | r21 = rsq21*rinv21; |
1100 | |
1101 | /* EWALD ELECTROSTATICS */ |
1102 | |
1103 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1104 | ewrt = r21*ewtabscale; |
1105 | ewitab = ewrt; |
1106 | eweps = ewrt-ewitab; |
1107 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1108 | felec = qq21*rinv21*(rinvsq21-felec); |
1109 | |
1110 | fscal = felec; |
1111 | |
1112 | /* Calculate temporary vectorial force */ |
1113 | tx = fscal*dx21; |
1114 | ty = fscal*dy21; |
1115 | tz = fscal*dz21; |
1116 | |
1117 | /* Update vectorial force */ |
1118 | fix2 += tx; |
1119 | fiy2 += ty; |
1120 | fiz2 += tz; |
1121 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1122 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1123 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1124 | |
1125 | /************************** |
1126 | * CALCULATE INTERACTIONS * |
1127 | **************************/ |
1128 | |
1129 | r22 = rsq22*rinv22; |
1130 | |
1131 | /* EWALD ELECTROSTATICS */ |
1132 | |
1133 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1134 | ewrt = r22*ewtabscale; |
1135 | ewitab = ewrt; |
1136 | eweps = ewrt-ewitab; |
1137 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1138 | felec = qq22*rinv22*(rinvsq22-felec); |
1139 | |
1140 | fscal = felec; |
1141 | |
1142 | /* Calculate temporary vectorial force */ |
1143 | tx = fscal*dx22; |
1144 | ty = fscal*dy22; |
1145 | tz = fscal*dz22; |
1146 | |
1147 | /* Update vectorial force */ |
1148 | fix2 += tx; |
1149 | fiy2 += ty; |
1150 | fiz2 += tz; |
1151 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1152 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1153 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1154 | |
1155 | /************************** |
1156 | * CALCULATE INTERACTIONS * |
1157 | **************************/ |
1158 | |
1159 | r23 = rsq23*rinv23; |
1160 | |
1161 | /* EWALD ELECTROSTATICS */ |
1162 | |
1163 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1164 | ewrt = r23*ewtabscale; |
1165 | ewitab = ewrt; |
1166 | eweps = ewrt-ewitab; |
1167 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1168 | felec = qq23*rinv23*(rinvsq23-felec); |
1169 | |
1170 | fscal = felec; |
1171 | |
1172 | /* Calculate temporary vectorial force */ |
1173 | tx = fscal*dx23; |
1174 | ty = fscal*dy23; |
1175 | tz = fscal*dz23; |
1176 | |
1177 | /* Update vectorial force */ |
1178 | fix2 += tx; |
1179 | fiy2 += ty; |
1180 | fiz2 += tz; |
1181 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1182 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1183 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1184 | |
1185 | /************************** |
1186 | * CALCULATE INTERACTIONS * |
1187 | **************************/ |
1188 | |
1189 | r31 = rsq31*rinv31; |
1190 | |
1191 | /* EWALD ELECTROSTATICS */ |
1192 | |
1193 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1194 | ewrt = r31*ewtabscale; |
1195 | ewitab = ewrt; |
1196 | eweps = ewrt-ewitab; |
1197 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1198 | felec = qq31*rinv31*(rinvsq31-felec); |
1199 | |
1200 | fscal = felec; |
1201 | |
1202 | /* Calculate temporary vectorial force */ |
1203 | tx = fscal*dx31; |
1204 | ty = fscal*dy31; |
1205 | tz = fscal*dz31; |
1206 | |
1207 | /* Update vectorial force */ |
1208 | fix3 += tx; |
1209 | fiy3 += ty; |
1210 | fiz3 += tz; |
1211 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1212 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1213 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1214 | |
1215 | /************************** |
1216 | * CALCULATE INTERACTIONS * |
1217 | **************************/ |
1218 | |
1219 | r32 = rsq32*rinv32; |
1220 | |
1221 | /* EWALD ELECTROSTATICS */ |
1222 | |
1223 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1224 | ewrt = r32*ewtabscale; |
1225 | ewitab = ewrt; |
1226 | eweps = ewrt-ewitab; |
1227 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1228 | felec = qq32*rinv32*(rinvsq32-felec); |
1229 | |
1230 | fscal = felec; |
1231 | |
1232 | /* Calculate temporary vectorial force */ |
1233 | tx = fscal*dx32; |
1234 | ty = fscal*dy32; |
1235 | tz = fscal*dz32; |
1236 | |
1237 | /* Update vectorial force */ |
1238 | fix3 += tx; |
1239 | fiy3 += ty; |
1240 | fiz3 += tz; |
1241 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1242 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1243 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1244 | |
1245 | /************************** |
1246 | * CALCULATE INTERACTIONS * |
1247 | **************************/ |
1248 | |
1249 | r33 = rsq33*rinv33; |
1250 | |
1251 | /* EWALD ELECTROSTATICS */ |
1252 | |
1253 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1254 | ewrt = r33*ewtabscale; |
1255 | ewitab = ewrt; |
1256 | eweps = ewrt-ewitab; |
1257 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1258 | felec = qq33*rinv33*(rinvsq33-felec); |
1259 | |
1260 | fscal = felec; |
1261 | |
1262 | /* Calculate temporary vectorial force */ |
1263 | tx = fscal*dx33; |
1264 | ty = fscal*dy33; |
1265 | tz = fscal*dz33; |
1266 | |
1267 | /* Update vectorial force */ |
1268 | fix3 += tx; |
1269 | fiy3 += ty; |
1270 | fiz3 += tz; |
1271 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1272 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1273 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1274 | |
1275 | /* Inner loop uses 344 flops */ |
1276 | } |
1277 | /* End of innermost loop */ |
1278 | |
1279 | tx = ty = tz = 0; |
1280 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
1281 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
1282 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
1283 | tx += fix0; |
1284 | ty += fiy0; |
1285 | tz += fiz0; |
1286 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1287 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1288 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1289 | tx += fix1; |
1290 | ty += fiy1; |
1291 | tz += fiz1; |
1292 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1293 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1294 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1295 | tx += fix2; |
1296 | ty += fiy2; |
1297 | tz += fiz2; |
1298 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
1299 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
1300 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
1301 | tx += fix3; |
1302 | ty += fiy3; |
1303 | tz += fiz3; |
1304 | fshift[i_shift_offset+XX0] += tx; |
1305 | fshift[i_shift_offset+YY1] += ty; |
1306 | fshift[i_shift_offset+ZZ2] += tz; |
1307 | |
1308 | /* Increment number of inner iterations */ |
1309 | inneriter += j_index_end - j_index_start; |
1310 | |
1311 | /* Outer loop uses 39 flops */ |
1312 | } |
1313 | |
1314 | /* Increment number of outer iterations */ |
1315 | outeriter += nri; |
1316 | |
1317 | /* Update outer/inner flops */ |
1318 | |
1319 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*344)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_F] += outeriter*39 + inneriter *344; |
1320 | } |