2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: CubicSplineTable
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 nvdwtype = fr->ntype;
126 vdwtype = mdatoms->typeA;
128 vftab = kernel_data->table_elec_vdw->data;
129 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->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 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
216 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
217 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
218 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
220 /* Load parameters for j particles */
221 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
222 vdwjidx0A = 2*vdwtype[jnrA+0];
223 vdwjidx0B = 2*vdwtype[jnrB+0];
225 fjx0 = _fjsp_setzero_v2r8();
226 fjy0 = _fjsp_setzero_v2r8();
227 fjz0 = _fjsp_setzero_v2r8();
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
233 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
235 /* Compute parameters for interactions between i and j atoms */
236 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
237 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
239 /* Calculate table index by multiplying r with table scale and truncate to integer */
240 rt = _fjsp_mul_v2r8(r00,vftabscale);
241 itab_tmp = _fjsp_dtox_v2r8(rt);
242 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
243 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
244 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
249 /* CUBIC SPLINE TABLE DISPERSION */
252 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
253 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
254 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
255 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
256 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
257 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
258 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
259 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
260 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
261 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
262 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
264 /* CUBIC SPLINE TABLE REPULSION */
265 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
266 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
267 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
268 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
269 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
270 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
271 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
272 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
273 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
274 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
275 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
276 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
277 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
279 /* Update potential sum for this i atom from the interaction with this j atom. */
280 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
284 /* Update vectorial force */
285 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
286 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
287 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
289 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
290 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
291 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
293 /**************************
294 * CALCULATE INTERACTIONS *
295 **************************/
297 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
299 /* Compute parameters for interactions between i and j atoms */
300 qq10 = _fjsp_mul_v2r8(iq1,jq0);
302 /* Calculate table index by multiplying r with table scale and truncate to integer */
303 rt = _fjsp_mul_v2r8(r10,vftabscale);
304 itab_tmp = _fjsp_dtox_v2r8(rt);
305 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
306 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
307 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
312 /* CUBIC SPLINE TABLE ELECTROSTATICS */
313 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
314 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
315 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
316 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
317 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
318 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
319 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
320 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
321 velec = _fjsp_mul_v2r8(qq10,VV);
322 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
323 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
325 /* Update potential sum for this i atom from the interaction with this j atom. */
326 velecsum = _fjsp_add_v2r8(velecsum,velec);
330 /* Update vectorial force */
331 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
332 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
333 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
335 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
336 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
337 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
339 /**************************
340 * CALCULATE INTERACTIONS *
341 **************************/
343 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
345 /* Compute parameters for interactions between i and j atoms */
346 qq20 = _fjsp_mul_v2r8(iq2,jq0);
348 /* Calculate table index by multiplying r with table scale and truncate to integer */
349 rt = _fjsp_mul_v2r8(r20,vftabscale);
350 itab_tmp = _fjsp_dtox_v2r8(rt);
351 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
352 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
353 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
358 /* CUBIC SPLINE TABLE ELECTROSTATICS */
359 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
360 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
361 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
362 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
363 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
364 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
365 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
366 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
367 velec = _fjsp_mul_v2r8(qq20,VV);
368 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
369 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
371 /* Update potential sum for this i atom from the interaction with this j atom. */
372 velecsum = _fjsp_add_v2r8(velecsum,velec);
376 /* Update vectorial force */
377 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
378 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
379 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
381 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
382 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
383 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
385 /**************************
386 * CALCULATE INTERACTIONS *
387 **************************/
389 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
391 /* Compute parameters for interactions between i and j atoms */
392 qq30 = _fjsp_mul_v2r8(iq3,jq0);
394 /* Calculate table index by multiplying r with table scale and truncate to integer */
395 rt = _fjsp_mul_v2r8(r30,vftabscale);
396 itab_tmp = _fjsp_dtox_v2r8(rt);
397 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
398 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
399 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
404 /* CUBIC SPLINE TABLE ELECTROSTATICS */
405 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
406 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
407 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
408 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
409 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
410 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
411 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
412 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
413 velec = _fjsp_mul_v2r8(qq30,VV);
414 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
415 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
417 /* Update potential sum for this i atom from the interaction with this j atom. */
418 velecsum = _fjsp_add_v2r8(velecsum,velec);
422 /* Update vectorial force */
423 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
424 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
425 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
427 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
428 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
429 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
431 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
433 /* Inner loop uses 200 flops */
440 j_coord_offsetA = DIM*jnrA;
442 /* load j atom coordinates */
443 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
446 /* Calculate displacement vector */
447 dx00 = _fjsp_sub_v2r8(ix0,jx0);
448 dy00 = _fjsp_sub_v2r8(iy0,jy0);
449 dz00 = _fjsp_sub_v2r8(iz0,jz0);
450 dx10 = _fjsp_sub_v2r8(ix1,jx0);
451 dy10 = _fjsp_sub_v2r8(iy1,jy0);
452 dz10 = _fjsp_sub_v2r8(iz1,jz0);
453 dx20 = _fjsp_sub_v2r8(ix2,jx0);
454 dy20 = _fjsp_sub_v2r8(iy2,jy0);
455 dz20 = _fjsp_sub_v2r8(iz2,jz0);
456 dx30 = _fjsp_sub_v2r8(ix3,jx0);
457 dy30 = _fjsp_sub_v2r8(iy3,jy0);
458 dz30 = _fjsp_sub_v2r8(iz3,jz0);
460 /* Calculate squared distance and things based on it */
461 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
462 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
463 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
464 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
466 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
467 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
468 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
469 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
471 /* Load parameters for j particles */
472 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
473 vdwjidx0A = 2*vdwtype[jnrA+0];
475 fjx0 = _fjsp_setzero_v2r8();
476 fjy0 = _fjsp_setzero_v2r8();
477 fjz0 = _fjsp_setzero_v2r8();
479 /**************************
480 * CALCULATE INTERACTIONS *
481 **************************/
483 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
485 /* Compute parameters for interactions between i and j atoms */
486 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
488 /* Calculate table index by multiplying r with table scale and truncate to integer */
489 rt = _fjsp_mul_v2r8(r00,vftabscale);
490 itab_tmp = _fjsp_dtox_v2r8(rt);
491 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
492 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
493 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
498 /* CUBIC SPLINE TABLE DISPERSION */
501 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
502 F = _fjsp_setzero_v2r8();
503 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
504 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
505 H = _fjsp_setzero_v2r8();
506 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
507 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
508 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
509 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
510 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
511 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
513 /* CUBIC SPLINE TABLE REPULSION */
514 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
515 F = _fjsp_setzero_v2r8();
516 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
517 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
518 H = _fjsp_setzero_v2r8();
519 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
520 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
521 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
522 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
523 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
524 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
525 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
526 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
528 /* Update potential sum for this i atom from the interaction with this j atom. */
529 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
530 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
534 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
536 /* Update vectorial force */
537 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
538 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
539 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
541 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
542 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
543 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
545 /**************************
546 * CALCULATE INTERACTIONS *
547 **************************/
549 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
551 /* Compute parameters for interactions between i and j atoms */
552 qq10 = _fjsp_mul_v2r8(iq1,jq0);
554 /* Calculate table index by multiplying r with table scale and truncate to integer */
555 rt = _fjsp_mul_v2r8(r10,vftabscale);
556 itab_tmp = _fjsp_dtox_v2r8(rt);
557 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
558 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
559 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
564 /* CUBIC SPLINE TABLE ELECTROSTATICS */
565 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
566 F = _fjsp_setzero_v2r8();
567 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
568 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
569 H = _fjsp_setzero_v2r8();
570 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
571 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
572 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
573 velec = _fjsp_mul_v2r8(qq10,VV);
574 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
575 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
577 /* Update potential sum for this i atom from the interaction with this j atom. */
578 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
579 velecsum = _fjsp_add_v2r8(velecsum,velec);
583 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
585 /* Update vectorial force */
586 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
587 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
588 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
590 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
591 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
592 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
594 /**************************
595 * CALCULATE INTERACTIONS *
596 **************************/
598 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
600 /* Compute parameters for interactions between i and j atoms */
601 qq20 = _fjsp_mul_v2r8(iq2,jq0);
603 /* Calculate table index by multiplying r with table scale and truncate to integer */
604 rt = _fjsp_mul_v2r8(r20,vftabscale);
605 itab_tmp = _fjsp_dtox_v2r8(rt);
606 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
607 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
608 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
613 /* CUBIC SPLINE TABLE ELECTROSTATICS */
614 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
615 F = _fjsp_setzero_v2r8();
616 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
617 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
618 H = _fjsp_setzero_v2r8();
619 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
620 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
621 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
622 velec = _fjsp_mul_v2r8(qq20,VV);
623 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
624 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
626 /* Update potential sum for this i atom from the interaction with this j atom. */
627 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
628 velecsum = _fjsp_add_v2r8(velecsum,velec);
632 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
634 /* Update vectorial force */
635 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
636 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
637 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
639 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
640 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
641 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
643 /**************************
644 * CALCULATE INTERACTIONS *
645 **************************/
647 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
649 /* Compute parameters for interactions between i and j atoms */
650 qq30 = _fjsp_mul_v2r8(iq3,jq0);
652 /* Calculate table index by multiplying r with table scale and truncate to integer */
653 rt = _fjsp_mul_v2r8(r30,vftabscale);
654 itab_tmp = _fjsp_dtox_v2r8(rt);
655 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
656 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
657 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
662 /* CUBIC SPLINE TABLE ELECTROSTATICS */
663 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
664 F = _fjsp_setzero_v2r8();
665 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
666 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
667 H = _fjsp_setzero_v2r8();
668 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
669 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
670 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
671 velec = _fjsp_mul_v2r8(qq30,VV);
672 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
673 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
675 /* Update potential sum for this i atom from the interaction with this j atom. */
676 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
677 velecsum = _fjsp_add_v2r8(velecsum,velec);
681 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
683 /* Update vectorial force */
684 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
685 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
686 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
688 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
689 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
690 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
692 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
694 /* Inner loop uses 200 flops */
697 /* End of innermost loop */
699 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
700 f+i_coord_offset,fshift+i_shift_offset);
703 /* Update potential energies */
704 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
705 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
707 /* Increment number of inner iterations */
708 inneriter += j_index_end - j_index_start;
710 /* Outer loop uses 26 flops */
713 /* Increment number of outer iterations */
716 /* Update outer/inner flops */
718 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*200);
721 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
722 * Electrostatics interaction: CubicSplineTable
723 * VdW interaction: CubicSplineTable
724 * Geometry: Water4-Particle
725 * Calculate force/pot: Force
728 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
729 (t_nblist * gmx_restrict nlist,
730 rvec * gmx_restrict xx,
731 rvec * gmx_restrict ff,
732 t_forcerec * gmx_restrict fr,
733 t_mdatoms * gmx_restrict mdatoms,
734 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
735 t_nrnb * gmx_restrict nrnb)
737 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
738 * just 0 for non-waters.
739 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
740 * jnr indices corresponding to data put in the four positions in the SIMD register.
742 int i_shift_offset,i_coord_offset,outeriter,inneriter;
743 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
745 int j_coord_offsetA,j_coord_offsetB;
746 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
748 real *shiftvec,*fshift,*x,*f;
749 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
751 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
753 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
755 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
757 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
758 int vdwjidx0A,vdwjidx0B;
759 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
760 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
761 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
762 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
763 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
764 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
767 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
770 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
771 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
772 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
775 _fjsp_v2r8 dummy_mask,cutoff_mask;
776 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
777 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
778 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
785 jindex = nlist->jindex;
787 shiftidx = nlist->shift;
789 shiftvec = fr->shift_vec[0];
790 fshift = fr->fshift[0];
791 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
792 charge = mdatoms->chargeA;
793 nvdwtype = fr->ntype;
795 vdwtype = mdatoms->typeA;
797 vftab = kernel_data->table_elec_vdw->data;
798 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
800 /* Setup water-specific parameters */
801 inr = nlist->iinr[0];
802 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
803 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
804 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
805 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
807 /* Avoid stupid compiler warnings */
815 /* Start outer loop over neighborlists */
816 for(iidx=0; iidx<nri; iidx++)
818 /* Load shift vector for this list */
819 i_shift_offset = DIM*shiftidx[iidx];
821 /* Load limits for loop over neighbors */
822 j_index_start = jindex[iidx];
823 j_index_end = jindex[iidx+1];
825 /* Get outer coordinate index */
827 i_coord_offset = DIM*inr;
829 /* Load i particle coords and add shift vector */
830 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
831 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
833 fix0 = _fjsp_setzero_v2r8();
834 fiy0 = _fjsp_setzero_v2r8();
835 fiz0 = _fjsp_setzero_v2r8();
836 fix1 = _fjsp_setzero_v2r8();
837 fiy1 = _fjsp_setzero_v2r8();
838 fiz1 = _fjsp_setzero_v2r8();
839 fix2 = _fjsp_setzero_v2r8();
840 fiy2 = _fjsp_setzero_v2r8();
841 fiz2 = _fjsp_setzero_v2r8();
842 fix3 = _fjsp_setzero_v2r8();
843 fiy3 = _fjsp_setzero_v2r8();
844 fiz3 = _fjsp_setzero_v2r8();
846 /* Start inner kernel loop */
847 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
850 /* Get j neighbor index, and coordinate index */
853 j_coord_offsetA = DIM*jnrA;
854 j_coord_offsetB = DIM*jnrB;
856 /* load j atom coordinates */
857 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
860 /* Calculate displacement vector */
861 dx00 = _fjsp_sub_v2r8(ix0,jx0);
862 dy00 = _fjsp_sub_v2r8(iy0,jy0);
863 dz00 = _fjsp_sub_v2r8(iz0,jz0);
864 dx10 = _fjsp_sub_v2r8(ix1,jx0);
865 dy10 = _fjsp_sub_v2r8(iy1,jy0);
866 dz10 = _fjsp_sub_v2r8(iz1,jz0);
867 dx20 = _fjsp_sub_v2r8(ix2,jx0);
868 dy20 = _fjsp_sub_v2r8(iy2,jy0);
869 dz20 = _fjsp_sub_v2r8(iz2,jz0);
870 dx30 = _fjsp_sub_v2r8(ix3,jx0);
871 dy30 = _fjsp_sub_v2r8(iy3,jy0);
872 dz30 = _fjsp_sub_v2r8(iz3,jz0);
874 /* Calculate squared distance and things based on it */
875 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
876 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
877 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
878 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
880 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
881 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
882 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
883 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
885 /* Load parameters for j particles */
886 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
887 vdwjidx0A = 2*vdwtype[jnrA+0];
888 vdwjidx0B = 2*vdwtype[jnrB+0];
890 fjx0 = _fjsp_setzero_v2r8();
891 fjy0 = _fjsp_setzero_v2r8();
892 fjz0 = _fjsp_setzero_v2r8();
894 /**************************
895 * CALCULATE INTERACTIONS *
896 **************************/
898 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
900 /* Compute parameters for interactions between i and j atoms */
901 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
902 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
904 /* Calculate table index by multiplying r with table scale and truncate to integer */
905 rt = _fjsp_mul_v2r8(r00,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 DISPERSION */
917 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
918 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
919 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
920 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
921 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
922 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
923 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
924 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
925 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
927 /* CUBIC SPLINE TABLE REPULSION */
928 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
929 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
930 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
931 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
932 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
933 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
934 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
935 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
936 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
937 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
941 /* Update vectorial force */
942 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
943 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
944 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
946 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
947 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
948 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
950 /**************************
951 * CALCULATE INTERACTIONS *
952 **************************/
954 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
956 /* Compute parameters for interactions between i and j atoms */
957 qq10 = _fjsp_mul_v2r8(iq1,jq0);
959 /* Calculate table index by multiplying r with table scale and truncate to integer */
960 rt = _fjsp_mul_v2r8(r10,vftabscale);
961 itab_tmp = _fjsp_dtox_v2r8(rt);
962 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
963 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
964 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
969 /* CUBIC SPLINE TABLE ELECTROSTATICS */
970 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
971 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
972 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
973 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
974 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
975 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
976 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
977 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
978 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
982 /* Update vectorial force */
983 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
984 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
985 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
987 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
988 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
989 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
991 /**************************
992 * CALCULATE INTERACTIONS *
993 **************************/
995 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
997 /* Compute parameters for interactions between i and j atoms */
998 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1000 /* Calculate table index by multiplying r with table scale and truncate to integer */
1001 rt = _fjsp_mul_v2r8(r20,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_load_v2r8( vftab + vfconv.i[1] );
1013 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1014 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1015 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
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(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1023 /* Update vectorial force */
1024 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1025 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1026 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1028 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1029 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1030 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1032 /**************************
1033 * CALCULATE INTERACTIONS *
1034 **************************/
1036 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1038 /* Compute parameters for interactions between i and j atoms */
1039 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1041 /* Calculate table index by multiplying r with table scale and truncate to integer */
1042 rt = _fjsp_mul_v2r8(r30,vftabscale);
1043 itab_tmp = _fjsp_dtox_v2r8(rt);
1044 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1045 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1046 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1051 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1052 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1053 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1054 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1055 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1056 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1057 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1058 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1059 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1060 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1064 /* Update vectorial force */
1065 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1066 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1067 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1069 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1070 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1071 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1073 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1075 /* Inner loop uses 180 flops */
1078 if(jidx<j_index_end)
1082 j_coord_offsetA = DIM*jnrA;
1084 /* load j atom coordinates */
1085 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1088 /* Calculate displacement vector */
1089 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1090 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1091 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1092 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1093 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1094 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1095 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1096 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1097 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1098 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1099 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1100 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1102 /* Calculate squared distance and things based on it */
1103 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1104 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1105 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1106 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1108 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1109 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1110 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1111 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1113 /* Load parameters for j particles */
1114 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1115 vdwjidx0A = 2*vdwtype[jnrA+0];
1117 fjx0 = _fjsp_setzero_v2r8();
1118 fjy0 = _fjsp_setzero_v2r8();
1119 fjz0 = _fjsp_setzero_v2r8();
1121 /**************************
1122 * CALCULATE INTERACTIONS *
1123 **************************/
1125 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1127 /* Compute parameters for interactions between i and j atoms */
1128 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1130 /* Calculate table index by multiplying r with table scale and truncate to integer */
1131 rt = _fjsp_mul_v2r8(r00,vftabscale);
1132 itab_tmp = _fjsp_dtox_v2r8(rt);
1133 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1134 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1135 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1140 /* CUBIC SPLINE TABLE DISPERSION */
1143 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1144 F = _fjsp_setzero_v2r8();
1145 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1146 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1147 H = _fjsp_setzero_v2r8();
1148 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1149 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1150 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1151 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1153 /* CUBIC SPLINE TABLE REPULSION */
1154 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1155 F = _fjsp_setzero_v2r8();
1156 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1157 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1158 H = _fjsp_setzero_v2r8();
1159 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1160 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1161 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1162 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1163 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1167 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1169 /* Update vectorial force */
1170 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1171 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1172 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1174 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1175 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1176 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1178 /**************************
1179 * CALCULATE INTERACTIONS *
1180 **************************/
1182 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1184 /* Compute parameters for interactions between i and j atoms */
1185 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1187 /* Calculate table index by multiplying r with table scale and truncate to integer */
1188 rt = _fjsp_mul_v2r8(r10,vftabscale);
1189 itab_tmp = _fjsp_dtox_v2r8(rt);
1190 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1191 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1192 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1197 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1198 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1199 F = _fjsp_setzero_v2r8();
1200 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1201 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1202 H = _fjsp_setzero_v2r8();
1203 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1204 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1205 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1206 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1210 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1212 /* Update vectorial force */
1213 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1214 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1215 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1217 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1218 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1219 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1221 /**************************
1222 * CALCULATE INTERACTIONS *
1223 **************************/
1225 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1227 /* Compute parameters for interactions between i and j atoms */
1228 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1230 /* Calculate table index by multiplying r with table scale and truncate to integer */
1231 rt = _fjsp_mul_v2r8(r20,vftabscale);
1232 itab_tmp = _fjsp_dtox_v2r8(rt);
1233 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1234 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1235 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1240 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1241 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1242 F = _fjsp_setzero_v2r8();
1243 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1244 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1245 H = _fjsp_setzero_v2r8();
1246 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1247 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1248 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1249 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1253 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1255 /* Update vectorial force */
1256 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1257 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1258 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1260 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1261 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1262 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1264 /**************************
1265 * CALCULATE INTERACTIONS *
1266 **************************/
1268 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1270 /* Compute parameters for interactions between i and j atoms */
1271 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1273 /* Calculate table index by multiplying r with table scale and truncate to integer */
1274 rt = _fjsp_mul_v2r8(r30,vftabscale);
1275 itab_tmp = _fjsp_dtox_v2r8(rt);
1276 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1277 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1278 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1283 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1284 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1285 F = _fjsp_setzero_v2r8();
1286 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1287 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1288 H = _fjsp_setzero_v2r8();
1289 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1290 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1291 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1292 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1296 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1298 /* Update vectorial force */
1299 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1300 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1301 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1303 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1304 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1305 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1307 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1309 /* Inner loop uses 180 flops */
1312 /* End of innermost loop */
1314 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1315 f+i_coord_offset,fshift+i_shift_offset);
1317 /* Increment number of inner iterations */
1318 inneriter += j_index_end - j_index_start;
1320 /* Outer loop uses 24 flops */
1323 /* Increment number of outer iterations */
1326 /* Update outer/inner flops */
1328 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);