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