2 * This file is part of the GROMACS molecular simulation package.
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.
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.
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.
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.
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.
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.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: LJEwald
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 c6grid_00;
104 _fjsp_v2r8 c6grid_10;
105 _fjsp_v2r8 c6grid_20;
106 _fjsp_v2r8 c6grid_30;
108 _fjsp_v2r8 ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,f6A,f6B,sh_lj_ewald;
109 _fjsp_v2r8 one_half = gmx_fjsp_set1_v2r8(0.5);
110 _fjsp_v2r8 minus_one = gmx_fjsp_set1_v2r8(-1.0);
111 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
114 _fjsp_v2r8 dummy_mask,cutoff_mask;
115 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
116 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
117 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
124 jindex = nlist->jindex;
126 shiftidx = nlist->shift;
128 shiftvec = fr->shift_vec[0];
129 fshift = fr->fshift[0];
130 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
131 charge = mdatoms->chargeA;
132 nvdwtype = fr->ntype;
134 vdwtype = mdatoms->typeA;
135 vdwgridparam = fr->ljpme_c6grid;
136 sh_lj_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_lj_ewald);
137 ewclj = gmx_fjsp_set1_v2r8(fr->ewaldcoeff_lj);
138 ewclj2 = _fjsp_mul_v2r8(minus_one,_fjsp_mul_v2r8(ewclj,ewclj));
140 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
141 ewtab = fr->ic->tabq_coul_FDV0;
142 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
143 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
145 /* Setup water-specific parameters */
146 inr = nlist->iinr[0];
147 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
148 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
149 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
150 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
152 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
153 rcutoff_scalar = fr->rcoulomb;
154 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
155 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
157 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
158 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
160 /* Avoid stupid compiler warnings */
168 /* Start outer loop over neighborlists */
169 for(iidx=0; iidx<nri; iidx++)
171 /* Load shift vector for this list */
172 i_shift_offset = DIM*shiftidx[iidx];
174 /* Load limits for loop over neighbors */
175 j_index_start = jindex[iidx];
176 j_index_end = jindex[iidx+1];
178 /* Get outer coordinate index */
180 i_coord_offset = DIM*inr;
182 /* Load i particle coords and add shift vector */
183 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
184 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
186 fix0 = _fjsp_setzero_v2r8();
187 fiy0 = _fjsp_setzero_v2r8();
188 fiz0 = _fjsp_setzero_v2r8();
189 fix1 = _fjsp_setzero_v2r8();
190 fiy1 = _fjsp_setzero_v2r8();
191 fiz1 = _fjsp_setzero_v2r8();
192 fix2 = _fjsp_setzero_v2r8();
193 fiy2 = _fjsp_setzero_v2r8();
194 fiz2 = _fjsp_setzero_v2r8();
195 fix3 = _fjsp_setzero_v2r8();
196 fiy3 = _fjsp_setzero_v2r8();
197 fiz3 = _fjsp_setzero_v2r8();
199 /* Reset potential sums */
200 velecsum = _fjsp_setzero_v2r8();
201 vvdwsum = _fjsp_setzero_v2r8();
203 /* Start inner kernel loop */
204 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
207 /* Get j neighbor index, and coordinate index */
210 j_coord_offsetA = DIM*jnrA;
211 j_coord_offsetB = DIM*jnrB;
213 /* load j atom coordinates */
214 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
217 /* Calculate displacement vector */
218 dx00 = _fjsp_sub_v2r8(ix0,jx0);
219 dy00 = _fjsp_sub_v2r8(iy0,jy0);
220 dz00 = _fjsp_sub_v2r8(iz0,jz0);
221 dx10 = _fjsp_sub_v2r8(ix1,jx0);
222 dy10 = _fjsp_sub_v2r8(iy1,jy0);
223 dz10 = _fjsp_sub_v2r8(iz1,jz0);
224 dx20 = _fjsp_sub_v2r8(ix2,jx0);
225 dy20 = _fjsp_sub_v2r8(iy2,jy0);
226 dz20 = _fjsp_sub_v2r8(iz2,jz0);
227 dx30 = _fjsp_sub_v2r8(ix3,jx0);
228 dy30 = _fjsp_sub_v2r8(iy3,jy0);
229 dz30 = _fjsp_sub_v2r8(iz3,jz0);
231 /* Calculate squared distance and things based on it */
232 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
233 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
234 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
235 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
237 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
238 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
239 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
240 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
242 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
243 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
244 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
245 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
247 /* Load parameters for j particles */
248 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
249 vdwjidx0A = 2*vdwtype[jnrA+0];
250 vdwjidx0B = 2*vdwtype[jnrB+0];
252 fjx0 = _fjsp_setzero_v2r8();
253 fjy0 = _fjsp_setzero_v2r8();
254 fjz0 = _fjsp_setzero_v2r8();
256 /**************************
257 * CALCULATE INTERACTIONS *
258 **************************/
260 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
263 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
265 /* Compute parameters for interactions between i and j atoms */
266 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
267 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
269 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
270 vdwgridparam+vdwioffset0+vdwjidx0B);
272 /* Analytical LJ-PME */
273 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
274 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
275 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
276 exponent = gmx_simd_exp_d(ewcljrsq);
277 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
278 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
279 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
280 vvdw6 = _fjsp_mul_v2r8(_fjsp_madd_v2r8(c6grid_00,_fjsp_sub_v2r8(poly,one),c6_00),rinvsix);
281 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
282 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
283 _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw6,_fjsp_madd_v2r8(c6grid_00,sh_lj_ewald,_fjsp_mul_v2r8(c6_00,sh_vdw_invrcut6))),one_sixth));
284 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
285 fvdw = _fjsp_mul_v2r8(_fjsp_add_v2r8(vvdw12,_fjsp_msub_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6),vvdw6)),rinvsq00);
287 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
289 /* Update potential sum for this i atom from the interaction with this j atom. */
290 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
291 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
295 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
297 /* Update vectorial force */
298 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
299 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
300 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
302 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
303 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
304 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
308 /**************************
309 * CALCULATE INTERACTIONS *
310 **************************/
312 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
315 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
317 /* Compute parameters for interactions between i and j atoms */
318 qq10 = _fjsp_mul_v2r8(iq1,jq0);
320 /* EWALD ELECTROSTATICS */
322 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
323 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
324 itab_tmp = _fjsp_dtox_v2r8(ewrt);
325 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
326 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
328 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
329 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
330 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
331 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
332 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
333 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
334 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
335 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
336 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
337 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
339 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
341 /* Update potential sum for this i atom from the interaction with this j atom. */
342 velec = _fjsp_and_v2r8(velec,cutoff_mask);
343 velecsum = _fjsp_add_v2r8(velecsum,velec);
347 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
349 /* Update vectorial force */
350 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
351 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
352 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
354 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
355 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
356 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
360 /**************************
361 * CALCULATE INTERACTIONS *
362 **************************/
364 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
367 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
369 /* Compute parameters for interactions between i and j atoms */
370 qq20 = _fjsp_mul_v2r8(iq2,jq0);
372 /* EWALD ELECTROSTATICS */
374 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
375 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
376 itab_tmp = _fjsp_dtox_v2r8(ewrt);
377 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
378 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
380 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
381 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
382 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
383 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
384 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
385 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
386 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
387 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
388 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
389 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
391 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
393 /* Update potential sum for this i atom from the interaction with this j atom. */
394 velec = _fjsp_and_v2r8(velec,cutoff_mask);
395 velecsum = _fjsp_add_v2r8(velecsum,velec);
399 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
401 /* Update vectorial force */
402 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
403 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
404 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
406 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
407 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
408 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
412 /**************************
413 * CALCULATE INTERACTIONS *
414 **************************/
416 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
419 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
421 /* Compute parameters for interactions between i and j atoms */
422 qq30 = _fjsp_mul_v2r8(iq3,jq0);
424 /* EWALD ELECTROSTATICS */
426 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
427 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
428 itab_tmp = _fjsp_dtox_v2r8(ewrt);
429 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
430 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
432 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
433 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
434 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
435 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
436 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
437 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
438 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
439 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
440 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
441 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
443 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
445 /* Update potential sum for this i atom from the interaction with this j atom. */
446 velec = _fjsp_and_v2r8(velec,cutoff_mask);
447 velecsum = _fjsp_add_v2r8(velecsum,velec);
451 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
453 /* Update vectorial force */
454 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
455 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
456 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
458 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
459 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
460 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
464 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
466 /* Inner loop uses 209 flops */
473 j_coord_offsetA = DIM*jnrA;
475 /* load j atom coordinates */
476 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
479 /* Calculate displacement vector */
480 dx00 = _fjsp_sub_v2r8(ix0,jx0);
481 dy00 = _fjsp_sub_v2r8(iy0,jy0);
482 dz00 = _fjsp_sub_v2r8(iz0,jz0);
483 dx10 = _fjsp_sub_v2r8(ix1,jx0);
484 dy10 = _fjsp_sub_v2r8(iy1,jy0);
485 dz10 = _fjsp_sub_v2r8(iz1,jz0);
486 dx20 = _fjsp_sub_v2r8(ix2,jx0);
487 dy20 = _fjsp_sub_v2r8(iy2,jy0);
488 dz20 = _fjsp_sub_v2r8(iz2,jz0);
489 dx30 = _fjsp_sub_v2r8(ix3,jx0);
490 dy30 = _fjsp_sub_v2r8(iy3,jy0);
491 dz30 = _fjsp_sub_v2r8(iz3,jz0);
493 /* Calculate squared distance and things based on it */
494 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
495 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
496 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
497 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
499 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
500 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
501 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
502 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
504 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
505 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
506 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
507 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
509 /* Load parameters for j particles */
510 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
511 vdwjidx0A = 2*vdwtype[jnrA+0];
513 fjx0 = _fjsp_setzero_v2r8();
514 fjy0 = _fjsp_setzero_v2r8();
515 fjz0 = _fjsp_setzero_v2r8();
517 /**************************
518 * CALCULATE INTERACTIONS *
519 **************************/
521 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
524 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
526 /* Compute parameters for interactions between i and j atoms */
527 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
528 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
530 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
531 vdwgridparam+vdwioffset0+vdwjidx0B);
533 /* Analytical LJ-PME */
534 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
535 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
536 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
537 exponent = gmx_simd_exp_d(ewcljrsq);
538 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
539 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
540 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
541 vvdw6 = _fjsp_mul_v2r8(_fjsp_madd_v2r8(c6grid_00,_fjsp_sub_v2r8(poly,one),c6_00),rinvsix);
542 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
543 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
544 _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw6,_fjsp_madd_v2r8(c6grid_00,sh_lj_ewald,_fjsp_mul_v2r8(c6_00,sh_vdw_invrcut6))),one_sixth));
545 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
546 fvdw = _fjsp_mul_v2r8(_fjsp_add_v2r8(vvdw12,_fjsp_msub_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6),vvdw6)),rinvsq00);
548 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
550 /* Update potential sum for this i atom from the interaction with this j atom. */
551 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
552 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
553 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
557 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
559 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
561 /* Update vectorial force */
562 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
563 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
564 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
566 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
567 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
568 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
572 /**************************
573 * CALCULATE INTERACTIONS *
574 **************************/
576 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
579 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
581 /* Compute parameters for interactions between i and j atoms */
582 qq10 = _fjsp_mul_v2r8(iq1,jq0);
584 /* EWALD ELECTROSTATICS */
586 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
587 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
588 itab_tmp = _fjsp_dtox_v2r8(ewrt);
589 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
590 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
592 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
593 ewtabD = _fjsp_setzero_v2r8();
594 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
595 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
596 ewtabFn = _fjsp_setzero_v2r8();
597 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
598 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
599 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
600 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
601 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
603 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
605 /* Update potential sum for this i atom from the interaction with this j atom. */
606 velec = _fjsp_and_v2r8(velec,cutoff_mask);
607 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
608 velecsum = _fjsp_add_v2r8(velecsum,velec);
612 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
614 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
616 /* Update vectorial force */
617 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
618 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
619 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
621 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
622 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
623 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
627 /**************************
628 * CALCULATE INTERACTIONS *
629 **************************/
631 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
634 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
636 /* Compute parameters for interactions between i and j atoms */
637 qq20 = _fjsp_mul_v2r8(iq2,jq0);
639 /* EWALD ELECTROSTATICS */
641 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
642 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
643 itab_tmp = _fjsp_dtox_v2r8(ewrt);
644 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
645 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
647 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
648 ewtabD = _fjsp_setzero_v2r8();
649 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
650 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
651 ewtabFn = _fjsp_setzero_v2r8();
652 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
653 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
654 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
655 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
656 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
658 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
660 /* Update potential sum for this i atom from the interaction with this j atom. */
661 velec = _fjsp_and_v2r8(velec,cutoff_mask);
662 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
663 velecsum = _fjsp_add_v2r8(velecsum,velec);
667 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
669 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
671 /* Update vectorial force */
672 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
673 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
674 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
676 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
677 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
678 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
682 /**************************
683 * CALCULATE INTERACTIONS *
684 **************************/
686 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
689 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
691 /* Compute parameters for interactions between i and j atoms */
692 qq30 = _fjsp_mul_v2r8(iq3,jq0);
694 /* EWALD ELECTROSTATICS */
696 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
697 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
698 itab_tmp = _fjsp_dtox_v2r8(ewrt);
699 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
700 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
702 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
703 ewtabD = _fjsp_setzero_v2r8();
704 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
705 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
706 ewtabFn = _fjsp_setzero_v2r8();
707 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
708 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
709 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
710 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
711 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
713 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
715 /* Update potential sum for this i atom from the interaction with this j atom. */
716 velec = _fjsp_and_v2r8(velec,cutoff_mask);
717 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
718 velecsum = _fjsp_add_v2r8(velecsum,velec);
722 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
724 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
726 /* Update vectorial force */
727 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
728 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
729 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
731 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
732 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
733 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
737 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
739 /* Inner loop uses 209 flops */
742 /* End of innermost loop */
744 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
745 f+i_coord_offset,fshift+i_shift_offset);
748 /* Update potential energies */
749 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
750 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
752 /* Increment number of inner iterations */
753 inneriter += j_index_end - j_index_start;
755 /* Outer loop uses 26 flops */
758 /* Increment number of outer iterations */
761 /* Update outer/inner flops */
763 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*209);
766 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
767 * Electrostatics interaction: Ewald
768 * VdW interaction: LJEwald
769 * Geometry: Water4-Particle
770 * Calculate force/pot: Force
773 nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
774 (t_nblist * gmx_restrict nlist,
775 rvec * gmx_restrict xx,
776 rvec * gmx_restrict ff,
777 t_forcerec * gmx_restrict fr,
778 t_mdatoms * gmx_restrict mdatoms,
779 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
780 t_nrnb * gmx_restrict nrnb)
782 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
783 * just 0 for non-waters.
784 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
785 * jnr indices corresponding to data put in the four positions in the SIMD register.
787 int i_shift_offset,i_coord_offset,outeriter,inneriter;
788 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
790 int j_coord_offsetA,j_coord_offsetB;
791 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
793 real *shiftvec,*fshift,*x,*f;
794 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
796 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
798 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
800 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
802 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
803 int vdwjidx0A,vdwjidx0B;
804 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
805 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
806 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
807 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
808 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
809 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
812 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
815 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
816 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
817 _fjsp_v2r8 c6grid_00;
818 _fjsp_v2r8 c6grid_10;
819 _fjsp_v2r8 c6grid_20;
820 _fjsp_v2r8 c6grid_30;
822 _fjsp_v2r8 ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,f6A,f6B,sh_lj_ewald;
823 _fjsp_v2r8 one_half = gmx_fjsp_set1_v2r8(0.5);
824 _fjsp_v2r8 minus_one = gmx_fjsp_set1_v2r8(-1.0);
825 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
828 _fjsp_v2r8 dummy_mask,cutoff_mask;
829 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
830 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
831 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
838 jindex = nlist->jindex;
840 shiftidx = nlist->shift;
842 shiftvec = fr->shift_vec[0];
843 fshift = fr->fshift[0];
844 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
845 charge = mdatoms->chargeA;
846 nvdwtype = fr->ntype;
848 vdwtype = mdatoms->typeA;
849 vdwgridparam = fr->ljpme_c6grid;
850 sh_lj_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_lj_ewald);
851 ewclj = gmx_fjsp_set1_v2r8(fr->ewaldcoeff_lj);
852 ewclj2 = _fjsp_mul_v2r8(minus_one,_fjsp_mul_v2r8(ewclj,ewclj));
854 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
855 ewtab = fr->ic->tabq_coul_F;
856 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
857 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
859 /* Setup water-specific parameters */
860 inr = nlist->iinr[0];
861 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
862 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
863 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
864 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
866 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
867 rcutoff_scalar = fr->rcoulomb;
868 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
869 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
871 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
872 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
874 /* Avoid stupid compiler warnings */
882 /* Start outer loop over neighborlists */
883 for(iidx=0; iidx<nri; iidx++)
885 /* Load shift vector for this list */
886 i_shift_offset = DIM*shiftidx[iidx];
888 /* Load limits for loop over neighbors */
889 j_index_start = jindex[iidx];
890 j_index_end = jindex[iidx+1];
892 /* Get outer coordinate index */
894 i_coord_offset = DIM*inr;
896 /* Load i particle coords and add shift vector */
897 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
898 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
900 fix0 = _fjsp_setzero_v2r8();
901 fiy0 = _fjsp_setzero_v2r8();
902 fiz0 = _fjsp_setzero_v2r8();
903 fix1 = _fjsp_setzero_v2r8();
904 fiy1 = _fjsp_setzero_v2r8();
905 fiz1 = _fjsp_setzero_v2r8();
906 fix2 = _fjsp_setzero_v2r8();
907 fiy2 = _fjsp_setzero_v2r8();
908 fiz2 = _fjsp_setzero_v2r8();
909 fix3 = _fjsp_setzero_v2r8();
910 fiy3 = _fjsp_setzero_v2r8();
911 fiz3 = _fjsp_setzero_v2r8();
913 /* Start inner kernel loop */
914 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
917 /* Get j neighbor index, and coordinate index */
920 j_coord_offsetA = DIM*jnrA;
921 j_coord_offsetB = DIM*jnrB;
923 /* load j atom coordinates */
924 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
927 /* Calculate displacement vector */
928 dx00 = _fjsp_sub_v2r8(ix0,jx0);
929 dy00 = _fjsp_sub_v2r8(iy0,jy0);
930 dz00 = _fjsp_sub_v2r8(iz0,jz0);
931 dx10 = _fjsp_sub_v2r8(ix1,jx0);
932 dy10 = _fjsp_sub_v2r8(iy1,jy0);
933 dz10 = _fjsp_sub_v2r8(iz1,jz0);
934 dx20 = _fjsp_sub_v2r8(ix2,jx0);
935 dy20 = _fjsp_sub_v2r8(iy2,jy0);
936 dz20 = _fjsp_sub_v2r8(iz2,jz0);
937 dx30 = _fjsp_sub_v2r8(ix3,jx0);
938 dy30 = _fjsp_sub_v2r8(iy3,jy0);
939 dz30 = _fjsp_sub_v2r8(iz3,jz0);
941 /* Calculate squared distance and things based on it */
942 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
943 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
944 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
945 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
947 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
948 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
949 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
950 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
952 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
953 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
954 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
955 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
957 /* Load parameters for j particles */
958 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
959 vdwjidx0A = 2*vdwtype[jnrA+0];
960 vdwjidx0B = 2*vdwtype[jnrB+0];
962 fjx0 = _fjsp_setzero_v2r8();
963 fjy0 = _fjsp_setzero_v2r8();
964 fjz0 = _fjsp_setzero_v2r8();
966 /**************************
967 * CALCULATE INTERACTIONS *
968 **************************/
970 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
973 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
975 /* Compute parameters for interactions between i and j atoms */
976 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
977 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
979 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
980 vdwgridparam+vdwioffset0+vdwjidx0B);
982 /* Analytical LJ-PME */
983 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
984 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
985 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
986 exponent = gmx_simd_exp_d(ewcljrsq);
987 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
988 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
989 /* f6A = 6 * C6grid * (1 - poly) */
990 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_sub_v2r8(one,poly));
991 /* f6B = C6grid * exponent * beta^6 */
992 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
993 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
994 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
996 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1000 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1002 /* Update vectorial force */
1003 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1004 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1005 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1007 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1008 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1009 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1013 /**************************
1014 * CALCULATE INTERACTIONS *
1015 **************************/
1017 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1020 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1022 /* Compute parameters for interactions between i and j atoms */
1023 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1025 /* EWALD ELECTROSTATICS */
1027 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1028 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1029 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1030 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1031 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1033 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1035 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1036 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1038 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1042 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1044 /* Update vectorial force */
1045 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1046 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1047 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1049 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1050 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1051 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1055 /**************************
1056 * CALCULATE INTERACTIONS *
1057 **************************/
1059 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1062 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1064 /* Compute parameters for interactions between i and j atoms */
1065 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1067 /* EWALD ELECTROSTATICS */
1069 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1070 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1071 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1072 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1073 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1075 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1077 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1078 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1080 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1084 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1086 /* Update vectorial force */
1087 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1088 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1089 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1091 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1092 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1093 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1097 /**************************
1098 * CALCULATE INTERACTIONS *
1099 **************************/
1101 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1104 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1106 /* Compute parameters for interactions between i and j atoms */
1107 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1109 /* EWALD ELECTROSTATICS */
1111 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1112 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1113 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1114 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1115 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1117 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1119 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1120 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1122 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1126 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1128 /* Update vectorial force */
1129 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1130 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1131 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1133 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1134 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1135 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1139 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1141 /* Inner loop uses 180 flops */
1144 if(jidx<j_index_end)
1148 j_coord_offsetA = DIM*jnrA;
1150 /* load j atom coordinates */
1151 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1154 /* Calculate displacement vector */
1155 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1156 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1157 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1158 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1159 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1160 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1161 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1162 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1163 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1164 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1165 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1166 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1168 /* Calculate squared distance and things based on it */
1169 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1170 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1171 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1172 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1174 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1175 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1176 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1177 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1179 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1180 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1181 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1182 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1184 /* Load parameters for j particles */
1185 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1186 vdwjidx0A = 2*vdwtype[jnrA+0];
1188 fjx0 = _fjsp_setzero_v2r8();
1189 fjy0 = _fjsp_setzero_v2r8();
1190 fjz0 = _fjsp_setzero_v2r8();
1192 /**************************
1193 * CALCULATE INTERACTIONS *
1194 **************************/
1196 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1199 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1201 /* Compute parameters for interactions between i and j atoms */
1202 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1203 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1205 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
1206 vdwgridparam+vdwioffset0+vdwjidx0B);
1208 /* Analytical LJ-PME */
1209 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1210 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
1211 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
1212 exponent = gmx_simd_exp_d(ewcljrsq);
1213 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
1214 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
1215 /* f6A = 6 * C6grid * (1 - poly) */
1216 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_sub_v2r8(one,poly));
1217 /* f6B = C6grid * exponent * beta^6 */
1218 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
1219 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
1220 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
1222 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1226 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1228 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1230 /* Update vectorial force */
1231 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1232 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1233 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1235 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1236 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1237 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1241 /**************************
1242 * CALCULATE INTERACTIONS *
1243 **************************/
1245 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1248 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1250 /* Compute parameters for interactions between i and j atoms */
1251 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1253 /* EWALD ELECTROSTATICS */
1255 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1256 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1257 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1258 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1259 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1261 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1262 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1263 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1265 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1269 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1271 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1273 /* Update vectorial force */
1274 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1275 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1276 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1278 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1279 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1280 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1284 /**************************
1285 * CALCULATE INTERACTIONS *
1286 **************************/
1288 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1291 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1293 /* Compute parameters for interactions between i and j atoms */
1294 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1296 /* EWALD ELECTROSTATICS */
1298 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1299 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1300 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1301 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1302 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1304 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1305 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1306 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1308 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1312 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1314 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1316 /* Update vectorial force */
1317 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1318 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1319 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1321 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1322 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1323 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1327 /**************************
1328 * CALCULATE INTERACTIONS *
1329 **************************/
1331 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1334 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1336 /* Compute parameters for interactions between i and j atoms */
1337 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1339 /* EWALD ELECTROSTATICS */
1341 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1342 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1343 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1344 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1345 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1347 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1348 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1349 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1351 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1355 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1357 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1359 /* Update vectorial force */
1360 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1361 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1362 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1364 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1365 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1366 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1370 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1372 /* Inner loop uses 180 flops */
1375 /* End of innermost loop */
1377 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1378 f+i_coord_offset,fshift+i_shift_offset);
1380 /* Increment number of inner iterations */
1381 inneriter += j_index_end - j_index_start;
1383 /* Outer loop uses 24 flops */
1386 /* Increment number of outer iterations */
1389 /* Update outer/inner flops */
1391 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);