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_ElecEw_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: CubicSplineTable
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEw_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;
96 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
99 _fjsp_v2r8 dummy_mask,cutoff_mask;
100 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
101 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
102 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
109 jindex = nlist->jindex;
111 shiftidx = nlist->shift;
113 shiftvec = fr->shift_vec[0];
114 fshift = fr->fshift[0];
115 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
116 charge = mdatoms->chargeA;
117 nvdwtype = fr->ntype;
119 vdwtype = mdatoms->typeA;
121 vftab = kernel_data->table_vdw->data;
122 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
124 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
125 ewtab = fr->ic->tabq_coul_FDV0;
126 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
127 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
129 /* Avoid stupid compiler warnings */
137 /* Start outer loop over neighborlists */
138 for(iidx=0; iidx<nri; iidx++)
140 /* Load shift vector for this list */
141 i_shift_offset = DIM*shiftidx[iidx];
143 /* Load limits for loop over neighbors */
144 j_index_start = jindex[iidx];
145 j_index_end = jindex[iidx+1];
147 /* Get outer coordinate index */
149 i_coord_offset = DIM*inr;
151 /* Load i particle coords and add shift vector */
152 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
154 fix0 = _fjsp_setzero_v2r8();
155 fiy0 = _fjsp_setzero_v2r8();
156 fiz0 = _fjsp_setzero_v2r8();
158 /* Load parameters for i particles */
159 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
160 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
162 /* Reset potential sums */
163 velecsum = _fjsp_setzero_v2r8();
164 vvdwsum = _fjsp_setzero_v2r8();
166 /* Start inner kernel loop */
167 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
170 /* Get j neighbor index, and coordinate index */
173 j_coord_offsetA = DIM*jnrA;
174 j_coord_offsetB = DIM*jnrB;
176 /* load j atom coordinates */
177 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
180 /* Calculate displacement vector */
181 dx00 = _fjsp_sub_v2r8(ix0,jx0);
182 dy00 = _fjsp_sub_v2r8(iy0,jy0);
183 dz00 = _fjsp_sub_v2r8(iz0,jz0);
185 /* Calculate squared distance and things based on it */
186 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
188 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
190 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
192 /* Load parameters for j particles */
193 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
194 vdwjidx0A = 2*vdwtype[jnrA+0];
195 vdwjidx0B = 2*vdwtype[jnrB+0];
197 /**************************
198 * CALCULATE INTERACTIONS *
199 **************************/
201 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
203 /* Compute parameters for interactions between i and j atoms */
204 qq00 = _fjsp_mul_v2r8(iq0,jq0);
205 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
206 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
208 /* Calculate table index by multiplying r with table scale and truncate to integer */
209 rt = _fjsp_mul_v2r8(r00,vftabscale);
210 itab_tmp = _fjsp_dtox_v2r8(rt);
211 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
212 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
213 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
218 /* EWALD ELECTROSTATICS */
220 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
221 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
222 itab_tmp = _fjsp_dtox_v2r8(ewrt);
223 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
224 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
226 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
227 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
228 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
229 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
230 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
231 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
232 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
233 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
234 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
235 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
237 /* CUBIC SPLINE TABLE DISPERSION */
238 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
239 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
240 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
241 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
242 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
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 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
247 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
248 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
250 /* CUBIC SPLINE TABLE REPULSION */
251 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
252 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
253 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
254 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
255 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
256 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
257 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
258 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
259 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
260 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
261 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
262 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
263 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
265 /* Update potential sum for this i atom from the interaction with this j atom. */
266 velecsum = _fjsp_add_v2r8(velecsum,velec);
267 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
269 fscal = _fjsp_add_v2r8(felec,fvdw);
271 /* Update vectorial force */
272 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
273 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
274 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
276 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
278 /* Inner loop uses 78 flops */
285 j_coord_offsetA = DIM*jnrA;
287 /* load j atom coordinates */
288 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
291 /* Calculate displacement vector */
292 dx00 = _fjsp_sub_v2r8(ix0,jx0);
293 dy00 = _fjsp_sub_v2r8(iy0,jy0);
294 dz00 = _fjsp_sub_v2r8(iz0,jz0);
296 /* Calculate squared distance and things based on it */
297 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
299 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
301 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
303 /* Load parameters for j particles */
304 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
305 vdwjidx0A = 2*vdwtype[jnrA+0];
307 /**************************
308 * CALCULATE INTERACTIONS *
309 **************************/
311 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
313 /* Compute parameters for interactions between i and j atoms */
314 qq00 = _fjsp_mul_v2r8(iq0,jq0);
315 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
317 /* Calculate table index by multiplying r with table scale and truncate to integer */
318 rt = _fjsp_mul_v2r8(r00,vftabscale);
319 itab_tmp = _fjsp_dtox_v2r8(rt);
320 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
321 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
322 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
327 /* EWALD ELECTROSTATICS */
329 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
330 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
331 itab_tmp = _fjsp_dtox_v2r8(ewrt);
332 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
333 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
335 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
336 ewtabD = _fjsp_setzero_v2r8();
337 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
338 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
339 ewtabFn = _fjsp_setzero_v2r8();
340 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
341 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
342 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
343 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
344 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
346 /* CUBIC SPLINE TABLE DISPERSION */
347 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
348 F = _fjsp_setzero_v2r8();
349 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
350 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
351 H = _fjsp_setzero_v2r8();
352 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
353 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
354 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
355 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
356 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
357 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
359 /* CUBIC SPLINE TABLE REPULSION */
360 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
361 F = _fjsp_setzero_v2r8();
362 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
363 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
364 H = _fjsp_setzero_v2r8();
365 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
366 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
367 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
368 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
369 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
370 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
371 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
372 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
374 /* Update potential sum for this i atom from the interaction with this j atom. */
375 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
376 velecsum = _fjsp_add_v2r8(velecsum,velec);
377 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
378 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
380 fscal = _fjsp_add_v2r8(felec,fvdw);
382 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
384 /* Update vectorial force */
385 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
386 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
387 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
389 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
391 /* Inner loop uses 78 flops */
394 /* End of innermost loop */
396 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
397 f+i_coord_offset,fshift+i_shift_offset);
400 /* Update potential energies */
401 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
402 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
404 /* Increment number of inner iterations */
405 inneriter += j_index_end - j_index_start;
407 /* Outer loop uses 9 flops */
410 /* Increment number of outer iterations */
413 /* Update outer/inner flops */
415 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*78);
418 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
419 * Electrostatics interaction: Ewald
420 * VdW interaction: CubicSplineTable
421 * Geometry: Particle-Particle
422 * Calculate force/pot: Force
425 nb_kernel_ElecEw_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
426 (t_nblist * gmx_restrict nlist,
427 rvec * gmx_restrict xx,
428 rvec * gmx_restrict ff,
429 t_forcerec * gmx_restrict fr,
430 t_mdatoms * gmx_restrict mdatoms,
431 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
432 t_nrnb * gmx_restrict nrnb)
434 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
435 * just 0 for non-waters.
436 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
437 * jnr indices corresponding to data put in the four positions in the SIMD register.
439 int i_shift_offset,i_coord_offset,outeriter,inneriter;
440 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
442 int j_coord_offsetA,j_coord_offsetB;
443 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
445 real *shiftvec,*fshift,*x,*f;
446 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
448 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
449 int vdwjidx0A,vdwjidx0B;
450 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
451 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
452 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
455 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
458 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
459 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
460 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
462 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
465 _fjsp_v2r8 dummy_mask,cutoff_mask;
466 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
467 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
468 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
475 jindex = nlist->jindex;
477 shiftidx = nlist->shift;
479 shiftvec = fr->shift_vec[0];
480 fshift = fr->fshift[0];
481 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
482 charge = mdatoms->chargeA;
483 nvdwtype = fr->ntype;
485 vdwtype = mdatoms->typeA;
487 vftab = kernel_data->table_vdw->data;
488 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
490 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
491 ewtab = fr->ic->tabq_coul_F;
492 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
493 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
495 /* Avoid stupid compiler warnings */
503 /* Start outer loop over neighborlists */
504 for(iidx=0; iidx<nri; iidx++)
506 /* Load shift vector for this list */
507 i_shift_offset = DIM*shiftidx[iidx];
509 /* Load limits for loop over neighbors */
510 j_index_start = jindex[iidx];
511 j_index_end = jindex[iidx+1];
513 /* Get outer coordinate index */
515 i_coord_offset = DIM*inr;
517 /* Load i particle coords and add shift vector */
518 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
520 fix0 = _fjsp_setzero_v2r8();
521 fiy0 = _fjsp_setzero_v2r8();
522 fiz0 = _fjsp_setzero_v2r8();
524 /* Load parameters for i particles */
525 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
526 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
528 /* Start inner kernel loop */
529 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
532 /* Get j neighbor index, and coordinate index */
535 j_coord_offsetA = DIM*jnrA;
536 j_coord_offsetB = DIM*jnrB;
538 /* load j atom coordinates */
539 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
542 /* Calculate displacement vector */
543 dx00 = _fjsp_sub_v2r8(ix0,jx0);
544 dy00 = _fjsp_sub_v2r8(iy0,jy0);
545 dz00 = _fjsp_sub_v2r8(iz0,jz0);
547 /* Calculate squared distance and things based on it */
548 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
550 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
552 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
554 /* Load parameters for j particles */
555 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
556 vdwjidx0A = 2*vdwtype[jnrA+0];
557 vdwjidx0B = 2*vdwtype[jnrB+0];
559 /**************************
560 * CALCULATE INTERACTIONS *
561 **************************/
563 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
565 /* Compute parameters for interactions between i and j atoms */
566 qq00 = _fjsp_mul_v2r8(iq0,jq0);
567 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
568 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
570 /* Calculate table index by multiplying r with table scale and truncate to integer */
571 rt = _fjsp_mul_v2r8(r00,vftabscale);
572 itab_tmp = _fjsp_dtox_v2r8(rt);
573 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
574 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
575 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
580 /* EWALD ELECTROSTATICS */
582 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
583 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
584 itab_tmp = _fjsp_dtox_v2r8(ewrt);
585 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
586 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
588 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
590 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
591 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
593 /* CUBIC SPLINE TABLE DISPERSION */
594 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
595 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
596 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
597 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
598 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
599 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
600 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
601 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
602 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
604 /* CUBIC SPLINE TABLE REPULSION */
605 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
606 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
607 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
608 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
609 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
610 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
611 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
612 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
613 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
614 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
616 fscal = _fjsp_add_v2r8(felec,fvdw);
618 /* Update vectorial force */
619 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
620 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
621 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
623 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
625 /* Inner loop uses 65 flops */
632 j_coord_offsetA = DIM*jnrA;
634 /* load j atom coordinates */
635 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
638 /* Calculate displacement vector */
639 dx00 = _fjsp_sub_v2r8(ix0,jx0);
640 dy00 = _fjsp_sub_v2r8(iy0,jy0);
641 dz00 = _fjsp_sub_v2r8(iz0,jz0);
643 /* Calculate squared distance and things based on it */
644 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
646 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
648 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
650 /* Load parameters for j particles */
651 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
652 vdwjidx0A = 2*vdwtype[jnrA+0];
654 /**************************
655 * CALCULATE INTERACTIONS *
656 **************************/
658 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
660 /* Compute parameters for interactions between i and j atoms */
661 qq00 = _fjsp_mul_v2r8(iq0,jq0);
662 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
664 /* Calculate table index by multiplying r with table scale and truncate to integer */
665 rt = _fjsp_mul_v2r8(r00,vftabscale);
666 itab_tmp = _fjsp_dtox_v2r8(rt);
667 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
668 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
669 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
674 /* EWALD ELECTROSTATICS */
676 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
677 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
678 itab_tmp = _fjsp_dtox_v2r8(ewrt);
679 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
680 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
682 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
683 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
684 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
686 /* CUBIC SPLINE TABLE DISPERSION */
687 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
688 F = _fjsp_setzero_v2r8();
689 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
690 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
691 H = _fjsp_setzero_v2r8();
692 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
693 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
694 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
695 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
697 /* CUBIC SPLINE TABLE REPULSION */
698 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
699 F = _fjsp_setzero_v2r8();
700 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
701 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
702 H = _fjsp_setzero_v2r8();
703 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
704 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
705 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
706 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
707 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
709 fscal = _fjsp_add_v2r8(felec,fvdw);
711 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
713 /* Update vectorial force */
714 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
715 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
716 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
718 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
720 /* Inner loop uses 65 flops */
723 /* End of innermost loop */
725 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
726 f+i_coord_offset,fshift+i_shift_offset);
728 /* Increment number of inner iterations */
729 inneriter += j_index_end - j_index_start;
731 /* Outer loop uses 7 flops */
734 /* Increment number of outer iterations */
737 /* Update outer/inner flops */
739 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*65);