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