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