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_ElecRF_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_ElecRF_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;
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 /* Avoid stupid compiler warnings */
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
136 /* Load shift vector for this list */
137 i_shift_offset = DIM*shiftidx[iidx];
139 /* Load limits for loop over neighbors */
140 j_index_start = jindex[iidx];
141 j_index_end = jindex[iidx+1];
143 /* Get outer coordinate index */
145 i_coord_offset = DIM*inr;
147 /* Load i particle coords and add shift vector */
148 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
150 fix0 = _fjsp_setzero_v2r8();
151 fiy0 = _fjsp_setzero_v2r8();
152 fiz0 = _fjsp_setzero_v2r8();
154 /* Load parameters for i particles */
155 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
156 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
158 /* Reset potential sums */
159 velecsum = _fjsp_setzero_v2r8();
160 vvdwsum = _fjsp_setzero_v2r8();
162 /* Start inner kernel loop */
163 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
166 /* Get j neighbor index, and coordinate index */
169 j_coord_offsetA = DIM*jnrA;
170 j_coord_offsetB = DIM*jnrB;
172 /* load j atom coordinates */
173 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
176 /* Calculate displacement vector */
177 dx00 = _fjsp_sub_v2r8(ix0,jx0);
178 dy00 = _fjsp_sub_v2r8(iy0,jy0);
179 dz00 = _fjsp_sub_v2r8(iz0,jz0);
181 /* Calculate squared distance and things based on it */
182 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
184 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
186 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
188 /* Load parameters for j particles */
189 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
190 vdwjidx0A = 2*vdwtype[jnrA+0];
191 vdwjidx0B = 2*vdwtype[jnrB+0];
193 /**************************
194 * CALCULATE INTERACTIONS *
195 **************************/
197 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
199 /* Compute parameters for interactions between i and j atoms */
200 qq00 = _fjsp_mul_v2r8(iq0,jq0);
201 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
202 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
204 /* Calculate table index by multiplying r with table scale and truncate to integer */
205 rt = _fjsp_mul_v2r8(r00,vftabscale);
206 itab_tmp = _fjsp_dtox_v2r8(rt);
207 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
208 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
209 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
214 /* REACTION-FIELD ELECTROSTATICS */
215 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
216 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
218 /* CUBIC SPLINE TABLE DISPERSION */
219 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
220 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
221 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
222 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
223 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
224 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
225 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
226 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
227 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
228 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
229 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
231 /* CUBIC SPLINE TABLE REPULSION */
232 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
233 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
234 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
235 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
236 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
237 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
238 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
239 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
240 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
241 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
242 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
243 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
244 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
246 /* Update potential sum for this i atom from the interaction with this j atom. */
247 velecsum = _fjsp_add_v2r8(velecsum,velec);
248 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
250 fscal = _fjsp_add_v2r8(felec,fvdw);
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);
259 /* Inner loop uses 70 flops */
266 j_coord_offsetA = DIM*jnrA;
268 /* load j atom coordinates */
269 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
272 /* Calculate displacement vector */
273 dx00 = _fjsp_sub_v2r8(ix0,jx0);
274 dy00 = _fjsp_sub_v2r8(iy0,jy0);
275 dz00 = _fjsp_sub_v2r8(iz0,jz0);
277 /* Calculate squared distance and things based on it */
278 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
280 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
282 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
284 /* Load parameters for j particles */
285 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
286 vdwjidx0A = 2*vdwtype[jnrA+0];
288 /**************************
289 * CALCULATE INTERACTIONS *
290 **************************/
292 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
294 /* Compute parameters for interactions between i and j atoms */
295 qq00 = _fjsp_mul_v2r8(iq0,jq0);
296 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
297 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
299 /* Calculate table index by multiplying r with table scale and truncate to integer */
300 rt = _fjsp_mul_v2r8(r00,vftabscale);
301 itab_tmp = _fjsp_dtox_v2r8(rt);
302 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
303 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
304 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
309 /* REACTION-FIELD ELECTROSTATICS */
310 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
311 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
313 /* CUBIC SPLINE TABLE DISPERSION */
314 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
315 F = _fjsp_setzero_v2r8();
316 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
317 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
318 H = _fjsp_setzero_v2r8();
319 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
320 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
321 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
322 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
323 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
324 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
326 /* CUBIC SPLINE TABLE REPULSION */
327 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
328 F = _fjsp_setzero_v2r8();
329 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
330 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
331 H = _fjsp_setzero_v2r8();
332 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
333 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
334 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
335 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
336 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
337 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
338 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
339 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
341 /* Update potential sum for this i atom from the interaction with this j atom. */
342 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
343 velecsum = _fjsp_add_v2r8(velecsum,velec);
344 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
345 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
347 fscal = _fjsp_add_v2r8(felec,fvdw);
349 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
351 /* Update vectorial force */
352 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
353 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
354 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
356 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
358 /* Inner loop uses 70 flops */
361 /* End of innermost loop */
363 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
364 f+i_coord_offset,fshift+i_shift_offset);
367 /* Update potential energies */
368 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
369 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
371 /* Increment number of inner iterations */
372 inneriter += j_index_end - j_index_start;
374 /* Outer loop uses 9 flops */
377 /* Increment number of outer iterations */
380 /* Update outer/inner flops */
382 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*70);
385 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
386 * Electrostatics interaction: ReactionField
387 * VdW interaction: CubicSplineTable
388 * Geometry: Particle-Particle
389 * Calculate force/pot: Force
392 nb_kernel_ElecRF_VdwCSTab_GeomP1P1_F_sparc64_hpc_ace_double
393 (t_nblist * gmx_restrict nlist,
394 rvec * gmx_restrict xx,
395 rvec * gmx_restrict ff,
396 t_forcerec * gmx_restrict fr,
397 t_mdatoms * gmx_restrict mdatoms,
398 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
399 t_nrnb * gmx_restrict nrnb)
401 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
402 * just 0 for non-waters.
403 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
404 * jnr indices corresponding to data put in the four positions in the SIMD register.
406 int i_shift_offset,i_coord_offset,outeriter,inneriter;
407 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
409 int j_coord_offsetA,j_coord_offsetB;
410 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
412 real *shiftvec,*fshift,*x,*f;
413 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
415 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
416 int vdwjidx0A,vdwjidx0B;
417 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
418 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
419 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
422 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
425 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
426 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
427 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
430 _fjsp_v2r8 dummy_mask,cutoff_mask;
431 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
432 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
433 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
440 jindex = nlist->jindex;
442 shiftidx = nlist->shift;
444 shiftvec = fr->shift_vec[0];
445 fshift = fr->fshift[0];
446 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
447 charge = mdatoms->chargeA;
448 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
449 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
450 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
451 nvdwtype = fr->ntype;
453 vdwtype = mdatoms->typeA;
455 vftab = kernel_data->table_vdw->data;
456 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
458 /* Avoid stupid compiler warnings */
466 /* Start outer loop over neighborlists */
467 for(iidx=0; iidx<nri; iidx++)
469 /* Load shift vector for this list */
470 i_shift_offset = DIM*shiftidx[iidx];
472 /* Load limits for loop over neighbors */
473 j_index_start = jindex[iidx];
474 j_index_end = jindex[iidx+1];
476 /* Get outer coordinate index */
478 i_coord_offset = DIM*inr;
480 /* Load i particle coords and add shift vector */
481 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
483 fix0 = _fjsp_setzero_v2r8();
484 fiy0 = _fjsp_setzero_v2r8();
485 fiz0 = _fjsp_setzero_v2r8();
487 /* Load parameters for i particles */
488 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
489 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
491 /* Start inner kernel loop */
492 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
495 /* Get j neighbor index, and coordinate index */
498 j_coord_offsetA = DIM*jnrA;
499 j_coord_offsetB = DIM*jnrB;
501 /* load j atom coordinates */
502 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
505 /* Calculate displacement vector */
506 dx00 = _fjsp_sub_v2r8(ix0,jx0);
507 dy00 = _fjsp_sub_v2r8(iy0,jy0);
508 dz00 = _fjsp_sub_v2r8(iz0,jz0);
510 /* Calculate squared distance and things based on it */
511 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
513 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
515 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
517 /* Load parameters for j particles */
518 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
519 vdwjidx0A = 2*vdwtype[jnrA+0];
520 vdwjidx0B = 2*vdwtype[jnrB+0];
522 /**************************
523 * CALCULATE INTERACTIONS *
524 **************************/
526 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
528 /* Compute parameters for interactions between i and j atoms */
529 qq00 = _fjsp_mul_v2r8(iq0,jq0);
530 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
531 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
533 /* Calculate table index by multiplying r with table scale and truncate to integer */
534 rt = _fjsp_mul_v2r8(r00,vftabscale);
535 itab_tmp = _fjsp_dtox_v2r8(rt);
536 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
537 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
538 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
543 /* REACTION-FIELD ELECTROSTATICS */
544 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
546 /* CUBIC SPLINE TABLE DISPERSION */
547 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
548 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
549 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
550 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
551 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
552 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
553 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
554 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
555 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
557 /* CUBIC SPLINE TABLE REPULSION */
558 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
559 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
560 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
561 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
562 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
563 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
564 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
565 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
566 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
567 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
569 fscal = _fjsp_add_v2r8(felec,fvdw);
571 /* Update vectorial force */
572 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
573 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
574 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
576 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
578 /* Inner loop uses 57 flops */
585 j_coord_offsetA = DIM*jnrA;
587 /* load j atom coordinates */
588 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
591 /* Calculate displacement vector */
592 dx00 = _fjsp_sub_v2r8(ix0,jx0);
593 dy00 = _fjsp_sub_v2r8(iy0,jy0);
594 dz00 = _fjsp_sub_v2r8(iz0,jz0);
596 /* Calculate squared distance and things based on it */
597 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
599 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
601 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
603 /* Load parameters for j particles */
604 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
605 vdwjidx0A = 2*vdwtype[jnrA+0];
607 /**************************
608 * CALCULATE INTERACTIONS *
609 **************************/
611 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
613 /* Compute parameters for interactions between i and j atoms */
614 qq00 = _fjsp_mul_v2r8(iq0,jq0);
615 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
616 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
618 /* Calculate table index by multiplying r with table scale and truncate to integer */
619 rt = _fjsp_mul_v2r8(r00,vftabscale);
620 itab_tmp = _fjsp_dtox_v2r8(rt);
621 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
622 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
623 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
628 /* REACTION-FIELD ELECTROSTATICS */
629 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
631 /* CUBIC SPLINE TABLE DISPERSION */
632 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
633 F = _fjsp_setzero_v2r8();
634 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
635 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
636 H = _fjsp_setzero_v2r8();
637 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
638 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
639 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
640 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
642 /* CUBIC SPLINE TABLE REPULSION */
643 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
644 F = _fjsp_setzero_v2r8();
645 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
646 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
647 H = _fjsp_setzero_v2r8();
648 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
649 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
650 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
651 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
652 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
654 fscal = _fjsp_add_v2r8(felec,fvdw);
656 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
658 /* Update vectorial force */
659 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
660 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
661 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
663 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
665 /* Inner loop uses 57 flops */
668 /* End of innermost loop */
670 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
671 f+i_coord_offset,fshift+i_shift_offset);
673 /* Increment number of inner iterations */
674 inneriter += j_index_end - j_index_start;
676 /* Outer loop uses 7 flops */
679 /* Increment number of outer iterations */
682 /* Update outer/inner flops */
684 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*57);