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