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_ElecRF_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_ElecRF_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 /* Avoid stupid compiler warnings */
147 /* Start outer loop over neighborlists */
148 for(iidx=0; iidx<nri; iidx++)
150 /* Load shift vector for this list */
151 i_shift_offset = DIM*shiftidx[iidx];
153 /* Load limits for loop over neighbors */
154 j_index_start = jindex[iidx];
155 j_index_end = jindex[iidx+1];
157 /* Get outer coordinate index */
159 i_coord_offset = DIM*inr;
161 /* Load i particle coords and add shift vector */
162 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
163 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
165 fix0 = _fjsp_setzero_v2r8();
166 fiy0 = _fjsp_setzero_v2r8();
167 fiz0 = _fjsp_setzero_v2r8();
168 fix1 = _fjsp_setzero_v2r8();
169 fiy1 = _fjsp_setzero_v2r8();
170 fiz1 = _fjsp_setzero_v2r8();
171 fix2 = _fjsp_setzero_v2r8();
172 fiy2 = _fjsp_setzero_v2r8();
173 fiz2 = _fjsp_setzero_v2r8();
174 fix3 = _fjsp_setzero_v2r8();
175 fiy3 = _fjsp_setzero_v2r8();
176 fiz3 = _fjsp_setzero_v2r8();
178 /* Reset potential sums */
179 velecsum = _fjsp_setzero_v2r8();
180 vvdwsum = _fjsp_setzero_v2r8();
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
186 /* Get j neighbor index, and coordinate index */
189 j_coord_offsetA = DIM*jnrA;
190 j_coord_offsetB = DIM*jnrB;
192 /* load j atom coordinates */
193 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
196 /* Calculate displacement vector */
197 dx00 = _fjsp_sub_v2r8(ix0,jx0);
198 dy00 = _fjsp_sub_v2r8(iy0,jy0);
199 dz00 = _fjsp_sub_v2r8(iz0,jz0);
200 dx10 = _fjsp_sub_v2r8(ix1,jx0);
201 dy10 = _fjsp_sub_v2r8(iy1,jy0);
202 dz10 = _fjsp_sub_v2r8(iz1,jz0);
203 dx20 = _fjsp_sub_v2r8(ix2,jx0);
204 dy20 = _fjsp_sub_v2r8(iy2,jy0);
205 dz20 = _fjsp_sub_v2r8(iz2,jz0);
206 dx30 = _fjsp_sub_v2r8(ix3,jx0);
207 dy30 = _fjsp_sub_v2r8(iy3,jy0);
208 dz30 = _fjsp_sub_v2r8(iz3,jz0);
210 /* Calculate squared distance and things based on it */
211 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
212 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
213 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
214 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
216 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
217 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
218 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
219 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
221 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
222 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
223 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
225 /* Load parameters for j particles */
226 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
227 vdwjidx0A = 2*vdwtype[jnrA+0];
228 vdwjidx0B = 2*vdwtype[jnrB+0];
230 fjx0 = _fjsp_setzero_v2r8();
231 fjy0 = _fjsp_setzero_v2r8();
232 fjz0 = _fjsp_setzero_v2r8();
234 /**************************
235 * CALCULATE INTERACTIONS *
236 **************************/
238 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
240 /* Compute parameters for interactions between i and j atoms */
241 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
242 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
244 /* Calculate table index by multiplying r with table scale and truncate to integer */
245 rt = _fjsp_mul_v2r8(r00,vftabscale);
246 itab_tmp = _fjsp_dtox_v2r8(rt);
247 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
248 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
249 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
254 /* CUBIC SPLINE TABLE DISPERSION */
255 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
256 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
257 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
258 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
259 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
260 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
261 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
262 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
263 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
264 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
265 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
267 /* CUBIC SPLINE TABLE REPULSION */
268 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
269 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
270 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
271 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
272 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
273 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
274 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
275 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
276 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
277 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
278 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
279 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
280 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
282 /* Update potential sum for this i atom from the interaction with this j atom. */
283 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
287 /* Update vectorial force */
288 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
289 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
290 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
292 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
293 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
294 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
296 /**************************
297 * CALCULATE INTERACTIONS *
298 **************************/
300 /* Compute parameters for interactions between i and j atoms */
301 qq10 = _fjsp_mul_v2r8(iq1,jq0);
303 /* REACTION-FIELD ELECTROSTATICS */
304 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
305 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
307 /* Update potential sum for this i atom from the interaction with this j atom. */
308 velecsum = _fjsp_add_v2r8(velecsum,velec);
312 /* Update vectorial force */
313 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
314 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
315 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
317 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
318 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
319 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
321 /**************************
322 * CALCULATE INTERACTIONS *
323 **************************/
325 /* Compute parameters for interactions between i and j atoms */
326 qq20 = _fjsp_mul_v2r8(iq2,jq0);
328 /* REACTION-FIELD ELECTROSTATICS */
329 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
330 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
332 /* Update potential sum for this i atom from the interaction with this j atom. */
333 velecsum = _fjsp_add_v2r8(velecsum,velec);
337 /* Update vectorial force */
338 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
339 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
340 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
342 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
343 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
344 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
346 /**************************
347 * CALCULATE INTERACTIONS *
348 **************************/
350 /* Compute parameters for interactions between i and j atoms */
351 qq30 = _fjsp_mul_v2r8(iq3,jq0);
353 /* REACTION-FIELD ELECTROSTATICS */
354 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
355 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
357 /* Update potential sum for this i atom from the interaction with this j atom. */
358 velecsum = _fjsp_add_v2r8(velecsum,velec);
362 /* Update vectorial force */
363 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
364 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
365 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
367 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
368 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
369 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
371 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
373 /* Inner loop uses 167 flops */
380 j_coord_offsetA = DIM*jnrA;
382 /* load j atom coordinates */
383 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
386 /* Calculate displacement vector */
387 dx00 = _fjsp_sub_v2r8(ix0,jx0);
388 dy00 = _fjsp_sub_v2r8(iy0,jy0);
389 dz00 = _fjsp_sub_v2r8(iz0,jz0);
390 dx10 = _fjsp_sub_v2r8(ix1,jx0);
391 dy10 = _fjsp_sub_v2r8(iy1,jy0);
392 dz10 = _fjsp_sub_v2r8(iz1,jz0);
393 dx20 = _fjsp_sub_v2r8(ix2,jx0);
394 dy20 = _fjsp_sub_v2r8(iy2,jy0);
395 dz20 = _fjsp_sub_v2r8(iz2,jz0);
396 dx30 = _fjsp_sub_v2r8(ix3,jx0);
397 dy30 = _fjsp_sub_v2r8(iy3,jy0);
398 dz30 = _fjsp_sub_v2r8(iz3,jz0);
400 /* Calculate squared distance and things based on it */
401 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
402 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
403 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
404 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
406 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
407 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
408 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
409 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
411 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
412 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
413 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
415 /* Load parameters for j particles */
416 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
417 vdwjidx0A = 2*vdwtype[jnrA+0];
419 fjx0 = _fjsp_setzero_v2r8();
420 fjy0 = _fjsp_setzero_v2r8();
421 fjz0 = _fjsp_setzero_v2r8();
423 /**************************
424 * CALCULATE INTERACTIONS *
425 **************************/
427 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
429 /* Compute parameters for interactions between i and j atoms */
430 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
432 /* Calculate table index by multiplying r with table scale and truncate to integer */
433 rt = _fjsp_mul_v2r8(r00,vftabscale);
434 itab_tmp = _fjsp_dtox_v2r8(rt);
435 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
436 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
437 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
442 /* CUBIC SPLINE TABLE DISPERSION */
443 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
444 F = _fjsp_setzero_v2r8();
445 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
446 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
447 H = _fjsp_setzero_v2r8();
448 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
449 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
450 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
451 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
452 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
453 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
455 /* CUBIC SPLINE TABLE REPULSION */
456 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
457 F = _fjsp_setzero_v2r8();
458 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
459 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
460 H = _fjsp_setzero_v2r8();
461 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
462 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
463 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
464 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
465 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
466 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
467 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
468 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
470 /* Update potential sum for this i atom from the interaction with this j atom. */
471 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
472 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
476 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
478 /* Update vectorial force */
479 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
480 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
481 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
483 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
484 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
485 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
487 /**************************
488 * CALCULATE INTERACTIONS *
489 **************************/
491 /* Compute parameters for interactions between i and j atoms */
492 qq10 = _fjsp_mul_v2r8(iq1,jq0);
494 /* REACTION-FIELD ELECTROSTATICS */
495 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
496 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
498 /* Update potential sum for this i atom from the interaction with this j atom. */
499 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
500 velecsum = _fjsp_add_v2r8(velecsum,velec);
504 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
506 /* Update vectorial force */
507 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
508 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
509 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
511 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
512 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
513 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
515 /**************************
516 * CALCULATE INTERACTIONS *
517 **************************/
519 /* Compute parameters for interactions between i and j atoms */
520 qq20 = _fjsp_mul_v2r8(iq2,jq0);
522 /* REACTION-FIELD ELECTROSTATICS */
523 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
524 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
526 /* Update potential sum for this i atom from the interaction with this j atom. */
527 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
528 velecsum = _fjsp_add_v2r8(velecsum,velec);
532 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
534 /* Update vectorial force */
535 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
536 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
537 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
539 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
540 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
541 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
543 /**************************
544 * CALCULATE INTERACTIONS *
545 **************************/
547 /* Compute parameters for interactions between i and j atoms */
548 qq30 = _fjsp_mul_v2r8(iq3,jq0);
550 /* REACTION-FIELD ELECTROSTATICS */
551 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
552 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
554 /* Update potential sum for this i atom from the interaction with this j atom. */
555 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
556 velecsum = _fjsp_add_v2r8(velecsum,velec);
560 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
562 /* Update vectorial force */
563 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
564 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
565 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
567 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
568 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
569 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
571 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
573 /* Inner loop uses 167 flops */
576 /* End of innermost loop */
578 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
579 f+i_coord_offset,fshift+i_shift_offset);
582 /* Update potential energies */
583 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
584 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
586 /* Increment number of inner iterations */
587 inneriter += j_index_end - j_index_start;
589 /* Outer loop uses 26 flops */
592 /* Increment number of outer iterations */
595 /* Update outer/inner flops */
597 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*167);
600 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
601 * Electrostatics interaction: ReactionField
602 * VdW interaction: CubicSplineTable
603 * Geometry: Water4-Particle
604 * Calculate force/pot: Force
607 nb_kernel_ElecRF_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
608 (t_nblist * gmx_restrict nlist,
609 rvec * gmx_restrict xx,
610 rvec * gmx_restrict ff,
611 t_forcerec * gmx_restrict fr,
612 t_mdatoms * gmx_restrict mdatoms,
613 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
614 t_nrnb * gmx_restrict nrnb)
616 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
617 * just 0 for non-waters.
618 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
619 * jnr indices corresponding to data put in the four positions in the SIMD register.
621 int i_shift_offset,i_coord_offset,outeriter,inneriter;
622 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
624 int j_coord_offsetA,j_coord_offsetB;
625 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
627 real *shiftvec,*fshift,*x,*f;
628 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
630 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
632 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
634 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
636 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
637 int vdwjidx0A,vdwjidx0B;
638 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
639 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
640 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
641 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
642 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
643 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
646 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
649 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
650 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
651 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
654 _fjsp_v2r8 dummy_mask,cutoff_mask;
655 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
656 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
657 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
664 jindex = nlist->jindex;
666 shiftidx = nlist->shift;
668 shiftvec = fr->shift_vec[0];
669 fshift = fr->fshift[0];
670 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
671 charge = mdatoms->chargeA;
672 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
673 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
674 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
675 nvdwtype = fr->ntype;
677 vdwtype = mdatoms->typeA;
679 vftab = kernel_data->table_vdw->data;
680 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
682 /* Setup water-specific parameters */
683 inr = nlist->iinr[0];
684 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
685 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
686 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
687 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
689 /* Avoid stupid compiler warnings */
697 /* Start outer loop over neighborlists */
698 for(iidx=0; iidx<nri; iidx++)
700 /* Load shift vector for this list */
701 i_shift_offset = DIM*shiftidx[iidx];
703 /* Load limits for loop over neighbors */
704 j_index_start = jindex[iidx];
705 j_index_end = jindex[iidx+1];
707 /* Get outer coordinate index */
709 i_coord_offset = DIM*inr;
711 /* Load i particle coords and add shift vector */
712 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
713 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
715 fix0 = _fjsp_setzero_v2r8();
716 fiy0 = _fjsp_setzero_v2r8();
717 fiz0 = _fjsp_setzero_v2r8();
718 fix1 = _fjsp_setzero_v2r8();
719 fiy1 = _fjsp_setzero_v2r8();
720 fiz1 = _fjsp_setzero_v2r8();
721 fix2 = _fjsp_setzero_v2r8();
722 fiy2 = _fjsp_setzero_v2r8();
723 fiz2 = _fjsp_setzero_v2r8();
724 fix3 = _fjsp_setzero_v2r8();
725 fiy3 = _fjsp_setzero_v2r8();
726 fiz3 = _fjsp_setzero_v2r8();
728 /* Start inner kernel loop */
729 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
732 /* Get j neighbor index, and coordinate index */
735 j_coord_offsetA = DIM*jnrA;
736 j_coord_offsetB = DIM*jnrB;
738 /* load j atom coordinates */
739 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
742 /* Calculate displacement vector */
743 dx00 = _fjsp_sub_v2r8(ix0,jx0);
744 dy00 = _fjsp_sub_v2r8(iy0,jy0);
745 dz00 = _fjsp_sub_v2r8(iz0,jz0);
746 dx10 = _fjsp_sub_v2r8(ix1,jx0);
747 dy10 = _fjsp_sub_v2r8(iy1,jy0);
748 dz10 = _fjsp_sub_v2r8(iz1,jz0);
749 dx20 = _fjsp_sub_v2r8(ix2,jx0);
750 dy20 = _fjsp_sub_v2r8(iy2,jy0);
751 dz20 = _fjsp_sub_v2r8(iz2,jz0);
752 dx30 = _fjsp_sub_v2r8(ix3,jx0);
753 dy30 = _fjsp_sub_v2r8(iy3,jy0);
754 dz30 = _fjsp_sub_v2r8(iz3,jz0);
756 /* Calculate squared distance and things based on it */
757 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
758 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
759 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
760 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
762 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
763 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
764 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
765 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
767 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
768 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
769 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
771 /* Load parameters for j particles */
772 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
773 vdwjidx0A = 2*vdwtype[jnrA+0];
774 vdwjidx0B = 2*vdwtype[jnrB+0];
776 fjx0 = _fjsp_setzero_v2r8();
777 fjy0 = _fjsp_setzero_v2r8();
778 fjz0 = _fjsp_setzero_v2r8();
780 /**************************
781 * CALCULATE INTERACTIONS *
782 **************************/
784 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
786 /* Compute parameters for interactions between i and j atoms */
787 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
788 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
790 /* Calculate table index by multiplying r with table scale and truncate to integer */
791 rt = _fjsp_mul_v2r8(r00,vftabscale);
792 itab_tmp = _fjsp_dtox_v2r8(rt);
793 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
794 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
795 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
800 /* CUBIC SPLINE TABLE DISPERSION */
801 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
802 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
803 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
804 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
805 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
806 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
807 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
808 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
809 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
811 /* CUBIC SPLINE TABLE REPULSION */
812 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
813 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
814 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
815 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
816 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
817 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
818 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
819 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
820 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
821 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
825 /* Update vectorial force */
826 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
827 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
828 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
830 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
831 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
832 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
834 /**************************
835 * CALCULATE INTERACTIONS *
836 **************************/
838 /* Compute parameters for interactions between i and j atoms */
839 qq10 = _fjsp_mul_v2r8(iq1,jq0);
841 /* REACTION-FIELD ELECTROSTATICS */
842 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
846 /* Update vectorial force */
847 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
848 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
849 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
851 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
852 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
853 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
855 /**************************
856 * CALCULATE INTERACTIONS *
857 **************************/
859 /* Compute parameters for interactions between i and j atoms */
860 qq20 = _fjsp_mul_v2r8(iq2,jq0);
862 /* REACTION-FIELD ELECTROSTATICS */
863 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
867 /* Update vectorial force */
868 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
869 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
870 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
872 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
873 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
874 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
876 /**************************
877 * CALCULATE INTERACTIONS *
878 **************************/
880 /* Compute parameters for interactions between i and j atoms */
881 qq30 = _fjsp_mul_v2r8(iq3,jq0);
883 /* REACTION-FIELD ELECTROSTATICS */
884 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
888 /* Update vectorial force */
889 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
890 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
891 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
893 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
894 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
895 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
897 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
899 /* Inner loop uses 144 flops */
906 j_coord_offsetA = DIM*jnrA;
908 /* load j atom coordinates */
909 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
912 /* Calculate displacement vector */
913 dx00 = _fjsp_sub_v2r8(ix0,jx0);
914 dy00 = _fjsp_sub_v2r8(iy0,jy0);
915 dz00 = _fjsp_sub_v2r8(iz0,jz0);
916 dx10 = _fjsp_sub_v2r8(ix1,jx0);
917 dy10 = _fjsp_sub_v2r8(iy1,jy0);
918 dz10 = _fjsp_sub_v2r8(iz1,jz0);
919 dx20 = _fjsp_sub_v2r8(ix2,jx0);
920 dy20 = _fjsp_sub_v2r8(iy2,jy0);
921 dz20 = _fjsp_sub_v2r8(iz2,jz0);
922 dx30 = _fjsp_sub_v2r8(ix3,jx0);
923 dy30 = _fjsp_sub_v2r8(iy3,jy0);
924 dz30 = _fjsp_sub_v2r8(iz3,jz0);
926 /* Calculate squared distance and things based on it */
927 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
928 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
929 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
930 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
932 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
933 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
934 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
935 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
937 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
938 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
939 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
941 /* Load parameters for j particles */
942 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
943 vdwjidx0A = 2*vdwtype[jnrA+0];
945 fjx0 = _fjsp_setzero_v2r8();
946 fjy0 = _fjsp_setzero_v2r8();
947 fjz0 = _fjsp_setzero_v2r8();
949 /**************************
950 * CALCULATE INTERACTIONS *
951 **************************/
953 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
955 /* Compute parameters for interactions between i and j atoms */
956 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
958 /* Calculate table index by multiplying r with table scale and truncate to integer */
959 rt = _fjsp_mul_v2r8(r00,vftabscale);
960 itab_tmp = _fjsp_dtox_v2r8(rt);
961 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
962 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
963 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
968 /* CUBIC SPLINE TABLE DISPERSION */
969 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
970 F = _fjsp_setzero_v2r8();
971 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
972 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
973 H = _fjsp_setzero_v2r8();
974 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
975 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
976 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
977 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
979 /* CUBIC SPLINE TABLE REPULSION */
980 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
981 F = _fjsp_setzero_v2r8();
982 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
983 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
984 H = _fjsp_setzero_v2r8();
985 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
986 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
987 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
988 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
989 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
993 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
995 /* Update vectorial force */
996 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
997 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
998 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1000 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1001 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1002 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1004 /**************************
1005 * CALCULATE INTERACTIONS *
1006 **************************/
1008 /* Compute parameters for interactions between i and j atoms */
1009 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1011 /* REACTION-FIELD ELECTROSTATICS */
1012 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1016 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1018 /* Update vectorial force */
1019 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1020 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1021 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1023 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1024 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1025 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1027 /**************************
1028 * CALCULATE INTERACTIONS *
1029 **************************/
1031 /* Compute parameters for interactions between i and j atoms */
1032 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1034 /* REACTION-FIELD ELECTROSTATICS */
1035 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1039 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1041 /* Update vectorial force */
1042 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1043 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1044 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1046 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1047 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1048 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1050 /**************************
1051 * CALCULATE INTERACTIONS *
1052 **************************/
1054 /* Compute parameters for interactions between i and j atoms */
1055 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1057 /* REACTION-FIELD ELECTROSTATICS */
1058 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1062 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1064 /* Update vectorial force */
1065 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1066 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1067 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1069 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1070 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1071 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1073 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1075 /* Inner loop uses 144 flops */
1078 /* End of innermost loop */
1080 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1081 f+i_coord_offset,fshift+i_shift_offset);
1083 /* Increment number of inner iterations */
1084 inneriter += j_index_end - j_index_start;
1086 /* Outer loop uses 24 flops */
1089 /* Increment number of outer iterations */
1092 /* Update outer/inner flops */
1094 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*144);