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