File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwNone_GeomW4W4_c.c |
Location: | line 113, column 5 |
Description: | Value stored to 'sh_ewald' 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_VdwNone_GeomW4W4_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: None |
53 | * Geometry: Water4-Water4 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEw_VdwNone_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 vdwioffset1; |
73 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
74 | int vdwioffset2; |
75 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
76 | int vdwioffset3; |
77 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
78 | int vdwjidx1; |
79 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
80 | int vdwjidx2; |
81 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
82 | int vdwjidx3; |
83 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
84 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
85 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
86 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
87 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
88 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
89 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
90 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
91 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
92 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
93 | real velec,felec,velecsum,facel,crf,krf,krf2; |
94 | real *charge; |
95 | int ewitab; |
96 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
97 | real *ewtab; |
98 | |
99 | x = xx[0]; |
100 | f = ff[0]; |
101 | |
102 | nri = nlist->nri; |
103 | iinr = nlist->iinr; |
104 | jindex = nlist->jindex; |
105 | jjnr = nlist->jjnr; |
106 | shiftidx = nlist->shift; |
107 | gid = nlist->gid; |
108 | shiftvec = fr->shift_vec[0]; |
109 | fshift = fr->fshift[0]; |
110 | facel = fr->epsfac; |
111 | charge = mdatoms->chargeA; |
112 | |
113 | sh_ewald = fr->ic->sh_ewald; |
Value stored to 'sh_ewald' is never read | |
114 | ewtab = fr->ic->tabq_coul_FDV0; |
115 | ewtabscale = fr->ic->tabq_scale; |
116 | ewtabhalfspace = 0.5/ewtabscale; |
117 | |
118 | /* Setup water-specific parameters */ |
119 | inr = nlist->iinr[0]; |
120 | iq1 = facel*charge[inr+1]; |
121 | iq2 = facel*charge[inr+2]; |
122 | iq3 = facel*charge[inr+3]; |
123 | |
124 | jq1 = charge[inr+1]; |
125 | jq2 = charge[inr+2]; |
126 | jq3 = charge[inr+3]; |
127 | qq11 = iq1*jq1; |
128 | qq12 = iq1*jq2; |
129 | qq13 = iq1*jq3; |
130 | qq21 = iq2*jq1; |
131 | qq22 = iq2*jq2; |
132 | qq23 = iq2*jq3; |
133 | qq31 = iq3*jq1; |
134 | qq32 = iq3*jq2; |
135 | qq33 = iq3*jq3; |
136 | |
137 | outeriter = 0; |
138 | inneriter = 0; |
139 | |
140 | /* Start outer loop over neighborlists */ |
141 | for(iidx=0; iidx<nri; iidx++) |
142 | { |
143 | /* Load shift vector for this list */ |
144 | i_shift_offset = DIM3*shiftidx[iidx]; |
145 | shX = shiftvec[i_shift_offset+XX0]; |
146 | shY = shiftvec[i_shift_offset+YY1]; |
147 | shZ = shiftvec[i_shift_offset+ZZ2]; |
148 | |
149 | /* Load limits for loop over neighbors */ |
150 | j_index_start = jindex[iidx]; |
151 | j_index_end = jindex[iidx+1]; |
152 | |
153 | /* Get outer coordinate index */ |
154 | inr = iinr[iidx]; |
155 | i_coord_offset = DIM3*inr; |
156 | |
157 | /* Load i particle coords and add shift vector */ |
158 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
159 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
160 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
161 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
162 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
163 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
164 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
165 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
166 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
167 | |
168 | fix1 = 0.0; |
169 | fiy1 = 0.0; |
170 | fiz1 = 0.0; |
171 | fix2 = 0.0; |
172 | fiy2 = 0.0; |
173 | fiz2 = 0.0; |
174 | fix3 = 0.0; |
175 | fiy3 = 0.0; |
176 | fiz3 = 0.0; |
177 | |
178 | /* Reset potential sums */ |
179 | velecsum = 0.0; |
180 | |
181 | /* Start inner kernel loop */ |
182 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
183 | { |
184 | /* Get j neighbor index, and coordinate index */ |
185 | jnr = jjnr[jidx]; |
186 | j_coord_offset = DIM3*jnr; |
187 | |
188 | /* load j atom coordinates */ |
189 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
190 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
191 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
192 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
193 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
194 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
195 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
196 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
197 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
198 | |
199 | /* Calculate displacement vector */ |
200 | dx11 = ix1 - jx1; |
201 | dy11 = iy1 - jy1; |
202 | dz11 = iz1 - jz1; |
203 | dx12 = ix1 - jx2; |
204 | dy12 = iy1 - jy2; |
205 | dz12 = iz1 - jz2; |
206 | dx13 = ix1 - jx3; |
207 | dy13 = iy1 - jy3; |
208 | dz13 = iz1 - jz3; |
209 | dx21 = ix2 - jx1; |
210 | dy21 = iy2 - jy1; |
211 | dz21 = iz2 - jz1; |
212 | dx22 = ix2 - jx2; |
213 | dy22 = iy2 - jy2; |
214 | dz22 = iz2 - jz2; |
215 | dx23 = ix2 - jx3; |
216 | dy23 = iy2 - jy3; |
217 | dz23 = iz2 - jz3; |
218 | dx31 = ix3 - jx1; |
219 | dy31 = iy3 - jy1; |
220 | dz31 = iz3 - jz1; |
221 | dx32 = ix3 - jx2; |
222 | dy32 = iy3 - jy2; |
223 | dz32 = iz3 - jz2; |
224 | dx33 = ix3 - jx3; |
225 | dy33 = iy3 - jy3; |
226 | dz33 = iz3 - jz3; |
227 | |
228 | /* Calculate squared distance and things based on it */ |
229 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
230 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
231 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
232 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
233 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
234 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
235 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
236 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
237 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
238 | |
239 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
240 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
241 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
242 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
243 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
244 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
245 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
246 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
247 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
248 | |
249 | rinvsq11 = rinv11*rinv11; |
250 | rinvsq12 = rinv12*rinv12; |
251 | rinvsq13 = rinv13*rinv13; |
252 | rinvsq21 = rinv21*rinv21; |
253 | rinvsq22 = rinv22*rinv22; |
254 | rinvsq23 = rinv23*rinv23; |
255 | rinvsq31 = rinv31*rinv31; |
256 | rinvsq32 = rinv32*rinv32; |
257 | rinvsq33 = rinv33*rinv33; |
258 | |
259 | /************************** |
260 | * CALCULATE INTERACTIONS * |
261 | **************************/ |
262 | |
263 | r11 = rsq11*rinv11; |
264 | |
265 | /* EWALD ELECTROSTATICS */ |
266 | |
267 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
268 | ewrt = r11*ewtabscale; |
269 | ewitab = ewrt; |
270 | eweps = ewrt-ewitab; |
271 | ewitab = 4*ewitab; |
272 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
273 | velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
274 | felec = qq11*rinv11*(rinvsq11-felec); |
275 | |
276 | /* Update potential sums from outer loop */ |
277 | velecsum += velec; |
278 | |
279 | fscal = felec; |
280 | |
281 | /* Calculate temporary vectorial force */ |
282 | tx = fscal*dx11; |
283 | ty = fscal*dy11; |
284 | tz = fscal*dz11; |
285 | |
286 | /* Update vectorial force */ |
287 | fix1 += tx; |
288 | fiy1 += ty; |
289 | fiz1 += tz; |
290 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
291 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
292 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
293 | |
294 | /************************** |
295 | * CALCULATE INTERACTIONS * |
296 | **************************/ |
297 | |
298 | r12 = rsq12*rinv12; |
299 | |
300 | /* EWALD ELECTROSTATICS */ |
301 | |
302 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
303 | ewrt = r12*ewtabscale; |
304 | ewitab = ewrt; |
305 | eweps = ewrt-ewitab; |
306 | ewitab = 4*ewitab; |
307 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
308 | velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
309 | felec = qq12*rinv12*(rinvsq12-felec); |
310 | |
311 | /* Update potential sums from outer loop */ |
312 | velecsum += velec; |
313 | |
314 | fscal = felec; |
315 | |
316 | /* Calculate temporary vectorial force */ |
317 | tx = fscal*dx12; |
318 | ty = fscal*dy12; |
319 | tz = fscal*dz12; |
320 | |
321 | /* Update vectorial force */ |
322 | fix1 += tx; |
323 | fiy1 += ty; |
324 | fiz1 += tz; |
325 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
326 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
327 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
328 | |
329 | /************************** |
330 | * CALCULATE INTERACTIONS * |
331 | **************************/ |
332 | |
333 | r13 = rsq13*rinv13; |
334 | |
335 | /* EWALD ELECTROSTATICS */ |
336 | |
337 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
338 | ewrt = r13*ewtabscale; |
339 | ewitab = ewrt; |
340 | eweps = ewrt-ewitab; |
341 | ewitab = 4*ewitab; |
342 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
343 | velec = qq13*(rinv13-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
344 | felec = qq13*rinv13*(rinvsq13-felec); |
345 | |
346 | /* Update potential sums from outer loop */ |
347 | velecsum += velec; |
348 | |
349 | fscal = felec; |
350 | |
351 | /* Calculate temporary vectorial force */ |
352 | tx = fscal*dx13; |
353 | ty = fscal*dy13; |
354 | tz = fscal*dz13; |
355 | |
356 | /* Update vectorial force */ |
357 | fix1 += tx; |
358 | fiy1 += ty; |
359 | fiz1 += tz; |
360 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
361 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
362 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
363 | |
364 | /************************** |
365 | * CALCULATE INTERACTIONS * |
366 | **************************/ |
367 | |
368 | r21 = rsq21*rinv21; |
369 | |
370 | /* EWALD ELECTROSTATICS */ |
371 | |
372 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
373 | ewrt = r21*ewtabscale; |
374 | ewitab = ewrt; |
375 | eweps = ewrt-ewitab; |
376 | ewitab = 4*ewitab; |
377 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
378 | velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
379 | felec = qq21*rinv21*(rinvsq21-felec); |
380 | |
381 | /* Update potential sums from outer loop */ |
382 | velecsum += velec; |
383 | |
384 | fscal = felec; |
385 | |
386 | /* Calculate temporary vectorial force */ |
387 | tx = fscal*dx21; |
388 | ty = fscal*dy21; |
389 | tz = fscal*dz21; |
390 | |
391 | /* Update vectorial force */ |
392 | fix2 += tx; |
393 | fiy2 += ty; |
394 | fiz2 += tz; |
395 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
396 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
397 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
398 | |
399 | /************************** |
400 | * CALCULATE INTERACTIONS * |
401 | **************************/ |
402 | |
403 | r22 = rsq22*rinv22; |
404 | |
405 | /* EWALD ELECTROSTATICS */ |
406 | |
407 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
408 | ewrt = r22*ewtabscale; |
409 | ewitab = ewrt; |
410 | eweps = ewrt-ewitab; |
411 | ewitab = 4*ewitab; |
412 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
413 | velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
414 | felec = qq22*rinv22*(rinvsq22-felec); |
415 | |
416 | /* Update potential sums from outer loop */ |
417 | velecsum += velec; |
418 | |
419 | fscal = felec; |
420 | |
421 | /* Calculate temporary vectorial force */ |
422 | tx = fscal*dx22; |
423 | ty = fscal*dy22; |
424 | tz = fscal*dz22; |
425 | |
426 | /* Update vectorial force */ |
427 | fix2 += tx; |
428 | fiy2 += ty; |
429 | fiz2 += tz; |
430 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
431 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
432 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
433 | |
434 | /************************** |
435 | * CALCULATE INTERACTIONS * |
436 | **************************/ |
437 | |
438 | r23 = rsq23*rinv23; |
439 | |
440 | /* EWALD ELECTROSTATICS */ |
441 | |
442 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
443 | ewrt = r23*ewtabscale; |
444 | ewitab = ewrt; |
445 | eweps = ewrt-ewitab; |
446 | ewitab = 4*ewitab; |
447 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
448 | velec = qq23*(rinv23-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
449 | felec = qq23*rinv23*(rinvsq23-felec); |
450 | |
451 | /* Update potential sums from outer loop */ |
452 | velecsum += velec; |
453 | |
454 | fscal = felec; |
455 | |
456 | /* Calculate temporary vectorial force */ |
457 | tx = fscal*dx23; |
458 | ty = fscal*dy23; |
459 | tz = fscal*dz23; |
460 | |
461 | /* Update vectorial force */ |
462 | fix2 += tx; |
463 | fiy2 += ty; |
464 | fiz2 += tz; |
465 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
466 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
467 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
468 | |
469 | /************************** |
470 | * CALCULATE INTERACTIONS * |
471 | **************************/ |
472 | |
473 | r31 = rsq31*rinv31; |
474 | |
475 | /* EWALD ELECTROSTATICS */ |
476 | |
477 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
478 | ewrt = r31*ewtabscale; |
479 | ewitab = ewrt; |
480 | eweps = ewrt-ewitab; |
481 | ewitab = 4*ewitab; |
482 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
483 | velec = qq31*(rinv31-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
484 | felec = qq31*rinv31*(rinvsq31-felec); |
485 | |
486 | /* Update potential sums from outer loop */ |
487 | velecsum += velec; |
488 | |
489 | fscal = felec; |
490 | |
491 | /* Calculate temporary vectorial force */ |
492 | tx = fscal*dx31; |
493 | ty = fscal*dy31; |
494 | tz = fscal*dz31; |
495 | |
496 | /* Update vectorial force */ |
497 | fix3 += tx; |
498 | fiy3 += ty; |
499 | fiz3 += tz; |
500 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
501 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
502 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
503 | |
504 | /************************** |
505 | * CALCULATE INTERACTIONS * |
506 | **************************/ |
507 | |
508 | r32 = rsq32*rinv32; |
509 | |
510 | /* EWALD ELECTROSTATICS */ |
511 | |
512 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
513 | ewrt = r32*ewtabscale; |
514 | ewitab = ewrt; |
515 | eweps = ewrt-ewitab; |
516 | ewitab = 4*ewitab; |
517 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
518 | velec = qq32*(rinv32-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
519 | felec = qq32*rinv32*(rinvsq32-felec); |
520 | |
521 | /* Update potential sums from outer loop */ |
522 | velecsum += velec; |
523 | |
524 | fscal = felec; |
525 | |
526 | /* Calculate temporary vectorial force */ |
527 | tx = fscal*dx32; |
528 | ty = fscal*dy32; |
529 | tz = fscal*dz32; |
530 | |
531 | /* Update vectorial force */ |
532 | fix3 += tx; |
533 | fiy3 += ty; |
534 | fiz3 += tz; |
535 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
536 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
537 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
538 | |
539 | /************************** |
540 | * CALCULATE INTERACTIONS * |
541 | **************************/ |
542 | |
543 | r33 = rsq33*rinv33; |
544 | |
545 | /* EWALD ELECTROSTATICS */ |
546 | |
547 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
548 | ewrt = r33*ewtabscale; |
549 | ewitab = ewrt; |
550 | eweps = ewrt-ewitab; |
551 | ewitab = 4*ewitab; |
552 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
553 | velec = qq33*(rinv33-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
554 | felec = qq33*rinv33*(rinvsq33-felec); |
555 | |
556 | /* Update potential sums from outer loop */ |
557 | velecsum += velec; |
558 | |
559 | fscal = felec; |
560 | |
561 | /* Calculate temporary vectorial force */ |
562 | tx = fscal*dx33; |
563 | ty = fscal*dy33; |
564 | tz = fscal*dz33; |
565 | |
566 | /* Update vectorial force */ |
567 | fix3 += tx; |
568 | fiy3 += ty; |
569 | fiz3 += tz; |
570 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
571 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
572 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
573 | |
574 | /* Inner loop uses 360 flops */ |
575 | } |
576 | /* End of innermost loop */ |
577 | |
578 | tx = ty = tz = 0; |
579 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
580 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
581 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
582 | tx += fix1; |
583 | ty += fiy1; |
584 | tz += fiz1; |
585 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
586 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
587 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
588 | tx += fix2; |
589 | ty += fiy2; |
590 | tz += fiz2; |
591 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
592 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
593 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
594 | tx += fix3; |
595 | ty += fiy3; |
596 | tz += fiz3; |
597 | fshift[i_shift_offset+XX0] += tx; |
598 | fshift[i_shift_offset+YY1] += ty; |
599 | fshift[i_shift_offset+ZZ2] += tz; |
600 | |
601 | ggid = gid[iidx]; |
602 | /* Update potential energies */ |
603 | kernel_data->energygrp_elec[ggid] += velecsum; |
604 | |
605 | /* Increment number of inner iterations */ |
606 | inneriter += j_index_end - j_index_start; |
607 | |
608 | /* Outer loop uses 31 flops */ |
609 | } |
610 | |
611 | /* Increment number of outer iterations */ |
612 | outeriter += nri; |
613 | |
614 | /* Update outer/inner flops */ |
615 | |
616 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*360)(nrnb)->n[eNR_NBKERNEL_ELEC_W4W4_VF] += outeriter*31 + inneriter *360; |
617 | } |
618 | /* |
619 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwNone_GeomW4W4_F_c |
620 | * Electrostatics interaction: Ewald |
621 | * VdW interaction: None |
622 | * Geometry: Water4-Water4 |
623 | * Calculate force/pot: Force |
624 | */ |
625 | void |
626 | nb_kernel_ElecEw_VdwNone_GeomW4W4_F_c |
627 | (t_nblist * gmx_restrict__restrict nlist, |
628 | rvec * gmx_restrict__restrict xx, |
629 | rvec * gmx_restrict__restrict ff, |
630 | t_forcerec * gmx_restrict__restrict fr, |
631 | t_mdatoms * gmx_restrict__restrict mdatoms, |
632 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
633 | t_nrnb * gmx_restrict__restrict nrnb) |
634 | { |
635 | int i_shift_offset,i_coord_offset,j_coord_offset; |
636 | int j_index_start,j_index_end; |
637 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
638 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
639 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
640 | real *shiftvec,*fshift,*x,*f; |
641 | int vdwioffset1; |
642 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
643 | int vdwioffset2; |
644 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
645 | int vdwioffset3; |
646 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
647 | int vdwjidx1; |
648 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
649 | int vdwjidx2; |
650 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
651 | int vdwjidx3; |
652 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
653 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
654 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
655 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
656 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
657 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
658 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
659 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
660 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
661 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
662 | real velec,felec,velecsum,facel,crf,krf,krf2; |
663 | real *charge; |
664 | int ewitab; |
665 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
666 | real *ewtab; |
667 | |
668 | x = xx[0]; |
669 | f = ff[0]; |
670 | |
671 | nri = nlist->nri; |
672 | iinr = nlist->iinr; |
673 | jindex = nlist->jindex; |
674 | jjnr = nlist->jjnr; |
675 | shiftidx = nlist->shift; |
676 | gid = nlist->gid; |
677 | shiftvec = fr->shift_vec[0]; |
678 | fshift = fr->fshift[0]; |
679 | facel = fr->epsfac; |
680 | charge = mdatoms->chargeA; |
681 | |
682 | sh_ewald = fr->ic->sh_ewald; |
683 | ewtab = fr->ic->tabq_coul_F; |
684 | ewtabscale = fr->ic->tabq_scale; |
685 | ewtabhalfspace = 0.5/ewtabscale; |
686 | |
687 | /* Setup water-specific parameters */ |
688 | inr = nlist->iinr[0]; |
689 | iq1 = facel*charge[inr+1]; |
690 | iq2 = facel*charge[inr+2]; |
691 | iq3 = facel*charge[inr+3]; |
692 | |
693 | jq1 = charge[inr+1]; |
694 | jq2 = charge[inr+2]; |
695 | jq3 = charge[inr+3]; |
696 | qq11 = iq1*jq1; |
697 | qq12 = iq1*jq2; |
698 | qq13 = iq1*jq3; |
699 | qq21 = iq2*jq1; |
700 | qq22 = iq2*jq2; |
701 | qq23 = iq2*jq3; |
702 | qq31 = iq3*jq1; |
703 | qq32 = iq3*jq2; |
704 | qq33 = iq3*jq3; |
705 | |
706 | outeriter = 0; |
707 | inneriter = 0; |
708 | |
709 | /* Start outer loop over neighborlists */ |
710 | for(iidx=0; iidx<nri; iidx++) |
711 | { |
712 | /* Load shift vector for this list */ |
713 | i_shift_offset = DIM3*shiftidx[iidx]; |
714 | shX = shiftvec[i_shift_offset+XX0]; |
715 | shY = shiftvec[i_shift_offset+YY1]; |
716 | shZ = shiftvec[i_shift_offset+ZZ2]; |
717 | |
718 | /* Load limits for loop over neighbors */ |
719 | j_index_start = jindex[iidx]; |
720 | j_index_end = jindex[iidx+1]; |
721 | |
722 | /* Get outer coordinate index */ |
723 | inr = iinr[iidx]; |
724 | i_coord_offset = DIM3*inr; |
725 | |
726 | /* Load i particle coords and add shift vector */ |
727 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
728 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
729 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
730 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
731 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
732 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
733 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
734 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
735 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
736 | |
737 | fix1 = 0.0; |
738 | fiy1 = 0.0; |
739 | fiz1 = 0.0; |
740 | fix2 = 0.0; |
741 | fiy2 = 0.0; |
742 | fiz2 = 0.0; |
743 | fix3 = 0.0; |
744 | fiy3 = 0.0; |
745 | fiz3 = 0.0; |
746 | |
747 | /* Start inner kernel loop */ |
748 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
749 | { |
750 | /* Get j neighbor index, and coordinate index */ |
751 | jnr = jjnr[jidx]; |
752 | j_coord_offset = DIM3*jnr; |
753 | |
754 | /* load j atom coordinates */ |
755 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
756 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
757 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
758 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
759 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
760 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
761 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
762 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
763 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
764 | |
765 | /* Calculate displacement vector */ |
766 | dx11 = ix1 - jx1; |
767 | dy11 = iy1 - jy1; |
768 | dz11 = iz1 - jz1; |
769 | dx12 = ix1 - jx2; |
770 | dy12 = iy1 - jy2; |
771 | dz12 = iz1 - jz2; |
772 | dx13 = ix1 - jx3; |
773 | dy13 = iy1 - jy3; |
774 | dz13 = iz1 - jz3; |
775 | dx21 = ix2 - jx1; |
776 | dy21 = iy2 - jy1; |
777 | dz21 = iz2 - jz1; |
778 | dx22 = ix2 - jx2; |
779 | dy22 = iy2 - jy2; |
780 | dz22 = iz2 - jz2; |
781 | dx23 = ix2 - jx3; |
782 | dy23 = iy2 - jy3; |
783 | dz23 = iz2 - jz3; |
784 | dx31 = ix3 - jx1; |
785 | dy31 = iy3 - jy1; |
786 | dz31 = iz3 - jz1; |
787 | dx32 = ix3 - jx2; |
788 | dy32 = iy3 - jy2; |
789 | dz32 = iz3 - jz2; |
790 | dx33 = ix3 - jx3; |
791 | dy33 = iy3 - jy3; |
792 | dz33 = iz3 - jz3; |
793 | |
794 | /* Calculate squared distance and things based on it */ |
795 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
796 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
797 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
798 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
799 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
800 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
801 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
802 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
803 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
804 | |
805 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
806 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
807 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
808 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
809 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
810 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
811 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
812 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
813 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
814 | |
815 | rinvsq11 = rinv11*rinv11; |
816 | rinvsq12 = rinv12*rinv12; |
817 | rinvsq13 = rinv13*rinv13; |
818 | rinvsq21 = rinv21*rinv21; |
819 | rinvsq22 = rinv22*rinv22; |
820 | rinvsq23 = rinv23*rinv23; |
821 | rinvsq31 = rinv31*rinv31; |
822 | rinvsq32 = rinv32*rinv32; |
823 | rinvsq33 = rinv33*rinv33; |
824 | |
825 | /************************** |
826 | * CALCULATE INTERACTIONS * |
827 | **************************/ |
828 | |
829 | r11 = rsq11*rinv11; |
830 | |
831 | /* EWALD ELECTROSTATICS */ |
832 | |
833 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
834 | ewrt = r11*ewtabscale; |
835 | ewitab = ewrt; |
836 | eweps = ewrt-ewitab; |
837 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
838 | felec = qq11*rinv11*(rinvsq11-felec); |
839 | |
840 | fscal = felec; |
841 | |
842 | /* Calculate temporary vectorial force */ |
843 | tx = fscal*dx11; |
844 | ty = fscal*dy11; |
845 | tz = fscal*dz11; |
846 | |
847 | /* Update vectorial force */ |
848 | fix1 += tx; |
849 | fiy1 += ty; |
850 | fiz1 += tz; |
851 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
852 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
853 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
854 | |
855 | /************************** |
856 | * CALCULATE INTERACTIONS * |
857 | **************************/ |
858 | |
859 | r12 = rsq12*rinv12; |
860 | |
861 | /* EWALD ELECTROSTATICS */ |
862 | |
863 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
864 | ewrt = r12*ewtabscale; |
865 | ewitab = ewrt; |
866 | eweps = ewrt-ewitab; |
867 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
868 | felec = qq12*rinv12*(rinvsq12-felec); |
869 | |
870 | fscal = felec; |
871 | |
872 | /* Calculate temporary vectorial force */ |
873 | tx = fscal*dx12; |
874 | ty = fscal*dy12; |
875 | tz = fscal*dz12; |
876 | |
877 | /* Update vectorial force */ |
878 | fix1 += tx; |
879 | fiy1 += ty; |
880 | fiz1 += tz; |
881 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
882 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
883 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
884 | |
885 | /************************** |
886 | * CALCULATE INTERACTIONS * |
887 | **************************/ |
888 | |
889 | r13 = rsq13*rinv13; |
890 | |
891 | /* EWALD ELECTROSTATICS */ |
892 | |
893 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
894 | ewrt = r13*ewtabscale; |
895 | ewitab = ewrt; |
896 | eweps = ewrt-ewitab; |
897 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
898 | felec = qq13*rinv13*(rinvsq13-felec); |
899 | |
900 | fscal = felec; |
901 | |
902 | /* Calculate temporary vectorial force */ |
903 | tx = fscal*dx13; |
904 | ty = fscal*dy13; |
905 | tz = fscal*dz13; |
906 | |
907 | /* Update vectorial force */ |
908 | fix1 += tx; |
909 | fiy1 += ty; |
910 | fiz1 += tz; |
911 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
912 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
913 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
914 | |
915 | /************************** |
916 | * CALCULATE INTERACTIONS * |
917 | **************************/ |
918 | |
919 | r21 = rsq21*rinv21; |
920 | |
921 | /* EWALD ELECTROSTATICS */ |
922 | |
923 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
924 | ewrt = r21*ewtabscale; |
925 | ewitab = ewrt; |
926 | eweps = ewrt-ewitab; |
927 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
928 | felec = qq21*rinv21*(rinvsq21-felec); |
929 | |
930 | fscal = felec; |
931 | |
932 | /* Calculate temporary vectorial force */ |
933 | tx = fscal*dx21; |
934 | ty = fscal*dy21; |
935 | tz = fscal*dz21; |
936 | |
937 | /* Update vectorial force */ |
938 | fix2 += tx; |
939 | fiy2 += ty; |
940 | fiz2 += tz; |
941 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
942 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
943 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
944 | |
945 | /************************** |
946 | * CALCULATE INTERACTIONS * |
947 | **************************/ |
948 | |
949 | r22 = rsq22*rinv22; |
950 | |
951 | /* EWALD ELECTROSTATICS */ |
952 | |
953 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
954 | ewrt = r22*ewtabscale; |
955 | ewitab = ewrt; |
956 | eweps = ewrt-ewitab; |
957 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
958 | felec = qq22*rinv22*(rinvsq22-felec); |
959 | |
960 | fscal = felec; |
961 | |
962 | /* Calculate temporary vectorial force */ |
963 | tx = fscal*dx22; |
964 | ty = fscal*dy22; |
965 | tz = fscal*dz22; |
966 | |
967 | /* Update vectorial force */ |
968 | fix2 += tx; |
969 | fiy2 += ty; |
970 | fiz2 += tz; |
971 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
972 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
973 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
974 | |
975 | /************************** |
976 | * CALCULATE INTERACTIONS * |
977 | **************************/ |
978 | |
979 | r23 = rsq23*rinv23; |
980 | |
981 | /* EWALD ELECTROSTATICS */ |
982 | |
983 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
984 | ewrt = r23*ewtabscale; |
985 | ewitab = ewrt; |
986 | eweps = ewrt-ewitab; |
987 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
988 | felec = qq23*rinv23*(rinvsq23-felec); |
989 | |
990 | fscal = felec; |
991 | |
992 | /* Calculate temporary vectorial force */ |
993 | tx = fscal*dx23; |
994 | ty = fscal*dy23; |
995 | tz = fscal*dz23; |
996 | |
997 | /* Update vectorial force */ |
998 | fix2 += tx; |
999 | fiy2 += ty; |
1000 | fiz2 += tz; |
1001 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1002 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1003 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1004 | |
1005 | /************************** |
1006 | * CALCULATE INTERACTIONS * |
1007 | **************************/ |
1008 | |
1009 | r31 = rsq31*rinv31; |
1010 | |
1011 | /* EWALD ELECTROSTATICS */ |
1012 | |
1013 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1014 | ewrt = r31*ewtabscale; |
1015 | ewitab = ewrt; |
1016 | eweps = ewrt-ewitab; |
1017 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1018 | felec = qq31*rinv31*(rinvsq31-felec); |
1019 | |
1020 | fscal = felec; |
1021 | |
1022 | /* Calculate temporary vectorial force */ |
1023 | tx = fscal*dx31; |
1024 | ty = fscal*dy31; |
1025 | tz = fscal*dz31; |
1026 | |
1027 | /* Update vectorial force */ |
1028 | fix3 += tx; |
1029 | fiy3 += ty; |
1030 | fiz3 += 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 | r32 = rsq32*rinv32; |
1040 | |
1041 | /* EWALD ELECTROSTATICS */ |
1042 | |
1043 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1044 | ewrt = r32*ewtabscale; |
1045 | ewitab = ewrt; |
1046 | eweps = ewrt-ewitab; |
1047 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1048 | felec = qq32*rinv32*(rinvsq32-felec); |
1049 | |
1050 | fscal = felec; |
1051 | |
1052 | /* Calculate temporary vectorial force */ |
1053 | tx = fscal*dx32; |
1054 | ty = fscal*dy32; |
1055 | tz = fscal*dz32; |
1056 | |
1057 | /* Update vectorial force */ |
1058 | fix3 += tx; |
1059 | fiy3 += ty; |
1060 | fiz3 += 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 | r33 = rsq33*rinv33; |
1070 | |
1071 | /* EWALD ELECTROSTATICS */ |
1072 | |
1073 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1074 | ewrt = r33*ewtabscale; |
1075 | ewitab = ewrt; |
1076 | eweps = ewrt-ewitab; |
1077 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1078 | felec = qq33*rinv33*(rinvsq33-felec); |
1079 | |
1080 | fscal = felec; |
1081 | |
1082 | /* Calculate temporary vectorial force */ |
1083 | tx = fscal*dx33; |
1084 | ty = fscal*dy33; |
1085 | tz = fscal*dz33; |
1086 | |
1087 | /* Update vectorial force */ |
1088 | fix3 += tx; |
1089 | fiy3 += ty; |
1090 | fiz3 += 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 | /* Inner loop uses 297 flops */ |
1096 | } |
1097 | /* End of innermost loop */ |
1098 | |
1099 | tx = ty = tz = 0; |
1100 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1101 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1102 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1103 | tx += fix1; |
1104 | ty += fiy1; |
1105 | tz += fiz1; |
1106 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1107 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1108 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1109 | tx += fix2; |
1110 | ty += fiy2; |
1111 | tz += fiz2; |
1112 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
1113 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
1114 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
1115 | tx += fix3; |
1116 | ty += fiy3; |
1117 | tz += fiz3; |
1118 | fshift[i_shift_offset+XX0] += tx; |
1119 | fshift[i_shift_offset+YY1] += ty; |
1120 | fshift[i_shift_offset+ZZ2] += tz; |
1121 | |
1122 | /* Increment number of inner iterations */ |
1123 | inneriter += j_index_end - j_index_start; |
1124 | |
1125 | /* Outer loop uses 30 flops */ |
1126 | } |
1127 | |
1128 | /* Increment number of outer iterations */ |
1129 | outeriter += nri; |
1130 | |
1131 | /* Update outer/inner flops */ |
1132 | |
1133 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*297)(nrnb)->n[eNR_NBKERNEL_ELEC_W4W4_F] += outeriter*30 + inneriter *297; |
1134 | } |