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_ElecRFCut_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: CubicSplineTable
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_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 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
114 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
115 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
116 nvdwtype = fr->ntype;
118 vdwtype = mdatoms->typeA;
120 vftab = kernel_data->table_vdw->data;
121 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
123 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
124 rcutoff_scalar = fr->ic->rcoulomb;
125 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
126 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
128 /* Avoid stupid compiler warnings */
136 /* Start outer loop over neighborlists */
137 for(iidx=0; iidx<nri; iidx++)
139 /* Load shift vector for this list */
140 i_shift_offset = DIM*shiftidx[iidx];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
153 fix0 = _fjsp_setzero_v2r8();
154 fiy0 = _fjsp_setzero_v2r8();
155 fiz0 = _fjsp_setzero_v2r8();
157 /* Load parameters for i particles */
158 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
159 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
161 /* Reset potential sums */
162 velecsum = _fjsp_setzero_v2r8();
163 vvdwsum = _fjsp_setzero_v2r8();
165 /* Start inner kernel loop */
166 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
169 /* Get j neighbor index, and coordinate index */
172 j_coord_offsetA = DIM*jnrA;
173 j_coord_offsetB = DIM*jnrB;
175 /* load j atom coordinates */
176 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
179 /* Calculate displacement vector */
180 dx00 = _fjsp_sub_v2r8(ix0,jx0);
181 dy00 = _fjsp_sub_v2r8(iy0,jy0);
182 dz00 = _fjsp_sub_v2r8(iz0,jz0);
184 /* Calculate squared distance and things based on it */
185 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
187 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
189 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
191 /* Load parameters for j particles */
192 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
193 vdwjidx0A = 2*vdwtype[jnrA+0];
194 vdwjidx0B = 2*vdwtype[jnrB+0];
196 /**************************
197 * CALCULATE INTERACTIONS *
198 **************************/
200 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
203 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
205 /* Compute parameters for interactions between i and j atoms */
206 qq00 = _fjsp_mul_v2r8(iq0,jq0);
207 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
208 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
210 /* Calculate table index by multiplying r with table scale and truncate to integer */
211 rt = _fjsp_mul_v2r8(r00,vftabscale);
212 itab_tmp = _fjsp_dtox_v2r8(rt);
213 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
214 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
215 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
220 /* REACTION-FIELD ELECTROSTATICS */
221 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
222 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
224 /* 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 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
254 /* Update potential sum for this i atom from the interaction with this j atom. */
255 velec = _fjsp_and_v2r8(velec,cutoff_mask);
256 velecsum = _fjsp_add_v2r8(velecsum,velec);
257 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
258 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
260 fscal = _fjsp_add_v2r8(felec,fvdw);
262 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
264 /* Update vectorial force */
265 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
266 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
267 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
269 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
273 /* Inner loop uses 75 flops */
280 j_coord_offsetA = DIM*jnrA;
282 /* load j atom coordinates */
283 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
286 /* Calculate displacement vector */
287 dx00 = _fjsp_sub_v2r8(ix0,jx0);
288 dy00 = _fjsp_sub_v2r8(iy0,jy0);
289 dz00 = _fjsp_sub_v2r8(iz0,jz0);
291 /* Calculate squared distance and things based on it */
292 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
294 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
296 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
298 /* Load parameters for j particles */
299 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
300 vdwjidx0A = 2*vdwtype[jnrA+0];
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
309 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
311 /* Compute parameters for interactions between i and j atoms */
312 qq00 = _fjsp_mul_v2r8(iq0,jq0);
313 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
314 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
316 /* Calculate table index by multiplying r with table scale and truncate to integer */
317 rt = _fjsp_mul_v2r8(r00,vftabscale);
318 itab_tmp = _fjsp_dtox_v2r8(rt);
319 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
320 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
321 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
326 /* REACTION-FIELD ELECTROSTATICS */
327 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
328 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
330 /* CUBIC SPLINE TABLE DISPERSION */
331 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
332 F = _fjsp_setzero_v2r8();
333 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
334 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
335 H = _fjsp_setzero_v2r8();
336 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
337 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
338 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
339 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
340 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
341 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
343 /* CUBIC SPLINE TABLE REPULSION */
344 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
345 F = _fjsp_setzero_v2r8();
346 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
347 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
348 H = _fjsp_setzero_v2r8();
349 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
350 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
351 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
352 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
353 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
354 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
355 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
356 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
358 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
360 /* Update potential sum for this i atom from the interaction with this j atom. */
361 velec = _fjsp_and_v2r8(velec,cutoff_mask);
362 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
363 velecsum = _fjsp_add_v2r8(velecsum,velec);
364 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
365 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
366 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
368 fscal = _fjsp_add_v2r8(felec,fvdw);
370 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
372 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
374 /* Update vectorial force */
375 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
376 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
377 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
379 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
383 /* Inner loop uses 75 flops */
386 /* End of innermost loop */
388 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
389 f+i_coord_offset,fshift+i_shift_offset);
392 /* Update potential energies */
393 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
394 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
396 /* Increment number of inner iterations */
397 inneriter += j_index_end - j_index_start;
399 /* Outer loop uses 9 flops */
402 /* Increment number of outer iterations */
405 /* Update outer/inner flops */
407 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*75);
410 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
411 * Electrostatics interaction: ReactionField
412 * VdW interaction: CubicSplineTable
413 * Geometry: Particle-Particle
414 * Calculate force/pot: Force
417 nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
418 (t_nblist * gmx_restrict nlist,
419 rvec * gmx_restrict xx,
420 rvec * gmx_restrict ff,
421 struct t_forcerec * gmx_restrict fr,
422 t_mdatoms * gmx_restrict mdatoms,
423 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
424 t_nrnb * gmx_restrict nrnb)
426 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
427 * just 0 for non-waters.
428 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
429 * jnr indices corresponding to data put in the four positions in the SIMD register.
431 int i_shift_offset,i_coord_offset,outeriter,inneriter;
432 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
434 int j_coord_offsetA,j_coord_offsetB;
435 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
437 real *shiftvec,*fshift,*x,*f;
438 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
440 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
441 int vdwjidx0A,vdwjidx0B;
442 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
443 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
444 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
447 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
450 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
451 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
452 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
455 _fjsp_v2r8 dummy_mask,cutoff_mask;
456 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
457 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
458 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
465 jindex = nlist->jindex;
467 shiftidx = nlist->shift;
469 shiftvec = fr->shift_vec[0];
470 fshift = fr->fshift[0];
471 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
472 charge = mdatoms->chargeA;
473 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
474 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
475 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
476 nvdwtype = fr->ntype;
478 vdwtype = mdatoms->typeA;
480 vftab = kernel_data->table_vdw->data;
481 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
483 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
484 rcutoff_scalar = fr->ic->rcoulomb;
485 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
486 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
488 /* Avoid stupid compiler warnings */
496 /* Start outer loop over neighborlists */
497 for(iidx=0; iidx<nri; iidx++)
499 /* Load shift vector for this list */
500 i_shift_offset = DIM*shiftidx[iidx];
502 /* Load limits for loop over neighbors */
503 j_index_start = jindex[iidx];
504 j_index_end = jindex[iidx+1];
506 /* Get outer coordinate index */
508 i_coord_offset = DIM*inr;
510 /* Load i particle coords and add shift vector */
511 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
513 fix0 = _fjsp_setzero_v2r8();
514 fiy0 = _fjsp_setzero_v2r8();
515 fiz0 = _fjsp_setzero_v2r8();
517 /* Load parameters for i particles */
518 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
519 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
521 /* Start inner kernel loop */
522 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
525 /* Get j neighbor index, and coordinate index */
528 j_coord_offsetA = DIM*jnrA;
529 j_coord_offsetB = DIM*jnrB;
531 /* load j atom coordinates */
532 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
535 /* Calculate displacement vector */
536 dx00 = _fjsp_sub_v2r8(ix0,jx0);
537 dy00 = _fjsp_sub_v2r8(iy0,jy0);
538 dz00 = _fjsp_sub_v2r8(iz0,jz0);
540 /* Calculate squared distance and things based on it */
541 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
543 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
545 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
547 /* Load parameters for j particles */
548 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
549 vdwjidx0A = 2*vdwtype[jnrA+0];
550 vdwjidx0B = 2*vdwtype[jnrB+0];
552 /**************************
553 * CALCULATE INTERACTIONS *
554 **************************/
556 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
559 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
561 /* Compute parameters for interactions between i and j atoms */
562 qq00 = _fjsp_mul_v2r8(iq0,jq0);
563 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
564 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
566 /* Calculate table index by multiplying r with table scale and truncate to integer */
567 rt = _fjsp_mul_v2r8(r00,vftabscale);
568 itab_tmp = _fjsp_dtox_v2r8(rt);
569 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
570 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
571 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
576 /* REACTION-FIELD ELECTROSTATICS */
577 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
579 /* CUBIC SPLINE TABLE DISPERSION */
580 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
581 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
582 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
583 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
584 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
585 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
586 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
587 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
588 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
590 /* CUBIC SPLINE TABLE REPULSION */
591 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
592 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
593 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
594 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
595 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
596 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
597 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
598 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
599 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
600 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
602 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
604 fscal = _fjsp_add_v2r8(felec,fvdw);
606 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
608 /* Update vectorial force */
609 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
610 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
611 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
613 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
617 /* Inner loop uses 60 flops */
624 j_coord_offsetA = DIM*jnrA;
626 /* load j atom coordinates */
627 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
630 /* Calculate displacement vector */
631 dx00 = _fjsp_sub_v2r8(ix0,jx0);
632 dy00 = _fjsp_sub_v2r8(iy0,jy0);
633 dz00 = _fjsp_sub_v2r8(iz0,jz0);
635 /* Calculate squared distance and things based on it */
636 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
638 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
640 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
642 /* Load parameters for j particles */
643 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
644 vdwjidx0A = 2*vdwtype[jnrA+0];
646 /**************************
647 * CALCULATE INTERACTIONS *
648 **************************/
650 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
653 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
655 /* Compute parameters for interactions between i and j atoms */
656 qq00 = _fjsp_mul_v2r8(iq0,jq0);
657 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
658 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
660 /* Calculate table index by multiplying r with table scale and truncate to integer */
661 rt = _fjsp_mul_v2r8(r00,vftabscale);
662 itab_tmp = _fjsp_dtox_v2r8(rt);
663 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
664 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
665 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
670 /* REACTION-FIELD ELECTROSTATICS */
671 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
673 /* CUBIC SPLINE TABLE DISPERSION */
674 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
675 F = _fjsp_setzero_v2r8();
676 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
677 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
678 H = _fjsp_setzero_v2r8();
679 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
680 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
681 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
682 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
684 /* CUBIC SPLINE TABLE REPULSION */
685 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
686 F = _fjsp_setzero_v2r8();
687 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
688 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
689 H = _fjsp_setzero_v2r8();
690 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
691 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
692 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
693 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
694 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
696 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
698 fscal = _fjsp_add_v2r8(felec,fvdw);
700 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
702 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
704 /* Update vectorial force */
705 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
706 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
707 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
709 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
713 /* Inner loop uses 60 flops */
716 /* End of innermost loop */
718 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
719 f+i_coord_offset,fshift+i_shift_offset);
721 /* Increment number of inner iterations */
722 inneriter += j_index_end - j_index_start;
724 /* Outer loop uses 7 flops */
727 /* Increment number of outer iterations */
730 /* Update outer/inner flops */
732 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*60);