File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecCoul_VdwBham_GeomW4P1_c.c |
Location: | line 437, 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_ElecCoul_VdwBham_GeomW4P1_VF_c |
51 | * Electrostatics interaction: Coulomb |
52 | * VdW interaction: Buckingham |
53 | * Geometry: Water4-Particle |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecCoul_VdwBham_GeomW4P1_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 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
83 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
84 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
85 | real dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30,cexp1_30,cexp2_30; |
86 | real velec,felec,velecsum,facel,crf,krf,krf2; |
87 | real *charge; |
88 | int nvdwtype; |
89 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
90 | int *vdwtype; |
91 | real *vdwparam; |
92 | |
93 | x = xx[0]; |
94 | f = ff[0]; |
95 | |
96 | nri = nlist->nri; |
97 | iinr = nlist->iinr; |
98 | jindex = nlist->jindex; |
99 | jjnr = nlist->jjnr; |
100 | shiftidx = nlist->shift; |
101 | gid = nlist->gid; |
102 | shiftvec = fr->shift_vec[0]; |
103 | fshift = fr->fshift[0]; |
104 | facel = fr->epsfac; |
105 | charge = mdatoms->chargeA; |
106 | nvdwtype = fr->ntype; |
107 | vdwparam = fr->nbfp; |
108 | vdwtype = mdatoms->typeA; |
109 | |
110 | /* Setup water-specific parameters */ |
111 | inr = nlist->iinr[0]; |
112 | iq1 = facel*charge[inr+1]; |
113 | iq2 = facel*charge[inr+2]; |
114 | iq3 = facel*charge[inr+3]; |
115 | vdwioffset0 = 3*nvdwtype*vdwtype[inr+0]; |
116 | |
117 | outeriter = 0; |
118 | inneriter = 0; |
119 | |
120 | /* Start outer loop over neighborlists */ |
121 | for(iidx=0; iidx<nri; iidx++) |
122 | { |
123 | /* Load shift vector for this list */ |
124 | i_shift_offset = DIM3*shiftidx[iidx]; |
125 | shX = shiftvec[i_shift_offset+XX0]; |
126 | shY = shiftvec[i_shift_offset+YY1]; |
127 | shZ = shiftvec[i_shift_offset+ZZ2]; |
128 | |
129 | /* Load limits for loop over neighbors */ |
130 | j_index_start = jindex[iidx]; |
131 | j_index_end = jindex[iidx+1]; |
132 | |
133 | /* Get outer coordinate index */ |
134 | inr = iinr[iidx]; |
135 | i_coord_offset = DIM3*inr; |
136 | |
137 | /* Load i particle coords and add shift vector */ |
138 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
139 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
140 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
141 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
142 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
143 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
144 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
145 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
146 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
147 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
148 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
149 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
150 | |
151 | fix0 = 0.0; |
152 | fiy0 = 0.0; |
153 | fiz0 = 0.0; |
154 | fix1 = 0.0; |
155 | fiy1 = 0.0; |
156 | fiz1 = 0.0; |
157 | fix2 = 0.0; |
158 | fiy2 = 0.0; |
159 | fiz2 = 0.0; |
160 | fix3 = 0.0; |
161 | fiy3 = 0.0; |
162 | fiz3 = 0.0; |
163 | |
164 | /* Reset potential sums */ |
165 | velecsum = 0.0; |
166 | vvdwsum = 0.0; |
167 | |
168 | /* Start inner kernel loop */ |
169 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
170 | { |
171 | /* Get j neighbor index, and coordinate index */ |
172 | jnr = jjnr[jidx]; |
173 | j_coord_offset = DIM3*jnr; |
174 | |
175 | /* load j atom coordinates */ |
176 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
177 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
178 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
179 | |
180 | /* Calculate displacement vector */ |
181 | dx00 = ix0 - jx0; |
182 | dy00 = iy0 - jy0; |
183 | dz00 = iz0 - jz0; |
184 | dx10 = ix1 - jx0; |
185 | dy10 = iy1 - jy0; |
186 | dz10 = iz1 - jz0; |
187 | dx20 = ix2 - jx0; |
188 | dy20 = iy2 - jy0; |
189 | dz20 = iz2 - jz0; |
190 | dx30 = ix3 - jx0; |
191 | dy30 = iy3 - jy0; |
192 | dz30 = iz3 - jz0; |
193 | |
194 | /* Calculate squared distance and things based on it */ |
195 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
196 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
197 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
198 | rsq30 = dx30*dx30+dy30*dy30+dz30*dz30; |
199 | |
200 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
201 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
202 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
203 | rinv30 = gmx_invsqrt(rsq30)gmx_software_invsqrt(rsq30); |
204 | |
205 | rinvsq00 = rinv00*rinv00; |
206 | rinvsq10 = rinv10*rinv10; |
207 | rinvsq20 = rinv20*rinv20; |
208 | rinvsq30 = rinv30*rinv30; |
209 | |
210 | /* Load parameters for j particles */ |
211 | jq0 = charge[jnr+0]; |
212 | vdwjidx0 = 3*vdwtype[jnr+0]; |
213 | |
214 | /************************** |
215 | * CALCULATE INTERACTIONS * |
216 | **************************/ |
217 | |
218 | r00 = rsq00*rinv00; |
219 | |
220 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
221 | cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
222 | cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2]; |
223 | |
224 | /* BUCKINGHAM DISPERSION/REPULSION */ |
225 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
226 | vvdw6 = c6_00*rinvsix; |
227 | br = cexp2_00*r00; |
228 | vvdwexp = cexp1_00*exp(-br); |
229 | vvdw = vvdwexp - vvdw6*(1.0/6.0); |
230 | fvdw = (br*vvdwexp-vvdw6)*rinvsq00; |
231 | |
232 | /* Update potential sums from outer loop */ |
233 | vvdwsum += vvdw; |
234 | |
235 | fscal = fvdw; |
236 | |
237 | /* Calculate temporary vectorial force */ |
238 | tx = fscal*dx00; |
239 | ty = fscal*dy00; |
240 | tz = fscal*dz00; |
241 | |
242 | /* Update vectorial force */ |
243 | fix0 += tx; |
244 | fiy0 += ty; |
245 | fiz0 += tz; |
246 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
247 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
248 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
249 | |
250 | /************************** |
251 | * CALCULATE INTERACTIONS * |
252 | **************************/ |
253 | |
254 | qq10 = iq1*jq0; |
255 | |
256 | /* COULOMB ELECTROSTATICS */ |
257 | velec = qq10*rinv10; |
258 | felec = velec*rinvsq10; |
259 | |
260 | /* Update potential sums from outer loop */ |
261 | velecsum += velec; |
262 | |
263 | fscal = felec; |
264 | |
265 | /* Calculate temporary vectorial force */ |
266 | tx = fscal*dx10; |
267 | ty = fscal*dy10; |
268 | tz = fscal*dz10; |
269 | |
270 | /* Update vectorial force */ |
271 | fix1 += tx; |
272 | fiy1 += ty; |
273 | fiz1 += tz; |
274 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
275 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
276 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
277 | |
278 | /************************** |
279 | * CALCULATE INTERACTIONS * |
280 | **************************/ |
281 | |
282 | qq20 = iq2*jq0; |
283 | |
284 | /* COULOMB ELECTROSTATICS */ |
285 | velec = qq20*rinv20; |
286 | felec = velec*rinvsq20; |
287 | |
288 | /* Update potential sums from outer loop */ |
289 | velecsum += velec; |
290 | |
291 | fscal = felec; |
292 | |
293 | /* Calculate temporary vectorial force */ |
294 | tx = fscal*dx20; |
295 | ty = fscal*dy20; |
296 | tz = fscal*dz20; |
297 | |
298 | /* Update vectorial force */ |
299 | fix2 += tx; |
300 | fiy2 += ty; |
301 | fiz2 += tz; |
302 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
303 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
304 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
305 | |
306 | /************************** |
307 | * CALCULATE INTERACTIONS * |
308 | **************************/ |
309 | |
310 | qq30 = iq3*jq0; |
311 | |
312 | /* COULOMB ELECTROSTATICS */ |
313 | velec = qq30*rinv30; |
314 | felec = velec*rinvsq30; |
315 | |
316 | /* Update potential sums from outer loop */ |
317 | velecsum += velec; |
318 | |
319 | fscal = felec; |
320 | |
321 | /* Calculate temporary vectorial force */ |
322 | tx = fscal*dx30; |
323 | ty = fscal*dy30; |
324 | tz = fscal*dz30; |
325 | |
326 | /* Update vectorial force */ |
327 | fix3 += tx; |
328 | fiy3 += ty; |
329 | fiz3 += 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 | /* Inner loop uses 145 flops */ |
335 | } |
336 | /* End of innermost loop */ |
337 | |
338 | tx = ty = tz = 0; |
339 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
340 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
341 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
342 | tx += fix0; |
343 | ty += fiy0; |
344 | tz += fiz0; |
345 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
346 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
347 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
348 | tx += fix1; |
349 | ty += fiy1; |
350 | tz += fiz1; |
351 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
352 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
353 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
354 | tx += fix2; |
355 | ty += fiy2; |
356 | tz += fiz2; |
357 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
358 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
359 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
360 | tx += fix3; |
361 | ty += fiy3; |
362 | tz += fiz3; |
363 | fshift[i_shift_offset+XX0] += tx; |
364 | fshift[i_shift_offset+YY1] += ty; |
365 | fshift[i_shift_offset+ZZ2] += tz; |
366 | |
367 | ggid = gid[iidx]; |
368 | /* Update potential energies */ |
369 | kernel_data->energygrp_elec[ggid] += velecsum; |
370 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
371 | |
372 | /* Increment number of inner iterations */ |
373 | inneriter += j_index_end - j_index_start; |
374 | |
375 | /* Outer loop uses 41 flops */ |
376 | } |
377 | |
378 | /* Increment number of outer iterations */ |
379 | outeriter += nri; |
380 | |
381 | /* Update outer/inner flops */ |
382 | |
383 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*41 + inneriter*145)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_VF] += outeriter*41 + inneriter *145; |
384 | } |
385 | /* |
386 | * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4P1_F_c |
387 | * Electrostatics interaction: Coulomb |
388 | * VdW interaction: Buckingham |
389 | * Geometry: Water4-Particle |
390 | * Calculate force/pot: Force |
391 | */ |
392 | void |
393 | nb_kernel_ElecCoul_VdwBham_GeomW4P1_F_c |
394 | (t_nblist * gmx_restrict__restrict nlist, |
395 | rvec * gmx_restrict__restrict xx, |
396 | rvec * gmx_restrict__restrict ff, |
397 | t_forcerec * gmx_restrict__restrict fr, |
398 | t_mdatoms * gmx_restrict__restrict mdatoms, |
399 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
400 | t_nrnb * gmx_restrict__restrict nrnb) |
401 | { |
402 | int i_shift_offset,i_coord_offset,j_coord_offset; |
403 | int j_index_start,j_index_end; |
404 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
405 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
406 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
407 | real *shiftvec,*fshift,*x,*f; |
408 | int vdwioffset0; |
409 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
410 | int vdwioffset1; |
411 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
412 | int vdwioffset2; |
413 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
414 | int vdwioffset3; |
415 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
416 | int vdwjidx0; |
417 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
418 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
419 | real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10; |
420 | real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20; |
421 | real dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30,cexp1_30,cexp2_30; |
422 | real velec,felec,velecsum,facel,crf,krf,krf2; |
423 | real *charge; |
424 | int nvdwtype; |
425 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
426 | int *vdwtype; |
427 | real *vdwparam; |
428 | |
429 | x = xx[0]; |
430 | f = ff[0]; |
431 | |
432 | nri = nlist->nri; |
433 | iinr = nlist->iinr; |
434 | jindex = nlist->jindex; |
435 | jjnr = nlist->jjnr; |
436 | shiftidx = nlist->shift; |
437 | gid = nlist->gid; |
Value stored to 'gid' is never read | |
438 | shiftvec = fr->shift_vec[0]; |
439 | fshift = fr->fshift[0]; |
440 | facel = fr->epsfac; |
441 | charge = mdatoms->chargeA; |
442 | nvdwtype = fr->ntype; |
443 | vdwparam = fr->nbfp; |
444 | vdwtype = mdatoms->typeA; |
445 | |
446 | /* Setup water-specific parameters */ |
447 | inr = nlist->iinr[0]; |
448 | iq1 = facel*charge[inr+1]; |
449 | iq2 = facel*charge[inr+2]; |
450 | iq3 = facel*charge[inr+3]; |
451 | vdwioffset0 = 3*nvdwtype*vdwtype[inr+0]; |
452 | |
453 | outeriter = 0; |
454 | inneriter = 0; |
455 | |
456 | /* Start outer loop over neighborlists */ |
457 | for(iidx=0; iidx<nri; iidx++) |
458 | { |
459 | /* Load shift vector for this list */ |
460 | i_shift_offset = DIM3*shiftidx[iidx]; |
461 | shX = shiftvec[i_shift_offset+XX0]; |
462 | shY = shiftvec[i_shift_offset+YY1]; |
463 | shZ = shiftvec[i_shift_offset+ZZ2]; |
464 | |
465 | /* Load limits for loop over neighbors */ |
466 | j_index_start = jindex[iidx]; |
467 | j_index_end = jindex[iidx+1]; |
468 | |
469 | /* Get outer coordinate index */ |
470 | inr = iinr[iidx]; |
471 | i_coord_offset = DIM3*inr; |
472 | |
473 | /* Load i particle coords and add shift vector */ |
474 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
475 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
476 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
477 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
478 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
479 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
480 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
481 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
482 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
483 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
484 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
485 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
486 | |
487 | fix0 = 0.0; |
488 | fiy0 = 0.0; |
489 | fiz0 = 0.0; |
490 | fix1 = 0.0; |
491 | fiy1 = 0.0; |
492 | fiz1 = 0.0; |
493 | fix2 = 0.0; |
494 | fiy2 = 0.0; |
495 | fiz2 = 0.0; |
496 | fix3 = 0.0; |
497 | fiy3 = 0.0; |
498 | fiz3 = 0.0; |
499 | |
500 | /* Start inner kernel loop */ |
501 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
502 | { |
503 | /* Get j neighbor index, and coordinate index */ |
504 | jnr = jjnr[jidx]; |
505 | j_coord_offset = DIM3*jnr; |
506 | |
507 | /* load j atom coordinates */ |
508 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
509 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
510 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
511 | |
512 | /* Calculate displacement vector */ |
513 | dx00 = ix0 - jx0; |
514 | dy00 = iy0 - jy0; |
515 | dz00 = iz0 - jz0; |
516 | dx10 = ix1 - jx0; |
517 | dy10 = iy1 - jy0; |
518 | dz10 = iz1 - jz0; |
519 | dx20 = ix2 - jx0; |
520 | dy20 = iy2 - jy0; |
521 | dz20 = iz2 - jz0; |
522 | dx30 = ix3 - jx0; |
523 | dy30 = iy3 - jy0; |
524 | dz30 = iz3 - jz0; |
525 | |
526 | /* Calculate squared distance and things based on it */ |
527 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
528 | rsq10 = dx10*dx10+dy10*dy10+dz10*dz10; |
529 | rsq20 = dx20*dx20+dy20*dy20+dz20*dz20; |
530 | rsq30 = dx30*dx30+dy30*dy30+dz30*dz30; |
531 | |
532 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
533 | rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10); |
534 | rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20); |
535 | rinv30 = gmx_invsqrt(rsq30)gmx_software_invsqrt(rsq30); |
536 | |
537 | rinvsq00 = rinv00*rinv00; |
538 | rinvsq10 = rinv10*rinv10; |
539 | rinvsq20 = rinv20*rinv20; |
540 | rinvsq30 = rinv30*rinv30; |
541 | |
542 | /* Load parameters for j particles */ |
543 | jq0 = charge[jnr+0]; |
544 | vdwjidx0 = 3*vdwtype[jnr+0]; |
545 | |
546 | /************************** |
547 | * CALCULATE INTERACTIONS * |
548 | **************************/ |
549 | |
550 | r00 = rsq00*rinv00; |
551 | |
552 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
553 | cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
554 | cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2]; |
555 | |
556 | /* BUCKINGHAM DISPERSION/REPULSION */ |
557 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
558 | vvdw6 = c6_00*rinvsix; |
559 | br = cexp2_00*r00; |
560 | vvdwexp = cexp1_00*exp(-br); |
561 | fvdw = (br*vvdwexp-vvdw6)*rinvsq00; |
562 | |
563 | fscal = fvdw; |
564 | |
565 | /* Calculate temporary vectorial force */ |
566 | tx = fscal*dx00; |
567 | ty = fscal*dy00; |
568 | tz = fscal*dz00; |
569 | |
570 | /* Update vectorial force */ |
571 | fix0 += tx; |
572 | fiy0 += ty; |
573 | fiz0 += tz; |
574 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
575 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
576 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
577 | |
578 | /************************** |
579 | * CALCULATE INTERACTIONS * |
580 | **************************/ |
581 | |
582 | qq10 = iq1*jq0; |
583 | |
584 | /* COULOMB ELECTROSTATICS */ |
585 | velec = qq10*rinv10; |
586 | felec = velec*rinvsq10; |
587 | |
588 | fscal = felec; |
589 | |
590 | /* Calculate temporary vectorial force */ |
591 | tx = fscal*dx10; |
592 | ty = fscal*dy10; |
593 | tz = fscal*dz10; |
594 | |
595 | /* Update vectorial force */ |
596 | fix1 += tx; |
597 | fiy1 += ty; |
598 | fiz1 += tz; |
599 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
600 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
601 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
602 | |
603 | /************************** |
604 | * CALCULATE INTERACTIONS * |
605 | **************************/ |
606 | |
607 | qq20 = iq2*jq0; |
608 | |
609 | /* COULOMB ELECTROSTATICS */ |
610 | velec = qq20*rinv20; |
611 | felec = velec*rinvsq20; |
612 | |
613 | fscal = felec; |
614 | |
615 | /* Calculate temporary vectorial force */ |
616 | tx = fscal*dx20; |
617 | ty = fscal*dy20; |
618 | tz = fscal*dz20; |
619 | |
620 | /* Update vectorial force */ |
621 | fix2 += tx; |
622 | fiy2 += ty; |
623 | fiz2 += tz; |
624 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
625 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
626 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
627 | |
628 | /************************** |
629 | * CALCULATE INTERACTIONS * |
630 | **************************/ |
631 | |
632 | qq30 = iq3*jq0; |
633 | |
634 | /* COULOMB ELECTROSTATICS */ |
635 | velec = qq30*rinv30; |
636 | felec = velec*rinvsq30; |
637 | |
638 | fscal = felec; |
639 | |
640 | /* Calculate temporary vectorial force */ |
641 | tx = fscal*dx30; |
642 | ty = fscal*dy30; |
643 | tz = fscal*dz30; |
644 | |
645 | /* Update vectorial force */ |
646 | fix3 += tx; |
647 | fiy3 += ty; |
648 | fiz3 += tz; |
649 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
650 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
651 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
652 | |
653 | /* Inner loop uses 139 flops */ |
654 | } |
655 | /* End of innermost loop */ |
656 | |
657 | tx = ty = tz = 0; |
658 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
659 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
660 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
661 | tx += fix0; |
662 | ty += fiy0; |
663 | tz += fiz0; |
664 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
665 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
666 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
667 | tx += fix1; |
668 | ty += fiy1; |
669 | tz += fiz1; |
670 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
671 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
672 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
673 | tx += fix2; |
674 | ty += fiy2; |
675 | tz += fiz2; |
676 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
677 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
678 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
679 | tx += fix3; |
680 | ty += fiy3; |
681 | tz += fiz3; |
682 | fshift[i_shift_offset+XX0] += tx; |
683 | fshift[i_shift_offset+YY1] += ty; |
684 | fshift[i_shift_offset+ZZ2] += tz; |
685 | |
686 | /* Increment number of inner iterations */ |
687 | inneriter += j_index_end - j_index_start; |
688 | |
689 | /* Outer loop uses 39 flops */ |
690 | } |
691 | |
692 | /* Increment number of outer iterations */ |
693 | outeriter += nri; |
694 | |
695 | /* Update outer/inner flops */ |
696 | |
697 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*39 + inneriter*139)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_F] += outeriter*39 + inneriter *139; |
698 | } |