File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEwSh_VdwBhamSh_GeomW4W4_c.c |
Location: | line 857, column 5 |
Description: | Value stored to 'rvdw' 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_VdwBhamSh_GeomW4W4_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: Buckingham |
53 | * Geometry: Water4-Water4 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEwSh_VdwBhamSh_GeomW4W4_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 | int vdwjidx1; |
83 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
84 | int vdwjidx2; |
85 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
86 | int vdwjidx3; |
87 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
88 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
89 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
90 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
91 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
92 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
93 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
94 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
95 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
96 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
97 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
98 | real velec,felec,velecsum,facel,crf,krf,krf2; |
99 | real *charge; |
100 | int nvdwtype; |
101 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
102 | int *vdwtype; |
103 | real *vdwparam; |
104 | int ewitab; |
105 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
106 | real *ewtab; |
107 | |
108 | x = xx[0]; |
109 | f = ff[0]; |
110 | |
111 | nri = nlist->nri; |
112 | iinr = nlist->iinr; |
113 | jindex = nlist->jindex; |
114 | jjnr = nlist->jjnr; |
115 | shiftidx = nlist->shift; |
116 | gid = nlist->gid; |
117 | shiftvec = fr->shift_vec[0]; |
118 | fshift = fr->fshift[0]; |
119 | facel = fr->epsfac; |
120 | charge = mdatoms->chargeA; |
121 | nvdwtype = fr->ntype; |
122 | vdwparam = fr->nbfp; |
123 | vdwtype = mdatoms->typeA; |
124 | |
125 | sh_ewald = fr->ic->sh_ewald; |
126 | ewtab = fr->ic->tabq_coul_FDV0; |
127 | ewtabscale = fr->ic->tabq_scale; |
128 | ewtabhalfspace = 0.5/ewtabscale; |
129 | |
130 | /* Setup water-specific parameters */ |
131 | inr = nlist->iinr[0]; |
132 | iq1 = facel*charge[inr+1]; |
133 | iq2 = facel*charge[inr+2]; |
134 | iq3 = facel*charge[inr+3]; |
135 | vdwioffset0 = 3*nvdwtype*vdwtype[inr+0]; |
136 | |
137 | jq1 = charge[inr+1]; |
138 | jq2 = charge[inr+2]; |
139 | jq3 = charge[inr+3]; |
140 | vdwjidx0 = 3*vdwtype[inr+0]; |
141 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
142 | cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
143 | cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2]; |
144 | qq11 = iq1*jq1; |
145 | qq12 = iq1*jq2; |
146 | qq13 = iq1*jq3; |
147 | qq21 = iq2*jq1; |
148 | qq22 = iq2*jq2; |
149 | qq23 = iq2*jq3; |
150 | qq31 = iq3*jq1; |
151 | qq32 = iq3*jq2; |
152 | qq33 = iq3*jq3; |
153 | |
154 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
155 | rcutoff = fr->rcoulomb; |
156 | rcutoff2 = rcutoff*rcutoff; |
157 | |
158 | sh_vdw_invrcut6 = fr->ic->sh_invrc6; |
159 | rvdw = fr->rvdw; |
160 | |
161 | outeriter = 0; |
162 | inneriter = 0; |
163 | |
164 | /* Start outer loop over neighborlists */ |
165 | for(iidx=0; iidx<nri; iidx++) |
166 | { |
167 | /* Load shift vector for this list */ |
168 | i_shift_offset = DIM3*shiftidx[iidx]; |
169 | shX = shiftvec[i_shift_offset+XX0]; |
170 | shY = shiftvec[i_shift_offset+YY1]; |
171 | shZ = shiftvec[i_shift_offset+ZZ2]; |
172 | |
173 | /* Load limits for loop over neighbors */ |
174 | j_index_start = jindex[iidx]; |
175 | j_index_end = jindex[iidx+1]; |
176 | |
177 | /* Get outer coordinate index */ |
178 | inr = iinr[iidx]; |
179 | i_coord_offset = DIM3*inr; |
180 | |
181 | /* Load i particle coords and add shift vector */ |
182 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
183 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
184 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
185 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
186 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
187 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
188 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
189 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
190 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
191 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
192 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
193 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
194 | |
195 | fix0 = 0.0; |
196 | fiy0 = 0.0; |
197 | fiz0 = 0.0; |
198 | fix1 = 0.0; |
199 | fiy1 = 0.0; |
200 | fiz1 = 0.0; |
201 | fix2 = 0.0; |
202 | fiy2 = 0.0; |
203 | fiz2 = 0.0; |
204 | fix3 = 0.0; |
205 | fiy3 = 0.0; |
206 | fiz3 = 0.0; |
207 | |
208 | /* Reset potential sums */ |
209 | velecsum = 0.0; |
210 | vvdwsum = 0.0; |
211 | |
212 | /* Start inner kernel loop */ |
213 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
214 | { |
215 | /* Get j neighbor index, and coordinate index */ |
216 | jnr = jjnr[jidx]; |
217 | j_coord_offset = DIM3*jnr; |
218 | |
219 | /* load j atom coordinates */ |
220 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
221 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
222 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
223 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
224 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
225 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
226 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
227 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
228 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
229 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
230 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
231 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
232 | |
233 | /* Calculate displacement vector */ |
234 | dx00 = ix0 - jx0; |
235 | dy00 = iy0 - jy0; |
236 | dz00 = iz0 - jz0; |
237 | dx11 = ix1 - jx1; |
238 | dy11 = iy1 - jy1; |
239 | dz11 = iz1 - jz1; |
240 | dx12 = ix1 - jx2; |
241 | dy12 = iy1 - jy2; |
242 | dz12 = iz1 - jz2; |
243 | dx13 = ix1 - jx3; |
244 | dy13 = iy1 - jy3; |
245 | dz13 = iz1 - jz3; |
246 | dx21 = ix2 - jx1; |
247 | dy21 = iy2 - jy1; |
248 | dz21 = iz2 - jz1; |
249 | dx22 = ix2 - jx2; |
250 | dy22 = iy2 - jy2; |
251 | dz22 = iz2 - jz2; |
252 | dx23 = ix2 - jx3; |
253 | dy23 = iy2 - jy3; |
254 | dz23 = iz2 - jz3; |
255 | dx31 = ix3 - jx1; |
256 | dy31 = iy3 - jy1; |
257 | dz31 = iz3 - jz1; |
258 | dx32 = ix3 - jx2; |
259 | dy32 = iy3 - jy2; |
260 | dz32 = iz3 - jz2; |
261 | dx33 = ix3 - jx3; |
262 | dy33 = iy3 - jy3; |
263 | dz33 = iz3 - jz3; |
264 | |
265 | /* Calculate squared distance and things based on it */ |
266 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
267 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
268 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
269 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
270 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
271 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
272 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
273 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
274 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
275 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
276 | |
277 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
278 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
279 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
280 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
281 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
282 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
283 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
284 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
285 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
286 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
287 | |
288 | rinvsq00 = rinv00*rinv00; |
289 | rinvsq11 = rinv11*rinv11; |
290 | rinvsq12 = rinv12*rinv12; |
291 | rinvsq13 = rinv13*rinv13; |
292 | rinvsq21 = rinv21*rinv21; |
293 | rinvsq22 = rinv22*rinv22; |
294 | rinvsq23 = rinv23*rinv23; |
295 | rinvsq31 = rinv31*rinv31; |
296 | rinvsq32 = rinv32*rinv32; |
297 | rinvsq33 = rinv33*rinv33; |
298 | |
299 | /************************** |
300 | * CALCULATE INTERACTIONS * |
301 | **************************/ |
302 | |
303 | if (rsq00<rcutoff2) |
304 | { |
305 | |
306 | r00 = rsq00*rinv00; |
307 | |
308 | /* BUCKINGHAM DISPERSION/REPULSION */ |
309 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
310 | vvdw6 = c6_00*rinvsix; |
311 | br = cexp2_00*r00; |
312 | vvdwexp = cexp1_00*exp(-br); |
313 | vvdw = (vvdwexp-cexp1_00*exp(-cexp2_00*rvdw)) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0); |
314 | fvdw = (br*vvdwexp-vvdw6)*rinvsq00; |
315 | |
316 | /* Update potential sums from outer loop */ |
317 | vvdwsum += vvdw; |
318 | |
319 | fscal = fvdw; |
320 | |
321 | /* Calculate temporary vectorial force */ |
322 | tx = fscal*dx00; |
323 | ty = fscal*dy00; |
324 | tz = fscal*dz00; |
325 | |
326 | /* Update vectorial force */ |
327 | fix0 += tx; |
328 | fiy0 += ty; |
329 | fiz0 += tz; |
330 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
331 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
332 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
333 | |
334 | } |
335 | |
336 | /************************** |
337 | * CALCULATE INTERACTIONS * |
338 | **************************/ |
339 | |
340 | if (rsq11<rcutoff2) |
341 | { |
342 | |
343 | r11 = rsq11*rinv11; |
344 | |
345 | /* EWALD ELECTROSTATICS */ |
346 | |
347 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
348 | ewrt = r11*ewtabscale; |
349 | ewitab = ewrt; |
350 | eweps = ewrt-ewitab; |
351 | ewitab = 4*ewitab; |
352 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
353 | velec = qq11*((rinv11-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
354 | felec = qq11*rinv11*(rinvsq11-felec); |
355 | |
356 | /* Update potential sums from outer loop */ |
357 | velecsum += velec; |
358 | |
359 | fscal = felec; |
360 | |
361 | /* Calculate temporary vectorial force */ |
362 | tx = fscal*dx11; |
363 | ty = fscal*dy11; |
364 | tz = fscal*dz11; |
365 | |
366 | /* Update vectorial force */ |
367 | fix1 += tx; |
368 | fiy1 += ty; |
369 | fiz1 += tz; |
370 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
371 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
372 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
373 | |
374 | } |
375 | |
376 | /************************** |
377 | * CALCULATE INTERACTIONS * |
378 | **************************/ |
379 | |
380 | if (rsq12<rcutoff2) |
381 | { |
382 | |
383 | r12 = rsq12*rinv12; |
384 | |
385 | /* EWALD ELECTROSTATICS */ |
386 | |
387 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
388 | ewrt = r12*ewtabscale; |
389 | ewitab = ewrt; |
390 | eweps = ewrt-ewitab; |
391 | ewitab = 4*ewitab; |
392 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
393 | velec = qq12*((rinv12-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
394 | felec = qq12*rinv12*(rinvsq12-felec); |
395 | |
396 | /* Update potential sums from outer loop */ |
397 | velecsum += velec; |
398 | |
399 | fscal = felec; |
400 | |
401 | /* Calculate temporary vectorial force */ |
402 | tx = fscal*dx12; |
403 | ty = fscal*dy12; |
404 | tz = fscal*dz12; |
405 | |
406 | /* Update vectorial force */ |
407 | fix1 += tx; |
408 | fiy1 += ty; |
409 | fiz1 += tz; |
410 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
411 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
412 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
413 | |
414 | } |
415 | |
416 | /************************** |
417 | * CALCULATE INTERACTIONS * |
418 | **************************/ |
419 | |
420 | if (rsq13<rcutoff2) |
421 | { |
422 | |
423 | r13 = rsq13*rinv13; |
424 | |
425 | /* EWALD ELECTROSTATICS */ |
426 | |
427 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
428 | ewrt = r13*ewtabscale; |
429 | ewitab = ewrt; |
430 | eweps = ewrt-ewitab; |
431 | ewitab = 4*ewitab; |
432 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
433 | velec = qq13*((rinv13-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
434 | felec = qq13*rinv13*(rinvsq13-felec); |
435 | |
436 | /* Update potential sums from outer loop */ |
437 | velecsum += velec; |
438 | |
439 | fscal = felec; |
440 | |
441 | /* Calculate temporary vectorial force */ |
442 | tx = fscal*dx13; |
443 | ty = fscal*dy13; |
444 | tz = fscal*dz13; |
445 | |
446 | /* Update vectorial force */ |
447 | fix1 += tx; |
448 | fiy1 += ty; |
449 | fiz1 += tz; |
450 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
451 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
452 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
453 | |
454 | } |
455 | |
456 | /************************** |
457 | * CALCULATE INTERACTIONS * |
458 | **************************/ |
459 | |
460 | if (rsq21<rcutoff2) |
461 | { |
462 | |
463 | r21 = rsq21*rinv21; |
464 | |
465 | /* EWALD ELECTROSTATICS */ |
466 | |
467 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
468 | ewrt = r21*ewtabscale; |
469 | ewitab = ewrt; |
470 | eweps = ewrt-ewitab; |
471 | ewitab = 4*ewitab; |
472 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
473 | velec = qq21*((rinv21-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
474 | felec = qq21*rinv21*(rinvsq21-felec); |
475 | |
476 | /* Update potential sums from outer loop */ |
477 | velecsum += velec; |
478 | |
479 | fscal = felec; |
480 | |
481 | /* Calculate temporary vectorial force */ |
482 | tx = fscal*dx21; |
483 | ty = fscal*dy21; |
484 | tz = fscal*dz21; |
485 | |
486 | /* Update vectorial force */ |
487 | fix2 += tx; |
488 | fiy2 += ty; |
489 | fiz2 += tz; |
490 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
491 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
492 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
493 | |
494 | } |
495 | |
496 | /************************** |
497 | * CALCULATE INTERACTIONS * |
498 | **************************/ |
499 | |
500 | if (rsq22<rcutoff2) |
501 | { |
502 | |
503 | r22 = rsq22*rinv22; |
504 | |
505 | /* EWALD ELECTROSTATICS */ |
506 | |
507 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
508 | ewrt = r22*ewtabscale; |
509 | ewitab = ewrt; |
510 | eweps = ewrt-ewitab; |
511 | ewitab = 4*ewitab; |
512 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
513 | velec = qq22*((rinv22-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
514 | felec = qq22*rinv22*(rinvsq22-felec); |
515 | |
516 | /* Update potential sums from outer loop */ |
517 | velecsum += velec; |
518 | |
519 | fscal = felec; |
520 | |
521 | /* Calculate temporary vectorial force */ |
522 | tx = fscal*dx22; |
523 | ty = fscal*dy22; |
524 | tz = fscal*dz22; |
525 | |
526 | /* Update vectorial force */ |
527 | fix2 += tx; |
528 | fiy2 += ty; |
529 | fiz2 += tz; |
530 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
531 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
532 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
533 | |
534 | } |
535 | |
536 | /************************** |
537 | * CALCULATE INTERACTIONS * |
538 | **************************/ |
539 | |
540 | if (rsq23<rcutoff2) |
541 | { |
542 | |
543 | r23 = rsq23*rinv23; |
544 | |
545 | /* EWALD ELECTROSTATICS */ |
546 | |
547 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
548 | ewrt = r23*ewtabscale; |
549 | ewitab = ewrt; |
550 | eweps = ewrt-ewitab; |
551 | ewitab = 4*ewitab; |
552 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
553 | velec = qq23*((rinv23-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
554 | felec = qq23*rinv23*(rinvsq23-felec); |
555 | |
556 | /* Update potential sums from outer loop */ |
557 | velecsum += velec; |
558 | |
559 | fscal = felec; |
560 | |
561 | /* Calculate temporary vectorial force */ |
562 | tx = fscal*dx23; |
563 | ty = fscal*dy23; |
564 | tz = fscal*dz23; |
565 | |
566 | /* Update vectorial force */ |
567 | fix2 += tx; |
568 | fiy2 += ty; |
569 | fiz2 += tz; |
570 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
571 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
572 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
573 | |
574 | } |
575 | |
576 | /************************** |
577 | * CALCULATE INTERACTIONS * |
578 | **************************/ |
579 | |
580 | if (rsq31<rcutoff2) |
581 | { |
582 | |
583 | r31 = rsq31*rinv31; |
584 | |
585 | /* EWALD ELECTROSTATICS */ |
586 | |
587 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
588 | ewrt = r31*ewtabscale; |
589 | ewitab = ewrt; |
590 | eweps = ewrt-ewitab; |
591 | ewitab = 4*ewitab; |
592 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
593 | velec = qq31*((rinv31-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
594 | felec = qq31*rinv31*(rinvsq31-felec); |
595 | |
596 | /* Update potential sums from outer loop */ |
597 | velecsum += velec; |
598 | |
599 | fscal = felec; |
600 | |
601 | /* Calculate temporary vectorial force */ |
602 | tx = fscal*dx31; |
603 | ty = fscal*dy31; |
604 | tz = fscal*dz31; |
605 | |
606 | /* Update vectorial force */ |
607 | fix3 += tx; |
608 | fiy3 += ty; |
609 | fiz3 += tz; |
610 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
611 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
612 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
613 | |
614 | } |
615 | |
616 | /************************** |
617 | * CALCULATE INTERACTIONS * |
618 | **************************/ |
619 | |
620 | if (rsq32<rcutoff2) |
621 | { |
622 | |
623 | r32 = rsq32*rinv32; |
624 | |
625 | /* EWALD ELECTROSTATICS */ |
626 | |
627 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
628 | ewrt = r32*ewtabscale; |
629 | ewitab = ewrt; |
630 | eweps = ewrt-ewitab; |
631 | ewitab = 4*ewitab; |
632 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
633 | velec = qq32*((rinv32-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
634 | felec = qq32*rinv32*(rinvsq32-felec); |
635 | |
636 | /* Update potential sums from outer loop */ |
637 | velecsum += velec; |
638 | |
639 | fscal = felec; |
640 | |
641 | /* Calculate temporary vectorial force */ |
642 | tx = fscal*dx32; |
643 | ty = fscal*dy32; |
644 | tz = fscal*dz32; |
645 | |
646 | /* Update vectorial force */ |
647 | fix3 += tx; |
648 | fiy3 += ty; |
649 | fiz3 += tz; |
650 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
651 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
652 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
653 | |
654 | } |
655 | |
656 | /************************** |
657 | * CALCULATE INTERACTIONS * |
658 | **************************/ |
659 | |
660 | if (rsq33<rcutoff2) |
661 | { |
662 | |
663 | r33 = rsq33*rinv33; |
664 | |
665 | /* EWALD ELECTROSTATICS */ |
666 | |
667 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
668 | ewrt = r33*ewtabscale; |
669 | ewitab = ewrt; |
670 | eweps = ewrt-ewitab; |
671 | ewitab = 4*ewitab; |
672 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
673 | velec = qq33*((rinv33-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
674 | felec = qq33*rinv33*(rinvsq33-felec); |
675 | |
676 | /* Update potential sums from outer loop */ |
677 | velecsum += velec; |
678 | |
679 | fscal = felec; |
680 | |
681 | /* Calculate temporary vectorial force */ |
682 | tx = fscal*dx33; |
683 | ty = fscal*dy33; |
684 | tz = fscal*dz33; |
685 | |
686 | /* Update vectorial force */ |
687 | fix3 += tx; |
688 | fiy3 += ty; |
689 | fiz3 += tz; |
690 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
691 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
692 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
693 | |
694 | } |
695 | |
696 | /* Inner loop uses 461 flops */ |
697 | } |
698 | /* End of innermost loop */ |
699 | |
700 | tx = ty = tz = 0; |
701 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
702 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
703 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
704 | tx += fix0; |
705 | ty += fiy0; |
706 | tz += fiz0; |
707 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
708 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
709 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
710 | tx += fix1; |
711 | ty += fiy1; |
712 | tz += fiz1; |
713 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
714 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
715 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
716 | tx += fix2; |
717 | ty += fiy2; |
718 | tz += fiz2; |
719 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
720 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
721 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
722 | tx += fix3; |
723 | ty += fiy3; |
724 | tz += fiz3; |
725 | fshift[i_shift_offset+XX0] += tx; |
726 | fshift[i_shift_offset+YY1] += ty; |
727 | fshift[i_shift_offset+ZZ2] += tz; |
728 | |
729 | ggid = gid[iidx]; |
730 | /* Update potential energies */ |
731 | kernel_data->energygrp_elec[ggid] += velecsum; |
732 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
733 | |
734 | /* Increment number of inner iterations */ |
735 | inneriter += j_index_end - j_index_start; |
736 | |
737 | /* Outer loop uses 41 flops */ |
738 | } |
739 | |
740 | /* Increment number of outer iterations */ |
741 | outeriter += nri; |
742 | |
743 | /* Update outer/inner flops */ |
744 | |
745 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*461)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_VF] += outeriter*41 + inneriter*461; |
746 | } |
747 | /* |
748 | * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwBhamSh_GeomW4W4_F_c |
749 | * Electrostatics interaction: Ewald |
750 | * VdW interaction: Buckingham |
751 | * Geometry: Water4-Water4 |
752 | * Calculate force/pot: Force |
753 | */ |
754 | void |
755 | nb_kernel_ElecEwSh_VdwBhamSh_GeomW4W4_F_c |
756 | (t_nblist * gmx_restrict__restrict nlist, |
757 | rvec * gmx_restrict__restrict xx, |
758 | rvec * gmx_restrict__restrict ff, |
759 | t_forcerec * gmx_restrict__restrict fr, |
760 | t_mdatoms * gmx_restrict__restrict mdatoms, |
761 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
762 | t_nrnb * gmx_restrict__restrict nrnb) |
763 | { |
764 | int i_shift_offset,i_coord_offset,j_coord_offset; |
765 | int j_index_start,j_index_end; |
766 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
767 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
768 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
769 | real *shiftvec,*fshift,*x,*f; |
770 | int vdwioffset0; |
771 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
772 | int vdwioffset1; |
773 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
774 | int vdwioffset2; |
775 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
776 | int vdwioffset3; |
777 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
778 | int vdwjidx0; |
779 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
780 | int vdwjidx1; |
781 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
782 | int vdwjidx2; |
783 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
784 | int vdwjidx3; |
785 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
786 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
787 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
788 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
789 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
790 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
791 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
792 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
793 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
794 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
795 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
796 | real velec,felec,velecsum,facel,crf,krf,krf2; |
797 | real *charge; |
798 | int nvdwtype; |
799 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
800 | int *vdwtype; |
801 | real *vdwparam; |
802 | int ewitab; |
803 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
804 | real *ewtab; |
805 | |
806 | x = xx[0]; |
807 | f = ff[0]; |
808 | |
809 | nri = nlist->nri; |
810 | iinr = nlist->iinr; |
811 | jindex = nlist->jindex; |
812 | jjnr = nlist->jjnr; |
813 | shiftidx = nlist->shift; |
814 | gid = nlist->gid; |
815 | shiftvec = fr->shift_vec[0]; |
816 | fshift = fr->fshift[0]; |
817 | facel = fr->epsfac; |
818 | charge = mdatoms->chargeA; |
819 | nvdwtype = fr->ntype; |
820 | vdwparam = fr->nbfp; |
821 | vdwtype = mdatoms->typeA; |
822 | |
823 | sh_ewald = fr->ic->sh_ewald; |
824 | ewtab = fr->ic->tabq_coul_F; |
825 | ewtabscale = fr->ic->tabq_scale; |
826 | ewtabhalfspace = 0.5/ewtabscale; |
827 | |
828 | /* Setup water-specific parameters */ |
829 | inr = nlist->iinr[0]; |
830 | iq1 = facel*charge[inr+1]; |
831 | iq2 = facel*charge[inr+2]; |
832 | iq3 = facel*charge[inr+3]; |
833 | vdwioffset0 = 3*nvdwtype*vdwtype[inr+0]; |
834 | |
835 | jq1 = charge[inr+1]; |
836 | jq2 = charge[inr+2]; |
837 | jq3 = charge[inr+3]; |
838 | vdwjidx0 = 3*vdwtype[inr+0]; |
839 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
840 | cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
841 | cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2]; |
842 | qq11 = iq1*jq1; |
843 | qq12 = iq1*jq2; |
844 | qq13 = iq1*jq3; |
845 | qq21 = iq2*jq1; |
846 | qq22 = iq2*jq2; |
847 | qq23 = iq2*jq3; |
848 | qq31 = iq3*jq1; |
849 | qq32 = iq3*jq2; |
850 | qq33 = iq3*jq3; |
851 | |
852 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
853 | rcutoff = fr->rcoulomb; |
854 | rcutoff2 = rcutoff*rcutoff; |
855 | |
856 | sh_vdw_invrcut6 = fr->ic->sh_invrc6; |
857 | rvdw = fr->rvdw; |
Value stored to 'rvdw' is never read | |
858 | |
859 | outeriter = 0; |
860 | inneriter = 0; |
861 | |
862 | /* Start outer loop over neighborlists */ |
863 | for(iidx=0; iidx<nri; iidx++) |
864 | { |
865 | /* Load shift vector for this list */ |
866 | i_shift_offset = DIM3*shiftidx[iidx]; |
867 | shX = shiftvec[i_shift_offset+XX0]; |
868 | shY = shiftvec[i_shift_offset+YY1]; |
869 | shZ = shiftvec[i_shift_offset+ZZ2]; |
870 | |
871 | /* Load limits for loop over neighbors */ |
872 | j_index_start = jindex[iidx]; |
873 | j_index_end = jindex[iidx+1]; |
874 | |
875 | /* Get outer coordinate index */ |
876 | inr = iinr[iidx]; |
877 | i_coord_offset = DIM3*inr; |
878 | |
879 | /* Load i particle coords and add shift vector */ |
880 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
881 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
882 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
883 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
884 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
885 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
886 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
887 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
888 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
889 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
890 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
891 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
892 | |
893 | fix0 = 0.0; |
894 | fiy0 = 0.0; |
895 | fiz0 = 0.0; |
896 | fix1 = 0.0; |
897 | fiy1 = 0.0; |
898 | fiz1 = 0.0; |
899 | fix2 = 0.0; |
900 | fiy2 = 0.0; |
901 | fiz2 = 0.0; |
902 | fix3 = 0.0; |
903 | fiy3 = 0.0; |
904 | fiz3 = 0.0; |
905 | |
906 | /* Start inner kernel loop */ |
907 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
908 | { |
909 | /* Get j neighbor index, and coordinate index */ |
910 | jnr = jjnr[jidx]; |
911 | j_coord_offset = DIM3*jnr; |
912 | |
913 | /* load j atom coordinates */ |
914 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
915 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
916 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
917 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
918 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
919 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
920 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
921 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
922 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
923 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
924 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
925 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
926 | |
927 | /* Calculate displacement vector */ |
928 | dx00 = ix0 - jx0; |
929 | dy00 = iy0 - jy0; |
930 | dz00 = iz0 - jz0; |
931 | dx11 = ix1 - jx1; |
932 | dy11 = iy1 - jy1; |
933 | dz11 = iz1 - jz1; |
934 | dx12 = ix1 - jx2; |
935 | dy12 = iy1 - jy2; |
936 | dz12 = iz1 - jz2; |
937 | dx13 = ix1 - jx3; |
938 | dy13 = iy1 - jy3; |
939 | dz13 = iz1 - jz3; |
940 | dx21 = ix2 - jx1; |
941 | dy21 = iy2 - jy1; |
942 | dz21 = iz2 - jz1; |
943 | dx22 = ix2 - jx2; |
944 | dy22 = iy2 - jy2; |
945 | dz22 = iz2 - jz2; |
946 | dx23 = ix2 - jx3; |
947 | dy23 = iy2 - jy3; |
948 | dz23 = iz2 - jz3; |
949 | dx31 = ix3 - jx1; |
950 | dy31 = iy3 - jy1; |
951 | dz31 = iz3 - jz1; |
952 | dx32 = ix3 - jx2; |
953 | dy32 = iy3 - jy2; |
954 | dz32 = iz3 - jz2; |
955 | dx33 = ix3 - jx3; |
956 | dy33 = iy3 - jy3; |
957 | dz33 = iz3 - jz3; |
958 | |
959 | /* Calculate squared distance and things based on it */ |
960 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
961 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
962 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
963 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
964 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
965 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
966 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
967 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
968 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
969 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
970 | |
971 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
972 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
973 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
974 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
975 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
976 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
977 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
978 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
979 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
980 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
981 | |
982 | rinvsq00 = rinv00*rinv00; |
983 | rinvsq11 = rinv11*rinv11; |
984 | rinvsq12 = rinv12*rinv12; |
985 | rinvsq13 = rinv13*rinv13; |
986 | rinvsq21 = rinv21*rinv21; |
987 | rinvsq22 = rinv22*rinv22; |
988 | rinvsq23 = rinv23*rinv23; |
989 | rinvsq31 = rinv31*rinv31; |
990 | rinvsq32 = rinv32*rinv32; |
991 | rinvsq33 = rinv33*rinv33; |
992 | |
993 | /************************** |
994 | * CALCULATE INTERACTIONS * |
995 | **************************/ |
996 | |
997 | if (rsq00<rcutoff2) |
998 | { |
999 | |
1000 | r00 = rsq00*rinv00; |
1001 | |
1002 | /* BUCKINGHAM DISPERSION/REPULSION */ |
1003 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
1004 | vvdw6 = c6_00*rinvsix; |
1005 | br = cexp2_00*r00; |
1006 | vvdwexp = cexp1_00*exp(-br); |
1007 | fvdw = (br*vvdwexp-vvdw6)*rinvsq00; |
1008 | |
1009 | fscal = fvdw; |
1010 | |
1011 | /* Calculate temporary vectorial force */ |
1012 | tx = fscal*dx00; |
1013 | ty = fscal*dy00; |
1014 | tz = fscal*dz00; |
1015 | |
1016 | /* Update vectorial force */ |
1017 | fix0 += tx; |
1018 | fiy0 += ty; |
1019 | fiz0 += tz; |
1020 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
1021 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
1022 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
1023 | |
1024 | } |
1025 | |
1026 | /************************** |
1027 | * CALCULATE INTERACTIONS * |
1028 | **************************/ |
1029 | |
1030 | if (rsq11<rcutoff2) |
1031 | { |
1032 | |
1033 | r11 = rsq11*rinv11; |
1034 | |
1035 | /* EWALD ELECTROSTATICS */ |
1036 | |
1037 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1038 | ewrt = r11*ewtabscale; |
1039 | ewitab = ewrt; |
1040 | eweps = ewrt-ewitab; |
1041 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1042 | felec = qq11*rinv11*(rinvsq11-felec); |
1043 | |
1044 | fscal = felec; |
1045 | |
1046 | /* Calculate temporary vectorial force */ |
1047 | tx = fscal*dx11; |
1048 | ty = fscal*dy11; |
1049 | tz = fscal*dz11; |
1050 | |
1051 | /* Update vectorial force */ |
1052 | fix1 += tx; |
1053 | fiy1 += ty; |
1054 | fiz1 += tz; |
1055 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1056 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1057 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1058 | |
1059 | } |
1060 | |
1061 | /************************** |
1062 | * CALCULATE INTERACTIONS * |
1063 | **************************/ |
1064 | |
1065 | if (rsq12<rcutoff2) |
1066 | { |
1067 | |
1068 | r12 = rsq12*rinv12; |
1069 | |
1070 | /* EWALD ELECTROSTATICS */ |
1071 | |
1072 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1073 | ewrt = r12*ewtabscale; |
1074 | ewitab = ewrt; |
1075 | eweps = ewrt-ewitab; |
1076 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1077 | felec = qq12*rinv12*(rinvsq12-felec); |
1078 | |
1079 | fscal = felec; |
1080 | |
1081 | /* Calculate temporary vectorial force */ |
1082 | tx = fscal*dx12; |
1083 | ty = fscal*dy12; |
1084 | tz = fscal*dz12; |
1085 | |
1086 | /* Update vectorial force */ |
1087 | fix1 += tx; |
1088 | fiy1 += ty; |
1089 | fiz1 += tz; |
1090 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1091 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1092 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1093 | |
1094 | } |
1095 | |
1096 | /************************** |
1097 | * CALCULATE INTERACTIONS * |
1098 | **************************/ |
1099 | |
1100 | if (rsq13<rcutoff2) |
1101 | { |
1102 | |
1103 | r13 = rsq13*rinv13; |
1104 | |
1105 | /* EWALD ELECTROSTATICS */ |
1106 | |
1107 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1108 | ewrt = r13*ewtabscale; |
1109 | ewitab = ewrt; |
1110 | eweps = ewrt-ewitab; |
1111 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1112 | felec = qq13*rinv13*(rinvsq13-felec); |
1113 | |
1114 | fscal = felec; |
1115 | |
1116 | /* Calculate temporary vectorial force */ |
1117 | tx = fscal*dx13; |
1118 | ty = fscal*dy13; |
1119 | tz = fscal*dz13; |
1120 | |
1121 | /* Update vectorial force */ |
1122 | fix1 += tx; |
1123 | fiy1 += ty; |
1124 | fiz1 += tz; |
1125 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1126 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1127 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1128 | |
1129 | } |
1130 | |
1131 | /************************** |
1132 | * CALCULATE INTERACTIONS * |
1133 | **************************/ |
1134 | |
1135 | if (rsq21<rcutoff2) |
1136 | { |
1137 | |
1138 | r21 = rsq21*rinv21; |
1139 | |
1140 | /* EWALD ELECTROSTATICS */ |
1141 | |
1142 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1143 | ewrt = r21*ewtabscale; |
1144 | ewitab = ewrt; |
1145 | eweps = ewrt-ewitab; |
1146 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1147 | felec = qq21*rinv21*(rinvsq21-felec); |
1148 | |
1149 | fscal = felec; |
1150 | |
1151 | /* Calculate temporary vectorial force */ |
1152 | tx = fscal*dx21; |
1153 | ty = fscal*dy21; |
1154 | tz = fscal*dz21; |
1155 | |
1156 | /* Update vectorial force */ |
1157 | fix2 += tx; |
1158 | fiy2 += ty; |
1159 | fiz2 += tz; |
1160 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1161 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1162 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1163 | |
1164 | } |
1165 | |
1166 | /************************** |
1167 | * CALCULATE INTERACTIONS * |
1168 | **************************/ |
1169 | |
1170 | if (rsq22<rcutoff2) |
1171 | { |
1172 | |
1173 | r22 = rsq22*rinv22; |
1174 | |
1175 | /* EWALD ELECTROSTATICS */ |
1176 | |
1177 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1178 | ewrt = r22*ewtabscale; |
1179 | ewitab = ewrt; |
1180 | eweps = ewrt-ewitab; |
1181 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1182 | felec = qq22*rinv22*(rinvsq22-felec); |
1183 | |
1184 | fscal = felec; |
1185 | |
1186 | /* Calculate temporary vectorial force */ |
1187 | tx = fscal*dx22; |
1188 | ty = fscal*dy22; |
1189 | tz = fscal*dz22; |
1190 | |
1191 | /* Update vectorial force */ |
1192 | fix2 += tx; |
1193 | fiy2 += ty; |
1194 | fiz2 += tz; |
1195 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1196 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1197 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1198 | |
1199 | } |
1200 | |
1201 | /************************** |
1202 | * CALCULATE INTERACTIONS * |
1203 | **************************/ |
1204 | |
1205 | if (rsq23<rcutoff2) |
1206 | { |
1207 | |
1208 | r23 = rsq23*rinv23; |
1209 | |
1210 | /* EWALD ELECTROSTATICS */ |
1211 | |
1212 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1213 | ewrt = r23*ewtabscale; |
1214 | ewitab = ewrt; |
1215 | eweps = ewrt-ewitab; |
1216 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1217 | felec = qq23*rinv23*(rinvsq23-felec); |
1218 | |
1219 | fscal = felec; |
1220 | |
1221 | /* Calculate temporary vectorial force */ |
1222 | tx = fscal*dx23; |
1223 | ty = fscal*dy23; |
1224 | tz = fscal*dz23; |
1225 | |
1226 | /* Update vectorial force */ |
1227 | fix2 += tx; |
1228 | fiy2 += ty; |
1229 | fiz2 += tz; |
1230 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1231 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1232 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1233 | |
1234 | } |
1235 | |
1236 | /************************** |
1237 | * CALCULATE INTERACTIONS * |
1238 | **************************/ |
1239 | |
1240 | if (rsq31<rcutoff2) |
1241 | { |
1242 | |
1243 | r31 = rsq31*rinv31; |
1244 | |
1245 | /* EWALD ELECTROSTATICS */ |
1246 | |
1247 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1248 | ewrt = r31*ewtabscale; |
1249 | ewitab = ewrt; |
1250 | eweps = ewrt-ewitab; |
1251 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1252 | felec = qq31*rinv31*(rinvsq31-felec); |
1253 | |
1254 | fscal = felec; |
1255 | |
1256 | /* Calculate temporary vectorial force */ |
1257 | tx = fscal*dx31; |
1258 | ty = fscal*dy31; |
1259 | tz = fscal*dz31; |
1260 | |
1261 | /* Update vectorial force */ |
1262 | fix3 += tx; |
1263 | fiy3 += ty; |
1264 | fiz3 += tz; |
1265 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1266 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1267 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1268 | |
1269 | } |
1270 | |
1271 | /************************** |
1272 | * CALCULATE INTERACTIONS * |
1273 | **************************/ |
1274 | |
1275 | if (rsq32<rcutoff2) |
1276 | { |
1277 | |
1278 | r32 = rsq32*rinv32; |
1279 | |
1280 | /* EWALD ELECTROSTATICS */ |
1281 | |
1282 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1283 | ewrt = r32*ewtabscale; |
1284 | ewitab = ewrt; |
1285 | eweps = ewrt-ewitab; |
1286 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1287 | felec = qq32*rinv32*(rinvsq32-felec); |
1288 | |
1289 | fscal = felec; |
1290 | |
1291 | /* Calculate temporary vectorial force */ |
1292 | tx = fscal*dx32; |
1293 | ty = fscal*dy32; |
1294 | tz = fscal*dz32; |
1295 | |
1296 | /* Update vectorial force */ |
1297 | fix3 += tx; |
1298 | fiy3 += ty; |
1299 | fiz3 += tz; |
1300 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1301 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1302 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1303 | |
1304 | } |
1305 | |
1306 | /************************** |
1307 | * CALCULATE INTERACTIONS * |
1308 | **************************/ |
1309 | |
1310 | if (rsq33<rcutoff2) |
1311 | { |
1312 | |
1313 | r33 = rsq33*rinv33; |
1314 | |
1315 | /* EWALD ELECTROSTATICS */ |
1316 | |
1317 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1318 | ewrt = r33*ewtabscale; |
1319 | ewitab = ewrt; |
1320 | eweps = ewrt-ewitab; |
1321 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1322 | felec = qq33*rinv33*(rinvsq33-felec); |
1323 | |
1324 | fscal = felec; |
1325 | |
1326 | /* Calculate temporary vectorial force */ |
1327 | tx = fscal*dx33; |
1328 | ty = fscal*dy33; |
1329 | tz = fscal*dz33; |
1330 | |
1331 | /* Update vectorial force */ |
1332 | fix3 += tx; |
1333 | fiy3 += ty; |
1334 | fiz3 += tz; |
1335 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1336 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1337 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1338 | |
1339 | } |
1340 | |
1341 | /* Inner loop uses 355 flops */ |
1342 | } |
1343 | /* End of innermost loop */ |
1344 | |
1345 | tx = ty = tz = 0; |
1346 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
1347 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
1348 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
1349 | tx += fix0; |
1350 | ty += fiy0; |
1351 | tz += fiz0; |
1352 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1353 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1354 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1355 | tx += fix1; |
1356 | ty += fiy1; |
1357 | tz += fiz1; |
1358 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1359 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1360 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1361 | tx += fix2; |
1362 | ty += fiy2; |
1363 | tz += fiz2; |
1364 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
1365 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
1366 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
1367 | tx += fix3; |
1368 | ty += fiy3; |
1369 | tz += fiz3; |
1370 | fshift[i_shift_offset+XX0] += tx; |
1371 | fshift[i_shift_offset+YY1] += ty; |
1372 | fshift[i_shift_offset+ZZ2] += tz; |
1373 | |
1374 | /* Increment number of inner iterations */ |
1375 | inneriter += j_index_end - j_index_start; |
1376 | |
1377 | /* Outer loop uses 39 flops */ |
1378 | } |
1379 | |
1380 | /* Increment number of outer iterations */ |
1381 | outeriter += nri; |
1382 | |
1383 | /* Update outer/inner flops */ |
1384 | |
1385 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*355)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_F] += outeriter*39 + inneriter *355; |
1386 | } |