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