2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012, by the GROMACS development team, led by
5 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 * others, as listed in the AUTHORS file in the top-level source
7 * 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_ElecRFCut_VdwCSTab_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: CubicSplineTable
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_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_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 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
116 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
117 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
118 nvdwtype = fr->ntype;
120 vdwtype = mdatoms->typeA;
122 vftab = kernel_data->table_vdw->data;
123 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
125 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
126 rcutoff_scalar = fr->rcoulomb;
127 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
128 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
130 /* Avoid stupid compiler warnings */
138 /* Start outer loop over neighborlists */
139 for(iidx=0; iidx<nri; iidx++)
141 /* Load shift vector for this list */
142 i_shift_offset = DIM*shiftidx[iidx];
144 /* Load limits for loop over neighbors */
145 j_index_start = jindex[iidx];
146 j_index_end = jindex[iidx+1];
148 /* Get outer coordinate index */
150 i_coord_offset = DIM*inr;
152 /* Load i particle coords and add shift vector */
153 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
155 fix0 = _fjsp_setzero_v2r8();
156 fiy0 = _fjsp_setzero_v2r8();
157 fiz0 = _fjsp_setzero_v2r8();
159 /* Load parameters for i particles */
160 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
161 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
163 /* Reset potential sums */
164 velecsum = _fjsp_setzero_v2r8();
165 vvdwsum = _fjsp_setzero_v2r8();
167 /* Start inner kernel loop */
168 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
171 /* Get j neighbor index, and coordinate index */
174 j_coord_offsetA = DIM*jnrA;
175 j_coord_offsetB = DIM*jnrB;
177 /* load j atom coordinates */
178 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
181 /* Calculate displacement vector */
182 dx00 = _fjsp_sub_v2r8(ix0,jx0);
183 dy00 = _fjsp_sub_v2r8(iy0,jy0);
184 dz00 = _fjsp_sub_v2r8(iz0,jz0);
186 /* Calculate squared distance and things based on it */
187 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
189 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
191 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
193 /* Load parameters for j particles */
194 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
195 vdwjidx0A = 2*vdwtype[jnrA+0];
196 vdwjidx0B = 2*vdwtype[jnrB+0];
198 /**************************
199 * CALCULATE INTERACTIONS *
200 **************************/
202 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
205 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
207 /* Compute parameters for interactions between i and j atoms */
208 qq00 = _fjsp_mul_v2r8(iq0,jq0);
209 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
210 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
212 /* Calculate table index by multiplying r with table scale and truncate to integer */
213 rt = _fjsp_mul_v2r8(r00,vftabscale);
214 itab_tmp = _fjsp_dtox_v2r8(rt);
215 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
216 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
217 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
222 /* REACTION-FIELD ELECTROSTATICS */
223 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
224 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
226 /* CUBIC SPLINE TABLE DISPERSION */
227 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
228 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
229 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
230 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
231 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
232 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
233 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
234 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
235 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
236 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
237 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
239 /* CUBIC SPLINE TABLE REPULSION */
240 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
241 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
242 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
243 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
244 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
245 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
246 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
247 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
248 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
249 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
250 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
251 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
252 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
254 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
256 /* Update potential sum for this i atom from the interaction with this j atom. */
257 velec = _fjsp_and_v2r8(velec,cutoff_mask);
258 velecsum = _fjsp_add_v2r8(velecsum,velec);
259 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
260 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
262 fscal = _fjsp_add_v2r8(felec,fvdw);
264 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
266 /* Update vectorial force */
267 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
268 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
269 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
271 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
275 /* Inner loop uses 75 flops */
282 j_coord_offsetA = DIM*jnrA;
284 /* load j atom coordinates */
285 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
288 /* Calculate displacement vector */
289 dx00 = _fjsp_sub_v2r8(ix0,jx0);
290 dy00 = _fjsp_sub_v2r8(iy0,jy0);
291 dz00 = _fjsp_sub_v2r8(iz0,jz0);
293 /* Calculate squared distance and things based on it */
294 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
296 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
298 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
300 /* Load parameters for j particles */
301 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
302 vdwjidx0A = 2*vdwtype[jnrA+0];
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
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 /* REACTION-FIELD ELECTROSTATICS */
328 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
329 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
331 /* CUBIC SPLINE TABLE DISPERSION */
332 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
333 F = _fjsp_setzero_v2r8();
334 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
335 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
336 H = _fjsp_setzero_v2r8();
337 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
338 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
339 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
340 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
341 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
342 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
344 /* CUBIC SPLINE TABLE REPULSION */
345 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
346 F = _fjsp_setzero_v2r8();
347 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
348 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
349 H = _fjsp_setzero_v2r8();
350 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
351 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
352 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
353 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
354 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
355 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
356 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
357 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
359 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
361 /* Update potential sum for this i atom from the interaction with this j atom. */
362 velec = _fjsp_and_v2r8(velec,cutoff_mask);
363 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
364 velecsum = _fjsp_add_v2r8(velecsum,velec);
365 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
366 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
367 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
369 fscal = _fjsp_add_v2r8(felec,fvdw);
371 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
373 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
375 /* Update vectorial force */
376 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
377 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
378 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
380 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
384 /* Inner loop uses 75 flops */
387 /* End of innermost loop */
389 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
390 f+i_coord_offset,fshift+i_shift_offset);
393 /* Update potential energies */
394 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
395 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
397 /* Increment number of inner iterations */
398 inneriter += j_index_end - j_index_start;
400 /* Outer loop uses 9 flops */
403 /* Increment number of outer iterations */
406 /* Update outer/inner flops */
408 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*75);
411 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
412 * Electrostatics interaction: ReactionField
413 * VdW interaction: CubicSplineTable
414 * Geometry: Particle-Particle
415 * Calculate force/pot: Force
418 nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
419 (t_nblist * gmx_restrict nlist,
420 rvec * gmx_restrict xx,
421 rvec * gmx_restrict ff,
422 t_forcerec * gmx_restrict fr,
423 t_mdatoms * gmx_restrict mdatoms,
424 nb_kernel_data_t * gmx_restrict kernel_data,
425 t_nrnb * gmx_restrict nrnb)
427 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
428 * just 0 for non-waters.
429 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
430 * jnr indices corresponding to data put in the four positions in the SIMD register.
432 int i_shift_offset,i_coord_offset,outeriter,inneriter;
433 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
435 int j_coord_offsetA,j_coord_offsetB;
436 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
438 real *shiftvec,*fshift,*x,*f;
439 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
441 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
442 int vdwjidx0A,vdwjidx0B;
443 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
444 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
445 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
448 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
451 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
452 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
453 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
456 _fjsp_v2r8 dummy_mask,cutoff_mask;
457 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
458 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
459 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
466 jindex = nlist->jindex;
468 shiftidx = nlist->shift;
470 shiftvec = fr->shift_vec[0];
471 fshift = fr->fshift[0];
472 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
473 charge = mdatoms->chargeA;
474 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
475 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
476 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
477 nvdwtype = fr->ntype;
479 vdwtype = mdatoms->typeA;
481 vftab = kernel_data->table_vdw->data;
482 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
484 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
485 rcutoff_scalar = fr->rcoulomb;
486 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
487 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
489 /* Avoid stupid compiler warnings */
497 /* Start outer loop over neighborlists */
498 for(iidx=0; iidx<nri; iidx++)
500 /* Load shift vector for this list */
501 i_shift_offset = DIM*shiftidx[iidx];
503 /* Load limits for loop over neighbors */
504 j_index_start = jindex[iidx];
505 j_index_end = jindex[iidx+1];
507 /* Get outer coordinate index */
509 i_coord_offset = DIM*inr;
511 /* Load i particle coords and add shift vector */
512 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
514 fix0 = _fjsp_setzero_v2r8();
515 fiy0 = _fjsp_setzero_v2r8();
516 fiz0 = _fjsp_setzero_v2r8();
518 /* Load parameters for i particles */
519 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
520 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
522 /* Start inner kernel loop */
523 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
526 /* Get j neighbor index, and coordinate index */
529 j_coord_offsetA = DIM*jnrA;
530 j_coord_offsetB = DIM*jnrB;
532 /* load j atom coordinates */
533 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
536 /* Calculate displacement vector */
537 dx00 = _fjsp_sub_v2r8(ix0,jx0);
538 dy00 = _fjsp_sub_v2r8(iy0,jy0);
539 dz00 = _fjsp_sub_v2r8(iz0,jz0);
541 /* Calculate squared distance and things based on it */
542 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
544 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
546 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
548 /* Load parameters for j particles */
549 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
550 vdwjidx0A = 2*vdwtype[jnrA+0];
551 vdwjidx0B = 2*vdwtype[jnrB+0];
553 /**************************
554 * CALCULATE INTERACTIONS *
555 **************************/
557 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
560 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
562 /* Compute parameters for interactions between i and j atoms */
563 qq00 = _fjsp_mul_v2r8(iq0,jq0);
564 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
565 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
567 /* Calculate table index by multiplying r with table scale and truncate to integer */
568 rt = _fjsp_mul_v2r8(r00,vftabscale);
569 itab_tmp = _fjsp_dtox_v2r8(rt);
570 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
571 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
572 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
577 /* REACTION-FIELD ELECTROSTATICS */
578 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
580 /* CUBIC SPLINE TABLE DISPERSION */
581 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
582 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
583 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
584 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
585 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
586 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
587 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
588 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
589 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
591 /* CUBIC SPLINE TABLE REPULSION */
592 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
593 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
594 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
595 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
596 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
597 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
598 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
599 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
600 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
601 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
603 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
605 fscal = _fjsp_add_v2r8(felec,fvdw);
607 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
609 /* Update vectorial force */
610 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
611 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
612 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
614 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
618 /* Inner loop uses 60 flops */
625 j_coord_offsetA = DIM*jnrA;
627 /* load j atom coordinates */
628 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
631 /* Calculate displacement vector */
632 dx00 = _fjsp_sub_v2r8(ix0,jx0);
633 dy00 = _fjsp_sub_v2r8(iy0,jy0);
634 dz00 = _fjsp_sub_v2r8(iz0,jz0);
636 /* Calculate squared distance and things based on it */
637 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
639 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
641 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
643 /* Load parameters for j particles */
644 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
645 vdwjidx0A = 2*vdwtype[jnrA+0];
647 /**************************
648 * CALCULATE INTERACTIONS *
649 **************************/
651 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
654 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
656 /* Compute parameters for interactions between i and j atoms */
657 qq00 = _fjsp_mul_v2r8(iq0,jq0);
658 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&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);