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