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 "types/simple.h"
46 #include "gromacs/legacyheaders/vec.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: CubicSplineTable
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwCSTab_GeomP1P1_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;
83 int vdwjidx0A,vdwjidx0B;
84 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
85 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
86 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
89 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
92 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
93 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
94 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
97 _fjsp_v2r8 dummy_mask,cutoff_mask;
98 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
99 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
100 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
107 jindex = nlist->jindex;
109 shiftidx = nlist->shift;
111 shiftvec = fr->shift_vec[0];
112 fshift = fr->fshift[0];
113 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
114 charge = mdatoms->chargeA;
115 nvdwtype = fr->ntype;
117 vdwtype = mdatoms->typeA;
119 vftab = kernel_data->table_vdw->data;
120 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
122 /* Avoid stupid compiler warnings */
130 /* Start outer loop over neighborlists */
131 for(iidx=0; iidx<nri; iidx++)
133 /* Load shift vector for this list */
134 i_shift_offset = DIM*shiftidx[iidx];
136 /* Load limits for loop over neighbors */
137 j_index_start = jindex[iidx];
138 j_index_end = jindex[iidx+1];
140 /* Get outer coordinate index */
142 i_coord_offset = DIM*inr;
144 /* Load i particle coords and add shift vector */
145 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
147 fix0 = _fjsp_setzero_v2r8();
148 fiy0 = _fjsp_setzero_v2r8();
149 fiz0 = _fjsp_setzero_v2r8();
151 /* Load parameters for i particles */
152 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
153 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
155 /* Reset potential sums */
156 velecsum = _fjsp_setzero_v2r8();
157 vvdwsum = _fjsp_setzero_v2r8();
159 /* Start inner kernel loop */
160 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
163 /* Get j neighbor index, and coordinate index */
166 j_coord_offsetA = DIM*jnrA;
167 j_coord_offsetB = DIM*jnrB;
169 /* load j atom coordinates */
170 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
173 /* Calculate displacement vector */
174 dx00 = _fjsp_sub_v2r8(ix0,jx0);
175 dy00 = _fjsp_sub_v2r8(iy0,jy0);
176 dz00 = _fjsp_sub_v2r8(iz0,jz0);
178 /* Calculate squared distance and things based on it */
179 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
181 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
183 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
185 /* Load parameters for j particles */
186 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
187 vdwjidx0A = 2*vdwtype[jnrA+0];
188 vdwjidx0B = 2*vdwtype[jnrB+0];
190 /**************************
191 * CALCULATE INTERACTIONS *
192 **************************/
194 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
196 /* Compute parameters for interactions between i and j atoms */
197 qq00 = _fjsp_mul_v2r8(iq0,jq0);
198 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
199 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
201 /* Calculate table index by multiplying r with table scale and truncate to integer */
202 rt = _fjsp_mul_v2r8(r00,vftabscale);
203 itab_tmp = _fjsp_dtox_v2r8(rt);
204 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
205 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
206 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
211 /* COULOMB ELECTROSTATICS */
212 velec = _fjsp_mul_v2r8(qq00,rinv00);
213 felec = _fjsp_mul_v2r8(velec,rinvsq00);
215 /* CUBIC SPLINE TABLE DISPERSION */
216 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
217 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
218 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
219 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
220 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
221 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
222 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
223 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
224 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
225 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
226 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
228 /* CUBIC SPLINE TABLE REPULSION */
229 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
230 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
231 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
232 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
233 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
234 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
235 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
236 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
237 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
238 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
239 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
240 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
241 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
243 /* Update potential sum for this i atom from the interaction with this j atom. */
244 velecsum = _fjsp_add_v2r8(velecsum,velec);
245 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
247 fscal = _fjsp_add_v2r8(felec,fvdw);
249 /* Update vectorial force */
250 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
251 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
252 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
254 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
256 /* Inner loop uses 66 flops */
263 j_coord_offsetA = DIM*jnrA;
265 /* load j atom coordinates */
266 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
269 /* Calculate displacement vector */
270 dx00 = _fjsp_sub_v2r8(ix0,jx0);
271 dy00 = _fjsp_sub_v2r8(iy0,jy0);
272 dz00 = _fjsp_sub_v2r8(iz0,jz0);
274 /* Calculate squared distance and things based on it */
275 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
277 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
279 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
281 /* Load parameters for j particles */
282 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
283 vdwjidx0A = 2*vdwtype[jnrA+0];
285 /**************************
286 * CALCULATE INTERACTIONS *
287 **************************/
289 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
291 /* Compute parameters for interactions between i and j atoms */
292 qq00 = _fjsp_mul_v2r8(iq0,jq0);
293 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
294 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
296 /* Calculate table index by multiplying r with table scale and truncate to integer */
297 rt = _fjsp_mul_v2r8(r00,vftabscale);
298 itab_tmp = _fjsp_dtox_v2r8(rt);
299 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
300 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
301 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
306 /* COULOMB ELECTROSTATICS */
307 velec = _fjsp_mul_v2r8(qq00,rinv00);
308 felec = _fjsp_mul_v2r8(velec,rinvsq00);
310 /* CUBIC SPLINE TABLE DISPERSION */
311 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
312 F = _fjsp_setzero_v2r8();
313 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
314 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
315 H = _fjsp_setzero_v2r8();
316 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
317 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
318 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
319 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
320 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
321 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
323 /* CUBIC SPLINE TABLE REPULSION */
324 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
325 F = _fjsp_setzero_v2r8();
326 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
327 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
328 H = _fjsp_setzero_v2r8();
329 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
330 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
331 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
332 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
333 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
334 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
335 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
336 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
338 /* Update potential sum for this i atom from the interaction with this j atom. */
339 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
340 velecsum = _fjsp_add_v2r8(velecsum,velec);
341 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
342 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
344 fscal = _fjsp_add_v2r8(felec,fvdw);
346 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
348 /* Update vectorial force */
349 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
350 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
351 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
353 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
355 /* Inner loop uses 66 flops */
358 /* End of innermost loop */
360 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
361 f+i_coord_offset,fshift+i_shift_offset);
364 /* Update potential energies */
365 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
366 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
368 /* Increment number of inner iterations */
369 inneriter += j_index_end - j_index_start;
371 /* Outer loop uses 9 flops */
374 /* Increment number of outer iterations */
377 /* Update outer/inner flops */
379 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*66);
382 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
383 * Electrostatics interaction: Coulomb
384 * VdW interaction: CubicSplineTable
385 * Geometry: Particle-Particle
386 * Calculate force/pot: Force
389 nb_kernel_ElecCoul_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
390 (t_nblist * gmx_restrict nlist,
391 rvec * gmx_restrict xx,
392 rvec * gmx_restrict ff,
393 t_forcerec * gmx_restrict fr,
394 t_mdatoms * gmx_restrict mdatoms,
395 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
396 t_nrnb * gmx_restrict nrnb)
398 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
399 * just 0 for non-waters.
400 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
401 * jnr indices corresponding to data put in the four positions in the SIMD register.
403 int i_shift_offset,i_coord_offset,outeriter,inneriter;
404 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
406 int j_coord_offsetA,j_coord_offsetB;
407 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
409 real *shiftvec,*fshift,*x,*f;
410 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
412 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
413 int vdwjidx0A,vdwjidx0B;
414 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
415 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
416 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
419 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
422 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
423 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
424 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
427 _fjsp_v2r8 dummy_mask,cutoff_mask;
428 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
429 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
430 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
437 jindex = nlist->jindex;
439 shiftidx = nlist->shift;
441 shiftvec = fr->shift_vec[0];
442 fshift = fr->fshift[0];
443 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
444 charge = mdatoms->chargeA;
445 nvdwtype = fr->ntype;
447 vdwtype = mdatoms->typeA;
449 vftab = kernel_data->table_vdw->data;
450 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
452 /* Avoid stupid compiler warnings */
460 /* Start outer loop over neighborlists */
461 for(iidx=0; iidx<nri; iidx++)
463 /* Load shift vector for this list */
464 i_shift_offset = DIM*shiftidx[iidx];
466 /* Load limits for loop over neighbors */
467 j_index_start = jindex[iidx];
468 j_index_end = jindex[iidx+1];
470 /* Get outer coordinate index */
472 i_coord_offset = DIM*inr;
474 /* Load i particle coords and add shift vector */
475 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
477 fix0 = _fjsp_setzero_v2r8();
478 fiy0 = _fjsp_setzero_v2r8();
479 fiz0 = _fjsp_setzero_v2r8();
481 /* Load parameters for i particles */
482 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
483 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
485 /* Start inner kernel loop */
486 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
489 /* Get j neighbor index, and coordinate index */
492 j_coord_offsetA = DIM*jnrA;
493 j_coord_offsetB = DIM*jnrB;
495 /* load j atom coordinates */
496 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
499 /* Calculate displacement vector */
500 dx00 = _fjsp_sub_v2r8(ix0,jx0);
501 dy00 = _fjsp_sub_v2r8(iy0,jy0);
502 dz00 = _fjsp_sub_v2r8(iz0,jz0);
504 /* Calculate squared distance and things based on it */
505 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
507 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
509 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
511 /* Load parameters for j particles */
512 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
513 vdwjidx0A = 2*vdwtype[jnrA+0];
514 vdwjidx0B = 2*vdwtype[jnrB+0];
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
520 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
522 /* Compute parameters for interactions between i and j atoms */
523 qq00 = _fjsp_mul_v2r8(iq0,jq0);
524 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
525 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
527 /* Calculate table index by multiplying r with table scale and truncate to integer */
528 rt = _fjsp_mul_v2r8(r00,vftabscale);
529 itab_tmp = _fjsp_dtox_v2r8(rt);
530 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
531 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
532 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
537 /* COULOMB ELECTROSTATICS */
538 velec = _fjsp_mul_v2r8(qq00,rinv00);
539 felec = _fjsp_mul_v2r8(velec,rinvsq00);
541 /* CUBIC SPLINE TABLE DISPERSION */
542 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
543 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
544 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
545 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
546 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
547 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
548 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
549 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
550 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
552 /* CUBIC SPLINE TABLE REPULSION */
553 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
554 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
555 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
556 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
557 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
558 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
559 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
560 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
561 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
562 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
564 fscal = _fjsp_add_v2r8(felec,fvdw);
566 /* Update vectorial force */
567 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
568 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
569 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
571 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
573 /* Inner loop uses 57 flops */
580 j_coord_offsetA = DIM*jnrA;
582 /* load j atom coordinates */
583 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
586 /* Calculate displacement vector */
587 dx00 = _fjsp_sub_v2r8(ix0,jx0);
588 dy00 = _fjsp_sub_v2r8(iy0,jy0);
589 dz00 = _fjsp_sub_v2r8(iz0,jz0);
591 /* Calculate squared distance and things based on it */
592 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
594 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
596 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
598 /* Load parameters for j particles */
599 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
600 vdwjidx0A = 2*vdwtype[jnrA+0];
602 /**************************
603 * CALCULATE INTERACTIONS *
604 **************************/
606 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
608 /* Compute parameters for interactions between i and j atoms */
609 qq00 = _fjsp_mul_v2r8(iq0,jq0);
610 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
611 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
613 /* Calculate table index by multiplying r with table scale and truncate to integer */
614 rt = _fjsp_mul_v2r8(r00,vftabscale);
615 itab_tmp = _fjsp_dtox_v2r8(rt);
616 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
617 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
618 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
623 /* COULOMB ELECTROSTATICS */
624 velec = _fjsp_mul_v2r8(qq00,rinv00);
625 felec = _fjsp_mul_v2r8(velec,rinvsq00);
627 /* CUBIC SPLINE TABLE DISPERSION */
628 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
629 F = _fjsp_setzero_v2r8();
630 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
631 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
632 H = _fjsp_setzero_v2r8();
633 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
634 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
635 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
636 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
638 /* CUBIC SPLINE TABLE REPULSION */
639 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
640 F = _fjsp_setzero_v2r8();
641 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
642 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
643 H = _fjsp_setzero_v2r8();
644 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
645 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
646 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
647 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
648 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
650 fscal = _fjsp_add_v2r8(felec,fvdw);
652 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
654 /* Update vectorial force */
655 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
656 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
657 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
659 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
661 /* Inner loop uses 57 flops */
664 /* End of innermost loop */
666 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
667 f+i_coord_offset,fshift+i_shift_offset);
669 /* Increment number of inner iterations */
670 inneriter += j_index_end - j_index_start;
672 /* Outer loop uses 7 flops */
675 /* Increment number of outer iterations */
678 /* Update outer/inner flops */
680 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*57);