File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwNone_GeomW3P1_c.c |
Location: | line 406, 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_GeomW3P1_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: None |
53 | * Geometry: Water3-Particle |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEw_VdwNone_GeomW3P1_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 vdwjidx0; |
79 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
80 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
81 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
82 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
83 | real velec,felec,velecsum,facel,crf,krf,krf2; |
84 | real *charge; |
85 | int ewitab; |
86 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
87 | real *ewtab; |
88 | |
89 | x = xx[0]; |
90 | f = ff[0]; |
91 | |
92 | nri = nlist->nri; |
93 | iinr = nlist->iinr; |
94 | jindex = nlist->jindex; |
95 | jjnr = nlist->jjnr; |
96 | shiftidx = nlist->shift; |
97 | gid = nlist->gid; |
98 | shiftvec = fr->shift_vec[0]; |
99 | fshift = fr->fshift[0]; |
100 | facel = fr->epsfac; |
101 | charge = mdatoms->chargeA; |
102 | |
103 | sh_ewald = fr->ic->sh_ewald; |
104 | ewtab = fr->ic->tabq_coul_FDV0; |
105 | ewtabscale = fr->ic->tabq_scale; |
106 | ewtabhalfspace = 0.5/ewtabscale; |
107 | |
108 | /* Setup water-specific parameters */ |
109 | inr = nlist->iinr[0]; |
110 | iq0 = facel*charge[inr+0]; |
111 | iq1 = facel*charge[inr+1]; |
112 | iq2 = facel*charge[inr+2]; |
113 | |
114 | outeriter = 0; |
115 | inneriter = 0; |
116 | |
117 | /* Start outer loop over neighborlists */ |
118 | for(iidx=0; iidx<nri; iidx++) |
119 | { |
120 | /* Load shift vector for this list */ |
121 | i_shift_offset = DIM3*shiftidx[iidx]; |
122 | shX = shiftvec[i_shift_offset+XX0]; |
123 | shY = shiftvec[i_shift_offset+YY1]; |
124 | shZ = shiftvec[i_shift_offset+ZZ2]; |
125 | |
126 | /* Load limits for loop over neighbors */ |
127 | j_index_start = jindex[iidx]; |
128 | j_index_end = jindex[iidx+1]; |
129 | |
130 | /* Get outer coordinate index */ |
131 | inr = iinr[iidx]; |
132 | i_coord_offset = DIM3*inr; |
133 | |
134 | /* Load i particle coords and add shift vector */ |
135 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
136 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
137 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
138 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
139 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
140 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
141 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
142 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
143 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
144 | |
145 | fix0 = 0.0; |
146 | fiy0 = 0.0; |
147 | fiz0 = 0.0; |
148 | fix1 = 0.0; |
149 | fiy1 = 0.0; |
150 | fiz1 = 0.0; |
151 | fix2 = 0.0; |
152 | fiy2 = 0.0; |
153 | fiz2 = 0.0; |
154 | |
155 | /* Reset potential sums */ |
156 | velecsum = 0.0; |
157 | |
158 | /* Start inner kernel loop */ |
159 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
160 | { |
161 | /* Get j neighbor index, and coordinate index */ |
162 | jnr = jjnr[jidx]; |
163 | j_coord_offset = DIM3*jnr; |
164 | |
165 | /* load j atom coordinates */ |
166 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
167 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
168 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
169 | |
170 | /* Calculate displacement vector */ |
171 | dx00 = ix0 - jx0; |
172 | dy00 = iy0 - jy0; |
173 | dz00 = iz0 - jz0; |
174 | dx10 = ix1 - jx0; |
175 | dy10 = iy1 - jy0; |
176 | dz10 = iz1 - jz0; |
177 | dx20 = ix2 - jx0; |
178 | dy20 = iy2 - jy0; |
179 | dz20 = iz2 - jz0; |
180 | |
181 | /* Calculate squared distance and things based on it */ |
182 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
183 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
184 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
185 | |
186 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
187 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
188 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
189 | |
190 | rinvsq00 = rinv00*rinv00; |
191 | rinvsq10 = rinv10*rinv10; |
192 | rinvsq20 = rinv20*rinv20; |
193 | |
194 | /* Load parameters for j particles */ |
195 | jq0 = charge[jnr+0]; |
196 | |
197 | /************************** |
198 | * CALCULATE INTERACTIONS * |
199 | **************************/ |
200 | |
201 | r00 = rsq00*rinv00; |
202 | |
203 | qq00 = iq0*jq0; |
204 | |
205 | /* EWALD ELECTROSTATICS */ |
206 | |
207 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
208 | ewrt = r00*ewtabscale; |
209 | ewitab = ewrt; |
210 | eweps = ewrt-ewitab; |
211 | ewitab = 4*ewitab; |
212 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
213 | velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
214 | felec = qq00*rinv00*(rinvsq00-felec); |
215 | |
216 | /* Update potential sums from outer loop */ |
217 | velecsum += velec; |
218 | |
219 | fscal = felec; |
220 | |
221 | /* Calculate temporary vectorial force */ |
222 | tx = fscal*dx00; |
223 | ty = fscal*dy00; |
224 | tz = fscal*dz00; |
225 | |
226 | /* Update vectorial force */ |
227 | fix0 += tx; |
228 | fiy0 += ty; |
229 | fiz0 += tz; |
230 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
231 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
232 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
233 | |
234 | /************************** |
235 | * CALCULATE INTERACTIONS * |
236 | **************************/ |
237 | |
238 | r10 = rsq10*rinv10; |
239 | |
240 | qq10 = iq1*jq0; |
241 | |
242 | /* EWALD ELECTROSTATICS */ |
243 | |
244 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
245 | ewrt = r10*ewtabscale; |
246 | ewitab = ewrt; |
247 | eweps = ewrt-ewitab; |
248 | ewitab = 4*ewitab; |
249 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
250 | velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
251 | felec = qq10*rinv10*(rinvsq10-felec); |
252 | |
253 | /* Update potential sums from outer loop */ |
254 | velecsum += velec; |
255 | |
256 | fscal = felec; |
257 | |
258 | /* Calculate temporary vectorial force */ |
259 | tx = fscal*dx10; |
260 | ty = fscal*dy10; |
261 | tz = fscal*dz10; |
262 | |
263 | /* Update vectorial force */ |
264 | fix1 += tx; |
265 | fiy1 += ty; |
266 | fiz1 += tz; |
267 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
268 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
269 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
270 | |
271 | /************************** |
272 | * CALCULATE INTERACTIONS * |
273 | **************************/ |
274 | |
275 | r20 = rsq20*rinv20; |
276 | |
277 | qq20 = iq2*jq0; |
278 | |
279 | /* EWALD ELECTROSTATICS */ |
280 | |
281 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
282 | ewrt = r20*ewtabscale; |
283 | ewitab = ewrt; |
284 | eweps = ewrt-ewitab; |
285 | ewitab = 4*ewitab; |
286 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
287 | velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
288 | felec = qq20*rinv20*(rinvsq20-felec); |
289 | |
290 | /* Update potential sums from outer loop */ |
291 | velecsum += velec; |
292 | |
293 | fscal = felec; |
294 | |
295 | /* Calculate temporary vectorial force */ |
296 | tx = fscal*dx20; |
297 | ty = fscal*dy20; |
298 | tz = fscal*dz20; |
299 | |
300 | /* Update vectorial force */ |
301 | fix2 += tx; |
302 | fiy2 += ty; |
303 | fiz2 += tz; |
304 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
305 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
306 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
307 | |
308 | /* Inner loop uses 123 flops */ |
309 | } |
310 | /* End of innermost loop */ |
311 | |
312 | tx = ty = tz = 0; |
313 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
314 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
315 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
316 | tx += fix0; |
317 | ty += fiy0; |
318 | tz += fiz0; |
319 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
320 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
321 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
322 | tx += fix1; |
323 | ty += fiy1; |
324 | tz += fiz1; |
325 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
326 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
327 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
328 | tx += fix2; |
329 | ty += fiy2; |
330 | tz += fiz2; |
331 | fshift[i_shift_offset+XX0] += tx; |
332 | fshift[i_shift_offset+YY1] += ty; |
333 | fshift[i_shift_offset+ZZ2] += tz; |
334 | |
335 | ggid = gid[iidx]; |
336 | /* Update potential energies */ |
337 | kernel_data->energygrp_elec[ggid] += velecsum; |
338 | |
339 | /* Increment number of inner iterations */ |
340 | inneriter += j_index_end - j_index_start; |
341 | |
342 | /* Outer loop uses 31 flops */ |
343 | } |
344 | |
345 | /* Increment number of outer iterations */ |
346 | outeriter += nri; |
347 | |
348 | /* Update outer/inner flops */ |
349 | |
350 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3_VF,outeriter*31 + inneriter*123)(nrnb)->n[eNR_NBKERNEL_ELEC_W3_VF] += outeriter*31 + inneriter *123; |
351 | } |
352 | /* |
353 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwNone_GeomW3P1_F_c |
354 | * Electrostatics interaction: Ewald |
355 | * VdW interaction: None |
356 | * Geometry: Water3-Particle |
357 | * Calculate force/pot: Force |
358 | */ |
359 | void |
360 | nb_kernel_ElecEw_VdwNone_GeomW3P1_F_c |
361 | (t_nblist * gmx_restrict__restrict nlist, |
362 | rvec * gmx_restrict__restrict xx, |
363 | rvec * gmx_restrict__restrict ff, |
364 | t_forcerec * gmx_restrict__restrict fr, |
365 | t_mdatoms * gmx_restrict__restrict mdatoms, |
366 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
367 | t_nrnb * gmx_restrict__restrict nrnb) |
368 | { |
369 | int i_shift_offset,i_coord_offset,j_coord_offset; |
370 | int j_index_start,j_index_end; |
371 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
372 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
373 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
374 | real *shiftvec,*fshift,*x,*f; |
375 | int vdwioffset0; |
376 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
377 | int vdwioffset1; |
378 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
379 | int vdwioffset2; |
380 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
381 | int vdwjidx0; |
382 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
383 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
384 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
385 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
386 | real velec,felec,velecsum,facel,crf,krf,krf2; |
387 | real *charge; |
388 | int ewitab; |
389 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
390 | real *ewtab; |
391 | |
392 | x = xx[0]; |
393 | f = ff[0]; |
394 | |
395 | nri = nlist->nri; |
396 | iinr = nlist->iinr; |
397 | jindex = nlist->jindex; |
398 | jjnr = nlist->jjnr; |
399 | shiftidx = nlist->shift; |
400 | gid = nlist->gid; |
401 | shiftvec = fr->shift_vec[0]; |
402 | fshift = fr->fshift[0]; |
403 | facel = fr->epsfac; |
404 | charge = mdatoms->chargeA; |
405 | |
406 | sh_ewald = fr->ic->sh_ewald; |
Value stored to 'sh_ewald' is never read | |
407 | ewtab = fr->ic->tabq_coul_F; |
408 | ewtabscale = fr->ic->tabq_scale; |
409 | ewtabhalfspace = 0.5/ewtabscale; |
410 | |
411 | /* Setup water-specific parameters */ |
412 | inr = nlist->iinr[0]; |
413 | iq0 = facel*charge[inr+0]; |
414 | iq1 = facel*charge[inr+1]; |
415 | iq2 = facel*charge[inr+2]; |
416 | |
417 | outeriter = 0; |
418 | inneriter = 0; |
419 | |
420 | /* Start outer loop over neighborlists */ |
421 | for(iidx=0; iidx<nri; iidx++) |
422 | { |
423 | /* Load shift vector for this list */ |
424 | i_shift_offset = DIM3*shiftidx[iidx]; |
425 | shX = shiftvec[i_shift_offset+XX0]; |
426 | shY = shiftvec[i_shift_offset+YY1]; |
427 | shZ = shiftvec[i_shift_offset+ZZ2]; |
428 | |
429 | /* Load limits for loop over neighbors */ |
430 | j_index_start = jindex[iidx]; |
431 | j_index_end = jindex[iidx+1]; |
432 | |
433 | /* Get outer coordinate index */ |
434 | inr = iinr[iidx]; |
435 | i_coord_offset = DIM3*inr; |
436 | |
437 | /* Load i particle coords and add shift vector */ |
438 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
439 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
440 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
441 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
442 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
443 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
444 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
445 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
446 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
447 | |
448 | fix0 = 0.0; |
449 | fiy0 = 0.0; |
450 | fiz0 = 0.0; |
451 | fix1 = 0.0; |
452 | fiy1 = 0.0; |
453 | fiz1 = 0.0; |
454 | fix2 = 0.0; |
455 | fiy2 = 0.0; |
456 | fiz2 = 0.0; |
457 | |
458 | /* Start inner kernel loop */ |
459 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
460 | { |
461 | /* Get j neighbor index, and coordinate index */ |
462 | jnr = jjnr[jidx]; |
463 | j_coord_offset = DIM3*jnr; |
464 | |
465 | /* load j atom coordinates */ |
466 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
467 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
468 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
469 | |
470 | /* Calculate displacement vector */ |
471 | dx00 = ix0 - jx0; |
472 | dy00 = iy0 - jy0; |
473 | dz00 = iz0 - jz0; |
474 | dx10 = ix1 - jx0; |
475 | dy10 = iy1 - jy0; |
476 | dz10 = iz1 - jz0; |
477 | dx20 = ix2 - jx0; |
478 | dy20 = iy2 - jy0; |
479 | dz20 = iz2 - jz0; |
480 | |
481 | /* Calculate squared distance and things based on it */ |
482 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
483 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
484 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
485 | |
486 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
487 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
488 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
489 | |
490 | rinvsq00 = rinv00*rinv00; |
491 | rinvsq10 = rinv10*rinv10; |
492 | rinvsq20 = rinv20*rinv20; |
493 | |
494 | /* Load parameters for j particles */ |
495 | jq0 = charge[jnr+0]; |
496 | |
497 | /************************** |
498 | * CALCULATE INTERACTIONS * |
499 | **************************/ |
500 | |
501 | r00 = rsq00*rinv00; |
502 | |
503 | qq00 = iq0*jq0; |
504 | |
505 | /* EWALD ELECTROSTATICS */ |
506 | |
507 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
508 | ewrt = r00*ewtabscale; |
509 | ewitab = ewrt; |
510 | eweps = ewrt-ewitab; |
511 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
512 | felec = qq00*rinv00*(rinvsq00-felec); |
513 | |
514 | fscal = felec; |
515 | |
516 | /* Calculate temporary vectorial force */ |
517 | tx = fscal*dx00; |
518 | ty = fscal*dy00; |
519 | tz = fscal*dz00; |
520 | |
521 | /* Update vectorial force */ |
522 | fix0 += tx; |
523 | fiy0 += ty; |
524 | fiz0 += tz; |
525 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
526 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
527 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
528 | |
529 | /************************** |
530 | * CALCULATE INTERACTIONS * |
531 | **************************/ |
532 | |
533 | r10 = rsq10*rinv10; |
534 | |
535 | qq10 = iq1*jq0; |
536 | |
537 | /* EWALD ELECTROSTATICS */ |
538 | |
539 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
540 | ewrt = r10*ewtabscale; |
541 | ewitab = ewrt; |
542 | eweps = ewrt-ewitab; |
543 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
544 | felec = qq10*rinv10*(rinvsq10-felec); |
545 | |
546 | fscal = felec; |
547 | |
548 | /* Calculate temporary vectorial force */ |
549 | tx = fscal*dx10; |
550 | ty = fscal*dy10; |
551 | tz = fscal*dz10; |
552 | |
553 | /* Update vectorial force */ |
554 | fix1 += tx; |
555 | fiy1 += ty; |
556 | fiz1 += tz; |
557 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
558 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
559 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
560 | |
561 | /************************** |
562 | * CALCULATE INTERACTIONS * |
563 | **************************/ |
564 | |
565 | r20 = rsq20*rinv20; |
566 | |
567 | qq20 = iq2*jq0; |
568 | |
569 | /* EWALD ELECTROSTATICS */ |
570 | |
571 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
572 | ewrt = r20*ewtabscale; |
573 | ewitab = ewrt; |
574 | eweps = ewrt-ewitab; |
575 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
576 | felec = qq20*rinv20*(rinvsq20-felec); |
577 | |
578 | fscal = felec; |
579 | |
580 | /* Calculate temporary vectorial force */ |
581 | tx = fscal*dx20; |
582 | ty = fscal*dy20; |
583 | tz = fscal*dz20; |
584 | |
585 | /* Update vectorial force */ |
586 | fix2 += tx; |
587 | fiy2 += ty; |
588 | fiz2 += tz; |
589 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
590 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
591 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
592 | |
593 | /* Inner loop uses 102 flops */ |
594 | } |
595 | /* End of innermost loop */ |
596 | |
597 | tx = ty = tz = 0; |
598 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
599 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
600 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
601 | tx += fix0; |
602 | ty += fiy0; |
603 | tz += fiz0; |
604 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
605 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
606 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
607 | tx += fix1; |
608 | ty += fiy1; |
609 | tz += fiz1; |
610 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
611 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
612 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
613 | tx += fix2; |
614 | ty += fiy2; |
615 | tz += fiz2; |
616 | fshift[i_shift_offset+XX0] += tx; |
617 | fshift[i_shift_offset+YY1] += ty; |
618 | fshift[i_shift_offset+ZZ2] += tz; |
619 | |
620 | /* Increment number of inner iterations */ |
621 | inneriter += j_index_end - j_index_start; |
622 | |
623 | /* Outer loop uses 30 flops */ |
624 | } |
625 | |
626 | /* Increment number of outer iterations */ |
627 | outeriter += nri; |
628 | |
629 | /* Update outer/inner flops */ |
630 | |
631 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3_F,outeriter*30 + inneriter*102)(nrnb)->n[eNR_NBKERNEL_ELEC_W3_F] += outeriter*30 + inneriter *102; |
632 | } |