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