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 "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: CubicSplineTable
54 * VdW interaction: LennardJones
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_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;
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 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
99 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
103 _fjsp_v2r8 dummy_mask,cutoff_mask;
104 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
105 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
106 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
119 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
120 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 vftab = kernel_data->table_elec->data;
126 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
128 /* Setup water-specific parameters */
129 inr = nlist->iinr[0];
130 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
131 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
132 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
133 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
135 /* Avoid stupid compiler warnings */
143 /* Start outer loop over neighborlists */
144 for(iidx=0; iidx<nri; iidx++)
146 /* Load shift vector for this list */
147 i_shift_offset = DIM*shiftidx[iidx];
149 /* Load limits for loop over neighbors */
150 j_index_start = jindex[iidx];
151 j_index_end = jindex[iidx+1];
153 /* Get outer coordinate index */
155 i_coord_offset = DIM*inr;
157 /* Load i particle coords and add shift vector */
158 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
159 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
161 fix0 = _fjsp_setzero_v2r8();
162 fiy0 = _fjsp_setzero_v2r8();
163 fiz0 = _fjsp_setzero_v2r8();
164 fix1 = _fjsp_setzero_v2r8();
165 fiy1 = _fjsp_setzero_v2r8();
166 fiz1 = _fjsp_setzero_v2r8();
167 fix2 = _fjsp_setzero_v2r8();
168 fiy2 = _fjsp_setzero_v2r8();
169 fiz2 = _fjsp_setzero_v2r8();
171 /* Reset potential sums */
172 velecsum = _fjsp_setzero_v2r8();
173 vvdwsum = _fjsp_setzero_v2r8();
175 /* Start inner kernel loop */
176 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
179 /* Get j neighbor index, and coordinate index */
182 j_coord_offsetA = DIM*jnrA;
183 j_coord_offsetB = DIM*jnrB;
185 /* load j atom coordinates */
186 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
189 /* Calculate displacement vector */
190 dx00 = _fjsp_sub_v2r8(ix0,jx0);
191 dy00 = _fjsp_sub_v2r8(iy0,jy0);
192 dz00 = _fjsp_sub_v2r8(iz0,jz0);
193 dx10 = _fjsp_sub_v2r8(ix1,jx0);
194 dy10 = _fjsp_sub_v2r8(iy1,jy0);
195 dz10 = _fjsp_sub_v2r8(iz1,jz0);
196 dx20 = _fjsp_sub_v2r8(ix2,jx0);
197 dy20 = _fjsp_sub_v2r8(iy2,jy0);
198 dz20 = _fjsp_sub_v2r8(iz2,jz0);
200 /* Calculate squared distance and things based on it */
201 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
202 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
203 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
205 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
206 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
207 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
209 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
211 /* Load parameters for j particles */
212 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
213 vdwjidx0A = 2*vdwtype[jnrA+0];
214 vdwjidx0B = 2*vdwtype[jnrB+0];
216 fjx0 = _fjsp_setzero_v2r8();
217 fjy0 = _fjsp_setzero_v2r8();
218 fjz0 = _fjsp_setzero_v2r8();
220 /**************************
221 * CALCULATE INTERACTIONS *
222 **************************/
224 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
226 /* Compute parameters for interactions between i and j atoms */
227 qq00 = _fjsp_mul_v2r8(iq0,jq0);
228 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
229 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
231 /* Calculate table index by multiplying r with table scale and truncate to integer */
232 rt = _fjsp_mul_v2r8(r00,vftabscale);
233 itab_tmp = _fjsp_dtox_v2r8(rt);
234 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
235 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
236 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
241 /* CUBIC SPLINE TABLE ELECTROSTATICS */
242 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
243 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
244 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
245 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
246 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
247 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
248 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
249 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
250 velec = _fjsp_mul_v2r8(qq00,VV);
251 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
252 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
254 /* LENNARD-JONES DISPERSION/REPULSION */
256 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
257 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
258 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
259 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
260 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
262 /* Update potential sum for this i atom from the interaction with this j atom. */
263 velecsum = _fjsp_add_v2r8(velecsum,velec);
264 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
266 fscal = _fjsp_add_v2r8(felec,fvdw);
268 /* Update vectorial force */
269 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
270 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
271 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
273 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
274 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
275 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
277 /**************************
278 * CALCULATE INTERACTIONS *
279 **************************/
281 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
283 /* Compute parameters for interactions between i and j atoms */
284 qq10 = _fjsp_mul_v2r8(iq1,jq0);
286 /* Calculate table index by multiplying r with table scale and truncate to integer */
287 rt = _fjsp_mul_v2r8(r10,vftabscale);
288 itab_tmp = _fjsp_dtox_v2r8(rt);
289 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
290 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
291 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
296 /* CUBIC SPLINE TABLE ELECTROSTATICS */
297 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
298 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
299 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
300 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
301 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
302 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
303 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
304 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
305 velec = _fjsp_mul_v2r8(qq10,VV);
306 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
307 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
309 /* Update potential sum for this i atom from the interaction with this j atom. */
310 velecsum = _fjsp_add_v2r8(velecsum,velec);
314 /* Update vectorial force */
315 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
316 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
317 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
319 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
320 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
321 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
323 /**************************
324 * CALCULATE INTERACTIONS *
325 **************************/
327 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
329 /* Compute parameters for interactions between i and j atoms */
330 qq20 = _fjsp_mul_v2r8(iq2,jq0);
332 /* Calculate table index by multiplying r with table scale and truncate to integer */
333 rt = _fjsp_mul_v2r8(r20,vftabscale);
334 itab_tmp = _fjsp_dtox_v2r8(rt);
335 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
336 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
337 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
342 /* CUBIC SPLINE TABLE ELECTROSTATICS */
343 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
344 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
345 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
346 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
347 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
348 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
349 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
350 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
351 velec = _fjsp_mul_v2r8(qq20,VV);
352 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
353 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
355 /* Update potential sum for this i atom from the interaction with this j atom. */
356 velecsum = _fjsp_add_v2r8(velecsum,velec);
360 /* Update vectorial force */
361 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
362 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
363 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
365 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
366 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
367 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
369 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
371 /* Inner loop uses 154 flops */
378 j_coord_offsetA = DIM*jnrA;
380 /* load j atom coordinates */
381 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
384 /* Calculate displacement vector */
385 dx00 = _fjsp_sub_v2r8(ix0,jx0);
386 dy00 = _fjsp_sub_v2r8(iy0,jy0);
387 dz00 = _fjsp_sub_v2r8(iz0,jz0);
388 dx10 = _fjsp_sub_v2r8(ix1,jx0);
389 dy10 = _fjsp_sub_v2r8(iy1,jy0);
390 dz10 = _fjsp_sub_v2r8(iz1,jz0);
391 dx20 = _fjsp_sub_v2r8(ix2,jx0);
392 dy20 = _fjsp_sub_v2r8(iy2,jy0);
393 dz20 = _fjsp_sub_v2r8(iz2,jz0);
395 /* Calculate squared distance and things based on it */
396 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
397 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
398 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
400 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
401 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
402 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
404 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
406 /* Load parameters for j particles */
407 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
408 vdwjidx0A = 2*vdwtype[jnrA+0];
410 fjx0 = _fjsp_setzero_v2r8();
411 fjy0 = _fjsp_setzero_v2r8();
412 fjz0 = _fjsp_setzero_v2r8();
414 /**************************
415 * CALCULATE INTERACTIONS *
416 **************************/
418 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
420 /* Compute parameters for interactions between i and j atoms */
421 qq00 = _fjsp_mul_v2r8(iq0,jq0);
422 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
423 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
425 /* Calculate table index by multiplying r with table scale and truncate to integer */
426 rt = _fjsp_mul_v2r8(r00,vftabscale);
427 itab_tmp = _fjsp_dtox_v2r8(rt);
428 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
429 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
430 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
435 /* CUBIC SPLINE TABLE ELECTROSTATICS */
436 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
437 F = _fjsp_setzero_v2r8();
438 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
439 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
440 H = _fjsp_setzero_v2r8();
441 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
442 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
443 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
444 velec = _fjsp_mul_v2r8(qq00,VV);
445 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
446 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
448 /* LENNARD-JONES DISPERSION/REPULSION */
450 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
451 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
452 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
453 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
454 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
456 /* Update potential sum for this i atom from the interaction with this j atom. */
457 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
458 velecsum = _fjsp_add_v2r8(velecsum,velec);
459 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
460 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
462 fscal = _fjsp_add_v2r8(felec,fvdw);
464 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
466 /* Update vectorial force */
467 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
468 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
469 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
471 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
472 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
473 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
475 /**************************
476 * CALCULATE INTERACTIONS *
477 **************************/
479 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
481 /* Compute parameters for interactions between i and j atoms */
482 qq10 = _fjsp_mul_v2r8(iq1,jq0);
484 /* Calculate table index by multiplying r with table scale and truncate to integer */
485 rt = _fjsp_mul_v2r8(r10,vftabscale);
486 itab_tmp = _fjsp_dtox_v2r8(rt);
487 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
488 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
489 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
494 /* CUBIC SPLINE TABLE ELECTROSTATICS */
495 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
496 F = _fjsp_setzero_v2r8();
497 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
498 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
499 H = _fjsp_setzero_v2r8();
500 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
501 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
502 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
503 velec = _fjsp_mul_v2r8(qq10,VV);
504 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
505 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
507 /* Update potential sum for this i atom from the interaction with this j atom. */
508 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
509 velecsum = _fjsp_add_v2r8(velecsum,velec);
513 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
515 /* Update vectorial force */
516 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
517 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
518 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
520 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
521 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
522 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
524 /**************************
525 * CALCULATE INTERACTIONS *
526 **************************/
528 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
530 /* Compute parameters for interactions between i and j atoms */
531 qq20 = _fjsp_mul_v2r8(iq2,jq0);
533 /* Calculate table index by multiplying r with table scale and truncate to integer */
534 rt = _fjsp_mul_v2r8(r20,vftabscale);
535 itab_tmp = _fjsp_dtox_v2r8(rt);
536 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
537 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
538 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
543 /* CUBIC SPLINE TABLE ELECTROSTATICS */
544 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
545 F = _fjsp_setzero_v2r8();
546 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
547 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
548 H = _fjsp_setzero_v2r8();
549 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
550 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
551 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
552 velec = _fjsp_mul_v2r8(qq20,VV);
553 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
554 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
556 /* Update potential sum for this i atom from the interaction with this j atom. */
557 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
558 velecsum = _fjsp_add_v2r8(velecsum,velec);
562 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
564 /* Update vectorial force */
565 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
566 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
567 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
569 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
570 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
571 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
573 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
575 /* Inner loop uses 154 flops */
578 /* End of innermost loop */
580 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
581 f+i_coord_offset,fshift+i_shift_offset);
584 /* Update potential energies */
585 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
586 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
588 /* Increment number of inner iterations */
589 inneriter += j_index_end - j_index_start;
591 /* Outer loop uses 20 flops */
594 /* Increment number of outer iterations */
597 /* Update outer/inner flops */
599 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
602 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
603 * Electrostatics interaction: CubicSplineTable
604 * VdW interaction: LennardJones
605 * Geometry: Water3-Particle
606 * Calculate force/pot: Force
609 nb_kernel_ElecCSTab_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
610 (t_nblist * gmx_restrict nlist,
611 rvec * gmx_restrict xx,
612 rvec * gmx_restrict ff,
613 t_forcerec * gmx_restrict fr,
614 t_mdatoms * gmx_restrict mdatoms,
615 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
616 t_nrnb * gmx_restrict nrnb)
618 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
619 * just 0 for non-waters.
620 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
621 * jnr indices corresponding to data put in the four positions in the SIMD register.
623 int i_shift_offset,i_coord_offset,outeriter,inneriter;
624 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
626 int j_coord_offsetA,j_coord_offsetB;
627 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
629 real *shiftvec,*fshift,*x,*f;
630 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
632 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
634 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
636 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
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 velec,felec,velecsum,facel,crf,krf,krf2;
645 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
648 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
649 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
650 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
653 _fjsp_v2r8 dummy_mask,cutoff_mask;
654 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
655 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
656 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
663 jindex = nlist->jindex;
665 shiftidx = nlist->shift;
667 shiftvec = fr->shift_vec[0];
668 fshift = fr->fshift[0];
669 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
670 charge = mdatoms->chargeA;
671 nvdwtype = fr->ntype;
673 vdwtype = mdatoms->typeA;
675 vftab = kernel_data->table_elec->data;
676 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
678 /* Setup water-specific parameters */
679 inr = nlist->iinr[0];
680 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
681 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
682 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
683 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
685 /* Avoid stupid compiler warnings */
693 /* Start outer loop over neighborlists */
694 for(iidx=0; iidx<nri; iidx++)
696 /* Load shift vector for this list */
697 i_shift_offset = DIM*shiftidx[iidx];
699 /* Load limits for loop over neighbors */
700 j_index_start = jindex[iidx];
701 j_index_end = jindex[iidx+1];
703 /* Get outer coordinate index */
705 i_coord_offset = DIM*inr;
707 /* Load i particle coords and add shift vector */
708 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
709 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
711 fix0 = _fjsp_setzero_v2r8();
712 fiy0 = _fjsp_setzero_v2r8();
713 fiz0 = _fjsp_setzero_v2r8();
714 fix1 = _fjsp_setzero_v2r8();
715 fiy1 = _fjsp_setzero_v2r8();
716 fiz1 = _fjsp_setzero_v2r8();
717 fix2 = _fjsp_setzero_v2r8();
718 fiy2 = _fjsp_setzero_v2r8();
719 fiz2 = _fjsp_setzero_v2r8();
721 /* Start inner kernel loop */
722 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
725 /* Get j neighbor index, and coordinate index */
728 j_coord_offsetA = DIM*jnrA;
729 j_coord_offsetB = DIM*jnrB;
731 /* load j atom coordinates */
732 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
735 /* Calculate displacement vector */
736 dx00 = _fjsp_sub_v2r8(ix0,jx0);
737 dy00 = _fjsp_sub_v2r8(iy0,jy0);
738 dz00 = _fjsp_sub_v2r8(iz0,jz0);
739 dx10 = _fjsp_sub_v2r8(ix1,jx0);
740 dy10 = _fjsp_sub_v2r8(iy1,jy0);
741 dz10 = _fjsp_sub_v2r8(iz1,jz0);
742 dx20 = _fjsp_sub_v2r8(ix2,jx0);
743 dy20 = _fjsp_sub_v2r8(iy2,jy0);
744 dz20 = _fjsp_sub_v2r8(iz2,jz0);
746 /* Calculate squared distance and things based on it */
747 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
748 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
749 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
751 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
752 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
753 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
755 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
757 /* Load parameters for j particles */
758 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
759 vdwjidx0A = 2*vdwtype[jnrA+0];
760 vdwjidx0B = 2*vdwtype[jnrB+0];
762 fjx0 = _fjsp_setzero_v2r8();
763 fjy0 = _fjsp_setzero_v2r8();
764 fjz0 = _fjsp_setzero_v2r8();
766 /**************************
767 * CALCULATE INTERACTIONS *
768 **************************/
770 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
772 /* Compute parameters for interactions between i and j atoms */
773 qq00 = _fjsp_mul_v2r8(iq0,jq0);
774 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
775 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
777 /* Calculate table index by multiplying r with table scale and truncate to integer */
778 rt = _fjsp_mul_v2r8(r00,vftabscale);
779 itab_tmp = _fjsp_dtox_v2r8(rt);
780 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
781 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
782 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
787 /* CUBIC SPLINE TABLE ELECTROSTATICS */
788 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
789 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
790 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
791 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
792 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
793 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
794 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
795 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
796 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
798 /* LENNARD-JONES DISPERSION/REPULSION */
800 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
801 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
803 fscal = _fjsp_add_v2r8(felec,fvdw);
805 /* Update vectorial force */
806 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
807 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
808 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
810 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
811 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
812 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
814 /**************************
815 * CALCULATE INTERACTIONS *
816 **************************/
818 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
820 /* Compute parameters for interactions between i and j atoms */
821 qq10 = _fjsp_mul_v2r8(iq1,jq0);
823 /* Calculate table index by multiplying r with table scale and truncate to integer */
824 rt = _fjsp_mul_v2r8(r10,vftabscale);
825 itab_tmp = _fjsp_dtox_v2r8(rt);
826 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
827 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
828 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
833 /* CUBIC SPLINE TABLE ELECTROSTATICS */
834 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
835 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
836 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
837 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
838 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
839 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
840 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
841 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
842 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
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 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
861 /* Compute parameters for interactions between i and j atoms */
862 qq20 = _fjsp_mul_v2r8(iq2,jq0);
864 /* Calculate table index by multiplying r with table scale and truncate to integer */
865 rt = _fjsp_mul_v2r8(r20,vftabscale);
866 itab_tmp = _fjsp_dtox_v2r8(rt);
867 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
868 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
869 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
874 /* CUBIC SPLINE TABLE ELECTROSTATICS */
875 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
876 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
877 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
878 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
879 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
880 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
881 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
882 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
883 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
887 /* Update vectorial force */
888 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
889 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
890 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
892 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
893 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
894 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
896 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
898 /* Inner loop uses 137 flops */
905 j_coord_offsetA = DIM*jnrA;
907 /* load j atom coordinates */
908 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
911 /* Calculate displacement vector */
912 dx00 = _fjsp_sub_v2r8(ix0,jx0);
913 dy00 = _fjsp_sub_v2r8(iy0,jy0);
914 dz00 = _fjsp_sub_v2r8(iz0,jz0);
915 dx10 = _fjsp_sub_v2r8(ix1,jx0);
916 dy10 = _fjsp_sub_v2r8(iy1,jy0);
917 dz10 = _fjsp_sub_v2r8(iz1,jz0);
918 dx20 = _fjsp_sub_v2r8(ix2,jx0);
919 dy20 = _fjsp_sub_v2r8(iy2,jy0);
920 dz20 = _fjsp_sub_v2r8(iz2,jz0);
922 /* Calculate squared distance and things based on it */
923 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
924 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
925 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
927 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
928 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
929 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
931 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
933 /* Load parameters for j particles */
934 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
935 vdwjidx0A = 2*vdwtype[jnrA+0];
937 fjx0 = _fjsp_setzero_v2r8();
938 fjy0 = _fjsp_setzero_v2r8();
939 fjz0 = _fjsp_setzero_v2r8();
941 /**************************
942 * CALCULATE INTERACTIONS *
943 **************************/
945 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
947 /* Compute parameters for interactions between i and j atoms */
948 qq00 = _fjsp_mul_v2r8(iq0,jq0);
949 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
950 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
952 /* Calculate table index by multiplying r with table scale and truncate to integer */
953 rt = _fjsp_mul_v2r8(r00,vftabscale);
954 itab_tmp = _fjsp_dtox_v2r8(rt);
955 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
956 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
957 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
962 /* CUBIC SPLINE TABLE ELECTROSTATICS */
963 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
964 F = _fjsp_setzero_v2r8();
965 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
966 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
967 H = _fjsp_setzero_v2r8();
968 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
969 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
970 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
971 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
973 /* LENNARD-JONES DISPERSION/REPULSION */
975 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
976 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
978 fscal = _fjsp_add_v2r8(felec,fvdw);
980 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
982 /* Update vectorial force */
983 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
984 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
985 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
987 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
988 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
989 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
991 /**************************
992 * CALCULATE INTERACTIONS *
993 **************************/
995 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
997 /* Compute parameters for interactions between i and j atoms */
998 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1000 /* Calculate table index by multiplying r with table scale and truncate to integer */
1001 rt = _fjsp_mul_v2r8(r10,vftabscale);
1002 itab_tmp = _fjsp_dtox_v2r8(rt);
1003 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1004 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1005 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1010 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1011 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1012 F = _fjsp_setzero_v2r8();
1013 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1014 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1015 H = _fjsp_setzero_v2r8();
1016 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1017 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1018 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1019 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1023 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1025 /* Update vectorial force */
1026 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1027 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1028 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1030 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1031 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1032 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1034 /**************************
1035 * CALCULATE INTERACTIONS *
1036 **************************/
1038 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1040 /* Compute parameters for interactions between i and j atoms */
1041 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1043 /* Calculate table index by multiplying r with table scale and truncate to integer */
1044 rt = _fjsp_mul_v2r8(r20,vftabscale);
1045 itab_tmp = _fjsp_dtox_v2r8(rt);
1046 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1047 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1048 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1053 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1054 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1055 F = _fjsp_setzero_v2r8();
1056 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1057 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1058 H = _fjsp_setzero_v2r8();
1059 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1060 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1061 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1062 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1066 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1068 /* Update vectorial force */
1069 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1070 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1071 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1073 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1074 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1075 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1077 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1079 /* Inner loop uses 137 flops */
1082 /* End of innermost loop */
1084 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1085 f+i_coord_offset,fshift+i_shift_offset);
1087 /* Increment number of inner iterations */
1088 inneriter += j_index_end - j_index_start;
1090 /* Outer loop uses 18 flops */
1093 /* Increment number of outer iterations */
1096 /* Update outer/inner flops */
1098 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*137);