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_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 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
121 charge = mdatoms->chargeA;
122 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->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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
467 /* Calculate table index by multiplying r with table scale and truncate to integer */
468 rt = _fjsp_mul_v2r8(r00,vftabscale);
469 itab_tmp = _fjsp_dtox_v2r8(rt);
470 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
471 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
472 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
477 /* CUBIC SPLINE TABLE DISPERSION */
478 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
479 F = _fjsp_setzero_v2r8();
480 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
481 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
482 H = _fjsp_setzero_v2r8();
483 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
484 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
485 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
486 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
487 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
488 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
490 /* CUBIC SPLINE TABLE REPULSION */
491 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
492 F = _fjsp_setzero_v2r8();
493 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
494 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
495 H = _fjsp_setzero_v2r8();
496 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
497 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
498 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
499 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
500 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
501 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
502 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
503 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
505 /* Update potential sum for this i atom from the interaction with this j atom. */
506 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
507 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
511 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
513 /* Update vectorial force */
514 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
515 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
516 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
518 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
519 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
520 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
522 /**************************
523 * CALCULATE INTERACTIONS *
524 **************************/
526 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
529 /* Compute parameters for interactions between i and j atoms */
530 qq10 = _fjsp_mul_v2r8(iq1,jq0);
532 /* REACTION-FIELD ELECTROSTATICS */
533 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
534 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
536 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
538 /* Update potential sum for this i atom from the interaction with this j atom. */
539 velec = _fjsp_and_v2r8(velec,cutoff_mask);
540 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
541 velecsum = _fjsp_add_v2r8(velecsum,velec);
545 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
547 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
549 /* Update vectorial force */
550 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
551 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
552 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
554 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
555 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
556 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
560 /**************************
561 * CALCULATE INTERACTIONS *
562 **************************/
564 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
567 /* Compute parameters for interactions between i and j atoms */
568 qq20 = _fjsp_mul_v2r8(iq2,jq0);
570 /* REACTION-FIELD ELECTROSTATICS */
571 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
572 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
574 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
576 /* Update potential sum for this i atom from the interaction with this j atom. */
577 velec = _fjsp_and_v2r8(velec,cutoff_mask);
578 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
579 velecsum = _fjsp_add_v2r8(velecsum,velec);
583 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
585 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
587 /* Update vectorial force */
588 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
589 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
590 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
592 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
593 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
594 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
598 /**************************
599 * CALCULATE INTERACTIONS *
600 **************************/
602 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
605 /* Compute parameters for interactions between i and j atoms */
606 qq30 = _fjsp_mul_v2r8(iq3,jq0);
608 /* REACTION-FIELD ELECTROSTATICS */
609 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
610 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
612 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
614 /* Update potential sum for this i atom from the interaction with this j atom. */
615 velec = _fjsp_and_v2r8(velec,cutoff_mask);
616 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
617 velecsum = _fjsp_add_v2r8(velecsum,velec);
621 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
623 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
625 /* Update vectorial force */
626 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
627 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
628 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
630 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
631 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
632 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
636 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
638 /* Inner loop uses 179 flops */
641 /* End of innermost loop */
643 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
644 f+i_coord_offset,fshift+i_shift_offset);
647 /* Update potential energies */
648 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
649 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
651 /* Increment number of inner iterations */
652 inneriter += j_index_end - j_index_start;
654 /* Outer loop uses 26 flops */
657 /* Increment number of outer iterations */
660 /* Update outer/inner flops */
662 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*179);
665 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
666 * Electrostatics interaction: ReactionField
667 * VdW interaction: CubicSplineTable
668 * Geometry: Water4-Particle
669 * Calculate force/pot: Force
672 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
673 (t_nblist * gmx_restrict nlist,
674 rvec * gmx_restrict xx,
675 rvec * gmx_restrict ff,
676 t_forcerec * gmx_restrict fr,
677 t_mdatoms * gmx_restrict mdatoms,
678 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
679 t_nrnb * gmx_restrict nrnb)
681 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
682 * just 0 for non-waters.
683 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
684 * jnr indices corresponding to data put in the four positions in the SIMD register.
686 int i_shift_offset,i_coord_offset,outeriter,inneriter;
687 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
689 int j_coord_offsetA,j_coord_offsetB;
690 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
692 real *shiftvec,*fshift,*x,*f;
693 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
695 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
697 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
699 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
701 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
702 int vdwjidx0A,vdwjidx0B;
703 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
704 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
705 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
706 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
707 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
708 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
711 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
714 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
715 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
716 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
719 _fjsp_v2r8 dummy_mask,cutoff_mask;
720 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
721 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
722 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
729 jindex = nlist->jindex;
731 shiftidx = nlist->shift;
733 shiftvec = fr->shift_vec[0];
734 fshift = fr->fshift[0];
735 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
736 charge = mdatoms->chargeA;
737 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
738 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
739 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
740 nvdwtype = fr->ntype;
742 vdwtype = mdatoms->typeA;
744 vftab = kernel_data->table_vdw->data;
745 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
747 /* Setup water-specific parameters */
748 inr = nlist->iinr[0];
749 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
750 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
751 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
752 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
754 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
755 rcutoff_scalar = fr->rcoulomb;
756 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
757 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
759 /* Avoid stupid compiler warnings */
767 /* Start outer loop over neighborlists */
768 for(iidx=0; iidx<nri; iidx++)
770 /* Load shift vector for this list */
771 i_shift_offset = DIM*shiftidx[iidx];
773 /* Load limits for loop over neighbors */
774 j_index_start = jindex[iidx];
775 j_index_end = jindex[iidx+1];
777 /* Get outer coordinate index */
779 i_coord_offset = DIM*inr;
781 /* Load i particle coords and add shift vector */
782 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
783 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
785 fix0 = _fjsp_setzero_v2r8();
786 fiy0 = _fjsp_setzero_v2r8();
787 fiz0 = _fjsp_setzero_v2r8();
788 fix1 = _fjsp_setzero_v2r8();
789 fiy1 = _fjsp_setzero_v2r8();
790 fiz1 = _fjsp_setzero_v2r8();
791 fix2 = _fjsp_setzero_v2r8();
792 fiy2 = _fjsp_setzero_v2r8();
793 fiz2 = _fjsp_setzero_v2r8();
794 fix3 = _fjsp_setzero_v2r8();
795 fiy3 = _fjsp_setzero_v2r8();
796 fiz3 = _fjsp_setzero_v2r8();
798 /* Start inner kernel loop */
799 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
802 /* Get j neighbor index, and coordinate index */
805 j_coord_offsetA = DIM*jnrA;
806 j_coord_offsetB = DIM*jnrB;
808 /* load j atom coordinates */
809 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
812 /* Calculate displacement vector */
813 dx00 = _fjsp_sub_v2r8(ix0,jx0);
814 dy00 = _fjsp_sub_v2r8(iy0,jy0);
815 dz00 = _fjsp_sub_v2r8(iz0,jz0);
816 dx10 = _fjsp_sub_v2r8(ix1,jx0);
817 dy10 = _fjsp_sub_v2r8(iy1,jy0);
818 dz10 = _fjsp_sub_v2r8(iz1,jz0);
819 dx20 = _fjsp_sub_v2r8(ix2,jx0);
820 dy20 = _fjsp_sub_v2r8(iy2,jy0);
821 dz20 = _fjsp_sub_v2r8(iz2,jz0);
822 dx30 = _fjsp_sub_v2r8(ix3,jx0);
823 dy30 = _fjsp_sub_v2r8(iy3,jy0);
824 dz30 = _fjsp_sub_v2r8(iz3,jz0);
826 /* Calculate squared distance and things based on it */
827 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
828 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
829 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
830 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
832 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
833 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
834 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
835 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
837 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
838 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
839 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
841 /* Load parameters for j particles */
842 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
843 vdwjidx0A = 2*vdwtype[jnrA+0];
844 vdwjidx0B = 2*vdwtype[jnrB+0];
846 fjx0 = _fjsp_setzero_v2r8();
847 fjy0 = _fjsp_setzero_v2r8();
848 fjz0 = _fjsp_setzero_v2r8();
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
854 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
856 /* Compute parameters for interactions between i and j atoms */
857 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
858 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
860 /* Calculate table index by multiplying r with table scale and truncate to integer */
861 rt = _fjsp_mul_v2r8(r00,vftabscale);
862 itab_tmp = _fjsp_dtox_v2r8(rt);
863 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
864 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
865 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
870 /* CUBIC SPLINE TABLE DISPERSION */
871 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
872 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
873 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
874 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
875 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
876 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
877 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
878 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
879 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
881 /* CUBIC SPLINE TABLE REPULSION */
882 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
883 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
884 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
885 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
886 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
887 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
888 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
889 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
890 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
891 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
895 /* Update vectorial force */
896 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
897 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
898 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
900 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
901 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
902 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
908 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
911 /* Compute parameters for interactions between i and j atoms */
912 qq10 = _fjsp_mul_v2r8(iq1,jq0);
914 /* REACTION-FIELD ELECTROSTATICS */
915 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
917 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
921 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
923 /* Update vectorial force */
924 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
925 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
926 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
928 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
929 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
930 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
934 /**************************
935 * CALCULATE INTERACTIONS *
936 **************************/
938 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
941 /* Compute parameters for interactions between i and j atoms */
942 qq20 = _fjsp_mul_v2r8(iq2,jq0);
944 /* REACTION-FIELD ELECTROSTATICS */
945 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
947 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
951 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
953 /* Update vectorial force */
954 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
955 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
956 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
958 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
959 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
960 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
964 /**************************
965 * CALCULATE INTERACTIONS *
966 **************************/
968 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
971 /* Compute parameters for interactions between i and j atoms */
972 qq30 = _fjsp_mul_v2r8(iq3,jq0);
974 /* REACTION-FIELD ELECTROSTATICS */
975 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
977 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
981 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
983 /* Update vectorial force */
984 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
985 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
986 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
988 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
989 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
990 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
994 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
996 /* Inner loop uses 153 flops */
1003 j_coord_offsetA = DIM*jnrA;
1005 /* load j atom coordinates */
1006 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1009 /* Calculate displacement vector */
1010 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1011 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1012 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1013 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1014 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1015 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1016 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1017 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1018 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1019 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1020 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1021 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1023 /* Calculate squared distance and things based on it */
1024 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1025 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1026 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1027 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1029 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1030 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1031 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1032 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1034 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1035 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1036 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1038 /* Load parameters for j particles */
1039 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1040 vdwjidx0A = 2*vdwtype[jnrA+0];
1042 fjx0 = _fjsp_setzero_v2r8();
1043 fjy0 = _fjsp_setzero_v2r8();
1044 fjz0 = _fjsp_setzero_v2r8();
1046 /**************************
1047 * CALCULATE INTERACTIONS *
1048 **************************/
1050 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1052 /* Compute parameters for interactions between i and j atoms */
1053 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1055 /* Calculate table index by multiplying r with table scale and truncate to integer */
1056 rt = _fjsp_mul_v2r8(r00,vftabscale);
1057 itab_tmp = _fjsp_dtox_v2r8(rt);
1058 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1059 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1060 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1065 /* CUBIC SPLINE TABLE DISPERSION */
1066 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1067 F = _fjsp_setzero_v2r8();
1068 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1069 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1070 H = _fjsp_setzero_v2r8();
1071 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1072 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1073 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1074 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1076 /* CUBIC SPLINE TABLE REPULSION */
1077 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1078 F = _fjsp_setzero_v2r8();
1079 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1080 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1081 H = _fjsp_setzero_v2r8();
1082 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1083 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1084 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1085 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1086 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1090 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1092 /* Update vectorial force */
1093 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1094 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1095 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1097 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1098 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1099 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1101 /**************************
1102 * CALCULATE INTERACTIONS *
1103 **************************/
1105 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1108 /* Compute parameters for interactions between i and j atoms */
1109 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1111 /* REACTION-FIELD ELECTROSTATICS */
1112 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1114 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1118 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1120 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1122 /* Update vectorial force */
1123 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1124 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1125 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1127 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1128 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1129 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1133 /**************************
1134 * CALCULATE INTERACTIONS *
1135 **************************/
1137 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1140 /* Compute parameters for interactions between i and j atoms */
1141 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1143 /* REACTION-FIELD ELECTROSTATICS */
1144 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1146 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1150 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1152 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1154 /* Update vectorial force */
1155 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1156 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1157 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1159 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1160 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1161 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1165 /**************************
1166 * CALCULATE INTERACTIONS *
1167 **************************/
1169 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1172 /* Compute parameters for interactions between i and j atoms */
1173 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1175 /* REACTION-FIELD ELECTROSTATICS */
1176 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1178 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1182 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1184 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1186 /* Update vectorial force */
1187 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1188 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1189 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1191 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1192 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1193 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1197 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1199 /* Inner loop uses 153 flops */
1202 /* End of innermost loop */
1204 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1205 f+i_coord_offset,fshift+i_shift_offset);
1207 /* Increment number of inner iterations */
1208 inneriter += j_index_end - j_index_start;
1210 /* Outer loop uses 24 flops */
1213 /* Increment number of outer iterations */
1216 /* Update outer/inner flops */
1218 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*153);