File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwNone_GeomW3W3_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_GeomW3W3_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: None |
53 | * Geometry: Water3-Water3 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEw_VdwNone_GeomW3W3_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 | int vdwjidx1; |
81 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
82 | int vdwjidx2; |
83 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
84 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
85 | real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01; |
86 | real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02; |
87 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
88 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
89 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
90 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
91 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
92 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
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 | iq0 = facel*charge[inr+0]; |
121 | iq1 = facel*charge[inr+1]; |
122 | iq2 = facel*charge[inr+2]; |
123 | |
124 | jq0 = charge[inr+0]; |
125 | jq1 = charge[inr+1]; |
126 | jq2 = charge[inr+2]; |
127 | qq00 = iq0*jq0; |
128 | qq01 = iq0*jq1; |
129 | qq02 = iq0*jq2; |
130 | qq10 = iq1*jq0; |
131 | qq11 = iq1*jq1; |
132 | qq12 = iq1*jq2; |
133 | qq20 = iq2*jq0; |
134 | qq21 = iq2*jq1; |
135 | qq22 = iq2*jq2; |
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 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
159 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
160 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
161 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
162 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
163 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
164 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
165 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
166 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
167 | |
168 | fix0 = 0.0; |
169 | fiy0 = 0.0; |
170 | fiz0 = 0.0; |
171 | fix1 = 0.0; |
172 | fiy1 = 0.0; |
173 | fiz1 = 0.0; |
174 | fix2 = 0.0; |
175 | fiy2 = 0.0; |
176 | fiz2 = 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 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
190 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
191 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
192 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
193 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
194 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
195 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
196 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
197 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
198 | |
199 | /* Calculate displacement vector */ |
200 | dx00 = ix0 - jx0; |
201 | dy00 = iy0 - jy0; |
202 | dz00 = iz0 - jz0; |
203 | dx01 = ix0 - jx1; |
204 | dy01 = iy0 - jy1; |
205 | dz01 = iz0 - jz1; |
206 | dx02 = ix0 - jx2; |
207 | dy02 = iy0 - jy2; |
208 | dz02 = iz0 - jz2; |
209 | dx10 = ix1 - jx0; |
210 | dy10 = iy1 - jy0; |
211 | dz10 = iz1 - jz0; |
212 | dx11 = ix1 - jx1; |
213 | dy11 = iy1 - jy1; |
214 | dz11 = iz1 - jz1; |
215 | dx12 = ix1 - jx2; |
216 | dy12 = iy1 - jy2; |
217 | dz12 = iz1 - jz2; |
218 | dx20 = ix2 - jx0; |
219 | dy20 = iy2 - jy0; |
220 | dz20 = iz2 - jz0; |
221 | dx21 = ix2 - jx1; |
222 | dy21 = iy2 - jy1; |
223 | dz21 = iz2 - jz1; |
224 | dx22 = ix2 - jx2; |
225 | dy22 = iy2 - jy2; |
226 | dz22 = iz2 - jz2; |
227 | |
228 | /* Calculate squared distance and things based on it */ |
229 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
230 | rsq01 = dx01*dx01+dy01*dy01+dz01*dz01; |
231 | rsq02 = dx02*dx02+dy02*dy02+dz02*dz02; |
232 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
233 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
234 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
235 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
236 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
237 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
238 | |
239 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
240 | rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01); |
241 | rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02); |
242 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
243 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
244 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
245 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
246 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
247 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
248 | |
249 | rinvsq00 = rinv00*rinv00; |
250 | rinvsq01 = rinv01*rinv01; |
251 | rinvsq02 = rinv02*rinv02; |
252 | rinvsq10 = rinv10*rinv10; |
253 | rinvsq11 = rinv11*rinv11; |
254 | rinvsq12 = rinv12*rinv12; |
255 | rinvsq20 = rinv20*rinv20; |
256 | rinvsq21 = rinv21*rinv21; |
257 | rinvsq22 = rinv22*rinv22; |
258 | |
259 | /************************** |
260 | * CALCULATE INTERACTIONS * |
261 | **************************/ |
262 | |
263 | r00 = rsq00*rinv00; |
264 | |
265 | /* EWALD ELECTROSTATICS */ |
266 | |
267 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
268 | ewrt = r00*ewtabscale; |
269 | ewitab = ewrt; |
270 | eweps = ewrt-ewitab; |
271 | ewitab = 4*ewitab; |
272 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
273 | velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
274 | felec = qq00*rinv00*(rinvsq00-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*dx00; |
283 | ty = fscal*dy00; |
284 | tz = fscal*dz00; |
285 | |
286 | /* Update vectorial force */ |
287 | fix0 += tx; |
288 | fiy0 += ty; |
289 | fiz0 += tz; |
290 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
291 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
292 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
293 | |
294 | /************************** |
295 | * CALCULATE INTERACTIONS * |
296 | **************************/ |
297 | |
298 | r01 = rsq01*rinv01; |
299 | |
300 | /* EWALD ELECTROSTATICS */ |
301 | |
302 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
303 | ewrt = r01*ewtabscale; |
304 | ewitab = ewrt; |
305 | eweps = ewrt-ewitab; |
306 | ewitab = 4*ewitab; |
307 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
308 | velec = qq01*(rinv01-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
309 | felec = qq01*rinv01*(rinvsq01-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*dx01; |
318 | ty = fscal*dy01; |
319 | tz = fscal*dz01; |
320 | |
321 | /* Update vectorial force */ |
322 | fix0 += tx; |
323 | fiy0 += ty; |
324 | fiz0 += tz; |
325 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
326 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
327 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
328 | |
329 | /************************** |
330 | * CALCULATE INTERACTIONS * |
331 | **************************/ |
332 | |
333 | r02 = rsq02*rinv02; |
334 | |
335 | /* EWALD ELECTROSTATICS */ |
336 | |
337 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
338 | ewrt = r02*ewtabscale; |
339 | ewitab = ewrt; |
340 | eweps = ewrt-ewitab; |
341 | ewitab = 4*ewitab; |
342 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
343 | velec = qq02*(rinv02-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
344 | felec = qq02*rinv02*(rinvsq02-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*dx02; |
353 | ty = fscal*dy02; |
354 | tz = fscal*dz02; |
355 | |
356 | /* Update vectorial force */ |
357 | fix0 += tx; |
358 | fiy0 += ty; |
359 | fiz0 += tz; |
360 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
361 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
362 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
363 | |
364 | /************************** |
365 | * CALCULATE INTERACTIONS * |
366 | **************************/ |
367 | |
368 | r10 = rsq10*rinv10; |
369 | |
370 | /* EWALD ELECTROSTATICS */ |
371 | |
372 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
373 | ewrt = r10*ewtabscale; |
374 | ewitab = ewrt; |
375 | eweps = ewrt-ewitab; |
376 | ewitab = 4*ewitab; |
377 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
378 | velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
379 | felec = qq10*rinv10*(rinvsq10-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*dx10; |
388 | ty = fscal*dy10; |
389 | tz = fscal*dz10; |
390 | |
391 | /* Update vectorial force */ |
392 | fix1 += tx; |
393 | fiy1 += ty; |
394 | fiz1 += tz; |
395 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
396 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
397 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
398 | |
399 | /************************** |
400 | * CALCULATE INTERACTIONS * |
401 | **************************/ |
402 | |
403 | r11 = rsq11*rinv11; |
404 | |
405 | /* EWALD ELECTROSTATICS */ |
406 | |
407 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
408 | ewrt = r11*ewtabscale; |
409 | ewitab = ewrt; |
410 | eweps = ewrt-ewitab; |
411 | ewitab = 4*ewitab; |
412 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
413 | velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
414 | felec = qq11*rinv11*(rinvsq11-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*dx11; |
423 | ty = fscal*dy11; |
424 | tz = fscal*dz11; |
425 | |
426 | /* Update vectorial force */ |
427 | fix1 += tx; |
428 | fiy1 += ty; |
429 | fiz1 += tz; |
430 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
431 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
432 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
433 | |
434 | /************************** |
435 | * CALCULATE INTERACTIONS * |
436 | **************************/ |
437 | |
438 | r12 = rsq12*rinv12; |
439 | |
440 | /* EWALD ELECTROSTATICS */ |
441 | |
442 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
443 | ewrt = r12*ewtabscale; |
444 | ewitab = ewrt; |
445 | eweps = ewrt-ewitab; |
446 | ewitab = 4*ewitab; |
447 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
448 | velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
449 | felec = qq12*rinv12*(rinvsq12-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*dx12; |
458 | ty = fscal*dy12; |
459 | tz = fscal*dz12; |
460 | |
461 | /* Update vectorial force */ |
462 | fix1 += tx; |
463 | fiy1 += ty; |
464 | fiz1 += tz; |
465 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
466 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
467 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
468 | |
469 | /************************** |
470 | * CALCULATE INTERACTIONS * |
471 | **************************/ |
472 | |
473 | r20 = rsq20*rinv20; |
474 | |
475 | /* EWALD ELECTROSTATICS */ |
476 | |
477 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
478 | ewrt = r20*ewtabscale; |
479 | ewitab = ewrt; |
480 | eweps = ewrt-ewitab; |
481 | ewitab = 4*ewitab; |
482 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
483 | velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
484 | felec = qq20*rinv20*(rinvsq20-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*dx20; |
493 | ty = fscal*dy20; |
494 | tz = fscal*dz20; |
495 | |
496 | /* Update vectorial force */ |
497 | fix2 += tx; |
498 | fiy2 += ty; |
499 | fiz2 += tz; |
500 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
501 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
502 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
503 | |
504 | /************************** |
505 | * CALCULATE INTERACTIONS * |
506 | **************************/ |
507 | |
508 | r21 = rsq21*rinv21; |
509 | |
510 | /* EWALD ELECTROSTATICS */ |
511 | |
512 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
513 | ewrt = r21*ewtabscale; |
514 | ewitab = ewrt; |
515 | eweps = ewrt-ewitab; |
516 | ewitab = 4*ewitab; |
517 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
518 | velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
519 | felec = qq21*rinv21*(rinvsq21-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*dx21; |
528 | ty = fscal*dy21; |
529 | tz = fscal*dz21; |
530 | |
531 | /* Update vectorial force */ |
532 | fix2 += tx; |
533 | fiy2 += ty; |
534 | fiz2 += tz; |
535 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
536 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
537 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
538 | |
539 | /************************** |
540 | * CALCULATE INTERACTIONS * |
541 | **************************/ |
542 | |
543 | r22 = rsq22*rinv22; |
544 | |
545 | /* EWALD ELECTROSTATICS */ |
546 | |
547 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
548 | ewrt = r22*ewtabscale; |
549 | ewitab = ewrt; |
550 | eweps = ewrt-ewitab; |
551 | ewitab = 4*ewitab; |
552 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
553 | velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
554 | felec = qq22*rinv22*(rinvsq22-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*dx22; |
563 | ty = fscal*dy22; |
564 | tz = fscal*dz22; |
565 | |
566 | /* Update vectorial force */ |
567 | fix2 += tx; |
568 | fiy2 += ty; |
569 | fiz2 += tz; |
570 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
571 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
572 | f[j_coord_offset+DIM3*2+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*0+XX0] += fix0; |
580 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
581 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
582 | tx += fix0; |
583 | ty += fiy0; |
584 | tz += fiz0; |
585 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
586 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
587 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
588 | tx += fix1; |
589 | ty += fiy1; |
590 | tz += fiz1; |
591 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
592 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
593 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
594 | tx += fix2; |
595 | ty += fiy2; |
596 | tz += fiz2; |
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_W3W3_VF,outeriter*31 + inneriter*360)(nrnb)->n[eNR_NBKERNEL_ELEC_W3W3_VF] += outeriter*31 + inneriter *360; |
617 | } |
618 | /* |
619 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwNone_GeomW3W3_F_c |
620 | * Electrostatics interaction: Ewald |
621 | * VdW interaction: None |
622 | * Geometry: Water3-Water3 |
623 | * Calculate force/pot: Force |
624 | */ |
625 | void |
626 | nb_kernel_ElecEw_VdwNone_GeomW3W3_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 vdwioffset0; |
642 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
643 | int vdwioffset1; |
644 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
645 | int vdwioffset2; |
646 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
647 | int vdwjidx0; |
648 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
649 | int vdwjidx1; |
650 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
651 | int vdwjidx2; |
652 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
653 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
654 | real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01; |
655 | real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02; |
656 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
657 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
658 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
659 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
660 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
661 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
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 | iq0 = facel*charge[inr+0]; |
690 | iq1 = facel*charge[inr+1]; |
691 | iq2 = facel*charge[inr+2]; |
692 | |
693 | jq0 = charge[inr+0]; |
694 | jq1 = charge[inr+1]; |
695 | jq2 = charge[inr+2]; |
696 | qq00 = iq0*jq0; |
697 | qq01 = iq0*jq1; |
698 | qq02 = iq0*jq2; |
699 | qq10 = iq1*jq0; |
700 | qq11 = iq1*jq1; |
701 | qq12 = iq1*jq2; |
702 | qq20 = iq2*jq0; |
703 | qq21 = iq2*jq1; |
704 | qq22 = iq2*jq2; |
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 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
728 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
729 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
730 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
731 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
732 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
733 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
734 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
735 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
736 | |
737 | fix0 = 0.0; |
738 | fiy0 = 0.0; |
739 | fiz0 = 0.0; |
740 | fix1 = 0.0; |
741 | fiy1 = 0.0; |
742 | fiz1 = 0.0; |
743 | fix2 = 0.0; |
744 | fiy2 = 0.0; |
745 | fiz2 = 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 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
756 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
757 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
758 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
759 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
760 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
761 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
762 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
763 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
764 | |
765 | /* Calculate displacement vector */ |
766 | dx00 = ix0 - jx0; |
767 | dy00 = iy0 - jy0; |
768 | dz00 = iz0 - jz0; |
769 | dx01 = ix0 - jx1; |
770 | dy01 = iy0 - jy1; |
771 | dz01 = iz0 - jz1; |
772 | dx02 = ix0 - jx2; |
773 | dy02 = iy0 - jy2; |
774 | dz02 = iz0 - jz2; |
775 | dx10 = ix1 - jx0; |
776 | dy10 = iy1 - jy0; |
777 | dz10 = iz1 - jz0; |
778 | dx11 = ix1 - jx1; |
779 | dy11 = iy1 - jy1; |
780 | dz11 = iz1 - jz1; |
781 | dx12 = ix1 - jx2; |
782 | dy12 = iy1 - jy2; |
783 | dz12 = iz1 - jz2; |
784 | dx20 = ix2 - jx0; |
785 | dy20 = iy2 - jy0; |
786 | dz20 = iz2 - jz0; |
787 | dx21 = ix2 - jx1; |
788 | dy21 = iy2 - jy1; |
789 | dz21 = iz2 - jz1; |
790 | dx22 = ix2 - jx2; |
791 | dy22 = iy2 - jy2; |
792 | dz22 = iz2 - jz2; |
793 | |
794 | /* Calculate squared distance and things based on it */ |
795 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
796 | rsq01 = dx01*dx01+dy01*dy01+dz01*dz01; |
797 | rsq02 = dx02*dx02+dy02*dy02+dz02*dz02; |
798 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
799 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
800 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
801 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
802 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
803 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
804 | |
805 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
806 | rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01); |
807 | rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02); |
808 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
809 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
810 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
811 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
812 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
813 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
814 | |
815 | rinvsq00 = rinv00*rinv00; |
816 | rinvsq01 = rinv01*rinv01; |
817 | rinvsq02 = rinv02*rinv02; |
818 | rinvsq10 = rinv10*rinv10; |
819 | rinvsq11 = rinv11*rinv11; |
820 | rinvsq12 = rinv12*rinv12; |
821 | rinvsq20 = rinv20*rinv20; |
822 | rinvsq21 = rinv21*rinv21; |
823 | rinvsq22 = rinv22*rinv22; |
824 | |
825 | /************************** |
826 | * CALCULATE INTERACTIONS * |
827 | **************************/ |
828 | |
829 | r00 = rsq00*rinv00; |
830 | |
831 | /* EWALD ELECTROSTATICS */ |
832 | |
833 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
834 | ewrt = r00*ewtabscale; |
835 | ewitab = ewrt; |
836 | eweps = ewrt-ewitab; |
837 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
838 | felec = qq00*rinv00*(rinvsq00-felec); |
839 | |
840 | fscal = felec; |
841 | |
842 | /* Calculate temporary vectorial force */ |
843 | tx = fscal*dx00; |
844 | ty = fscal*dy00; |
845 | tz = fscal*dz00; |
846 | |
847 | /* Update vectorial force */ |
848 | fix0 += tx; |
849 | fiy0 += ty; |
850 | fiz0 += tz; |
851 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
852 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
853 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
854 | |
855 | /************************** |
856 | * CALCULATE INTERACTIONS * |
857 | **************************/ |
858 | |
859 | r01 = rsq01*rinv01; |
860 | |
861 | /* EWALD ELECTROSTATICS */ |
862 | |
863 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
864 | ewrt = r01*ewtabscale; |
865 | ewitab = ewrt; |
866 | eweps = ewrt-ewitab; |
867 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
868 | felec = qq01*rinv01*(rinvsq01-felec); |
869 | |
870 | fscal = felec; |
871 | |
872 | /* Calculate temporary vectorial force */ |
873 | tx = fscal*dx01; |
874 | ty = fscal*dy01; |
875 | tz = fscal*dz01; |
876 | |
877 | /* Update vectorial force */ |
878 | fix0 += tx; |
879 | fiy0 += ty; |
880 | fiz0 += tz; |
881 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
882 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
883 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
884 | |
885 | /************************** |
886 | * CALCULATE INTERACTIONS * |
887 | **************************/ |
888 | |
889 | r02 = rsq02*rinv02; |
890 | |
891 | /* EWALD ELECTROSTATICS */ |
892 | |
893 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
894 | ewrt = r02*ewtabscale; |
895 | ewitab = ewrt; |
896 | eweps = ewrt-ewitab; |
897 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
898 | felec = qq02*rinv02*(rinvsq02-felec); |
899 | |
900 | fscal = felec; |
901 | |
902 | /* Calculate temporary vectorial force */ |
903 | tx = fscal*dx02; |
904 | ty = fscal*dy02; |
905 | tz = fscal*dz02; |
906 | |
907 | /* Update vectorial force */ |
908 | fix0 += tx; |
909 | fiy0 += ty; |
910 | fiz0 += tz; |
911 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
912 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
913 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
914 | |
915 | /************************** |
916 | * CALCULATE INTERACTIONS * |
917 | **************************/ |
918 | |
919 | r10 = rsq10*rinv10; |
920 | |
921 | /* EWALD ELECTROSTATICS */ |
922 | |
923 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
924 | ewrt = r10*ewtabscale; |
925 | ewitab = ewrt; |
926 | eweps = ewrt-ewitab; |
927 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
928 | felec = qq10*rinv10*(rinvsq10-felec); |
929 | |
930 | fscal = felec; |
931 | |
932 | /* Calculate temporary vectorial force */ |
933 | tx = fscal*dx10; |
934 | ty = fscal*dy10; |
935 | tz = fscal*dz10; |
936 | |
937 | /* Update vectorial force */ |
938 | fix1 += tx; |
939 | fiy1 += ty; |
940 | fiz1 += tz; |
941 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
942 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
943 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
944 | |
945 | /************************** |
946 | * CALCULATE INTERACTIONS * |
947 | **************************/ |
948 | |
949 | r11 = rsq11*rinv11; |
950 | |
951 | /* EWALD ELECTROSTATICS */ |
952 | |
953 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
954 | ewrt = r11*ewtabscale; |
955 | ewitab = ewrt; |
956 | eweps = ewrt-ewitab; |
957 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
958 | felec = qq11*rinv11*(rinvsq11-felec); |
959 | |
960 | fscal = felec; |
961 | |
962 | /* Calculate temporary vectorial force */ |
963 | tx = fscal*dx11; |
964 | ty = fscal*dy11; |
965 | tz = fscal*dz11; |
966 | |
967 | /* Update vectorial force */ |
968 | fix1 += tx; |
969 | fiy1 += ty; |
970 | fiz1 += tz; |
971 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
972 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
973 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
974 | |
975 | /************************** |
976 | * CALCULATE INTERACTIONS * |
977 | **************************/ |
978 | |
979 | r12 = rsq12*rinv12; |
980 | |
981 | /* EWALD ELECTROSTATICS */ |
982 | |
983 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
984 | ewrt = r12*ewtabscale; |
985 | ewitab = ewrt; |
986 | eweps = ewrt-ewitab; |
987 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
988 | felec = qq12*rinv12*(rinvsq12-felec); |
989 | |
990 | fscal = felec; |
991 | |
992 | /* Calculate temporary vectorial force */ |
993 | tx = fscal*dx12; |
994 | ty = fscal*dy12; |
995 | tz = fscal*dz12; |
996 | |
997 | /* Update vectorial force */ |
998 | fix1 += tx; |
999 | fiy1 += ty; |
1000 | fiz1 += tz; |
1001 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1002 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1003 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1004 | |
1005 | /************************** |
1006 | * CALCULATE INTERACTIONS * |
1007 | **************************/ |
1008 | |
1009 | r20 = rsq20*rinv20; |
1010 | |
1011 | /* EWALD ELECTROSTATICS */ |
1012 | |
1013 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1014 | ewrt = r20*ewtabscale; |
1015 | ewitab = ewrt; |
1016 | eweps = ewrt-ewitab; |
1017 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1018 | felec = qq20*rinv20*(rinvsq20-felec); |
1019 | |
1020 | fscal = felec; |
1021 | |
1022 | /* Calculate temporary vectorial force */ |
1023 | tx = fscal*dx20; |
1024 | ty = fscal*dy20; |
1025 | tz = fscal*dz20; |
1026 | |
1027 | /* Update vectorial force */ |
1028 | fix2 += tx; |
1029 | fiy2 += ty; |
1030 | fiz2 += tz; |
1031 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
1032 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
1033 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
1034 | |
1035 | /************************** |
1036 | * CALCULATE INTERACTIONS * |
1037 | **************************/ |
1038 | |
1039 | r21 = rsq21*rinv21; |
1040 | |
1041 | /* EWALD ELECTROSTATICS */ |
1042 | |
1043 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1044 | ewrt = r21*ewtabscale; |
1045 | ewitab = ewrt; |
1046 | eweps = ewrt-ewitab; |
1047 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1048 | felec = qq21*rinv21*(rinvsq21-felec); |
1049 | |
1050 | fscal = felec; |
1051 | |
1052 | /* Calculate temporary vectorial force */ |
1053 | tx = fscal*dx21; |
1054 | ty = fscal*dy21; |
1055 | tz = fscal*dz21; |
1056 | |
1057 | /* Update vectorial force */ |
1058 | fix2 += tx; |
1059 | fiy2 += ty; |
1060 | fiz2 += tz; |
1061 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1062 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1063 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1064 | |
1065 | /************************** |
1066 | * CALCULATE INTERACTIONS * |
1067 | **************************/ |
1068 | |
1069 | r22 = rsq22*rinv22; |
1070 | |
1071 | /* EWALD ELECTROSTATICS */ |
1072 | |
1073 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1074 | ewrt = r22*ewtabscale; |
1075 | ewitab = ewrt; |
1076 | eweps = ewrt-ewitab; |
1077 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1078 | felec = qq22*rinv22*(rinvsq22-felec); |
1079 | |
1080 | fscal = felec; |
1081 | |
1082 | /* Calculate temporary vectorial force */ |
1083 | tx = fscal*dx22; |
1084 | ty = fscal*dy22; |
1085 | tz = fscal*dz22; |
1086 | |
1087 | /* Update vectorial force */ |
1088 | fix2 += tx; |
1089 | fiy2 += ty; |
1090 | fiz2 += tz; |
1091 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1092 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1093 | f[j_coord_offset+DIM3*2+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*0+XX0] += fix0; |
1101 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
1102 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
1103 | tx += fix0; |
1104 | ty += fiy0; |
1105 | tz += fiz0; |
1106 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1107 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1108 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1109 | tx += fix1; |
1110 | ty += fiy1; |
1111 | tz += fiz1; |
1112 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1113 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1114 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1115 | tx += fix2; |
1116 | ty += fiy2; |
1117 | tz += fiz2; |
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_W3W3_F,outeriter*30 + inneriter*297)(nrnb)->n[eNR_NBKERNEL_ELEC_W3W3_F] += outeriter*30 + inneriter *297; |
1134 | } |