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(one,poly),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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
529 c6grid_00 = gmx_fjsp_load_1real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A);
531 /* Analytical LJ-PME */
532 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
533 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
534 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
535 exponent = gmx_simd_exp_d(-ewcljrsq);
536 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
537 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
538 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
539 vvdw6 = _fjsp_mul_v2r8(_fjsp_madd_v2r8(-c6grid_00,_fjsp_sub_v2r8(one,poly),c6_00),rinvsix);
540 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
541 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
542 _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));
543 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
544 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);
546 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
548 /* Update potential sum for this i atom from the interaction with this j atom. */
549 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
550 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
551 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
555 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
557 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
559 /* Update vectorial force */
560 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
561 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
562 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
564 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
565 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
566 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
570 /**************************
571 * CALCULATE INTERACTIONS *
572 **************************/
574 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
577 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
579 /* Compute parameters for interactions between i and j atoms */
580 qq10 = _fjsp_mul_v2r8(iq1,jq0);
582 /* EWALD ELECTROSTATICS */
584 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
585 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
586 itab_tmp = _fjsp_dtox_v2r8(ewrt);
587 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
588 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
590 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
591 ewtabD = _fjsp_setzero_v2r8();
592 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
593 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
594 ewtabFn = _fjsp_setzero_v2r8();
595 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
596 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
597 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
598 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
599 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
601 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
603 /* Update potential sum for this i atom from the interaction with this j atom. */
604 velec = _fjsp_and_v2r8(velec,cutoff_mask);
605 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
606 velecsum = _fjsp_add_v2r8(velecsum,velec);
610 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
612 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
614 /* Update vectorial force */
615 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
616 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
617 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
619 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
620 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
621 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
625 /**************************
626 * CALCULATE INTERACTIONS *
627 **************************/
629 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
632 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
634 /* Compute parameters for interactions between i and j atoms */
635 qq20 = _fjsp_mul_v2r8(iq2,jq0);
637 /* EWALD ELECTROSTATICS */
639 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
640 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
641 itab_tmp = _fjsp_dtox_v2r8(ewrt);
642 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
643 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
645 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
646 ewtabD = _fjsp_setzero_v2r8();
647 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
648 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
649 ewtabFn = _fjsp_setzero_v2r8();
650 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
651 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
652 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
653 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
654 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
656 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
658 /* Update potential sum for this i atom from the interaction with this j atom. */
659 velec = _fjsp_and_v2r8(velec,cutoff_mask);
660 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
661 velecsum = _fjsp_add_v2r8(velecsum,velec);
665 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
667 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
669 /* Update vectorial force */
670 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
671 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
672 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
674 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
675 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
676 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
680 /**************************
681 * CALCULATE INTERACTIONS *
682 **************************/
684 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
687 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
689 /* Compute parameters for interactions between i and j atoms */
690 qq30 = _fjsp_mul_v2r8(iq3,jq0);
692 /* EWALD ELECTROSTATICS */
694 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
695 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
696 itab_tmp = _fjsp_dtox_v2r8(ewrt);
697 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
698 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
700 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
701 ewtabD = _fjsp_setzero_v2r8();
702 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
703 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
704 ewtabFn = _fjsp_setzero_v2r8();
705 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
706 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
707 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
708 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
709 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
711 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
713 /* Update potential sum for this i atom from the interaction with this j atom. */
714 velec = _fjsp_and_v2r8(velec,cutoff_mask);
715 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
716 velecsum = _fjsp_add_v2r8(velecsum,velec);
720 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
722 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
724 /* Update vectorial force */
725 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
726 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
727 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
729 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
730 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
731 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
735 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
737 /* Inner loop uses 209 flops */
740 /* End of innermost loop */
742 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
743 f+i_coord_offset,fshift+i_shift_offset);
746 /* Update potential energies */
747 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
748 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
750 /* Increment number of inner iterations */
751 inneriter += j_index_end - j_index_start;
753 /* Outer loop uses 26 flops */
756 /* Increment number of outer iterations */
759 /* Update outer/inner flops */
761 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*209);
764 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
765 * Electrostatics interaction: Ewald
766 * VdW interaction: LJEwald
767 * Geometry: Water4-Particle
768 * Calculate force/pot: Force
771 nb_kernel_ElecEwSh_VdwLJEwSh_GeomW4P1_F_sparc64_hpc_ace_double
772 (t_nblist * gmx_restrict nlist,
773 rvec * gmx_restrict xx,
774 rvec * gmx_restrict ff,
775 t_forcerec * gmx_restrict fr,
776 t_mdatoms * gmx_restrict mdatoms,
777 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
778 t_nrnb * gmx_restrict nrnb)
780 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
781 * just 0 for non-waters.
782 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
783 * jnr indices corresponding to data put in the four positions in the SIMD register.
785 int i_shift_offset,i_coord_offset,outeriter,inneriter;
786 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
788 int j_coord_offsetA,j_coord_offsetB;
789 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
791 real *shiftvec,*fshift,*x,*f;
792 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
794 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
796 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
798 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
800 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
801 int vdwjidx0A,vdwjidx0B;
802 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
803 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
804 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
805 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
806 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
807 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
810 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
813 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
814 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
815 _fjsp_v2r8 c6grid_00;
816 _fjsp_v2r8 c6grid_10;
817 _fjsp_v2r8 c6grid_20;
818 _fjsp_v2r8 c6grid_30;
820 _fjsp_v2r8 ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,f6A,f6B,sh_lj_ewald;
821 _fjsp_v2r8 one_half = gmx_fjsp_set1_v2r8(0.5);
822 _fjsp_v2r8 minus_one = gmx_fjsp_set1_v2r8(-1.0);
823 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
826 _fjsp_v2r8 dummy_mask,cutoff_mask;
827 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
828 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
829 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
836 jindex = nlist->jindex;
838 shiftidx = nlist->shift;
840 shiftvec = fr->shift_vec[0];
841 fshift = fr->fshift[0];
842 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
843 charge = mdatoms->chargeA;
844 nvdwtype = fr->ntype;
846 vdwtype = mdatoms->typeA;
847 vdwgridparam = fr->ljpme_c6grid;
848 sh_lj_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_lj_ewald);
849 ewclj = gmx_fjsp_set1_v2r8(fr->ewaldcoeff_lj);
850 ewclj2 = _fjsp_mul_v2r8(minus_one,_fjsp_mul_v2r8(ewclj,ewclj));
852 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
853 ewtab = fr->ic->tabq_coul_F;
854 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
855 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
857 /* Setup water-specific parameters */
858 inr = nlist->iinr[0];
859 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
860 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
861 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
862 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
864 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
865 rcutoff_scalar = fr->rcoulomb;
866 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
867 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
869 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
870 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
872 /* Avoid stupid compiler warnings */
880 /* Start outer loop over neighborlists */
881 for(iidx=0; iidx<nri; iidx++)
883 /* Load shift vector for this list */
884 i_shift_offset = DIM*shiftidx[iidx];
886 /* Load limits for loop over neighbors */
887 j_index_start = jindex[iidx];
888 j_index_end = jindex[iidx+1];
890 /* Get outer coordinate index */
892 i_coord_offset = DIM*inr;
894 /* Load i particle coords and add shift vector */
895 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
896 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
898 fix0 = _fjsp_setzero_v2r8();
899 fiy0 = _fjsp_setzero_v2r8();
900 fiz0 = _fjsp_setzero_v2r8();
901 fix1 = _fjsp_setzero_v2r8();
902 fiy1 = _fjsp_setzero_v2r8();
903 fiz1 = _fjsp_setzero_v2r8();
904 fix2 = _fjsp_setzero_v2r8();
905 fiy2 = _fjsp_setzero_v2r8();
906 fiz2 = _fjsp_setzero_v2r8();
907 fix3 = _fjsp_setzero_v2r8();
908 fiy3 = _fjsp_setzero_v2r8();
909 fiz3 = _fjsp_setzero_v2r8();
911 /* Start inner kernel loop */
912 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
915 /* Get j neighbor index, and coordinate index */
918 j_coord_offsetA = DIM*jnrA;
919 j_coord_offsetB = DIM*jnrB;
921 /* load j atom coordinates */
922 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
925 /* Calculate displacement vector */
926 dx00 = _fjsp_sub_v2r8(ix0,jx0);
927 dy00 = _fjsp_sub_v2r8(iy0,jy0);
928 dz00 = _fjsp_sub_v2r8(iz0,jz0);
929 dx10 = _fjsp_sub_v2r8(ix1,jx0);
930 dy10 = _fjsp_sub_v2r8(iy1,jy0);
931 dz10 = _fjsp_sub_v2r8(iz1,jz0);
932 dx20 = _fjsp_sub_v2r8(ix2,jx0);
933 dy20 = _fjsp_sub_v2r8(iy2,jy0);
934 dz20 = _fjsp_sub_v2r8(iz2,jz0);
935 dx30 = _fjsp_sub_v2r8(ix3,jx0);
936 dy30 = _fjsp_sub_v2r8(iy3,jy0);
937 dz30 = _fjsp_sub_v2r8(iz3,jz0);
939 /* Calculate squared distance and things based on it */
940 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
941 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
942 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
943 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
945 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
946 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
947 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
948 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
950 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
951 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
952 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
953 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
955 /* Load parameters for j particles */
956 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
957 vdwjidx0A = 2*vdwtype[jnrA+0];
958 vdwjidx0B = 2*vdwtype[jnrB+0];
960 fjx0 = _fjsp_setzero_v2r8();
961 fjy0 = _fjsp_setzero_v2r8();
962 fjz0 = _fjsp_setzero_v2r8();
964 /**************************
965 * CALCULATE INTERACTIONS *
966 **************************/
968 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
971 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
973 /* Compute parameters for interactions between i and j atoms */
974 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
975 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
977 c6grid_00 = gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A,
978 vdwgridparam+vdwioffset0+vdwjidx0B);
980 /* Analytical LJ-PME */
981 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
982 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
983 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
984 exponent = gmx_simd_exp_d(-ewcljrsq);
985 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
986 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
987 /* f6A = 6 * C6grid * (1 - poly) */
988 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_msub_v2r8(one,poly));
989 /* f6B = C6grid * exponent * beta^6 */
990 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
991 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
992 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
994 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
998 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1000 /* Update vectorial force */
1001 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1002 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1003 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1005 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1006 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1007 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1011 /**************************
1012 * CALCULATE INTERACTIONS *
1013 **************************/
1015 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1018 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1020 /* Compute parameters for interactions between i and j atoms */
1021 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1023 /* EWALD ELECTROSTATICS */
1025 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1026 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1027 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1028 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1029 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1031 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1033 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1034 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1036 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1040 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1042 /* Update vectorial force */
1043 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1044 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1045 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1047 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1048 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1049 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1053 /**************************
1054 * CALCULATE INTERACTIONS *
1055 **************************/
1057 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1060 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1062 /* Compute parameters for interactions between i and j atoms */
1063 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1065 /* EWALD ELECTROSTATICS */
1067 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1068 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1069 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1070 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1071 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1073 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1075 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1076 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1078 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1082 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1084 /* Update vectorial force */
1085 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1086 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1087 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1089 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1090 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1091 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1095 /**************************
1096 * CALCULATE INTERACTIONS *
1097 **************************/
1099 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1102 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1104 /* Compute parameters for interactions between i and j atoms */
1105 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1107 /* EWALD ELECTROSTATICS */
1109 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1110 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1111 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1112 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1113 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1115 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1117 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1118 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1120 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1124 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1126 /* Update vectorial force */
1127 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1128 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1129 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1131 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1132 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1133 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1137 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1139 /* Inner loop uses 180 flops */
1142 if(jidx<j_index_end)
1146 j_coord_offsetA = DIM*jnrA;
1148 /* load j atom coordinates */
1149 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1152 /* Calculate displacement vector */
1153 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1154 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1155 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1156 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1157 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1158 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1159 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1160 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1161 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1162 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1163 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1164 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1166 /* Calculate squared distance and things based on it */
1167 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1168 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1169 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1170 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1172 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1173 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1174 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1175 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1177 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1178 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1179 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1180 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1182 /* Load parameters for j particles */
1183 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1184 vdwjidx0A = 2*vdwtype[jnrA+0];
1186 fjx0 = _fjsp_setzero_v2r8();
1187 fjy0 = _fjsp_setzero_v2r8();
1188 fjz0 = _fjsp_setzero_v2r8();
1190 /**************************
1191 * CALCULATE INTERACTIONS *
1192 **************************/
1194 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1197 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1199 /* Compute parameters for interactions between i and j atoms */
1200 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1202 c6grid_00 = gmx_fjsp_load_1real_swizzle_v2r8(vdwgridparam+vdwioffset0+vdwjidx0A);
1204 /* Analytical LJ-PME */
1205 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1206 ewcljrsq = _fjsp_mul_v2r8(ewclj2,rsq00);
1207 ewclj6 = _fjsp_mul_v2r8(ewclj2,_fjsp_mul_v2r8(ewclj2,ewclj2));
1208 exponent = gmx_simd_exp_d(-ewcljrsq);
1209 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
1210 poly = _fjsp_mul_v2r8(exponent,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq,ewcljrsq),one_half,_fjsp_sub_v2r8(one,ewcljrsq)));
1211 /* f6A = 6 * C6grid * (1 - poly) */
1212 f6A = _fjsp_mul_v2r8(c6grid_00,_fjsp_msub_v2r8(one,poly));
1213 /* f6B = C6grid * exponent * beta^6 */
1214 f6B = _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00,one_sixth),_fjsp_mul_v2r8(exponent,ewclj6));
1215 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
1216 fvdw = _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,_fjsp_sub_v2r8(c6_00,f6A)),rinvsix,f6B),rinvsq00);
1218 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1222 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1224 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1226 /* Update vectorial force */
1227 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1228 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1229 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1231 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1232 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1233 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1237 /**************************
1238 * CALCULATE INTERACTIONS *
1239 **************************/
1241 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1244 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1246 /* Compute parameters for interactions between i and j atoms */
1247 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1249 /* EWALD ELECTROSTATICS */
1251 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1252 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1253 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1254 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1255 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1257 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1258 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1259 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1261 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1265 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1267 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1269 /* Update vectorial force */
1270 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1271 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1272 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1274 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1275 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1276 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1280 /**************************
1281 * CALCULATE INTERACTIONS *
1282 **************************/
1284 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1287 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1289 /* Compute parameters for interactions between i and j atoms */
1290 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1292 /* EWALD ELECTROSTATICS */
1294 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1295 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1296 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1297 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1298 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1300 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1301 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1302 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1304 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1308 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1310 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1312 /* Update vectorial force */
1313 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1314 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1315 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1317 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1318 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1319 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1323 /**************************
1324 * CALCULATE INTERACTIONS *
1325 **************************/
1327 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1330 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1332 /* Compute parameters for interactions between i and j atoms */
1333 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1335 /* EWALD ELECTROSTATICS */
1337 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1338 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1339 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1340 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1341 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1343 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1344 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1345 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1347 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1351 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1353 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1355 /* Update vectorial force */
1356 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1357 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1358 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1360 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1361 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1362 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1366 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1368 /* Inner loop uses 180 flops */
1371 /* End of innermost loop */
1373 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1374 f+i_coord_offset,fshift+i_shift_offset);
1376 /* Increment number of inner iterations */
1377 inneriter += j_index_end - j_index_start;
1379 /* Outer loop uses 24 flops */
1382 /* Increment number of outer iterations */
1385 /* Update outer/inner flops */
1387 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);