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