2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_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 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
121 charge = mdatoms->chargeA;
122 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
123 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
124 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
125 nvdwtype = fr->ntype;
127 vdwtype = mdatoms->typeA;
129 vftab = kernel_data->table_vdw->data;
130 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
132 /* Setup water-specific parameters */
133 inr = nlist->iinr[0];
134 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
135 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
136 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
137 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
139 /* 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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
431 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
433 /* Calculate table index by multiplying r with table scale and truncate to integer */
434 rt = _fjsp_mul_v2r8(r00,vftabscale);
435 itab_tmp = _fjsp_dtox_v2r8(rt);
436 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
437 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
438 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
443 /* CUBIC SPLINE TABLE DISPERSION */
444 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
445 F = _fjsp_setzero_v2r8();
446 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
447 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
448 H = _fjsp_setzero_v2r8();
449 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
450 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
451 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
452 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
453 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
454 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
456 /* CUBIC SPLINE TABLE REPULSION */
457 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
458 F = _fjsp_setzero_v2r8();
459 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
460 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
461 H = _fjsp_setzero_v2r8();
462 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
463 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
464 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
465 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
466 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
467 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
468 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
469 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
471 /* Update potential sum for this i atom from the interaction with this j atom. */
472 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
473 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
477 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
479 /* Update vectorial force */
480 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
481 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
482 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
484 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
485 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
486 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
488 /**************************
489 * CALCULATE INTERACTIONS *
490 **************************/
492 /* Compute parameters for interactions between i and j atoms */
493 qq10 = _fjsp_mul_v2r8(iq1,jq0);
495 /* REACTION-FIELD ELECTROSTATICS */
496 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
497 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
499 /* Update potential sum for this i atom from the interaction with this j atom. */
500 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
501 velecsum = _fjsp_add_v2r8(velecsum,velec);
505 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
507 /* Update vectorial force */
508 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
509 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
510 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
512 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
513 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
514 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
520 /* Compute parameters for interactions between i and j atoms */
521 qq20 = _fjsp_mul_v2r8(iq2,jq0);
523 /* REACTION-FIELD ELECTROSTATICS */
524 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
525 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
527 /* Update potential sum for this i atom from the interaction with this j atom. */
528 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
529 velecsum = _fjsp_add_v2r8(velecsum,velec);
533 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
535 /* Update vectorial force */
536 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
537 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
538 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
540 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
541 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
542 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
544 /**************************
545 * CALCULATE INTERACTIONS *
546 **************************/
548 /* Compute parameters for interactions between i and j atoms */
549 qq30 = _fjsp_mul_v2r8(iq3,jq0);
551 /* REACTION-FIELD ELECTROSTATICS */
552 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
553 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
555 /* Update potential sum for this i atom from the interaction with this j atom. */
556 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
557 velecsum = _fjsp_add_v2r8(velecsum,velec);
561 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
563 /* Update vectorial force */
564 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
565 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
566 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
568 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
569 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
570 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
572 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
574 /* Inner loop uses 167 flops */
577 /* End of innermost loop */
579 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
580 f+i_coord_offset,fshift+i_shift_offset);
583 /* Update potential energies */
584 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
585 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
587 /* Increment number of inner iterations */
588 inneriter += j_index_end - j_index_start;
590 /* Outer loop uses 26 flops */
593 /* Increment number of outer iterations */
596 /* Update outer/inner flops */
598 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*167);
601 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
602 * Electrostatics interaction: ReactionField
603 * VdW interaction: CubicSplineTable
604 * Geometry: Water4-Particle
605 * Calculate force/pot: Force
608 nb_kernel_ElecRF_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
609 (t_nblist * gmx_restrict nlist,
610 rvec * gmx_restrict xx,
611 rvec * gmx_restrict ff,
612 struct t_forcerec * gmx_restrict fr,
613 t_mdatoms * gmx_restrict mdatoms,
614 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
615 t_nrnb * gmx_restrict nrnb)
617 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
618 * just 0 for non-waters.
619 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
620 * jnr indices corresponding to data put in the four positions in the SIMD register.
622 int i_shift_offset,i_coord_offset,outeriter,inneriter;
623 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
625 int j_coord_offsetA,j_coord_offsetB;
626 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
628 real *shiftvec,*fshift,*x,*f;
629 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
631 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
633 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
635 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
637 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
638 int vdwjidx0A,vdwjidx0B;
639 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
640 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
641 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
642 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
643 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
644 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
647 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
650 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
651 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
652 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
655 _fjsp_v2r8 dummy_mask,cutoff_mask;
656 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
657 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
658 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
665 jindex = nlist->jindex;
667 shiftidx = nlist->shift;
669 shiftvec = fr->shift_vec[0];
670 fshift = fr->fshift[0];
671 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
672 charge = mdatoms->chargeA;
673 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
674 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
675 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
676 nvdwtype = fr->ntype;
678 vdwtype = mdatoms->typeA;
680 vftab = kernel_data->table_vdw->data;
681 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
683 /* Setup water-specific parameters */
684 inr = nlist->iinr[0];
685 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
686 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
687 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
688 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
690 /* Avoid stupid compiler warnings */
698 /* Start outer loop over neighborlists */
699 for(iidx=0; iidx<nri; iidx++)
701 /* Load shift vector for this list */
702 i_shift_offset = DIM*shiftidx[iidx];
704 /* Load limits for loop over neighbors */
705 j_index_start = jindex[iidx];
706 j_index_end = jindex[iidx+1];
708 /* Get outer coordinate index */
710 i_coord_offset = DIM*inr;
712 /* Load i particle coords and add shift vector */
713 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
714 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
716 fix0 = _fjsp_setzero_v2r8();
717 fiy0 = _fjsp_setzero_v2r8();
718 fiz0 = _fjsp_setzero_v2r8();
719 fix1 = _fjsp_setzero_v2r8();
720 fiy1 = _fjsp_setzero_v2r8();
721 fiz1 = _fjsp_setzero_v2r8();
722 fix2 = _fjsp_setzero_v2r8();
723 fiy2 = _fjsp_setzero_v2r8();
724 fiz2 = _fjsp_setzero_v2r8();
725 fix3 = _fjsp_setzero_v2r8();
726 fiy3 = _fjsp_setzero_v2r8();
727 fiz3 = _fjsp_setzero_v2r8();
729 /* Start inner kernel loop */
730 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
733 /* Get j neighbor index, and coordinate index */
736 j_coord_offsetA = DIM*jnrA;
737 j_coord_offsetB = DIM*jnrB;
739 /* load j atom coordinates */
740 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
743 /* Calculate displacement vector */
744 dx00 = _fjsp_sub_v2r8(ix0,jx0);
745 dy00 = _fjsp_sub_v2r8(iy0,jy0);
746 dz00 = _fjsp_sub_v2r8(iz0,jz0);
747 dx10 = _fjsp_sub_v2r8(ix1,jx0);
748 dy10 = _fjsp_sub_v2r8(iy1,jy0);
749 dz10 = _fjsp_sub_v2r8(iz1,jz0);
750 dx20 = _fjsp_sub_v2r8(ix2,jx0);
751 dy20 = _fjsp_sub_v2r8(iy2,jy0);
752 dz20 = _fjsp_sub_v2r8(iz2,jz0);
753 dx30 = _fjsp_sub_v2r8(ix3,jx0);
754 dy30 = _fjsp_sub_v2r8(iy3,jy0);
755 dz30 = _fjsp_sub_v2r8(iz3,jz0);
757 /* Calculate squared distance and things based on it */
758 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
759 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
760 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
761 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
763 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
764 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
765 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
766 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
768 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
769 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
770 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
772 /* Load parameters for j particles */
773 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
774 vdwjidx0A = 2*vdwtype[jnrA+0];
775 vdwjidx0B = 2*vdwtype[jnrB+0];
777 fjx0 = _fjsp_setzero_v2r8();
778 fjy0 = _fjsp_setzero_v2r8();
779 fjz0 = _fjsp_setzero_v2r8();
781 /**************************
782 * CALCULATE INTERACTIONS *
783 **************************/
785 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
787 /* Compute parameters for interactions between i and j atoms */
788 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
789 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
791 /* Calculate table index by multiplying r with table scale and truncate to integer */
792 rt = _fjsp_mul_v2r8(r00,vftabscale);
793 itab_tmp = _fjsp_dtox_v2r8(rt);
794 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
795 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
796 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
801 /* CUBIC SPLINE TABLE DISPERSION */
802 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
803 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
804 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
805 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
806 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
807 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
808 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
809 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
810 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
812 /* CUBIC SPLINE TABLE REPULSION */
813 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
814 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
815 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
816 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
817 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
818 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
819 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
820 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
821 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
822 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
826 /* Update vectorial force */
827 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
828 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
829 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
831 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
832 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
833 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
835 /**************************
836 * CALCULATE INTERACTIONS *
837 **************************/
839 /* Compute parameters for interactions between i and j atoms */
840 qq10 = _fjsp_mul_v2r8(iq1,jq0);
842 /* REACTION-FIELD ELECTROSTATICS */
843 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
847 /* Update vectorial force */
848 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
849 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
850 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
852 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
853 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
854 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
856 /**************************
857 * CALCULATE INTERACTIONS *
858 **************************/
860 /* Compute parameters for interactions between i and j atoms */
861 qq20 = _fjsp_mul_v2r8(iq2,jq0);
863 /* REACTION-FIELD ELECTROSTATICS */
864 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
868 /* Update vectorial force */
869 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
870 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
871 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
873 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
874 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
875 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
877 /**************************
878 * CALCULATE INTERACTIONS *
879 **************************/
881 /* Compute parameters for interactions between i and j atoms */
882 qq30 = _fjsp_mul_v2r8(iq3,jq0);
884 /* REACTION-FIELD ELECTROSTATICS */
885 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
889 /* Update vectorial force */
890 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
891 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
892 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
894 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
895 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
896 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
898 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
900 /* Inner loop uses 144 flops */
907 j_coord_offsetA = DIM*jnrA;
909 /* load j atom coordinates */
910 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
913 /* Calculate displacement vector */
914 dx00 = _fjsp_sub_v2r8(ix0,jx0);
915 dy00 = _fjsp_sub_v2r8(iy0,jy0);
916 dz00 = _fjsp_sub_v2r8(iz0,jz0);
917 dx10 = _fjsp_sub_v2r8(ix1,jx0);
918 dy10 = _fjsp_sub_v2r8(iy1,jy0);
919 dz10 = _fjsp_sub_v2r8(iz1,jz0);
920 dx20 = _fjsp_sub_v2r8(ix2,jx0);
921 dy20 = _fjsp_sub_v2r8(iy2,jy0);
922 dz20 = _fjsp_sub_v2r8(iz2,jz0);
923 dx30 = _fjsp_sub_v2r8(ix3,jx0);
924 dy30 = _fjsp_sub_v2r8(iy3,jy0);
925 dz30 = _fjsp_sub_v2r8(iz3,jz0);
927 /* Calculate squared distance and things based on it */
928 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
929 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
930 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
931 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
933 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
934 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
935 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
936 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
938 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
939 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
940 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
942 /* Load parameters for j particles */
943 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
944 vdwjidx0A = 2*vdwtype[jnrA+0];
946 fjx0 = _fjsp_setzero_v2r8();
947 fjy0 = _fjsp_setzero_v2r8();
948 fjz0 = _fjsp_setzero_v2r8();
950 /**************************
951 * CALCULATE INTERACTIONS *
952 **************************/
954 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
956 /* Compute parameters for interactions between i and j atoms */
957 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
958 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
960 /* Calculate table index by multiplying r with table scale and truncate to integer */
961 rt = _fjsp_mul_v2r8(r00,vftabscale);
962 itab_tmp = _fjsp_dtox_v2r8(rt);
963 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
964 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
965 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
970 /* CUBIC SPLINE TABLE DISPERSION */
971 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
972 F = _fjsp_setzero_v2r8();
973 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
974 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
975 H = _fjsp_setzero_v2r8();
976 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
977 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
978 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
979 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
981 /* CUBIC SPLINE TABLE REPULSION */
982 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
983 F = _fjsp_setzero_v2r8();
984 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
985 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
986 H = _fjsp_setzero_v2r8();
987 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
988 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
989 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
990 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
991 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
995 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
997 /* Update vectorial force */
998 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
999 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1000 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1002 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1003 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1004 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1006 /**************************
1007 * CALCULATE INTERACTIONS *
1008 **************************/
1010 /* Compute parameters for interactions between i and j atoms */
1011 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1013 /* REACTION-FIELD ELECTROSTATICS */
1014 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1018 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1020 /* Update vectorial force */
1021 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1022 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1023 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1025 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1026 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1027 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1029 /**************************
1030 * CALCULATE INTERACTIONS *
1031 **************************/
1033 /* Compute parameters for interactions between i and j atoms */
1034 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1036 /* REACTION-FIELD ELECTROSTATICS */
1037 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1041 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1043 /* Update vectorial force */
1044 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1045 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1046 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1048 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1049 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1050 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1052 /**************************
1053 * CALCULATE INTERACTIONS *
1054 **************************/
1056 /* Compute parameters for interactions between i and j atoms */
1057 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1059 /* REACTION-FIELD ELECTROSTATICS */
1060 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1064 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1066 /* Update vectorial force */
1067 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1068 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1069 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1071 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1072 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1073 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1075 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1077 /* Inner loop uses 144 flops */
1080 /* End of innermost loop */
1082 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1083 f+i_coord_offset,fshift+i_shift_offset);
1085 /* Increment number of inner iterations */
1086 inneriter += j_index_end - j_index_start;
1088 /* Outer loop uses 24 flops */
1091 /* Increment number of outer iterations */
1094 /* Update outer/inner flops */
1096 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*144);