Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCoul_VdwLJ_GeomP1P1_sse4_1_single.c
Location:line 122, column 5
Description:Value stored to 'j_coord_offsetB' is never read

Annotated Source Code

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 sse4_1_single 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#include "gromacs/simd/math_x86_sse4_1_single.h"
50#include "kernelutil_x86_sse4_1_single.h"
51
52/*
53 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomP1P1_VF_sse4_1_single
54 * Electrostatics interaction: Coulomb
55 * VdW interaction: LennardJones
56 * Geometry: Particle-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecCoul_VdwLJ_GeomP1P1_VF_sse4_1_single
61 (t_nblist * gmx_restrict nlist,
62 rvec * gmx_restrict xx,
63 rvec * gmx_restrict ff,
64 t_forcerec * gmx_restrict fr,
65 t_mdatoms * gmx_restrict mdatoms,
66 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
67 t_nrnb * gmx_restrict nrnb)
68{
69 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
70 * just 0 for non-waters.
71 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
72 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 */
74 int i_shift_offset,i_coord_offset,outeriter,inneriter;
75 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int jnrA,jnrB,jnrC,jnrD;
77 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
78 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
79 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
80 real rcutoff_scalar;
81 real *shiftvec,*fshift,*x,*f;
82 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
83 real scratch[4*DIM3];
84 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
85 int vdwioffset0;
86 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
87 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
88 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
91 real *charge;
92 int nvdwtype;
93 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
94 int *vdwtype;
95 real *vdwparam;
96 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
97 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
98 __m128 dummy_mask,cutoff_mask;
99 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
100 __m128 one = _mm_set1_ps(1.0);
101 __m128 two = _mm_set1_ps(2.0);
102 x = xx[0];
103 f = ff[0];
104
105 nri = nlist->nri;
106 iinr = nlist->iinr;
107 jindex = nlist->jindex;
108 jjnr = nlist->jjnr;
109 shiftidx = nlist->shift;
110 gid = nlist->gid;
111 shiftvec = fr->shift_vec[0];
112 fshift = fr->fshift[0];
113 facel = _mm_set1_ps(fr->epsfac);
114 charge = mdatoms->chargeA;
115 nvdwtype = fr->ntype;
116 vdwparam = fr->nbfp;
117 vdwtype = mdatoms->typeA;
118
119 /* Avoid stupid compiler warnings */
120 jnrA = jnrB = jnrC = jnrD = 0;
121 j_coord_offsetA = 0;
122 j_coord_offsetB = 0;
Value stored to 'j_coord_offsetB' is never read
123 j_coord_offsetC = 0;
124 j_coord_offsetD = 0;
125
126 outeriter = 0;
127 inneriter = 0;
128
129 for(iidx=0;iidx<4*DIM3;iidx++)
130 {
131 scratch[iidx] = 0.0;
132 }
133
134 /* Start outer loop over neighborlists */
135 for(iidx=0; iidx<nri; iidx++)
136 {
137 /* Load shift vector for this list */
138 i_shift_offset = DIM3*shiftidx[iidx];
139
140 /* Load limits for loop over neighbors */
141 j_index_start = jindex[iidx];
142 j_index_end = jindex[iidx+1];
143
144 /* Get outer coordinate index */
145 inr = iinr[iidx];
146 i_coord_offset = DIM3*inr;
147
148 /* Load i particle coords and add shift vector */
149 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
150
151 fix0 = _mm_setzero_ps();
152 fiy0 = _mm_setzero_ps();
153 fiz0 = _mm_setzero_ps();
154
155 /* Load parameters for i particles */
156 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
157 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
158
159 /* Reset potential sums */
160 velecsum = _mm_setzero_ps();
161 vvdwsum = _mm_setzero_ps();
162
163 /* Start inner kernel loop */
164 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
165 {
166
167 /* Get j neighbor index, and coordinate index */
168 jnrA = jjnr[jidx];
169 jnrB = jjnr[jidx+1];
170 jnrC = jjnr[jidx+2];
171 jnrD = jjnr[jidx+3];
172 j_coord_offsetA = DIM3*jnrA;
173 j_coord_offsetB = DIM3*jnrB;
174 j_coord_offsetC = DIM3*jnrC;
175 j_coord_offsetD = DIM3*jnrD;
176
177 /* load j atom coordinates */
178 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
179 x+j_coord_offsetC,x+j_coord_offsetD,
180 &jx0,&jy0,&jz0);
181
182 /* Calculate displacement vector */
183 dx00 = _mm_sub_ps(ix0,jx0);
184 dy00 = _mm_sub_ps(iy0,jy0);
185 dz00 = _mm_sub_ps(iz0,jz0);
186
187 /* Calculate squared distance and things based on it */
188 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
189
190 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
191
192 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
193
194 /* Load parameters for j particles */
195 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
196 charge+jnrC+0,charge+jnrD+0);
197 vdwjidx0A = 2*vdwtype[jnrA+0];
198 vdwjidx0B = 2*vdwtype[jnrB+0];
199 vdwjidx0C = 2*vdwtype[jnrC+0];
200 vdwjidx0D = 2*vdwtype[jnrD+0];
201
202 /**************************
203 * CALCULATE INTERACTIONS *
204 **************************/
205
206 /* Compute parameters for interactions between i and j atoms */
207 qq00 = _mm_mul_ps(iq0,jq0);
208 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
209 vdwparam+vdwioffset0+vdwjidx0B,
210 vdwparam+vdwioffset0+vdwjidx0C,
211 vdwparam+vdwioffset0+vdwjidx0D,
212 &c6_00,&c12_00);
213
214 /* COULOMB ELECTROSTATICS */
215 velec = _mm_mul_ps(qq00,rinv00);
216 felec = _mm_mul_ps(velec,rinvsq00);
217
218 /* LENNARD-JONES DISPERSION/REPULSION */
219
220 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
221 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
222 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
223 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
224 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
225
226 /* Update potential sum for this i atom from the interaction with this j atom. */
227 velecsum = _mm_add_ps(velecsum,velec);
228 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
229
230 fscal = _mm_add_ps(felec,fvdw);
231
232 /* Calculate temporary vectorial force */
233 tx = _mm_mul_ps(fscal,dx00);
234 ty = _mm_mul_ps(fscal,dy00);
235 tz = _mm_mul_ps(fscal,dz00);
236
237 /* Update vectorial force */
238 fix0 = _mm_add_ps(fix0,tx);
239 fiy0 = _mm_add_ps(fiy0,ty);
240 fiz0 = _mm_add_ps(fiz0,tz);
241
242 fjptrA = f+j_coord_offsetA;
243 fjptrB = f+j_coord_offsetB;
244 fjptrC = f+j_coord_offsetC;
245 fjptrD = f+j_coord_offsetD;
246 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
247
248 /* Inner loop uses 40 flops */
249 }
250
251 if(jidx<j_index_end)
252 {
253
254 /* Get j neighbor index, and coordinate index */
255 jnrlistA = jjnr[jidx];
256 jnrlistB = jjnr[jidx+1];
257 jnrlistC = jjnr[jidx+2];
258 jnrlistD = jjnr[jidx+3];
259 /* Sign of each element will be negative for non-real atoms.
260 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
261 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
262 */
263 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
264 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
265 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
266 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
267 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
268 j_coord_offsetA = DIM3*jnrA;
269 j_coord_offsetB = DIM3*jnrB;
270 j_coord_offsetC = DIM3*jnrC;
271 j_coord_offsetD = DIM3*jnrD;
272
273 /* load j atom coordinates */
274 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
275 x+j_coord_offsetC,x+j_coord_offsetD,
276 &jx0,&jy0,&jz0);
277
278 /* Calculate displacement vector */
279 dx00 = _mm_sub_ps(ix0,jx0);
280 dy00 = _mm_sub_ps(iy0,jy0);
281 dz00 = _mm_sub_ps(iz0,jz0);
282
283 /* Calculate squared distance and things based on it */
284 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
285
286 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
287
288 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
289
290 /* Load parameters for j particles */
291 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
292 charge+jnrC+0,charge+jnrD+0);
293 vdwjidx0A = 2*vdwtype[jnrA+0];
294 vdwjidx0B = 2*vdwtype[jnrB+0];
295 vdwjidx0C = 2*vdwtype[jnrC+0];
296 vdwjidx0D = 2*vdwtype[jnrD+0];
297
298 /**************************
299 * CALCULATE INTERACTIONS *
300 **************************/
301
302 /* Compute parameters for interactions between i and j atoms */
303 qq00 = _mm_mul_ps(iq0,jq0);
304 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
305 vdwparam+vdwioffset0+vdwjidx0B,
306 vdwparam+vdwioffset0+vdwjidx0C,
307 vdwparam+vdwioffset0+vdwjidx0D,
308 &c6_00,&c12_00);
309
310 /* COULOMB ELECTROSTATICS */
311 velec = _mm_mul_ps(qq00,rinv00);
312 felec = _mm_mul_ps(velec,rinvsq00);
313
314 /* LENNARD-JONES DISPERSION/REPULSION */
315
316 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
317 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
318 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
319 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
320 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
321
322 /* Update potential sum for this i atom from the interaction with this j atom. */
323 velec = _mm_andnot_ps(dummy_mask,velec);
324 velecsum = _mm_add_ps(velecsum,velec);
325 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
326 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
327
328 fscal = _mm_add_ps(felec,fvdw);
329
330 fscal = _mm_andnot_ps(dummy_mask,fscal);
331
332 /* Calculate temporary vectorial force */
333 tx = _mm_mul_ps(fscal,dx00);
334 ty = _mm_mul_ps(fscal,dy00);
335 tz = _mm_mul_ps(fscal,dz00);
336
337 /* Update vectorial force */
338 fix0 = _mm_add_ps(fix0,tx);
339 fiy0 = _mm_add_ps(fiy0,ty);
340 fiz0 = _mm_add_ps(fiz0,tz);
341
342 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
343 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
344 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
345 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
346 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
347
348 /* Inner loop uses 40 flops */
349 }
350
351 /* End of innermost loop */
352
353 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
354 f+i_coord_offset,fshift+i_shift_offset);
355
356 ggid = gid[iidx];
357 /* Update potential energies */
358 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
359 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
360
361 /* Increment number of inner iterations */
362 inneriter += j_index_end - j_index_start;
363
364 /* Outer loop uses 9 flops */
365 }
366
367 /* Increment number of outer iterations */
368 outeriter += nri;
369
370 /* Update outer/inner flops */
371
372 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*40)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_VF] += outeriter*9 + inneriter
*40
;
373}
374/*
375 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomP1P1_F_sse4_1_single
376 * Electrostatics interaction: Coulomb
377 * VdW interaction: LennardJones
378 * Geometry: Particle-Particle
379 * Calculate force/pot: Force
380 */
381void
382nb_kernel_ElecCoul_VdwLJ_GeomP1P1_F_sse4_1_single
383 (t_nblist * gmx_restrict nlist,
384 rvec * gmx_restrict xx,
385 rvec * gmx_restrict ff,
386 t_forcerec * gmx_restrict fr,
387 t_mdatoms * gmx_restrict mdatoms,
388 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
389 t_nrnb * gmx_restrict nrnb)
390{
391 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
392 * just 0 for non-waters.
393 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
394 * jnr indices corresponding to data put in the four positions in the SIMD register.
395 */
396 int i_shift_offset,i_coord_offset,outeriter,inneriter;
397 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
398 int jnrA,jnrB,jnrC,jnrD;
399 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
400 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
401 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
402 real rcutoff_scalar;
403 real *shiftvec,*fshift,*x,*f;
404 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
405 real scratch[4*DIM3];
406 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
407 int vdwioffset0;
408 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
409 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
410 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
411 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
412 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
413 real *charge;
414 int nvdwtype;
415 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
416 int *vdwtype;
417 real *vdwparam;
418 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
419 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
420 __m128 dummy_mask,cutoff_mask;
421 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
422 __m128 one = _mm_set1_ps(1.0);
423 __m128 two = _mm_set1_ps(2.0);
424 x = xx[0];
425 f = ff[0];
426
427 nri = nlist->nri;
428 iinr = nlist->iinr;
429 jindex = nlist->jindex;
430 jjnr = nlist->jjnr;
431 shiftidx = nlist->shift;
432 gid = nlist->gid;
433 shiftvec = fr->shift_vec[0];
434 fshift = fr->fshift[0];
435 facel = _mm_set1_ps(fr->epsfac);
436 charge = mdatoms->chargeA;
437 nvdwtype = fr->ntype;
438 vdwparam = fr->nbfp;
439 vdwtype = mdatoms->typeA;
440
441 /* Avoid stupid compiler warnings */
442 jnrA = jnrB = jnrC = jnrD = 0;
443 j_coord_offsetA = 0;
444 j_coord_offsetB = 0;
445 j_coord_offsetC = 0;
446 j_coord_offsetD = 0;
447
448 outeriter = 0;
449 inneriter = 0;
450
451 for(iidx=0;iidx<4*DIM3;iidx++)
452 {
453 scratch[iidx] = 0.0;
454 }
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
462 /* Load limits for loop over neighbors */
463 j_index_start = jindex[iidx];
464 j_index_end = jindex[iidx+1];
465
466 /* Get outer coordinate index */
467 inr = iinr[iidx];
468 i_coord_offset = DIM3*inr;
469
470 /* Load i particle coords and add shift vector */
471 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
472
473 fix0 = _mm_setzero_ps();
474 fiy0 = _mm_setzero_ps();
475 fiz0 = _mm_setzero_ps();
476
477 /* Load parameters for i particles */
478 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
479 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
480
481 /* Start inner kernel loop */
482 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
483 {
484
485 /* Get j neighbor index, and coordinate index */
486 jnrA = jjnr[jidx];
487 jnrB = jjnr[jidx+1];
488 jnrC = jjnr[jidx+2];
489 jnrD = jjnr[jidx+3];
490 j_coord_offsetA = DIM3*jnrA;
491 j_coord_offsetB = DIM3*jnrB;
492 j_coord_offsetC = DIM3*jnrC;
493 j_coord_offsetD = DIM3*jnrD;
494
495 /* load j atom coordinates */
496 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
497 x+j_coord_offsetC,x+j_coord_offsetD,
498 &jx0,&jy0,&jz0);
499
500 /* Calculate displacement vector */
501 dx00 = _mm_sub_ps(ix0,jx0);
502 dy00 = _mm_sub_ps(iy0,jy0);
503 dz00 = _mm_sub_ps(iz0,jz0);
504
505 /* Calculate squared distance and things based on it */
506 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
507
508 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
509
510 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
511
512 /* Load parameters for j particles */
513 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
514 charge+jnrC+0,charge+jnrD+0);
515 vdwjidx0A = 2*vdwtype[jnrA+0];
516 vdwjidx0B = 2*vdwtype[jnrB+0];
517 vdwjidx0C = 2*vdwtype[jnrC+0];
518 vdwjidx0D = 2*vdwtype[jnrD+0];
519
520 /**************************
521 * CALCULATE INTERACTIONS *
522 **************************/
523
524 /* Compute parameters for interactions between i and j atoms */
525 qq00 = _mm_mul_ps(iq0,jq0);
526 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
527 vdwparam+vdwioffset0+vdwjidx0B,
528 vdwparam+vdwioffset0+vdwjidx0C,
529 vdwparam+vdwioffset0+vdwjidx0D,
530 &c6_00,&c12_00);
531
532 /* COULOMB ELECTROSTATICS */
533 velec = _mm_mul_ps(qq00,rinv00);
534 felec = _mm_mul_ps(velec,rinvsq00);
535
536 /* LENNARD-JONES DISPERSION/REPULSION */
537
538 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
539 fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00));
540
541 fscal = _mm_add_ps(felec,fvdw);
542
543 /* Calculate temporary vectorial force */
544 tx = _mm_mul_ps(fscal,dx00);
545 ty = _mm_mul_ps(fscal,dy00);
546 tz = _mm_mul_ps(fscal,dz00);
547
548 /* Update vectorial force */
549 fix0 = _mm_add_ps(fix0,tx);
550 fiy0 = _mm_add_ps(fiy0,ty);
551 fiz0 = _mm_add_ps(fiz0,tz);
552
553 fjptrA = f+j_coord_offsetA;
554 fjptrB = f+j_coord_offsetB;
555 fjptrC = f+j_coord_offsetC;
556 fjptrD = f+j_coord_offsetD;
557 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
558
559 /* Inner loop uses 34 flops */
560 }
561
562 if(jidx<j_index_end)
563 {
564
565 /* Get j neighbor index, and coordinate index */
566 jnrlistA = jjnr[jidx];
567 jnrlistB = jjnr[jidx+1];
568 jnrlistC = jjnr[jidx+2];
569 jnrlistD = jjnr[jidx+3];
570 /* Sign of each element will be negative for non-real atoms.
571 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
572 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
573 */
574 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
575 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
576 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
577 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
578 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
579 j_coord_offsetA = DIM3*jnrA;
580 j_coord_offsetB = DIM3*jnrB;
581 j_coord_offsetC = DIM3*jnrC;
582 j_coord_offsetD = DIM3*jnrD;
583
584 /* load j atom coordinates */
585 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
586 x+j_coord_offsetC,x+j_coord_offsetD,
587 &jx0,&jy0,&jz0);
588
589 /* Calculate displacement vector */
590 dx00 = _mm_sub_ps(ix0,jx0);
591 dy00 = _mm_sub_ps(iy0,jy0);
592 dz00 = _mm_sub_ps(iz0,jz0);
593
594 /* Calculate squared distance and things based on it */
595 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
596
597 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
598
599 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
600
601 /* Load parameters for j particles */
602 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
603 charge+jnrC+0,charge+jnrD+0);
604 vdwjidx0A = 2*vdwtype[jnrA+0];
605 vdwjidx0B = 2*vdwtype[jnrB+0];
606 vdwjidx0C = 2*vdwtype[jnrC+0];
607 vdwjidx0D = 2*vdwtype[jnrD+0];
608
609 /**************************
610 * CALCULATE INTERACTIONS *
611 **************************/
612
613 /* Compute parameters for interactions between i and j atoms */
614 qq00 = _mm_mul_ps(iq0,jq0);
615 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
616 vdwparam+vdwioffset0+vdwjidx0B,
617 vdwparam+vdwioffset0+vdwjidx0C,
618 vdwparam+vdwioffset0+vdwjidx0D,
619 &c6_00,&c12_00);
620
621 /* COULOMB ELECTROSTATICS */
622 velec = _mm_mul_ps(qq00,rinv00);
623 felec = _mm_mul_ps(velec,rinvsq00);
624
625 /* LENNARD-JONES DISPERSION/REPULSION */
626
627 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
628 fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00));
629
630 fscal = _mm_add_ps(felec,fvdw);
631
632 fscal = _mm_andnot_ps(dummy_mask,fscal);
633
634 /* Calculate temporary vectorial force */
635 tx = _mm_mul_ps(fscal,dx00);
636 ty = _mm_mul_ps(fscal,dy00);
637 tz = _mm_mul_ps(fscal,dz00);
638
639 /* Update vectorial force */
640 fix0 = _mm_add_ps(fix0,tx);
641 fiy0 = _mm_add_ps(fiy0,ty);
642 fiz0 = _mm_add_ps(fiz0,tz);
643
644 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
645 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
646 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
647 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
648 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
649
650 /* Inner loop uses 34 flops */
651 }
652
653 /* End of innermost loop */
654
655 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
656 f+i_coord_offset,fshift+i_shift_offset);
657
658 /* Increment number of inner iterations */
659 inneriter += j_index_end - j_index_start;
660
661 /* Outer loop uses 7 flops */
662 }
663
664 /* Increment number of outer iterations */
665 outeriter += nri;
666
667 /* Update outer/inner flops */
668
669 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*34)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_F] += outeriter*7 + inneriter
*34
;
670}