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