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