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_ElecCSTab_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: CubicSplineTable
54 * VdW interaction: CubicSplineTable
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCSTab_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_elec_vdw->data;
120 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_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 /* Load parameters for j particles */
184 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
185 vdwjidx0A = 2*vdwtype[jnrA+0];
186 vdwjidx0B = 2*vdwtype[jnrB+0];
188 /**************************
189 * CALCULATE INTERACTIONS *
190 **************************/
192 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
194 /* Compute parameters for interactions between i and j atoms */
195 qq00 = _fjsp_mul_v2r8(iq0,jq0);
196 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
197 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
199 /* Calculate table index by multiplying r with table scale and truncate to integer */
200 rt = _fjsp_mul_v2r8(r00,vftabscale);
201 itab_tmp = _fjsp_dtox_v2r8(rt);
202 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
203 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
204 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
209 /* CUBIC SPLINE TABLE ELECTROSTATICS */
210 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
211 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
212 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
213 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
214 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
215 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
216 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
217 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
218 velec = _fjsp_mul_v2r8(qq00,VV);
219 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
220 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
222 /* CUBIC SPLINE TABLE DISPERSION */
225 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
226 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
227 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
228 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
229 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
230 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
231 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
232 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
233 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
234 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
235 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
237 /* CUBIC SPLINE TABLE REPULSION */
238 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
239 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
240 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
241 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
242 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
243 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
244 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
245 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
246 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
247 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
248 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
249 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
250 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
252 /* Update potential sum for this i atom from the interaction with this j atom. */
253 velecsum = _fjsp_add_v2r8(velecsum,velec);
254 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
256 fscal = _fjsp_add_v2r8(felec,fvdw);
258 /* Update vectorial force */
259 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
260 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
261 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
263 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
265 /* Inner loop uses 76 flops */
272 j_coord_offsetA = DIM*jnrA;
274 /* load j atom coordinates */
275 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
278 /* Calculate displacement vector */
279 dx00 = _fjsp_sub_v2r8(ix0,jx0);
280 dy00 = _fjsp_sub_v2r8(iy0,jy0);
281 dz00 = _fjsp_sub_v2r8(iz0,jz0);
283 /* Calculate squared distance and things based on it */
284 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
286 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
288 /* Load parameters for j particles */
289 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
290 vdwjidx0A = 2*vdwtype[jnrA+0];
292 /**************************
293 * CALCULATE INTERACTIONS *
294 **************************/
296 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
298 /* Compute parameters for interactions between i and j atoms */
299 qq00 = _fjsp_mul_v2r8(iq0,jq0);
300 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
301 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
303 /* Calculate table index by multiplying r with table scale and truncate to integer */
304 rt = _fjsp_mul_v2r8(r00,vftabscale);
305 itab_tmp = _fjsp_dtox_v2r8(rt);
306 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
307 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
308 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
313 /* CUBIC SPLINE TABLE ELECTROSTATICS */
314 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
315 F = _fjsp_setzero_v2r8();
316 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
317 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
318 H = _fjsp_setzero_v2r8();
319 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
320 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
321 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
322 velec = _fjsp_mul_v2r8(qq00,VV);
323 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
324 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
326 /* CUBIC SPLINE TABLE DISPERSION */
329 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
330 F = _fjsp_setzero_v2r8();
331 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
332 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
333 H = _fjsp_setzero_v2r8();
334 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
335 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
336 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
337 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
338 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
339 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
341 /* CUBIC SPLINE TABLE REPULSION */
342 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
343 F = _fjsp_setzero_v2r8();
344 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
345 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
346 H = _fjsp_setzero_v2r8();
347 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
348 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
349 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
350 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
351 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
352 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
353 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
354 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
356 /* Update potential sum for this i atom from the interaction with this j atom. */
357 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
358 velecsum = _fjsp_add_v2r8(velecsum,velec);
359 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
360 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
362 fscal = _fjsp_add_v2r8(felec,fvdw);
364 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
366 /* Update vectorial force */
367 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
368 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
369 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
371 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
373 /* Inner loop uses 76 flops */
376 /* End of innermost loop */
378 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
379 f+i_coord_offset,fshift+i_shift_offset);
382 /* Update potential energies */
383 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
384 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
386 /* Increment number of inner iterations */
387 inneriter += j_index_end - j_index_start;
389 /* Outer loop uses 9 flops */
392 /* Increment number of outer iterations */
395 /* Update outer/inner flops */
397 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*76);
400 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
401 * Electrostatics interaction: CubicSplineTable
402 * VdW interaction: CubicSplineTable
403 * Geometry: Particle-Particle
404 * Calculate force/pot: Force
407 nb_kernel_ElecCSTab_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
408 (t_nblist * gmx_restrict nlist,
409 rvec * gmx_restrict xx,
410 rvec * gmx_restrict ff,
411 t_forcerec * gmx_restrict fr,
412 t_mdatoms * gmx_restrict mdatoms,
413 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
414 t_nrnb * gmx_restrict nrnb)
416 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
417 * just 0 for non-waters.
418 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
419 * jnr indices corresponding to data put in the four positions in the SIMD register.
421 int i_shift_offset,i_coord_offset,outeriter,inneriter;
422 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
424 int j_coord_offsetA,j_coord_offsetB;
425 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
427 real *shiftvec,*fshift,*x,*f;
428 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
430 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
431 int vdwjidx0A,vdwjidx0B;
432 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
433 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
434 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
437 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
440 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
441 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
442 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
445 _fjsp_v2r8 dummy_mask,cutoff_mask;
446 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
447 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
448 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
455 jindex = nlist->jindex;
457 shiftidx = nlist->shift;
459 shiftvec = fr->shift_vec[0];
460 fshift = fr->fshift[0];
461 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
462 charge = mdatoms->chargeA;
463 nvdwtype = fr->ntype;
465 vdwtype = mdatoms->typeA;
467 vftab = kernel_data->table_elec_vdw->data;
468 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
470 /* Avoid stupid compiler warnings */
478 /* Start outer loop over neighborlists */
479 for(iidx=0; iidx<nri; iidx++)
481 /* Load shift vector for this list */
482 i_shift_offset = DIM*shiftidx[iidx];
484 /* Load limits for loop over neighbors */
485 j_index_start = jindex[iidx];
486 j_index_end = jindex[iidx+1];
488 /* Get outer coordinate index */
490 i_coord_offset = DIM*inr;
492 /* Load i particle coords and add shift vector */
493 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
495 fix0 = _fjsp_setzero_v2r8();
496 fiy0 = _fjsp_setzero_v2r8();
497 fiz0 = _fjsp_setzero_v2r8();
499 /* Load parameters for i particles */
500 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
501 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
503 /* Start inner kernel loop */
504 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
507 /* Get j neighbor index, and coordinate index */
510 j_coord_offsetA = DIM*jnrA;
511 j_coord_offsetB = DIM*jnrB;
513 /* load j atom coordinates */
514 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
517 /* Calculate displacement vector */
518 dx00 = _fjsp_sub_v2r8(ix0,jx0);
519 dy00 = _fjsp_sub_v2r8(iy0,jy0);
520 dz00 = _fjsp_sub_v2r8(iz0,jz0);
522 /* Calculate squared distance and things based on it */
523 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
525 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
527 /* Load parameters for j particles */
528 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
529 vdwjidx0A = 2*vdwtype[jnrA+0];
530 vdwjidx0B = 2*vdwtype[jnrB+0];
532 /**************************
533 * CALCULATE INTERACTIONS *
534 **************************/
536 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
538 /* Compute parameters for interactions between i and j atoms */
539 qq00 = _fjsp_mul_v2r8(iq0,jq0);
540 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
541 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
543 /* Calculate table index by multiplying r with table scale and truncate to integer */
544 rt = _fjsp_mul_v2r8(r00,vftabscale);
545 itab_tmp = _fjsp_dtox_v2r8(rt);
546 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
547 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
548 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
553 /* CUBIC SPLINE TABLE ELECTROSTATICS */
554 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
555 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
556 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
557 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
558 H = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
559 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
560 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
561 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
562 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
564 /* CUBIC SPLINE TABLE DISPERSION */
567 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
568 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
569 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
570 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
571 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
572 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
573 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
574 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
575 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
577 /* CUBIC SPLINE TABLE REPULSION */
578 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
579 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
580 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
581 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
582 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
583 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
584 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
585 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
586 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
587 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
589 fscal = _fjsp_add_v2r8(felec,fvdw);
591 /* Update vectorial force */
592 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
593 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
594 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
596 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
598 /* Inner loop uses 64 flops */
605 j_coord_offsetA = DIM*jnrA;
607 /* load j atom coordinates */
608 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
611 /* Calculate displacement vector */
612 dx00 = _fjsp_sub_v2r8(ix0,jx0);
613 dy00 = _fjsp_sub_v2r8(iy0,jy0);
614 dz00 = _fjsp_sub_v2r8(iz0,jz0);
616 /* Calculate squared distance and things based on it */
617 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
619 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
621 /* Load parameters for j particles */
622 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
623 vdwjidx0A = 2*vdwtype[jnrA+0];
625 /**************************
626 * CALCULATE INTERACTIONS *
627 **************************/
629 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
631 /* Compute parameters for interactions between i and j atoms */
632 qq00 = _fjsp_mul_v2r8(iq0,jq0);
633 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
634 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
636 /* Calculate table index by multiplying r with table scale and truncate to integer */
637 rt = _fjsp_mul_v2r8(r00,vftabscale);
638 itab_tmp = _fjsp_dtox_v2r8(rt);
639 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
640 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
641 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
646 /* CUBIC SPLINE TABLE ELECTROSTATICS */
647 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
648 F = _fjsp_setzero_v2r8();
649 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
650 G = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
651 H = _fjsp_setzero_v2r8();
652 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
653 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
654 FF = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
655 felec = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
657 /* CUBIC SPLINE TABLE DISPERSION */
660 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
661 F = _fjsp_setzero_v2r8();
662 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
663 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
664 H = _fjsp_setzero_v2r8();
665 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
666 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
667 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
668 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
670 /* CUBIC SPLINE TABLE REPULSION */
671 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
672 F = _fjsp_setzero_v2r8();
673 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
674 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
675 H = _fjsp_setzero_v2r8();
676 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
677 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
678 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
679 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
680 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
682 fscal = _fjsp_add_v2r8(felec,fvdw);
684 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
686 /* Update vectorial force */
687 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
688 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
689 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
691 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
693 /* Inner loop uses 64 flops */
696 /* End of innermost loop */
698 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
699 f+i_coord_offset,fshift+i_shift_offset);
701 /* Increment number of inner iterations */
702 inneriter += j_index_end - j_index_start;
704 /* Outer loop uses 7 flops */
707 /* Increment number of outer iterations */
710 /* Update outer/inner flops */
712 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*64);