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.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: LJEwald
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 c6grid_00;
102 _fjsp_v2r8 c6grid_10;
103 _fjsp_v2r8 c6grid_20;
104 _fjsp_v2r8 c6grid_30;
106 _fjsp_v2r8 ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,f6A,f6B,sh_lj_ewald;
107 _fjsp_v2r8 one_half = gmx_fjsp_set1_v2r8(0.5);
108 _fjsp_v2r8 minus_one = gmx_fjsp_set1_v2r8(-1.0);
109 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
112 _fjsp_v2r8 dummy_mask,cutoff_mask;
113 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
114 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
115 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
122 jindex = nlist->jindex;
124 shiftidx = nlist->shift;
126 shiftvec = fr->shift_vec[0];
127 fshift = fr->fshift[0];
128 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
129 charge = mdatoms->chargeA;
130 nvdwtype = fr->ntype;
132 vdwtype = mdatoms->typeA;
133 vdwgridparam = fr->ljpme_c6grid;
134 sh_lj_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_lj_ewald);
135 ewclj = gmx_fjsp_set1_v2r8(fr->ewaldcoeff_lj);
136 ewclj2 = _fjsp_mul_v2r8(minus_one,_fjsp_mul_v2r8(ewclj,ewclj));
138 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
139 ewtab = fr->ic->tabq_coul_FDV0;
140 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
141 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
143 /* Setup water-specific parameters */
144 inr = nlist->iinr[0];
145 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
146 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
147 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
148 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
150 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
151 rcutoff_scalar = fr->rcoulomb;
152 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
153 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
155 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
156 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
158 /* Avoid stupid compiler warnings */
166 /* Start outer loop over neighborlists */
167 for(iidx=0; iidx<nri; iidx++)
169 /* Load shift vector for this list */
170 i_shift_offset = DIM*shiftidx[iidx];
172 /* Load limits for loop over neighbors */
173 j_index_start = jindex[iidx];
174 j_index_end = jindex[iidx+1];
176 /* Get outer coordinate index */
178 i_coord_offset = DIM*inr;
180 /* Load i particle coords and add shift vector */
181 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
182 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
184 fix0 = _fjsp_setzero_v2r8();
185 fiy0 = _fjsp_setzero_v2r8();
186 fiz0 = _fjsp_setzero_v2r8();
187 fix1 = _fjsp_setzero_v2r8();
188 fiy1 = _fjsp_setzero_v2r8();
189 fiz1 = _fjsp_setzero_v2r8();
190 fix2 = _fjsp_setzero_v2r8();
191 fiy2 = _fjsp_setzero_v2r8();
192 fiz2 = _fjsp_setzero_v2r8();
193 fix3 = _fjsp_setzero_v2r8();
194 fiy3 = _fjsp_setzero_v2r8();
195 fiz3 = _fjsp_setzero_v2r8();
197 /* Reset potential sums */
198 velecsum = _fjsp_setzero_v2r8();
199 vvdwsum = _fjsp_setzero_v2r8();
201 /* Start inner kernel loop */
202 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
205 /* Get j neighbor index, and coordinate index */
208 j_coord_offsetA = DIM*jnrA;
209 j_coord_offsetB = DIM*jnrB;
211 /* load j atom coordinates */
212 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
215 /* Calculate displacement vector */
216 dx00 = _fjsp_sub_v2r8(ix0,jx0);
217 dy00 = _fjsp_sub_v2r8(iy0,jy0);
218 dz00 = _fjsp_sub_v2r8(iz0,jz0);
219 dx10 = _fjsp_sub_v2r8(ix1,jx0);
220 dy10 = _fjsp_sub_v2r8(iy1,jy0);
221 dz10 = _fjsp_sub_v2r8(iz1,jz0);
222 dx20 = _fjsp_sub_v2r8(ix2,jx0);
223 dy20 = _fjsp_sub_v2r8(iy2,jy0);
224 dz20 = _fjsp_sub_v2r8(iz2,jz0);
225 dx30 = _fjsp_sub_v2r8(ix3,jx0);
226 dy30 = _fjsp_sub_v2r8(iy3,jy0);
227 dz30 = _fjsp_sub_v2r8(iz3,jz0);
229 /* Calculate squared distance and things based on it */
230 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
231 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
232 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
233 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
235 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
236 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
237 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
238 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
240 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
241 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
242 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
243 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
245 /* Load parameters for j particles */
246 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
247 vdwjidx0A = 2*vdwtype[jnrA+0];
248 vdwjidx0B = 2*vdwtype[jnrB+0];
250 fjx0 = _fjsp_setzero_v2r8();
251 fjy0 = _fjsp_setzero_v2r8();
252 fjz0 = _fjsp_setzero_v2r8();
254 /**************************
255 * CALCULATE INTERACTIONS *
256 **************************/
258 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
261 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
263 /* Compute parameters for interactions between i and j atoms */
264 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
265 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
267 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
268 vdwgridparam+vdwioffset0+vdwjidx0B);
270 /* Analytical LJ-PME */
271 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
272 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
273 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
274 exponent = gmx_simd_exp_d(-ewcljrsq);
275 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
276 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
277 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
278 vvdw6 = _fjsp_mul_v2r8(_fjsp_madd_v2r8(-c6grid_00,_fjsp_sub_v2r8(one,poly),c6_00),rinvsix);
279 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
280 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
281 _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));
282 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
283 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);
285 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
287 /* Update potential sum for this i atom from the interaction with this j atom. */
288 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
289 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
293 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
295 /* Update vectorial force */
296 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
297 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
298 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
300 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
301 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
302 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
313 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
315 /* Compute parameters for interactions between i and j atoms */
316 qq10 = _fjsp_mul_v2r8(iq1,jq0);
318 /* EWALD ELECTROSTATICS */
320 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
321 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
322 itab_tmp = _fjsp_dtox_v2r8(ewrt);
323 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
324 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
326 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
327 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
328 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
329 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
330 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
331 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
332 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
333 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
334 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
335 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
337 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
339 /* Update potential sum for this i atom from the interaction with this j atom. */
340 velec = _fjsp_and_v2r8(velec,cutoff_mask);
341 velecsum = _fjsp_add_v2r8(velecsum,velec);
345 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
347 /* Update vectorial force */
348 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
349 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
350 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
352 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
353 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
354 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
358 /**************************
359 * CALCULATE INTERACTIONS *
360 **************************/
362 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
365 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
367 /* Compute parameters for interactions between i and j atoms */
368 qq20 = _fjsp_mul_v2r8(iq2,jq0);
370 /* EWALD ELECTROSTATICS */
372 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
373 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
374 itab_tmp = _fjsp_dtox_v2r8(ewrt);
375 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
376 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
378 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
379 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
380 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
381 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
382 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
383 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
384 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
385 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
386 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
387 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
389 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
391 /* Update potential sum for this i atom from the interaction with this j atom. */
392 velec = _fjsp_and_v2r8(velec,cutoff_mask);
393 velecsum = _fjsp_add_v2r8(velecsum,velec);
397 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
399 /* Update vectorial force */
400 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
401 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
402 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
404 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
405 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
406 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
410 /**************************
411 * CALCULATE INTERACTIONS *
412 **************************/
414 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
417 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
419 /* Compute parameters for interactions between i and j atoms */
420 qq30 = _fjsp_mul_v2r8(iq3,jq0);
422 /* EWALD ELECTROSTATICS */
424 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
425 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
426 itab_tmp = _fjsp_dtox_v2r8(ewrt);
427 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
428 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
430 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
431 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
432 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
433 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
434 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
435 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
436 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
437 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
438 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
439 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
441 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
443 /* Update potential sum for this i atom from the interaction with this j atom. */
444 velec = _fjsp_and_v2r8(velec,cutoff_mask);
445 velecsum = _fjsp_add_v2r8(velecsum,velec);
449 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
451 /* Update vectorial force */
452 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
453 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
454 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
456 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
457 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
458 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
462 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
464 /* Inner loop uses 209 flops */
471 j_coord_offsetA = DIM*jnrA;
473 /* load j atom coordinates */
474 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
477 /* Calculate displacement vector */
478 dx00 = _fjsp_sub_v2r8(ix0,jx0);
479 dy00 = _fjsp_sub_v2r8(iy0,jy0);
480 dz00 = _fjsp_sub_v2r8(iz0,jz0);
481 dx10 = _fjsp_sub_v2r8(ix1,jx0);
482 dy10 = _fjsp_sub_v2r8(iy1,jy0);
483 dz10 = _fjsp_sub_v2r8(iz1,jz0);
484 dx20 = _fjsp_sub_v2r8(ix2,jx0);
485 dy20 = _fjsp_sub_v2r8(iy2,jy0);
486 dz20 = _fjsp_sub_v2r8(iz2,jz0);
487 dx30 = _fjsp_sub_v2r8(ix3,jx0);
488 dy30 = _fjsp_sub_v2r8(iy3,jy0);
489 dz30 = _fjsp_sub_v2r8(iz3,jz0);
491 /* Calculate squared distance and things based on it */
492 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
493 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
494 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
495 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
497 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
498 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
499 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
500 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
502 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
503 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
504 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
505 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
507 /* Load parameters for j particles */
508 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
509 vdwjidx0A = 2*vdwtype[jnrA+0];
511 fjx0 = _fjsp_setzero_v2r8();
512 fjy0 = _fjsp_setzero_v2r8();
513 fjz0 = _fjsp_setzero_v2r8();
515 /**************************
516 * CALCULATE INTERACTIONS *
517 **************************/
519 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
522 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
524 /* Compute parameters for interactions between i and j atoms */
525 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
527 c6grid_00 = gmx_fjsp_load_1real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A);
529 /* Analytical LJ-PME */
530 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
531 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
532 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
533 exponent = gmx_simd_exp_d(-ewcljrsq);
534 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
535 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
536 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
537 vvdw6 = _fjsp_mul_v2r8(_fjsp_madd_v2r8(-c6grid_00,_fjsp_sub_v2r8(one,poly),c6_00),rinvsix);
538 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
539 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
540 _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));
541 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
542 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);
544 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
546 /* Update potential sum for this i atom from the interaction with this j atom. */
547 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
548 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
549 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
553 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
555 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
557 /* Update vectorial force */
558 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
559 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
560 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
562 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
563 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
564 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
568 /**************************
569 * CALCULATE INTERACTIONS *
570 **************************/
572 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
575 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
577 /* Compute parameters for interactions between i and j atoms */
578 qq10 = _fjsp_mul_v2r8(iq1,jq0);
580 /* EWALD ELECTROSTATICS */
582 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
583 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
584 itab_tmp = _fjsp_dtox_v2r8(ewrt);
585 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
586 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
588 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
589 ewtabD = _fjsp_setzero_v2r8();
590 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
591 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
592 ewtabFn = _fjsp_setzero_v2r8();
593 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
594 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
595 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
596 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
597 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
599 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
601 /* Update potential sum for this i atom from the interaction with this j atom. */
602 velec = _fjsp_and_v2r8(velec,cutoff_mask);
603 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
604 velecsum = _fjsp_add_v2r8(velecsum,velec);
608 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
610 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
612 /* Update vectorial force */
613 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
614 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
615 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
617 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
618 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
619 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
623 /**************************
624 * CALCULATE INTERACTIONS *
625 **************************/
627 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
630 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
632 /* Compute parameters for interactions between i and j atoms */
633 qq20 = _fjsp_mul_v2r8(iq2,jq0);
635 /* EWALD ELECTROSTATICS */
637 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
638 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
639 itab_tmp = _fjsp_dtox_v2r8(ewrt);
640 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
641 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
643 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
644 ewtabD = _fjsp_setzero_v2r8();
645 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
646 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
647 ewtabFn = _fjsp_setzero_v2r8();
648 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
649 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
650 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
651 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
652 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
654 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
656 /* Update potential sum for this i atom from the interaction with this j atom. */
657 velec = _fjsp_and_v2r8(velec,cutoff_mask);
658 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
659 velecsum = _fjsp_add_v2r8(velecsum,velec);
663 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
665 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
667 /* Update vectorial force */
668 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
669 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
670 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
672 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
673 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
674 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
678 /**************************
679 * CALCULATE INTERACTIONS *
680 **************************/
682 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
685 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
687 /* Compute parameters for interactions between i and j atoms */
688 qq30 = _fjsp_mul_v2r8(iq3,jq0);
690 /* EWALD ELECTROSTATICS */
692 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
693 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
694 itab_tmp = _fjsp_dtox_v2r8(ewrt);
695 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
696 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
698 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
699 ewtabD = _fjsp_setzero_v2r8();
700 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
701 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
702 ewtabFn = _fjsp_setzero_v2r8();
703 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
704 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
705 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
706 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
707 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
709 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
711 /* Update potential sum for this i atom from the interaction with this j atom. */
712 velec = _fjsp_and_v2r8(velec,cutoff_mask);
713 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
714 velecsum = _fjsp_add_v2r8(velecsum,velec);
718 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
720 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
722 /* Update vectorial force */
723 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
724 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
725 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
727 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
728 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
729 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
733 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
735 /* Inner loop uses 209 flops */
738 /* End of innermost loop */
740 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
741 f+i_coord_offset,fshift+i_shift_offset);
744 /* Update potential energies */
745 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
746 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
748 /* Increment number of inner iterations */
749 inneriter += j_index_end - j_index_start;
751 /* Outer loop uses 26 flops */
754 /* Increment number of outer iterations */
757 /* Update outer/inner flops */
759 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*209);
762 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
763 * Electrostatics interaction: Ewald
764 * VdW interaction: LJEwald
765 * Geometry: Water4-Particle
766 * Calculate force/pot: Force
769 nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
770 (t_nblist * gmx_restrict nlist,
771 rvec * gmx_restrict xx,
772 rvec * gmx_restrict ff,
773 t_forcerec * gmx_restrict fr,
774 t_mdatoms * gmx_restrict mdatoms,
775 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
776 t_nrnb * gmx_restrict nrnb)
778 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
779 * just 0 for non-waters.
780 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
781 * jnr indices corresponding to data put in the four positions in the SIMD register.
783 int i_shift_offset,i_coord_offset,outeriter,inneriter;
784 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
786 int j_coord_offsetA,j_coord_offsetB;
787 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
789 real *shiftvec,*fshift,*x,*f;
790 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
792 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
794 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
796 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
798 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
799 int vdwjidx0A,vdwjidx0B;
800 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
801 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
802 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
803 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
804 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
805 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
808 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
811 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
812 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
813 _fjsp_v2r8 c6grid_00;
814 _fjsp_v2r8 c6grid_10;
815 _fjsp_v2r8 c6grid_20;
816 _fjsp_v2r8 c6grid_30;
818 _fjsp_v2r8 ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,f6A,f6B,sh_lj_ewald;
819 _fjsp_v2r8 one_half = gmx_fjsp_set1_v2r8(0.5);
820 _fjsp_v2r8 minus_one = gmx_fjsp_set1_v2r8(-1.0);
821 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
824 _fjsp_v2r8 dummy_mask,cutoff_mask;
825 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
826 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
827 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
834 jindex = nlist->jindex;
836 shiftidx = nlist->shift;
838 shiftvec = fr->shift_vec[0];
839 fshift = fr->fshift[0];
840 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
841 charge = mdatoms->chargeA;
842 nvdwtype = fr->ntype;
844 vdwtype = mdatoms->typeA;
845 vdwgridparam = fr->ljpme_c6grid;
846 sh_lj_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_lj_ewald);
847 ewclj = gmx_fjsp_set1_v2r8(fr->ewaldcoeff_lj);
848 ewclj2 = _fjsp_mul_v2r8(minus_one,_fjsp_mul_v2r8(ewclj,ewclj));
850 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
851 ewtab = fr->ic->tabq_coul_F;
852 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
853 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
855 /* Setup water-specific parameters */
856 inr = nlist->iinr[0];
857 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
858 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
859 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
860 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
862 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
863 rcutoff_scalar = fr->rcoulomb;
864 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
865 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
867 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
868 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
870 /* Avoid stupid compiler warnings */
878 /* Start outer loop over neighborlists */
879 for(iidx=0; iidx<nri; iidx++)
881 /* Load shift vector for this list */
882 i_shift_offset = DIM*shiftidx[iidx];
884 /* Load limits for loop over neighbors */
885 j_index_start = jindex[iidx];
886 j_index_end = jindex[iidx+1];
888 /* Get outer coordinate index */
890 i_coord_offset = DIM*inr;
892 /* Load i particle coords and add shift vector */
893 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
894 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
896 fix0 = _fjsp_setzero_v2r8();
897 fiy0 = _fjsp_setzero_v2r8();
898 fiz0 = _fjsp_setzero_v2r8();
899 fix1 = _fjsp_setzero_v2r8();
900 fiy1 = _fjsp_setzero_v2r8();
901 fiz1 = _fjsp_setzero_v2r8();
902 fix2 = _fjsp_setzero_v2r8();
903 fiy2 = _fjsp_setzero_v2r8();
904 fiz2 = _fjsp_setzero_v2r8();
905 fix3 = _fjsp_setzero_v2r8();
906 fiy3 = _fjsp_setzero_v2r8();
907 fiz3 = _fjsp_setzero_v2r8();
909 /* Start inner kernel loop */
910 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
913 /* Get j neighbor index, and coordinate index */
916 j_coord_offsetA = DIM*jnrA;
917 j_coord_offsetB = DIM*jnrB;
919 /* load j atom coordinates */
920 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
923 /* Calculate displacement vector */
924 dx00 = _fjsp_sub_v2r8(ix0,jx0);
925 dy00 = _fjsp_sub_v2r8(iy0,jy0);
926 dz00 = _fjsp_sub_v2r8(iz0,jz0);
927 dx10 = _fjsp_sub_v2r8(ix1,jx0);
928 dy10 = _fjsp_sub_v2r8(iy1,jy0);
929 dz10 = _fjsp_sub_v2r8(iz1,jz0);
930 dx20 = _fjsp_sub_v2r8(ix2,jx0);
931 dy20 = _fjsp_sub_v2r8(iy2,jy0);
932 dz20 = _fjsp_sub_v2r8(iz2,jz0);
933 dx30 = _fjsp_sub_v2r8(ix3,jx0);
934 dy30 = _fjsp_sub_v2r8(iy3,jy0);
935 dz30 = _fjsp_sub_v2r8(iz3,jz0);
937 /* Calculate squared distance and things based on it */
938 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
939 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
940 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
941 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
943 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
944 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
945 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
946 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
948 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
949 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
950 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
951 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
953 /* Load parameters for j particles */
954 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
955 vdwjidx0A = 2*vdwtype[jnrA+0];
956 vdwjidx0B = 2*vdwtype[jnrB+0];
958 fjx0 = _fjsp_setzero_v2r8();
959 fjy0 = _fjsp_setzero_v2r8();
960 fjz0 = _fjsp_setzero_v2r8();
962 /**************************
963 * CALCULATE INTERACTIONS *
964 **************************/
966 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
969 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
971 /* Compute parameters for interactions between i and j atoms */
972 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
973 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
975 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
976 vdwgridparam+vdwioffset0+vdwjidx0B);
978 /* Analytical LJ-PME */
979 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
980 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
981 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
982 exponent = gmx_simd_exp_d(-ewcljrsq);
983 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
984 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
985 /* f6A = 6 * C6grid * (1 - poly) */
986 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_msub_v2r8(one,poly));
987 /* f6B = C6grid * exponent * beta^6 */
988 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
989 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
990 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
992 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
996 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
998 /* Update vectorial force */
999 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1000 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1001 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1003 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1004 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1005 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1009 /**************************
1010 * CALCULATE INTERACTIONS *
1011 **************************/
1013 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1016 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1018 /* Compute parameters for interactions between i and j atoms */
1019 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1021 /* EWALD ELECTROSTATICS */
1023 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1024 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1025 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1026 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1027 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1029 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1031 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1032 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1034 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1038 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1040 /* Update vectorial force */
1041 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1042 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1043 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1045 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1046 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1047 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1051 /**************************
1052 * CALCULATE INTERACTIONS *
1053 **************************/
1055 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1058 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1060 /* Compute parameters for interactions between i and j atoms */
1061 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1063 /* EWALD ELECTROSTATICS */
1065 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1066 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1067 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1068 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1069 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1071 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1073 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1074 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1076 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1080 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1082 /* Update vectorial force */
1083 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1084 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1085 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1087 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1088 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1089 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1093 /**************************
1094 * CALCULATE INTERACTIONS *
1095 **************************/
1097 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1100 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1102 /* Compute parameters for interactions between i and j atoms */
1103 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1105 /* EWALD ELECTROSTATICS */
1107 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1108 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1109 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1110 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1111 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1113 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1115 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1116 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1118 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1122 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1124 /* Update vectorial force */
1125 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1126 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1127 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1129 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1130 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1131 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1135 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1137 /* Inner loop uses 180 flops */
1140 if(jidx<j_index_end)
1144 j_coord_offsetA = DIM*jnrA;
1146 /* load j atom coordinates */
1147 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1150 /* Calculate displacement vector */
1151 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1152 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1153 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1154 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1155 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1156 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1157 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1158 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1159 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1160 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1161 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1162 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1164 /* Calculate squared distance and things based on it */
1165 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1166 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1167 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1168 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1170 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1171 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1172 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1173 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1175 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1176 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1177 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1178 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1180 /* Load parameters for j particles */
1181 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1182 vdwjidx0A = 2*vdwtype[jnrA+0];
1184 fjx0 = _fjsp_setzero_v2r8();
1185 fjy0 = _fjsp_setzero_v2r8();
1186 fjz0 = _fjsp_setzero_v2r8();
1188 /**************************
1189 * CALCULATE INTERACTIONS *
1190 **************************/
1192 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1195 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1197 /* Compute parameters for interactions between i and j atoms */
1198 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1200 c6grid_00 = gmx_fjsp_load_1real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A);
1202 /* Analytical LJ-PME */
1203 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1204 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
1205 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
1206 exponent = gmx_simd_exp_d(-ewcljrsq);
1207 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
1208 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
1209 /* f6A = 6 * C6grid * (1 - poly) */
1210 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_msub_v2r8(one,poly));
1211 /* f6B = C6grid * exponent * beta^6 */
1212 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
1213 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
1214 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
1216 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1220 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1222 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1224 /* Update vectorial force */
1225 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1226 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1227 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1229 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1230 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1231 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1235 /**************************
1236 * CALCULATE INTERACTIONS *
1237 **************************/
1239 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1242 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1244 /* Compute parameters for interactions between i and j atoms */
1245 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1247 /* EWALD ELECTROSTATICS */
1249 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1250 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1251 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1252 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1253 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1255 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1256 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1257 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1259 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1263 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1265 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1267 /* Update vectorial force */
1268 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1269 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1270 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1272 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1273 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1274 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1278 /**************************
1279 * CALCULATE INTERACTIONS *
1280 **************************/
1282 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1285 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1287 /* Compute parameters for interactions between i and j atoms */
1288 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1290 /* EWALD ELECTROSTATICS */
1292 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1293 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1294 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1295 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1296 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1298 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1299 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1300 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1302 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1306 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1308 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1310 /* Update vectorial force */
1311 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1312 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1313 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1315 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1316 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1317 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1321 /**************************
1322 * CALCULATE INTERACTIONS *
1323 **************************/
1325 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1328 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1330 /* Compute parameters for interactions between i and j atoms */
1331 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1333 /* EWALD ELECTROSTATICS */
1335 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1336 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1337 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1338 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1339 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1341 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1342 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1343 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1345 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1349 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1351 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1353 /* Update vectorial force */
1354 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1355 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1356 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1358 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1359 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1360 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1364 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1366 /* Inner loop uses 180 flops */
1369 /* End of innermost loop */
1371 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1372 f+i_coord_offset,fshift+i_shift_offset);
1374 /* Increment number of inner iterations */
1375 inneriter += j_index_end - j_index_start;
1377 /* Outer loop uses 24 flops */
1380 /* Increment number of outer iterations */
1383 /* Update outer/inner flops */
1385 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);