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.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: LennardJones
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSh_VdwLJSh_GeomP1P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 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 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
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->epsfac);
112 charge = mdatoms->chargeA;
113 nvdwtype = fr->ntype;
115 vdwtype = mdatoms->typeA;
117 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
118 ewtab = fr->ic->tabq_coul_FDV0;
119 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
120 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
122 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
123 rcutoff_scalar = fr->rcoulomb;
124 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
125 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
127 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
128 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
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 /* EWALD ELECTROSTATICS */
214 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
215 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
216 itab_tmp = _fjsp_dtox_v2r8(ewrt);
217 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
218 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
220 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
221 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
222 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
223 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
224 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
225 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
226 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
227 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
228 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv00,sh_ewald),velec));
229 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
231 /* LENNARD-JONES DISPERSION/REPULSION */
233 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
234 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
235 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
236 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
237 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
238 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
240 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
242 /* Update potential sum for this i atom from the interaction with this j atom. */
243 velec = _fjsp_and_v2r8(velec,cutoff_mask);
244 velecsum = _fjsp_add_v2r8(velecsum,velec);
245 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
246 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
248 fscal = _fjsp_add_v2r8(felec,fvdw);
250 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
252 /* Update vectorial force */
253 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
254 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
255 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
257 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
261 /* Inner loop uses 67 flops */
268 j_coord_offsetA = DIM*jnrA;
270 /* load j atom coordinates */
271 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
274 /* Calculate displacement vector */
275 dx00 = _fjsp_sub_v2r8(ix0,jx0);
276 dy00 = _fjsp_sub_v2r8(iy0,jy0);
277 dz00 = _fjsp_sub_v2r8(iz0,jz0);
279 /* Calculate squared distance and things based on it */
280 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
282 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
284 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
286 /* Load parameters for j particles */
287 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
288 vdwjidx0A = 2*vdwtype[jnrA+0];
290 /**************************
291 * CALCULATE INTERACTIONS *
292 **************************/
294 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
297 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
299 /* Compute parameters for interactions between i and j atoms */
300 qq00 = _fjsp_mul_v2r8(iq0,jq0);
301 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
303 /* EWALD ELECTROSTATICS */
305 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
306 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
307 itab_tmp = _fjsp_dtox_v2r8(ewrt);
308 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
309 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
311 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
312 ewtabD = _fjsp_setzero_v2r8();
313 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
314 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
315 ewtabFn = _fjsp_setzero_v2r8();
316 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
317 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
318 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
319 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv00,sh_ewald),velec));
320 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
322 /* LENNARD-JONES DISPERSION/REPULSION */
324 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
325 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
326 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
327 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
328 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
329 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
331 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
333 /* Update potential sum for this i atom from the interaction with this j atom. */
334 velec = _fjsp_and_v2r8(velec,cutoff_mask);
335 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
336 velecsum = _fjsp_add_v2r8(velecsum,velec);
337 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
338 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
339 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
341 fscal = _fjsp_add_v2r8(felec,fvdw);
343 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
345 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
347 /* Update vectorial force */
348 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
349 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
350 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
352 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
356 /* Inner loop uses 67 flops */
359 /* End of innermost loop */
361 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
362 f+i_coord_offset,fshift+i_shift_offset);
365 /* Update potential energies */
366 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
367 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
369 /* Increment number of inner iterations */
370 inneriter += j_index_end - j_index_start;
372 /* Outer loop uses 9 flops */
375 /* Increment number of outer iterations */
378 /* Update outer/inner flops */
380 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*67);
383 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomP1P1_F_sparc64_hpc_ace_double
384 * Electrostatics interaction: Ewald
385 * VdW interaction: LennardJones
386 * Geometry: Particle-Particle
387 * Calculate force/pot: Force
390 nb_kernel_ElecEwSh_VdwLJSh_GeomP1P1_F_sparc64_hpc_ace_double
391 (t_nblist * gmx_restrict nlist,
392 rvec * gmx_restrict xx,
393 rvec * gmx_restrict ff,
394 t_forcerec * gmx_restrict fr,
395 t_mdatoms * gmx_restrict mdatoms,
396 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
397 t_nrnb * gmx_restrict nrnb)
399 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
400 * just 0 for non-waters.
401 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
402 * jnr indices corresponding to data put in the four positions in the SIMD register.
404 int i_shift_offset,i_coord_offset,outeriter,inneriter;
405 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
407 int j_coord_offsetA,j_coord_offsetB;
408 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
410 real *shiftvec,*fshift,*x,*f;
411 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
413 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
414 int vdwjidx0A,vdwjidx0B;
415 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
416 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
417 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
420 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
423 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
424 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
425 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
428 _fjsp_v2r8 dummy_mask,cutoff_mask;
429 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
430 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
431 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
438 jindex = nlist->jindex;
440 shiftidx = nlist->shift;
442 shiftvec = fr->shift_vec[0];
443 fshift = fr->fshift[0];
444 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
445 charge = mdatoms->chargeA;
446 nvdwtype = fr->ntype;
448 vdwtype = mdatoms->typeA;
450 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
451 ewtab = fr->ic->tabq_coul_F;
452 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
453 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
455 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
456 rcutoff_scalar = fr->rcoulomb;
457 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
458 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
460 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
461 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
463 /* Avoid stupid compiler warnings */
471 /* Start outer loop over neighborlists */
472 for(iidx=0; iidx<nri; iidx++)
474 /* Load shift vector for this list */
475 i_shift_offset = DIM*shiftidx[iidx];
477 /* Load limits for loop over neighbors */
478 j_index_start = jindex[iidx];
479 j_index_end = jindex[iidx+1];
481 /* Get outer coordinate index */
483 i_coord_offset = DIM*inr;
485 /* Load i particle coords and add shift vector */
486 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
488 fix0 = _fjsp_setzero_v2r8();
489 fiy0 = _fjsp_setzero_v2r8();
490 fiz0 = _fjsp_setzero_v2r8();
492 /* Load parameters for i particles */
493 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
494 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
496 /* Start inner kernel loop */
497 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
500 /* Get j neighbor index, and coordinate index */
503 j_coord_offsetA = DIM*jnrA;
504 j_coord_offsetB = DIM*jnrB;
506 /* load j atom coordinates */
507 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
510 /* Calculate displacement vector */
511 dx00 = _fjsp_sub_v2r8(ix0,jx0);
512 dy00 = _fjsp_sub_v2r8(iy0,jy0);
513 dz00 = _fjsp_sub_v2r8(iz0,jz0);
515 /* Calculate squared distance and things based on it */
516 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
518 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
520 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
522 /* Load parameters for j particles */
523 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
524 vdwjidx0A = 2*vdwtype[jnrA+0];
525 vdwjidx0B = 2*vdwtype[jnrB+0];
527 /**************************
528 * CALCULATE INTERACTIONS *
529 **************************/
531 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
534 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
536 /* Compute parameters for interactions between i and j atoms */
537 qq00 = _fjsp_mul_v2r8(iq0,jq0);
538 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
539 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
541 /* EWALD ELECTROSTATICS */
543 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
544 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
545 itab_tmp = _fjsp_dtox_v2r8(ewrt);
546 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
547 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
549 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
551 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
552 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
554 /* LENNARD-JONES DISPERSION/REPULSION */
556 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
557 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
559 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
561 fscal = _fjsp_add_v2r8(felec,fvdw);
563 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
565 /* Update vectorial force */
566 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
567 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
568 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
570 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
574 /* Inner loop uses 49 flops */
581 j_coord_offsetA = DIM*jnrA;
583 /* load j atom coordinates */
584 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
587 /* Calculate displacement vector */
588 dx00 = _fjsp_sub_v2r8(ix0,jx0);
589 dy00 = _fjsp_sub_v2r8(iy0,jy0);
590 dz00 = _fjsp_sub_v2r8(iz0,jz0);
592 /* Calculate squared distance and things based on it */
593 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
595 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
597 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
599 /* Load parameters for j particles */
600 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
601 vdwjidx0A = 2*vdwtype[jnrA+0];
603 /**************************
604 * CALCULATE INTERACTIONS *
605 **************************/
607 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
610 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
612 /* Compute parameters for interactions between i and j atoms */
613 qq00 = _fjsp_mul_v2r8(iq0,jq0);
614 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
616 /* EWALD ELECTROSTATICS */
618 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
619 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
620 itab_tmp = _fjsp_dtox_v2r8(ewrt);
621 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
622 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
624 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
625 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
626 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
628 /* LENNARD-JONES DISPERSION/REPULSION */
630 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
631 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
633 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
635 fscal = _fjsp_add_v2r8(felec,fvdw);
637 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
639 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
641 /* Update vectorial force */
642 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
643 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
644 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
646 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
650 /* Inner loop uses 49 flops */
653 /* End of innermost loop */
655 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
656 f+i_coord_offset,fshift+i_shift_offset);
658 /* Increment number of inner iterations */
659 inneriter += j_index_end - j_index_start;
661 /* Outer loop uses 7 flops */
664 /* Increment number of outer iterations */
667 /* Update outer/inner flops */
669 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*49);