2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
121 charge = mdatoms->chargeA;
122 nvdwtype = fr->ntype;
124 vdwtype = mdatoms->typeA;
126 vftab = kernel_data->table_elec->data;
127 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
129 /* Setup water-specific parameters */
130 inr = nlist->iinr[0];
131 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
132 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
133 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
134 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
136 /* Avoid stupid compiler warnings */
144 /* Start outer loop over neighborlists */
145 for(iidx=0; iidx<nri; iidx++)
147 /* Load shift vector for this list */
148 i_shift_offset = DIM*shiftidx[iidx];
150 /* Load limits for loop over neighbors */
151 j_index_start = jindex[iidx];
152 j_index_end = jindex[iidx+1];
154 /* Get outer coordinate index */
156 i_coord_offset = DIM*inr;
158 /* Load i particle coords and add shift vector */
159 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
160 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
162 fix0 = _fjsp_setzero_v2r8();
163 fiy0 = _fjsp_setzero_v2r8();
164 fiz0 = _fjsp_setzero_v2r8();
165 fix1 = _fjsp_setzero_v2r8();
166 fiy1 = _fjsp_setzero_v2r8();
167 fiz1 = _fjsp_setzero_v2r8();
168 fix2 = _fjsp_setzero_v2r8();
169 fiy2 = _fjsp_setzero_v2r8();
170 fiz2 = _fjsp_setzero_v2r8();
171 fix3 = _fjsp_setzero_v2r8();
172 fiy3 = _fjsp_setzero_v2r8();
173 fiz3 = _fjsp_setzero_v2r8();
175 /* Reset potential sums */
176 velecsum = _fjsp_setzero_v2r8();
177 vvdwsum = _fjsp_setzero_v2r8();
179 /* Start inner kernel loop */
180 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
183 /* Get j neighbor index, and coordinate index */
186 j_coord_offsetA = DIM*jnrA;
187 j_coord_offsetB = DIM*jnrB;
189 /* load j atom coordinates */
190 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
193 /* Calculate displacement vector */
194 dx00 = _fjsp_sub_v2r8(ix0,jx0);
195 dy00 = _fjsp_sub_v2r8(iy0,jy0);
196 dz00 = _fjsp_sub_v2r8(iz0,jz0);
197 dx10 = _fjsp_sub_v2r8(ix1,jx0);
198 dy10 = _fjsp_sub_v2r8(iy1,jy0);
199 dz10 = _fjsp_sub_v2r8(iz1,jz0);
200 dx20 = _fjsp_sub_v2r8(ix2,jx0);
201 dy20 = _fjsp_sub_v2r8(iy2,jy0);
202 dz20 = _fjsp_sub_v2r8(iz2,jz0);
203 dx30 = _fjsp_sub_v2r8(ix3,jx0);
204 dy30 = _fjsp_sub_v2r8(iy3,jy0);
205 dz30 = _fjsp_sub_v2r8(iz3,jz0);
207 /* Calculate squared distance and things based on it */
208 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
209 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
210 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
211 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
213 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
214 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
215 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
217 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
219 /* Load parameters for j particles */
220 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
221 vdwjidx0A = 2*vdwtype[jnrA+0];
222 vdwjidx0B = 2*vdwtype[jnrB+0];
224 fjx0 = _fjsp_setzero_v2r8();
225 fjy0 = _fjsp_setzero_v2r8();
226 fjz0 = _fjsp_setzero_v2r8();
228 /**************************
229 * CALCULATE INTERACTIONS *
230 **************************/
232 /* Compute parameters for interactions between i and j atoms */
233 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
234 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
236 /* LENNARD-JONES DISPERSION/REPULSION */
238 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
239 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
240 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
241 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
242 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
244 /* Update potential sum for this i atom from the interaction with this j atom. */
245 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
249 /* Update vectorial force */
250 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
251 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
252 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
254 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
255 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
256 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
258 /**************************
259 * CALCULATE INTERACTIONS *
260 **************************/
262 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
264 /* Compute parameters for interactions between i and j atoms */
265 qq10 = _fjsp_mul_v2r8(iq1,jq0);
267 /* Calculate table index by multiplying r with table scale and truncate to integer */
268 rt = _fjsp_mul_v2r8(r10,vftabscale);
269 itab_tmp = _fjsp_dtox_v2r8(rt);
270 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
271 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
272 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
277 /* CUBIC SPLINE TABLE ELECTROSTATICS */
278 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
279 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
280 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
281 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
282 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
283 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
284 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
285 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
286 velec = _fjsp_mul_v2r8(qq10,VV);
287 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
288 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
290 /* Update potential sum for this i atom from the interaction with this j atom. */
291 velecsum = _fjsp_add_v2r8(velecsum,velec);
295 /* Update vectorial force */
296 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
297 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
298 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
300 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
301 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
302 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
310 /* Compute parameters for interactions between i and j atoms */
311 qq20 = _fjsp_mul_v2r8(iq2,jq0);
313 /* Calculate table index by multiplying r with table scale and truncate to integer */
314 rt = _fjsp_mul_v2r8(r20,vftabscale);
315 itab_tmp = _fjsp_dtox_v2r8(rt);
316 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
317 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
318 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
323 /* CUBIC SPLINE TABLE ELECTROSTATICS */
324 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
325 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
326 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
327 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
328 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
329 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
330 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
331 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
332 velec = _fjsp_mul_v2r8(qq20,VV);
333 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
334 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
336 /* Update potential sum for this i atom from the interaction with this j atom. */
337 velecsum = _fjsp_add_v2r8(velecsum,velec);
341 /* Update vectorial force */
342 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
343 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
344 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
346 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
347 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
348 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
350 /**************************
351 * CALCULATE INTERACTIONS *
352 **************************/
354 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
356 /* Compute parameters for interactions between i and j atoms */
357 qq30 = _fjsp_mul_v2r8(iq3,jq0);
359 /* Calculate table index by multiplying r with table scale and truncate to integer */
360 rt = _fjsp_mul_v2r8(r30,vftabscale);
361 itab_tmp = _fjsp_dtox_v2r8(rt);
362 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
363 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
364 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
369 /* CUBIC SPLINE TABLE ELECTROSTATICS */
370 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
371 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
372 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
373 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
374 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
375 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
376 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
377 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
378 velec = _fjsp_mul_v2r8(qq30,VV);
379 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
380 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
382 /* Update potential sum for this i atom from the interaction with this j atom. */
383 velecsum = _fjsp_add_v2r8(velecsum,velec);
387 /* Update vectorial force */
388 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
389 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
390 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
392 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
393 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
394 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
396 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
398 /* Inner loop uses 176 flops */
405 j_coord_offsetA = DIM*jnrA;
407 /* load j atom coordinates */
408 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
411 /* Calculate displacement vector */
412 dx00 = _fjsp_sub_v2r8(ix0,jx0);
413 dy00 = _fjsp_sub_v2r8(iy0,jy0);
414 dz00 = _fjsp_sub_v2r8(iz0,jz0);
415 dx10 = _fjsp_sub_v2r8(ix1,jx0);
416 dy10 = _fjsp_sub_v2r8(iy1,jy0);
417 dz10 = _fjsp_sub_v2r8(iz1,jz0);
418 dx20 = _fjsp_sub_v2r8(ix2,jx0);
419 dy20 = _fjsp_sub_v2r8(iy2,jy0);
420 dz20 = _fjsp_sub_v2r8(iz2,jz0);
421 dx30 = _fjsp_sub_v2r8(ix3,jx0);
422 dy30 = _fjsp_sub_v2r8(iy3,jy0);
423 dz30 = _fjsp_sub_v2r8(iz3,jz0);
425 /* Calculate squared distance and things based on it */
426 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
427 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
428 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
429 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
431 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
432 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
433 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
435 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
437 /* Load parameters for j particles */
438 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
439 vdwjidx0A = 2*vdwtype[jnrA+0];
441 fjx0 = _fjsp_setzero_v2r8();
442 fjy0 = _fjsp_setzero_v2r8();
443 fjz0 = _fjsp_setzero_v2r8();
445 /**************************
446 * CALCULATE INTERACTIONS *
447 **************************/
449 /* Compute parameters for interactions between i and j atoms */
450 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
451 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
453 /* LENNARD-JONES DISPERSION/REPULSION */
455 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
456 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
457 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
458 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
459 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
461 /* Update potential sum for this i atom from the interaction with this j atom. */
462 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
463 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
467 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
469 /* Update vectorial force */
470 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
471 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
472 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
474 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
475 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
476 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
478 /**************************
479 * CALCULATE INTERACTIONS *
480 **************************/
482 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
484 /* Compute parameters for interactions between i and j atoms */
485 qq10 = _fjsp_mul_v2r8(iq1,jq0);
487 /* Calculate table index by multiplying r with table scale and truncate to integer */
488 rt = _fjsp_mul_v2r8(r10,vftabscale);
489 itab_tmp = _fjsp_dtox_v2r8(rt);
490 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
491 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
492 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
497 /* CUBIC SPLINE TABLE ELECTROSTATICS */
498 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
499 F = _fjsp_setzero_v2r8();
500 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
501 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
502 H = _fjsp_setzero_v2r8();
503 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
504 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
505 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
506 velec = _fjsp_mul_v2r8(qq10,VV);
507 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
508 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
510 /* Update potential sum for this i atom from the interaction with this j atom. */
511 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
512 velecsum = _fjsp_add_v2r8(velecsum,velec);
516 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
518 /* Update vectorial force */
519 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
520 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
521 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
523 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
524 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
525 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
527 /**************************
528 * CALCULATE INTERACTIONS *
529 **************************/
531 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
533 /* Compute parameters for interactions between i and j atoms */
534 qq20 = _fjsp_mul_v2r8(iq2,jq0);
536 /* Calculate table index by multiplying r with table scale and truncate to integer */
537 rt = _fjsp_mul_v2r8(r20,vftabscale);
538 itab_tmp = _fjsp_dtox_v2r8(rt);
539 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
540 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
541 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
546 /* CUBIC SPLINE TABLE ELECTROSTATICS */
547 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
548 F = _fjsp_setzero_v2r8();
549 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
550 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
551 H = _fjsp_setzero_v2r8();
552 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
553 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
554 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
555 velec = _fjsp_mul_v2r8(qq20,VV);
556 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
557 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
559 /* Update potential sum for this i atom from the interaction with this j atom. */
560 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
561 velecsum = _fjsp_add_v2r8(velecsum,velec);
565 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
567 /* Update vectorial force */
568 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
569 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
570 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
572 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
573 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
574 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
576 /**************************
577 * CALCULATE INTERACTIONS *
578 **************************/
580 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
582 /* Compute parameters for interactions between i and j atoms */
583 qq30 = _fjsp_mul_v2r8(iq3,jq0);
585 /* Calculate table index by multiplying r with table scale and truncate to integer */
586 rt = _fjsp_mul_v2r8(r30,vftabscale);
587 itab_tmp = _fjsp_dtox_v2r8(rt);
588 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
589 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
590 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
595 /* CUBIC SPLINE TABLE ELECTROSTATICS */
596 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
597 F = _fjsp_setzero_v2r8();
598 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
599 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
600 H = _fjsp_setzero_v2r8();
601 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
602 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
603 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
604 velec = _fjsp_mul_v2r8(qq30,VV);
605 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
606 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
608 /* Update potential sum for this i atom from the interaction with this j atom. */
609 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
610 velecsum = _fjsp_add_v2r8(velecsum,velec);
614 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
616 /* Update vectorial force */
617 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
618 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
619 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
621 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
622 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
623 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
625 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
627 /* Inner loop uses 176 flops */
630 /* End of innermost loop */
632 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
633 f+i_coord_offset,fshift+i_shift_offset);
636 /* Update potential energies */
637 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
638 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
640 /* Increment number of inner iterations */
641 inneriter += j_index_end - j_index_start;
643 /* Outer loop uses 26 flops */
646 /* Increment number of outer iterations */
649 /* Update outer/inner flops */
651 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*176);
654 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
655 * Electrostatics interaction: CubicSplineTable
656 * VdW interaction: LennardJones
657 * Geometry: Water4-Particle
658 * Calculate force/pot: Force
661 nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
662 (t_nblist * gmx_restrict nlist,
663 rvec * gmx_restrict xx,
664 rvec * gmx_restrict ff,
665 struct t_forcerec * gmx_restrict fr,
666 t_mdatoms * gmx_restrict mdatoms,
667 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
668 t_nrnb * gmx_restrict nrnb)
670 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
671 * just 0 for non-waters.
672 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
673 * jnr indices corresponding to data put in the four positions in the SIMD register.
675 int i_shift_offset,i_coord_offset,outeriter,inneriter;
676 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
678 int j_coord_offsetA,j_coord_offsetB;
679 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
681 real *shiftvec,*fshift,*x,*f;
682 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
684 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
686 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
688 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
690 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
691 int vdwjidx0A,vdwjidx0B;
692 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
693 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
694 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
695 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
696 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
697 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
700 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
703 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
704 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
705 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
708 _fjsp_v2r8 dummy_mask,cutoff_mask;
709 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
710 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
711 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
718 jindex = nlist->jindex;
720 shiftidx = nlist->shift;
722 shiftvec = fr->shift_vec[0];
723 fshift = fr->fshift[0];
724 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
725 charge = mdatoms->chargeA;
726 nvdwtype = fr->ntype;
728 vdwtype = mdatoms->typeA;
730 vftab = kernel_data->table_elec->data;
731 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
733 /* Setup water-specific parameters */
734 inr = nlist->iinr[0];
735 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
736 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
737 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
738 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
740 /* Avoid stupid compiler warnings */
748 /* Start outer loop over neighborlists */
749 for(iidx=0; iidx<nri; iidx++)
751 /* Load shift vector for this list */
752 i_shift_offset = DIM*shiftidx[iidx];
754 /* Load limits for loop over neighbors */
755 j_index_start = jindex[iidx];
756 j_index_end = jindex[iidx+1];
758 /* Get outer coordinate index */
760 i_coord_offset = DIM*inr;
762 /* Load i particle coords and add shift vector */
763 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
764 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
766 fix0 = _fjsp_setzero_v2r8();
767 fiy0 = _fjsp_setzero_v2r8();
768 fiz0 = _fjsp_setzero_v2r8();
769 fix1 = _fjsp_setzero_v2r8();
770 fiy1 = _fjsp_setzero_v2r8();
771 fiz1 = _fjsp_setzero_v2r8();
772 fix2 = _fjsp_setzero_v2r8();
773 fiy2 = _fjsp_setzero_v2r8();
774 fiz2 = _fjsp_setzero_v2r8();
775 fix3 = _fjsp_setzero_v2r8();
776 fiy3 = _fjsp_setzero_v2r8();
777 fiz3 = _fjsp_setzero_v2r8();
779 /* Start inner kernel loop */
780 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
783 /* Get j neighbor index, and coordinate index */
786 j_coord_offsetA = DIM*jnrA;
787 j_coord_offsetB = DIM*jnrB;
789 /* load j atom coordinates */
790 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
793 /* Calculate displacement vector */
794 dx00 = _fjsp_sub_v2r8(ix0,jx0);
795 dy00 = _fjsp_sub_v2r8(iy0,jy0);
796 dz00 = _fjsp_sub_v2r8(iz0,jz0);
797 dx10 = _fjsp_sub_v2r8(ix1,jx0);
798 dy10 = _fjsp_sub_v2r8(iy1,jy0);
799 dz10 = _fjsp_sub_v2r8(iz1,jz0);
800 dx20 = _fjsp_sub_v2r8(ix2,jx0);
801 dy20 = _fjsp_sub_v2r8(iy2,jy0);
802 dz20 = _fjsp_sub_v2r8(iz2,jz0);
803 dx30 = _fjsp_sub_v2r8(ix3,jx0);
804 dy30 = _fjsp_sub_v2r8(iy3,jy0);
805 dz30 = _fjsp_sub_v2r8(iz3,jz0);
807 /* Calculate squared distance and things based on it */
808 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
809 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
810 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
811 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
813 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
814 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
815 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
817 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
819 /* Load parameters for j particles */
820 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
821 vdwjidx0A = 2*vdwtype[jnrA+0];
822 vdwjidx0B = 2*vdwtype[jnrB+0];
824 fjx0 = _fjsp_setzero_v2r8();
825 fjy0 = _fjsp_setzero_v2r8();
826 fjz0 = _fjsp_setzero_v2r8();
828 /**************************
829 * CALCULATE INTERACTIONS *
830 **************************/
832 /* Compute parameters for interactions between i and j atoms */
833 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
834 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
836 /* LENNARD-JONES DISPERSION/REPULSION */
838 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
839 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
843 /* Update vectorial force */
844 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
845 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
846 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
848 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
849 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
850 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
852 /**************************
853 * CALCULATE INTERACTIONS *
854 **************************/
856 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
858 /* Compute parameters for interactions between i and j atoms */
859 qq10 = _fjsp_mul_v2r8(iq1,jq0);
861 /* Calculate table index by multiplying r with table scale and truncate to integer */
862 rt = _fjsp_mul_v2r8(r10,vftabscale);
863 itab_tmp = _fjsp_dtox_v2r8(rt);
864 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
865 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
866 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
871 /* CUBIC SPLINE TABLE ELECTROSTATICS */
872 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
873 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
874 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
875 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
876 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
877 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
878 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
879 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
880 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
884 /* Update vectorial force */
885 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
886 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
887 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
889 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
890 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
891 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
897 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
899 /* Compute parameters for interactions between i and j atoms */
900 qq20 = _fjsp_mul_v2r8(iq2,jq0);
902 /* Calculate table index by multiplying r with table scale and truncate to integer */
903 rt = _fjsp_mul_v2r8(r20,vftabscale);
904 itab_tmp = _fjsp_dtox_v2r8(rt);
905 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
906 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
907 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
912 /* CUBIC SPLINE TABLE ELECTROSTATICS */
913 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
914 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
915 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
916 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
917 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
918 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
919 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
920 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
921 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
925 /* Update vectorial force */
926 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
927 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
928 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
930 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
931 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
932 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
934 /**************************
935 * CALCULATE INTERACTIONS *
936 **************************/
938 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
940 /* Compute parameters for interactions between i and j atoms */
941 qq30 = _fjsp_mul_v2r8(iq3,jq0);
943 /* Calculate table index by multiplying r with table scale and truncate to integer */
944 rt = _fjsp_mul_v2r8(r30,vftabscale);
945 itab_tmp = _fjsp_dtox_v2r8(rt);
946 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
947 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
948 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
953 /* CUBIC SPLINE TABLE ELECTROSTATICS */
954 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
955 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
956 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
957 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
958 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
959 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
960 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
961 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
962 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
966 /* Update vectorial force */
967 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
968 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
969 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
971 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
972 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
973 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
975 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
977 /* Inner loop uses 159 flops */
984 j_coord_offsetA = DIM*jnrA;
986 /* load j atom coordinates */
987 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
990 /* Calculate displacement vector */
991 dx00 = _fjsp_sub_v2r8(ix0,jx0);
992 dy00 = _fjsp_sub_v2r8(iy0,jy0);
993 dz00 = _fjsp_sub_v2r8(iz0,jz0);
994 dx10 = _fjsp_sub_v2r8(ix1,jx0);
995 dy10 = _fjsp_sub_v2r8(iy1,jy0);
996 dz10 = _fjsp_sub_v2r8(iz1,jz0);
997 dx20 = _fjsp_sub_v2r8(ix2,jx0);
998 dy20 = _fjsp_sub_v2r8(iy2,jy0);
999 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1000 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1001 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1002 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1004 /* Calculate squared distance and things based on it */
1005 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1006 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1007 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1008 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1010 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1011 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1012 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1014 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1016 /* Load parameters for j particles */
1017 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1018 vdwjidx0A = 2*vdwtype[jnrA+0];
1020 fjx0 = _fjsp_setzero_v2r8();
1021 fjy0 = _fjsp_setzero_v2r8();
1022 fjz0 = _fjsp_setzero_v2r8();
1024 /**************************
1025 * CALCULATE INTERACTIONS *
1026 **************************/
1028 /* Compute parameters for interactions between i and j atoms */
1029 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1030 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1032 /* LENNARD-JONES DISPERSION/REPULSION */
1034 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1035 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1039 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1041 /* Update vectorial force */
1042 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1043 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1044 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1046 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1047 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1048 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1050 /**************************
1051 * CALCULATE INTERACTIONS *
1052 **************************/
1054 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1056 /* Compute parameters for interactions between i and j atoms */
1057 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1059 /* Calculate table index by multiplying r with table scale and truncate to integer */
1060 rt = _fjsp_mul_v2r8(r10,vftabscale);
1061 itab_tmp = _fjsp_dtox_v2r8(rt);
1062 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1063 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1064 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1069 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1070 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1071 F = _fjsp_setzero_v2r8();
1072 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1073 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1074 H = _fjsp_setzero_v2r8();
1075 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1076 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1077 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1078 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1082 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1084 /* Update vectorial force */
1085 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1086 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1087 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1089 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1090 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1091 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1093 /**************************
1094 * CALCULATE INTERACTIONS *
1095 **************************/
1097 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1099 /* Compute parameters for interactions between i and j atoms */
1100 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1102 /* Calculate table index by multiplying r with table scale and truncate to integer */
1103 rt = _fjsp_mul_v2r8(r20,vftabscale);
1104 itab_tmp = _fjsp_dtox_v2r8(rt);
1105 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1106 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1107 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1112 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1113 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1114 F = _fjsp_setzero_v2r8();
1115 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1116 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1117 H = _fjsp_setzero_v2r8();
1118 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1119 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1120 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1121 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1125 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1127 /* Update vectorial force */
1128 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1129 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1130 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1132 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1133 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1134 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1136 /**************************
1137 * CALCULATE INTERACTIONS *
1138 **************************/
1140 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1142 /* Compute parameters for interactions between i and j atoms */
1143 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1145 /* Calculate table index by multiplying r with table scale and truncate to integer */
1146 rt = _fjsp_mul_v2r8(r30,vftabscale);
1147 itab_tmp = _fjsp_dtox_v2r8(rt);
1148 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1149 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1150 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1155 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1156 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1157 F = _fjsp_setzero_v2r8();
1158 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1159 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1160 H = _fjsp_setzero_v2r8();
1161 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1162 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1163 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1164 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1168 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1170 /* Update vectorial force */
1171 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1172 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1173 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1175 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1176 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1177 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1179 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1181 /* Inner loop uses 159 flops */
1184 /* End of innermost loop */
1186 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1187 f+i_coord_offset,fshift+i_shift_offset);
1189 /* Increment number of inner iterations */
1190 inneriter += j_index_end - j_index_start;
1192 /* Outer loop uses 24 flops */
1195 /* Increment number of outer iterations */
1198 /* Update outer/inner flops */
1200 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*159);