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_VdwLJ_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: LennardJones
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_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;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
97 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
98 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
101 _fjsp_v2r8 dummy_mask,cutoff_mask;
102 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
103 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
104 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
111 jindex = nlist->jindex;
113 shiftidx = nlist->shift;
115 shiftvec = fr->shift_vec[0];
116 fshift = fr->fshift[0];
117 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
118 charge = mdatoms->chargeA;
119 nvdwtype = fr->ntype;
121 vdwtype = mdatoms->typeA;
123 vftab = kernel_data->table_elec->data;
124 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
126 /* Setup water-specific parameters */
127 inr = nlist->iinr[0];
128 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
129 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
130 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
131 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
133 /* Avoid stupid compiler warnings */
141 /* Start outer loop over neighborlists */
142 for(iidx=0; iidx<nri; iidx++)
144 /* Load shift vector for this list */
145 i_shift_offset = DIM*shiftidx[iidx];
147 /* Load limits for loop over neighbors */
148 j_index_start = jindex[iidx];
149 j_index_end = jindex[iidx+1];
151 /* Get outer coordinate index */
153 i_coord_offset = DIM*inr;
155 /* Load i particle coords and add shift vector */
156 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
157 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
159 fix0 = _fjsp_setzero_v2r8();
160 fiy0 = _fjsp_setzero_v2r8();
161 fiz0 = _fjsp_setzero_v2r8();
162 fix1 = _fjsp_setzero_v2r8();
163 fiy1 = _fjsp_setzero_v2r8();
164 fiz1 = _fjsp_setzero_v2r8();
165 fix2 = _fjsp_setzero_v2r8();
166 fiy2 = _fjsp_setzero_v2r8();
167 fiz2 = _fjsp_setzero_v2r8();
169 /* Reset potential sums */
170 velecsum = _fjsp_setzero_v2r8();
171 vvdwsum = _fjsp_setzero_v2r8();
173 /* Start inner kernel loop */
174 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
177 /* Get j neighbor index, and coordinate index */
180 j_coord_offsetA = DIM*jnrA;
181 j_coord_offsetB = DIM*jnrB;
183 /* load j atom coordinates */
184 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
187 /* Calculate displacement vector */
188 dx00 = _fjsp_sub_v2r8(ix0,jx0);
189 dy00 = _fjsp_sub_v2r8(iy0,jy0);
190 dz00 = _fjsp_sub_v2r8(iz0,jz0);
191 dx10 = _fjsp_sub_v2r8(ix1,jx0);
192 dy10 = _fjsp_sub_v2r8(iy1,jy0);
193 dz10 = _fjsp_sub_v2r8(iz1,jz0);
194 dx20 = _fjsp_sub_v2r8(ix2,jx0);
195 dy20 = _fjsp_sub_v2r8(iy2,jy0);
196 dz20 = _fjsp_sub_v2r8(iz2,jz0);
198 /* Calculate squared distance and things based on it */
199 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
200 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
201 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
203 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
204 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
205 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
207 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
209 /* Load parameters for j particles */
210 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
211 vdwjidx0A = 2*vdwtype[jnrA+0];
212 vdwjidx0B = 2*vdwtype[jnrB+0];
214 fjx0 = _fjsp_setzero_v2r8();
215 fjy0 = _fjsp_setzero_v2r8();
216 fjz0 = _fjsp_setzero_v2r8();
218 /**************************
219 * CALCULATE INTERACTIONS *
220 **************************/
222 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
224 /* Compute parameters for interactions between i and j atoms */
225 qq00 = _fjsp_mul_v2r8(iq0,jq0);
226 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
227 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
229 /* Calculate table index by multiplying r with table scale and truncate to integer */
230 rt = _fjsp_mul_v2r8(r00,vftabscale);
231 itab_tmp = _fjsp_dtox_v2r8(rt);
232 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
233 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
234 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
239 /* CUBIC SPLINE TABLE ELECTROSTATICS */
240 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
241 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
242 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
243 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
244 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
245 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
246 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
247 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
248 velec = _fjsp_mul_v2r8(qq00,VV);
249 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
250 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
252 /* LENNARD-JONES DISPERSION/REPULSION */
254 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
255 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
256 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
257 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
258 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
260 /* Update potential sum for this i atom from the interaction with this j atom. */
261 velecsum = _fjsp_add_v2r8(velecsum,velec);
262 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
264 fscal = _fjsp_add_v2r8(felec,fvdw);
266 /* Update vectorial force */
267 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
268 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
269 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
271 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
272 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
273 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
275 /**************************
276 * CALCULATE INTERACTIONS *
277 **************************/
279 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
281 /* Compute parameters for interactions between i and j atoms */
282 qq10 = _fjsp_mul_v2r8(iq1,jq0);
284 /* Calculate table index by multiplying r with table scale and truncate to integer */
285 rt = _fjsp_mul_v2r8(r10,vftabscale);
286 itab_tmp = _fjsp_dtox_v2r8(rt);
287 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
288 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
289 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
294 /* CUBIC SPLINE TABLE ELECTROSTATICS */
295 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
296 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
297 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
298 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
299 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
300 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
301 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
302 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
303 velec = _fjsp_mul_v2r8(qq10,VV);
304 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
305 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
307 /* Update potential sum for this i atom from the interaction with this j atom. */
308 velecsum = _fjsp_add_v2r8(velecsum,velec);
312 /* Update vectorial force */
313 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
314 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
315 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
317 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
318 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
319 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
321 /**************************
322 * CALCULATE INTERACTIONS *
323 **************************/
325 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
327 /* Compute parameters for interactions between i and j atoms */
328 qq20 = _fjsp_mul_v2r8(iq2,jq0);
330 /* Calculate table index by multiplying r with table scale and truncate to integer */
331 rt = _fjsp_mul_v2r8(r20,vftabscale);
332 itab_tmp = _fjsp_dtox_v2r8(rt);
333 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
334 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
335 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
340 /* CUBIC SPLINE TABLE ELECTROSTATICS */
341 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
342 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
343 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
344 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
345 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
346 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
347 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
348 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
349 velec = _fjsp_mul_v2r8(qq20,VV);
350 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
351 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
353 /* Update potential sum for this i atom from the interaction with this j atom. */
354 velecsum = _fjsp_add_v2r8(velecsum,velec);
358 /* Update vectorial force */
359 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
360 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
361 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
363 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
364 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
365 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
367 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
369 /* Inner loop uses 154 flops */
376 j_coord_offsetA = DIM*jnrA;
378 /* load j atom coordinates */
379 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
382 /* Calculate displacement vector */
383 dx00 = _fjsp_sub_v2r8(ix0,jx0);
384 dy00 = _fjsp_sub_v2r8(iy0,jy0);
385 dz00 = _fjsp_sub_v2r8(iz0,jz0);
386 dx10 = _fjsp_sub_v2r8(ix1,jx0);
387 dy10 = _fjsp_sub_v2r8(iy1,jy0);
388 dz10 = _fjsp_sub_v2r8(iz1,jz0);
389 dx20 = _fjsp_sub_v2r8(ix2,jx0);
390 dy20 = _fjsp_sub_v2r8(iy2,jy0);
391 dz20 = _fjsp_sub_v2r8(iz2,jz0);
393 /* Calculate squared distance and things based on it */
394 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
395 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
396 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
398 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
399 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
400 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
402 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
404 /* Load parameters for j particles */
405 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
406 vdwjidx0A = 2*vdwtype[jnrA+0];
408 fjx0 = _fjsp_setzero_v2r8();
409 fjy0 = _fjsp_setzero_v2r8();
410 fjz0 = _fjsp_setzero_v2r8();
412 /**************************
413 * CALCULATE INTERACTIONS *
414 **************************/
416 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
418 /* Compute parameters for interactions between i and j atoms */
419 qq00 = _fjsp_mul_v2r8(iq0,jq0);
420 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
422 /* Calculate table index by multiplying r with table scale and truncate to integer */
423 rt = _fjsp_mul_v2r8(r00,vftabscale);
424 itab_tmp = _fjsp_dtox_v2r8(rt);
425 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
426 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
427 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
432 /* CUBIC SPLINE TABLE ELECTROSTATICS */
433 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
434 F = _fjsp_setzero_v2r8();
435 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
436 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
437 H = _fjsp_setzero_v2r8();
438 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
439 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
440 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
441 velec = _fjsp_mul_v2r8(qq00,VV);
442 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
443 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
445 /* LENNARD-JONES DISPERSION/REPULSION */
447 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
448 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
449 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
450 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
451 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
453 /* Update potential sum for this i atom from the interaction with this j atom. */
454 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
455 velecsum = _fjsp_add_v2r8(velecsum,velec);
456 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
457 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
459 fscal = _fjsp_add_v2r8(felec,fvdw);
461 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
463 /* Update vectorial force */
464 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
465 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
466 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
468 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
469 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
470 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
472 /**************************
473 * CALCULATE INTERACTIONS *
474 **************************/
476 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
478 /* Compute parameters for interactions between i and j atoms */
479 qq10 = _fjsp_mul_v2r8(iq1,jq0);
481 /* Calculate table index by multiplying r with table scale and truncate to integer */
482 rt = _fjsp_mul_v2r8(r10,vftabscale);
483 itab_tmp = _fjsp_dtox_v2r8(rt);
484 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
485 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
486 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
491 /* CUBIC SPLINE TABLE ELECTROSTATICS */
492 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
493 F = _fjsp_setzero_v2r8();
494 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
495 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
496 H = _fjsp_setzero_v2r8();
497 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
498 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
499 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
500 velec = _fjsp_mul_v2r8(qq10,VV);
501 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
502 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
504 /* Update potential sum for this i atom from the interaction with this j atom. */
505 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
506 velecsum = _fjsp_add_v2r8(velecsum,velec);
510 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
512 /* Update vectorial force */
513 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
514 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
515 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
517 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
518 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
519 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
521 /**************************
522 * CALCULATE INTERACTIONS *
523 **************************/
525 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
527 /* Compute parameters for interactions between i and j atoms */
528 qq20 = _fjsp_mul_v2r8(iq2,jq0);
530 /* Calculate table index by multiplying r with table scale and truncate to integer */
531 rt = _fjsp_mul_v2r8(r20,vftabscale);
532 itab_tmp = _fjsp_dtox_v2r8(rt);
533 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
534 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
535 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
540 /* CUBIC SPLINE TABLE ELECTROSTATICS */
541 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
542 F = _fjsp_setzero_v2r8();
543 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
544 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
545 H = _fjsp_setzero_v2r8();
546 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
547 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
548 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
549 velec = _fjsp_mul_v2r8(qq20,VV);
550 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
551 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
553 /* Update potential sum for this i atom from the interaction with this j atom. */
554 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
555 velecsum = _fjsp_add_v2r8(velecsum,velec);
559 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
561 /* Update vectorial force */
562 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
563 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
564 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
566 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
567 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
568 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
570 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
572 /* Inner loop uses 154 flops */
575 /* End of innermost loop */
577 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
578 f+i_coord_offset,fshift+i_shift_offset);
581 /* Update potential energies */
582 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
583 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
585 /* Increment number of inner iterations */
586 inneriter += j_index_end - j_index_start;
588 /* Outer loop uses 20 flops */
591 /* Increment number of outer iterations */
594 /* Update outer/inner flops */
596 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
599 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
600 * Electrostatics interaction: CubicSplineTable
601 * VdW interaction: LennardJones
602 * Geometry: Water3-Particle
603 * Calculate force/pot: Force
606 nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
607 (t_nblist * gmx_restrict nlist,
608 rvec * gmx_restrict xx,
609 rvec * gmx_restrict ff,
610 t_forcerec * gmx_restrict fr,
611 t_mdatoms * gmx_restrict mdatoms,
612 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
613 t_nrnb * gmx_restrict nrnb)
615 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
616 * just 0 for non-waters.
617 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
618 * jnr indices corresponding to data put in the four positions in the SIMD register.
620 int i_shift_offset,i_coord_offset,outeriter,inneriter;
621 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
623 int j_coord_offsetA,j_coord_offsetB;
624 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
626 real *shiftvec,*fshift,*x,*f;
627 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
629 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
631 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
633 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
634 int vdwjidx0A,vdwjidx0B;
635 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
636 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
637 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
638 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
639 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
642 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
645 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
646 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
647 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
650 _fjsp_v2r8 dummy_mask,cutoff_mask;
651 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
652 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
653 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
660 jindex = nlist->jindex;
662 shiftidx = nlist->shift;
664 shiftvec = fr->shift_vec[0];
665 fshift = fr->fshift[0];
666 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
667 charge = mdatoms->chargeA;
668 nvdwtype = fr->ntype;
670 vdwtype = mdatoms->typeA;
672 vftab = kernel_data->table_elec->data;
673 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
675 /* Setup water-specific parameters */
676 inr = nlist->iinr[0];
677 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
678 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
679 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
680 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
682 /* Avoid stupid compiler warnings */
690 /* Start outer loop over neighborlists */
691 for(iidx=0; iidx<nri; iidx++)
693 /* Load shift vector for this list */
694 i_shift_offset = DIM*shiftidx[iidx];
696 /* Load limits for loop over neighbors */
697 j_index_start = jindex[iidx];
698 j_index_end = jindex[iidx+1];
700 /* Get outer coordinate index */
702 i_coord_offset = DIM*inr;
704 /* Load i particle coords and add shift vector */
705 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
706 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
708 fix0 = _fjsp_setzero_v2r8();
709 fiy0 = _fjsp_setzero_v2r8();
710 fiz0 = _fjsp_setzero_v2r8();
711 fix1 = _fjsp_setzero_v2r8();
712 fiy1 = _fjsp_setzero_v2r8();
713 fiz1 = _fjsp_setzero_v2r8();
714 fix2 = _fjsp_setzero_v2r8();
715 fiy2 = _fjsp_setzero_v2r8();
716 fiz2 = _fjsp_setzero_v2r8();
718 /* Start inner kernel loop */
719 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
722 /* Get j neighbor index, and coordinate index */
725 j_coord_offsetA = DIM*jnrA;
726 j_coord_offsetB = DIM*jnrB;
728 /* load j atom coordinates */
729 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
732 /* Calculate displacement vector */
733 dx00 = _fjsp_sub_v2r8(ix0,jx0);
734 dy00 = _fjsp_sub_v2r8(iy0,jy0);
735 dz00 = _fjsp_sub_v2r8(iz0,jz0);
736 dx10 = _fjsp_sub_v2r8(ix1,jx0);
737 dy10 = _fjsp_sub_v2r8(iy1,jy0);
738 dz10 = _fjsp_sub_v2r8(iz1,jz0);
739 dx20 = _fjsp_sub_v2r8(ix2,jx0);
740 dy20 = _fjsp_sub_v2r8(iy2,jy0);
741 dz20 = _fjsp_sub_v2r8(iz2,jz0);
743 /* Calculate squared distance and things based on it */
744 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
745 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
746 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
748 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
749 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
750 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
752 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
754 /* Load parameters for j particles */
755 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
756 vdwjidx0A = 2*vdwtype[jnrA+0];
757 vdwjidx0B = 2*vdwtype[jnrB+0];
759 fjx0 = _fjsp_setzero_v2r8();
760 fjy0 = _fjsp_setzero_v2r8();
761 fjz0 = _fjsp_setzero_v2r8();
763 /**************************
764 * CALCULATE INTERACTIONS *
765 **************************/
767 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
769 /* Compute parameters for interactions between i and j atoms */
770 qq00 = _fjsp_mul_v2r8(iq0,jq0);
771 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
772 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
774 /* Calculate table index by multiplying r with table scale and truncate to integer */
775 rt = _fjsp_mul_v2r8(r00,vftabscale);
776 itab_tmp = _fjsp_dtox_v2r8(rt);
777 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
778 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
779 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
784 /* CUBIC SPLINE TABLE ELECTROSTATICS */
785 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
786 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
787 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
788 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
789 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
790 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
791 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
792 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
793 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
795 /* LENNARD-JONES DISPERSION/REPULSION */
797 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
798 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
800 fscal = _fjsp_add_v2r8(felec,fvdw);
802 /* Update vectorial force */
803 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
804 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
805 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
807 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
808 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
809 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
811 /**************************
812 * CALCULATE INTERACTIONS *
813 **************************/
815 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
817 /* Compute parameters for interactions between i and j atoms */
818 qq10 = _fjsp_mul_v2r8(iq1,jq0);
820 /* Calculate table index by multiplying r with table scale and truncate to integer */
821 rt = _fjsp_mul_v2r8(r10,vftabscale);
822 itab_tmp = _fjsp_dtox_v2r8(rt);
823 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
824 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
825 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
830 /* CUBIC SPLINE TABLE ELECTROSTATICS */
831 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
832 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
833 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
834 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
835 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
836 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
837 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
838 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
839 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
843 /* Update vectorial force */
844 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
845 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
846 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
848 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
849 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
850 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
852 /**************************
853 * CALCULATE INTERACTIONS *
854 **************************/
856 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
858 /* Compute parameters for interactions between i and j atoms */
859 qq20 = _fjsp_mul_v2r8(iq2,jq0);
861 /* Calculate table index by multiplying r with table scale and truncate to integer */
862 rt = _fjsp_mul_v2r8(r20,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(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
884 /* Update vectorial force */
885 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
886 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
887 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
889 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
890 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
891 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
893 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
895 /* Inner loop uses 137 flops */
902 j_coord_offsetA = DIM*jnrA;
904 /* load j atom coordinates */
905 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
908 /* Calculate displacement vector */
909 dx00 = _fjsp_sub_v2r8(ix0,jx0);
910 dy00 = _fjsp_sub_v2r8(iy0,jy0);
911 dz00 = _fjsp_sub_v2r8(iz0,jz0);
912 dx10 = _fjsp_sub_v2r8(ix1,jx0);
913 dy10 = _fjsp_sub_v2r8(iy1,jy0);
914 dz10 = _fjsp_sub_v2r8(iz1,jz0);
915 dx20 = _fjsp_sub_v2r8(ix2,jx0);
916 dy20 = _fjsp_sub_v2r8(iy2,jy0);
917 dz20 = _fjsp_sub_v2r8(iz2,jz0);
919 /* Calculate squared distance and things based on it */
920 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
921 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
922 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
924 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
925 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
926 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
928 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
930 /* Load parameters for j particles */
931 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
932 vdwjidx0A = 2*vdwtype[jnrA+0];
934 fjx0 = _fjsp_setzero_v2r8();
935 fjy0 = _fjsp_setzero_v2r8();
936 fjz0 = _fjsp_setzero_v2r8();
938 /**************************
939 * CALCULATE INTERACTIONS *
940 **************************/
942 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
944 /* Compute parameters for interactions between i and j atoms */
945 qq00 = _fjsp_mul_v2r8(iq0,jq0);
946 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
948 /* Calculate table index by multiplying r with table scale and truncate to integer */
949 rt = _fjsp_mul_v2r8(r00,vftabscale);
950 itab_tmp = _fjsp_dtox_v2r8(rt);
951 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
952 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
953 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
958 /* CUBIC SPLINE TABLE ELECTROSTATICS */
959 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
960 F = _fjsp_setzero_v2r8();
961 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
962 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
963 H = _fjsp_setzero_v2r8();
964 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
965 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
966 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
967 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
969 /* LENNARD-JONES DISPERSION/REPULSION */
971 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
972 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
974 fscal = _fjsp_add_v2r8(felec,fvdw);
976 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
978 /* Update vectorial force */
979 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
980 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
981 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
983 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
984 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
985 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
987 /**************************
988 * CALCULATE INTERACTIONS *
989 **************************/
991 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
993 /* Compute parameters for interactions between i and j atoms */
994 qq10 = _fjsp_mul_v2r8(iq1,jq0);
996 /* Calculate table index by multiplying r with table scale and truncate to integer */
997 rt = _fjsp_mul_v2r8(r10,vftabscale);
998 itab_tmp = _fjsp_dtox_v2r8(rt);
999 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1000 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1001 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1006 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1007 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1008 F = _fjsp_setzero_v2r8();
1009 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1010 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1011 H = _fjsp_setzero_v2r8();
1012 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1013 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1014 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1015 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1019 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1021 /* Update vectorial force */
1022 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1023 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1024 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1026 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1027 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1028 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1030 /**************************
1031 * CALCULATE INTERACTIONS *
1032 **************************/
1034 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1036 /* Compute parameters for interactions between i and j atoms */
1037 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1039 /* Calculate table index by multiplying r with table scale and truncate to integer */
1040 rt = _fjsp_mul_v2r8(r20,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_setzero_v2r8();
1052 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1053 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1054 H = _fjsp_setzero_v2r8();
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(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1062 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1064 /* Update vectorial force */
1065 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1066 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1067 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1069 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1070 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1071 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1073 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1075 /* Inner loop uses 137 flops */
1078 /* End of innermost loop */
1080 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1081 f+i_coord_offset,fshift+i_shift_offset);
1083 /* Increment number of inner iterations */
1084 inneriter += j_index_end - j_index_start;
1086 /* Outer loop uses 18 flops */
1089 /* Increment number of outer iterations */
1092 /* Update outer/inner flops */
1094 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*137);