2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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 "types/simple.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
125 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
126 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
127 nvdwtype = fr->ntype;
129 vdwtype = mdatoms->typeA;
131 vftab = kernel_data->table_vdw->data;
132 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
134 /* Setup water-specific parameters */
135 inr = nlist->iinr[0];
136 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
137 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
138 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
139 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
141 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
142 rcutoff_scalar = fr->rcoulomb;
143 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
144 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
146 /* Avoid stupid compiler warnings */
154 /* Start outer loop over neighborlists */
155 for(iidx=0; iidx<nri; iidx++)
157 /* Load shift vector for this list */
158 i_shift_offset = DIM*shiftidx[iidx];
160 /* Load limits for loop over neighbors */
161 j_index_start = jindex[iidx];
162 j_index_end = jindex[iidx+1];
164 /* Get outer coordinate index */
166 i_coord_offset = DIM*inr;
168 /* Load i particle coords and add shift vector */
169 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
170 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
172 fix0 = _fjsp_setzero_v2r8();
173 fiy0 = _fjsp_setzero_v2r8();
174 fiz0 = _fjsp_setzero_v2r8();
175 fix1 = _fjsp_setzero_v2r8();
176 fiy1 = _fjsp_setzero_v2r8();
177 fiz1 = _fjsp_setzero_v2r8();
178 fix2 = _fjsp_setzero_v2r8();
179 fiy2 = _fjsp_setzero_v2r8();
180 fiz2 = _fjsp_setzero_v2r8();
181 fix3 = _fjsp_setzero_v2r8();
182 fiy3 = _fjsp_setzero_v2r8();
183 fiz3 = _fjsp_setzero_v2r8();
185 /* Reset potential sums */
186 velecsum = _fjsp_setzero_v2r8();
187 vvdwsum = _fjsp_setzero_v2r8();
189 /* Start inner kernel loop */
190 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
193 /* Get j neighbor index, and coordinate index */
196 j_coord_offsetA = DIM*jnrA;
197 j_coord_offsetB = DIM*jnrB;
199 /* load j atom coordinates */
200 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
203 /* Calculate displacement vector */
204 dx00 = _fjsp_sub_v2r8(ix0,jx0);
205 dy00 = _fjsp_sub_v2r8(iy0,jy0);
206 dz00 = _fjsp_sub_v2r8(iz0,jz0);
207 dx10 = _fjsp_sub_v2r8(ix1,jx0);
208 dy10 = _fjsp_sub_v2r8(iy1,jy0);
209 dz10 = _fjsp_sub_v2r8(iz1,jz0);
210 dx20 = _fjsp_sub_v2r8(ix2,jx0);
211 dy20 = _fjsp_sub_v2r8(iy2,jy0);
212 dz20 = _fjsp_sub_v2r8(iz2,jz0);
213 dx30 = _fjsp_sub_v2r8(ix3,jx0);
214 dy30 = _fjsp_sub_v2r8(iy3,jy0);
215 dz30 = _fjsp_sub_v2r8(iz3,jz0);
217 /* Calculate squared distance and things based on it */
218 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
219 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
220 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
221 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
223 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
224 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
225 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
226 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
228 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
229 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
230 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
232 /* Load parameters for j particles */
233 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
234 vdwjidx0A = 2*vdwtype[jnrA+0];
235 vdwjidx0B = 2*vdwtype[jnrB+0];
237 fjx0 = _fjsp_setzero_v2r8();
238 fjy0 = _fjsp_setzero_v2r8();
239 fjz0 = _fjsp_setzero_v2r8();
241 /**************************
242 * CALCULATE INTERACTIONS *
243 **************************/
245 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
247 /* Compute parameters for interactions between i and j atoms */
248 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
249 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
251 /* Calculate table index by multiplying r with table scale and truncate to integer */
252 rt = _fjsp_mul_v2r8(r00,vftabscale);
253 itab_tmp = _fjsp_dtox_v2r8(rt);
254 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
255 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
256 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
261 /* CUBIC SPLINE TABLE DISPERSION */
262 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
263 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
264 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
265 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
266 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
267 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
268 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
269 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
270 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
271 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
272 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
274 /* CUBIC SPLINE TABLE REPULSION */
275 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
276 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
277 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
278 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
279 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
280 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
281 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
282 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
283 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
284 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
285 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
286 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
287 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
289 /* Update potential sum for this i atom from the interaction with this j atom. */
290 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
294 /* Update vectorial force */
295 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
296 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
297 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
299 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
300 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
301 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
303 /**************************
304 * CALCULATE INTERACTIONS *
305 **************************/
307 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
310 /* Compute parameters for interactions between i and j atoms */
311 qq10 = _fjsp_mul_v2r8(iq1,jq0);
313 /* REACTION-FIELD ELECTROSTATICS */
314 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
315 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
317 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
319 /* Update potential sum for this i atom from the interaction with this j atom. */
320 velec = _fjsp_and_v2r8(velec,cutoff_mask);
321 velecsum = _fjsp_add_v2r8(velecsum,velec);
325 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
327 /* Update vectorial force */
328 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
329 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
330 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
332 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
333 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
334 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
338 /**************************
339 * CALCULATE INTERACTIONS *
340 **************************/
342 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
345 /* Compute parameters for interactions between i and j atoms */
346 qq20 = _fjsp_mul_v2r8(iq2,jq0);
348 /* REACTION-FIELD ELECTROSTATICS */
349 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
350 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
352 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
354 /* Update potential sum for this i atom from the interaction with this j atom. */
355 velec = _fjsp_and_v2r8(velec,cutoff_mask);
356 velecsum = _fjsp_add_v2r8(velecsum,velec);
360 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
362 /* Update vectorial force */
363 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
364 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
365 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
367 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
368 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
369 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
373 /**************************
374 * CALCULATE INTERACTIONS *
375 **************************/
377 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
380 /* Compute parameters for interactions between i and j atoms */
381 qq30 = _fjsp_mul_v2r8(iq3,jq0);
383 /* REACTION-FIELD ELECTROSTATICS */
384 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
385 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
387 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
389 /* Update potential sum for this i atom from the interaction with this j atom. */
390 velec = _fjsp_and_v2r8(velec,cutoff_mask);
391 velecsum = _fjsp_add_v2r8(velecsum,velec);
395 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
397 /* Update vectorial force */
398 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
399 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
400 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
402 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
403 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
404 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
408 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
410 /* Inner loop uses 179 flops */
417 j_coord_offsetA = DIM*jnrA;
419 /* load j atom coordinates */
420 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
423 /* Calculate displacement vector */
424 dx00 = _fjsp_sub_v2r8(ix0,jx0);
425 dy00 = _fjsp_sub_v2r8(iy0,jy0);
426 dz00 = _fjsp_sub_v2r8(iz0,jz0);
427 dx10 = _fjsp_sub_v2r8(ix1,jx0);
428 dy10 = _fjsp_sub_v2r8(iy1,jy0);
429 dz10 = _fjsp_sub_v2r8(iz1,jz0);
430 dx20 = _fjsp_sub_v2r8(ix2,jx0);
431 dy20 = _fjsp_sub_v2r8(iy2,jy0);
432 dz20 = _fjsp_sub_v2r8(iz2,jz0);
433 dx30 = _fjsp_sub_v2r8(ix3,jx0);
434 dy30 = _fjsp_sub_v2r8(iy3,jy0);
435 dz30 = _fjsp_sub_v2r8(iz3,jz0);
437 /* Calculate squared distance and things based on it */
438 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
439 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
440 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
441 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
443 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
444 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
445 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
446 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
448 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
449 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
450 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
452 /* Load parameters for j particles */
453 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
454 vdwjidx0A = 2*vdwtype[jnrA+0];
456 fjx0 = _fjsp_setzero_v2r8();
457 fjy0 = _fjsp_setzero_v2r8();
458 fjz0 = _fjsp_setzero_v2r8();
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
466 /* Compute parameters for interactions between i and j atoms */
467 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
469 /* Calculate table index by multiplying r with table scale and truncate to integer */
470 rt = _fjsp_mul_v2r8(r00,vftabscale);
471 itab_tmp = _fjsp_dtox_v2r8(rt);
472 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
473 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
474 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
479 /* CUBIC SPLINE TABLE DISPERSION */
480 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
481 F = _fjsp_setzero_v2r8();
482 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
483 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
484 H = _fjsp_setzero_v2r8();
485 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
486 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
487 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
488 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
489 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
490 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
492 /* CUBIC SPLINE TABLE REPULSION */
493 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
494 F = _fjsp_setzero_v2r8();
495 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
496 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
497 H = _fjsp_setzero_v2r8();
498 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
499 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
500 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
501 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
502 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
503 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
504 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
505 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
507 /* Update potential sum for this i atom from the interaction with this j atom. */
508 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
509 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
513 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
515 /* Update vectorial force */
516 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
517 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
518 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
520 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
521 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
522 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
524 /**************************
525 * CALCULATE INTERACTIONS *
526 **************************/
528 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
531 /* Compute parameters for interactions between i and j atoms */
532 qq10 = _fjsp_mul_v2r8(iq1,jq0);
534 /* REACTION-FIELD ELECTROSTATICS */
535 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
536 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
538 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
540 /* Update potential sum for this i atom from the interaction with this j atom. */
541 velec = _fjsp_and_v2r8(velec,cutoff_mask);
542 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
543 velecsum = _fjsp_add_v2r8(velecsum,velec);
547 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
549 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
551 /* Update vectorial force */
552 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
553 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
554 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
556 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
557 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
558 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
562 /**************************
563 * CALCULATE INTERACTIONS *
564 **************************/
566 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
569 /* Compute parameters for interactions between i and j atoms */
570 qq20 = _fjsp_mul_v2r8(iq2,jq0);
572 /* REACTION-FIELD ELECTROSTATICS */
573 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
574 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
576 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
578 /* Update potential sum for this i atom from the interaction with this j atom. */
579 velec = _fjsp_and_v2r8(velec,cutoff_mask);
580 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
581 velecsum = _fjsp_add_v2r8(velecsum,velec);
585 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
587 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
589 /* Update vectorial force */
590 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
591 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
592 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
594 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
595 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
596 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
600 /**************************
601 * CALCULATE INTERACTIONS *
602 **************************/
604 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
607 /* Compute parameters for interactions between i and j atoms */
608 qq30 = _fjsp_mul_v2r8(iq3,jq0);
610 /* REACTION-FIELD ELECTROSTATICS */
611 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
612 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
614 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
616 /* Update potential sum for this i atom from the interaction with this j atom. */
617 velec = _fjsp_and_v2r8(velec,cutoff_mask);
618 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
619 velecsum = _fjsp_add_v2r8(velecsum,velec);
623 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
625 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
627 /* Update vectorial force */
628 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
629 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
630 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
632 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
633 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
634 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
638 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
640 /* Inner loop uses 179 flops */
643 /* End of innermost loop */
645 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
646 f+i_coord_offset,fshift+i_shift_offset);
649 /* Update potential energies */
650 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
651 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
653 /* Increment number of inner iterations */
654 inneriter += j_index_end - j_index_start;
656 /* Outer loop uses 26 flops */
659 /* Increment number of outer iterations */
662 /* Update outer/inner flops */
664 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*179);
667 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
668 * Electrostatics interaction: ReactionField
669 * VdW interaction: CubicSplineTable
670 * Geometry: Water4-Particle
671 * Calculate force/pot: Force
674 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
675 (t_nblist * gmx_restrict nlist,
676 rvec * gmx_restrict xx,
677 rvec * gmx_restrict ff,
678 t_forcerec * gmx_restrict fr,
679 t_mdatoms * gmx_restrict mdatoms,
680 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
681 t_nrnb * gmx_restrict nrnb)
683 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
684 * just 0 for non-waters.
685 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
686 * jnr indices corresponding to data put in the four positions in the SIMD register.
688 int i_shift_offset,i_coord_offset,outeriter,inneriter;
689 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
691 int j_coord_offsetA,j_coord_offsetB;
692 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
694 real *shiftvec,*fshift,*x,*f;
695 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
697 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
699 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
701 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
703 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
704 int vdwjidx0A,vdwjidx0B;
705 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
706 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
707 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
708 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
709 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
710 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
713 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
716 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
717 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
718 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
721 _fjsp_v2r8 dummy_mask,cutoff_mask;
722 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
723 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
724 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
731 jindex = nlist->jindex;
733 shiftidx = nlist->shift;
735 shiftvec = fr->shift_vec[0];
736 fshift = fr->fshift[0];
737 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
738 charge = mdatoms->chargeA;
739 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
740 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
741 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
742 nvdwtype = fr->ntype;
744 vdwtype = mdatoms->typeA;
746 vftab = kernel_data->table_vdw->data;
747 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
749 /* Setup water-specific parameters */
750 inr = nlist->iinr[0];
751 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
752 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
753 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
754 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
756 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
757 rcutoff_scalar = fr->rcoulomb;
758 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
759 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
761 /* Avoid stupid compiler warnings */
769 /* Start outer loop over neighborlists */
770 for(iidx=0; iidx<nri; iidx++)
772 /* Load shift vector for this list */
773 i_shift_offset = DIM*shiftidx[iidx];
775 /* Load limits for loop over neighbors */
776 j_index_start = jindex[iidx];
777 j_index_end = jindex[iidx+1];
779 /* Get outer coordinate index */
781 i_coord_offset = DIM*inr;
783 /* Load i particle coords and add shift vector */
784 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
785 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
787 fix0 = _fjsp_setzero_v2r8();
788 fiy0 = _fjsp_setzero_v2r8();
789 fiz0 = _fjsp_setzero_v2r8();
790 fix1 = _fjsp_setzero_v2r8();
791 fiy1 = _fjsp_setzero_v2r8();
792 fiz1 = _fjsp_setzero_v2r8();
793 fix2 = _fjsp_setzero_v2r8();
794 fiy2 = _fjsp_setzero_v2r8();
795 fiz2 = _fjsp_setzero_v2r8();
796 fix3 = _fjsp_setzero_v2r8();
797 fiy3 = _fjsp_setzero_v2r8();
798 fiz3 = _fjsp_setzero_v2r8();
800 /* Start inner kernel loop */
801 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
804 /* Get j neighbor index, and coordinate index */
807 j_coord_offsetA = DIM*jnrA;
808 j_coord_offsetB = DIM*jnrB;
810 /* load j atom coordinates */
811 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
814 /* Calculate displacement vector */
815 dx00 = _fjsp_sub_v2r8(ix0,jx0);
816 dy00 = _fjsp_sub_v2r8(iy0,jy0);
817 dz00 = _fjsp_sub_v2r8(iz0,jz0);
818 dx10 = _fjsp_sub_v2r8(ix1,jx0);
819 dy10 = _fjsp_sub_v2r8(iy1,jy0);
820 dz10 = _fjsp_sub_v2r8(iz1,jz0);
821 dx20 = _fjsp_sub_v2r8(ix2,jx0);
822 dy20 = _fjsp_sub_v2r8(iy2,jy0);
823 dz20 = _fjsp_sub_v2r8(iz2,jz0);
824 dx30 = _fjsp_sub_v2r8(ix3,jx0);
825 dy30 = _fjsp_sub_v2r8(iy3,jy0);
826 dz30 = _fjsp_sub_v2r8(iz3,jz0);
828 /* Calculate squared distance and things based on it */
829 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
830 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
831 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
832 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
834 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
835 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
836 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
837 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
839 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
840 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
841 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
843 /* Load parameters for j particles */
844 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
845 vdwjidx0A = 2*vdwtype[jnrA+0];
846 vdwjidx0B = 2*vdwtype[jnrB+0];
848 fjx0 = _fjsp_setzero_v2r8();
849 fjy0 = _fjsp_setzero_v2r8();
850 fjz0 = _fjsp_setzero_v2r8();
852 /**************************
853 * CALCULATE INTERACTIONS *
854 **************************/
856 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
858 /* Compute parameters for interactions between i and j atoms */
859 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
860 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
862 /* Calculate table index by multiplying r with table scale and truncate to integer */
863 rt = _fjsp_mul_v2r8(r00,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 DISPERSION */
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(H,vfeps,G),F);
880 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
881 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
883 /* CUBIC SPLINE TABLE REPULSION */
884 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
885 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
886 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
887 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
888 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
889 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
890 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
891 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
892 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
893 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
897 /* Update vectorial force */
898 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
899 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
900 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
902 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
903 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
904 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
906 /**************************
907 * CALCULATE INTERACTIONS *
908 **************************/
910 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
913 /* Compute parameters for interactions between i and j atoms */
914 qq10 = _fjsp_mul_v2r8(iq1,jq0);
916 /* REACTION-FIELD ELECTROSTATICS */
917 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
919 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
923 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
925 /* Update vectorial force */
926 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
927 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
928 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
930 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
931 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
932 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
936 /**************************
937 * CALCULATE INTERACTIONS *
938 **************************/
940 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
943 /* Compute parameters for interactions between i and j atoms */
944 qq20 = _fjsp_mul_v2r8(iq2,jq0);
946 /* REACTION-FIELD ELECTROSTATICS */
947 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
949 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
953 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
955 /* Update vectorial force */
956 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
957 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
958 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
960 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
961 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
962 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
966 /**************************
967 * CALCULATE INTERACTIONS *
968 **************************/
970 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
973 /* Compute parameters for interactions between i and j atoms */
974 qq30 = _fjsp_mul_v2r8(iq3,jq0);
976 /* REACTION-FIELD ELECTROSTATICS */
977 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
979 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
983 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
985 /* Update vectorial force */
986 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
987 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
988 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
990 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
991 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
992 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
996 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
998 /* Inner loop uses 153 flops */
1001 if(jidx<j_index_end)
1005 j_coord_offsetA = DIM*jnrA;
1007 /* load j atom coordinates */
1008 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1011 /* Calculate displacement vector */
1012 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1013 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1014 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1015 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1016 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1017 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1018 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1019 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1020 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1021 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1022 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1023 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1025 /* Calculate squared distance and things based on it */
1026 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1027 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1028 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1029 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1031 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1032 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1033 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1034 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1036 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1037 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1038 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1040 /* Load parameters for j particles */
1041 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1042 vdwjidx0A = 2*vdwtype[jnrA+0];
1044 fjx0 = _fjsp_setzero_v2r8();
1045 fjy0 = _fjsp_setzero_v2r8();
1046 fjz0 = _fjsp_setzero_v2r8();
1048 /**************************
1049 * CALCULATE INTERACTIONS *
1050 **************************/
1052 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1054 /* Compute parameters for interactions between i and j atoms */
1055 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&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);