Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_sse4_1_single.c
Location:line 860, column 5
Description:Value stored to 'j_coord_offsetC' 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_ElecRFCut_VdwCSTab_GeomW4P1_VF_sse4_1_single
54 * Electrostatics interaction: ReactionField
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water4-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_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 vdwioffset1;
88 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
89 int vdwioffset2;
90 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
91 int vdwioffset3;
92 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
93 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
94 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
95 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
97 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
98 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
99 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
100 real *charge;
101 int nvdwtype;
102 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
103 int *vdwtype;
104 real *vdwparam;
105 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
106 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
107 __m128i vfitab;
108 __m128i ifour = _mm_set1_epi32(4);
109 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
110 real *vftab;
111 __m128 dummy_mask,cutoff_mask;
112 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
113 __m128 one = _mm_set1_ps(1.0);
114 __m128 two = _mm_set1_ps(2.0);
115 x = xx[0];
116 f = ff[0];
117
118 nri = nlist->nri;
119 iinr = nlist->iinr;
120 jindex = nlist->jindex;
121 jjnr = nlist->jjnr;
122 shiftidx = nlist->shift;
123 gid = nlist->gid;
124 shiftvec = fr->shift_vec[0];
125 fshift = fr->fshift[0];
126 facel = _mm_set1_ps(fr->epsfac);
127 charge = mdatoms->chargeA;
128 krf = _mm_set1_ps(fr->ic->k_rf);
129 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
130 crf = _mm_set1_ps(fr->ic->c_rf);
131 nvdwtype = fr->ntype;
132 vdwparam = fr->nbfp;
133 vdwtype = mdatoms->typeA;
134
135 vftab = kernel_data->table_vdw->data;
136 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
137
138 /* Setup water-specific parameters */
139 inr = nlist->iinr[0];
140 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
141 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
142 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
143 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
144
145 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
146 rcutoff_scalar = fr->rcoulomb;
147 rcutoff = _mm_set1_ps(rcutoff_scalar);
148 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
149
150 /* Avoid stupid compiler warnings */
151 jnrA = jnrB = jnrC = jnrD = 0;
152 j_coord_offsetA = 0;
153 j_coord_offsetB = 0;
154 j_coord_offsetC = 0;
155 j_coord_offsetD = 0;
156
157 outeriter = 0;
158 inneriter = 0;
159
160 for(iidx=0;iidx<4*DIM3;iidx++)
161 {
162 scratch[iidx] = 0.0;
163 }
164
165 /* Start outer loop over neighborlists */
166 for(iidx=0; iidx<nri; iidx++)
167 {
168 /* Load shift vector for this list */
169 i_shift_offset = DIM3*shiftidx[iidx];
170
171 /* Load limits for loop over neighbors */
172 j_index_start = jindex[iidx];
173 j_index_end = jindex[iidx+1];
174
175 /* Get outer coordinate index */
176 inr = iinr[iidx];
177 i_coord_offset = DIM3*inr;
178
179 /* Load i particle coords and add shift vector */
180 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
181 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
182
183 fix0 = _mm_setzero_ps();
184 fiy0 = _mm_setzero_ps();
185 fiz0 = _mm_setzero_ps();
186 fix1 = _mm_setzero_ps();
187 fiy1 = _mm_setzero_ps();
188 fiz1 = _mm_setzero_ps();
189 fix2 = _mm_setzero_ps();
190 fiy2 = _mm_setzero_ps();
191 fiz2 = _mm_setzero_ps();
192 fix3 = _mm_setzero_ps();
193 fiy3 = _mm_setzero_ps();
194 fiz3 = _mm_setzero_ps();
195
196 /* Reset potential sums */
197 velecsum = _mm_setzero_ps();
198 vvdwsum = _mm_setzero_ps();
199
200 /* Start inner kernel loop */
201 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
202 {
203
204 /* Get j neighbor index, and coordinate index */
205 jnrA = jjnr[jidx];
206 jnrB = jjnr[jidx+1];
207 jnrC = jjnr[jidx+2];
208 jnrD = jjnr[jidx+3];
209 j_coord_offsetA = DIM3*jnrA;
210 j_coord_offsetB = DIM3*jnrB;
211 j_coord_offsetC = DIM3*jnrC;
212 j_coord_offsetD = DIM3*jnrD;
213
214 /* load j atom coordinates */
215 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
216 x+j_coord_offsetC,x+j_coord_offsetD,
217 &jx0,&jy0,&jz0);
218
219 /* Calculate displacement vector */
220 dx00 = _mm_sub_ps(ix0,jx0);
221 dy00 = _mm_sub_ps(iy0,jy0);
222 dz00 = _mm_sub_ps(iz0,jz0);
223 dx10 = _mm_sub_ps(ix1,jx0);
224 dy10 = _mm_sub_ps(iy1,jy0);
225 dz10 = _mm_sub_ps(iz1,jz0);
226 dx20 = _mm_sub_ps(ix2,jx0);
227 dy20 = _mm_sub_ps(iy2,jy0);
228 dz20 = _mm_sub_ps(iz2,jz0);
229 dx30 = _mm_sub_ps(ix3,jx0);
230 dy30 = _mm_sub_ps(iy3,jy0);
231 dz30 = _mm_sub_ps(iz3,jz0);
232
233 /* Calculate squared distance and things based on it */
234 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
235 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
236 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
237 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
238
239 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
240 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
241 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
242 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
243
244 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
245 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
246 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
247
248 /* Load parameters for j particles */
249 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
250 charge+jnrC+0,charge+jnrD+0);
251 vdwjidx0A = 2*vdwtype[jnrA+0];
252 vdwjidx0B = 2*vdwtype[jnrB+0];
253 vdwjidx0C = 2*vdwtype[jnrC+0];
254 vdwjidx0D = 2*vdwtype[jnrD+0];
255
256 fjx0 = _mm_setzero_ps();
257 fjy0 = _mm_setzero_ps();
258 fjz0 = _mm_setzero_ps();
259
260 /**************************
261 * CALCULATE INTERACTIONS *
262 **************************/
263
264 r00 = _mm_mul_ps(rsq00,rinv00);
265
266 /* Compute parameters for interactions between i and j atoms */
267 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
268 vdwparam+vdwioffset0+vdwjidx0B,
269 vdwparam+vdwioffset0+vdwjidx0C,
270 vdwparam+vdwioffset0+vdwjidx0D,
271 &c6_00,&c12_00);
272
273 /* Calculate table index by multiplying r with table scale and truncate to integer */
274 rt = _mm_mul_ps(r00,vftabscale);
275 vfitab = _mm_cvttps_epi32(rt);
276 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
277 vfitab = _mm_slli_epi32(vfitab,3);
278
279 /* CUBIC SPLINE TABLE DISPERSION */
280 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
281 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
282 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
283 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
284 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
285 Heps = _mm_mul_ps(vfeps,H);
286 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
287 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
288 vvdw6 = _mm_mul_ps(c6_00,VV);
289 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
290 fvdw6 = _mm_mul_ps(c6_00,FF);
291
292 /* CUBIC SPLINE TABLE REPULSION */
293 vfitab = _mm_add_epi32(vfitab,ifour);
294 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
295 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
296 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
297 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
298 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
299 Heps = _mm_mul_ps(vfeps,H);
300 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
301 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
302 vvdw12 = _mm_mul_ps(c12_00,VV);
303 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
304 fvdw12 = _mm_mul_ps(c12_00,FF);
305 vvdw = _mm_add_ps(vvdw12,vvdw6);
306 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
307
308 /* Update potential sum for this i atom from the interaction with this j atom. */
309 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
310
311 fscal = fvdw;
312
313 /* Calculate temporary vectorial force */
314 tx = _mm_mul_ps(fscal,dx00);
315 ty = _mm_mul_ps(fscal,dy00);
316 tz = _mm_mul_ps(fscal,dz00);
317
318 /* Update vectorial force */
319 fix0 = _mm_add_ps(fix0,tx);
320 fiy0 = _mm_add_ps(fiy0,ty);
321 fiz0 = _mm_add_ps(fiz0,tz);
322
323 fjx0 = _mm_add_ps(fjx0,tx);
324 fjy0 = _mm_add_ps(fjy0,ty);
325 fjz0 = _mm_add_ps(fjz0,tz);
326
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
330
331 if (gmx_mm_any_lt(rsq10,rcutoff2))
332 {
333
334 /* Compute parameters for interactions between i and j atoms */
335 qq10 = _mm_mul_ps(iq1,jq0);
336
337 /* REACTION-FIELD ELECTROSTATICS */
338 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_add_ps(rinv10,_mm_mul_ps(krf,rsq10)),crf));
339 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
340
341 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
342
343 /* Update potential sum for this i atom from the interaction with this j atom. */
344 velec = _mm_and_ps(velec,cutoff_mask);
345 velecsum = _mm_add_ps(velecsum,velec);
346
347 fscal = felec;
348
349 fscal = _mm_and_ps(fscal,cutoff_mask);
350
351 /* Calculate temporary vectorial force */
352 tx = _mm_mul_ps(fscal,dx10);
353 ty = _mm_mul_ps(fscal,dy10);
354 tz = _mm_mul_ps(fscal,dz10);
355
356 /* Update vectorial force */
357 fix1 = _mm_add_ps(fix1,tx);
358 fiy1 = _mm_add_ps(fiy1,ty);
359 fiz1 = _mm_add_ps(fiz1,tz);
360
361 fjx0 = _mm_add_ps(fjx0,tx);
362 fjy0 = _mm_add_ps(fjy0,ty);
363 fjz0 = _mm_add_ps(fjz0,tz);
364
365 }
366
367 /**************************
368 * CALCULATE INTERACTIONS *
369 **************************/
370
371 if (gmx_mm_any_lt(rsq20,rcutoff2))
372 {
373
374 /* Compute parameters for interactions between i and j atoms */
375 qq20 = _mm_mul_ps(iq2,jq0);
376
377 /* REACTION-FIELD ELECTROSTATICS */
378 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_add_ps(rinv20,_mm_mul_ps(krf,rsq20)),crf));
379 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
380
381 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
382
383 /* Update potential sum for this i atom from the interaction with this j atom. */
384 velec = _mm_and_ps(velec,cutoff_mask);
385 velecsum = _mm_add_ps(velecsum,velec);
386
387 fscal = felec;
388
389 fscal = _mm_and_ps(fscal,cutoff_mask);
390
391 /* Calculate temporary vectorial force */
392 tx = _mm_mul_ps(fscal,dx20);
393 ty = _mm_mul_ps(fscal,dy20);
394 tz = _mm_mul_ps(fscal,dz20);
395
396 /* Update vectorial force */
397 fix2 = _mm_add_ps(fix2,tx);
398 fiy2 = _mm_add_ps(fiy2,ty);
399 fiz2 = _mm_add_ps(fiz2,tz);
400
401 fjx0 = _mm_add_ps(fjx0,tx);
402 fjy0 = _mm_add_ps(fjy0,ty);
403 fjz0 = _mm_add_ps(fjz0,tz);
404
405 }
406
407 /**************************
408 * CALCULATE INTERACTIONS *
409 **************************/
410
411 if (gmx_mm_any_lt(rsq30,rcutoff2))
412 {
413
414 /* Compute parameters for interactions between i and j atoms */
415 qq30 = _mm_mul_ps(iq3,jq0);
416
417 /* REACTION-FIELD ELECTROSTATICS */
418 velec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_add_ps(rinv30,_mm_mul_ps(krf,rsq30)),crf));
419 felec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_mul_ps(rinv30,rinvsq30),krf2));
420
421 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
422
423 /* Update potential sum for this i atom from the interaction with this j atom. */
424 velec = _mm_and_ps(velec,cutoff_mask);
425 velecsum = _mm_add_ps(velecsum,velec);
426
427 fscal = felec;
428
429 fscal = _mm_and_ps(fscal,cutoff_mask);
430
431 /* Calculate temporary vectorial force */
432 tx = _mm_mul_ps(fscal,dx30);
433 ty = _mm_mul_ps(fscal,dy30);
434 tz = _mm_mul_ps(fscal,dz30);
435
436 /* Update vectorial force */
437 fix3 = _mm_add_ps(fix3,tx);
438 fiy3 = _mm_add_ps(fiy3,ty);
439 fiz3 = _mm_add_ps(fiz3,tz);
440
441 fjx0 = _mm_add_ps(fjx0,tx);
442 fjy0 = _mm_add_ps(fjy0,ty);
443 fjz0 = _mm_add_ps(fjz0,tz);
444
445 }
446
447 fjptrA = f+j_coord_offsetA;
448 fjptrB = f+j_coord_offsetB;
449 fjptrC = f+j_coord_offsetC;
450 fjptrD = f+j_coord_offsetD;
451
452 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
453
454 /* Inner loop uses 164 flops */
455 }
456
457 if(jidx<j_index_end)
458 {
459
460 /* Get j neighbor index, and coordinate index */
461 jnrlistA = jjnr[jidx];
462 jnrlistB = jjnr[jidx+1];
463 jnrlistC = jjnr[jidx+2];
464 jnrlistD = jjnr[jidx+3];
465 /* Sign of each element will be negative for non-real atoms.
466 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
467 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
468 */
469 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
470 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
471 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
472 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
473 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
474 j_coord_offsetA = DIM3*jnrA;
475 j_coord_offsetB = DIM3*jnrB;
476 j_coord_offsetC = DIM3*jnrC;
477 j_coord_offsetD = DIM3*jnrD;
478
479 /* load j atom coordinates */
480 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
481 x+j_coord_offsetC,x+j_coord_offsetD,
482 &jx0,&jy0,&jz0);
483
484 /* Calculate displacement vector */
485 dx00 = _mm_sub_ps(ix0,jx0);
486 dy00 = _mm_sub_ps(iy0,jy0);
487 dz00 = _mm_sub_ps(iz0,jz0);
488 dx10 = _mm_sub_ps(ix1,jx0);
489 dy10 = _mm_sub_ps(iy1,jy0);
490 dz10 = _mm_sub_ps(iz1,jz0);
491 dx20 = _mm_sub_ps(ix2,jx0);
492 dy20 = _mm_sub_ps(iy2,jy0);
493 dz20 = _mm_sub_ps(iz2,jz0);
494 dx30 = _mm_sub_ps(ix3,jx0);
495 dy30 = _mm_sub_ps(iy3,jy0);
496 dz30 = _mm_sub_ps(iz3,jz0);
497
498 /* Calculate squared distance and things based on it */
499 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
500 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
501 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
502 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
503
504 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
505 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
506 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
507 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
508
509 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
510 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
511 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
512
513 /* Load parameters for j particles */
514 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
515 charge+jnrC+0,charge+jnrD+0);
516 vdwjidx0A = 2*vdwtype[jnrA+0];
517 vdwjidx0B = 2*vdwtype[jnrB+0];
518 vdwjidx0C = 2*vdwtype[jnrC+0];
519 vdwjidx0D = 2*vdwtype[jnrD+0];
520
521 fjx0 = _mm_setzero_ps();
522 fjy0 = _mm_setzero_ps();
523 fjz0 = _mm_setzero_ps();
524
525 /**************************
526 * CALCULATE INTERACTIONS *
527 **************************/
528
529 r00 = _mm_mul_ps(rsq00,rinv00);
530 r00 = _mm_andnot_ps(dummy_mask,r00);
531
532 /* Compute parameters for interactions between i and j atoms */
533 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
534 vdwparam+vdwioffset0+vdwjidx0B,
535 vdwparam+vdwioffset0+vdwjidx0C,
536 vdwparam+vdwioffset0+vdwjidx0D,
537 &c6_00,&c12_00);
538
539 /* Calculate table index by multiplying r with table scale and truncate to integer */
540 rt = _mm_mul_ps(r00,vftabscale);
541 vfitab = _mm_cvttps_epi32(rt);
542 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
543 vfitab = _mm_slli_epi32(vfitab,3);
544
545 /* CUBIC SPLINE TABLE DISPERSION */
546 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
547 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
548 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
549 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
550 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
551 Heps = _mm_mul_ps(vfeps,H);
552 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
553 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
554 vvdw6 = _mm_mul_ps(c6_00,VV);
555 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
556 fvdw6 = _mm_mul_ps(c6_00,FF);
557
558 /* CUBIC SPLINE TABLE REPULSION */
559 vfitab = _mm_add_epi32(vfitab,ifour);
560 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
561 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
562 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
563 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
564 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
565 Heps = _mm_mul_ps(vfeps,H);
566 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
567 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
568 vvdw12 = _mm_mul_ps(c12_00,VV);
569 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
570 fvdw12 = _mm_mul_ps(c12_00,FF);
571 vvdw = _mm_add_ps(vvdw12,vvdw6);
572 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
573
574 /* Update potential sum for this i atom from the interaction with this j atom. */
575 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
576 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
577
578 fscal = fvdw;
579
580 fscal = _mm_andnot_ps(dummy_mask,fscal);
581
582 /* Calculate temporary vectorial force */
583 tx = _mm_mul_ps(fscal,dx00);
584 ty = _mm_mul_ps(fscal,dy00);
585 tz = _mm_mul_ps(fscal,dz00);
586
587 /* Update vectorial force */
588 fix0 = _mm_add_ps(fix0,tx);
589 fiy0 = _mm_add_ps(fiy0,ty);
590 fiz0 = _mm_add_ps(fiz0,tz);
591
592 fjx0 = _mm_add_ps(fjx0,tx);
593 fjy0 = _mm_add_ps(fjy0,ty);
594 fjz0 = _mm_add_ps(fjz0,tz);
595
596 /**************************
597 * CALCULATE INTERACTIONS *
598 **************************/
599
600 if (gmx_mm_any_lt(rsq10,rcutoff2))
601 {
602
603 /* Compute parameters for interactions between i and j atoms */
604 qq10 = _mm_mul_ps(iq1,jq0);
605
606 /* REACTION-FIELD ELECTROSTATICS */
607 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_add_ps(rinv10,_mm_mul_ps(krf,rsq10)),crf));
608 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
609
610 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
611
612 /* Update potential sum for this i atom from the interaction with this j atom. */
613 velec = _mm_and_ps(velec,cutoff_mask);
614 velec = _mm_andnot_ps(dummy_mask,velec);
615 velecsum = _mm_add_ps(velecsum,velec);
616
617 fscal = felec;
618
619 fscal = _mm_and_ps(fscal,cutoff_mask);
620
621 fscal = _mm_andnot_ps(dummy_mask,fscal);
622
623 /* Calculate temporary vectorial force */
624 tx = _mm_mul_ps(fscal,dx10);
625 ty = _mm_mul_ps(fscal,dy10);
626 tz = _mm_mul_ps(fscal,dz10);
627
628 /* Update vectorial force */
629 fix1 = _mm_add_ps(fix1,tx);
630 fiy1 = _mm_add_ps(fiy1,ty);
631 fiz1 = _mm_add_ps(fiz1,tz);
632
633 fjx0 = _mm_add_ps(fjx0,tx);
634 fjy0 = _mm_add_ps(fjy0,ty);
635 fjz0 = _mm_add_ps(fjz0,tz);
636
637 }
638
639 /**************************
640 * CALCULATE INTERACTIONS *
641 **************************/
642
643 if (gmx_mm_any_lt(rsq20,rcutoff2))
644 {
645
646 /* Compute parameters for interactions between i and j atoms */
647 qq20 = _mm_mul_ps(iq2,jq0);
648
649 /* REACTION-FIELD ELECTROSTATICS */
650 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_add_ps(rinv20,_mm_mul_ps(krf,rsq20)),crf));
651 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
652
653 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
654
655 /* Update potential sum for this i atom from the interaction with this j atom. */
656 velec = _mm_and_ps(velec,cutoff_mask);
657 velec = _mm_andnot_ps(dummy_mask,velec);
658 velecsum = _mm_add_ps(velecsum,velec);
659
660 fscal = felec;
661
662 fscal = _mm_and_ps(fscal,cutoff_mask);
663
664 fscal = _mm_andnot_ps(dummy_mask,fscal);
665
666 /* Calculate temporary vectorial force */
667 tx = _mm_mul_ps(fscal,dx20);
668 ty = _mm_mul_ps(fscal,dy20);
669 tz = _mm_mul_ps(fscal,dz20);
670
671 /* Update vectorial force */
672 fix2 = _mm_add_ps(fix2,tx);
673 fiy2 = _mm_add_ps(fiy2,ty);
674 fiz2 = _mm_add_ps(fiz2,tz);
675
676 fjx0 = _mm_add_ps(fjx0,tx);
677 fjy0 = _mm_add_ps(fjy0,ty);
678 fjz0 = _mm_add_ps(fjz0,tz);
679
680 }
681
682 /**************************
683 * CALCULATE INTERACTIONS *
684 **************************/
685
686 if (gmx_mm_any_lt(rsq30,rcutoff2))
687 {
688
689 /* Compute parameters for interactions between i and j atoms */
690 qq30 = _mm_mul_ps(iq3,jq0);
691
692 /* REACTION-FIELD ELECTROSTATICS */
693 velec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_add_ps(rinv30,_mm_mul_ps(krf,rsq30)),crf));
694 felec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_mul_ps(rinv30,rinvsq30),krf2));
695
696 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
697
698 /* Update potential sum for this i atom from the interaction with this j atom. */
699 velec = _mm_and_ps(velec,cutoff_mask);
700 velec = _mm_andnot_ps(dummy_mask,velec);
701 velecsum = _mm_add_ps(velecsum,velec);
702
703 fscal = felec;
704
705 fscal = _mm_and_ps(fscal,cutoff_mask);
706
707 fscal = _mm_andnot_ps(dummy_mask,fscal);
708
709 /* Calculate temporary vectorial force */
710 tx = _mm_mul_ps(fscal,dx30);
711 ty = _mm_mul_ps(fscal,dy30);
712 tz = _mm_mul_ps(fscal,dz30);
713
714 /* Update vectorial force */
715 fix3 = _mm_add_ps(fix3,tx);
716 fiy3 = _mm_add_ps(fiy3,ty);
717 fiz3 = _mm_add_ps(fiz3,tz);
718
719 fjx0 = _mm_add_ps(fjx0,tx);
720 fjy0 = _mm_add_ps(fjy0,ty);
721 fjz0 = _mm_add_ps(fjz0,tz);
722
723 }
724
725 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
726 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
727 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
728 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
729
730 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
731
732 /* Inner loop uses 165 flops */
733 }
734
735 /* End of innermost loop */
736
737 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
738 f+i_coord_offset,fshift+i_shift_offset);
739
740 ggid = gid[iidx];
741 /* Update potential energies */
742 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
743 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
744
745 /* Increment number of inner iterations */
746 inneriter += j_index_end - j_index_start;
747
748 /* Outer loop uses 26 flops */
749 }
750
751 /* Increment number of outer iterations */
752 outeriter += nri;
753
754 /* Update outer/inner flops */
755
756 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*165)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_VF] += outeriter*26 + inneriter
*165
;
757}
758/*
759 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sse4_1_single
760 * Electrostatics interaction: ReactionField
761 * VdW interaction: CubicSplineTable
762 * Geometry: Water4-Particle
763 * Calculate force/pot: Force
764 */
765void
766nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sse4_1_single
767 (t_nblist * gmx_restrict nlist,
768 rvec * gmx_restrict xx,
769 rvec * gmx_restrict ff,
770 t_forcerec * gmx_restrict fr,
771 t_mdatoms * gmx_restrict mdatoms,
772 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
773 t_nrnb * gmx_restrict nrnb)
774{
775 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
776 * just 0 for non-waters.
777 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
778 * jnr indices corresponding to data put in the four positions in the SIMD register.
779 */
780 int i_shift_offset,i_coord_offset,outeriter,inneriter;
781 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
782 int jnrA,jnrB,jnrC,jnrD;
783 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
784 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
785 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
786 real rcutoff_scalar;
787 real *shiftvec,*fshift,*x,*f;
788 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
789 real scratch[4*DIM3];
790 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
791 int vdwioffset0;
792 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
793 int vdwioffset1;
794 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
795 int vdwioffset2;
796 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
797 int vdwioffset3;
798 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
799 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
800 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
801 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
802 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
803 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
804 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
805 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
806 real *charge;
807 int nvdwtype;
808 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
809 int *vdwtype;
810 real *vdwparam;
811 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
812 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
813 __m128i vfitab;
814 __m128i ifour = _mm_set1_epi32(4);
815 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
816 real *vftab;
817 __m128 dummy_mask,cutoff_mask;
818 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
819 __m128 one = _mm_set1_ps(1.0);
820 __m128 two = _mm_set1_ps(2.0);
821 x = xx[0];
822 f = ff[0];
823
824 nri = nlist->nri;
825 iinr = nlist->iinr;
826 jindex = nlist->jindex;
827 jjnr = nlist->jjnr;
828 shiftidx = nlist->shift;
829 gid = nlist->gid;
830 shiftvec = fr->shift_vec[0];
831 fshift = fr->fshift[0];
832 facel = _mm_set1_ps(fr->epsfac);
833 charge = mdatoms->chargeA;
834 krf = _mm_set1_ps(fr->ic->k_rf);
835 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
836 crf = _mm_set1_ps(fr->ic->c_rf);
837 nvdwtype = fr->ntype;
838 vdwparam = fr->nbfp;
839 vdwtype = mdatoms->typeA;
840
841 vftab = kernel_data->table_vdw->data;
842 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
843
844 /* Setup water-specific parameters */
845 inr = nlist->iinr[0];
846 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
847 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
848 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
849 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
850
851 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
852 rcutoff_scalar = fr->rcoulomb;
853 rcutoff = _mm_set1_ps(rcutoff_scalar);
854 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
855
856 /* Avoid stupid compiler warnings */
857 jnrA = jnrB = jnrC = jnrD = 0;
858 j_coord_offsetA = 0;
859 j_coord_offsetB = 0;
860 j_coord_offsetC = 0;
Value stored to 'j_coord_offsetC' is never read
861 j_coord_offsetD = 0;
862
863 outeriter = 0;
864 inneriter = 0;
865
866 for(iidx=0;iidx<4*DIM3;iidx++)
867 {
868 scratch[iidx] = 0.0;
869 }
870
871 /* Start outer loop over neighborlists */
872 for(iidx=0; iidx<nri; iidx++)
873 {
874 /* Load shift vector for this list */
875 i_shift_offset = DIM3*shiftidx[iidx];
876
877 /* Load limits for loop over neighbors */
878 j_index_start = jindex[iidx];
879 j_index_end = jindex[iidx+1];
880
881 /* Get outer coordinate index */
882 inr = iinr[iidx];
883 i_coord_offset = DIM3*inr;
884
885 /* Load i particle coords and add shift vector */
886 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
887 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
888
889 fix0 = _mm_setzero_ps();
890 fiy0 = _mm_setzero_ps();
891 fiz0 = _mm_setzero_ps();
892 fix1 = _mm_setzero_ps();
893 fiy1 = _mm_setzero_ps();
894 fiz1 = _mm_setzero_ps();
895 fix2 = _mm_setzero_ps();
896 fiy2 = _mm_setzero_ps();
897 fiz2 = _mm_setzero_ps();
898 fix3 = _mm_setzero_ps();
899 fiy3 = _mm_setzero_ps();
900 fiz3 = _mm_setzero_ps();
901
902 /* Start inner kernel loop */
903 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
904 {
905
906 /* Get j neighbor index, and coordinate index */
907 jnrA = jjnr[jidx];
908 jnrB = jjnr[jidx+1];
909 jnrC = jjnr[jidx+2];
910 jnrD = jjnr[jidx+3];
911 j_coord_offsetA = DIM3*jnrA;
912 j_coord_offsetB = DIM3*jnrB;
913 j_coord_offsetC = DIM3*jnrC;
914 j_coord_offsetD = DIM3*jnrD;
915
916 /* load j atom coordinates */
917 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
918 x+j_coord_offsetC,x+j_coord_offsetD,
919 &jx0,&jy0,&jz0);
920
921 /* Calculate displacement vector */
922 dx00 = _mm_sub_ps(ix0,jx0);
923 dy00 = _mm_sub_ps(iy0,jy0);
924 dz00 = _mm_sub_ps(iz0,jz0);
925 dx10 = _mm_sub_ps(ix1,jx0);
926 dy10 = _mm_sub_ps(iy1,jy0);
927 dz10 = _mm_sub_ps(iz1,jz0);
928 dx20 = _mm_sub_ps(ix2,jx0);
929 dy20 = _mm_sub_ps(iy2,jy0);
930 dz20 = _mm_sub_ps(iz2,jz0);
931 dx30 = _mm_sub_ps(ix3,jx0);
932 dy30 = _mm_sub_ps(iy3,jy0);
933 dz30 = _mm_sub_ps(iz3,jz0);
934
935 /* Calculate squared distance and things based on it */
936 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
937 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
938 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
939 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
940
941 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
942 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
943 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
944 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
945
946 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
947 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
948 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
949
950 /* Load parameters for j particles */
951 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
952 charge+jnrC+0,charge+jnrD+0);
953 vdwjidx0A = 2*vdwtype[jnrA+0];
954 vdwjidx0B = 2*vdwtype[jnrB+0];
955 vdwjidx0C = 2*vdwtype[jnrC+0];
956 vdwjidx0D = 2*vdwtype[jnrD+0];
957
958 fjx0 = _mm_setzero_ps();
959 fjy0 = _mm_setzero_ps();
960 fjz0 = _mm_setzero_ps();
961
962 /**************************
963 * CALCULATE INTERACTIONS *
964 **************************/
965
966 r00 = _mm_mul_ps(rsq00,rinv00);
967
968 /* Compute parameters for interactions between i and j atoms */
969 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
970 vdwparam+vdwioffset0+vdwjidx0B,
971 vdwparam+vdwioffset0+vdwjidx0C,
972 vdwparam+vdwioffset0+vdwjidx0D,
973 &c6_00,&c12_00);
974
975 /* Calculate table index by multiplying r with table scale and truncate to integer */
976 rt = _mm_mul_ps(r00,vftabscale);
977 vfitab = _mm_cvttps_epi32(rt);
978 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
979 vfitab = _mm_slli_epi32(vfitab,3);
980
981 /* CUBIC SPLINE TABLE DISPERSION */
982 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
983 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
984 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
985 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
986 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
987 Heps = _mm_mul_ps(vfeps,H);
988 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
989 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
990 fvdw6 = _mm_mul_ps(c6_00,FF);
991
992 /* CUBIC SPLINE TABLE REPULSION */
993 vfitab = _mm_add_epi32(vfitab,ifour);
994 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
995 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
996 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
997 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
998 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
999 Heps = _mm_mul_ps(vfeps,H);
1000 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1001 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1002 fvdw12 = _mm_mul_ps(c12_00,FF);
1003 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1004
1005 fscal = fvdw;
1006
1007 /* Calculate temporary vectorial force */
1008 tx = _mm_mul_ps(fscal,dx00);
1009 ty = _mm_mul_ps(fscal,dy00);
1010 tz = _mm_mul_ps(fscal,dz00);
1011
1012 /* Update vectorial force */
1013 fix0 = _mm_add_ps(fix0,tx);
1014 fiy0 = _mm_add_ps(fiy0,ty);
1015 fiz0 = _mm_add_ps(fiz0,tz);
1016
1017 fjx0 = _mm_add_ps(fjx0,tx);
1018 fjy0 = _mm_add_ps(fjy0,ty);
1019 fjz0 = _mm_add_ps(fjz0,tz);
1020
1021 /**************************
1022 * CALCULATE INTERACTIONS *
1023 **************************/
1024
1025 if (gmx_mm_any_lt(rsq10,rcutoff2))
1026 {
1027
1028 /* Compute parameters for interactions between i and j atoms */
1029 qq10 = _mm_mul_ps(iq1,jq0);
1030
1031 /* REACTION-FIELD ELECTROSTATICS */
1032 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
1033
1034 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1035
1036 fscal = felec;
1037
1038 fscal = _mm_and_ps(fscal,cutoff_mask);
1039
1040 /* Calculate temporary vectorial force */
1041 tx = _mm_mul_ps(fscal,dx10);
1042 ty = _mm_mul_ps(fscal,dy10);
1043 tz = _mm_mul_ps(fscal,dz10);
1044
1045 /* Update vectorial force */
1046 fix1 = _mm_add_ps(fix1,tx);
1047 fiy1 = _mm_add_ps(fiy1,ty);
1048 fiz1 = _mm_add_ps(fiz1,tz);
1049
1050 fjx0 = _mm_add_ps(fjx0,tx);
1051 fjy0 = _mm_add_ps(fjy0,ty);
1052 fjz0 = _mm_add_ps(fjz0,tz);
1053
1054 }
1055
1056 /**************************
1057 * CALCULATE INTERACTIONS *
1058 **************************/
1059
1060 if (gmx_mm_any_lt(rsq20,rcutoff2))
1061 {
1062
1063 /* Compute parameters for interactions between i and j atoms */
1064 qq20 = _mm_mul_ps(iq2,jq0);
1065
1066 /* REACTION-FIELD ELECTROSTATICS */
1067 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
1068
1069 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1070
1071 fscal = felec;
1072
1073 fscal = _mm_and_ps(fscal,cutoff_mask);
1074
1075 /* Calculate temporary vectorial force */
1076 tx = _mm_mul_ps(fscal,dx20);
1077 ty = _mm_mul_ps(fscal,dy20);
1078 tz = _mm_mul_ps(fscal,dz20);
1079
1080 /* Update vectorial force */
1081 fix2 = _mm_add_ps(fix2,tx);
1082 fiy2 = _mm_add_ps(fiy2,ty);
1083 fiz2 = _mm_add_ps(fiz2,tz);
1084
1085 fjx0 = _mm_add_ps(fjx0,tx);
1086 fjy0 = _mm_add_ps(fjy0,ty);
1087 fjz0 = _mm_add_ps(fjz0,tz);
1088
1089 }
1090
1091 /**************************
1092 * CALCULATE INTERACTIONS *
1093 **************************/
1094
1095 if (gmx_mm_any_lt(rsq30,rcutoff2))
1096 {
1097
1098 /* Compute parameters for interactions between i and j atoms */
1099 qq30 = _mm_mul_ps(iq3,jq0);
1100
1101 /* REACTION-FIELD ELECTROSTATICS */
1102 felec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_mul_ps(rinv30,rinvsq30),krf2));
1103
1104 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
1105
1106 fscal = felec;
1107
1108 fscal = _mm_and_ps(fscal,cutoff_mask);
1109
1110 /* Calculate temporary vectorial force */
1111 tx = _mm_mul_ps(fscal,dx30);
1112 ty = _mm_mul_ps(fscal,dy30);
1113 tz = _mm_mul_ps(fscal,dz30);
1114
1115 /* Update vectorial force */
1116 fix3 = _mm_add_ps(fix3,tx);
1117 fiy3 = _mm_add_ps(fiy3,ty);
1118 fiz3 = _mm_add_ps(fiz3,tz);
1119
1120 fjx0 = _mm_add_ps(fjx0,tx);
1121 fjy0 = _mm_add_ps(fjy0,ty);
1122 fjz0 = _mm_add_ps(fjz0,tz);
1123
1124 }
1125
1126 fjptrA = f+j_coord_offsetA;
1127 fjptrB = f+j_coord_offsetB;
1128 fjptrC = f+j_coord_offsetC;
1129 fjptrD = f+j_coord_offsetD;
1130
1131 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1132
1133 /* Inner loop uses 138 flops */
1134 }
1135
1136 if(jidx<j_index_end)
1137 {
1138
1139 /* Get j neighbor index, and coordinate index */
1140 jnrlistA = jjnr[jidx];
1141 jnrlistB = jjnr[jidx+1];
1142 jnrlistC = jjnr[jidx+2];
1143 jnrlistD = jjnr[jidx+3];
1144 /* Sign of each element will be negative for non-real atoms.
1145 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
1146 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
1147 */
1148 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
1149 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
1150 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
1151 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
1152 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
1153 j_coord_offsetA = DIM3*jnrA;
1154 j_coord_offsetB = DIM3*jnrB;
1155 j_coord_offsetC = DIM3*jnrC;
1156 j_coord_offsetD = DIM3*jnrD;
1157
1158 /* load j atom coordinates */
1159 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1160 x+j_coord_offsetC,x+j_coord_offsetD,
1161 &jx0,&jy0,&jz0);
1162
1163 /* Calculate displacement vector */
1164 dx00 = _mm_sub_ps(ix0,jx0);
1165 dy00 = _mm_sub_ps(iy0,jy0);
1166 dz00 = _mm_sub_ps(iz0,jz0);
1167 dx10 = _mm_sub_ps(ix1,jx0);
1168 dy10 = _mm_sub_ps(iy1,jy0);
1169 dz10 = _mm_sub_ps(iz1,jz0);
1170 dx20 = _mm_sub_ps(ix2,jx0);
1171 dy20 = _mm_sub_ps(iy2,jy0);
1172 dz20 = _mm_sub_ps(iz2,jz0);
1173 dx30 = _mm_sub_ps(ix3,jx0);
1174 dy30 = _mm_sub_ps(iy3,jy0);
1175 dz30 = _mm_sub_ps(iz3,jz0);
1176
1177 /* Calculate squared distance and things based on it */
1178 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1179 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1180 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1181 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
1182
1183 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
1184 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
1185 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
1186 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
1187
1188 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
1189 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
1190 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
1191
1192 /* Load parameters for j particles */
1193 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
1194 charge+jnrC+0,charge+jnrD+0);
1195 vdwjidx0A = 2*vdwtype[jnrA+0];
1196 vdwjidx0B = 2*vdwtype[jnrB+0];
1197 vdwjidx0C = 2*vdwtype[jnrC+0];
1198 vdwjidx0D = 2*vdwtype[jnrD+0];
1199
1200 fjx0 = _mm_setzero_ps();
1201 fjy0 = _mm_setzero_ps();
1202 fjz0 = _mm_setzero_ps();
1203
1204 /**************************
1205 * CALCULATE INTERACTIONS *
1206 **************************/
1207
1208 r00 = _mm_mul_ps(rsq00,rinv00);
1209 r00 = _mm_andnot_ps(dummy_mask,r00);
1210
1211 /* Compute parameters for interactions between i and j atoms */
1212 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
1213 vdwparam+vdwioffset0+vdwjidx0B,
1214 vdwparam+vdwioffset0+vdwjidx0C,
1215 vdwparam+vdwioffset0+vdwjidx0D,
1216 &c6_00,&c12_00);
1217
1218 /* Calculate table index by multiplying r with table scale and truncate to integer */
1219 rt = _mm_mul_ps(r00,vftabscale);
1220 vfitab = _mm_cvttps_epi32(rt);
1221 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1222 vfitab = _mm_slli_epi32(vfitab,3);
1223
1224 /* CUBIC SPLINE TABLE DISPERSION */
1225 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1226 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1227 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1228 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1229 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1230 Heps = _mm_mul_ps(vfeps,H);
1231 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1232 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1233 fvdw6 = _mm_mul_ps(c6_00,FF);
1234
1235 /* CUBIC SPLINE TABLE REPULSION */
1236 vfitab = _mm_add_epi32(vfitab,ifour);
1237 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1238 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1239 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1240 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1241 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1242 Heps = _mm_mul_ps(vfeps,H);
1243 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1244 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1245 fvdw12 = _mm_mul_ps(c12_00,FF);
1246 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1247
1248 fscal = fvdw;
1249
1250 fscal = _mm_andnot_ps(dummy_mask,fscal);
1251
1252 /* Calculate temporary vectorial force */
1253 tx = _mm_mul_ps(fscal,dx00);
1254 ty = _mm_mul_ps(fscal,dy00);
1255 tz = _mm_mul_ps(fscal,dz00);
1256
1257 /* Update vectorial force */
1258 fix0 = _mm_add_ps(fix0,tx);
1259 fiy0 = _mm_add_ps(fiy0,ty);
1260 fiz0 = _mm_add_ps(fiz0,tz);
1261
1262 fjx0 = _mm_add_ps(fjx0,tx);
1263 fjy0 = _mm_add_ps(fjy0,ty);
1264 fjz0 = _mm_add_ps(fjz0,tz);
1265
1266 /**************************
1267 * CALCULATE INTERACTIONS *
1268 **************************/
1269
1270 if (gmx_mm_any_lt(rsq10,rcutoff2))
1271 {
1272
1273 /* Compute parameters for interactions between i and j atoms */
1274 qq10 = _mm_mul_ps(iq1,jq0);
1275
1276 /* REACTION-FIELD ELECTROSTATICS */
1277 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
1278
1279 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1280
1281 fscal = felec;
1282
1283 fscal = _mm_and_ps(fscal,cutoff_mask);
1284
1285 fscal = _mm_andnot_ps(dummy_mask,fscal);
1286
1287 /* Calculate temporary vectorial force */
1288 tx = _mm_mul_ps(fscal,dx10);
1289 ty = _mm_mul_ps(fscal,dy10);
1290 tz = _mm_mul_ps(fscal,dz10);
1291
1292 /* Update vectorial force */
1293 fix1 = _mm_add_ps(fix1,tx);
1294 fiy1 = _mm_add_ps(fiy1,ty);
1295 fiz1 = _mm_add_ps(fiz1,tz);
1296
1297 fjx0 = _mm_add_ps(fjx0,tx);
1298 fjy0 = _mm_add_ps(fjy0,ty);
1299 fjz0 = _mm_add_ps(fjz0,tz);
1300
1301 }
1302
1303 /**************************
1304 * CALCULATE INTERACTIONS *
1305 **************************/
1306
1307 if (gmx_mm_any_lt(rsq20,rcutoff2))
1308 {
1309
1310 /* Compute parameters for interactions between i and j atoms */
1311 qq20 = _mm_mul_ps(iq2,jq0);
1312
1313 /* REACTION-FIELD ELECTROSTATICS */
1314 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
1315
1316 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1317
1318 fscal = felec;
1319
1320 fscal = _mm_and_ps(fscal,cutoff_mask);
1321
1322 fscal = _mm_andnot_ps(dummy_mask,fscal);
1323
1324 /* Calculate temporary vectorial force */
1325 tx = _mm_mul_ps(fscal,dx20);
1326 ty = _mm_mul_ps(fscal,dy20);
1327 tz = _mm_mul_ps(fscal,dz20);
1328
1329 /* Update vectorial force */
1330 fix2 = _mm_add_ps(fix2,tx);
1331 fiy2 = _mm_add_ps(fiy2,ty);
1332 fiz2 = _mm_add_ps(fiz2,tz);
1333
1334 fjx0 = _mm_add_ps(fjx0,tx);
1335 fjy0 = _mm_add_ps(fjy0,ty);
1336 fjz0 = _mm_add_ps(fjz0,tz);
1337
1338 }
1339
1340 /**************************
1341 * CALCULATE INTERACTIONS *
1342 **************************/
1343
1344 if (gmx_mm_any_lt(rsq30,rcutoff2))
1345 {
1346
1347 /* Compute parameters for interactions between i and j atoms */
1348 qq30 = _mm_mul_ps(iq3,jq0);
1349
1350 /* REACTION-FIELD ELECTROSTATICS */
1351 felec = _mm_mul_ps(qq30,_mm_sub_ps(_mm_mul_ps(rinv30,rinvsq30),krf2));
1352
1353 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
1354
1355 fscal = felec;
1356
1357 fscal = _mm_and_ps(fscal,cutoff_mask);
1358
1359 fscal = _mm_andnot_ps(dummy_mask,fscal);
1360
1361 /* Calculate temporary vectorial force */
1362 tx = _mm_mul_ps(fscal,dx30);
1363 ty = _mm_mul_ps(fscal,dy30);
1364 tz = _mm_mul_ps(fscal,dz30);
1365
1366 /* Update vectorial force */
1367 fix3 = _mm_add_ps(fix3,tx);
1368 fiy3 = _mm_add_ps(fiy3,ty);
1369 fiz3 = _mm_add_ps(fiz3,tz);
1370
1371 fjx0 = _mm_add_ps(fjx0,tx);
1372 fjy0 = _mm_add_ps(fjy0,ty);
1373 fjz0 = _mm_add_ps(fjz0,tz);
1374
1375 }
1376
1377 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1378 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1379 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1380 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1381
1382 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1383
1384 /* Inner loop uses 139 flops */
1385 }
1386
1387 /* End of innermost loop */
1388
1389 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1390 f+i_coord_offset,fshift+i_shift_offset);
1391
1392 /* Increment number of inner iterations */
1393 inneriter += j_index_end - j_index_start;
1394
1395 /* Outer loop uses 24 flops */
1396 }
1397
1398 /* Increment number of outer iterations */
1399 outeriter += nri;
1400
1401 /* Update outer/inner flops */
1402
1403 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*139)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_F] += outeriter*24 + inneriter
*139
;
1404}