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 "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwCSTab_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_vdw->data;
127 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->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 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
214 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
215 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
216 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
218 /* Load parameters for j particles */
219 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
220 vdwjidx0A = 2*vdwtype[jnrA+0];
221 vdwjidx0B = 2*vdwtype[jnrB+0];
223 fjx0 = _fjsp_setzero_v2r8();
224 fjy0 = _fjsp_setzero_v2r8();
225 fjz0 = _fjsp_setzero_v2r8();
227 /**************************
228 * CALCULATE INTERACTIONS *
229 **************************/
231 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
233 /* Compute parameters for interactions between i and j atoms */
234 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
235 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
237 /* Calculate table index by multiplying r with table scale and truncate to integer */
238 rt = _fjsp_mul_v2r8(r00,vftabscale);
239 itab_tmp = _fjsp_dtox_v2r8(rt);
240 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
241 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
242 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
247 /* CUBIC SPLINE TABLE DISPERSION */
250 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
251 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
252 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
253 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
254 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
255 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
256 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
257 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
258 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
259 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
260 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
262 /* CUBIC SPLINE TABLE REPULSION */
263 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
264 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
265 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
266 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
267 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
268 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
269 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
270 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
271 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
272 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
273 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
274 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
275 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
277 /* Update potential sum for this i atom from the interaction with this j atom. */
278 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
282 /* Update vectorial force */
283 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
284 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
285 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
287 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
288 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
289 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
291 /**************************
292 * CALCULATE INTERACTIONS *
293 **************************/
295 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
297 /* Compute parameters for interactions between i and j atoms */
298 qq10 = _fjsp_mul_v2r8(iq1,jq0);
300 /* Calculate table index by multiplying r with table scale and truncate to integer */
301 rt = _fjsp_mul_v2r8(r10,vftabscale);
302 itab_tmp = _fjsp_dtox_v2r8(rt);
303 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
304 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
305 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
310 /* CUBIC SPLINE TABLE ELECTROSTATICS */
311 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
312 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
313 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
314 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
315 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
316 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
317 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
318 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
319 velec = _fjsp_mul_v2r8(qq10,VV);
320 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
321 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
323 /* Update potential sum for this i atom from the interaction with this j atom. */
324 velecsum = _fjsp_add_v2r8(velecsum,velec);
328 /* Update vectorial force */
329 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
330 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
331 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
333 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
334 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
335 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
337 /**************************
338 * CALCULATE INTERACTIONS *
339 **************************/
341 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
343 /* Compute parameters for interactions between i and j atoms */
344 qq20 = _fjsp_mul_v2r8(iq2,jq0);
346 /* Calculate table index by multiplying r with table scale and truncate to integer */
347 rt = _fjsp_mul_v2r8(r20,vftabscale);
348 itab_tmp = _fjsp_dtox_v2r8(rt);
349 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
350 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
351 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
356 /* CUBIC SPLINE TABLE ELECTROSTATICS */
357 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
358 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
359 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
360 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
361 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
362 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
363 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
364 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
365 velec = _fjsp_mul_v2r8(qq20,VV);
366 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
367 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
369 /* Update potential sum for this i atom from the interaction with this j atom. */
370 velecsum = _fjsp_add_v2r8(velecsum,velec);
374 /* Update vectorial force */
375 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
376 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
377 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
379 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
380 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
381 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
383 /**************************
384 * CALCULATE INTERACTIONS *
385 **************************/
387 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
389 /* Compute parameters for interactions between i and j atoms */
390 qq30 = _fjsp_mul_v2r8(iq3,jq0);
392 /* Calculate table index by multiplying r with table scale and truncate to integer */
393 rt = _fjsp_mul_v2r8(r30,vftabscale);
394 itab_tmp = _fjsp_dtox_v2r8(rt);
395 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
396 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
397 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
402 /* CUBIC SPLINE TABLE ELECTROSTATICS */
403 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
404 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
405 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
406 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
407 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
408 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
409 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
410 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
411 velec = _fjsp_mul_v2r8(qq30,VV);
412 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
413 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
415 /* Update potential sum for this i atom from the interaction with this j atom. */
416 velecsum = _fjsp_add_v2r8(velecsum,velec);
420 /* Update vectorial force */
421 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
422 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
423 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
425 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
426 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
427 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
429 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
431 /* Inner loop uses 200 flops */
438 j_coord_offsetA = DIM*jnrA;
440 /* load j atom coordinates */
441 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
444 /* Calculate displacement vector */
445 dx00 = _fjsp_sub_v2r8(ix0,jx0);
446 dy00 = _fjsp_sub_v2r8(iy0,jy0);
447 dz00 = _fjsp_sub_v2r8(iz0,jz0);
448 dx10 = _fjsp_sub_v2r8(ix1,jx0);
449 dy10 = _fjsp_sub_v2r8(iy1,jy0);
450 dz10 = _fjsp_sub_v2r8(iz1,jz0);
451 dx20 = _fjsp_sub_v2r8(ix2,jx0);
452 dy20 = _fjsp_sub_v2r8(iy2,jy0);
453 dz20 = _fjsp_sub_v2r8(iz2,jz0);
454 dx30 = _fjsp_sub_v2r8(ix3,jx0);
455 dy30 = _fjsp_sub_v2r8(iy3,jy0);
456 dz30 = _fjsp_sub_v2r8(iz3,jz0);
458 /* Calculate squared distance and things based on it */
459 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
460 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
461 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
462 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
464 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
465 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
466 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
467 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
469 /* Load parameters for j particles */
470 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
471 vdwjidx0A = 2*vdwtype[jnrA+0];
473 fjx0 = _fjsp_setzero_v2r8();
474 fjy0 = _fjsp_setzero_v2r8();
475 fjz0 = _fjsp_setzero_v2r8();
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
481 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
483 /* Compute parameters for interactions between i and j atoms */
484 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
486 /* Calculate table index by multiplying r with table scale and truncate to integer */
487 rt = _fjsp_mul_v2r8(r00,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 DISPERSION */
499 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
500 F = _fjsp_setzero_v2r8();
501 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
502 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
503 H = _fjsp_setzero_v2r8();
504 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
505 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
506 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
507 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
508 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
509 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
511 /* CUBIC SPLINE TABLE REPULSION */
512 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
513 F = _fjsp_setzero_v2r8();
514 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
515 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
516 H = _fjsp_setzero_v2r8();
517 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
518 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
519 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
520 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
521 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
522 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
523 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
524 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
526 /* Update potential sum for this i atom from the interaction with this j atom. */
527 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
528 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
532 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
534 /* Update vectorial force */
535 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
536 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
537 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
539 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
540 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
541 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
543 /**************************
544 * CALCULATE INTERACTIONS *
545 **************************/
547 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
549 /* Compute parameters for interactions between i and j atoms */
550 qq10 = _fjsp_mul_v2r8(iq1,jq0);
552 /* Calculate table index by multiplying r with table scale and truncate to integer */
553 rt = _fjsp_mul_v2r8(r10,vftabscale);
554 itab_tmp = _fjsp_dtox_v2r8(rt);
555 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
556 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
557 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
562 /* CUBIC SPLINE TABLE ELECTROSTATICS */
563 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
564 F = _fjsp_setzero_v2r8();
565 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
566 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
567 H = _fjsp_setzero_v2r8();
568 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
569 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
570 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
571 velec = _fjsp_mul_v2r8(qq10,VV);
572 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
573 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
575 /* Update potential sum for this i atom from the interaction with this j atom. */
576 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
577 velecsum = _fjsp_add_v2r8(velecsum,velec);
581 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
583 /* Update vectorial force */
584 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
585 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
586 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
588 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
589 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
590 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
592 /**************************
593 * CALCULATE INTERACTIONS *
594 **************************/
596 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
598 /* Compute parameters for interactions between i and j atoms */
599 qq20 = _fjsp_mul_v2r8(iq2,jq0);
601 /* Calculate table index by multiplying r with table scale and truncate to integer */
602 rt = _fjsp_mul_v2r8(r20,vftabscale);
603 itab_tmp = _fjsp_dtox_v2r8(rt);
604 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
605 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
606 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
611 /* CUBIC SPLINE TABLE ELECTROSTATICS */
612 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
613 F = _fjsp_setzero_v2r8();
614 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
615 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
616 H = _fjsp_setzero_v2r8();
617 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
618 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
619 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
620 velec = _fjsp_mul_v2r8(qq20,VV);
621 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
622 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
624 /* Update potential sum for this i atom from the interaction with this j atom. */
625 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
626 velecsum = _fjsp_add_v2r8(velecsum,velec);
630 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
632 /* Update vectorial force */
633 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
634 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
635 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
637 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
638 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
639 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
641 /**************************
642 * CALCULATE INTERACTIONS *
643 **************************/
645 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
647 /* Compute parameters for interactions between i and j atoms */
648 qq30 = _fjsp_mul_v2r8(iq3,jq0);
650 /* Calculate table index by multiplying r with table scale and truncate to integer */
651 rt = _fjsp_mul_v2r8(r30,vftabscale);
652 itab_tmp = _fjsp_dtox_v2r8(rt);
653 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
654 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
655 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
660 /* CUBIC SPLINE TABLE ELECTROSTATICS */
661 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
662 F = _fjsp_setzero_v2r8();
663 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
664 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
665 H = _fjsp_setzero_v2r8();
666 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
667 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
668 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
669 velec = _fjsp_mul_v2r8(qq30,VV);
670 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
671 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
673 /* Update potential sum for this i atom from the interaction with this j atom. */
674 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
675 velecsum = _fjsp_add_v2r8(velecsum,velec);
679 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
681 /* Update vectorial force */
682 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
683 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
684 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
686 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
687 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
688 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
690 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
692 /* Inner loop uses 200 flops */
695 /* End of innermost loop */
697 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
698 f+i_coord_offset,fshift+i_shift_offset);
701 /* Update potential energies */
702 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
703 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
705 /* Increment number of inner iterations */
706 inneriter += j_index_end - j_index_start;
708 /* Outer loop uses 26 flops */
711 /* Increment number of outer iterations */
714 /* Update outer/inner flops */
716 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*200);
719 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
720 * Electrostatics interaction: CubicSplineTable
721 * VdW interaction: CubicSplineTable
722 * Geometry: Water4-Particle
723 * Calculate force/pot: Force
726 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
727 (t_nblist * gmx_restrict nlist,
728 rvec * gmx_restrict xx,
729 rvec * gmx_restrict ff,
730 t_forcerec * gmx_restrict fr,
731 t_mdatoms * gmx_restrict mdatoms,
732 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
733 t_nrnb * gmx_restrict nrnb)
735 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
736 * just 0 for non-waters.
737 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
738 * jnr indices corresponding to data put in the four positions in the SIMD register.
740 int i_shift_offset,i_coord_offset,outeriter,inneriter;
741 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
743 int j_coord_offsetA,j_coord_offsetB;
744 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
746 real *shiftvec,*fshift,*x,*f;
747 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
749 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
751 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
753 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
755 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
756 int vdwjidx0A,vdwjidx0B;
757 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
758 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
759 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
760 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
761 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
762 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
765 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
768 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
769 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
770 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
773 _fjsp_v2r8 dummy_mask,cutoff_mask;
774 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
775 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
776 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
783 jindex = nlist->jindex;
785 shiftidx = nlist->shift;
787 shiftvec = fr->shift_vec[0];
788 fshift = fr->fshift[0];
789 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
790 charge = mdatoms->chargeA;
791 nvdwtype = fr->ntype;
793 vdwtype = mdatoms->typeA;
795 vftab = kernel_data->table_elec_vdw->data;
796 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
798 /* Setup water-specific parameters */
799 inr = nlist->iinr[0];
800 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
801 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
802 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
803 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
805 /* Avoid stupid compiler warnings */
813 /* Start outer loop over neighborlists */
814 for(iidx=0; iidx<nri; iidx++)
816 /* Load shift vector for this list */
817 i_shift_offset = DIM*shiftidx[iidx];
819 /* Load limits for loop over neighbors */
820 j_index_start = jindex[iidx];
821 j_index_end = jindex[iidx+1];
823 /* Get outer coordinate index */
825 i_coord_offset = DIM*inr;
827 /* Load i particle coords and add shift vector */
828 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
829 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
831 fix0 = _fjsp_setzero_v2r8();
832 fiy0 = _fjsp_setzero_v2r8();
833 fiz0 = _fjsp_setzero_v2r8();
834 fix1 = _fjsp_setzero_v2r8();
835 fiy1 = _fjsp_setzero_v2r8();
836 fiz1 = _fjsp_setzero_v2r8();
837 fix2 = _fjsp_setzero_v2r8();
838 fiy2 = _fjsp_setzero_v2r8();
839 fiz2 = _fjsp_setzero_v2r8();
840 fix3 = _fjsp_setzero_v2r8();
841 fiy3 = _fjsp_setzero_v2r8();
842 fiz3 = _fjsp_setzero_v2r8();
844 /* Start inner kernel loop */
845 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
848 /* Get j neighbor index, and coordinate index */
851 j_coord_offsetA = DIM*jnrA;
852 j_coord_offsetB = DIM*jnrB;
854 /* load j atom coordinates */
855 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
858 /* Calculate displacement vector */
859 dx00 = _fjsp_sub_v2r8(ix0,jx0);
860 dy00 = _fjsp_sub_v2r8(iy0,jy0);
861 dz00 = _fjsp_sub_v2r8(iz0,jz0);
862 dx10 = _fjsp_sub_v2r8(ix1,jx0);
863 dy10 = _fjsp_sub_v2r8(iy1,jy0);
864 dz10 = _fjsp_sub_v2r8(iz1,jz0);
865 dx20 = _fjsp_sub_v2r8(ix2,jx0);
866 dy20 = _fjsp_sub_v2r8(iy2,jy0);
867 dz20 = _fjsp_sub_v2r8(iz2,jz0);
868 dx30 = _fjsp_sub_v2r8(ix3,jx0);
869 dy30 = _fjsp_sub_v2r8(iy3,jy0);
870 dz30 = _fjsp_sub_v2r8(iz3,jz0);
872 /* Calculate squared distance and things based on it */
873 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
874 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
875 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
876 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
878 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
879 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
880 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
881 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
883 /* Load parameters for j particles */
884 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
885 vdwjidx0A = 2*vdwtype[jnrA+0];
886 vdwjidx0B = 2*vdwtype[jnrB+0];
888 fjx0 = _fjsp_setzero_v2r8();
889 fjy0 = _fjsp_setzero_v2r8();
890 fjz0 = _fjsp_setzero_v2r8();
892 /**************************
893 * CALCULATE INTERACTIONS *
894 **************************/
896 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
898 /* Compute parameters for interactions between i and j atoms */
899 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
900 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
902 /* Calculate table index by multiplying r with table scale and truncate to integer */
903 rt = _fjsp_mul_v2r8(r00,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 DISPERSION */
915 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
916 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
917 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
918 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
919 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
920 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
921 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
922 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
923 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
925 /* CUBIC SPLINE TABLE REPULSION */
926 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
927 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
928 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
929 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
930 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
931 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
932 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
933 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
934 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
935 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
939 /* Update vectorial force */
940 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
941 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
942 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
944 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
945 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
946 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
948 /**************************
949 * CALCULATE INTERACTIONS *
950 **************************/
952 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
954 /* Compute parameters for interactions between i and j atoms */
955 qq10 = _fjsp_mul_v2r8(iq1,jq0);
957 /* Calculate table index by multiplying r with table scale and truncate to integer */
958 rt = _fjsp_mul_v2r8(r10,vftabscale);
959 itab_tmp = _fjsp_dtox_v2r8(rt);
960 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
961 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
962 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
967 /* CUBIC SPLINE TABLE ELECTROSTATICS */
968 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
969 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
970 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
971 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
972 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
973 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
974 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
975 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
976 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
980 /* Update vectorial force */
981 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
982 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
983 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
985 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
986 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
987 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
989 /**************************
990 * CALCULATE INTERACTIONS *
991 **************************/
993 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
995 /* Compute parameters for interactions between i and j atoms */
996 qq20 = _fjsp_mul_v2r8(iq2,jq0);
998 /* Calculate table index by multiplying r with table scale and truncate to integer */
999 rt = _fjsp_mul_v2r8(r20,vftabscale);
1000 itab_tmp = _fjsp_dtox_v2r8(rt);
1001 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1002 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1003 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1008 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1009 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1010 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1011 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1012 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1013 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1014 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1015 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1016 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1017 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1021 /* Update vectorial force */
1022 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1023 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1024 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1026 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1027 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1028 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1030 /**************************
1031 * CALCULATE INTERACTIONS *
1032 **************************/
1034 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1036 /* Compute parameters for interactions between i and j atoms */
1037 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1039 /* Calculate table index by multiplying r with table scale and truncate to integer */
1040 rt = _fjsp_mul_v2r8(r30,vftabscale);
1041 itab_tmp = _fjsp_dtox_v2r8(rt);
1042 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1043 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1044 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1049 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1050 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1051 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1052 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1053 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1054 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1055 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1056 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1057 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1058 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1062 /* Update vectorial force */
1063 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1064 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1065 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1067 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1068 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1069 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1071 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1073 /* Inner loop uses 180 flops */
1076 if(jidx<j_index_end)
1080 j_coord_offsetA = DIM*jnrA;
1082 /* load j atom coordinates */
1083 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1086 /* Calculate displacement vector */
1087 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1088 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1089 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1090 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1091 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1092 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1093 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1094 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1095 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1096 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1097 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1098 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1100 /* Calculate squared distance and things based on it */
1101 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1102 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1103 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1104 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1106 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1107 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1108 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1109 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1111 /* Load parameters for j particles */
1112 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1113 vdwjidx0A = 2*vdwtype[jnrA+0];
1115 fjx0 = _fjsp_setzero_v2r8();
1116 fjy0 = _fjsp_setzero_v2r8();
1117 fjz0 = _fjsp_setzero_v2r8();
1119 /**************************
1120 * CALCULATE INTERACTIONS *
1121 **************************/
1123 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1125 /* Compute parameters for interactions between i and j atoms */
1126 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1128 /* Calculate table index by multiplying r with table scale and truncate to integer */
1129 rt = _fjsp_mul_v2r8(r00,vftabscale);
1130 itab_tmp = _fjsp_dtox_v2r8(rt);
1131 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1132 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1133 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1138 /* CUBIC SPLINE TABLE DISPERSION */
1141 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1142 F = _fjsp_setzero_v2r8();
1143 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1144 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1145 H = _fjsp_setzero_v2r8();
1146 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1147 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1148 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1149 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1151 /* CUBIC SPLINE TABLE REPULSION */
1152 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1153 F = _fjsp_setzero_v2r8();
1154 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1155 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1156 H = _fjsp_setzero_v2r8();
1157 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1158 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1159 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1160 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1161 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1165 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1167 /* Update vectorial force */
1168 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1169 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1170 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1172 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1173 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1174 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1176 /**************************
1177 * CALCULATE INTERACTIONS *
1178 **************************/
1180 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1182 /* Compute parameters for interactions between i and j atoms */
1183 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1185 /* Calculate table index by multiplying r with table scale and truncate to integer */
1186 rt = _fjsp_mul_v2r8(r10,vftabscale);
1187 itab_tmp = _fjsp_dtox_v2r8(rt);
1188 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1189 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1190 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1195 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1196 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1197 F = _fjsp_setzero_v2r8();
1198 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1199 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1200 H = _fjsp_setzero_v2r8();
1201 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1202 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1203 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1204 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1208 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1210 /* Update vectorial force */
1211 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1212 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1213 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1215 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1216 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1217 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1219 /**************************
1220 * CALCULATE INTERACTIONS *
1221 **************************/
1223 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1225 /* Compute parameters for interactions between i and j atoms */
1226 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1228 /* Calculate table index by multiplying r with table scale and truncate to integer */
1229 rt = _fjsp_mul_v2r8(r20,vftabscale);
1230 itab_tmp = _fjsp_dtox_v2r8(rt);
1231 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1232 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1233 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1238 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1239 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1240 F = _fjsp_setzero_v2r8();
1241 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1242 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1243 H = _fjsp_setzero_v2r8();
1244 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1245 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1246 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1247 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1251 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1253 /* Update vectorial force */
1254 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1255 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1256 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1258 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1259 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1260 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1262 /**************************
1263 * CALCULATE INTERACTIONS *
1264 **************************/
1266 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1268 /* Compute parameters for interactions between i and j atoms */
1269 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1271 /* Calculate table index by multiplying r with table scale and truncate to integer */
1272 rt = _fjsp_mul_v2r8(r30,vftabscale);
1273 itab_tmp = _fjsp_dtox_v2r8(rt);
1274 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1275 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1276 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1281 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1282 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1283 F = _fjsp_setzero_v2r8();
1284 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1285 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1286 H = _fjsp_setzero_v2r8();
1287 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1288 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1289 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1290 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1294 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1296 /* Update vectorial force */
1297 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1298 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1299 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1301 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1302 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1303 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1305 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1307 /* Inner loop uses 180 flops */
1310 /* End of innermost loop */
1312 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1313 f+i_coord_offset,fshift+i_shift_offset);
1315 /* Increment number of inner iterations */
1316 inneriter += j_index_end - j_index_start;
1318 /* Outer loop uses 24 flops */
1321 /* Increment number of outer iterations */
1324 /* Update outer/inner flops */
1326 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);