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 "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
316 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
318 /* Calculate table index by multiplying r with table scale and truncate to integer */
319 rt = _fjsp_mul_v2r8(r00,vftabscale);
320 itab_tmp = _fjsp_dtox_v2r8(rt);
321 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
322 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
323 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
328 /* EWALD ELECTROSTATICS */
330 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
331 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
332 itab_tmp = _fjsp_dtox_v2r8(ewrt);
333 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
334 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
336 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
337 ewtabD = _fjsp_setzero_v2r8();
338 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
339 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
340 ewtabFn = _fjsp_setzero_v2r8();
341 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
342 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
343 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
344 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
345 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
347 /* CUBIC SPLINE TABLE DISPERSION */
348 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
349 F = _fjsp_setzero_v2r8();
350 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
351 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
352 H = _fjsp_setzero_v2r8();
353 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
354 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
355 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
356 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
357 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
358 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
360 /* CUBIC SPLINE TABLE REPULSION */
361 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
362 F = _fjsp_setzero_v2r8();
363 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
364 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
365 H = _fjsp_setzero_v2r8();
366 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
367 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
368 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
369 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
370 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
371 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
372 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
373 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
375 /* Update potential sum for this i atom from the interaction with this j atom. */
376 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
377 velecsum = _fjsp_add_v2r8(velecsum,velec);
378 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
379 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
381 fscal = _fjsp_add_v2r8(felec,fvdw);
383 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
385 /* Update vectorial force */
386 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
387 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
388 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
390 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
392 /* Inner loop uses 78 flops */
395 /* End of innermost loop */
397 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
398 f+i_coord_offset,fshift+i_shift_offset);
401 /* Update potential energies */
402 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
403 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
405 /* Increment number of inner iterations */
406 inneriter += j_index_end - j_index_start;
408 /* Outer loop uses 9 flops */
411 /* Increment number of outer iterations */
414 /* Update outer/inner flops */
416 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*78);
419 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
420 * Electrostatics interaction: Ewald
421 * VdW interaction: CubicSplineTable
422 * Geometry: Particle-Particle
423 * Calculate force/pot: Force
426 nb_kernel_ElecEw_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
427 (t_nblist * gmx_restrict nlist,
428 rvec * gmx_restrict xx,
429 rvec * gmx_restrict ff,
430 t_forcerec * gmx_restrict fr,
431 t_mdatoms * gmx_restrict mdatoms,
432 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
433 t_nrnb * gmx_restrict nrnb)
435 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
436 * just 0 for non-waters.
437 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
438 * jnr indices corresponding to data put in the four positions in the SIMD register.
440 int i_shift_offset,i_coord_offset,outeriter,inneriter;
441 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
443 int j_coord_offsetA,j_coord_offsetB;
444 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
446 real *shiftvec,*fshift,*x,*f;
447 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
449 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
450 int vdwjidx0A,vdwjidx0B;
451 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
452 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
453 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
456 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
459 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
460 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
461 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
463 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
466 _fjsp_v2r8 dummy_mask,cutoff_mask;
467 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
468 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
469 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
476 jindex = nlist->jindex;
478 shiftidx = nlist->shift;
480 shiftvec = fr->shift_vec[0];
481 fshift = fr->fshift[0];
482 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
483 charge = mdatoms->chargeA;
484 nvdwtype = fr->ntype;
486 vdwtype = mdatoms->typeA;
488 vftab = kernel_data->table_vdw->data;
489 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
491 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
492 ewtab = fr->ic->tabq_coul_F;
493 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
494 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
496 /* Avoid stupid compiler warnings */
504 /* Start outer loop over neighborlists */
505 for(iidx=0; iidx<nri; iidx++)
507 /* Load shift vector for this list */
508 i_shift_offset = DIM*shiftidx[iidx];
510 /* Load limits for loop over neighbors */
511 j_index_start = jindex[iidx];
512 j_index_end = jindex[iidx+1];
514 /* Get outer coordinate index */
516 i_coord_offset = DIM*inr;
518 /* Load i particle coords and add shift vector */
519 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
521 fix0 = _fjsp_setzero_v2r8();
522 fiy0 = _fjsp_setzero_v2r8();
523 fiz0 = _fjsp_setzero_v2r8();
525 /* Load parameters for i particles */
526 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
527 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
529 /* Start inner kernel loop */
530 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
533 /* Get j neighbor index, and coordinate index */
536 j_coord_offsetA = DIM*jnrA;
537 j_coord_offsetB = DIM*jnrB;
539 /* load j atom coordinates */
540 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
543 /* Calculate displacement vector */
544 dx00 = _fjsp_sub_v2r8(ix0,jx0);
545 dy00 = _fjsp_sub_v2r8(iy0,jy0);
546 dz00 = _fjsp_sub_v2r8(iz0,jz0);
548 /* Calculate squared distance and things based on it */
549 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
551 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
553 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
555 /* Load parameters for j particles */
556 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
557 vdwjidx0A = 2*vdwtype[jnrA+0];
558 vdwjidx0B = 2*vdwtype[jnrB+0];
560 /**************************
561 * CALCULATE INTERACTIONS *
562 **************************/
564 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
566 /* Compute parameters for interactions between i and j atoms */
567 qq00 = _fjsp_mul_v2r8(iq0,jq0);
568 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
569 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
571 /* Calculate table index by multiplying r with table scale and truncate to integer */
572 rt = _fjsp_mul_v2r8(r00,vftabscale);
573 itab_tmp = _fjsp_dtox_v2r8(rt);
574 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
575 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
576 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
581 /* EWALD ELECTROSTATICS */
583 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
584 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
585 itab_tmp = _fjsp_dtox_v2r8(ewrt);
586 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
587 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
589 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
591 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
592 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
594 /* CUBIC SPLINE TABLE DISPERSION */
595 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
596 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
597 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
598 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
599 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
600 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
601 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
602 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
603 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
605 /* CUBIC SPLINE TABLE REPULSION */
606 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
607 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
608 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
609 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
610 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
611 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
612 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
613 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
614 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
615 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
617 fscal = _fjsp_add_v2r8(felec,fvdw);
619 /* Update vectorial force */
620 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
621 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
622 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
624 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
626 /* Inner loop uses 65 flops */
633 j_coord_offsetA = DIM*jnrA;
635 /* load j atom coordinates */
636 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
639 /* Calculate displacement vector */
640 dx00 = _fjsp_sub_v2r8(ix0,jx0);
641 dy00 = _fjsp_sub_v2r8(iy0,jy0);
642 dz00 = _fjsp_sub_v2r8(iz0,jz0);
644 /* Calculate squared distance and things based on it */
645 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
647 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
649 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
651 /* Load parameters for j particles */
652 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
653 vdwjidx0A = 2*vdwtype[jnrA+0];
655 /**************************
656 * CALCULATE INTERACTIONS *
657 **************************/
659 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
661 /* Compute parameters for interactions between i and j atoms */
662 qq00 = _fjsp_mul_v2r8(iq0,jq0);
663 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
664 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
666 /* Calculate table index by multiplying r with table scale and truncate to integer */
667 rt = _fjsp_mul_v2r8(r00,vftabscale);
668 itab_tmp = _fjsp_dtox_v2r8(rt);
669 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
670 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
671 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
676 /* EWALD ELECTROSTATICS */
678 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
679 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
680 itab_tmp = _fjsp_dtox_v2r8(ewrt);
681 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
682 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
684 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
685 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
686 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
688 /* CUBIC SPLINE TABLE DISPERSION */
689 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
690 F = _fjsp_setzero_v2r8();
691 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
692 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
693 H = _fjsp_setzero_v2r8();
694 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
695 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
696 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
697 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
699 /* CUBIC SPLINE TABLE REPULSION */
700 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
701 F = _fjsp_setzero_v2r8();
702 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
703 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
704 H = _fjsp_setzero_v2r8();
705 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
706 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
707 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
708 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
709 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
711 fscal = _fjsp_add_v2r8(felec,fvdw);
713 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
715 /* Update vectorial force */
716 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
717 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
718 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
720 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
722 /* Inner loop uses 65 flops */
725 /* End of innermost loop */
727 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
728 f+i_coord_offset,fshift+i_shift_offset);
730 /* Increment number of inner iterations */
731 inneriter += j_index_end - j_index_start;
733 /* Outer loop uses 7 flops */
736 /* Increment number of outer iterations */
739 /* Update outer/inner flops */
741 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*65);