2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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 "types/simple.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Water4
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_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 int vdwjidx1A,vdwjidx1B;
92 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
93 int vdwjidx2A,vdwjidx2B;
94 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
95 int vdwjidx3A,vdwjidx3B;
96 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
97 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
98 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
99 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
100 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
101 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
102 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
103 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
104 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
105 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
106 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
107 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
110 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
113 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
114 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
115 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
118 _fjsp_v2r8 dummy_mask,cutoff_mask;
119 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
120 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
121 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
128 jindex = nlist->jindex;
130 shiftidx = nlist->shift;
132 shiftvec = fr->shift_vec[0];
133 fshift = fr->fshift[0];
134 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
135 charge = mdatoms->chargeA;
136 nvdwtype = fr->ntype;
138 vdwtype = mdatoms->typeA;
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 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
153 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
154 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
155 vdwjidx0A = 2*vdwtype[inr+0];
156 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
157 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
158 qq11 = _fjsp_mul_v2r8(iq1,jq1);
159 qq12 = _fjsp_mul_v2r8(iq1,jq2);
160 qq13 = _fjsp_mul_v2r8(iq1,jq3);
161 qq21 = _fjsp_mul_v2r8(iq2,jq1);
162 qq22 = _fjsp_mul_v2r8(iq2,jq2);
163 qq23 = _fjsp_mul_v2r8(iq2,jq3);
164 qq31 = _fjsp_mul_v2r8(iq3,jq1);
165 qq32 = _fjsp_mul_v2r8(iq3,jq2);
166 qq33 = _fjsp_mul_v2r8(iq3,jq3);
168 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
169 rcutoff_scalar = fr->rcoulomb;
170 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
171 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
173 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
174 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
176 /* Avoid stupid compiler warnings */
184 /* Start outer loop over neighborlists */
185 for(iidx=0; iidx<nri; iidx++)
187 /* Load shift vector for this list */
188 i_shift_offset = DIM*shiftidx[iidx];
190 /* Load limits for loop over neighbors */
191 j_index_start = jindex[iidx];
192 j_index_end = jindex[iidx+1];
194 /* Get outer coordinate index */
196 i_coord_offset = DIM*inr;
198 /* Load i particle coords and add shift vector */
199 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
200 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
202 fix0 = _fjsp_setzero_v2r8();
203 fiy0 = _fjsp_setzero_v2r8();
204 fiz0 = _fjsp_setzero_v2r8();
205 fix1 = _fjsp_setzero_v2r8();
206 fiy1 = _fjsp_setzero_v2r8();
207 fiz1 = _fjsp_setzero_v2r8();
208 fix2 = _fjsp_setzero_v2r8();
209 fiy2 = _fjsp_setzero_v2r8();
210 fiz2 = _fjsp_setzero_v2r8();
211 fix3 = _fjsp_setzero_v2r8();
212 fiy3 = _fjsp_setzero_v2r8();
213 fiz3 = _fjsp_setzero_v2r8();
215 /* Reset potential sums */
216 velecsum = _fjsp_setzero_v2r8();
217 vvdwsum = _fjsp_setzero_v2r8();
219 /* Start inner kernel loop */
220 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
223 /* Get j neighbor index, and coordinate index */
226 j_coord_offsetA = DIM*jnrA;
227 j_coord_offsetB = DIM*jnrB;
229 /* load j atom coordinates */
230 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
231 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
232 &jy2,&jz2,&jx3,&jy3,&jz3);
234 /* Calculate displacement vector */
235 dx00 = _fjsp_sub_v2r8(ix0,jx0);
236 dy00 = _fjsp_sub_v2r8(iy0,jy0);
237 dz00 = _fjsp_sub_v2r8(iz0,jz0);
238 dx11 = _fjsp_sub_v2r8(ix1,jx1);
239 dy11 = _fjsp_sub_v2r8(iy1,jy1);
240 dz11 = _fjsp_sub_v2r8(iz1,jz1);
241 dx12 = _fjsp_sub_v2r8(ix1,jx2);
242 dy12 = _fjsp_sub_v2r8(iy1,jy2);
243 dz12 = _fjsp_sub_v2r8(iz1,jz2);
244 dx13 = _fjsp_sub_v2r8(ix1,jx3);
245 dy13 = _fjsp_sub_v2r8(iy1,jy3);
246 dz13 = _fjsp_sub_v2r8(iz1,jz3);
247 dx21 = _fjsp_sub_v2r8(ix2,jx1);
248 dy21 = _fjsp_sub_v2r8(iy2,jy1);
249 dz21 = _fjsp_sub_v2r8(iz2,jz1);
250 dx22 = _fjsp_sub_v2r8(ix2,jx2);
251 dy22 = _fjsp_sub_v2r8(iy2,jy2);
252 dz22 = _fjsp_sub_v2r8(iz2,jz2);
253 dx23 = _fjsp_sub_v2r8(ix2,jx3);
254 dy23 = _fjsp_sub_v2r8(iy2,jy3);
255 dz23 = _fjsp_sub_v2r8(iz2,jz3);
256 dx31 = _fjsp_sub_v2r8(ix3,jx1);
257 dy31 = _fjsp_sub_v2r8(iy3,jy1);
258 dz31 = _fjsp_sub_v2r8(iz3,jz1);
259 dx32 = _fjsp_sub_v2r8(ix3,jx2);
260 dy32 = _fjsp_sub_v2r8(iy3,jy2);
261 dz32 = _fjsp_sub_v2r8(iz3,jz2);
262 dx33 = _fjsp_sub_v2r8(ix3,jx3);
263 dy33 = _fjsp_sub_v2r8(iy3,jy3);
264 dz33 = _fjsp_sub_v2r8(iz3,jz3);
266 /* Calculate squared distance and things based on it */
267 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
268 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
269 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
270 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
271 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
272 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
273 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
274 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
275 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
276 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
278 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
279 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
280 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
281 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
282 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
283 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
284 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
285 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
286 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
288 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
289 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
290 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
291 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
292 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
293 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
294 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
295 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
296 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
297 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
299 fjx0 = _fjsp_setzero_v2r8();
300 fjy0 = _fjsp_setzero_v2r8();
301 fjz0 = _fjsp_setzero_v2r8();
302 fjx1 = _fjsp_setzero_v2r8();
303 fjy1 = _fjsp_setzero_v2r8();
304 fjz1 = _fjsp_setzero_v2r8();
305 fjx2 = _fjsp_setzero_v2r8();
306 fjy2 = _fjsp_setzero_v2r8();
307 fjz2 = _fjsp_setzero_v2r8();
308 fjx3 = _fjsp_setzero_v2r8();
309 fjy3 = _fjsp_setzero_v2r8();
310 fjz3 = _fjsp_setzero_v2r8();
312 /**************************
313 * CALCULATE INTERACTIONS *
314 **************************/
316 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
319 /* LENNARD-JONES DISPERSION/REPULSION */
321 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
322 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
323 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
324 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
325 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
326 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
328 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
330 /* Update potential sum for this i atom from the interaction with this j atom. */
331 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
332 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
336 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
338 /* Update vectorial force */
339 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
340 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
341 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
343 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
344 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
345 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
349 /**************************
350 * CALCULATE INTERACTIONS *
351 **************************/
353 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
356 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
358 /* EWALD ELECTROSTATICS */
360 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
361 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
362 itab_tmp = _fjsp_dtox_v2r8(ewrt);
363 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
364 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
366 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
367 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
368 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
369 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
370 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
371 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
372 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
373 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
374 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
375 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
377 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
379 /* Update potential sum for this i atom from the interaction with this j atom. */
380 velec = _fjsp_and_v2r8(velec,cutoff_mask);
381 velecsum = _fjsp_add_v2r8(velecsum,velec);
385 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
387 /* Update vectorial force */
388 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
389 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
390 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
392 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
393 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
394 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
398 /**************************
399 * CALCULATE INTERACTIONS *
400 **************************/
402 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
405 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
407 /* EWALD ELECTROSTATICS */
409 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
410 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
411 itab_tmp = _fjsp_dtox_v2r8(ewrt);
412 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
413 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
415 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
416 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
417 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
418 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
419 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
420 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
421 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
422 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
423 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
424 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
426 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
428 /* Update potential sum for this i atom from the interaction with this j atom. */
429 velec = _fjsp_and_v2r8(velec,cutoff_mask);
430 velecsum = _fjsp_add_v2r8(velecsum,velec);
434 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
436 /* Update vectorial force */
437 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
438 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
439 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
441 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
442 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
443 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
447 /**************************
448 * CALCULATE INTERACTIONS *
449 **************************/
451 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
454 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
456 /* EWALD ELECTROSTATICS */
458 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
459 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
460 itab_tmp = _fjsp_dtox_v2r8(ewrt);
461 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
462 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
464 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
465 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
466 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
467 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
468 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
469 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
470 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
471 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
472 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
473 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
475 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
477 /* Update potential sum for this i atom from the interaction with this j atom. */
478 velec = _fjsp_and_v2r8(velec,cutoff_mask);
479 velecsum = _fjsp_add_v2r8(velecsum,velec);
483 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
485 /* Update vectorial force */
486 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
487 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
488 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
490 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
491 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
492 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
496 /**************************
497 * CALCULATE INTERACTIONS *
498 **************************/
500 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
503 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
505 /* EWALD ELECTROSTATICS */
507 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
508 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
509 itab_tmp = _fjsp_dtox_v2r8(ewrt);
510 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
511 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
513 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
514 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
515 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
516 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
517 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
518 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
519 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
520 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
521 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
522 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
524 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
526 /* Update potential sum for this i atom from the interaction with this j atom. */
527 velec = _fjsp_and_v2r8(velec,cutoff_mask);
528 velecsum = _fjsp_add_v2r8(velecsum,velec);
532 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
534 /* Update vectorial force */
535 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
536 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
537 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
539 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
540 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
541 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
545 /**************************
546 * CALCULATE INTERACTIONS *
547 **************************/
549 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
552 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
554 /* EWALD ELECTROSTATICS */
556 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
557 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
558 itab_tmp = _fjsp_dtox_v2r8(ewrt);
559 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
560 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
562 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
563 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
564 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
565 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
566 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
567 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
568 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
569 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
570 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
571 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
573 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
575 /* Update potential sum for this i atom from the interaction with this j atom. */
576 velec = _fjsp_and_v2r8(velec,cutoff_mask);
577 velecsum = _fjsp_add_v2r8(velecsum,velec);
581 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
583 /* Update vectorial force */
584 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
585 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
586 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
588 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
589 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
590 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
594 /**************************
595 * CALCULATE INTERACTIONS *
596 **************************/
598 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
601 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
603 /* EWALD ELECTROSTATICS */
605 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
606 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
607 itab_tmp = _fjsp_dtox_v2r8(ewrt);
608 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
609 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
611 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
612 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
613 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
614 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
615 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
616 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
617 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
618 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
619 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
620 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
622 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
624 /* Update potential sum for this i atom from the interaction with this j atom. */
625 velec = _fjsp_and_v2r8(velec,cutoff_mask);
626 velecsum = _fjsp_add_v2r8(velecsum,velec);
630 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
632 /* Update vectorial force */
633 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
634 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
635 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
637 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
638 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
639 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
643 /**************************
644 * CALCULATE INTERACTIONS *
645 **************************/
647 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
650 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
652 /* EWALD ELECTROSTATICS */
654 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
655 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
656 itab_tmp = _fjsp_dtox_v2r8(ewrt);
657 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
658 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
660 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
661 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
662 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
663 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
664 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
665 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
666 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
667 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
668 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
669 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
671 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
673 /* Update potential sum for this i atom from the interaction with this j atom. */
674 velec = _fjsp_and_v2r8(velec,cutoff_mask);
675 velecsum = _fjsp_add_v2r8(velecsum,velec);
679 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
681 /* Update vectorial force */
682 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
683 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
684 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
686 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
687 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
688 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
692 /**************************
693 * CALCULATE INTERACTIONS *
694 **************************/
696 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
699 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
701 /* EWALD ELECTROSTATICS */
703 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
704 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
705 itab_tmp = _fjsp_dtox_v2r8(ewrt);
706 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
707 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
709 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
710 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
711 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
712 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
713 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
714 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
715 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
716 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
717 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
718 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
720 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
722 /* Update potential sum for this i atom from the interaction with this j atom. */
723 velec = _fjsp_and_v2r8(velec,cutoff_mask);
724 velecsum = _fjsp_add_v2r8(velecsum,velec);
728 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
730 /* Update vectorial force */
731 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
732 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
733 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
735 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
736 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
737 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
741 /**************************
742 * CALCULATE INTERACTIONS *
743 **************************/
745 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
748 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
750 /* EWALD ELECTROSTATICS */
752 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
753 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
754 itab_tmp = _fjsp_dtox_v2r8(ewrt);
755 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
756 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
758 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
759 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
760 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
761 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
762 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
763 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
764 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
765 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
766 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
767 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
769 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
771 /* Update potential sum for this i atom from the interaction with this j atom. */
772 velec = _fjsp_and_v2r8(velec,cutoff_mask);
773 velecsum = _fjsp_add_v2r8(velecsum,velec);
777 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
779 /* Update vectorial force */
780 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
781 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
782 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
784 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
785 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
786 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
790 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);
792 /* Inner loop uses 488 flops */
799 j_coord_offsetA = DIM*jnrA;
801 /* load j atom coordinates */
802 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
803 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
804 &jy2,&jz2,&jx3,&jy3,&jz3);
806 /* Calculate displacement vector */
807 dx00 = _fjsp_sub_v2r8(ix0,jx0);
808 dy00 = _fjsp_sub_v2r8(iy0,jy0);
809 dz00 = _fjsp_sub_v2r8(iz0,jz0);
810 dx11 = _fjsp_sub_v2r8(ix1,jx1);
811 dy11 = _fjsp_sub_v2r8(iy1,jy1);
812 dz11 = _fjsp_sub_v2r8(iz1,jz1);
813 dx12 = _fjsp_sub_v2r8(ix1,jx2);
814 dy12 = _fjsp_sub_v2r8(iy1,jy2);
815 dz12 = _fjsp_sub_v2r8(iz1,jz2);
816 dx13 = _fjsp_sub_v2r8(ix1,jx3);
817 dy13 = _fjsp_sub_v2r8(iy1,jy3);
818 dz13 = _fjsp_sub_v2r8(iz1,jz3);
819 dx21 = _fjsp_sub_v2r8(ix2,jx1);
820 dy21 = _fjsp_sub_v2r8(iy2,jy1);
821 dz21 = _fjsp_sub_v2r8(iz2,jz1);
822 dx22 = _fjsp_sub_v2r8(ix2,jx2);
823 dy22 = _fjsp_sub_v2r8(iy2,jy2);
824 dz22 = _fjsp_sub_v2r8(iz2,jz2);
825 dx23 = _fjsp_sub_v2r8(ix2,jx3);
826 dy23 = _fjsp_sub_v2r8(iy2,jy3);
827 dz23 = _fjsp_sub_v2r8(iz2,jz3);
828 dx31 = _fjsp_sub_v2r8(ix3,jx1);
829 dy31 = _fjsp_sub_v2r8(iy3,jy1);
830 dz31 = _fjsp_sub_v2r8(iz3,jz1);
831 dx32 = _fjsp_sub_v2r8(ix3,jx2);
832 dy32 = _fjsp_sub_v2r8(iy3,jy2);
833 dz32 = _fjsp_sub_v2r8(iz3,jz2);
834 dx33 = _fjsp_sub_v2r8(ix3,jx3);
835 dy33 = _fjsp_sub_v2r8(iy3,jy3);
836 dz33 = _fjsp_sub_v2r8(iz3,jz3);
838 /* Calculate squared distance and things based on it */
839 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
840 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
841 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
842 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
843 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
844 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
845 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
846 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
847 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
848 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
850 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
851 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
852 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
853 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
854 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
855 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
856 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
857 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
858 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
860 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
861 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
862 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
863 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
864 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
865 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
866 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
867 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
868 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
869 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
871 fjx0 = _fjsp_setzero_v2r8();
872 fjy0 = _fjsp_setzero_v2r8();
873 fjz0 = _fjsp_setzero_v2r8();
874 fjx1 = _fjsp_setzero_v2r8();
875 fjy1 = _fjsp_setzero_v2r8();
876 fjz1 = _fjsp_setzero_v2r8();
877 fjx2 = _fjsp_setzero_v2r8();
878 fjy2 = _fjsp_setzero_v2r8();
879 fjz2 = _fjsp_setzero_v2r8();
880 fjx3 = _fjsp_setzero_v2r8();
881 fjy3 = _fjsp_setzero_v2r8();
882 fjz3 = _fjsp_setzero_v2r8();
884 /**************************
885 * CALCULATE INTERACTIONS *
886 **************************/
888 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
891 /* LENNARD-JONES DISPERSION/REPULSION */
893 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
894 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
895 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
896 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
897 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
898 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
900 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
902 /* Update potential sum for this i atom from the interaction with this j atom. */
903 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
904 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
905 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
909 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
911 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
913 /* Update vectorial force */
914 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
915 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
916 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
918 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
919 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
920 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
924 /**************************
925 * CALCULATE INTERACTIONS *
926 **************************/
928 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
931 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
933 /* EWALD ELECTROSTATICS */
935 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
936 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
937 itab_tmp = _fjsp_dtox_v2r8(ewrt);
938 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
939 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
941 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
942 ewtabD = _fjsp_setzero_v2r8();
943 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
944 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
945 ewtabFn = _fjsp_setzero_v2r8();
946 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
947 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
948 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
949 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
950 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
952 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
954 /* Update potential sum for this i atom from the interaction with this j atom. */
955 velec = _fjsp_and_v2r8(velec,cutoff_mask);
956 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
957 velecsum = _fjsp_add_v2r8(velecsum,velec);
961 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
963 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
965 /* Update vectorial force */
966 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
967 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
968 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
970 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
971 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
972 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
976 /**************************
977 * CALCULATE INTERACTIONS *
978 **************************/
980 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
983 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
985 /* EWALD ELECTROSTATICS */
987 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
988 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
989 itab_tmp = _fjsp_dtox_v2r8(ewrt);
990 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
991 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
993 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
994 ewtabD = _fjsp_setzero_v2r8();
995 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
996 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
997 ewtabFn = _fjsp_setzero_v2r8();
998 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
999 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1000 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1001 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
1002 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1004 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1006 /* Update potential sum for this i atom from the interaction with this j atom. */
1007 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1008 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1009 velecsum = _fjsp_add_v2r8(velecsum,velec);
1013 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1015 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1017 /* Update vectorial force */
1018 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1019 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1020 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1022 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1023 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1024 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1028 /**************************
1029 * CALCULATE INTERACTIONS *
1030 **************************/
1032 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1035 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
1037 /* EWALD ELECTROSTATICS */
1039 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1040 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
1041 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1042 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1043 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1045 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1046 ewtabD = _fjsp_setzero_v2r8();
1047 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1048 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1049 ewtabFn = _fjsp_setzero_v2r8();
1050 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1051 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1052 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1053 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
1054 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1056 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1058 /* Update potential sum for this i atom from the interaction with this j atom. */
1059 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1060 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1061 velecsum = _fjsp_add_v2r8(velecsum,velec);
1065 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1067 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1069 /* Update vectorial force */
1070 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1071 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1072 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1074 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1075 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1076 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1080 /**************************
1081 * CALCULATE INTERACTIONS *
1082 **************************/
1084 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1087 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
1089 /* EWALD ELECTROSTATICS */
1091 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1092 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
1093 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1094 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1095 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1097 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1098 ewtabD = _fjsp_setzero_v2r8();
1099 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1100 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1101 ewtabFn = _fjsp_setzero_v2r8();
1102 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1103 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1104 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1105 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
1106 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1108 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1110 /* Update potential sum for this i atom from the interaction with this j atom. */
1111 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1112 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1113 velecsum = _fjsp_add_v2r8(velecsum,velec);
1117 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1119 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1121 /* Update vectorial force */
1122 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1123 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1124 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1126 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1127 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1128 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1132 /**************************
1133 * CALCULATE INTERACTIONS *
1134 **************************/
1136 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1139 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
1141 /* EWALD ELECTROSTATICS */
1143 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1144 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
1145 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1146 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1147 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1149 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1150 ewtabD = _fjsp_setzero_v2r8();
1151 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1152 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1153 ewtabFn = _fjsp_setzero_v2r8();
1154 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1155 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1156 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1157 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
1158 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1160 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1162 /* Update potential sum for this i atom from the interaction with this j atom. */
1163 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1164 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1165 velecsum = _fjsp_add_v2r8(velecsum,velec);
1169 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1171 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1173 /* Update vectorial force */
1174 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1175 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1176 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1178 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1179 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1180 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1184 /**************************
1185 * CALCULATE INTERACTIONS *
1186 **************************/
1188 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1191 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
1193 /* EWALD ELECTROSTATICS */
1195 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1196 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
1197 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1198 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1199 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1201 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1202 ewtabD = _fjsp_setzero_v2r8();
1203 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1204 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1205 ewtabFn = _fjsp_setzero_v2r8();
1206 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1207 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1208 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1209 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
1210 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1212 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1214 /* Update potential sum for this i atom from the interaction with this j atom. */
1215 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1216 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1217 velecsum = _fjsp_add_v2r8(velecsum,velec);
1221 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1223 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1225 /* Update vectorial force */
1226 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1227 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1228 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1230 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1231 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1232 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1236 /**************************
1237 * CALCULATE INTERACTIONS *
1238 **************************/
1240 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1243 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
1245 /* EWALD ELECTROSTATICS */
1247 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1248 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
1249 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1250 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1251 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1253 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1254 ewtabD = _fjsp_setzero_v2r8();
1255 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1256 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1257 ewtabFn = _fjsp_setzero_v2r8();
1258 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1259 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1260 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1261 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
1262 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1264 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1266 /* Update potential sum for this i atom from the interaction with this j atom. */
1267 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1268 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1269 velecsum = _fjsp_add_v2r8(velecsum,velec);
1273 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1275 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1277 /* Update vectorial force */
1278 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1279 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1280 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1282 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1283 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1284 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1288 /**************************
1289 * CALCULATE INTERACTIONS *
1290 **************************/
1292 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1295 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
1297 /* EWALD ELECTROSTATICS */
1299 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1300 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
1301 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1302 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1303 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1305 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1306 ewtabD = _fjsp_setzero_v2r8();
1307 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1308 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1309 ewtabFn = _fjsp_setzero_v2r8();
1310 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1311 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1312 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1313 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
1314 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
1316 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
1318 /* Update potential sum for this i atom from the interaction with this j atom. */
1319 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1320 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1321 velecsum = _fjsp_add_v2r8(velecsum,velec);
1325 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1327 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1329 /* Update vectorial force */
1330 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1331 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1332 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1334 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1335 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1336 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1340 /**************************
1341 * CALCULATE INTERACTIONS *
1342 **************************/
1344 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
1347 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
1349 /* EWALD ELECTROSTATICS */
1351 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1352 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
1353 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1354 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1355 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1357 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1358 ewtabD = _fjsp_setzero_v2r8();
1359 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1360 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1361 ewtabFn = _fjsp_setzero_v2r8();
1362 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1363 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1364 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1365 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
1366 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
1368 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
1370 /* Update potential sum for this i atom from the interaction with this j atom. */
1371 velec = _fjsp_and_v2r8(velec,cutoff_mask);
1372 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1373 velecsum = _fjsp_add_v2r8(velecsum,velec);
1377 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1379 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1381 /* Update vectorial force */
1382 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1383 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1384 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1386 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1387 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1388 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1392 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1394 /* Inner loop uses 488 flops */
1397 /* End of innermost loop */
1399 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1400 f+i_coord_offset,fshift+i_shift_offset);
1403 /* Update potential energies */
1404 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
1405 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
1407 /* Increment number of inner iterations */
1408 inneriter += j_index_end - j_index_start;
1410 /* Outer loop uses 26 flops */
1413 /* Increment number of outer iterations */
1416 /* Update outer/inner flops */
1418 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*488);
1421 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1422 * Electrostatics interaction: Ewald
1423 * VdW interaction: LennardJones
1424 * Geometry: Water4-Water4
1425 * Calculate force/pot: Force
1428 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1429 (t_nblist * gmx_restrict nlist,
1430 rvec * gmx_restrict xx,
1431 rvec * gmx_restrict ff,
1432 t_forcerec * gmx_restrict fr,
1433 t_mdatoms * gmx_restrict mdatoms,
1434 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
1435 t_nrnb * gmx_restrict nrnb)
1437 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1438 * just 0 for non-waters.
1439 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
1440 * jnr indices corresponding to data put in the four positions in the SIMD register.
1442 int i_shift_offset,i_coord_offset,outeriter,inneriter;
1443 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1445 int j_coord_offsetA,j_coord_offsetB;
1446 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
1447 real rcutoff_scalar;
1448 real *shiftvec,*fshift,*x,*f;
1449 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
1451 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1453 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1455 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1457 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
1458 int vdwjidx0A,vdwjidx0B;
1459 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1460 int vdwjidx1A,vdwjidx1B;
1461 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1462 int vdwjidx2A,vdwjidx2B;
1463 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1464 int vdwjidx3A,vdwjidx3B;
1465 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
1466 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1467 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1468 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1469 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
1470 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1471 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1472 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
1473 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
1474 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
1475 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
1476 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
1479 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1482 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
1483 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1484 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
1486 _fjsp_v2r8 itab_tmp;
1487 _fjsp_v2r8 dummy_mask,cutoff_mask;
1488 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
1489 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
1490 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1497 jindex = nlist->jindex;
1499 shiftidx = nlist->shift;
1501 shiftvec = fr->shift_vec[0];
1502 fshift = fr->fshift[0];
1503 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
1504 charge = mdatoms->chargeA;
1505 nvdwtype = fr->ntype;
1506 vdwparam = fr->nbfp;
1507 vdwtype = mdatoms->typeA;
1509 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
1510 ewtab = fr->ic->tabq_coul_F;
1511 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
1512 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
1514 /* Setup water-specific parameters */
1515 inr = nlist->iinr[0];
1516 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1517 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1518 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
1519 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
1521 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
1522 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
1523 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
1524 vdwjidx0A = 2*vdwtype[inr+0];
1525 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1526 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1527 qq11 = _fjsp_mul_v2r8(iq1,jq1);
1528 qq12 = _fjsp_mul_v2r8(iq1,jq2);
1529 qq13 = _fjsp_mul_v2r8(iq1,jq3);
1530 qq21 = _fjsp_mul_v2r8(iq2,jq1);
1531 qq22 = _fjsp_mul_v2r8(iq2,jq2);
1532 qq23 = _fjsp_mul_v2r8(iq2,jq3);
1533 qq31 = _fjsp_mul_v2r8(iq3,jq1);
1534 qq32 = _fjsp_mul_v2r8(iq3,jq2);
1535 qq33 = _fjsp_mul_v2r8(iq3,jq3);
1537 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
1538 rcutoff_scalar = fr->rcoulomb;
1539 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
1540 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
1542 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
1543 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
1545 /* Avoid stupid compiler warnings */
1547 j_coord_offsetA = 0;
1548 j_coord_offsetB = 0;
1553 /* Start outer loop over neighborlists */
1554 for(iidx=0; iidx<nri; iidx++)
1556 /* Load shift vector for this list */
1557 i_shift_offset = DIM*shiftidx[iidx];
1559 /* Load limits for loop over neighbors */
1560 j_index_start = jindex[iidx];
1561 j_index_end = jindex[iidx+1];
1563 /* Get outer coordinate index */
1565 i_coord_offset = DIM*inr;
1567 /* Load i particle coords and add shift vector */
1568 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1569 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1571 fix0 = _fjsp_setzero_v2r8();
1572 fiy0 = _fjsp_setzero_v2r8();
1573 fiz0 = _fjsp_setzero_v2r8();
1574 fix1 = _fjsp_setzero_v2r8();
1575 fiy1 = _fjsp_setzero_v2r8();
1576 fiz1 = _fjsp_setzero_v2r8();
1577 fix2 = _fjsp_setzero_v2r8();
1578 fiy2 = _fjsp_setzero_v2r8();
1579 fiz2 = _fjsp_setzero_v2r8();
1580 fix3 = _fjsp_setzero_v2r8();
1581 fiy3 = _fjsp_setzero_v2r8();
1582 fiz3 = _fjsp_setzero_v2r8();
1584 /* Start inner kernel loop */
1585 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1588 /* Get j neighbor index, and coordinate index */
1590 jnrB = jjnr[jidx+1];
1591 j_coord_offsetA = DIM*jnrA;
1592 j_coord_offsetB = DIM*jnrB;
1594 /* load j atom coordinates */
1595 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1596 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1597 &jy2,&jz2,&jx3,&jy3,&jz3);
1599 /* Calculate displacement vector */
1600 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1601 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1602 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1603 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1604 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1605 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1606 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1607 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1608 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1609 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1610 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1611 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1612 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1613 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1614 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1615 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1616 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1617 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1618 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1619 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1620 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1621 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1622 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1623 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1624 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1625 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1626 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1627 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1628 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1629 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1631 /* Calculate squared distance and things based on it */
1632 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1633 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1634 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1635 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1636 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1637 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1638 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1639 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1640 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1641 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1643 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1644 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1645 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1646 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1647 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1648 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1649 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1650 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1651 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1653 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1654 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1655 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1656 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1657 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1658 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1659 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1660 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1661 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1662 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1664 fjx0 = _fjsp_setzero_v2r8();
1665 fjy0 = _fjsp_setzero_v2r8();
1666 fjz0 = _fjsp_setzero_v2r8();
1667 fjx1 = _fjsp_setzero_v2r8();
1668 fjy1 = _fjsp_setzero_v2r8();
1669 fjz1 = _fjsp_setzero_v2r8();
1670 fjx2 = _fjsp_setzero_v2r8();
1671 fjy2 = _fjsp_setzero_v2r8();
1672 fjz2 = _fjsp_setzero_v2r8();
1673 fjx3 = _fjsp_setzero_v2r8();
1674 fjy3 = _fjsp_setzero_v2r8();
1675 fjz3 = _fjsp_setzero_v2r8();
1677 /**************************
1678 * CALCULATE INTERACTIONS *
1679 **************************/
1681 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1684 /* LENNARD-JONES DISPERSION/REPULSION */
1686 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1687 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1689 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1693 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1695 /* Update vectorial force */
1696 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1697 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1698 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1700 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1701 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1702 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1706 /**************************
1707 * CALCULATE INTERACTIONS *
1708 **************************/
1710 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
1713 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
1715 /* EWALD ELECTROSTATICS */
1717 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1718 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
1719 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1720 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1721 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1723 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1725 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1726 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
1728 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
1732 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1734 /* Update vectorial force */
1735 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1736 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1737 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1739 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1740 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1741 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1745 /**************************
1746 * CALCULATE INTERACTIONS *
1747 **************************/
1749 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
1752 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
1754 /* EWALD ELECTROSTATICS */
1756 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1757 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
1758 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1759 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1760 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1762 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1764 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1765 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1767 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1771 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1773 /* Update vectorial force */
1774 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1775 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1776 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1778 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1779 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1780 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1784 /**************************
1785 * CALCULATE INTERACTIONS *
1786 **************************/
1788 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1791 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
1793 /* EWALD ELECTROSTATICS */
1795 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1796 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
1797 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1798 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1799 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1801 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1803 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1804 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1806 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1810 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1812 /* Update vectorial force */
1813 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1814 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1815 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1817 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1818 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1819 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1823 /**************************
1824 * CALCULATE INTERACTIONS *
1825 **************************/
1827 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1830 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
1832 /* EWALD ELECTROSTATICS */
1834 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1835 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
1836 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1837 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1838 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1840 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1842 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1843 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1845 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1849 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1851 /* Update vectorial force */
1852 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1853 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1854 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1856 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1857 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1858 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1862 /**************************
1863 * CALCULATE INTERACTIONS *
1864 **************************/
1866 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1869 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
1871 /* EWALD ELECTROSTATICS */
1873 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1874 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
1875 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1876 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1877 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1879 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1881 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1882 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1884 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1888 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1890 /* Update vectorial force */
1891 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1892 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1893 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1895 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1896 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1897 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1901 /**************************
1902 * CALCULATE INTERACTIONS *
1903 **************************/
1905 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1908 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
1910 /* EWALD ELECTROSTATICS */
1912 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1913 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
1914 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1915 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1916 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1918 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1920 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1921 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1923 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1927 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1929 /* Update vectorial force */
1930 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1931 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1932 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1934 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1935 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1936 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1940 /**************************
1941 * CALCULATE INTERACTIONS *
1942 **************************/
1944 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1947 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
1949 /* EWALD ELECTROSTATICS */
1951 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1952 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
1953 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1954 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1955 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1957 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1959 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1960 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1962 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1966 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1968 /* Update vectorial force */
1969 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1970 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1971 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1973 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1974 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1975 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1979 /**************************
1980 * CALCULATE INTERACTIONS *
1981 **************************/
1983 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1986 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
1988 /* EWALD ELECTROSTATICS */
1990 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1991 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
1992 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1993 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1994 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1996 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1998 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1999 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
2001 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2005 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2007 /* Update vectorial force */
2008 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
2009 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2010 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2012 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2013 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2014 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2018 /**************************
2019 * CALCULATE INTERACTIONS *
2020 **************************/
2022 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2025 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
2027 /* EWALD ELECTROSTATICS */
2029 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2030 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
2031 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2032 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2033 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2035 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
2037 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2038 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2040 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2044 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2046 /* Update vectorial force */
2047 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
2048 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2049 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2051 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2052 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2053 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2057 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);
2059 /* Inner loop uses 414 flops */
2062 if(jidx<j_index_end)
2066 j_coord_offsetA = DIM*jnrA;
2068 /* load j atom coordinates */
2069 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
2070 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
2071 &jy2,&jz2,&jx3,&jy3,&jz3);
2073 /* Calculate displacement vector */
2074 dx00 = _fjsp_sub_v2r8(ix0,jx0);
2075 dy00 = _fjsp_sub_v2r8(iy0,jy0);
2076 dz00 = _fjsp_sub_v2r8(iz0,jz0);
2077 dx11 = _fjsp_sub_v2r8(ix1,jx1);
2078 dy11 = _fjsp_sub_v2r8(iy1,jy1);
2079 dz11 = _fjsp_sub_v2r8(iz1,jz1);
2080 dx12 = _fjsp_sub_v2r8(ix1,jx2);
2081 dy12 = _fjsp_sub_v2r8(iy1,jy2);
2082 dz12 = _fjsp_sub_v2r8(iz1,jz2);
2083 dx13 = _fjsp_sub_v2r8(ix1,jx3);
2084 dy13 = _fjsp_sub_v2r8(iy1,jy3);
2085 dz13 = _fjsp_sub_v2r8(iz1,jz3);
2086 dx21 = _fjsp_sub_v2r8(ix2,jx1);
2087 dy21 = _fjsp_sub_v2r8(iy2,jy1);
2088 dz21 = _fjsp_sub_v2r8(iz2,jz1);
2089 dx22 = _fjsp_sub_v2r8(ix2,jx2);
2090 dy22 = _fjsp_sub_v2r8(iy2,jy2);
2091 dz22 = _fjsp_sub_v2r8(iz2,jz2);
2092 dx23 = _fjsp_sub_v2r8(ix2,jx3);
2093 dy23 = _fjsp_sub_v2r8(iy2,jy3);
2094 dz23 = _fjsp_sub_v2r8(iz2,jz3);
2095 dx31 = _fjsp_sub_v2r8(ix3,jx1);
2096 dy31 = _fjsp_sub_v2r8(iy3,jy1);
2097 dz31 = _fjsp_sub_v2r8(iz3,jz1);
2098 dx32 = _fjsp_sub_v2r8(ix3,jx2);
2099 dy32 = _fjsp_sub_v2r8(iy3,jy2);
2100 dz32 = _fjsp_sub_v2r8(iz3,jz2);
2101 dx33 = _fjsp_sub_v2r8(ix3,jx3);
2102 dy33 = _fjsp_sub_v2r8(iy3,jy3);
2103 dz33 = _fjsp_sub_v2r8(iz3,jz3);
2105 /* Calculate squared distance and things based on it */
2106 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
2107 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
2108 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
2109 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
2110 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
2111 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
2112 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
2113 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
2114 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
2115 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
2117 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
2118 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
2119 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
2120 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
2121 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
2122 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
2123 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
2124 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
2125 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
2127 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
2128 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
2129 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
2130 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
2131 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
2132 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
2133 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
2134 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
2135 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
2136 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
2138 fjx0 = _fjsp_setzero_v2r8();
2139 fjy0 = _fjsp_setzero_v2r8();
2140 fjz0 = _fjsp_setzero_v2r8();
2141 fjx1 = _fjsp_setzero_v2r8();
2142 fjy1 = _fjsp_setzero_v2r8();
2143 fjz1 = _fjsp_setzero_v2r8();
2144 fjx2 = _fjsp_setzero_v2r8();
2145 fjy2 = _fjsp_setzero_v2r8();
2146 fjz2 = _fjsp_setzero_v2r8();
2147 fjx3 = _fjsp_setzero_v2r8();
2148 fjy3 = _fjsp_setzero_v2r8();
2149 fjz3 = _fjsp_setzero_v2r8();
2151 /**************************
2152 * CALCULATE INTERACTIONS *
2153 **************************/
2155 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
2158 /* LENNARD-JONES DISPERSION/REPULSION */
2160 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
2161 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
2163 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
2167 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2169 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2171 /* Update vectorial force */
2172 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
2173 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
2174 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
2176 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
2177 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
2178 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
2182 /**************************
2183 * CALCULATE INTERACTIONS *
2184 **************************/
2186 if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
2189 r11 = _fjsp_mul_v2r8(rsq11,rinv11);
2191 /* EWALD ELECTROSTATICS */
2193 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2194 ewrt = _fjsp_mul_v2r8(r11,ewtabscale);
2195 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2196 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2197 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2199 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2200 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2201 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
2203 cutoff_mask = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
2207 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2209 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2211 /* Update vectorial force */
2212 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
2213 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
2214 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
2216 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
2217 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
2218 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
2222 /**************************
2223 * CALCULATE INTERACTIONS *
2224 **************************/
2226 if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
2229 r12 = _fjsp_mul_v2r8(rsq12,rinv12);
2231 /* EWALD ELECTROSTATICS */
2233 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2234 ewrt = _fjsp_mul_v2r8(r12,ewtabscale);
2235 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2236 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2237 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2239 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2240 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2241 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
2243 cutoff_mask = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
2247 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2249 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2251 /* Update vectorial force */
2252 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
2253 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
2254 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
2256 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
2257 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
2258 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
2262 /**************************
2263 * CALCULATE INTERACTIONS *
2264 **************************/
2266 if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
2269 r13 = _fjsp_mul_v2r8(rsq13,rinv13);
2271 /* EWALD ELECTROSTATICS */
2273 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2274 ewrt = _fjsp_mul_v2r8(r13,ewtabscale);
2275 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2276 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2277 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2279 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2280 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2281 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
2283 cutoff_mask = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
2287 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2289 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2291 /* Update vectorial force */
2292 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
2293 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
2294 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
2296 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
2297 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
2298 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
2302 /**************************
2303 * CALCULATE INTERACTIONS *
2304 **************************/
2306 if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
2309 r21 = _fjsp_mul_v2r8(rsq21,rinv21);
2311 /* EWALD ELECTROSTATICS */
2313 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2314 ewrt = _fjsp_mul_v2r8(r21,ewtabscale);
2315 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2316 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2317 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2319 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2320 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2321 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
2323 cutoff_mask = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
2327 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2329 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2331 /* Update vectorial force */
2332 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
2333 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
2334 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
2336 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
2337 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
2338 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
2342 /**************************
2343 * CALCULATE INTERACTIONS *
2344 **************************/
2346 if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
2349 r22 = _fjsp_mul_v2r8(rsq22,rinv22);
2351 /* EWALD ELECTROSTATICS */
2353 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2354 ewrt = _fjsp_mul_v2r8(r22,ewtabscale);
2355 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2356 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2357 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2359 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2360 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2361 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
2363 cutoff_mask = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
2367 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2369 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2371 /* Update vectorial force */
2372 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
2373 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
2374 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
2376 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
2377 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
2378 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
2382 /**************************
2383 * CALCULATE INTERACTIONS *
2384 **************************/
2386 if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
2389 r23 = _fjsp_mul_v2r8(rsq23,rinv23);
2391 /* EWALD ELECTROSTATICS */
2393 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2394 ewrt = _fjsp_mul_v2r8(r23,ewtabscale);
2395 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2396 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2397 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2399 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2400 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2401 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
2403 cutoff_mask = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
2407 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2409 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2411 /* Update vectorial force */
2412 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
2413 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
2414 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
2416 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
2417 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
2418 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
2422 /**************************
2423 * CALCULATE INTERACTIONS *
2424 **************************/
2426 if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
2429 r31 = _fjsp_mul_v2r8(rsq31,rinv31);
2431 /* EWALD ELECTROSTATICS */
2433 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2434 ewrt = _fjsp_mul_v2r8(r31,ewtabscale);
2435 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2436 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2437 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2439 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2440 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2441 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
2443 cutoff_mask = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
2447 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2449 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2451 /* Update vectorial force */
2452 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
2453 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
2454 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
2456 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
2457 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
2458 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
2462 /**************************
2463 * CALCULATE INTERACTIONS *
2464 **************************/
2466 if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
2469 r32 = _fjsp_mul_v2r8(rsq32,rinv32);
2471 /* EWALD ELECTROSTATICS */
2473 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2474 ewrt = _fjsp_mul_v2r8(r32,ewtabscale);
2475 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2476 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2477 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2479 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2480 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2481 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
2483 cutoff_mask = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2487 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2489 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2491 /* Update vectorial force */
2492 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
2493 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2494 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2496 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2497 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2498 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2502 /**************************
2503 * CALCULATE INTERACTIONS *
2504 **************************/
2506 if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2509 r33 = _fjsp_mul_v2r8(rsq33,rinv33);
2511 /* EWALD ELECTROSTATICS */
2513 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2514 ewrt = _fjsp_mul_v2r8(r33,ewtabscale);
2515 itab_tmp = _fjsp_dtox_v2r8(ewrt);
2516 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2517 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2519 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2520 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2521 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2523 cutoff_mask = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2527 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
2529 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2531 /* Update vectorial force */
2532 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
2533 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2534 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2536 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2537 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2538 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2542 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
2544 /* Inner loop uses 414 flops */
2547 /* End of innermost loop */
2549 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
2550 f+i_coord_offset,fshift+i_shift_offset);
2552 /* Increment number of inner iterations */
2553 inneriter += j_index_end - j_index_start;
2555 /* Outer loop uses 24 flops */
2558 /* Increment number of outer iterations */
2561 /* Update outer/inner flops */
2563 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*414);