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