2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_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 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->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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
452 /* LENNARD-JONES DISPERSION/REPULSION */
454 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
455 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
456 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
457 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
458 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
460 /* Update potential sum for this i atom from the interaction with this j atom. */
461 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
462 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
466 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
468 /* Update vectorial force */
469 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
470 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
471 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
473 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
474 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
475 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
481 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
483 /* Compute parameters for interactions between i and j atoms */
484 qq10 = _fjsp_mul_v2r8(iq1,jq0);
486 /* Calculate table index by multiplying r with table scale and truncate to integer */
487 rt = _fjsp_mul_v2r8(r10,vftabscale);
488 itab_tmp = _fjsp_dtox_v2r8(rt);
489 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
490 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
491 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
496 /* CUBIC SPLINE TABLE ELECTROSTATICS */
497 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
498 F = _fjsp_setzero_v2r8();
499 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
500 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
501 H = _fjsp_setzero_v2r8();
502 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
503 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
504 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
505 velec = _fjsp_mul_v2r8(qq10,VV);
506 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
507 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
509 /* Update potential sum for this i atom from the interaction with this j atom. */
510 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
511 velecsum = _fjsp_add_v2r8(velecsum,velec);
515 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
517 /* Update vectorial force */
518 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
519 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
520 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
522 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
523 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
524 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
526 /**************************
527 * CALCULATE INTERACTIONS *
528 **************************/
530 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
532 /* Compute parameters for interactions between i and j atoms */
533 qq20 = _fjsp_mul_v2r8(iq2,jq0);
535 /* Calculate table index by multiplying r with table scale and truncate to integer */
536 rt = _fjsp_mul_v2r8(r20,vftabscale);
537 itab_tmp = _fjsp_dtox_v2r8(rt);
538 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
539 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
540 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
545 /* CUBIC SPLINE TABLE ELECTROSTATICS */
546 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
547 F = _fjsp_setzero_v2r8();
548 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
549 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
550 H = _fjsp_setzero_v2r8();
551 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
552 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
553 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
554 velec = _fjsp_mul_v2r8(qq20,VV);
555 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
556 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
558 /* Update potential sum for this i atom from the interaction with this j atom. */
559 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
560 velecsum = _fjsp_add_v2r8(velecsum,velec);
564 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
566 /* Update vectorial force */
567 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
568 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
569 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
571 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
572 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
573 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
575 /**************************
576 * CALCULATE INTERACTIONS *
577 **************************/
579 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
581 /* Compute parameters for interactions between i and j atoms */
582 qq30 = _fjsp_mul_v2r8(iq3,jq0);
584 /* Calculate table index by multiplying r with table scale and truncate to integer */
585 rt = _fjsp_mul_v2r8(r30,vftabscale);
586 itab_tmp = _fjsp_dtox_v2r8(rt);
587 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
588 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
589 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
594 /* CUBIC SPLINE TABLE ELECTROSTATICS */
595 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
596 F = _fjsp_setzero_v2r8();
597 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
598 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
599 H = _fjsp_setzero_v2r8();
600 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
601 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
602 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
603 velec = _fjsp_mul_v2r8(qq30,VV);
604 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
605 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
607 /* Update potential sum for this i atom from the interaction with this j atom. */
608 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
609 velecsum = _fjsp_add_v2r8(velecsum,velec);
613 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
615 /* Update vectorial force */
616 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
617 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
618 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
620 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
621 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
622 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
624 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
626 /* Inner loop uses 176 flops */
629 /* End of innermost loop */
631 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
632 f+i_coord_offset,fshift+i_shift_offset);
635 /* Update potential energies */
636 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
637 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
639 /* Increment number of inner iterations */
640 inneriter += j_index_end - j_index_start;
642 /* Outer loop uses 26 flops */
645 /* Increment number of outer iterations */
648 /* Update outer/inner flops */
650 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*176);
653 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
654 * Electrostatics interaction: CubicSplineTable
655 * VdW interaction: LennardJones
656 * Geometry: Water4-Particle
657 * Calculate force/pot: Force
660 nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
661 (t_nblist * gmx_restrict nlist,
662 rvec * gmx_restrict xx,
663 rvec * gmx_restrict ff,
664 t_forcerec * gmx_restrict fr,
665 t_mdatoms * gmx_restrict mdatoms,
666 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
667 t_nrnb * gmx_restrict nrnb)
669 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
670 * just 0 for non-waters.
671 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
672 * jnr indices corresponding to data put in the four positions in the SIMD register.
674 int i_shift_offset,i_coord_offset,outeriter,inneriter;
675 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
677 int j_coord_offsetA,j_coord_offsetB;
678 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
680 real *shiftvec,*fshift,*x,*f;
681 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
683 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
685 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
687 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
689 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
690 int vdwjidx0A,vdwjidx0B;
691 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
692 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
693 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
694 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
695 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
696 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
699 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
702 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
703 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
704 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
707 _fjsp_v2r8 dummy_mask,cutoff_mask;
708 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
709 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
710 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
717 jindex = nlist->jindex;
719 shiftidx = nlist->shift;
721 shiftvec = fr->shift_vec[0];
722 fshift = fr->fshift[0];
723 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
724 charge = mdatoms->chargeA;
725 nvdwtype = fr->ntype;
727 vdwtype = mdatoms->typeA;
729 vftab = kernel_data->table_elec->data;
730 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
732 /* Setup water-specific parameters */
733 inr = nlist->iinr[0];
734 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
735 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
736 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
737 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
739 /* Avoid stupid compiler warnings */
747 /* Start outer loop over neighborlists */
748 for(iidx=0; iidx<nri; iidx++)
750 /* Load shift vector for this list */
751 i_shift_offset = DIM*shiftidx[iidx];
753 /* Load limits for loop over neighbors */
754 j_index_start = jindex[iidx];
755 j_index_end = jindex[iidx+1];
757 /* Get outer coordinate index */
759 i_coord_offset = DIM*inr;
761 /* Load i particle coords and add shift vector */
762 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
763 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
765 fix0 = _fjsp_setzero_v2r8();
766 fiy0 = _fjsp_setzero_v2r8();
767 fiz0 = _fjsp_setzero_v2r8();
768 fix1 = _fjsp_setzero_v2r8();
769 fiy1 = _fjsp_setzero_v2r8();
770 fiz1 = _fjsp_setzero_v2r8();
771 fix2 = _fjsp_setzero_v2r8();
772 fiy2 = _fjsp_setzero_v2r8();
773 fiz2 = _fjsp_setzero_v2r8();
774 fix3 = _fjsp_setzero_v2r8();
775 fiy3 = _fjsp_setzero_v2r8();
776 fiz3 = _fjsp_setzero_v2r8();
778 /* Start inner kernel loop */
779 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
782 /* Get j neighbor index, and coordinate index */
785 j_coord_offsetA = DIM*jnrA;
786 j_coord_offsetB = DIM*jnrB;
788 /* load j atom coordinates */
789 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
792 /* Calculate displacement vector */
793 dx00 = _fjsp_sub_v2r8(ix0,jx0);
794 dy00 = _fjsp_sub_v2r8(iy0,jy0);
795 dz00 = _fjsp_sub_v2r8(iz0,jz0);
796 dx10 = _fjsp_sub_v2r8(ix1,jx0);
797 dy10 = _fjsp_sub_v2r8(iy1,jy0);
798 dz10 = _fjsp_sub_v2r8(iz1,jz0);
799 dx20 = _fjsp_sub_v2r8(ix2,jx0);
800 dy20 = _fjsp_sub_v2r8(iy2,jy0);
801 dz20 = _fjsp_sub_v2r8(iz2,jz0);
802 dx30 = _fjsp_sub_v2r8(ix3,jx0);
803 dy30 = _fjsp_sub_v2r8(iy3,jy0);
804 dz30 = _fjsp_sub_v2r8(iz3,jz0);
806 /* Calculate squared distance and things based on it */
807 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
808 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
809 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
810 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
812 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
813 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
814 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
816 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
818 /* Load parameters for j particles */
819 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
820 vdwjidx0A = 2*vdwtype[jnrA+0];
821 vdwjidx0B = 2*vdwtype[jnrB+0];
823 fjx0 = _fjsp_setzero_v2r8();
824 fjy0 = _fjsp_setzero_v2r8();
825 fjz0 = _fjsp_setzero_v2r8();
827 /**************************
828 * CALCULATE INTERACTIONS *
829 **************************/
831 /* Compute parameters for interactions between i and j atoms */
832 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
833 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
835 /* LENNARD-JONES DISPERSION/REPULSION */
837 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
838 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
842 /* Update vectorial force */
843 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
844 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
845 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
847 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
848 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
849 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
851 /**************************
852 * CALCULATE INTERACTIONS *
853 **************************/
855 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
857 /* Compute parameters for interactions between i and j atoms */
858 qq10 = _fjsp_mul_v2r8(iq1,jq0);
860 /* Calculate table index by multiplying r with table scale and truncate to integer */
861 rt = _fjsp_mul_v2r8(r10,vftabscale);
862 itab_tmp = _fjsp_dtox_v2r8(rt);
863 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
864 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
865 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
870 /* CUBIC SPLINE TABLE ELECTROSTATICS */
871 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
872 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
873 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
874 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
875 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
876 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
877 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
878 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
879 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
883 /* Update vectorial force */
884 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
885 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
886 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
888 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
889 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
890 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
892 /**************************
893 * CALCULATE INTERACTIONS *
894 **************************/
896 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
898 /* Compute parameters for interactions between i and j atoms */
899 qq20 = _fjsp_mul_v2r8(iq2,jq0);
901 /* Calculate table index by multiplying r with table scale and truncate to integer */
902 rt = _fjsp_mul_v2r8(r20,vftabscale);
903 itab_tmp = _fjsp_dtox_v2r8(rt);
904 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
905 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
906 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
911 /* CUBIC SPLINE TABLE ELECTROSTATICS */
912 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
913 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
914 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
915 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
916 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
917 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
918 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
919 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
920 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
924 /* Update vectorial force */
925 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
926 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
927 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
929 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
930 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
931 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
933 /**************************
934 * CALCULATE INTERACTIONS *
935 **************************/
937 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
939 /* Compute parameters for interactions between i and j atoms */
940 qq30 = _fjsp_mul_v2r8(iq3,jq0);
942 /* Calculate table index by multiplying r with table scale and truncate to integer */
943 rt = _fjsp_mul_v2r8(r30,vftabscale);
944 itab_tmp = _fjsp_dtox_v2r8(rt);
945 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
946 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
947 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
952 /* CUBIC SPLINE TABLE ELECTROSTATICS */
953 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
954 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
955 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
956 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
957 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
958 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
959 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
960 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
961 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
965 /* Update vectorial force */
966 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
967 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
968 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
970 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
971 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
972 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
974 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
976 /* Inner loop uses 159 flops */
983 j_coord_offsetA = DIM*jnrA;
985 /* load j atom coordinates */
986 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
989 /* Calculate displacement vector */
990 dx00 = _fjsp_sub_v2r8(ix0,jx0);
991 dy00 = _fjsp_sub_v2r8(iy0,jy0);
992 dz00 = _fjsp_sub_v2r8(iz0,jz0);
993 dx10 = _fjsp_sub_v2r8(ix1,jx0);
994 dy10 = _fjsp_sub_v2r8(iy1,jy0);
995 dz10 = _fjsp_sub_v2r8(iz1,jz0);
996 dx20 = _fjsp_sub_v2r8(ix2,jx0);
997 dy20 = _fjsp_sub_v2r8(iy2,jy0);
998 dz20 = _fjsp_sub_v2r8(iz2,jz0);
999 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1000 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1001 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1003 /* Calculate squared distance and things based on it */
1004 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1005 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1006 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1007 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1009 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1010 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1011 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1013 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1015 /* Load parameters for j particles */
1016 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1017 vdwjidx0A = 2*vdwtype[jnrA+0];
1019 fjx0 = _fjsp_setzero_v2r8();
1020 fjy0 = _fjsp_setzero_v2r8();
1021 fjz0 = _fjsp_setzero_v2r8();
1023 /**************************
1024 * CALCULATE INTERACTIONS *
1025 **************************/
1027 /* Compute parameters for interactions between i and j atoms */
1028 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1030 /* LENNARD-JONES DISPERSION/REPULSION */
1032 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1033 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1037 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1039 /* Update vectorial force */
1040 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1041 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1042 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1044 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1045 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1046 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1048 /**************************
1049 * CALCULATE INTERACTIONS *
1050 **************************/
1052 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1054 /* Compute parameters for interactions between i and j atoms */
1055 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1057 /* Calculate table index by multiplying r with table scale and truncate to integer */
1058 rt = _fjsp_mul_v2r8(r10,vftabscale);
1059 itab_tmp = _fjsp_dtox_v2r8(rt);
1060 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1061 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1062 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1067 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1068 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1069 F = _fjsp_setzero_v2r8();
1070 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1071 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1072 H = _fjsp_setzero_v2r8();
1073 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1074 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1075 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1076 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1080 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1082 /* Update vectorial force */
1083 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1084 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1085 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1087 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1088 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1089 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1091 /**************************
1092 * CALCULATE INTERACTIONS *
1093 **************************/
1095 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1097 /* Compute parameters for interactions between i and j atoms */
1098 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1100 /* Calculate table index by multiplying r with table scale and truncate to integer */
1101 rt = _fjsp_mul_v2r8(r20,vftabscale);
1102 itab_tmp = _fjsp_dtox_v2r8(rt);
1103 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1104 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1105 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1110 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1111 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1112 F = _fjsp_setzero_v2r8();
1113 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1114 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1115 H = _fjsp_setzero_v2r8();
1116 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1117 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1118 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1119 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1123 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1125 /* Update vectorial force */
1126 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1127 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1128 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1130 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1131 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1132 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1134 /**************************
1135 * CALCULATE INTERACTIONS *
1136 **************************/
1138 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1140 /* Compute parameters for interactions between i and j atoms */
1141 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1143 /* Calculate table index by multiplying r with table scale and truncate to integer */
1144 rt = _fjsp_mul_v2r8(r30,vftabscale);
1145 itab_tmp = _fjsp_dtox_v2r8(rt);
1146 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1147 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1148 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1153 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1154 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1155 F = _fjsp_setzero_v2r8();
1156 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1157 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1158 H = _fjsp_setzero_v2r8();
1159 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1160 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1161 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1162 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1166 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1168 /* Update vectorial force */
1169 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1170 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1171 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1173 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1174 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1175 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1177 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1179 /* Inner loop uses 159 flops */
1182 /* End of innermost loop */
1184 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1185 f+i_coord_offset,fshift+i_shift_offset);
1187 /* Increment number of inner iterations */
1188 inneriter += j_index_end - j_index_start;
1190 /* Outer loop uses 24 flops */
1193 /* Increment number of outer iterations */
1196 /* Update outer/inner flops */
1198 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*159);