2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: CubicSplineTable
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81 int vdwjidx0A,vdwjidx0B;
82 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
84 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
87 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
90 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
91 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
92 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
95 _fjsp_v2r8 dummy_mask,cutoff_mask;
96 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
97 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
98 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
105 jindex = nlist->jindex;
107 shiftidx = nlist->shift;
109 shiftvec = fr->shift_vec[0];
110 fshift = fr->fshift[0];
111 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
112 charge = mdatoms->chargeA;
113 nvdwtype = fr->ntype;
115 vdwtype = mdatoms->typeA;
117 vftab = kernel_data->table_elec_vdw->data;
118 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
120 /* Avoid stupid compiler warnings */
128 /* Start outer loop over neighborlists */
129 for(iidx=0; iidx<nri; iidx++)
131 /* Load shift vector for this list */
132 i_shift_offset = DIM*shiftidx[iidx];
134 /* Load limits for loop over neighbors */
135 j_index_start = jindex[iidx];
136 j_index_end = jindex[iidx+1];
138 /* Get outer coordinate index */
140 i_coord_offset = DIM*inr;
142 /* Load i particle coords and add shift vector */
143 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
145 fix0 = _fjsp_setzero_v2r8();
146 fiy0 = _fjsp_setzero_v2r8();
147 fiz0 = _fjsp_setzero_v2r8();
149 /* Load parameters for i particles */
150 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
151 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
153 /* Reset potential sums */
154 velecsum = _fjsp_setzero_v2r8();
155 vvdwsum = _fjsp_setzero_v2r8();
157 /* Start inner kernel loop */
158 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
161 /* Get j neighbor index, and coordinate index */
164 j_coord_offsetA = DIM*jnrA;
165 j_coord_offsetB = DIM*jnrB;
167 /* load j atom coordinates */
168 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
171 /* Calculate displacement vector */
172 dx00 = _fjsp_sub_v2r8(ix0,jx0);
173 dy00 = _fjsp_sub_v2r8(iy0,jy0);
174 dz00 = _fjsp_sub_v2r8(iz0,jz0);
176 /* Calculate squared distance and things based on it */
177 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
179 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
181 /* Load parameters for j particles */
182 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
183 vdwjidx0A = 2*vdwtype[jnrA+0];
184 vdwjidx0B = 2*vdwtype[jnrB+0];
186 /**************************
187 * CALCULATE INTERACTIONS *
188 **************************/
190 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
192 /* Compute parameters for interactions between i and j atoms */
193 qq00 = _fjsp_mul_v2r8(iq0,jq0);
194 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
195 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
197 /* Calculate table index by multiplying r with table scale and truncate to integer */
198 rt = _fjsp_mul_v2r8(r00,vftabscale);
199 itab_tmp = _fjsp_dtox_v2r8(rt);
200 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
201 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
202 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
207 /* CUBIC SPLINE TABLE ELECTROSTATICS */
208 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
209 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
210 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
211 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
212 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
213 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
214 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
215 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
216 velec = _fjsp_mul_v2r8(qq00,VV);
217 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
218 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
220 /* CUBIC SPLINE TABLE DISPERSION */
223 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
224 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
225 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
226 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
227 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
228 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
229 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
230 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
231 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
232 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
233 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
235 /* CUBIC SPLINE TABLE REPULSION */
236 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
237 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
238 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
239 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
240 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
241 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
242 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
243 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
244 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
245 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
246 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
247 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
248 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
250 /* Update potential sum for this i atom from the interaction with this j atom. */
251 velecsum = _fjsp_add_v2r8(velecsum,velec);
252 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
254 fscal = _fjsp_add_v2r8(felec,fvdw);
256 /* Update vectorial force */
257 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
258 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
259 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
261 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
263 /* Inner loop uses 76 flops */
270 j_coord_offsetA = DIM*jnrA;
272 /* load j atom coordinates */
273 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
276 /* Calculate displacement vector */
277 dx00 = _fjsp_sub_v2r8(ix0,jx0);
278 dy00 = _fjsp_sub_v2r8(iy0,jy0);
279 dz00 = _fjsp_sub_v2r8(iz0,jz0);
281 /* Calculate squared distance and things based on it */
282 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
284 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
286 /* Load parameters for j particles */
287 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
288 vdwjidx0A = 2*vdwtype[jnrA+0];
290 /**************************
291 * CALCULATE INTERACTIONS *
292 **************************/
294 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
296 /* Compute parameters for interactions between i and j atoms */
297 qq00 = _fjsp_mul_v2r8(iq0,jq0);
298 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
299 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
301 /* Calculate table index by multiplying r with table scale and truncate to integer */
302 rt = _fjsp_mul_v2r8(r00,vftabscale);
303 itab_tmp = _fjsp_dtox_v2r8(rt);
304 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
305 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
306 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
311 /* CUBIC SPLINE TABLE ELECTROSTATICS */
312 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
313 F = _fjsp_setzero_v2r8();
314 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
315 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
316 H = _fjsp_setzero_v2r8();
317 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
318 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
319 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
320 velec = _fjsp_mul_v2r8(qq00,VV);
321 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
322 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
324 /* CUBIC SPLINE TABLE DISPERSION */
327 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
328 F = _fjsp_setzero_v2r8();
329 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
330 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
331 H = _fjsp_setzero_v2r8();
332 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
333 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
334 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
335 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
336 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
337 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
339 /* CUBIC SPLINE TABLE REPULSION */
340 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
341 F = _fjsp_setzero_v2r8();
342 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
343 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
344 H = _fjsp_setzero_v2r8();
345 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
346 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
347 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
348 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
349 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
350 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
351 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
352 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
354 /* Update potential sum for this i atom from the interaction with this j atom. */
355 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
356 velecsum = _fjsp_add_v2r8(velecsum,velec);
357 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
358 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
360 fscal = _fjsp_add_v2r8(felec,fvdw);
362 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
364 /* Update vectorial force */
365 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
366 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
367 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
369 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
371 /* Inner loop uses 76 flops */
374 /* End of innermost loop */
376 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
377 f+i_coord_offset,fshift+i_shift_offset);
380 /* Update potential energies */
381 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
382 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
384 /* Increment number of inner iterations */
385 inneriter += j_index_end - j_index_start;
387 /* Outer loop uses 9 flops */
390 /* Increment number of outer iterations */
393 /* Update outer/inner flops */
395 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*76);
398 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
399 * Electrostatics interaction: CubicSplineTable
400 * VdW interaction: CubicSplineTable
401 * Geometry: Particle-Particle
402 * Calculate force/pot: Force
405 nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
406 (t_nblist * gmx_restrict nlist,
407 rvec * gmx_restrict xx,
408 rvec * gmx_restrict ff,
409 struct t_forcerec * gmx_restrict fr,
410 t_mdatoms * gmx_restrict mdatoms,
411 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
412 t_nrnb * gmx_restrict nrnb)
414 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
415 * just 0 for non-waters.
416 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
417 * jnr indices corresponding to data put in the four positions in the SIMD register.
419 int i_shift_offset,i_coord_offset,outeriter,inneriter;
420 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
422 int j_coord_offsetA,j_coord_offsetB;
423 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
425 real *shiftvec,*fshift,*x,*f;
426 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
428 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
429 int vdwjidx0A,vdwjidx0B;
430 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
431 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
432 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
435 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
438 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
439 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
440 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
443 _fjsp_v2r8 dummy_mask,cutoff_mask;
444 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
445 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
446 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
453 jindex = nlist->jindex;
455 shiftidx = nlist->shift;
457 shiftvec = fr->shift_vec[0];
458 fshift = fr->fshift[0];
459 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
460 charge = mdatoms->chargeA;
461 nvdwtype = fr->ntype;
463 vdwtype = mdatoms->typeA;
465 vftab = kernel_data->table_elec_vdw->data;
466 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
468 /* Avoid stupid compiler warnings */
476 /* Start outer loop over neighborlists */
477 for(iidx=0; iidx<nri; iidx++)
479 /* Load shift vector for this list */
480 i_shift_offset = DIM*shiftidx[iidx];
482 /* Load limits for loop over neighbors */
483 j_index_start = jindex[iidx];
484 j_index_end = jindex[iidx+1];
486 /* Get outer coordinate index */
488 i_coord_offset = DIM*inr;
490 /* Load i particle coords and add shift vector */
491 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
493 fix0 = _fjsp_setzero_v2r8();
494 fiy0 = _fjsp_setzero_v2r8();
495 fiz0 = _fjsp_setzero_v2r8();
497 /* Load parameters for i particles */
498 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
499 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
501 /* Start inner kernel loop */
502 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
505 /* Get j neighbor index, and coordinate index */
508 j_coord_offsetA = DIM*jnrA;
509 j_coord_offsetB = DIM*jnrB;
511 /* load j atom coordinates */
512 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
515 /* Calculate displacement vector */
516 dx00 = _fjsp_sub_v2r8(ix0,jx0);
517 dy00 = _fjsp_sub_v2r8(iy0,jy0);
518 dz00 = _fjsp_sub_v2r8(iz0,jz0);
520 /* Calculate squared distance and things based on it */
521 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
523 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
525 /* Load parameters for j particles */
526 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
527 vdwjidx0A = 2*vdwtype[jnrA+0];
528 vdwjidx0B = 2*vdwtype[jnrB+0];
530 /**************************
531 * CALCULATE INTERACTIONS *
532 **************************/
534 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
536 /* Compute parameters for interactions between i and j atoms */
537 qq00 = _fjsp_mul_v2r8(iq0,jq0);
538 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
539 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
541 /* Calculate table index by multiplying r with table scale and truncate to integer */
542 rt = _fjsp_mul_v2r8(r00,vftabscale);
543 itab_tmp = _fjsp_dtox_v2r8(rt);
544 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
545 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
546 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
551 /* CUBIC SPLINE TABLE ELECTROSTATICS */
552 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
553 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
554 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
555 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
556 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
557 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
558 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
559 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
560 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
562 /* CUBIC SPLINE TABLE DISPERSION */
565 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
566 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
567 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
568 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
569 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
570 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
571 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
572 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
573 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
575 /* CUBIC SPLINE TABLE REPULSION */
576 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
577 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
578 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
579 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
580 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
581 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
582 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
583 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
584 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
585 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
587 fscal = _fjsp_add_v2r8(felec,fvdw);
589 /* Update vectorial force */
590 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
591 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
592 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
594 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
596 /* Inner loop uses 64 flops */
603 j_coord_offsetA = DIM*jnrA;
605 /* load j atom coordinates */
606 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
609 /* Calculate displacement vector */
610 dx00 = _fjsp_sub_v2r8(ix0,jx0);
611 dy00 = _fjsp_sub_v2r8(iy0,jy0);
612 dz00 = _fjsp_sub_v2r8(iz0,jz0);
614 /* Calculate squared distance and things based on it */
615 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
617 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
619 /* Load parameters for j particles */
620 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
621 vdwjidx0A = 2*vdwtype[jnrA+0];
623 /**************************
624 * CALCULATE INTERACTIONS *
625 **************************/
627 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
629 /* Compute parameters for interactions between i and j atoms */
630 qq00 = _fjsp_mul_v2r8(iq0,jq0);
631 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
632 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
634 /* Calculate table index by multiplying r with table scale and truncate to integer */
635 rt = _fjsp_mul_v2r8(r00,vftabscale);
636 itab_tmp = _fjsp_dtox_v2r8(rt);
637 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
638 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
639 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
644 /* CUBIC SPLINE TABLE ELECTROSTATICS */
645 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
646 F = _fjsp_setzero_v2r8();
647 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
648 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
649 H = _fjsp_setzero_v2r8();
650 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
651 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
652 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
653 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
655 /* CUBIC SPLINE TABLE DISPERSION */
658 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
659 F = _fjsp_setzero_v2r8();
660 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
661 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
662 H = _fjsp_setzero_v2r8();
663 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
664 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
665 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
666 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
668 /* CUBIC SPLINE TABLE REPULSION */
669 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
670 F = _fjsp_setzero_v2r8();
671 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
672 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
673 H = _fjsp_setzero_v2r8();
674 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
675 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
676 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
677 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
678 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
680 fscal = _fjsp_add_v2r8(felec,fvdw);
682 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
684 /* Update vectorial force */
685 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
686 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
687 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
689 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
691 /* Inner loop uses 64 flops */
694 /* End of innermost loop */
696 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
697 f+i_coord_offset,fshift+i_shift_offset);
699 /* Increment number of inner iterations */
700 inneriter += j_index_end - j_index_start;
702 /* Outer loop uses 7 flops */
705 /* Increment number of outer iterations */
708 /* Update outer/inner flops */
710 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*64);