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