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