2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_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 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
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->ic->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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
421 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
423 /* Calculate table index by multiplying r with table scale and truncate to integer */
424 rt = _fjsp_mul_v2r8(r00,vftabscale);
425 itab_tmp = _fjsp_dtox_v2r8(rt);
426 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
427 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
428 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
433 /* CUBIC SPLINE TABLE ELECTROSTATICS */
434 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
435 F = _fjsp_setzero_v2r8();
436 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
437 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
438 H = _fjsp_setzero_v2r8();
439 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
440 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
441 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
442 velec = _fjsp_mul_v2r8(qq00,VV);
443 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
444 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
446 /* LENNARD-JONES DISPERSION/REPULSION */
448 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
449 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
450 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
451 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
452 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
454 /* Update potential sum for this i atom from the interaction with this j atom. */
455 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
456 velecsum = _fjsp_add_v2r8(velecsum,velec);
457 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
458 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
460 fscal = _fjsp_add_v2r8(felec,fvdw);
462 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
464 /* Update vectorial force */
465 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
466 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
467 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
469 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
470 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
471 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
473 /**************************
474 * CALCULATE INTERACTIONS *
475 **************************/
477 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
479 /* Compute parameters for interactions between i and j atoms */
480 qq10 = _fjsp_mul_v2r8(iq1,jq0);
482 /* Calculate table index by multiplying r with table scale and truncate to integer */
483 rt = _fjsp_mul_v2r8(r10,vftabscale);
484 itab_tmp = _fjsp_dtox_v2r8(rt);
485 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
486 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
487 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
492 /* CUBIC SPLINE TABLE ELECTROSTATICS */
493 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
494 F = _fjsp_setzero_v2r8();
495 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
496 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
497 H = _fjsp_setzero_v2r8();
498 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
499 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
500 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
501 velec = _fjsp_mul_v2r8(qq10,VV);
502 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
503 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
505 /* Update potential sum for this i atom from the interaction with this j atom. */
506 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
507 velecsum = _fjsp_add_v2r8(velecsum,velec);
511 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
513 /* Update vectorial force */
514 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
515 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
516 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
518 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
519 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
520 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
522 /**************************
523 * CALCULATE INTERACTIONS *
524 **************************/
526 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
528 /* Compute parameters for interactions between i and j atoms */
529 qq20 = _fjsp_mul_v2r8(iq2,jq0);
531 /* Calculate table index by multiplying r with table scale and truncate to integer */
532 rt = _fjsp_mul_v2r8(r20,vftabscale);
533 itab_tmp = _fjsp_dtox_v2r8(rt);
534 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
535 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
536 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
541 /* CUBIC SPLINE TABLE ELECTROSTATICS */
542 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
543 F = _fjsp_setzero_v2r8();
544 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
545 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
546 H = _fjsp_setzero_v2r8();
547 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
548 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
549 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
550 velec = _fjsp_mul_v2r8(qq20,VV);
551 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
552 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
554 /* Update potential sum for this i atom from the interaction with this j atom. */
555 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
556 velecsum = _fjsp_add_v2r8(velecsum,velec);
560 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
562 /* Update vectorial force */
563 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
564 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
565 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
567 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
568 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
569 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
571 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
573 /* Inner loop uses 154 flops */
576 /* End of innermost loop */
578 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
579 f+i_coord_offset,fshift+i_shift_offset);
582 /* Update potential energies */
583 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
584 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
586 /* Increment number of inner iterations */
587 inneriter += j_index_end - j_index_start;
589 /* Outer loop uses 20 flops */
592 /* Increment number of outer iterations */
595 /* Update outer/inner flops */
597 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
600 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
601 * Electrostatics interaction: CubicSplineTable
602 * VdW interaction: LennardJones
603 * Geometry: Water3-Particle
604 * Calculate force/pot: Force
607 nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
608 (t_nblist * gmx_restrict nlist,
609 rvec * gmx_restrict xx,
610 rvec * gmx_restrict ff,
611 struct t_forcerec * gmx_restrict fr,
612 t_mdatoms * gmx_restrict mdatoms,
613 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
614 t_nrnb * gmx_restrict nrnb)
616 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
617 * just 0 for non-waters.
618 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
619 * jnr indices corresponding to data put in the four positions in the SIMD register.
621 int i_shift_offset,i_coord_offset,outeriter,inneriter;
622 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
624 int j_coord_offsetA,j_coord_offsetB;
625 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
627 real *shiftvec,*fshift,*x,*f;
628 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
630 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
632 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
634 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
635 int vdwjidx0A,vdwjidx0B;
636 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
637 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
638 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
639 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
640 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
643 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
646 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
647 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
648 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
651 _fjsp_v2r8 dummy_mask,cutoff_mask;
652 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
653 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
654 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
661 jindex = nlist->jindex;
663 shiftidx = nlist->shift;
665 shiftvec = fr->shift_vec[0];
666 fshift = fr->fshift[0];
667 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
668 charge = mdatoms->chargeA;
669 nvdwtype = fr->ntype;
671 vdwtype = mdatoms->typeA;
673 vftab = kernel_data->table_elec->data;
674 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
676 /* Setup water-specific parameters */
677 inr = nlist->iinr[0];
678 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
679 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
680 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
681 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
683 /* Avoid stupid compiler warnings */
691 /* Start outer loop over neighborlists */
692 for(iidx=0; iidx<nri; iidx++)
694 /* Load shift vector for this list */
695 i_shift_offset = DIM*shiftidx[iidx];
697 /* Load limits for loop over neighbors */
698 j_index_start = jindex[iidx];
699 j_index_end = jindex[iidx+1];
701 /* Get outer coordinate index */
703 i_coord_offset = DIM*inr;
705 /* Load i particle coords and add shift vector */
706 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
707 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
709 fix0 = _fjsp_setzero_v2r8();
710 fiy0 = _fjsp_setzero_v2r8();
711 fiz0 = _fjsp_setzero_v2r8();
712 fix1 = _fjsp_setzero_v2r8();
713 fiy1 = _fjsp_setzero_v2r8();
714 fiz1 = _fjsp_setzero_v2r8();
715 fix2 = _fjsp_setzero_v2r8();
716 fiy2 = _fjsp_setzero_v2r8();
717 fiz2 = _fjsp_setzero_v2r8();
719 /* Start inner kernel loop */
720 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
723 /* Get j neighbor index, and coordinate index */
726 j_coord_offsetA = DIM*jnrA;
727 j_coord_offsetB = DIM*jnrB;
729 /* load j atom coordinates */
730 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
733 /* Calculate displacement vector */
734 dx00 = _fjsp_sub_v2r8(ix0,jx0);
735 dy00 = _fjsp_sub_v2r8(iy0,jy0);
736 dz00 = _fjsp_sub_v2r8(iz0,jz0);
737 dx10 = _fjsp_sub_v2r8(ix1,jx0);
738 dy10 = _fjsp_sub_v2r8(iy1,jy0);
739 dz10 = _fjsp_sub_v2r8(iz1,jz0);
740 dx20 = _fjsp_sub_v2r8(ix2,jx0);
741 dy20 = _fjsp_sub_v2r8(iy2,jy0);
742 dz20 = _fjsp_sub_v2r8(iz2,jz0);
744 /* Calculate squared distance and things based on it */
745 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
746 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
747 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
749 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
750 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
751 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
753 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
755 /* Load parameters for j particles */
756 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
757 vdwjidx0A = 2*vdwtype[jnrA+0];
758 vdwjidx0B = 2*vdwtype[jnrB+0];
760 fjx0 = _fjsp_setzero_v2r8();
761 fjy0 = _fjsp_setzero_v2r8();
762 fjz0 = _fjsp_setzero_v2r8();
764 /**************************
765 * CALCULATE INTERACTIONS *
766 **************************/
768 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
770 /* Compute parameters for interactions between i and j atoms */
771 qq00 = _fjsp_mul_v2r8(iq0,jq0);
772 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
773 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
775 /* Calculate table index by multiplying r with table scale and truncate to integer */
776 rt = _fjsp_mul_v2r8(r00,vftabscale);
777 itab_tmp = _fjsp_dtox_v2r8(rt);
778 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
779 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
780 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
785 /* CUBIC SPLINE TABLE ELECTROSTATICS */
786 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
787 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
788 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
789 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
790 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
791 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
792 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
793 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
794 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
796 /* LENNARD-JONES DISPERSION/REPULSION */
798 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
799 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
801 fscal = _fjsp_add_v2r8(felec,fvdw);
803 /* Update vectorial force */
804 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
805 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
806 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
808 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
809 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
810 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
812 /**************************
813 * CALCULATE INTERACTIONS *
814 **************************/
816 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
818 /* Compute parameters for interactions between i and j atoms */
819 qq10 = _fjsp_mul_v2r8(iq1,jq0);
821 /* Calculate table index by multiplying r with table scale and truncate to integer */
822 rt = _fjsp_mul_v2r8(r10,vftabscale);
823 itab_tmp = _fjsp_dtox_v2r8(rt);
824 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
825 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
826 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
831 /* CUBIC SPLINE TABLE ELECTROSTATICS */
832 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
833 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
834 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
835 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
836 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
837 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
838 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
839 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
840 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
844 /* Update vectorial force */
845 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
846 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
847 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
849 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
850 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
851 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
853 /**************************
854 * CALCULATE INTERACTIONS *
855 **************************/
857 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
859 /* Compute parameters for interactions between i and j atoms */
860 qq20 = _fjsp_mul_v2r8(iq2,jq0);
862 /* Calculate table index by multiplying r with table scale and truncate to integer */
863 rt = _fjsp_mul_v2r8(r20,vftabscale);
864 itab_tmp = _fjsp_dtox_v2r8(rt);
865 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
866 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
867 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
872 /* CUBIC SPLINE TABLE ELECTROSTATICS */
873 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
874 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
875 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
876 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
877 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
878 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
879 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
880 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
881 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
885 /* Update vectorial force */
886 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
887 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
888 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
890 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
891 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
892 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
894 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
896 /* Inner loop uses 137 flops */
903 j_coord_offsetA = DIM*jnrA;
905 /* load j atom coordinates */
906 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
909 /* Calculate displacement vector */
910 dx00 = _fjsp_sub_v2r8(ix0,jx0);
911 dy00 = _fjsp_sub_v2r8(iy0,jy0);
912 dz00 = _fjsp_sub_v2r8(iz0,jz0);
913 dx10 = _fjsp_sub_v2r8(ix1,jx0);
914 dy10 = _fjsp_sub_v2r8(iy1,jy0);
915 dz10 = _fjsp_sub_v2r8(iz1,jz0);
916 dx20 = _fjsp_sub_v2r8(ix2,jx0);
917 dy20 = _fjsp_sub_v2r8(iy2,jy0);
918 dz20 = _fjsp_sub_v2r8(iz2,jz0);
920 /* Calculate squared distance and things based on it */
921 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
922 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
923 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
925 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
926 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
927 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
929 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
931 /* Load parameters for j particles */
932 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
933 vdwjidx0A = 2*vdwtype[jnrA+0];
935 fjx0 = _fjsp_setzero_v2r8();
936 fjy0 = _fjsp_setzero_v2r8();
937 fjz0 = _fjsp_setzero_v2r8();
939 /**************************
940 * CALCULATE INTERACTIONS *
941 **************************/
943 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
945 /* Compute parameters for interactions between i and j atoms */
946 qq00 = _fjsp_mul_v2r8(iq0,jq0);
947 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
948 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
950 /* Calculate table index by multiplying r with table scale and truncate to integer */
951 rt = _fjsp_mul_v2r8(r00,vftabscale);
952 itab_tmp = _fjsp_dtox_v2r8(rt);
953 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
954 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
955 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
960 /* CUBIC SPLINE TABLE ELECTROSTATICS */
961 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
962 F = _fjsp_setzero_v2r8();
963 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
964 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
965 H = _fjsp_setzero_v2r8();
966 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
967 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
968 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
969 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
971 /* LENNARD-JONES DISPERSION/REPULSION */
973 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
974 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
976 fscal = _fjsp_add_v2r8(felec,fvdw);
978 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
980 /* Update vectorial force */
981 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
982 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
983 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
985 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
986 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
987 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
989 /**************************
990 * CALCULATE INTERACTIONS *
991 **************************/
993 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
995 /* Compute parameters for interactions between i and j atoms */
996 qq10 = _fjsp_mul_v2r8(iq1,jq0);
998 /* Calculate table index by multiplying r with table scale and truncate to integer */
999 rt = _fjsp_mul_v2r8(r10,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_setzero_v2r8();
1011 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1012 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1013 H = _fjsp_setzero_v2r8();
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(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1021 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1023 /* Update vectorial force */
1024 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1025 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1026 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1028 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1029 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1030 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1032 /**************************
1033 * CALCULATE INTERACTIONS *
1034 **************************/
1036 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1038 /* Compute parameters for interactions between i and j atoms */
1039 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1041 /* Calculate table index by multiplying r with table scale and truncate to integer */
1042 rt = _fjsp_mul_v2r8(r20,vftabscale);
1043 itab_tmp = _fjsp_dtox_v2r8(rt);
1044 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1045 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1046 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1051 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1052 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1053 F = _fjsp_setzero_v2r8();
1054 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1055 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1056 H = _fjsp_setzero_v2r8();
1057 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1058 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1059 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1060 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1064 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1066 /* Update vectorial force */
1067 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1068 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1069 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1071 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1072 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1073 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1075 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1077 /* Inner loop uses 137 flops */
1080 /* End of innermost loop */
1082 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1083 f+i_coord_offset,fshift+i_shift_offset);
1085 /* Increment number of inner iterations */
1086 inneriter += j_index_end - j_index_start;
1088 /* Outer loop uses 18 flops */
1091 /* Increment number of outer iterations */
1094 /* Update outer/inner flops */
1096 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*137);