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_ElecRFCut_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
121 charge = mdatoms->chargeA;
122 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
123 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
124 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
125 nvdwtype = fr->ntype;
127 vdwtype = mdatoms->typeA;
129 vftab = kernel_data->table_vdw->data;
130 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
132 /* Setup water-specific parameters */
133 inr = nlist->iinr[0];
134 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
135 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
136 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
137 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
139 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
140 rcutoff_scalar = fr->ic->rcoulomb;
141 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
142 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
144 /* Avoid stupid compiler warnings */
152 /* Start outer loop over neighborlists */
153 for(iidx=0; iidx<nri; iidx++)
155 /* Load shift vector for this list */
156 i_shift_offset = DIM*shiftidx[iidx];
158 /* Load limits for loop over neighbors */
159 j_index_start = jindex[iidx];
160 j_index_end = jindex[iidx+1];
162 /* Get outer coordinate index */
164 i_coord_offset = DIM*inr;
166 /* Load i particle coords and add shift vector */
167 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
168 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
170 fix0 = _fjsp_setzero_v2r8();
171 fiy0 = _fjsp_setzero_v2r8();
172 fiz0 = _fjsp_setzero_v2r8();
173 fix1 = _fjsp_setzero_v2r8();
174 fiy1 = _fjsp_setzero_v2r8();
175 fiz1 = _fjsp_setzero_v2r8();
176 fix2 = _fjsp_setzero_v2r8();
177 fiy2 = _fjsp_setzero_v2r8();
178 fiz2 = _fjsp_setzero_v2r8();
179 fix3 = _fjsp_setzero_v2r8();
180 fiy3 = _fjsp_setzero_v2r8();
181 fiz3 = _fjsp_setzero_v2r8();
183 /* Reset potential sums */
184 velecsum = _fjsp_setzero_v2r8();
185 vvdwsum = _fjsp_setzero_v2r8();
187 /* Start inner kernel loop */
188 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
191 /* Get j neighbor index, and coordinate index */
194 j_coord_offsetA = DIM*jnrA;
195 j_coord_offsetB = DIM*jnrB;
197 /* load j atom coordinates */
198 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
201 /* Calculate displacement vector */
202 dx00 = _fjsp_sub_v2r8(ix0,jx0);
203 dy00 = _fjsp_sub_v2r8(iy0,jy0);
204 dz00 = _fjsp_sub_v2r8(iz0,jz0);
205 dx10 = _fjsp_sub_v2r8(ix1,jx0);
206 dy10 = _fjsp_sub_v2r8(iy1,jy0);
207 dz10 = _fjsp_sub_v2r8(iz1,jz0);
208 dx20 = _fjsp_sub_v2r8(ix2,jx0);
209 dy20 = _fjsp_sub_v2r8(iy2,jy0);
210 dz20 = _fjsp_sub_v2r8(iz2,jz0);
211 dx30 = _fjsp_sub_v2r8(ix3,jx0);
212 dy30 = _fjsp_sub_v2r8(iy3,jy0);
213 dz30 = _fjsp_sub_v2r8(iz3,jz0);
215 /* Calculate squared distance and things based on it */
216 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
217 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
218 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
219 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
221 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
222 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
223 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
224 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
226 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
227 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
228 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
230 /* Load parameters for j particles */
231 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
232 vdwjidx0A = 2*vdwtype[jnrA+0];
233 vdwjidx0B = 2*vdwtype[jnrB+0];
235 fjx0 = _fjsp_setzero_v2r8();
236 fjy0 = _fjsp_setzero_v2r8();
237 fjz0 = _fjsp_setzero_v2r8();
239 /**************************
240 * CALCULATE INTERACTIONS *
241 **************************/
243 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
245 /* Compute parameters for interactions between i and j atoms */
246 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
247 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
249 /* Calculate table index by multiplying r with table scale and truncate to integer */
250 rt = _fjsp_mul_v2r8(r00,vftabscale);
251 itab_tmp = _fjsp_dtox_v2r8(rt);
252 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
253 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
254 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
259 /* CUBIC SPLINE TABLE DISPERSION */
260 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
261 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
262 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
263 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
264 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
265 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
266 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
267 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
268 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
269 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
270 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
272 /* CUBIC SPLINE TABLE REPULSION */
273 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
274 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
275 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
276 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
277 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
278 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
279 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
280 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
281 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
282 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
283 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
284 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
285 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
287 /* Update potential sum for this i atom from the interaction with this j atom. */
288 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
292 /* Update vectorial force */
293 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
294 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
295 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
297 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
298 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
299 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
301 /**************************
302 * CALCULATE INTERACTIONS *
303 **************************/
305 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
308 /* Compute parameters for interactions between i and j atoms */
309 qq10 = _fjsp_mul_v2r8(iq1,jq0);
311 /* REACTION-FIELD ELECTROSTATICS */
312 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
313 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
315 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
317 /* Update potential sum for this i atom from the interaction with this j atom. */
318 velec = _fjsp_and_v2r8(velec,cutoff_mask);
319 velecsum = _fjsp_add_v2r8(velecsum,velec);
323 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
325 /* Update vectorial force */
326 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
327 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
328 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
330 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
331 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
332 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
336 /**************************
337 * CALCULATE INTERACTIONS *
338 **************************/
340 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
343 /* Compute parameters for interactions between i and j atoms */
344 qq20 = _fjsp_mul_v2r8(iq2,jq0);
346 /* REACTION-FIELD ELECTROSTATICS */
347 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
348 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
350 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
352 /* Update potential sum for this i atom from the interaction with this j atom. */
353 velec = _fjsp_and_v2r8(velec,cutoff_mask);
354 velecsum = _fjsp_add_v2r8(velecsum,velec);
358 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
360 /* Update vectorial force */
361 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
362 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
363 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
365 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
366 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
367 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
371 /**************************
372 * CALCULATE INTERACTIONS *
373 **************************/
375 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
378 /* Compute parameters for interactions between i and j atoms */
379 qq30 = _fjsp_mul_v2r8(iq3,jq0);
381 /* REACTION-FIELD ELECTROSTATICS */
382 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
383 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
385 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
387 /* Update potential sum for this i atom from the interaction with this j atom. */
388 velec = _fjsp_and_v2r8(velec,cutoff_mask);
389 velecsum = _fjsp_add_v2r8(velecsum,velec);
393 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
395 /* Update vectorial force */
396 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
397 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
398 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
400 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
401 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
402 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
406 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
408 /* Inner loop uses 179 flops */
415 j_coord_offsetA = DIM*jnrA;
417 /* load j atom coordinates */
418 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
421 /* Calculate displacement vector */
422 dx00 = _fjsp_sub_v2r8(ix0,jx0);
423 dy00 = _fjsp_sub_v2r8(iy0,jy0);
424 dz00 = _fjsp_sub_v2r8(iz0,jz0);
425 dx10 = _fjsp_sub_v2r8(ix1,jx0);
426 dy10 = _fjsp_sub_v2r8(iy1,jy0);
427 dz10 = _fjsp_sub_v2r8(iz1,jz0);
428 dx20 = _fjsp_sub_v2r8(ix2,jx0);
429 dy20 = _fjsp_sub_v2r8(iy2,jy0);
430 dz20 = _fjsp_sub_v2r8(iz2,jz0);
431 dx30 = _fjsp_sub_v2r8(ix3,jx0);
432 dy30 = _fjsp_sub_v2r8(iy3,jy0);
433 dz30 = _fjsp_sub_v2r8(iz3,jz0);
435 /* Calculate squared distance and things based on it */
436 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
437 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
438 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
439 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
441 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
442 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
443 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
444 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
446 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
447 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
448 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
450 /* Load parameters for j particles */
451 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
452 vdwjidx0A = 2*vdwtype[jnrA+0];
454 fjx0 = _fjsp_setzero_v2r8();
455 fjy0 = _fjsp_setzero_v2r8();
456 fjz0 = _fjsp_setzero_v2r8();
458 /**************************
459 * CALCULATE INTERACTIONS *
460 **************************/
462 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
464 /* Compute parameters for interactions between i and j atoms */
465 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
466 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
468 /* Calculate table index by multiplying r with table scale and truncate to integer */
469 rt = _fjsp_mul_v2r8(r00,vftabscale);
470 itab_tmp = _fjsp_dtox_v2r8(rt);
471 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
472 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
473 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
478 /* CUBIC SPLINE TABLE DISPERSION */
479 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
480 F = _fjsp_setzero_v2r8();
481 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
482 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
483 H = _fjsp_setzero_v2r8();
484 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
485 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
486 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
487 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
488 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
489 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
491 /* CUBIC SPLINE TABLE REPULSION */
492 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
493 F = _fjsp_setzero_v2r8();
494 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
495 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
496 H = _fjsp_setzero_v2r8();
497 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
498 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
499 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
500 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
501 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
502 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
503 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
504 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
506 /* Update potential sum for this i atom from the interaction with this j atom. */
507 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
508 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
512 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
514 /* Update vectorial force */
515 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
516 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
517 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
519 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
520 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
521 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
523 /**************************
524 * CALCULATE INTERACTIONS *
525 **************************/
527 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
530 /* Compute parameters for interactions between i and j atoms */
531 qq10 = _fjsp_mul_v2r8(iq1,jq0);
533 /* REACTION-FIELD ELECTROSTATICS */
534 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
535 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
537 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
539 /* Update potential sum for this i atom from the interaction with this j atom. */
540 velec = _fjsp_and_v2r8(velec,cutoff_mask);
541 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
542 velecsum = _fjsp_add_v2r8(velecsum,velec);
546 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
548 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
550 /* Update vectorial force */
551 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
552 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
553 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
555 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
556 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
557 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
561 /**************************
562 * CALCULATE INTERACTIONS *
563 **************************/
565 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
568 /* Compute parameters for interactions between i and j atoms */
569 qq20 = _fjsp_mul_v2r8(iq2,jq0);
571 /* REACTION-FIELD ELECTROSTATICS */
572 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
573 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
575 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
577 /* Update potential sum for this i atom from the interaction with this j atom. */
578 velec = _fjsp_and_v2r8(velec,cutoff_mask);
579 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
580 velecsum = _fjsp_add_v2r8(velecsum,velec);
584 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
586 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
588 /* Update vectorial force */
589 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
590 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
591 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
593 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
594 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
595 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
599 /**************************
600 * CALCULATE INTERACTIONS *
601 **************************/
603 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
606 /* Compute parameters for interactions between i and j atoms */
607 qq30 = _fjsp_mul_v2r8(iq3,jq0);
609 /* REACTION-FIELD ELECTROSTATICS */
610 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
611 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
613 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
615 /* Update potential sum for this i atom from the interaction with this j atom. */
616 velec = _fjsp_and_v2r8(velec,cutoff_mask);
617 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
618 velecsum = _fjsp_add_v2r8(velecsum,velec);
622 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
624 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
626 /* Update vectorial force */
627 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
628 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
629 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
631 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
632 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
633 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
637 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
639 /* Inner loop uses 179 flops */
642 /* End of innermost loop */
644 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
645 f+i_coord_offset,fshift+i_shift_offset);
648 /* Update potential energies */
649 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
650 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
652 /* Increment number of inner iterations */
653 inneriter += j_index_end - j_index_start;
655 /* Outer loop uses 26 flops */
658 /* Increment number of outer iterations */
661 /* Update outer/inner flops */
663 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*179);
666 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
667 * Electrostatics interaction: ReactionField
668 * VdW interaction: CubicSplineTable
669 * Geometry: Water4-Particle
670 * Calculate force/pot: Force
673 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
674 (t_nblist * gmx_restrict nlist,
675 rvec * gmx_restrict xx,
676 rvec * gmx_restrict ff,
677 struct t_forcerec * gmx_restrict fr,
678 t_mdatoms * gmx_restrict mdatoms,
679 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
680 t_nrnb * gmx_restrict nrnb)
682 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
683 * just 0 for non-waters.
684 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
685 * jnr indices corresponding to data put in the four positions in the SIMD register.
687 int i_shift_offset,i_coord_offset,outeriter,inneriter;
688 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
690 int j_coord_offsetA,j_coord_offsetB;
691 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
693 real *shiftvec,*fshift,*x,*f;
694 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
696 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
698 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
700 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
702 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
703 int vdwjidx0A,vdwjidx0B;
704 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
705 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
706 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
707 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
708 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
709 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
712 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
715 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
716 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
717 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
720 _fjsp_v2r8 dummy_mask,cutoff_mask;
721 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
722 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
723 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
730 jindex = nlist->jindex;
732 shiftidx = nlist->shift;
734 shiftvec = fr->shift_vec[0];
735 fshift = fr->fshift[0];
736 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
737 charge = mdatoms->chargeA;
738 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
739 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
740 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
741 nvdwtype = fr->ntype;
743 vdwtype = mdatoms->typeA;
745 vftab = kernel_data->table_vdw->data;
746 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
748 /* Setup water-specific parameters */
749 inr = nlist->iinr[0];
750 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
751 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
752 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
753 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
755 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
756 rcutoff_scalar = fr->ic->rcoulomb;
757 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
758 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
760 /* Avoid stupid compiler warnings */
768 /* Start outer loop over neighborlists */
769 for(iidx=0; iidx<nri; iidx++)
771 /* Load shift vector for this list */
772 i_shift_offset = DIM*shiftidx[iidx];
774 /* Load limits for loop over neighbors */
775 j_index_start = jindex[iidx];
776 j_index_end = jindex[iidx+1];
778 /* Get outer coordinate index */
780 i_coord_offset = DIM*inr;
782 /* Load i particle coords and add shift vector */
783 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
784 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
786 fix0 = _fjsp_setzero_v2r8();
787 fiy0 = _fjsp_setzero_v2r8();
788 fiz0 = _fjsp_setzero_v2r8();
789 fix1 = _fjsp_setzero_v2r8();
790 fiy1 = _fjsp_setzero_v2r8();
791 fiz1 = _fjsp_setzero_v2r8();
792 fix2 = _fjsp_setzero_v2r8();
793 fiy2 = _fjsp_setzero_v2r8();
794 fiz2 = _fjsp_setzero_v2r8();
795 fix3 = _fjsp_setzero_v2r8();
796 fiy3 = _fjsp_setzero_v2r8();
797 fiz3 = _fjsp_setzero_v2r8();
799 /* Start inner kernel loop */
800 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
803 /* Get j neighbor index, and coordinate index */
806 j_coord_offsetA = DIM*jnrA;
807 j_coord_offsetB = DIM*jnrB;
809 /* load j atom coordinates */
810 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
813 /* Calculate displacement vector */
814 dx00 = _fjsp_sub_v2r8(ix0,jx0);
815 dy00 = _fjsp_sub_v2r8(iy0,jy0);
816 dz00 = _fjsp_sub_v2r8(iz0,jz0);
817 dx10 = _fjsp_sub_v2r8(ix1,jx0);
818 dy10 = _fjsp_sub_v2r8(iy1,jy0);
819 dz10 = _fjsp_sub_v2r8(iz1,jz0);
820 dx20 = _fjsp_sub_v2r8(ix2,jx0);
821 dy20 = _fjsp_sub_v2r8(iy2,jy0);
822 dz20 = _fjsp_sub_v2r8(iz2,jz0);
823 dx30 = _fjsp_sub_v2r8(ix3,jx0);
824 dy30 = _fjsp_sub_v2r8(iy3,jy0);
825 dz30 = _fjsp_sub_v2r8(iz3,jz0);
827 /* Calculate squared distance and things based on it */
828 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
829 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
830 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
831 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
833 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
834 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
835 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
836 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
838 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
839 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
840 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
842 /* Load parameters for j particles */
843 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
844 vdwjidx0A = 2*vdwtype[jnrA+0];
845 vdwjidx0B = 2*vdwtype[jnrB+0];
847 fjx0 = _fjsp_setzero_v2r8();
848 fjy0 = _fjsp_setzero_v2r8();
849 fjz0 = _fjsp_setzero_v2r8();
851 /**************************
852 * CALCULATE INTERACTIONS *
853 **************************/
855 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
857 /* Compute parameters for interactions between i and j atoms */
858 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
859 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
861 /* Calculate table index by multiplying r with table scale and truncate to integer */
862 rt = _fjsp_mul_v2r8(r00,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 DISPERSION */
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(H,vfeps,G),F);
879 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
880 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
882 /* CUBIC SPLINE TABLE REPULSION */
883 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
884 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
885 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
886 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
887 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
888 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
889 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
890 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
891 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
892 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
896 /* Update vectorial force */
897 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
898 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
899 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
901 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
902 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
903 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
905 /**************************
906 * CALCULATE INTERACTIONS *
907 **************************/
909 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
912 /* Compute parameters for interactions between i and j atoms */
913 qq10 = _fjsp_mul_v2r8(iq1,jq0);
915 /* REACTION-FIELD ELECTROSTATICS */
916 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
918 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
922 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
924 /* Update vectorial force */
925 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
926 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
927 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
929 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
930 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
931 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
935 /**************************
936 * CALCULATE INTERACTIONS *
937 **************************/
939 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
942 /* Compute parameters for interactions between i and j atoms */
943 qq20 = _fjsp_mul_v2r8(iq2,jq0);
945 /* REACTION-FIELD ELECTROSTATICS */
946 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
948 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
952 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
954 /* Update vectorial force */
955 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
956 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
957 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
959 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
960 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
961 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
965 /**************************
966 * CALCULATE INTERACTIONS *
967 **************************/
969 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
972 /* Compute parameters for interactions between i and j atoms */
973 qq30 = _fjsp_mul_v2r8(iq3,jq0);
975 /* REACTION-FIELD ELECTROSTATICS */
976 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
978 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
982 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
984 /* Update vectorial force */
985 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
986 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
987 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
989 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
990 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
991 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
995 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
997 /* Inner loop uses 153 flops */
1000 if(jidx<j_index_end)
1004 j_coord_offsetA = DIM*jnrA;
1006 /* load j atom coordinates */
1007 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1010 /* Calculate displacement vector */
1011 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1012 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1013 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1014 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1015 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1016 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1017 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1018 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1019 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1020 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1021 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1022 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1024 /* Calculate squared distance and things based on it */
1025 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1026 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1027 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1028 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1030 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1031 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1032 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1033 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1035 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1036 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1037 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1039 /* Load parameters for j particles */
1040 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1041 vdwjidx0A = 2*vdwtype[jnrA+0];
1043 fjx0 = _fjsp_setzero_v2r8();
1044 fjy0 = _fjsp_setzero_v2r8();
1045 fjz0 = _fjsp_setzero_v2r8();
1047 /**************************
1048 * CALCULATE INTERACTIONS *
1049 **************************/
1051 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1053 /* Compute parameters for interactions between i and j atoms */
1054 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1055 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1057 /* Calculate table index by multiplying r with table scale and truncate to integer */
1058 rt = _fjsp_mul_v2r8(r00,vftabscale);
1059 itab_tmp = _fjsp_dtox_v2r8(rt);
1060 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1061 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1062 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1067 /* CUBIC SPLINE TABLE DISPERSION */
1068 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1069 F = _fjsp_setzero_v2r8();
1070 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1071 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1072 H = _fjsp_setzero_v2r8();
1073 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1074 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1075 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1076 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1078 /* CUBIC SPLINE TABLE REPULSION */
1079 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1080 F = _fjsp_setzero_v2r8();
1081 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1082 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1083 H = _fjsp_setzero_v2r8();
1084 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1085 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1086 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1087 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1088 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1092 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1094 /* Update vectorial force */
1095 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1096 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1097 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1099 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1100 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1101 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1103 /**************************
1104 * CALCULATE INTERACTIONS *
1105 **************************/
1107 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1110 /* Compute parameters for interactions between i and j atoms */
1111 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1113 /* REACTION-FIELD ELECTROSTATICS */
1114 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1116 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1120 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1122 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1124 /* Update vectorial force */
1125 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1126 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1127 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1129 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1130 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1131 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1135 /**************************
1136 * CALCULATE INTERACTIONS *
1137 **************************/
1139 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1142 /* Compute parameters for interactions between i and j atoms */
1143 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1145 /* REACTION-FIELD ELECTROSTATICS */
1146 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1148 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1152 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1154 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1156 /* Update vectorial force */
1157 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1158 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1159 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1161 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1162 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1163 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1167 /**************************
1168 * CALCULATE INTERACTIONS *
1169 **************************/
1171 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1174 /* Compute parameters for interactions between i and j atoms */
1175 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1177 /* REACTION-FIELD ELECTROSTATICS */
1178 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1180 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1184 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1186 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1188 /* Update vectorial force */
1189 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1190 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1191 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1193 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1194 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1195 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1199 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1201 /* Inner loop uses 153 flops */
1204 /* End of innermost loop */
1206 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1207 f+i_coord_offset,fshift+i_shift_offset);
1209 /* Increment number of inner iterations */
1210 inneriter += j_index_end - j_index_start;
1212 /* Outer loop uses 24 flops */
1215 /* Increment number of outer iterations */
1218 /* Update outer/inner flops */
1220 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*153);