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_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: CubicSplineTable
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 nvdwtype = fr->ntype;
126 vdwtype = mdatoms->typeA;
128 vftab = kernel_data->table_elec->data;
129 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
131 /* Setup water-specific parameters */
132 inr = nlist->iinr[0];
133 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
134 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
135 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
136 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
138 /* Avoid stupid compiler warnings */
146 /* Start outer loop over neighborlists */
147 for(iidx=0; iidx<nri; iidx++)
149 /* Load shift vector for this list */
150 i_shift_offset = DIM*shiftidx[iidx];
152 /* Load limits for loop over neighbors */
153 j_index_start = jindex[iidx];
154 j_index_end = jindex[iidx+1];
156 /* Get outer coordinate index */
158 i_coord_offset = DIM*inr;
160 /* Load i particle coords and add shift vector */
161 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
162 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
164 fix0 = _fjsp_setzero_v2r8();
165 fiy0 = _fjsp_setzero_v2r8();
166 fiz0 = _fjsp_setzero_v2r8();
167 fix1 = _fjsp_setzero_v2r8();
168 fiy1 = _fjsp_setzero_v2r8();
169 fiz1 = _fjsp_setzero_v2r8();
170 fix2 = _fjsp_setzero_v2r8();
171 fiy2 = _fjsp_setzero_v2r8();
172 fiz2 = _fjsp_setzero_v2r8();
173 fix3 = _fjsp_setzero_v2r8();
174 fiy3 = _fjsp_setzero_v2r8();
175 fiz3 = _fjsp_setzero_v2r8();
177 /* Reset potential sums */
178 velecsum = _fjsp_setzero_v2r8();
179 vvdwsum = _fjsp_setzero_v2r8();
181 /* Start inner kernel loop */
182 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
185 /* Get j neighbor index, and coordinate index */
188 j_coord_offsetA = DIM*jnrA;
189 j_coord_offsetB = DIM*jnrB;
191 /* load j atom coordinates */
192 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
195 /* Calculate displacement vector */
196 dx00 = _fjsp_sub_v2r8(ix0,jx0);
197 dy00 = _fjsp_sub_v2r8(iy0,jy0);
198 dz00 = _fjsp_sub_v2r8(iz0,jz0);
199 dx10 = _fjsp_sub_v2r8(ix1,jx0);
200 dy10 = _fjsp_sub_v2r8(iy1,jy0);
201 dz10 = _fjsp_sub_v2r8(iz1,jz0);
202 dx20 = _fjsp_sub_v2r8(ix2,jx0);
203 dy20 = _fjsp_sub_v2r8(iy2,jy0);
204 dz20 = _fjsp_sub_v2r8(iz2,jz0);
205 dx30 = _fjsp_sub_v2r8(ix3,jx0);
206 dy30 = _fjsp_sub_v2r8(iy3,jy0);
207 dz30 = _fjsp_sub_v2r8(iz3,jz0);
209 /* Calculate squared distance and things based on it */
210 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
211 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
212 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
213 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
215 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
216 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
217 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
219 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
221 /* Load parameters for j particles */
222 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
223 vdwjidx0A = 2*vdwtype[jnrA+0];
224 vdwjidx0B = 2*vdwtype[jnrB+0];
226 fjx0 = _fjsp_setzero_v2r8();
227 fjy0 = _fjsp_setzero_v2r8();
228 fjz0 = _fjsp_setzero_v2r8();
230 /**************************
231 * CALCULATE INTERACTIONS *
232 **************************/
234 /* Compute parameters for interactions between i and j atoms */
235 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
236 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
238 /* LENNARD-JONES DISPERSION/REPULSION */
240 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
241 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
242 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
243 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
244 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
246 /* Update potential sum for this i atom from the interaction with this j atom. */
247 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
251 /* Update vectorial force */
252 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
253 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
254 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
256 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
257 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
258 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
260 /**************************
261 * CALCULATE INTERACTIONS *
262 **************************/
264 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
266 /* Compute parameters for interactions between i and j atoms */
267 qq10 = _fjsp_mul_v2r8(iq1,jq0);
269 /* Calculate table index by multiplying r with table scale and truncate to integer */
270 rt = _fjsp_mul_v2r8(r10,vftabscale);
271 itab_tmp = _fjsp_dtox_v2r8(rt);
272 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
273 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
274 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
279 /* CUBIC SPLINE TABLE ELECTROSTATICS */
280 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
281 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
282 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
283 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
284 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
285 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
286 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
287 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
288 velec = _fjsp_mul_v2r8(qq10,VV);
289 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
290 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
292 /* Update potential sum for this i atom from the interaction with this j atom. */
293 velecsum = _fjsp_add_v2r8(velecsum,velec);
297 /* Update vectorial force */
298 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
299 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
300 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
302 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
303 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
304 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
312 /* Compute parameters for interactions between i and j atoms */
313 qq20 = _fjsp_mul_v2r8(iq2,jq0);
315 /* Calculate table index by multiplying r with table scale and truncate to integer */
316 rt = _fjsp_mul_v2r8(r20,vftabscale);
317 itab_tmp = _fjsp_dtox_v2r8(rt);
318 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
319 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
320 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
325 /* CUBIC SPLINE TABLE ELECTROSTATICS */
326 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
327 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
328 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
329 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
330 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
331 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
332 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
333 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
334 velec = _fjsp_mul_v2r8(qq20,VV);
335 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
336 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
338 /* Update potential sum for this i atom from the interaction with this j atom. */
339 velecsum = _fjsp_add_v2r8(velecsum,velec);
343 /* Update vectorial force */
344 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
345 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
346 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
348 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
349 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
350 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
352 /**************************
353 * CALCULATE INTERACTIONS *
354 **************************/
356 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
358 /* Compute parameters for interactions between i and j atoms */
359 qq30 = _fjsp_mul_v2r8(iq3,jq0);
361 /* Calculate table index by multiplying r with table scale and truncate to integer */
362 rt = _fjsp_mul_v2r8(r30,vftabscale);
363 itab_tmp = _fjsp_dtox_v2r8(rt);
364 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
365 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
366 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
371 /* CUBIC SPLINE TABLE ELECTROSTATICS */
372 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
373 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
374 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
375 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
376 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
377 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
378 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
379 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
380 velec = _fjsp_mul_v2r8(qq30,VV);
381 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
382 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
384 /* Update potential sum for this i atom from the interaction with this j atom. */
385 velecsum = _fjsp_add_v2r8(velecsum,velec);
389 /* Update vectorial force */
390 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
391 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
392 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
394 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
395 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
396 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
398 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
400 /* Inner loop uses 176 flops */
407 j_coord_offsetA = DIM*jnrA;
409 /* load j atom coordinates */
410 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
413 /* Calculate displacement vector */
414 dx00 = _fjsp_sub_v2r8(ix0,jx0);
415 dy00 = _fjsp_sub_v2r8(iy0,jy0);
416 dz00 = _fjsp_sub_v2r8(iz0,jz0);
417 dx10 = _fjsp_sub_v2r8(ix1,jx0);
418 dy10 = _fjsp_sub_v2r8(iy1,jy0);
419 dz10 = _fjsp_sub_v2r8(iz1,jz0);
420 dx20 = _fjsp_sub_v2r8(ix2,jx0);
421 dy20 = _fjsp_sub_v2r8(iy2,jy0);
422 dz20 = _fjsp_sub_v2r8(iz2,jz0);
423 dx30 = _fjsp_sub_v2r8(ix3,jx0);
424 dy30 = _fjsp_sub_v2r8(iy3,jy0);
425 dz30 = _fjsp_sub_v2r8(iz3,jz0);
427 /* Calculate squared distance and things based on it */
428 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
429 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
430 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
431 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
433 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
434 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
435 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
437 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
439 /* Load parameters for j particles */
440 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
441 vdwjidx0A = 2*vdwtype[jnrA+0];
443 fjx0 = _fjsp_setzero_v2r8();
444 fjy0 = _fjsp_setzero_v2r8();
445 fjz0 = _fjsp_setzero_v2r8();
447 /**************************
448 * CALCULATE INTERACTIONS *
449 **************************/
451 /* Compute parameters for interactions between i and j atoms */
452 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
453 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
455 /* LENNARD-JONES DISPERSION/REPULSION */
457 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
458 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
459 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
460 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
461 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
463 /* Update potential sum for this i atom from the interaction with this j atom. */
464 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
465 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
469 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
471 /* Update vectorial force */
472 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
473 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
474 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
476 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
477 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
478 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
486 /* Compute parameters for interactions between i and j atoms */
487 qq10 = _fjsp_mul_v2r8(iq1,jq0);
489 /* Calculate table index by multiplying r with table scale and truncate to integer */
490 rt = _fjsp_mul_v2r8(r10,vftabscale);
491 itab_tmp = _fjsp_dtox_v2r8(rt);
492 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
493 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
494 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
499 /* CUBIC SPLINE TABLE ELECTROSTATICS */
500 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
501 F = _fjsp_setzero_v2r8();
502 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
503 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
504 H = _fjsp_setzero_v2r8();
505 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
506 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
507 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
508 velec = _fjsp_mul_v2r8(qq10,VV);
509 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
510 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
512 /* Update potential sum for this i atom from the interaction with this j atom. */
513 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
514 velecsum = _fjsp_add_v2r8(velecsum,velec);
518 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
520 /* Update vectorial force */
521 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
522 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
523 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
525 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
526 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
527 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
529 /**************************
530 * CALCULATE INTERACTIONS *
531 **************************/
533 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
535 /* Compute parameters for interactions between i and j atoms */
536 qq20 = _fjsp_mul_v2r8(iq2,jq0);
538 /* Calculate table index by multiplying r with table scale and truncate to integer */
539 rt = _fjsp_mul_v2r8(r20,vftabscale);
540 itab_tmp = _fjsp_dtox_v2r8(rt);
541 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
542 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
543 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
548 /* CUBIC SPLINE TABLE ELECTROSTATICS */
549 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
550 F = _fjsp_setzero_v2r8();
551 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
552 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
553 H = _fjsp_setzero_v2r8();
554 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
555 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
556 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
557 velec = _fjsp_mul_v2r8(qq20,VV);
558 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
559 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
561 /* Update potential sum for this i atom from the interaction with this j atom. */
562 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
563 velecsum = _fjsp_add_v2r8(velecsum,velec);
567 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
569 /* Update vectorial force */
570 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
571 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
572 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
574 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
575 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
576 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
578 /**************************
579 * CALCULATE INTERACTIONS *
580 **************************/
582 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
584 /* Compute parameters for interactions between i and j atoms */
585 qq30 = _fjsp_mul_v2r8(iq3,jq0);
587 /* Calculate table index by multiplying r with table scale and truncate to integer */
588 rt = _fjsp_mul_v2r8(r30,vftabscale);
589 itab_tmp = _fjsp_dtox_v2r8(rt);
590 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
591 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
592 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
597 /* CUBIC SPLINE TABLE ELECTROSTATICS */
598 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
599 F = _fjsp_setzero_v2r8();
600 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
601 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
602 H = _fjsp_setzero_v2r8();
603 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
604 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
605 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
606 velec = _fjsp_mul_v2r8(qq30,VV);
607 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
608 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
610 /* Update potential sum for this i atom from the interaction with this j atom. */
611 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
612 velecsum = _fjsp_add_v2r8(velecsum,velec);
616 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
618 /* Update vectorial force */
619 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
620 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
621 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
623 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
624 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
625 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
627 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
629 /* Inner loop uses 176 flops */
632 /* End of innermost loop */
634 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
635 f+i_coord_offset,fshift+i_shift_offset);
638 /* Update potential energies */
639 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
640 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
642 /* Increment number of inner iterations */
643 inneriter += j_index_end - j_index_start;
645 /* Outer loop uses 26 flops */
648 /* Increment number of outer iterations */
651 /* Update outer/inner flops */
653 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*176);
656 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
657 * Electrostatics interaction: CubicSplineTable
658 * VdW interaction: LennardJones
659 * Geometry: Water4-Particle
660 * Calculate force/pot: Force
663 nb_kernel_ElecCSTab_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
664 (t_nblist * gmx_restrict nlist,
665 rvec * gmx_restrict xx,
666 rvec * gmx_restrict ff,
667 t_forcerec * gmx_restrict fr,
668 t_mdatoms * gmx_restrict mdatoms,
669 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
670 t_nrnb * gmx_restrict nrnb)
672 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
673 * just 0 for non-waters.
674 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
675 * jnr indices corresponding to data put in the four positions in the SIMD register.
677 int i_shift_offset,i_coord_offset,outeriter,inneriter;
678 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
680 int j_coord_offsetA,j_coord_offsetB;
681 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
683 real *shiftvec,*fshift,*x,*f;
684 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
686 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
688 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
690 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
692 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
693 int vdwjidx0A,vdwjidx0B;
694 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
695 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
696 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
697 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
698 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
699 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
702 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
705 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
706 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
707 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
710 _fjsp_v2r8 dummy_mask,cutoff_mask;
711 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
712 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
713 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
720 jindex = nlist->jindex;
722 shiftidx = nlist->shift;
724 shiftvec = fr->shift_vec[0];
725 fshift = fr->fshift[0];
726 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
727 charge = mdatoms->chargeA;
728 nvdwtype = fr->ntype;
730 vdwtype = mdatoms->typeA;
732 vftab = kernel_data->table_elec->data;
733 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
735 /* Setup water-specific parameters */
736 inr = nlist->iinr[0];
737 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
738 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
739 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
740 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
742 /* Avoid stupid compiler warnings */
750 /* Start outer loop over neighborlists */
751 for(iidx=0; iidx<nri; iidx++)
753 /* Load shift vector for this list */
754 i_shift_offset = DIM*shiftidx[iidx];
756 /* Load limits for loop over neighbors */
757 j_index_start = jindex[iidx];
758 j_index_end = jindex[iidx+1];
760 /* Get outer coordinate index */
762 i_coord_offset = DIM*inr;
764 /* Load i particle coords and add shift vector */
765 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
766 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
768 fix0 = _fjsp_setzero_v2r8();
769 fiy0 = _fjsp_setzero_v2r8();
770 fiz0 = _fjsp_setzero_v2r8();
771 fix1 = _fjsp_setzero_v2r8();
772 fiy1 = _fjsp_setzero_v2r8();
773 fiz1 = _fjsp_setzero_v2r8();
774 fix2 = _fjsp_setzero_v2r8();
775 fiy2 = _fjsp_setzero_v2r8();
776 fiz2 = _fjsp_setzero_v2r8();
777 fix3 = _fjsp_setzero_v2r8();
778 fiy3 = _fjsp_setzero_v2r8();
779 fiz3 = _fjsp_setzero_v2r8();
781 /* Start inner kernel loop */
782 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
785 /* Get j neighbor index, and coordinate index */
788 j_coord_offsetA = DIM*jnrA;
789 j_coord_offsetB = DIM*jnrB;
791 /* load j atom coordinates */
792 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
795 /* Calculate displacement vector */
796 dx00 = _fjsp_sub_v2r8(ix0,jx0);
797 dy00 = _fjsp_sub_v2r8(iy0,jy0);
798 dz00 = _fjsp_sub_v2r8(iz0,jz0);
799 dx10 = _fjsp_sub_v2r8(ix1,jx0);
800 dy10 = _fjsp_sub_v2r8(iy1,jy0);
801 dz10 = _fjsp_sub_v2r8(iz1,jz0);
802 dx20 = _fjsp_sub_v2r8(ix2,jx0);
803 dy20 = _fjsp_sub_v2r8(iy2,jy0);
804 dz20 = _fjsp_sub_v2r8(iz2,jz0);
805 dx30 = _fjsp_sub_v2r8(ix3,jx0);
806 dy30 = _fjsp_sub_v2r8(iy3,jy0);
807 dz30 = _fjsp_sub_v2r8(iz3,jz0);
809 /* Calculate squared distance and things based on it */
810 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
811 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
812 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
813 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
815 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
816 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
817 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
819 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
821 /* Load parameters for j particles */
822 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
823 vdwjidx0A = 2*vdwtype[jnrA+0];
824 vdwjidx0B = 2*vdwtype[jnrB+0];
826 fjx0 = _fjsp_setzero_v2r8();
827 fjy0 = _fjsp_setzero_v2r8();
828 fjz0 = _fjsp_setzero_v2r8();
830 /**************************
831 * CALCULATE INTERACTIONS *
832 **************************/
834 /* Compute parameters for interactions between i and j atoms */
835 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
836 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
838 /* LENNARD-JONES DISPERSION/REPULSION */
840 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
841 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
845 /* Update vectorial force */
846 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
847 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
848 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
850 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
851 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
852 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
854 /**************************
855 * CALCULATE INTERACTIONS *
856 **************************/
858 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
860 /* Compute parameters for interactions between i and j atoms */
861 qq10 = _fjsp_mul_v2r8(iq1,jq0);
863 /* Calculate table index by multiplying r with table scale and truncate to integer */
864 rt = _fjsp_mul_v2r8(r10,vftabscale);
865 itab_tmp = _fjsp_dtox_v2r8(rt);
866 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
867 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
868 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
873 /* CUBIC SPLINE TABLE ELECTROSTATICS */
874 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
875 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
876 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
877 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
878 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
879 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
880 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
881 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
882 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
886 /* Update vectorial force */
887 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
888 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
889 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
891 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
892 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
893 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
895 /**************************
896 * CALCULATE INTERACTIONS *
897 **************************/
899 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
901 /* Compute parameters for interactions between i and j atoms */
902 qq20 = _fjsp_mul_v2r8(iq2,jq0);
904 /* Calculate table index by multiplying r with table scale and truncate to integer */
905 rt = _fjsp_mul_v2r8(r20,vftabscale);
906 itab_tmp = _fjsp_dtox_v2r8(rt);
907 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
908 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
909 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
914 /* CUBIC SPLINE TABLE ELECTROSTATICS */
915 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
916 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
917 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
918 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
919 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
920 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
921 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
922 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
923 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
927 /* Update vectorial force */
928 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
929 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
930 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
932 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
933 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
934 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
936 /**************************
937 * CALCULATE INTERACTIONS *
938 **************************/
940 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
942 /* Compute parameters for interactions between i and j atoms */
943 qq30 = _fjsp_mul_v2r8(iq3,jq0);
945 /* Calculate table index by multiplying r with table scale and truncate to integer */
946 rt = _fjsp_mul_v2r8(r30,vftabscale);
947 itab_tmp = _fjsp_dtox_v2r8(rt);
948 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
949 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
950 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
955 /* CUBIC SPLINE TABLE ELECTROSTATICS */
956 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
957 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
958 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
959 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
960 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
961 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
962 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
963 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
964 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
968 /* Update vectorial force */
969 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
970 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
971 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
973 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
974 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
975 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
977 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
979 /* Inner loop uses 159 flops */
986 j_coord_offsetA = DIM*jnrA;
988 /* load j atom coordinates */
989 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
992 /* Calculate displacement vector */
993 dx00 = _fjsp_sub_v2r8(ix0,jx0);
994 dy00 = _fjsp_sub_v2r8(iy0,jy0);
995 dz00 = _fjsp_sub_v2r8(iz0,jz0);
996 dx10 = _fjsp_sub_v2r8(ix1,jx0);
997 dy10 = _fjsp_sub_v2r8(iy1,jy0);
998 dz10 = _fjsp_sub_v2r8(iz1,jz0);
999 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1000 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1001 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1002 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1003 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1004 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1006 /* Calculate squared distance and things based on it */
1007 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1008 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1009 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1010 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1012 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1013 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1014 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1016 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1018 /* Load parameters for j particles */
1019 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1020 vdwjidx0A = 2*vdwtype[jnrA+0];
1022 fjx0 = _fjsp_setzero_v2r8();
1023 fjy0 = _fjsp_setzero_v2r8();
1024 fjz0 = _fjsp_setzero_v2r8();
1026 /**************************
1027 * CALCULATE INTERACTIONS *
1028 **************************/
1030 /* Compute parameters for interactions between i and j atoms */
1031 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1032 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1034 /* LENNARD-JONES DISPERSION/REPULSION */
1036 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1037 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1041 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1043 /* Update vectorial force */
1044 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1045 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1046 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1048 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1049 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1050 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1052 /**************************
1053 * CALCULATE INTERACTIONS *
1054 **************************/
1056 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1058 /* Compute parameters for interactions between i and j atoms */
1059 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1061 /* Calculate table index by multiplying r with table scale and truncate to integer */
1062 rt = _fjsp_mul_v2r8(r10,vftabscale);
1063 itab_tmp = _fjsp_dtox_v2r8(rt);
1064 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1065 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1066 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1071 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1072 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1073 F = _fjsp_setzero_v2r8();
1074 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1075 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1076 H = _fjsp_setzero_v2r8();
1077 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1078 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1079 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1080 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1084 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1086 /* Update vectorial force */
1087 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1088 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1089 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1091 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1092 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1093 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1095 /**************************
1096 * CALCULATE INTERACTIONS *
1097 **************************/
1099 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1101 /* Compute parameters for interactions between i and j atoms */
1102 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1104 /* Calculate table index by multiplying r with table scale and truncate to integer */
1105 rt = _fjsp_mul_v2r8(r20,vftabscale);
1106 itab_tmp = _fjsp_dtox_v2r8(rt);
1107 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1108 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1109 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1114 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1115 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1116 F = _fjsp_setzero_v2r8();
1117 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1118 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1119 H = _fjsp_setzero_v2r8();
1120 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1121 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1122 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1123 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1127 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1129 /* Update vectorial force */
1130 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1131 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1132 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1134 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1135 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1136 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1138 /**************************
1139 * CALCULATE INTERACTIONS *
1140 **************************/
1142 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1144 /* Compute parameters for interactions between i and j atoms */
1145 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1147 /* Calculate table index by multiplying r with table scale and truncate to integer */
1148 rt = _fjsp_mul_v2r8(r30,vftabscale);
1149 itab_tmp = _fjsp_dtox_v2r8(rt);
1150 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1151 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1152 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1157 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1158 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1159 F = _fjsp_setzero_v2r8();
1160 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1161 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1162 H = _fjsp_setzero_v2r8();
1163 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1164 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1165 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1166 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1170 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1172 /* Update vectorial force */
1173 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1174 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1175 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1177 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1178 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1179 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1181 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1183 /* Inner loop uses 159 flops */
1186 /* End of innermost loop */
1188 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1189 f+i_coord_offset,fshift+i_shift_offset);
1191 /* Increment number of inner iterations */
1192 inneriter += j_index_end - j_index_start;
1194 /* Outer loop uses 24 flops */
1197 /* Increment number of outer iterations */
1200 /* Update outer/inner flops */
1202 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*159);