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