File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecRF_VdwCSTab_GeomW3P1_c.c |
Location: | line 425, 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_ElecRF_VdwCSTab_GeomW3P1_VF_c |
51 | * Electrostatics interaction: ReactionField |
52 | * VdW interaction: CubicSplineTable |
53 | * Geometry: Water3-Particle |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecRF_VdwCSTab_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 nvdwtype; |
86 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
87 | int *vdwtype; |
88 | real *vdwparam; |
89 | int vfitab; |
90 | real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF; |
91 | real *vftab; |
92 | |
93 | x = xx[0]; |
94 | f = ff[0]; |
95 | |
96 | nri = nlist->nri; |
97 | iinr = nlist->iinr; |
98 | jindex = nlist->jindex; |
99 | jjnr = nlist->jjnr; |
100 | shiftidx = nlist->shift; |
101 | gid = nlist->gid; |
102 | shiftvec = fr->shift_vec[0]; |
103 | fshift = fr->fshift[0]; |
104 | facel = fr->epsfac; |
105 | charge = mdatoms->chargeA; |
106 | krf = fr->ic->k_rf; |
107 | krf2 = krf*2.0; |
108 | crf = fr->ic->c_rf; |
109 | nvdwtype = fr->ntype; |
110 | vdwparam = fr->nbfp; |
111 | vdwtype = mdatoms->typeA; |
112 | |
113 | vftab = kernel_data->table_vdw->data; |
114 | vftabscale = kernel_data->table_vdw->scale; |
115 | |
116 | /* Setup water-specific parameters */ |
117 | inr = nlist->iinr[0]; |
118 | iq0 = facel*charge[inr+0]; |
119 | iq1 = facel*charge[inr+1]; |
120 | iq2 = facel*charge[inr+2]; |
121 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
122 | |
123 | outeriter = 0; |
124 | inneriter = 0; |
125 | |
126 | /* Start outer loop over neighborlists */ |
127 | for(iidx=0; iidx<nri; iidx++) |
128 | { |
129 | /* Load shift vector for this list */ |
130 | i_shift_offset = DIM3*shiftidx[iidx]; |
131 | shX = shiftvec[i_shift_offset+XX0]; |
132 | shY = shiftvec[i_shift_offset+YY1]; |
133 | shZ = shiftvec[i_shift_offset+ZZ2]; |
134 | |
135 | /* Load limits for loop over neighbors */ |
136 | j_index_start = jindex[iidx]; |
137 | j_index_end = jindex[iidx+1]; |
138 | |
139 | /* Get outer coordinate index */ |
140 | inr = iinr[iidx]; |
141 | i_coord_offset = DIM3*inr; |
142 | |
143 | /* Load i particle coords and add shift vector */ |
144 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
145 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
146 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
147 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
148 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
149 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
150 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
151 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
152 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
153 | |
154 | fix0 = 0.0; |
155 | fiy0 = 0.0; |
156 | fiz0 = 0.0; |
157 | fix1 = 0.0; |
158 | fiy1 = 0.0; |
159 | fiz1 = 0.0; |
160 | fix2 = 0.0; |
161 | fiy2 = 0.0; |
162 | fiz2 = 0.0; |
163 | |
164 | /* Reset potential sums */ |
165 | velecsum = 0.0; |
166 | vvdwsum = 0.0; |
167 | |
168 | /* Start inner kernel loop */ |
169 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
170 | { |
171 | /* Get j neighbor index, and coordinate index */ |
172 | jnr = jjnr[jidx]; |
173 | j_coord_offset = DIM3*jnr; |
174 | |
175 | /* load j atom coordinates */ |
176 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
177 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
178 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
179 | |
180 | /* Calculate displacement vector */ |
181 | dx00 = ix0 - jx0; |
182 | dy00 = iy0 - jy0; |
183 | dz00 = iz0 - jz0; |
184 | dx10 = ix1 - jx0; |
185 | dy10 = iy1 - jy0; |
186 | dz10 = iz1 - jz0; |
187 | dx20 = ix2 - jx0; |
188 | dy20 = iy2 - jy0; |
189 | dz20 = iz2 - jz0; |
190 | |
191 | /* Calculate squared distance and things based on it */ |
192 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
193 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
194 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
195 | |
196 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
197 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
198 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
199 | |
200 | rinvsq00 = rinv00*rinv00; |
201 | rinvsq10 = rinv10*rinv10; |
202 | rinvsq20 = rinv20*rinv20; |
203 | |
204 | /* Load parameters for j particles */ |
205 | jq0 = charge[jnr+0]; |
206 | vdwjidx0 = 2*vdwtype[jnr+0]; |
207 | |
208 | /************************** |
209 | * CALCULATE INTERACTIONS * |
210 | **************************/ |
211 | |
212 | r00 = rsq00*rinv00; |
213 | |
214 | qq00 = iq0*jq0; |
215 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
216 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
217 | |
218 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
219 | rt = r00*vftabscale; |
220 | vfitab = rt; |
221 | vfeps = rt-vfitab; |
222 | vfitab = 2*4*vfitab; |
223 | |
224 | /* REACTION-FIELD ELECTROSTATICS */ |
225 | velec = qq00*(rinv00+krf*rsq00-crf); |
226 | felec = qq00*(rinv00*rinvsq00-krf2); |
227 | |
228 | /* CUBIC SPLINE TABLE DISPERSION */ |
229 | vfitab += 0; |
230 | Y = vftab[vfitab]; |
231 | F = vftab[vfitab+1]; |
232 | Geps = vfeps*vftab[vfitab+2]; |
233 | Heps2 = vfeps*vfeps*vftab[vfitab+3]; |
234 | Fp = F+Geps+Heps2; |
235 | VV = Y+vfeps*Fp; |
236 | vvdw6 = c6_00*VV; |
237 | FF = Fp+Geps+2.0*Heps2; |
238 | fvdw6 = c6_00*FF; |
239 | |
240 | /* CUBIC SPLINE TABLE REPULSION */ |
241 | Y = vftab[vfitab+4]; |
242 | F = vftab[vfitab+5]; |
243 | Geps = vfeps*vftab[vfitab+6]; |
244 | Heps2 = vfeps*vfeps*vftab[vfitab+7]; |
245 | Fp = F+Geps+Heps2; |
246 | VV = Y+vfeps*Fp; |
247 | vvdw12 = c12_00*VV; |
248 | FF = Fp+Geps+2.0*Heps2; |
249 | fvdw12 = c12_00*FF; |
250 | vvdw = vvdw12+vvdw6; |
251 | fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00; |
252 | |
253 | /* Update potential sums from outer loop */ |
254 | velecsum += velec; |
255 | vvdwsum += vvdw; |
256 | |
257 | fscal = felec+fvdw; |
258 | |
259 | /* Calculate temporary vectorial force */ |
260 | tx = fscal*dx00; |
261 | ty = fscal*dy00; |
262 | tz = fscal*dz00; |
263 | |
264 | /* Update vectorial force */ |
265 | fix0 += tx; |
266 | fiy0 += ty; |
267 | fiz0 += tz; |
268 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
269 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
270 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
271 | |
272 | /************************** |
273 | * CALCULATE INTERACTIONS * |
274 | **************************/ |
275 | |
276 | qq10 = iq1*jq0; |
277 | |
278 | /* REACTION-FIELD ELECTROSTATICS */ |
279 | velec = qq10*(rinv10+krf*rsq10-crf); |
280 | felec = qq10*(rinv10*rinvsq10-krf2); |
281 | |
282 | /* Update potential sums from outer loop */ |
283 | velecsum += velec; |
284 | |
285 | fscal = felec; |
286 | |
287 | /* Calculate temporary vectorial force */ |
288 | tx = fscal*dx10; |
289 | ty = fscal*dy10; |
290 | tz = fscal*dz10; |
291 | |
292 | /* Update vectorial force */ |
293 | fix1 += tx; |
294 | fiy1 += ty; |
295 | fiz1 += tz; |
296 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
297 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
298 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
299 | |
300 | /************************** |
301 | * CALCULATE INTERACTIONS * |
302 | **************************/ |
303 | |
304 | qq20 = iq2*jq0; |
305 | |
306 | /* REACTION-FIELD ELECTROSTATICS */ |
307 | velec = qq20*(rinv20+krf*rsq20-crf); |
308 | felec = qq20*(rinv20*rinvsq20-krf2); |
309 | |
310 | /* Update potential sums from outer loop */ |
311 | velecsum += velec; |
312 | |
313 | fscal = felec; |
314 | |
315 | /* Calculate temporary vectorial force */ |
316 | tx = fscal*dx20; |
317 | ty = fscal*dy20; |
318 | tz = fscal*dz20; |
319 | |
320 | /* Update vectorial force */ |
321 | fix2 += tx; |
322 | fiy2 += ty; |
323 | fiz2 += tz; |
324 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
325 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
326 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
327 | |
328 | /* Inner loop uses 130 flops */ |
329 | } |
330 | /* End of innermost loop */ |
331 | |
332 | tx = ty = tz = 0; |
333 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
334 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
335 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
336 | tx += fix0; |
337 | ty += fiy0; |
338 | tz += fiz0; |
339 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
340 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
341 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
342 | tx += fix1; |
343 | ty += fiy1; |
344 | tz += fiz1; |
345 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
346 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
347 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
348 | tx += fix2; |
349 | ty += fiy2; |
350 | tz += fiz2; |
351 | fshift[i_shift_offset+XX0] += tx; |
352 | fshift[i_shift_offset+YY1] += ty; |
353 | fshift[i_shift_offset+ZZ2] += tz; |
354 | |
355 | ggid = gid[iidx]; |
356 | /* Update potential energies */ |
357 | kernel_data->energygrp_elec[ggid] += velecsum; |
358 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
359 | |
360 | /* Increment number of inner iterations */ |
361 | inneriter += j_index_end - j_index_start; |
362 | |
363 | /* Outer loop uses 32 flops */ |
364 | } |
365 | |
366 | /* Increment number of outer iterations */ |
367 | outeriter += nri; |
368 | |
369 | /* Update outer/inner flops */ |
370 | |
371 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*130)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_VF] += outeriter*32 + inneriter *130; |
372 | } |
373 | /* |
374 | * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_c |
375 | * Electrostatics interaction: ReactionField |
376 | * VdW interaction: CubicSplineTable |
377 | * Geometry: Water3-Particle |
378 | * Calculate force/pot: Force |
379 | */ |
380 | void |
381 | nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_c |
382 | (t_nblist * gmx_restrict__restrict nlist, |
383 | rvec * gmx_restrict__restrict xx, |
384 | rvec * gmx_restrict__restrict ff, |
385 | t_forcerec * gmx_restrict__restrict fr, |
386 | t_mdatoms * gmx_restrict__restrict mdatoms, |
387 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
388 | t_nrnb * gmx_restrict__restrict nrnb) |
389 | { |
390 | int i_shift_offset,i_coord_offset,j_coord_offset; |
391 | int j_index_start,j_index_end; |
392 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
393 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
394 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
395 | real *shiftvec,*fshift,*x,*f; |
396 | int vdwioffset0; |
397 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
398 | int vdwioffset1; |
399 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
400 | int vdwioffset2; |
401 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
402 | int vdwjidx0; |
403 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
404 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
405 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
406 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
407 | real velec,felec,velecsum,facel,crf,krf,krf2; |
408 | real *charge; |
409 | int nvdwtype; |
410 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
411 | int *vdwtype; |
412 | real *vdwparam; |
413 | int vfitab; |
414 | real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF; |
415 | real *vftab; |
416 | |
417 | x = xx[0]; |
418 | f = ff[0]; |
419 | |
420 | nri = nlist->nri; |
421 | iinr = nlist->iinr; |
422 | jindex = nlist->jindex; |
423 | jjnr = nlist->jjnr; |
424 | shiftidx = nlist->shift; |
425 | gid = nlist->gid; |
Value stored to 'gid' is never read | |
426 | shiftvec = fr->shift_vec[0]; |
427 | fshift = fr->fshift[0]; |
428 | facel = fr->epsfac; |
429 | charge = mdatoms->chargeA; |
430 | krf = fr->ic->k_rf; |
431 | krf2 = krf*2.0; |
432 | crf = fr->ic->c_rf; |
433 | nvdwtype = fr->ntype; |
434 | vdwparam = fr->nbfp; |
435 | vdwtype = mdatoms->typeA; |
436 | |
437 | vftab = kernel_data->table_vdw->data; |
438 | vftabscale = kernel_data->table_vdw->scale; |
439 | |
440 | /* Setup water-specific parameters */ |
441 | inr = nlist->iinr[0]; |
442 | iq0 = facel*charge[inr+0]; |
443 | iq1 = facel*charge[inr+1]; |
444 | iq2 = facel*charge[inr+2]; |
445 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
446 | |
447 | outeriter = 0; |
448 | inneriter = 0; |
449 | |
450 | /* Start outer loop over neighborlists */ |
451 | for(iidx=0; iidx<nri; iidx++) |
452 | { |
453 | /* Load shift vector for this list */ |
454 | i_shift_offset = DIM3*shiftidx[iidx]; |
455 | shX = shiftvec[i_shift_offset+XX0]; |
456 | shY = shiftvec[i_shift_offset+YY1]; |
457 | shZ = shiftvec[i_shift_offset+ZZ2]; |
458 | |
459 | /* Load limits for loop over neighbors */ |
460 | j_index_start = jindex[iidx]; |
461 | j_index_end = jindex[iidx+1]; |
462 | |
463 | /* Get outer coordinate index */ |
464 | inr = iinr[iidx]; |
465 | i_coord_offset = DIM3*inr; |
466 | |
467 | /* Load i particle coords and add shift vector */ |
468 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
469 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
470 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
471 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
472 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
473 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
474 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
475 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
476 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
477 | |
478 | fix0 = 0.0; |
479 | fiy0 = 0.0; |
480 | fiz0 = 0.0; |
481 | fix1 = 0.0; |
482 | fiy1 = 0.0; |
483 | fiz1 = 0.0; |
484 | fix2 = 0.0; |
485 | fiy2 = 0.0; |
486 | fiz2 = 0.0; |
487 | |
488 | /* Start inner kernel loop */ |
489 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
490 | { |
491 | /* Get j neighbor index, and coordinate index */ |
492 | jnr = jjnr[jidx]; |
493 | j_coord_offset = DIM3*jnr; |
494 | |
495 | /* load j atom coordinates */ |
496 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
497 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
498 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
499 | |
500 | /* Calculate displacement vector */ |
501 | dx00 = ix0 - jx0; |
502 | dy00 = iy0 - jy0; |
503 | dz00 = iz0 - jz0; |
504 | dx10 = ix1 - jx0; |
505 | dy10 = iy1 - jy0; |
506 | dz10 = iz1 - jz0; |
507 | dx20 = ix2 - jx0; |
508 | dy20 = iy2 - jy0; |
509 | dz20 = iz2 - jz0; |
510 | |
511 | /* Calculate squared distance and things based on it */ |
512 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
513 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
514 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
515 | |
516 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
517 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
518 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
519 | |
520 | rinvsq00 = rinv00*rinv00; |
521 | rinvsq10 = rinv10*rinv10; |
522 | rinvsq20 = rinv20*rinv20; |
523 | |
524 | /* Load parameters for j particles */ |
525 | jq0 = charge[jnr+0]; |
526 | vdwjidx0 = 2*vdwtype[jnr+0]; |
527 | |
528 | /************************** |
529 | * CALCULATE INTERACTIONS * |
530 | **************************/ |
531 | |
532 | r00 = rsq00*rinv00; |
533 | |
534 | qq00 = iq0*jq0; |
535 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
536 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
537 | |
538 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
539 | rt = r00*vftabscale; |
540 | vfitab = rt; |
541 | vfeps = rt-vfitab; |
542 | vfitab = 2*4*vfitab; |
543 | |
544 | /* REACTION-FIELD ELECTROSTATICS */ |
545 | felec = qq00*(rinv00*rinvsq00-krf2); |
546 | |
547 | /* CUBIC SPLINE TABLE DISPERSION */ |
548 | vfitab += 0; |
549 | F = vftab[vfitab+1]; |
550 | Geps = vfeps*vftab[vfitab+2]; |
551 | Heps2 = vfeps*vfeps*vftab[vfitab+3]; |
552 | Fp = F+Geps+Heps2; |
553 | FF = Fp+Geps+2.0*Heps2; |
554 | fvdw6 = c6_00*FF; |
555 | |
556 | /* CUBIC SPLINE TABLE REPULSION */ |
557 | F = vftab[vfitab+5]; |
558 | Geps = vfeps*vftab[vfitab+6]; |
559 | Heps2 = vfeps*vfeps*vftab[vfitab+7]; |
560 | Fp = F+Geps+Heps2; |
561 | FF = Fp+Geps+2.0*Heps2; |
562 | fvdw12 = c12_00*FF; |
563 | fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00; |
564 | |
565 | fscal = felec+fvdw; |
566 | |
567 | /* Calculate temporary vectorial force */ |
568 | tx = fscal*dx00; |
569 | ty = fscal*dy00; |
570 | tz = fscal*dz00; |
571 | |
572 | /* Update vectorial force */ |
573 | fix0 += tx; |
574 | fiy0 += ty; |
575 | fiz0 += tz; |
576 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
577 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
578 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
579 | |
580 | /************************** |
581 | * CALCULATE INTERACTIONS * |
582 | **************************/ |
583 | |
584 | qq10 = iq1*jq0; |
585 | |
586 | /* REACTION-FIELD ELECTROSTATICS */ |
587 | felec = qq10*(rinv10*rinvsq10-krf2); |
588 | |
589 | fscal = felec; |
590 | |
591 | /* Calculate temporary vectorial force */ |
592 | tx = fscal*dx10; |
593 | ty = fscal*dy10; |
594 | tz = fscal*dz10; |
595 | |
596 | /* Update vectorial force */ |
597 | fix1 += tx; |
598 | fiy1 += ty; |
599 | fiz1 += tz; |
600 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
601 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
602 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
603 | |
604 | /************************** |
605 | * CALCULATE INTERACTIONS * |
606 | **************************/ |
607 | |
608 | qq20 = iq2*jq0; |
609 | |
610 | /* REACTION-FIELD ELECTROSTATICS */ |
611 | felec = qq20*(rinv20*rinvsq20-krf2); |
612 | |
613 | fscal = felec; |
614 | |
615 | /* Calculate temporary vectorial force */ |
616 | tx = fscal*dx20; |
617 | ty = fscal*dy20; |
618 | tz = fscal*dz20; |
619 | |
620 | /* Update vectorial force */ |
621 | fix2 += tx; |
622 | fiy2 += ty; |
623 | fiz2 += tz; |
624 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
625 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
626 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
627 | |
628 | /* Inner loop uses 107 flops */ |
629 | } |
630 | /* End of innermost loop */ |
631 | |
632 | tx = ty = tz = 0; |
633 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
634 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
635 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
636 | tx += fix0; |
637 | ty += fiy0; |
638 | tz += fiz0; |
639 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
640 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
641 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
642 | tx += fix1; |
643 | ty += fiy1; |
644 | tz += fiz1; |
645 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
646 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
647 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
648 | tx += fix2; |
649 | ty += fiy2; |
650 | tz += fiz2; |
651 | fshift[i_shift_offset+XX0] += tx; |
652 | fshift[i_shift_offset+YY1] += ty; |
653 | fshift[i_shift_offset+ZZ2] += tz; |
654 | |
655 | /* Increment number of inner iterations */ |
656 | inneriter += j_index_end - j_index_start; |
657 | |
658 | /* Outer loop uses 30 flops */ |
659 | } |
660 | |
661 | /* Increment number of outer iterations */ |
662 | outeriter += nri; |
663 | |
664 | /* Update outer/inner flops */ |
665 | |
666 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*107)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_F] += outeriter*30 + inneriter *107; |
667 | } |