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.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "gromacs/legacyheaders/vec.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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
468 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
470 /* Calculate table index by multiplying r with table scale and truncate to integer */
471 rt = _fjsp_mul_v2r8(r00,vftabscale);
472 itab_tmp = _fjsp_dtox_v2r8(rt);
473 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
474 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
475 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
480 /* CUBIC SPLINE TABLE DISPERSION */
481 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
482 F = _fjsp_setzero_v2r8();
483 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
484 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
485 H = _fjsp_setzero_v2r8();
486 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
487 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
488 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
489 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
490 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
491 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
493 /* CUBIC SPLINE TABLE REPULSION */
494 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
495 F = _fjsp_setzero_v2r8();
496 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
497 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
498 H = _fjsp_setzero_v2r8();
499 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
500 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
501 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
502 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
503 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
504 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
505 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
506 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
508 /* Update potential sum for this i atom from the interaction with this j atom. */
509 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
510 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
514 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
516 /* Update vectorial force */
517 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
518 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
519 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
521 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
522 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
523 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
525 /**************************
526 * CALCULATE INTERACTIONS *
527 **************************/
529 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
532 /* Compute parameters for interactions between i and j atoms */
533 qq10 = _fjsp_mul_v2r8(iq1,jq0);
535 /* REACTION-FIELD ELECTROSTATICS */
536 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
537 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
539 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
541 /* Update potential sum for this i atom from the interaction with this j atom. */
542 velec = _fjsp_and_v2r8(velec,cutoff_mask);
543 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
544 velecsum = _fjsp_add_v2r8(velecsum,velec);
548 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
550 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
552 /* Update vectorial force */
553 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
554 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
555 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
557 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
558 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
559 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
563 /**************************
564 * CALCULATE INTERACTIONS *
565 **************************/
567 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
570 /* Compute parameters for interactions between i and j atoms */
571 qq20 = _fjsp_mul_v2r8(iq2,jq0);
573 /* REACTION-FIELD ELECTROSTATICS */
574 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
575 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
577 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
579 /* Update potential sum for this i atom from the interaction with this j atom. */
580 velec = _fjsp_and_v2r8(velec,cutoff_mask);
581 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
582 velecsum = _fjsp_add_v2r8(velecsum,velec);
586 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
588 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
590 /* Update vectorial force */
591 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
592 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
593 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
595 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
596 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
597 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
601 /**************************
602 * CALCULATE INTERACTIONS *
603 **************************/
605 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
608 /* Compute parameters for interactions between i and j atoms */
609 qq30 = _fjsp_mul_v2r8(iq3,jq0);
611 /* REACTION-FIELD ELECTROSTATICS */
612 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
613 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
615 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
617 /* Update potential sum for this i atom from the interaction with this j atom. */
618 velec = _fjsp_and_v2r8(velec,cutoff_mask);
619 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
620 velecsum = _fjsp_add_v2r8(velecsum,velec);
624 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
626 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
628 /* Update vectorial force */
629 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
630 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
631 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
633 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
634 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
635 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
639 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
641 /* Inner loop uses 179 flops */
644 /* End of innermost loop */
646 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
647 f+i_coord_offset,fshift+i_shift_offset);
650 /* Update potential energies */
651 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
652 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
654 /* Increment number of inner iterations */
655 inneriter += j_index_end - j_index_start;
657 /* Outer loop uses 26 flops */
660 /* Increment number of outer iterations */
663 /* Update outer/inner flops */
665 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*179);
668 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
669 * Electrostatics interaction: ReactionField
670 * VdW interaction: CubicSplineTable
671 * Geometry: Water4-Particle
672 * Calculate force/pot: Force
675 nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
676 (t_nblist * gmx_restrict nlist,
677 rvec * gmx_restrict xx,
678 rvec * gmx_restrict ff,
679 t_forcerec * gmx_restrict fr,
680 t_mdatoms * gmx_restrict mdatoms,
681 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
682 t_nrnb * gmx_restrict nrnb)
684 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
685 * just 0 for non-waters.
686 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
687 * jnr indices corresponding to data put in the four positions in the SIMD register.
689 int i_shift_offset,i_coord_offset,outeriter,inneriter;
690 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
692 int j_coord_offsetA,j_coord_offsetB;
693 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
695 real *shiftvec,*fshift,*x,*f;
696 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
698 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
700 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
702 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
704 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
705 int vdwjidx0A,vdwjidx0B;
706 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
707 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
708 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
709 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
710 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
711 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
714 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
717 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
718 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
719 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
722 _fjsp_v2r8 dummy_mask,cutoff_mask;
723 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
724 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
725 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
732 jindex = nlist->jindex;
734 shiftidx = nlist->shift;
736 shiftvec = fr->shift_vec[0];
737 fshift = fr->fshift[0];
738 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
739 charge = mdatoms->chargeA;
740 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
741 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
742 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
743 nvdwtype = fr->ntype;
745 vdwtype = mdatoms->typeA;
747 vftab = kernel_data->table_vdw->data;
748 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
750 /* Setup water-specific parameters */
751 inr = nlist->iinr[0];
752 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
753 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
754 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
755 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
757 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
758 rcutoff_scalar = fr->rcoulomb;
759 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
760 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
762 /* Avoid stupid compiler warnings */
770 /* Start outer loop over neighborlists */
771 for(iidx=0; iidx<nri; iidx++)
773 /* Load shift vector for this list */
774 i_shift_offset = DIM*shiftidx[iidx];
776 /* Load limits for loop over neighbors */
777 j_index_start = jindex[iidx];
778 j_index_end = jindex[iidx+1];
780 /* Get outer coordinate index */
782 i_coord_offset = DIM*inr;
784 /* Load i particle coords and add shift vector */
785 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
786 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
788 fix0 = _fjsp_setzero_v2r8();
789 fiy0 = _fjsp_setzero_v2r8();
790 fiz0 = _fjsp_setzero_v2r8();
791 fix1 = _fjsp_setzero_v2r8();
792 fiy1 = _fjsp_setzero_v2r8();
793 fiz1 = _fjsp_setzero_v2r8();
794 fix2 = _fjsp_setzero_v2r8();
795 fiy2 = _fjsp_setzero_v2r8();
796 fiz2 = _fjsp_setzero_v2r8();
797 fix3 = _fjsp_setzero_v2r8();
798 fiy3 = _fjsp_setzero_v2r8();
799 fiz3 = _fjsp_setzero_v2r8();
801 /* Start inner kernel loop */
802 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
805 /* Get j neighbor index, and coordinate index */
808 j_coord_offsetA = DIM*jnrA;
809 j_coord_offsetB = DIM*jnrB;
811 /* load j atom coordinates */
812 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
815 /* Calculate displacement vector */
816 dx00 = _fjsp_sub_v2r8(ix0,jx0);
817 dy00 = _fjsp_sub_v2r8(iy0,jy0);
818 dz00 = _fjsp_sub_v2r8(iz0,jz0);
819 dx10 = _fjsp_sub_v2r8(ix1,jx0);
820 dy10 = _fjsp_sub_v2r8(iy1,jy0);
821 dz10 = _fjsp_sub_v2r8(iz1,jz0);
822 dx20 = _fjsp_sub_v2r8(ix2,jx0);
823 dy20 = _fjsp_sub_v2r8(iy2,jy0);
824 dz20 = _fjsp_sub_v2r8(iz2,jz0);
825 dx30 = _fjsp_sub_v2r8(ix3,jx0);
826 dy30 = _fjsp_sub_v2r8(iy3,jy0);
827 dz30 = _fjsp_sub_v2r8(iz3,jz0);
829 /* Calculate squared distance and things based on it */
830 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
831 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
832 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
833 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
835 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
836 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
837 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
838 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
840 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
841 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
842 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
844 /* Load parameters for j particles */
845 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
846 vdwjidx0A = 2*vdwtype[jnrA+0];
847 vdwjidx0B = 2*vdwtype[jnrB+0];
849 fjx0 = _fjsp_setzero_v2r8();
850 fjy0 = _fjsp_setzero_v2r8();
851 fjz0 = _fjsp_setzero_v2r8();
853 /**************************
854 * CALCULATE INTERACTIONS *
855 **************************/
857 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
859 /* Compute parameters for interactions between i and j atoms */
860 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
861 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
863 /* Calculate table index by multiplying r with table scale and truncate to integer */
864 rt = _fjsp_mul_v2r8(r00,vftabscale);
865 itab_tmp = _fjsp_dtox_v2r8(rt);
866 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
867 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
868 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
873 /* CUBIC SPLINE TABLE DISPERSION */
874 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
875 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
876 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
877 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
878 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
879 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
880 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
881 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
882 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
884 /* CUBIC SPLINE TABLE REPULSION */
885 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
886 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
887 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
888 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
889 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
890 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
891 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
892 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
893 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
894 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
898 /* Update vectorial force */
899 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
900 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
901 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
903 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
904 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
905 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
907 /**************************
908 * CALCULATE INTERACTIONS *
909 **************************/
911 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
914 /* Compute parameters for interactions between i and j atoms */
915 qq10 = _fjsp_mul_v2r8(iq1,jq0);
917 /* REACTION-FIELD ELECTROSTATICS */
918 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
920 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
924 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
926 /* Update vectorial force */
927 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
928 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
929 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
931 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
932 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
933 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
937 /**************************
938 * CALCULATE INTERACTIONS *
939 **************************/
941 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
944 /* Compute parameters for interactions between i and j atoms */
945 qq20 = _fjsp_mul_v2r8(iq2,jq0);
947 /* REACTION-FIELD ELECTROSTATICS */
948 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
950 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
954 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
956 /* Update vectorial force */
957 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
958 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
959 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
961 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
962 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
963 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
967 /**************************
968 * CALCULATE INTERACTIONS *
969 **************************/
971 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
974 /* Compute parameters for interactions between i and j atoms */
975 qq30 = _fjsp_mul_v2r8(iq3,jq0);
977 /* REACTION-FIELD ELECTROSTATICS */
978 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
980 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
984 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
986 /* Update vectorial force */
987 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
988 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
989 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
991 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
992 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
993 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
997 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
999 /* Inner loop uses 153 flops */
1002 if(jidx<j_index_end)
1006 j_coord_offsetA = DIM*jnrA;
1008 /* load j atom coordinates */
1009 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1012 /* Calculate displacement vector */
1013 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1014 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1015 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1016 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1017 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1018 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1019 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1020 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1021 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1022 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1023 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1024 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1026 /* Calculate squared distance and things based on it */
1027 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1028 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1029 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1030 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1032 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1033 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1034 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1035 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1037 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1038 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1039 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1041 /* Load parameters for j particles */
1042 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1043 vdwjidx0A = 2*vdwtype[jnrA+0];
1045 fjx0 = _fjsp_setzero_v2r8();
1046 fjy0 = _fjsp_setzero_v2r8();
1047 fjz0 = _fjsp_setzero_v2r8();
1049 /**************************
1050 * CALCULATE INTERACTIONS *
1051 **************************/
1053 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1055 /* Compute parameters for interactions between i and j atoms */
1056 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1057 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1059 /* Calculate table index by multiplying r with table scale and truncate to integer */
1060 rt = _fjsp_mul_v2r8(r00,vftabscale);
1061 itab_tmp = _fjsp_dtox_v2r8(rt);
1062 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1063 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1064 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1069 /* CUBIC SPLINE TABLE DISPERSION */
1070 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1071 F = _fjsp_setzero_v2r8();
1072 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1073 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1074 H = _fjsp_setzero_v2r8();
1075 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1076 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1077 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1078 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1080 /* CUBIC SPLINE TABLE REPULSION */
1081 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1082 F = _fjsp_setzero_v2r8();
1083 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1084 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1085 H = _fjsp_setzero_v2r8();
1086 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1087 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1088 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1089 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1090 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1094 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1096 /* Update vectorial force */
1097 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1098 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1099 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1101 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1102 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1103 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1105 /**************************
1106 * CALCULATE INTERACTIONS *
1107 **************************/
1109 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1112 /* Compute parameters for interactions between i and j atoms */
1113 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1115 /* REACTION-FIELD ELECTROSTATICS */
1116 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1118 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1122 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1124 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1126 /* Update vectorial force */
1127 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1128 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1129 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1131 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1132 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1133 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1137 /**************************
1138 * CALCULATE INTERACTIONS *
1139 **************************/
1141 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1144 /* Compute parameters for interactions between i and j atoms */
1145 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1147 /* REACTION-FIELD ELECTROSTATICS */
1148 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1150 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1154 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1156 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1158 /* Update vectorial force */
1159 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1160 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1161 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1163 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1164 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1165 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1169 /**************************
1170 * CALCULATE INTERACTIONS *
1171 **************************/
1173 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1176 /* Compute parameters for interactions between i and j atoms */
1177 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1179 /* REACTION-FIELD ELECTROSTATICS */
1180 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1182 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1186 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1188 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1190 /* Update vectorial force */
1191 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1192 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1193 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1195 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1196 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1197 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1201 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1203 /* Inner loop uses 153 flops */
1206 /* End of innermost loop */
1208 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1209 f+i_coord_offset,fshift+i_shift_offset);
1211 /* Increment number of inner iterations */
1212 inneriter += j_index_end - j_index_start;
1214 /* Outer loop uses 24 flops */
1217 /* Increment number of outer iterations */
1220 /* Update outer/inner flops */
1222 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*153);