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_VdwLJSh_GeomW4W4_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_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 int vdwjidx1A,vdwjidx1B;
90 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
91 int vdwjidx2A,vdwjidx2B;
92 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
93 int vdwjidx3A,vdwjidx3B;
94 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
95 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
97 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
98 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
99 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
100 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
101 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
102 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
103 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
104 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
105 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
108 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
111 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
112 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
113 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
116 _fjsp_v2r8 dummy_mask,cutoff_mask;
117 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
118 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
119 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
126 jindex = nlist->jindex;
128 shiftidx = nlist->shift;
130 shiftvec = fr->shift_vec[0];
131 fshift = fr->fshift[0];
132 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
133 charge = mdatoms->chargeA;
134 nvdwtype = fr->ntype;
136 vdwtype = mdatoms->typeA;
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 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
151 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
152 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
153 vdwjidx0A = 2*vdwtype[inr+0];
154 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
155 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
156 qq11 = _fjsp_mul_v2r8(iq1,jq1);
157 qq12 = _fjsp_mul_v2r8(iq1,jq2);
158 qq13 = _fjsp_mul_v2r8(iq1,jq3);
159 qq21 = _fjsp_mul_v2r8(iq2,jq1);
160 qq22 = _fjsp_mul_v2r8(iq2,jq2);
161 qq23 = _fjsp_mul_v2r8(iq2,jq3);
162 qq31 = _fjsp_mul_v2r8(iq3,jq1);
163 qq32 = _fjsp_mul_v2r8(iq3,jq2);
164 qq33 = _fjsp_mul_v2r8(iq3,jq3);
166 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
167 rcutoff_scalar = fr->rcoulomb;
168 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
169 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
171 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
172 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
174 /* Avoid stupid compiler warnings */
182 /* Start outer loop over neighborlists */
183 for(iidx=0; iidx<nri; iidx++)
185 /* Load shift vector for this list */
186 i_shift_offset = DIM*shiftidx[iidx];
188 /* Load limits for loop over neighbors */
189 j_index_start = jindex[iidx];
190 j_index_end = jindex[iidx+1];
192 /* Get outer coordinate index */
194 i_coord_offset = DIM*inr;
196 /* Load i particle coords and add shift vector */
197 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
198 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
200 fix0 = _fjsp_setzero_v2r8();
201 fiy0 = _fjsp_setzero_v2r8();
202 fiz0 = _fjsp_setzero_v2r8();
203 fix1 = _fjsp_setzero_v2r8();
204 fiy1 = _fjsp_setzero_v2r8();
205 fiz1 = _fjsp_setzero_v2r8();
206 fix2 = _fjsp_setzero_v2r8();
207 fiy2 = _fjsp_setzero_v2r8();
208 fiz2 = _fjsp_setzero_v2r8();
209 fix3 = _fjsp_setzero_v2r8();
210 fiy3 = _fjsp_setzero_v2r8();
211 fiz3 = _fjsp_setzero_v2r8();
213 /* Reset potential sums */
214 velecsum = _fjsp_setzero_v2r8();
215 vvdwsum = _fjsp_setzero_v2r8();
217 /* Start inner kernel loop */
218 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
221 /* Get j neighbor index, and coordinate index */
224 j_coord_offsetA = DIM*jnrA;
225 j_coord_offsetB = DIM*jnrB;
227 /* load j atom coordinates */
228 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
229 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
230 &jy2,&jz2,&jx3,&jy3,&jz3);
232 /* Calculate displacement vector */
233 dx00 = _fjsp_sub_v2r8(ix0,jx0);
234 dy00 = _fjsp_sub_v2r8(iy0,jy0);
235 dz00 = _fjsp_sub_v2r8(iz0,jz0);
236 dx11 = _fjsp_sub_v2r8(ix1,jx1);
237 dy11 = _fjsp_sub_v2r8(iy1,jy1);
238 dz11 = _fjsp_sub_v2r8(iz1,jz1);
239 dx12 = _fjsp_sub_v2r8(ix1,jx2);
240 dy12 = _fjsp_sub_v2r8(iy1,jy2);
241 dz12 = _fjsp_sub_v2r8(iz1,jz2);
242 dx13 = _fjsp_sub_v2r8(ix1,jx3);
243 dy13 = _fjsp_sub_v2r8(iy1,jy3);
244 dz13 = _fjsp_sub_v2r8(iz1,jz3);
245 dx21 = _fjsp_sub_v2r8(ix2,jx1);
246 dy21 = _fjsp_sub_v2r8(iy2,jy1);
247 dz21 = _fjsp_sub_v2r8(iz2,jz1);
248 dx22 = _fjsp_sub_v2r8(ix2,jx2);
249 dy22 = _fjsp_sub_v2r8(iy2,jy2);
250 dz22 = _fjsp_sub_v2r8(iz2,jz2);
251 dx23 = _fjsp_sub_v2r8(ix2,jx3);
252 dy23 = _fjsp_sub_v2r8(iy2,jy3);
253 dz23 = _fjsp_sub_v2r8(iz2,jz3);
254 dx31 = _fjsp_sub_v2r8(ix3,jx1);
255 dy31 = _fjsp_sub_v2r8(iy3,jy1);
256 dz31 = _fjsp_sub_v2r8(iz3,jz1);
257 dx32 = _fjsp_sub_v2r8(ix3,jx2);
258 dy32 = _fjsp_sub_v2r8(iy3,jy2);
259 dz32 = _fjsp_sub_v2r8(iz3,jz2);
260 dx33 = _fjsp_sub_v2r8(ix3,jx3);
261 dy33 = _fjsp_sub_v2r8(iy3,jy3);
262 dz33 = _fjsp_sub_v2r8(iz3,jz3);
264 /* Calculate squared distance and things based on it */
265 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
266 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
267 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
268 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
269 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
270 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
271 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
272 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
273 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
274 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
276 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
277 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
278 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
279 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
280 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
281 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
282 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
283 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
284 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
286 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
287 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
288 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
289 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
290 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
291 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
292 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
293 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
294 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
295 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
297 fjx0 = _fjsp_setzero_v2r8();
298 fjy0 = _fjsp_setzero_v2r8();
299 fjz0 = _fjsp_setzero_v2r8();
300 fjx1 = _fjsp_setzero_v2r8();
301 fjy1 = _fjsp_setzero_v2r8();
302 fjz1 = _fjsp_setzero_v2r8();
303 fjx2 = _fjsp_setzero_v2r8();
304 fjy2 = _fjsp_setzero_v2r8();
305 fjz2 = _fjsp_setzero_v2r8();
306 fjx3 = _fjsp_setzero_v2r8();
307 fjy3 = _fjsp_setzero_v2r8();
308 fjz3 = _fjsp_setzero_v2r8();
310 /**************************
311 * CALCULATE INTERACTIONS *
312 **************************/
314 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
317 /* LENNARD-JONES DISPERSION/REPULSION */
319 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
320 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
321 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
322 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
323 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
324 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
326 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
328 /* Update potential sum for this i atom from the interaction with this j atom. */
329 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
330 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
334 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
336 /* Update vectorial force */
337 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
338 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
339 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
341 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
342 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
343 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
347 /**************************
348 * CALCULATE INTERACTIONS *
349 **************************/
351 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
354 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
356 /* EWALD ELECTROSTATICS */
358 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
359 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
360 itab_tmp = _fjsp_dtox_v2r8(ewrt);
361 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
362 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
364 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
365 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
366 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
367 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
368 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
369 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
370 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
371 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
372 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
373 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
375 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
377 /* Update potential sum for this i atom from the interaction with this j atom. */
378 velec = _fjsp_and_v2r8(velec,cutoff_mask);
379 velecsum = _fjsp_add_v2r8(velecsum,velec);
383 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
385 /* Update vectorial force */
386 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
387 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
388 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
390 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
391 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
392 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
396 /**************************
397 * CALCULATE INTERACTIONS *
398 **************************/
400 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
403 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
405 /* EWALD ELECTROSTATICS */
407 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
408 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
409 itab_tmp = _fjsp_dtox_v2r8(ewrt);
410 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
411 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
413 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
414 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
415 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
416 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
417 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
418 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
419 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
420 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
421 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
422 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
424 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
426 /* Update potential sum for this i atom from the interaction with this j atom. */
427 velec = _fjsp_and_v2r8(velec,cutoff_mask);
428 velecsum = _fjsp_add_v2r8(velecsum,velec);
432 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
434 /* Update vectorial force */
435 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
436 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
437 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
439 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
440 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
441 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
445 /**************************
446 * CALCULATE INTERACTIONS *
447 **************************/
449 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
452 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
454 /* EWALD ELECTROSTATICS */
456 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
457 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
458 itab_tmp = _fjsp_dtox_v2r8(ewrt);
459 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
460 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
462 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
463 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
464 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
465 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
466 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
467 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
468 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
469 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
470 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
471 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
473 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
475 /* Update potential sum for this i atom from the interaction with this j atom. */
476 velec = _fjsp_and_v2r8(velec,cutoff_mask);
477 velecsum = _fjsp_add_v2r8(velecsum,velec);
481 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
483 /* Update vectorial force */
484 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
485 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
486 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
488 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
489 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
490 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
494 /**************************
495 * CALCULATE INTERACTIONS *
496 **************************/
498 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
501 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
503 /* EWALD ELECTROSTATICS */
505 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
506 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
507 itab_tmp = _fjsp_dtox_v2r8(ewrt);
508 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
509 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
511 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
512 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
513 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
514 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
515 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
516 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
517 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
518 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
519 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
520 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
522 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
524 /* Update potential sum for this i atom from the interaction with this j atom. */
525 velec = _fjsp_and_v2r8(velec,cutoff_mask);
526 velecsum = _fjsp_add_v2r8(velecsum,velec);
530 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
532 /* Update vectorial force */
533 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
534 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
535 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
537 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
538 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
539 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
543 /**************************
544 * CALCULATE INTERACTIONS *
545 **************************/
547 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
550 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
552 /* EWALD ELECTROSTATICS */
554 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
555 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
556 itab_tmp = _fjsp_dtox_v2r8(ewrt);
557 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
558 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
560 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
561 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
562 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
563 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
564 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
565 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
566 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
567 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
568 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
569 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
571 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
573 /* Update potential sum for this i atom from the interaction with this j atom. */
574 velec = _fjsp_and_v2r8(velec,cutoff_mask);
575 velecsum = _fjsp_add_v2r8(velecsum,velec);
579 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
581 /* Update vectorial force */
582 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
583 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
584 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
586 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
587 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
588 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
592 /**************************
593 * CALCULATE INTERACTIONS *
594 **************************/
596 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
599 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
601 /* EWALD ELECTROSTATICS */
603 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
604 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
605 itab_tmp = _fjsp_dtox_v2r8(ewrt);
606 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
607 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
609 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
610 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
611 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
612 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
613 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
614 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
615 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
616 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
617 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
618 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
620 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
622 /* Update potential sum for this i atom from the interaction with this j atom. */
623 velec = _fjsp_and_v2r8(velec,cutoff_mask);
624 velecsum = _fjsp_add_v2r8(velecsum,velec);
628 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
630 /* Update vectorial force */
631 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
632 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
633 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
635 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
636 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
637 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
641 /**************************
642 * CALCULATE INTERACTIONS *
643 **************************/
645 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
648 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
650 /* EWALD ELECTROSTATICS */
652 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
653 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
654 itab_tmp = _fjsp_dtox_v2r8(ewrt);
655 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
656 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
658 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
659 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
660 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
661 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
662 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
663 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
664 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
665 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
666 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
667 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
669 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
671 /* Update potential sum for this i atom from the interaction with this j atom. */
672 velec = _fjsp_and_v2r8(velec,cutoff_mask);
673 velecsum = _fjsp_add_v2r8(velecsum,velec);
677 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
679 /* Update vectorial force */
680 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
681 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
682 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
684 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
685 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
686 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
690 /**************************
691 * CALCULATE INTERACTIONS *
692 **************************/
694 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
697 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
699 /* EWALD ELECTROSTATICS */
701 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
702 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
703 itab_tmp = _fjsp_dtox_v2r8(ewrt);
704 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
705 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
707 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
708 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
709 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
710 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
711 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
712 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
713 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
714 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
715 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
716 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
718 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
720 /* Update potential sum for this i atom from the interaction with this j atom. */
721 velec = _fjsp_and_v2r8(velec,cutoff_mask);
722 velecsum = _fjsp_add_v2r8(velecsum,velec);
726 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
728 /* Update vectorial force */
729 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
730 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
731 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
733 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
734 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
735 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
739 /**************************
740 * CALCULATE INTERACTIONS *
741 **************************/
743 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
746 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
748 /* EWALD ELECTROSTATICS */
750 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
751 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
752 itab_tmp = _fjsp_dtox_v2r8(ewrt);
753 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
754 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
756 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
757 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
758 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
759 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
760 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
761 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
762 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
763 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
764 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
765 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
767 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
769 /* Update potential sum for this i atom from the interaction with this j atom. */
770 velec = _fjsp_and_v2r8(velec,cutoff_mask);
771 velecsum = _fjsp_add_v2r8(velecsum,velec);
775 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
777 /* Update vectorial force */
778 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
779 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
780 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
782 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
783 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
784 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
788 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
790 /* Inner loop uses 488 flops */
797 j_coord_offsetA = DIM*jnrA;
799 /* load j atom coordinates */
800 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
801 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
802 &jy2,&jz2,&jx3,&jy3,&jz3);
804 /* Calculate displacement vector */
805 dx00 = _fjsp_sub_v2r8(ix0,jx0);
806 dy00 = _fjsp_sub_v2r8(iy0,jy0);
807 dz00 = _fjsp_sub_v2r8(iz0,jz0);
808 dx11 = _fjsp_sub_v2r8(ix1,jx1);
809 dy11 = _fjsp_sub_v2r8(iy1,jy1);
810 dz11 = _fjsp_sub_v2r8(iz1,jz1);
811 dx12 = _fjsp_sub_v2r8(ix1,jx2);
812 dy12 = _fjsp_sub_v2r8(iy1,jy2);
813 dz12 = _fjsp_sub_v2r8(iz1,jz2);
814 dx13 = _fjsp_sub_v2r8(ix1,jx3);
815 dy13 = _fjsp_sub_v2r8(iy1,jy3);
816 dz13 = _fjsp_sub_v2r8(iz1,jz3);
817 dx21 = _fjsp_sub_v2r8(ix2,jx1);
818 dy21 = _fjsp_sub_v2r8(iy2,jy1);
819 dz21 = _fjsp_sub_v2r8(iz2,jz1);
820 dx22 = _fjsp_sub_v2r8(ix2,jx2);
821 dy22 = _fjsp_sub_v2r8(iy2,jy2);
822 dz22 = _fjsp_sub_v2r8(iz2,jz2);
823 dx23 = _fjsp_sub_v2r8(ix2,jx3);
824 dy23 = _fjsp_sub_v2r8(iy2,jy3);
825 dz23 = _fjsp_sub_v2r8(iz2,jz3);
826 dx31 = _fjsp_sub_v2r8(ix3,jx1);
827 dy31 = _fjsp_sub_v2r8(iy3,jy1);
828 dz31 = _fjsp_sub_v2r8(iz3,jz1);
829 dx32 = _fjsp_sub_v2r8(ix3,jx2);
830 dy32 = _fjsp_sub_v2r8(iy3,jy2);
831 dz32 = _fjsp_sub_v2r8(iz3,jz2);
832 dx33 = _fjsp_sub_v2r8(ix3,jx3);
833 dy33 = _fjsp_sub_v2r8(iy3,jy3);
834 dz33 = _fjsp_sub_v2r8(iz3,jz3);
836 /* Calculate squared distance and things based on it */
837 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
838 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
839 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
840 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
841 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
842 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
843 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
844 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
845 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
846 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
848 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
849 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
850 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
851 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
852 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
853 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
854 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
855 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
856 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
858 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
859 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
860 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
861 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
862 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
863 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
864 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
865 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
866 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
867 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
869 fjx0 = _fjsp_setzero_v2r8();
870 fjy0 = _fjsp_setzero_v2r8();
871 fjz0 = _fjsp_setzero_v2r8();
872 fjx1 = _fjsp_setzero_v2r8();
873 fjy1 = _fjsp_setzero_v2r8();
874 fjz1 = _fjsp_setzero_v2r8();
875 fjx2 = _fjsp_setzero_v2r8();
876 fjy2 = _fjsp_setzero_v2r8();
877 fjz2 = _fjsp_setzero_v2r8();
878 fjx3 = _fjsp_setzero_v2r8();
879 fjy3 = _fjsp_setzero_v2r8();
880 fjz3 = _fjsp_setzero_v2r8();
882 /**************************
883 * CALCULATE INTERACTIONS *
884 **************************/
886 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
889 /* LENNARD-JONES DISPERSION/REPULSION */
891 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
892 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
893 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
894 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
895 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
896 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
898 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
900 /* Update potential sum for this i atom from the interaction with this j atom. */
901 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
902 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
903 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
907 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
909 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
911 /* Update vectorial force */
912 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
913 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
914 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
916 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
917 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
918 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
922 /**************************
923 * CALCULATE INTERACTIONS *
924 **************************/
926 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
929 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
931 /* EWALD ELECTROSTATICS */
933 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
934 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
935 itab_tmp = _fjsp_dtox_v2r8(ewrt);
936 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
937 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
939 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
940 ewtabD = _fjsp_setzero_v2r8();
941 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
942 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
943 ewtabFn = _fjsp_setzero_v2r8();
944 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
945 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
946 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
947 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
948 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
950 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
952 /* Update potential sum for this i atom from the interaction with this j atom. */
953 velec = _fjsp_and_v2r8(velec,cutoff_mask);
954 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
955 velecsum = _fjsp_add_v2r8(velecsum,velec);
959 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
961 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
963 /* Update vectorial force */
964 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
965 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
966 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
968 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
969 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
970 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
974 /**************************
975 * CALCULATE INTERACTIONS *
976 **************************/
978 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
981 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
983 /* EWALD ELECTROSTATICS */
985 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
986 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
987 itab_tmp = _fjsp_dtox_v2r8(ewrt);
988 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
989 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
991 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
992 ewtabD = _fjsp_setzero_v2r8();
993 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
994 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
995 ewtabFn = _fjsp_setzero_v2r8();
996 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
997 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
998 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
999 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
1000 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1002 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1004 /* Update potential sum for this i atom from the interaction with this j atom. */
1005 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1006 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1007 velecsum = _fjsp_add_v2r8(velecsum,velec);
1011 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1013 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1015 /* Update vectorial force */
1016 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1017 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1018 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1020 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1021 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1022 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1026 /**************************
1027 * CALCULATE INTERACTIONS *
1028 **************************/
1030 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1033 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
1035 /* EWALD ELECTROSTATICS */
1037 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1038 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
1039 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1040 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1041 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1043 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1044 ewtabD = _fjsp_setzero_v2r8();
1045 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1046 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1047 ewtabFn = _fjsp_setzero_v2r8();
1048 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1049 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1050 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1051 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
1052 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1054 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1056 /* Update potential sum for this i atom from the interaction with this j atom. */
1057 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1058 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1059 velecsum = _fjsp_add_v2r8(velecsum,velec);
1063 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1065 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1067 /* Update vectorial force */
1068 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1069 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1070 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1072 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1073 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1074 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1078 /**************************
1079 * CALCULATE INTERACTIONS *
1080 **************************/
1082 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1085 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
1087 /* EWALD ELECTROSTATICS */
1089 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1090 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
1091 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1092 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1093 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1095 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1096 ewtabD = _fjsp_setzero_v2r8();
1097 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1098 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1099 ewtabFn = _fjsp_setzero_v2r8();
1100 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1101 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1102 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1103 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
1104 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1106 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1108 /* Update potential sum for this i atom from the interaction with this j atom. */
1109 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1110 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1111 velecsum = _fjsp_add_v2r8(velecsum,velec);
1115 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1117 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1119 /* Update vectorial force */
1120 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1121 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1122 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1124 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1125 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1126 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1130 /**************************
1131 * CALCULATE INTERACTIONS *
1132 **************************/
1134 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1137 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
1139 /* EWALD ELECTROSTATICS */
1141 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1142 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
1143 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1144 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1145 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1147 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1148 ewtabD = _fjsp_setzero_v2r8();
1149 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1150 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1151 ewtabFn = _fjsp_setzero_v2r8();
1152 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1153 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1154 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1155 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
1156 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1158 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1160 /* Update potential sum for this i atom from the interaction with this j atom. */
1161 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1162 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1163 velecsum = _fjsp_add_v2r8(velecsum,velec);
1167 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1169 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1171 /* Update vectorial force */
1172 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1173 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1174 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1176 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1177 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1178 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1182 /**************************
1183 * CALCULATE INTERACTIONS *
1184 **************************/
1186 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1189 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
1191 /* EWALD ELECTROSTATICS */
1193 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1194 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
1195 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1196 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1197 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1199 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1200 ewtabD = _fjsp_setzero_v2r8();
1201 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1202 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1203 ewtabFn = _fjsp_setzero_v2r8();
1204 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1205 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1206 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1207 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
1208 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1210 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1212 /* Update potential sum for this i atom from the interaction with this j atom. */
1213 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1214 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1215 velecsum = _fjsp_add_v2r8(velecsum,velec);
1219 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1221 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1223 /* Update vectorial force */
1224 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1225 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1226 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1228 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1229 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1230 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1234 /**************************
1235 * CALCULATE INTERACTIONS *
1236 **************************/
1238 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1241 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
1243 /* EWALD ELECTROSTATICS */
1245 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1246 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
1247 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1248 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1249 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1251 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1252 ewtabD = _fjsp_setzero_v2r8();
1253 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1254 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1255 ewtabFn = _fjsp_setzero_v2r8();
1256 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1257 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1258 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1259 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
1260 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1262 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1264 /* Update potential sum for this i atom from the interaction with this j atom. */
1265 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1266 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1267 velecsum = _fjsp_add_v2r8(velecsum,velec);
1271 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1273 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1275 /* Update vectorial force */
1276 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1277 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1278 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1280 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1281 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1282 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1286 /**************************
1287 * CALCULATE INTERACTIONS *
1288 **************************/
1290 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1293 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
1295 /* EWALD ELECTROSTATICS */
1297 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1298 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
1299 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1300 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1301 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1303 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1304 ewtabD = _fjsp_setzero_v2r8();
1305 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1306 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1307 ewtabFn = _fjsp_setzero_v2r8();
1308 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1309 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1310 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1311 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
1312 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
1314 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
1316 /* Update potential sum for this i atom from the interaction with this j atom. */
1317 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1318 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1319 velecsum = _fjsp_add_v2r8(velecsum,velec);
1323 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1325 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1327 /* Update vectorial force */
1328 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1329 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1330 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1332 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1333 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1334 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1338 /**************************
1339 * CALCULATE INTERACTIONS *
1340 **************************/
1342 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
1345 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
1347 /* EWALD ELECTROSTATICS */
1349 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1350 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
1351 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1352 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1353 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1355 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1356 ewtabD = _fjsp_setzero_v2r8();
1357 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1358 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1359 ewtabFn = _fjsp_setzero_v2r8();
1360 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1361 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1362 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1363 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
1364 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
1366 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
1368 /* Update potential sum for this i atom from the interaction with this j atom. */
1369 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1370 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1371 velecsum = _fjsp_add_v2r8(velecsum,velec);
1375 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1377 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1379 /* Update vectorial force */
1380 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1381 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1382 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1384 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1385 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1386 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1390 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1392 /* Inner loop uses 488 flops */
1395 /* End of innermost loop */
1397 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1398 f+i_coord_offset,fshift+i_shift_offset);
1401 /* Update potential energies */
1402 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
1403 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
1405 /* Increment number of inner iterations */
1406 inneriter += j_index_end - j_index_start;
1408 /* Outer loop uses 26 flops */
1411 /* Increment number of outer iterations */
1414 /* Update outer/inner flops */
1416 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*488);
1419 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1420 * Electrostatics interaction: Ewald
1421 * VdW interaction: LennardJones
1422 * Geometry: Water4-Water4
1423 * Calculate force/pot: Force
1426 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1427 (t_nblist * gmx_restrict nlist,
1428 rvec * gmx_restrict xx,
1429 rvec * gmx_restrict ff,
1430 t_forcerec * gmx_restrict fr,
1431 t_mdatoms * gmx_restrict mdatoms,
1432 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
1433 t_nrnb * gmx_restrict nrnb)
1435 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1436 * just 0 for non-waters.
1437 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
1438 * jnr indices corresponding to data put in the four positions in the SIMD register.
1440 int i_shift_offset,i_coord_offset,outeriter,inneriter;
1441 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1443 int j_coord_offsetA,j_coord_offsetB;
1444 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
1445 real rcutoff_scalar;
1446 real *shiftvec,*fshift,*x,*f;
1447 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
1449 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1451 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1453 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1455 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
1456 int vdwjidx0A,vdwjidx0B;
1457 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1458 int vdwjidx1A,vdwjidx1B;
1459 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1460 int vdwjidx2A,vdwjidx2B;
1461 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1462 int vdwjidx3A,vdwjidx3B;
1463 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
1464 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1465 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1466 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1467 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
1468 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1469 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1470 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
1471 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
1472 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
1473 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
1474 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
1477 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1480 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
1481 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1482 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
1484 _fjsp_v2r8 itab_tmp;
1485 _fjsp_v2r8 dummy_mask,cutoff_mask;
1486 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
1487 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
1488 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1495 jindex = nlist->jindex;
1497 shiftidx = nlist->shift;
1499 shiftvec = fr->shift_vec[0];
1500 fshift = fr->fshift[0];
1501 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
1502 charge = mdatoms->chargeA;
1503 nvdwtype = fr->ntype;
1504 vdwparam = fr->nbfp;
1505 vdwtype = mdatoms->typeA;
1507 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
1508 ewtab = fr->ic->tabq_coul_F;
1509 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
1510 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
1512 /* Setup water-specific parameters */
1513 inr = nlist->iinr[0];
1514 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1515 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1516 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
1517 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
1519 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
1520 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
1521 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
1522 vdwjidx0A = 2*vdwtype[inr+0];
1523 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1524 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1525 qq11 = _fjsp_mul_v2r8(iq1,jq1);
1526 qq12 = _fjsp_mul_v2r8(iq1,jq2);
1527 qq13 = _fjsp_mul_v2r8(iq1,jq3);
1528 qq21 = _fjsp_mul_v2r8(iq2,jq1);
1529 qq22 = _fjsp_mul_v2r8(iq2,jq2);
1530 qq23 = _fjsp_mul_v2r8(iq2,jq3);
1531 qq31 = _fjsp_mul_v2r8(iq3,jq1);
1532 qq32 = _fjsp_mul_v2r8(iq3,jq2);
1533 qq33 = _fjsp_mul_v2r8(iq3,jq3);
1535 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
1536 rcutoff_scalar = fr->rcoulomb;
1537 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
1538 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
1540 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
1541 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
1543 /* Avoid stupid compiler warnings */
1545 j_coord_offsetA = 0;
1546 j_coord_offsetB = 0;
1551 /* Start outer loop over neighborlists */
1552 for(iidx=0; iidx<nri; iidx++)
1554 /* Load shift vector for this list */
1555 i_shift_offset = DIM*shiftidx[iidx];
1557 /* Load limits for loop over neighbors */
1558 j_index_start = jindex[iidx];
1559 j_index_end = jindex[iidx+1];
1561 /* Get outer coordinate index */
1563 i_coord_offset = DIM*inr;
1565 /* Load i particle coords and add shift vector */
1566 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1567 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1569 fix0 = _fjsp_setzero_v2r8();
1570 fiy0 = _fjsp_setzero_v2r8();
1571 fiz0 = _fjsp_setzero_v2r8();
1572 fix1 = _fjsp_setzero_v2r8();
1573 fiy1 = _fjsp_setzero_v2r8();
1574 fiz1 = _fjsp_setzero_v2r8();
1575 fix2 = _fjsp_setzero_v2r8();
1576 fiy2 = _fjsp_setzero_v2r8();
1577 fiz2 = _fjsp_setzero_v2r8();
1578 fix3 = _fjsp_setzero_v2r8();
1579 fiy3 = _fjsp_setzero_v2r8();
1580 fiz3 = _fjsp_setzero_v2r8();
1582 /* Start inner kernel loop */
1583 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1586 /* Get j neighbor index, and coordinate index */
1588 jnrB = jjnr[jidx+1];
1589 j_coord_offsetA = DIM*jnrA;
1590 j_coord_offsetB = DIM*jnrB;
1592 /* load j atom coordinates */
1593 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1594 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1595 &jy2,&jz2,&jx3,&jy3,&jz3);
1597 /* Calculate displacement vector */
1598 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1599 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1600 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1601 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1602 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1603 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1604 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1605 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1606 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1607 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1608 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1609 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1610 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1611 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1612 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1613 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1614 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1615 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1616 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1617 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1618 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1619 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1620 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1621 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1622 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1623 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1624 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1625 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1626 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1627 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1629 /* Calculate squared distance and things based on it */
1630 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1631 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1632 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1633 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1634 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1635 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1636 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1637 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1638 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1639 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1641 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1642 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1643 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1644 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1645 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1646 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1647 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1648 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1649 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1651 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1652 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1653 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1654 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1655 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1656 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1657 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1658 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1659 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1660 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1662 fjx0 = _fjsp_setzero_v2r8();
1663 fjy0 = _fjsp_setzero_v2r8();
1664 fjz0 = _fjsp_setzero_v2r8();
1665 fjx1 = _fjsp_setzero_v2r8();
1666 fjy1 = _fjsp_setzero_v2r8();
1667 fjz1 = _fjsp_setzero_v2r8();
1668 fjx2 = _fjsp_setzero_v2r8();
1669 fjy2 = _fjsp_setzero_v2r8();
1670 fjz2 = _fjsp_setzero_v2r8();
1671 fjx3 = _fjsp_setzero_v2r8();
1672 fjy3 = _fjsp_setzero_v2r8();
1673 fjz3 = _fjsp_setzero_v2r8();
1675 /**************************
1676 * CALCULATE INTERACTIONS *
1677 **************************/
1679 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1682 /* LENNARD-JONES DISPERSION/REPULSION */
1684 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1685 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1687 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1691 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1693 /* Update vectorial force */
1694 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1695 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1696 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1698 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1699 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1700 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1704 /**************************
1705 * CALCULATE INTERACTIONS *
1706 **************************/
1708 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
1711 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
1713 /* EWALD ELECTROSTATICS */
1715 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1716 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
1717 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1718 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1719 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1721 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1723 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1724 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
1726 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
1730 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1732 /* Update vectorial force */
1733 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1734 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1735 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1737 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1738 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1739 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1743 /**************************
1744 * CALCULATE INTERACTIONS *
1745 **************************/
1747 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
1750 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
1752 /* EWALD ELECTROSTATICS */
1754 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1755 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
1756 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1757 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1758 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1760 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1762 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1763 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1765 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1769 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1771 /* Update vectorial force */
1772 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1773 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1774 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1776 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1777 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1778 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1782 /**************************
1783 * CALCULATE INTERACTIONS *
1784 **************************/
1786 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1789 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
1791 /* EWALD ELECTROSTATICS */
1793 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1794 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
1795 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1796 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1797 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1799 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1801 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1802 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1804 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1808 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1810 /* Update vectorial force */
1811 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1812 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1813 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1815 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1816 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1817 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1821 /**************************
1822 * CALCULATE INTERACTIONS *
1823 **************************/
1825 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1828 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
1830 /* EWALD ELECTROSTATICS */
1832 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1833 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
1834 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1835 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1836 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1838 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1840 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1841 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1843 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1847 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1849 /* Update vectorial force */
1850 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1851 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1852 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1854 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1855 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1856 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1860 /**************************
1861 * CALCULATE INTERACTIONS *
1862 **************************/
1864 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1867 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
1869 /* EWALD ELECTROSTATICS */
1871 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1872 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
1873 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1874 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1875 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1877 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1879 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1880 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1882 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1886 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1888 /* Update vectorial force */
1889 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1890 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1891 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1893 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1894 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1895 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1899 /**************************
1900 * CALCULATE INTERACTIONS *
1901 **************************/
1903 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1906 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
1908 /* EWALD ELECTROSTATICS */
1910 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1911 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
1912 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1913 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1914 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1916 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1918 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1919 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1921 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1925 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1927 /* Update vectorial force */
1928 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1929 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1930 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1932 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1933 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1934 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1938 /**************************
1939 * CALCULATE INTERACTIONS *
1940 **************************/
1942 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1945 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
1947 /* EWALD ELECTROSTATICS */
1949 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1950 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
1951 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1952 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1953 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1955 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1957 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1958 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1960 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1964 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1966 /* Update vectorial force */
1967 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1968 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1969 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1971 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1972 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1973 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1977 /**************************
1978 * CALCULATE INTERACTIONS *
1979 **************************/
1981 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1984 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
1986 /* EWALD ELECTROSTATICS */
1988 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1989 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
1990 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1991 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1992 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1994 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1996 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1997 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
1999 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2003 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2005 /* Update vectorial force */
2006 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
2007 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2008 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2010 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2011 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2012 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2016 /**************************
2017 * CALCULATE INTERACTIONS *
2018 **************************/
2020 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2023 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
2025 /* EWALD ELECTROSTATICS */
2027 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2028 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
2029 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2030 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2031 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2033 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
2035 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2036 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2038 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2042 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2044 /* Update vectorial force */
2045 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
2046 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2047 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2049 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2050 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2051 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2055 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
2057 /* Inner loop uses 414 flops */
2060 if(jidx<j_index_end)
2064 j_coord_offsetA = DIM*jnrA;
2066 /* load j atom coordinates */
2067 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
2068 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
2069 &jy2,&jz2,&jx3,&jy3,&jz3);
2071 /* Calculate displacement vector */
2072 dx00 = _fjsp_sub_v2r8(ix0,jx0);
2073 dy00 = _fjsp_sub_v2r8(iy0,jy0);
2074 dz00 = _fjsp_sub_v2r8(iz0,jz0);
2075 dx11 = _fjsp_sub_v2r8(ix1,jx1);
2076 dy11 = _fjsp_sub_v2r8(iy1,jy1);
2077 dz11 = _fjsp_sub_v2r8(iz1,jz1);
2078 dx12 = _fjsp_sub_v2r8(ix1,jx2);
2079 dy12 = _fjsp_sub_v2r8(iy1,jy2);
2080 dz12 = _fjsp_sub_v2r8(iz1,jz2);
2081 dx13 = _fjsp_sub_v2r8(ix1,jx3);
2082 dy13 = _fjsp_sub_v2r8(iy1,jy3);
2083 dz13 = _fjsp_sub_v2r8(iz1,jz3);
2084 dx21 = _fjsp_sub_v2r8(ix2,jx1);
2085 dy21 = _fjsp_sub_v2r8(iy2,jy1);
2086 dz21 = _fjsp_sub_v2r8(iz2,jz1);
2087 dx22 = _fjsp_sub_v2r8(ix2,jx2);
2088 dy22 = _fjsp_sub_v2r8(iy2,jy2);
2089 dz22 = _fjsp_sub_v2r8(iz2,jz2);
2090 dx23 = _fjsp_sub_v2r8(ix2,jx3);
2091 dy23 = _fjsp_sub_v2r8(iy2,jy3);
2092 dz23 = _fjsp_sub_v2r8(iz2,jz3);
2093 dx31 = _fjsp_sub_v2r8(ix3,jx1);
2094 dy31 = _fjsp_sub_v2r8(iy3,jy1);
2095 dz31 = _fjsp_sub_v2r8(iz3,jz1);
2096 dx32 = _fjsp_sub_v2r8(ix3,jx2);
2097 dy32 = _fjsp_sub_v2r8(iy3,jy2);
2098 dz32 = _fjsp_sub_v2r8(iz3,jz2);
2099 dx33 = _fjsp_sub_v2r8(ix3,jx3);
2100 dy33 = _fjsp_sub_v2r8(iy3,jy3);
2101 dz33 = _fjsp_sub_v2r8(iz3,jz3);
2103 /* Calculate squared distance and things based on it */
2104 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
2105 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
2106 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
2107 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
2108 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
2109 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
2110 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
2111 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
2112 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
2113 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
2115 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
2116 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
2117 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
2118 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
2119 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
2120 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
2121 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
2122 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
2123 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
2125 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
2126 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
2127 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
2128 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
2129 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
2130 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
2131 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
2132 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
2133 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
2134 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
2136 fjx0 = _fjsp_setzero_v2r8();
2137 fjy0 = _fjsp_setzero_v2r8();
2138 fjz0 = _fjsp_setzero_v2r8();
2139 fjx1 = _fjsp_setzero_v2r8();
2140 fjy1 = _fjsp_setzero_v2r8();
2141 fjz1 = _fjsp_setzero_v2r8();
2142 fjx2 = _fjsp_setzero_v2r8();
2143 fjy2 = _fjsp_setzero_v2r8();
2144 fjz2 = _fjsp_setzero_v2r8();
2145 fjx3 = _fjsp_setzero_v2r8();
2146 fjy3 = _fjsp_setzero_v2r8();
2147 fjz3 = _fjsp_setzero_v2r8();
2149 /**************************
2150 * CALCULATE INTERACTIONS *
2151 **************************/
2153 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
2156 /* LENNARD-JONES DISPERSION/REPULSION */
2158 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
2159 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
2161 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
2165 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2167 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2169 /* Update vectorial force */
2170 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
2171 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
2172 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
2174 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
2175 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
2176 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
2180 /**************************
2181 * CALCULATE INTERACTIONS *
2182 **************************/
2184 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
2187 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
2189 /* EWALD ELECTROSTATICS */
2191 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2192 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
2193 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2194 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2195 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2197 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2198 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2199 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
2201 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
2205 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2207 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2209 /* Update vectorial force */
2210 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
2211 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
2212 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
2214 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
2215 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
2216 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
2220 /**************************
2221 * CALCULATE INTERACTIONS *
2222 **************************/
2224 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
2227 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
2229 /* EWALD ELECTROSTATICS */
2231 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2232 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
2233 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2234 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2235 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2237 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2238 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2239 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
2241 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
2245 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2247 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2249 /* Update vectorial force */
2250 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
2251 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
2252 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
2254 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
2255 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
2256 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
2260 /**************************
2261 * CALCULATE INTERACTIONS *
2262 **************************/
2264 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
2267 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
2269 /* EWALD ELECTROSTATICS */
2271 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2272 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
2273 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2274 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2275 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2277 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2278 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2279 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
2281 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
2285 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2287 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2289 /* Update vectorial force */
2290 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
2291 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
2292 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
2294 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
2295 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
2296 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
2300 /**************************
2301 * CALCULATE INTERACTIONS *
2302 **************************/
2304 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
2307 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
2309 /* EWALD ELECTROSTATICS */
2311 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2312 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
2313 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2314 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2315 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2317 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2318 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2319 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
2321 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
2325 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2327 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2329 /* Update vectorial force */
2330 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
2331 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
2332 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
2334 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
2335 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
2336 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
2340 /**************************
2341 * CALCULATE INTERACTIONS *
2342 **************************/
2344 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
2347 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
2349 /* EWALD ELECTROSTATICS */
2351 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2352 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
2353 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2354 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2355 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2357 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2358 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2359 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
2361 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
2365 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2367 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2369 /* Update vectorial force */
2370 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
2371 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
2372 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
2374 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
2375 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
2376 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
2380 /**************************
2381 * CALCULATE INTERACTIONS *
2382 **************************/
2384 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
2387 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
2389 /* EWALD ELECTROSTATICS */
2391 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2392 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
2393 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2394 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2395 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2397 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2398 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2399 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
2401 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
2405 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2407 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2409 /* Update vectorial force */
2410 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
2411 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
2412 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
2414 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
2415 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
2416 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
2420 /**************************
2421 * CALCULATE INTERACTIONS *
2422 **************************/
2424 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
2427 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
2429 /* EWALD ELECTROSTATICS */
2431 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2432 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
2433 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2434 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2435 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2437 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2438 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2439 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
2441 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
2445 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2447 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2449 /* Update vectorial force */
2450 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
2451 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
2452 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
2454 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
2455 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
2456 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
2460 /**************************
2461 * CALCULATE INTERACTIONS *
2462 **************************/
2464 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
2467 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
2469 /* EWALD ELECTROSTATICS */
2471 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2472 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
2473 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2474 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2475 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2477 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2478 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2479 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
2481 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2485 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2487 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2489 /* Update vectorial force */
2490 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
2491 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2492 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2494 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2495 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2496 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2500 /**************************
2501 * CALCULATE INTERACTIONS *
2502 **************************/
2504 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2507 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
2509 /* EWALD ELECTROSTATICS */
2511 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2512 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
2513 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2514 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2515 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2517 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2518 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2519 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2521 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2525 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2527 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2529 /* Update vectorial force */
2530 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
2531 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2532 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2534 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2535 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2536 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2540 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
2542 /* Inner loop uses 414 flops */
2545 /* End of innermost loop */
2547 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
2548 f+i_coord_offset,fshift+i_shift_offset);
2550 /* Increment number of inner iterations */
2551 inneriter += j_index_end - j_index_start;
2553 /* Outer loop uses 24 flops */
2556 /* Increment number of outer iterations */
2559 /* Update outer/inner flops */
2561 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*414);