File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEwSh_VdwLJSh_GeomW3W3_c.c |
Location: | line 763, 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_ElecEwSh_VdwLJSh_GeomW3W3_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: LennardJones |
53 | * Geometry: Water3-Water3 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEwSh_VdwLJSh_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 nvdwtype; |
96 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
97 | int *vdwtype; |
98 | real *vdwparam; |
99 | int ewitab; |
100 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
101 | real *ewtab; |
102 | |
103 | x = xx[0]; |
104 | f = ff[0]; |
105 | |
106 | nri = nlist->nri; |
107 | iinr = nlist->iinr; |
108 | jindex = nlist->jindex; |
109 | jjnr = nlist->jjnr; |
110 | shiftidx = nlist->shift; |
111 | gid = nlist->gid; |
112 | shiftvec = fr->shift_vec[0]; |
113 | fshift = fr->fshift[0]; |
114 | facel = fr->epsfac; |
115 | charge = mdatoms->chargeA; |
116 | nvdwtype = fr->ntype; |
117 | vdwparam = fr->nbfp; |
118 | vdwtype = mdatoms->typeA; |
119 | |
120 | sh_ewald = fr->ic->sh_ewald; |
121 | ewtab = fr->ic->tabq_coul_FDV0; |
122 | ewtabscale = fr->ic->tabq_scale; |
123 | ewtabhalfspace = 0.5/ewtabscale; |
124 | |
125 | /* Setup water-specific parameters */ |
126 | inr = nlist->iinr[0]; |
127 | iq0 = facel*charge[inr+0]; |
128 | iq1 = facel*charge[inr+1]; |
129 | iq2 = facel*charge[inr+2]; |
130 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
131 | |
132 | jq0 = charge[inr+0]; |
133 | jq1 = charge[inr+1]; |
134 | jq2 = charge[inr+2]; |
135 | vdwjidx0 = 2*vdwtype[inr+0]; |
136 | qq00 = iq0*jq0; |
137 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
138 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
139 | qq01 = iq0*jq1; |
140 | qq02 = iq0*jq2; |
141 | qq10 = iq1*jq0; |
142 | qq11 = iq1*jq1; |
143 | qq12 = iq1*jq2; |
144 | qq20 = iq2*jq0; |
145 | qq21 = iq2*jq1; |
146 | qq22 = iq2*jq2; |
147 | |
148 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
149 | rcutoff = fr->rcoulomb; |
150 | rcutoff2 = rcutoff*rcutoff; |
151 | |
152 | sh_vdw_invrcut6 = fr->ic->sh_invrc6; |
153 | rvdw = fr->rvdw; |
154 | |
155 | outeriter = 0; |
156 | inneriter = 0; |
157 | |
158 | /* Start outer loop over neighborlists */ |
159 | for(iidx=0; iidx<nri; iidx++) |
160 | { |
161 | /* Load shift vector for this list */ |
162 | i_shift_offset = DIM3*shiftidx[iidx]; |
163 | shX = shiftvec[i_shift_offset+XX0]; |
164 | shY = shiftvec[i_shift_offset+YY1]; |
165 | shZ = shiftvec[i_shift_offset+ZZ2]; |
166 | |
167 | /* Load limits for loop over neighbors */ |
168 | j_index_start = jindex[iidx]; |
169 | j_index_end = jindex[iidx+1]; |
170 | |
171 | /* Get outer coordinate index */ |
172 | inr = iinr[iidx]; |
173 | i_coord_offset = DIM3*inr; |
174 | |
175 | /* Load i particle coords and add shift vector */ |
176 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
177 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
178 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
179 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
180 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
181 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
182 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
183 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
184 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
185 | |
186 | fix0 = 0.0; |
187 | fiy0 = 0.0; |
188 | fiz0 = 0.0; |
189 | fix1 = 0.0; |
190 | fiy1 = 0.0; |
191 | fiz1 = 0.0; |
192 | fix2 = 0.0; |
193 | fiy2 = 0.0; |
194 | fiz2 = 0.0; |
195 | |
196 | /* Reset potential sums */ |
197 | velecsum = 0.0; |
198 | vvdwsum = 0.0; |
199 | |
200 | /* Start inner kernel loop */ |
201 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
202 | { |
203 | /* Get j neighbor index, and coordinate index */ |
204 | jnr = jjnr[jidx]; |
205 | j_coord_offset = DIM3*jnr; |
206 | |
207 | /* load j atom coordinates */ |
208 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
209 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
210 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
211 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
212 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
213 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
214 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
215 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
216 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
217 | |
218 | /* Calculate displacement vector */ |
219 | dx00 = ix0 - jx0; |
220 | dy00 = iy0 - jy0; |
221 | dz00 = iz0 - jz0; |
222 | dx01 = ix0 - jx1; |
223 | dy01 = iy0 - jy1; |
224 | dz01 = iz0 - jz1; |
225 | dx02 = ix0 - jx2; |
226 | dy02 = iy0 - jy2; |
227 | dz02 = iz0 - jz2; |
228 | dx10 = ix1 - jx0; |
229 | dy10 = iy1 - jy0; |
230 | dz10 = iz1 - jz0; |
231 | dx11 = ix1 - jx1; |
232 | dy11 = iy1 - jy1; |
233 | dz11 = iz1 - jz1; |
234 | dx12 = ix1 - jx2; |
235 | dy12 = iy1 - jy2; |
236 | dz12 = iz1 - jz2; |
237 | dx20 = ix2 - jx0; |
238 | dy20 = iy2 - jy0; |
239 | dz20 = iz2 - jz0; |
240 | dx21 = ix2 - jx1; |
241 | dy21 = iy2 - jy1; |
242 | dz21 = iz2 - jz1; |
243 | dx22 = ix2 - jx2; |
244 | dy22 = iy2 - jy2; |
245 | dz22 = iz2 - jz2; |
246 | |
247 | /* Calculate squared distance and things based on it */ |
248 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
249 | rsq01 = dx01*dx01+dy01*dy01+dz01*dz01; |
250 | rsq02 = dx02*dx02+dy02*dy02+dz02*dz02; |
251 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
252 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
253 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
254 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
255 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
256 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
257 | |
258 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
259 | rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01); |
260 | rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02); |
261 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
262 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
263 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
264 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
265 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
266 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
267 | |
268 | rinvsq00 = rinv00*rinv00; |
269 | rinvsq01 = rinv01*rinv01; |
270 | rinvsq02 = rinv02*rinv02; |
271 | rinvsq10 = rinv10*rinv10; |
272 | rinvsq11 = rinv11*rinv11; |
273 | rinvsq12 = rinv12*rinv12; |
274 | rinvsq20 = rinv20*rinv20; |
275 | rinvsq21 = rinv21*rinv21; |
276 | rinvsq22 = rinv22*rinv22; |
277 | |
278 | /************************** |
279 | * CALCULATE INTERACTIONS * |
280 | **************************/ |
281 | |
282 | if (rsq00<rcutoff2) |
283 | { |
284 | |
285 | r00 = rsq00*rinv00; |
286 | |
287 | /* EWALD ELECTROSTATICS */ |
288 | |
289 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
290 | ewrt = r00*ewtabscale; |
291 | ewitab = ewrt; |
292 | eweps = ewrt-ewitab; |
293 | ewitab = 4*ewitab; |
294 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
295 | velec = qq00*((rinv00-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
296 | felec = qq00*rinv00*(rinvsq00-felec); |
297 | |
298 | /* LENNARD-JONES DISPERSION/REPULSION */ |
299 | |
300 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
301 | vvdw6 = c6_00*rinvsix; |
302 | vvdw12 = c12_00*rinvsix*rinvsix; |
303 | vvdw = (vvdw12 - c12_00*sh_vdw_invrcut6*sh_vdw_invrcut6)*(1.0/12.0) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0); |
304 | fvdw = (vvdw12-vvdw6)*rinvsq00; |
305 | |
306 | /* Update potential sums from outer loop */ |
307 | velecsum += velec; |
308 | vvdwsum += vvdw; |
309 | |
310 | fscal = felec+fvdw; |
311 | |
312 | /* Calculate temporary vectorial force */ |
313 | tx = fscal*dx00; |
314 | ty = fscal*dy00; |
315 | tz = fscal*dz00; |
316 | |
317 | /* Update vectorial force */ |
318 | fix0 += tx; |
319 | fiy0 += ty; |
320 | fiz0 += tz; |
321 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
322 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
323 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
324 | |
325 | } |
326 | |
327 | /************************** |
328 | * CALCULATE INTERACTIONS * |
329 | **************************/ |
330 | |
331 | if (rsq01<rcutoff2) |
332 | { |
333 | |
334 | r01 = rsq01*rinv01; |
335 | |
336 | /* EWALD ELECTROSTATICS */ |
337 | |
338 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
339 | ewrt = r01*ewtabscale; |
340 | ewitab = ewrt; |
341 | eweps = ewrt-ewitab; |
342 | ewitab = 4*ewitab; |
343 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
344 | velec = qq01*((rinv01-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
345 | felec = qq01*rinv01*(rinvsq01-felec); |
346 | |
347 | /* Update potential sums from outer loop */ |
348 | velecsum += velec; |
349 | |
350 | fscal = felec; |
351 | |
352 | /* Calculate temporary vectorial force */ |
353 | tx = fscal*dx01; |
354 | ty = fscal*dy01; |
355 | tz = fscal*dz01; |
356 | |
357 | /* Update vectorial force */ |
358 | fix0 += tx; |
359 | fiy0 += ty; |
360 | fiz0 += tz; |
361 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
362 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
363 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
364 | |
365 | } |
366 | |
367 | /************************** |
368 | * CALCULATE INTERACTIONS * |
369 | **************************/ |
370 | |
371 | if (rsq02<rcutoff2) |
372 | { |
373 | |
374 | r02 = rsq02*rinv02; |
375 | |
376 | /* EWALD ELECTROSTATICS */ |
377 | |
378 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
379 | ewrt = r02*ewtabscale; |
380 | ewitab = ewrt; |
381 | eweps = ewrt-ewitab; |
382 | ewitab = 4*ewitab; |
383 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
384 | velec = qq02*((rinv02-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
385 | felec = qq02*rinv02*(rinvsq02-felec); |
386 | |
387 | /* Update potential sums from outer loop */ |
388 | velecsum += velec; |
389 | |
390 | fscal = felec; |
391 | |
392 | /* Calculate temporary vectorial force */ |
393 | tx = fscal*dx02; |
394 | ty = fscal*dy02; |
395 | tz = fscal*dz02; |
396 | |
397 | /* Update vectorial force */ |
398 | fix0 += tx; |
399 | fiy0 += ty; |
400 | fiz0 += tz; |
401 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
402 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
403 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
404 | |
405 | } |
406 | |
407 | /************************** |
408 | * CALCULATE INTERACTIONS * |
409 | **************************/ |
410 | |
411 | if (rsq10<rcutoff2) |
412 | { |
413 | |
414 | r10 = rsq10*rinv10; |
415 | |
416 | /* EWALD ELECTROSTATICS */ |
417 | |
418 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
419 | ewrt = r10*ewtabscale; |
420 | ewitab = ewrt; |
421 | eweps = ewrt-ewitab; |
422 | ewitab = 4*ewitab; |
423 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
424 | velec = qq10*((rinv10-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
425 | felec = qq10*rinv10*(rinvsq10-felec); |
426 | |
427 | /* Update potential sums from outer loop */ |
428 | velecsum += velec; |
429 | |
430 | fscal = felec; |
431 | |
432 | /* Calculate temporary vectorial force */ |
433 | tx = fscal*dx10; |
434 | ty = fscal*dy10; |
435 | tz = fscal*dz10; |
436 | |
437 | /* Update vectorial force */ |
438 | fix1 += tx; |
439 | fiy1 += ty; |
440 | fiz1 += tz; |
441 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
442 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
443 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
444 | |
445 | } |
446 | |
447 | /************************** |
448 | * CALCULATE INTERACTIONS * |
449 | **************************/ |
450 | |
451 | if (rsq11<rcutoff2) |
452 | { |
453 | |
454 | r11 = rsq11*rinv11; |
455 | |
456 | /* EWALD ELECTROSTATICS */ |
457 | |
458 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
459 | ewrt = r11*ewtabscale; |
460 | ewitab = ewrt; |
461 | eweps = ewrt-ewitab; |
462 | ewitab = 4*ewitab; |
463 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
464 | velec = qq11*((rinv11-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
465 | felec = qq11*rinv11*(rinvsq11-felec); |
466 | |
467 | /* Update potential sums from outer loop */ |
468 | velecsum += velec; |
469 | |
470 | fscal = felec; |
471 | |
472 | /* Calculate temporary vectorial force */ |
473 | tx = fscal*dx11; |
474 | ty = fscal*dy11; |
475 | tz = fscal*dz11; |
476 | |
477 | /* Update vectorial force */ |
478 | fix1 += tx; |
479 | fiy1 += ty; |
480 | fiz1 += tz; |
481 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
482 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
483 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
484 | |
485 | } |
486 | |
487 | /************************** |
488 | * CALCULATE INTERACTIONS * |
489 | **************************/ |
490 | |
491 | if (rsq12<rcutoff2) |
492 | { |
493 | |
494 | r12 = rsq12*rinv12; |
495 | |
496 | /* EWALD ELECTROSTATICS */ |
497 | |
498 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
499 | ewrt = r12*ewtabscale; |
500 | ewitab = ewrt; |
501 | eweps = ewrt-ewitab; |
502 | ewitab = 4*ewitab; |
503 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
504 | velec = qq12*((rinv12-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
505 | felec = qq12*rinv12*(rinvsq12-felec); |
506 | |
507 | /* Update potential sums from outer loop */ |
508 | velecsum += velec; |
509 | |
510 | fscal = felec; |
511 | |
512 | /* Calculate temporary vectorial force */ |
513 | tx = fscal*dx12; |
514 | ty = fscal*dy12; |
515 | tz = fscal*dz12; |
516 | |
517 | /* Update vectorial force */ |
518 | fix1 += tx; |
519 | fiy1 += ty; |
520 | fiz1 += tz; |
521 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
522 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
523 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
524 | |
525 | } |
526 | |
527 | /************************** |
528 | * CALCULATE INTERACTIONS * |
529 | **************************/ |
530 | |
531 | if (rsq20<rcutoff2) |
532 | { |
533 | |
534 | r20 = rsq20*rinv20; |
535 | |
536 | /* EWALD ELECTROSTATICS */ |
537 | |
538 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
539 | ewrt = r20*ewtabscale; |
540 | ewitab = ewrt; |
541 | eweps = ewrt-ewitab; |
542 | ewitab = 4*ewitab; |
543 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
544 | velec = qq20*((rinv20-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
545 | felec = qq20*rinv20*(rinvsq20-felec); |
546 | |
547 | /* Update potential sums from outer loop */ |
548 | velecsum += velec; |
549 | |
550 | fscal = felec; |
551 | |
552 | /* Calculate temporary vectorial force */ |
553 | tx = fscal*dx20; |
554 | ty = fscal*dy20; |
555 | tz = fscal*dz20; |
556 | |
557 | /* Update vectorial force */ |
558 | fix2 += tx; |
559 | fiy2 += ty; |
560 | fiz2 += tz; |
561 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
562 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
563 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
564 | |
565 | } |
566 | |
567 | /************************** |
568 | * CALCULATE INTERACTIONS * |
569 | **************************/ |
570 | |
571 | if (rsq21<rcutoff2) |
572 | { |
573 | |
574 | r21 = rsq21*rinv21; |
575 | |
576 | /* EWALD ELECTROSTATICS */ |
577 | |
578 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
579 | ewrt = r21*ewtabscale; |
580 | ewitab = ewrt; |
581 | eweps = ewrt-ewitab; |
582 | ewitab = 4*ewitab; |
583 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
584 | velec = qq21*((rinv21-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
585 | felec = qq21*rinv21*(rinvsq21-felec); |
586 | |
587 | /* Update potential sums from outer loop */ |
588 | velecsum += velec; |
589 | |
590 | fscal = felec; |
591 | |
592 | /* Calculate temporary vectorial force */ |
593 | tx = fscal*dx21; |
594 | ty = fscal*dy21; |
595 | tz = fscal*dz21; |
596 | |
597 | /* Update vectorial force */ |
598 | fix2 += tx; |
599 | fiy2 += ty; |
600 | fiz2 += tz; |
601 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
602 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
603 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
604 | |
605 | } |
606 | |
607 | /************************** |
608 | * CALCULATE INTERACTIONS * |
609 | **************************/ |
610 | |
611 | if (rsq22<rcutoff2) |
612 | { |
613 | |
614 | r22 = rsq22*rinv22; |
615 | |
616 | /* EWALD ELECTROSTATICS */ |
617 | |
618 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
619 | ewrt = r22*ewtabscale; |
620 | ewitab = ewrt; |
621 | eweps = ewrt-ewitab; |
622 | ewitab = 4*ewitab; |
623 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
624 | velec = qq22*((rinv22-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
625 | felec = qq22*rinv22*(rinvsq22-felec); |
626 | |
627 | /* Update potential sums from outer loop */ |
628 | velecsum += velec; |
629 | |
630 | fscal = felec; |
631 | |
632 | /* Calculate temporary vectorial force */ |
633 | tx = fscal*dx22; |
634 | ty = fscal*dy22; |
635 | tz = fscal*dz22; |
636 | |
637 | /* Update vectorial force */ |
638 | fix2 += tx; |
639 | fiy2 += ty; |
640 | fiz2 += tz; |
641 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
642 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
643 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
644 | |
645 | } |
646 | |
647 | /* Inner loop uses 386 flops */ |
648 | } |
649 | /* End of innermost loop */ |
650 | |
651 | tx = ty = tz = 0; |
652 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
653 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
654 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
655 | tx += fix0; |
656 | ty += fiy0; |
657 | tz += fiz0; |
658 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
659 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
660 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
661 | tx += fix1; |
662 | ty += fiy1; |
663 | tz += fiz1; |
664 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
665 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
666 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
667 | tx += fix2; |
668 | ty += fiy2; |
669 | tz += fiz2; |
670 | fshift[i_shift_offset+XX0] += tx; |
671 | fshift[i_shift_offset+YY1] += ty; |
672 | fshift[i_shift_offset+ZZ2] += tz; |
673 | |
674 | ggid = gid[iidx]; |
675 | /* Update potential energies */ |
676 | kernel_data->energygrp_elec[ggid] += velecsum; |
677 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
678 | |
679 | /* Increment number of inner iterations */ |
680 | inneriter += j_index_end - j_index_start; |
681 | |
682 | /* Outer loop uses 32 flops */ |
683 | } |
684 | |
685 | /* Increment number of outer iterations */ |
686 | outeriter += nri; |
687 | |
688 | /* Update outer/inner flops */ |
689 | |
690 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*386)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3W3_VF] += outeriter*32 + inneriter*386; |
691 | } |
692 | /* |
693 | * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW3W3_F_c |
694 | * Electrostatics interaction: Ewald |
695 | * VdW interaction: LennardJones |
696 | * Geometry: Water3-Water3 |
697 | * Calculate force/pot: Force |
698 | */ |
699 | void |
700 | nb_kernel_ElecEwSh_VdwLJSh_GeomW3W3_F_c |
701 | (t_nblist * gmx_restrict__restrict nlist, |
702 | rvec * gmx_restrict__restrict xx, |
703 | rvec * gmx_restrict__restrict ff, |
704 | t_forcerec * gmx_restrict__restrict fr, |
705 | t_mdatoms * gmx_restrict__restrict mdatoms, |
706 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
707 | t_nrnb * gmx_restrict__restrict nrnb) |
708 | { |
709 | int i_shift_offset,i_coord_offset,j_coord_offset; |
710 | int j_index_start,j_index_end; |
711 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
712 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
713 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
714 | real *shiftvec,*fshift,*x,*f; |
715 | int vdwioffset0; |
716 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
717 | int vdwioffset1; |
718 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
719 | int vdwioffset2; |
720 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
721 | int vdwjidx0; |
722 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
723 | int vdwjidx1; |
724 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
725 | int vdwjidx2; |
726 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
727 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
728 | real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01; |
729 | real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02; |
730 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
731 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
732 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
733 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
734 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
735 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
736 | real velec,felec,velecsum,facel,crf,krf,krf2; |
737 | real *charge; |
738 | int nvdwtype; |
739 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
740 | int *vdwtype; |
741 | real *vdwparam; |
742 | int ewitab; |
743 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
744 | real *ewtab; |
745 | |
746 | x = xx[0]; |
747 | f = ff[0]; |
748 | |
749 | nri = nlist->nri; |
750 | iinr = nlist->iinr; |
751 | jindex = nlist->jindex; |
752 | jjnr = nlist->jjnr; |
753 | shiftidx = nlist->shift; |
754 | gid = nlist->gid; |
755 | shiftvec = fr->shift_vec[0]; |
756 | fshift = fr->fshift[0]; |
757 | facel = fr->epsfac; |
758 | charge = mdatoms->chargeA; |
759 | nvdwtype = fr->ntype; |
760 | vdwparam = fr->nbfp; |
761 | vdwtype = mdatoms->typeA; |
762 | |
763 | sh_ewald = fr->ic->sh_ewald; |
Value stored to 'sh_ewald' is never read | |
764 | ewtab = fr->ic->tabq_coul_F; |
765 | ewtabscale = fr->ic->tabq_scale; |
766 | ewtabhalfspace = 0.5/ewtabscale; |
767 | |
768 | /* Setup water-specific parameters */ |
769 | inr = nlist->iinr[0]; |
770 | iq0 = facel*charge[inr+0]; |
771 | iq1 = facel*charge[inr+1]; |
772 | iq2 = facel*charge[inr+2]; |
773 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
774 | |
775 | jq0 = charge[inr+0]; |
776 | jq1 = charge[inr+1]; |
777 | jq2 = charge[inr+2]; |
778 | vdwjidx0 = 2*vdwtype[inr+0]; |
779 | qq00 = iq0*jq0; |
780 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
781 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
782 | qq01 = iq0*jq1; |
783 | qq02 = iq0*jq2; |
784 | qq10 = iq1*jq0; |
785 | qq11 = iq1*jq1; |
786 | qq12 = iq1*jq2; |
787 | qq20 = iq2*jq0; |
788 | qq21 = iq2*jq1; |
789 | qq22 = iq2*jq2; |
790 | |
791 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
792 | rcutoff = fr->rcoulomb; |
793 | rcutoff2 = rcutoff*rcutoff; |
794 | |
795 | sh_vdw_invrcut6 = fr->ic->sh_invrc6; |
796 | rvdw = fr->rvdw; |
797 | |
798 | outeriter = 0; |
799 | inneriter = 0; |
800 | |
801 | /* Start outer loop over neighborlists */ |
802 | for(iidx=0; iidx<nri; iidx++) |
803 | { |
804 | /* Load shift vector for this list */ |
805 | i_shift_offset = DIM3*shiftidx[iidx]; |
806 | shX = shiftvec[i_shift_offset+XX0]; |
807 | shY = shiftvec[i_shift_offset+YY1]; |
808 | shZ = shiftvec[i_shift_offset+ZZ2]; |
809 | |
810 | /* Load limits for loop over neighbors */ |
811 | j_index_start = jindex[iidx]; |
812 | j_index_end = jindex[iidx+1]; |
813 | |
814 | /* Get outer coordinate index */ |
815 | inr = iinr[iidx]; |
816 | i_coord_offset = DIM3*inr; |
817 | |
818 | /* Load i particle coords and add shift vector */ |
819 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
820 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
821 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
822 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
823 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
824 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
825 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
826 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
827 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
828 | |
829 | fix0 = 0.0; |
830 | fiy0 = 0.0; |
831 | fiz0 = 0.0; |
832 | fix1 = 0.0; |
833 | fiy1 = 0.0; |
834 | fiz1 = 0.0; |
835 | fix2 = 0.0; |
836 | fiy2 = 0.0; |
837 | fiz2 = 0.0; |
838 | |
839 | /* Start inner kernel loop */ |
840 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
841 | { |
842 | /* Get j neighbor index, and coordinate index */ |
843 | jnr = jjnr[jidx]; |
844 | j_coord_offset = DIM3*jnr; |
845 | |
846 | /* load j atom coordinates */ |
847 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
848 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
849 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
850 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
851 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
852 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
853 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
854 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
855 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
856 | |
857 | /* Calculate displacement vector */ |
858 | dx00 = ix0 - jx0; |
859 | dy00 = iy0 - jy0; |
860 | dz00 = iz0 - jz0; |
861 | dx01 = ix0 - jx1; |
862 | dy01 = iy0 - jy1; |
863 | dz01 = iz0 - jz1; |
864 | dx02 = ix0 - jx2; |
865 | dy02 = iy0 - jy2; |
866 | dz02 = iz0 - jz2; |
867 | dx10 = ix1 - jx0; |
868 | dy10 = iy1 - jy0; |
869 | dz10 = iz1 - jz0; |
870 | dx11 = ix1 - jx1; |
871 | dy11 = iy1 - jy1; |
872 | dz11 = iz1 - jz1; |
873 | dx12 = ix1 - jx2; |
874 | dy12 = iy1 - jy2; |
875 | dz12 = iz1 - jz2; |
876 | dx20 = ix2 - jx0; |
877 | dy20 = iy2 - jy0; |
878 | dz20 = iz2 - jz0; |
879 | dx21 = ix2 - jx1; |
880 | dy21 = iy2 - jy1; |
881 | dz21 = iz2 - jz1; |
882 | dx22 = ix2 - jx2; |
883 | dy22 = iy2 - jy2; |
884 | dz22 = iz2 - jz2; |
885 | |
886 | /* Calculate squared distance and things based on it */ |
887 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
888 | rsq01 = dx01*dx01+dy01*dy01+dz01*dz01; |
889 | rsq02 = dx02*dx02+dy02*dy02+dz02*dz02; |
890 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
891 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
892 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
893 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
894 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
895 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
896 | |
897 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
898 | rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01); |
899 | rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02); |
900 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
901 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
902 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
903 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
904 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
905 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
906 | |
907 | rinvsq00 = rinv00*rinv00; |
908 | rinvsq01 = rinv01*rinv01; |
909 | rinvsq02 = rinv02*rinv02; |
910 | rinvsq10 = rinv10*rinv10; |
911 | rinvsq11 = rinv11*rinv11; |
912 | rinvsq12 = rinv12*rinv12; |
913 | rinvsq20 = rinv20*rinv20; |
914 | rinvsq21 = rinv21*rinv21; |
915 | rinvsq22 = rinv22*rinv22; |
916 | |
917 | /************************** |
918 | * CALCULATE INTERACTIONS * |
919 | **************************/ |
920 | |
921 | if (rsq00<rcutoff2) |
922 | { |
923 | |
924 | r00 = rsq00*rinv00; |
925 | |
926 | /* EWALD ELECTROSTATICS */ |
927 | |
928 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
929 | ewrt = r00*ewtabscale; |
930 | ewitab = ewrt; |
931 | eweps = ewrt-ewitab; |
932 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
933 | felec = qq00*rinv00*(rinvsq00-felec); |
934 | |
935 | /* LENNARD-JONES DISPERSION/REPULSION */ |
936 | |
937 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
938 | fvdw = (c12_00*rinvsix-c6_00)*rinvsix*rinvsq00; |
939 | |
940 | fscal = felec+fvdw; |
941 | |
942 | /* Calculate temporary vectorial force */ |
943 | tx = fscal*dx00; |
944 | ty = fscal*dy00; |
945 | tz = fscal*dz00; |
946 | |
947 | /* Update vectorial force */ |
948 | fix0 += tx; |
949 | fiy0 += ty; |
950 | fiz0 += tz; |
951 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
952 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
953 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
954 | |
955 | } |
956 | |
957 | /************************** |
958 | * CALCULATE INTERACTIONS * |
959 | **************************/ |
960 | |
961 | if (rsq01<rcutoff2) |
962 | { |
963 | |
964 | r01 = rsq01*rinv01; |
965 | |
966 | /* EWALD ELECTROSTATICS */ |
967 | |
968 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
969 | ewrt = r01*ewtabscale; |
970 | ewitab = ewrt; |
971 | eweps = ewrt-ewitab; |
972 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
973 | felec = qq01*rinv01*(rinvsq01-felec); |
974 | |
975 | fscal = felec; |
976 | |
977 | /* Calculate temporary vectorial force */ |
978 | tx = fscal*dx01; |
979 | ty = fscal*dy01; |
980 | tz = fscal*dz01; |
981 | |
982 | /* Update vectorial force */ |
983 | fix0 += tx; |
984 | fiy0 += ty; |
985 | fiz0 += tz; |
986 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
987 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
988 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
989 | |
990 | } |
991 | |
992 | /************************** |
993 | * CALCULATE INTERACTIONS * |
994 | **************************/ |
995 | |
996 | if (rsq02<rcutoff2) |
997 | { |
998 | |
999 | r02 = rsq02*rinv02; |
1000 | |
1001 | /* EWALD ELECTROSTATICS */ |
1002 | |
1003 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1004 | ewrt = r02*ewtabscale; |
1005 | ewitab = ewrt; |
1006 | eweps = ewrt-ewitab; |
1007 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1008 | felec = qq02*rinv02*(rinvsq02-felec); |
1009 | |
1010 | fscal = felec; |
1011 | |
1012 | /* Calculate temporary vectorial force */ |
1013 | tx = fscal*dx02; |
1014 | ty = fscal*dy02; |
1015 | tz = fscal*dz02; |
1016 | |
1017 | /* Update vectorial force */ |
1018 | fix0 += tx; |
1019 | fiy0 += ty; |
1020 | fiz0 += tz; |
1021 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1022 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1023 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1024 | |
1025 | } |
1026 | |
1027 | /************************** |
1028 | * CALCULATE INTERACTIONS * |
1029 | **************************/ |
1030 | |
1031 | if (rsq10<rcutoff2) |
1032 | { |
1033 | |
1034 | r10 = rsq10*rinv10; |
1035 | |
1036 | /* EWALD ELECTROSTATICS */ |
1037 | |
1038 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1039 | ewrt = r10*ewtabscale; |
1040 | ewitab = ewrt; |
1041 | eweps = ewrt-ewitab; |
1042 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1043 | felec = qq10*rinv10*(rinvsq10-felec); |
1044 | |
1045 | fscal = felec; |
1046 | |
1047 | /* Calculate temporary vectorial force */ |
1048 | tx = fscal*dx10; |
1049 | ty = fscal*dy10; |
1050 | tz = fscal*dz10; |
1051 | |
1052 | /* Update vectorial force */ |
1053 | fix1 += tx; |
1054 | fiy1 += ty; |
1055 | fiz1 += tz; |
1056 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
1057 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
1058 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
1059 | |
1060 | } |
1061 | |
1062 | /************************** |
1063 | * CALCULATE INTERACTIONS * |
1064 | **************************/ |
1065 | |
1066 | if (rsq11<rcutoff2) |
1067 | { |
1068 | |
1069 | r11 = rsq11*rinv11; |
1070 | |
1071 | /* EWALD ELECTROSTATICS */ |
1072 | |
1073 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1074 | ewrt = r11*ewtabscale; |
1075 | ewitab = ewrt; |
1076 | eweps = ewrt-ewitab; |
1077 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1078 | felec = qq11*rinv11*(rinvsq11-felec); |
1079 | |
1080 | fscal = felec; |
1081 | |
1082 | /* Calculate temporary vectorial force */ |
1083 | tx = fscal*dx11; |
1084 | ty = fscal*dy11; |
1085 | tz = fscal*dz11; |
1086 | |
1087 | /* Update vectorial force */ |
1088 | fix1 += tx; |
1089 | fiy1 += ty; |
1090 | fiz1 += tz; |
1091 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1092 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1093 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1094 | |
1095 | } |
1096 | |
1097 | /************************** |
1098 | * CALCULATE INTERACTIONS * |
1099 | **************************/ |
1100 | |
1101 | if (rsq12<rcutoff2) |
1102 | { |
1103 | |
1104 | r12 = rsq12*rinv12; |
1105 | |
1106 | /* EWALD ELECTROSTATICS */ |
1107 | |
1108 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1109 | ewrt = r12*ewtabscale; |
1110 | ewitab = ewrt; |
1111 | eweps = ewrt-ewitab; |
1112 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1113 | felec = qq12*rinv12*(rinvsq12-felec); |
1114 | |
1115 | fscal = felec; |
1116 | |
1117 | /* Calculate temporary vectorial force */ |
1118 | tx = fscal*dx12; |
1119 | ty = fscal*dy12; |
1120 | tz = fscal*dz12; |
1121 | |
1122 | /* Update vectorial force */ |
1123 | fix1 += tx; |
1124 | fiy1 += ty; |
1125 | fiz1 += tz; |
1126 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1127 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1128 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1129 | |
1130 | } |
1131 | |
1132 | /************************** |
1133 | * CALCULATE INTERACTIONS * |
1134 | **************************/ |
1135 | |
1136 | if (rsq20<rcutoff2) |
1137 | { |
1138 | |
1139 | r20 = rsq20*rinv20; |
1140 | |
1141 | /* EWALD ELECTROSTATICS */ |
1142 | |
1143 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1144 | ewrt = r20*ewtabscale; |
1145 | ewitab = ewrt; |
1146 | eweps = ewrt-ewitab; |
1147 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1148 | felec = qq20*rinv20*(rinvsq20-felec); |
1149 | |
1150 | fscal = felec; |
1151 | |
1152 | /* Calculate temporary vectorial force */ |
1153 | tx = fscal*dx20; |
1154 | ty = fscal*dy20; |
1155 | tz = fscal*dz20; |
1156 | |
1157 | /* Update vectorial force */ |
1158 | fix2 += tx; |
1159 | fiy2 += ty; |
1160 | fiz2 += tz; |
1161 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
1162 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
1163 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
1164 | |
1165 | } |
1166 | |
1167 | /************************** |
1168 | * CALCULATE INTERACTIONS * |
1169 | **************************/ |
1170 | |
1171 | if (rsq21<rcutoff2) |
1172 | { |
1173 | |
1174 | r21 = rsq21*rinv21; |
1175 | |
1176 | /* EWALD ELECTROSTATICS */ |
1177 | |
1178 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1179 | ewrt = r21*ewtabscale; |
1180 | ewitab = ewrt; |
1181 | eweps = ewrt-ewitab; |
1182 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1183 | felec = qq21*rinv21*(rinvsq21-felec); |
1184 | |
1185 | fscal = felec; |
1186 | |
1187 | /* Calculate temporary vectorial force */ |
1188 | tx = fscal*dx21; |
1189 | ty = fscal*dy21; |
1190 | tz = fscal*dz21; |
1191 | |
1192 | /* Update vectorial force */ |
1193 | fix2 += tx; |
1194 | fiy2 += ty; |
1195 | fiz2 += tz; |
1196 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1197 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1198 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1199 | |
1200 | } |
1201 | |
1202 | /************************** |
1203 | * CALCULATE INTERACTIONS * |
1204 | **************************/ |
1205 | |
1206 | if (rsq22<rcutoff2) |
1207 | { |
1208 | |
1209 | r22 = rsq22*rinv22; |
1210 | |
1211 | /* EWALD ELECTROSTATICS */ |
1212 | |
1213 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1214 | ewrt = r22*ewtabscale; |
1215 | ewitab = ewrt; |
1216 | eweps = ewrt-ewitab; |
1217 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1218 | felec = qq22*rinv22*(rinvsq22-felec); |
1219 | |
1220 | fscal = felec; |
1221 | |
1222 | /* Calculate temporary vectorial force */ |
1223 | tx = fscal*dx22; |
1224 | ty = fscal*dy22; |
1225 | tz = fscal*dz22; |
1226 | |
1227 | /* Update vectorial force */ |
1228 | fix2 += tx; |
1229 | fiy2 += ty; |
1230 | fiz2 += tz; |
1231 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1232 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1233 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1234 | |
1235 | } |
1236 | |
1237 | /* Inner loop uses 304 flops */ |
1238 | } |
1239 | /* End of innermost loop */ |
1240 | |
1241 | tx = ty = tz = 0; |
1242 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
1243 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
1244 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
1245 | tx += fix0; |
1246 | ty += fiy0; |
1247 | tz += fiz0; |
1248 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1249 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1250 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1251 | tx += fix1; |
1252 | ty += fiy1; |
1253 | tz += fiz1; |
1254 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1255 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1256 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1257 | tx += fix2; |
1258 | ty += fiy2; |
1259 | tz += fiz2; |
1260 | fshift[i_shift_offset+XX0] += tx; |
1261 | fshift[i_shift_offset+YY1] += ty; |
1262 | fshift[i_shift_offset+ZZ2] += tz; |
1263 | |
1264 | /* Increment number of inner iterations */ |
1265 | inneriter += j_index_end - j_index_start; |
1266 | |
1267 | /* Outer loop uses 30 flops */ |
1268 | } |
1269 | |
1270 | /* Increment number of outer iterations */ |
1271 | outeriter += nri; |
1272 | |
1273 | /* Update outer/inner flops */ |
1274 | |
1275 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*304)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3W3_F] += outeriter*30 + inneriter *304; |
1276 | } |