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_ElecEw_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_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;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
103 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 nvdwtype = fr->ntype;
126 vdwtype = mdatoms->typeA;
128 vftab = kernel_data->table_vdw->data;
129 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
131 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
132 ewtab = fr->ic->tabq_coul_FDV0;
133 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
134 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
136 /* Setup water-specific parameters */
137 inr = nlist->iinr[0];
138 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
139 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
140 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
141 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
143 /* Avoid stupid compiler warnings */
151 /* Start outer loop over neighborlists */
152 for(iidx=0; iidx<nri; iidx++)
154 /* Load shift vector for this list */
155 i_shift_offset = DIM*shiftidx[iidx];
157 /* Load limits for loop over neighbors */
158 j_index_start = jindex[iidx];
159 j_index_end = jindex[iidx+1];
161 /* Get outer coordinate index */
163 i_coord_offset = DIM*inr;
165 /* Load i particle coords and add shift vector */
166 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
167 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
169 fix0 = _fjsp_setzero_v2r8();
170 fiy0 = _fjsp_setzero_v2r8();
171 fiz0 = _fjsp_setzero_v2r8();
172 fix1 = _fjsp_setzero_v2r8();
173 fiy1 = _fjsp_setzero_v2r8();
174 fiz1 = _fjsp_setzero_v2r8();
175 fix2 = _fjsp_setzero_v2r8();
176 fiy2 = _fjsp_setzero_v2r8();
177 fiz2 = _fjsp_setzero_v2r8();
178 fix3 = _fjsp_setzero_v2r8();
179 fiy3 = _fjsp_setzero_v2r8();
180 fiz3 = _fjsp_setzero_v2r8();
182 /* Reset potential sums */
183 velecsum = _fjsp_setzero_v2r8();
184 vvdwsum = _fjsp_setzero_v2r8();
186 /* Start inner kernel loop */
187 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
190 /* Get j neighbor index, and coordinate index */
193 j_coord_offsetA = DIM*jnrA;
194 j_coord_offsetB = DIM*jnrB;
196 /* load j atom coordinates */
197 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
200 /* Calculate displacement vector */
201 dx00 = _fjsp_sub_v2r8(ix0,jx0);
202 dy00 = _fjsp_sub_v2r8(iy0,jy0);
203 dz00 = _fjsp_sub_v2r8(iz0,jz0);
204 dx10 = _fjsp_sub_v2r8(ix1,jx0);
205 dy10 = _fjsp_sub_v2r8(iy1,jy0);
206 dz10 = _fjsp_sub_v2r8(iz1,jz0);
207 dx20 = _fjsp_sub_v2r8(ix2,jx0);
208 dy20 = _fjsp_sub_v2r8(iy2,jy0);
209 dz20 = _fjsp_sub_v2r8(iz2,jz0);
210 dx30 = _fjsp_sub_v2r8(ix3,jx0);
211 dy30 = _fjsp_sub_v2r8(iy3,jy0);
212 dz30 = _fjsp_sub_v2r8(iz3,jz0);
214 /* Calculate squared distance and things based on it */
215 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
216 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
217 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
218 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
220 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
221 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
222 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
223 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
225 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
226 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
227 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
229 /* Load parameters for j particles */
230 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
231 vdwjidx0A = 2*vdwtype[jnrA+0];
232 vdwjidx0B = 2*vdwtype[jnrB+0];
234 fjx0 = _fjsp_setzero_v2r8();
235 fjy0 = _fjsp_setzero_v2r8();
236 fjz0 = _fjsp_setzero_v2r8();
238 /**************************
239 * CALCULATE INTERACTIONS *
240 **************************/
242 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
244 /* Compute parameters for interactions between i and j atoms */
245 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
246 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
248 /* Calculate table index by multiplying r with table scale and truncate to integer */
249 rt = _fjsp_mul_v2r8(r00,vftabscale);
250 itab_tmp = _fjsp_dtox_v2r8(rt);
251 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
252 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
253 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
258 /* CUBIC SPLINE TABLE DISPERSION */
259 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
260 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
261 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
262 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
263 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
264 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
265 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
266 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
267 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
268 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
269 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
271 /* CUBIC SPLINE TABLE REPULSION */
272 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
273 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
274 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
275 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
276 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
277 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
278 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
279 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
280 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
281 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
282 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
283 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
284 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
286 /* Update potential sum for this i atom from the interaction with this j atom. */
287 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
291 /* Update vectorial force */
292 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
293 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
294 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
296 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
297 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
298 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
300 /**************************
301 * CALCULATE INTERACTIONS *
302 **************************/
304 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
306 /* Compute parameters for interactions between i and j atoms */
307 qq10 = _fjsp_mul_v2r8(iq1,jq0);
309 /* EWALD ELECTROSTATICS */
311 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
312 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
313 itab_tmp = _fjsp_dtox_v2r8(ewrt);
314 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
315 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
317 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
318 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
319 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
320 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
321 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
322 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
323 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
324 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
325 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
326 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
328 /* Update potential sum for this i atom from the interaction with this j atom. */
329 velecsum = _fjsp_add_v2r8(velecsum,velec);
333 /* Update vectorial force */
334 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
335 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
336 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
338 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
339 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
340 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
346 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
348 /* Compute parameters for interactions between i and j atoms */
349 qq20 = _fjsp_mul_v2r8(iq2,jq0);
351 /* EWALD ELECTROSTATICS */
353 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
354 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
355 itab_tmp = _fjsp_dtox_v2r8(ewrt);
356 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
357 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
359 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
360 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
361 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
362 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
363 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
364 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
365 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
366 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
367 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
368 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
370 /* Update potential sum for this i atom from the interaction with this j atom. */
371 velecsum = _fjsp_add_v2r8(velecsum,velec);
375 /* Update vectorial force */
376 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
377 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
378 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
380 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
381 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
382 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
384 /**************************
385 * CALCULATE INTERACTIONS *
386 **************************/
388 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
390 /* Compute parameters for interactions between i and j atoms */
391 qq30 = _fjsp_mul_v2r8(iq3,jq0);
393 /* EWALD ELECTROSTATICS */
395 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
396 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
397 itab_tmp = _fjsp_dtox_v2r8(ewrt);
398 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
399 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
401 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
402 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
403 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
404 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
405 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
406 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
407 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
408 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
409 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
410 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
412 /* Update potential sum for this i atom from the interaction with this j atom. */
413 velecsum = _fjsp_add_v2r8(velecsum,velec);
417 /* Update vectorial force */
418 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
419 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
420 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
422 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
423 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
424 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
426 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
428 /* Inner loop uses 194 flops */
435 j_coord_offsetA = DIM*jnrA;
437 /* load j atom coordinates */
438 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
441 /* Calculate displacement vector */
442 dx00 = _fjsp_sub_v2r8(ix0,jx0);
443 dy00 = _fjsp_sub_v2r8(iy0,jy0);
444 dz00 = _fjsp_sub_v2r8(iz0,jz0);
445 dx10 = _fjsp_sub_v2r8(ix1,jx0);
446 dy10 = _fjsp_sub_v2r8(iy1,jy0);
447 dz10 = _fjsp_sub_v2r8(iz1,jz0);
448 dx20 = _fjsp_sub_v2r8(ix2,jx0);
449 dy20 = _fjsp_sub_v2r8(iy2,jy0);
450 dz20 = _fjsp_sub_v2r8(iz2,jz0);
451 dx30 = _fjsp_sub_v2r8(ix3,jx0);
452 dy30 = _fjsp_sub_v2r8(iy3,jy0);
453 dz30 = _fjsp_sub_v2r8(iz3,jz0);
455 /* Calculate squared distance and things based on it */
456 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
457 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
458 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
459 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
461 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
462 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
463 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
464 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
466 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
467 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
468 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
470 /* Load parameters for j particles */
471 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
472 vdwjidx0A = 2*vdwtype[jnrA+0];
474 fjx0 = _fjsp_setzero_v2r8();
475 fjy0 = _fjsp_setzero_v2r8();
476 fjz0 = _fjsp_setzero_v2r8();
478 /**************************
479 * CALCULATE INTERACTIONS *
480 **************************/
482 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
484 /* Compute parameters for interactions between i and j atoms */
485 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
487 /* Calculate table index by multiplying r with table scale and truncate to integer */
488 rt = _fjsp_mul_v2r8(r00,vftabscale);
489 itab_tmp = _fjsp_dtox_v2r8(rt);
490 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
491 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
492 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
497 /* CUBIC SPLINE TABLE DISPERSION */
498 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
499 F = _fjsp_setzero_v2r8();
500 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
501 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
502 H = _fjsp_setzero_v2r8();
503 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
504 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
505 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
506 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
507 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
508 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
510 /* CUBIC SPLINE TABLE REPULSION */
511 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
512 F = _fjsp_setzero_v2r8();
513 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
514 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
515 H = _fjsp_setzero_v2r8();
516 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
517 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
518 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
519 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
520 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
521 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
522 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
523 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
525 /* Update potential sum for this i atom from the interaction with this j atom. */
526 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
527 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
531 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
533 /* Update vectorial force */
534 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
535 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
536 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
538 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
539 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
540 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
542 /**************************
543 * CALCULATE INTERACTIONS *
544 **************************/
546 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
548 /* Compute parameters for interactions between i and j atoms */
549 qq10 = _fjsp_mul_v2r8(iq1,jq0);
551 /* EWALD ELECTROSTATICS */
553 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
554 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
555 itab_tmp = _fjsp_dtox_v2r8(ewrt);
556 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
557 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
559 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
560 ewtabD = _fjsp_setzero_v2r8();
561 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
562 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
563 ewtabFn = _fjsp_setzero_v2r8();
564 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
565 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
566 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
567 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
568 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
570 /* Update potential sum for this i atom from the interaction with this j atom. */
571 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
572 velecsum = _fjsp_add_v2r8(velecsum,velec);
576 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
578 /* Update vectorial force */
579 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
580 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
581 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
583 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
584 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
585 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
587 /**************************
588 * CALCULATE INTERACTIONS *
589 **************************/
591 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
593 /* Compute parameters for interactions between i and j atoms */
594 qq20 = _fjsp_mul_v2r8(iq2,jq0);
596 /* EWALD ELECTROSTATICS */
598 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
599 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
600 itab_tmp = _fjsp_dtox_v2r8(ewrt);
601 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
602 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
604 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
605 ewtabD = _fjsp_setzero_v2r8();
606 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
607 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
608 ewtabFn = _fjsp_setzero_v2r8();
609 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
610 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
611 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
612 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
613 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
615 /* Update potential sum for this i atom from the interaction with this j atom. */
616 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
617 velecsum = _fjsp_add_v2r8(velecsum,velec);
621 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
623 /* Update vectorial force */
624 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
625 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
626 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
628 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
629 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
630 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
632 /**************************
633 * CALCULATE INTERACTIONS *
634 **************************/
636 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
638 /* Compute parameters for interactions between i and j atoms */
639 qq30 = _fjsp_mul_v2r8(iq3,jq0);
641 /* EWALD ELECTROSTATICS */
643 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
644 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
645 itab_tmp = _fjsp_dtox_v2r8(ewrt);
646 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
647 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
649 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
650 ewtabD = _fjsp_setzero_v2r8();
651 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
652 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
653 ewtabFn = _fjsp_setzero_v2r8();
654 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
655 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
656 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
657 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
658 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
660 /* Update potential sum for this i atom from the interaction with this j atom. */
661 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
662 velecsum = _fjsp_add_v2r8(velecsum,velec);
666 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
668 /* Update vectorial force */
669 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
670 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
671 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
673 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
674 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
675 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
677 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
679 /* Inner loop uses 194 flops */
682 /* End of innermost loop */
684 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
685 f+i_coord_offset,fshift+i_shift_offset);
688 /* Update potential energies */
689 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
690 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
692 /* Increment number of inner iterations */
693 inneriter += j_index_end - j_index_start;
695 /* Outer loop uses 26 flops */
698 /* Increment number of outer iterations */
701 /* Update outer/inner flops */
703 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*194);
706 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
707 * Electrostatics interaction: Ewald
708 * VdW interaction: CubicSplineTable
709 * Geometry: Water4-Particle
710 * Calculate force/pot: Force
713 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
714 (t_nblist * gmx_restrict nlist,
715 rvec * gmx_restrict xx,
716 rvec * gmx_restrict ff,
717 t_forcerec * gmx_restrict fr,
718 t_mdatoms * gmx_restrict mdatoms,
719 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
720 t_nrnb * gmx_restrict nrnb)
722 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
723 * just 0 for non-waters.
724 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
725 * jnr indices corresponding to data put in the four positions in the SIMD register.
727 int i_shift_offset,i_coord_offset,outeriter,inneriter;
728 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
730 int j_coord_offsetA,j_coord_offsetB;
731 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
733 real *shiftvec,*fshift,*x,*f;
734 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
736 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
738 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
740 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
742 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
743 int vdwjidx0A,vdwjidx0B;
744 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
745 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
746 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
747 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
748 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
749 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
752 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
755 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
756 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
757 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
759 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
762 _fjsp_v2r8 dummy_mask,cutoff_mask;
763 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
764 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
765 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
772 jindex = nlist->jindex;
774 shiftidx = nlist->shift;
776 shiftvec = fr->shift_vec[0];
777 fshift = fr->fshift[0];
778 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
779 charge = mdatoms->chargeA;
780 nvdwtype = fr->ntype;
782 vdwtype = mdatoms->typeA;
784 vftab = kernel_data->table_vdw->data;
785 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
787 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
788 ewtab = fr->ic->tabq_coul_F;
789 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
790 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
792 /* Setup water-specific parameters */
793 inr = nlist->iinr[0];
794 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
795 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
796 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
797 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
799 /* Avoid stupid compiler warnings */
807 /* Start outer loop over neighborlists */
808 for(iidx=0; iidx<nri; iidx++)
810 /* Load shift vector for this list */
811 i_shift_offset = DIM*shiftidx[iidx];
813 /* Load limits for loop over neighbors */
814 j_index_start = jindex[iidx];
815 j_index_end = jindex[iidx+1];
817 /* Get outer coordinate index */
819 i_coord_offset = DIM*inr;
821 /* Load i particle coords and add shift vector */
822 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
823 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
825 fix0 = _fjsp_setzero_v2r8();
826 fiy0 = _fjsp_setzero_v2r8();
827 fiz0 = _fjsp_setzero_v2r8();
828 fix1 = _fjsp_setzero_v2r8();
829 fiy1 = _fjsp_setzero_v2r8();
830 fiz1 = _fjsp_setzero_v2r8();
831 fix2 = _fjsp_setzero_v2r8();
832 fiy2 = _fjsp_setzero_v2r8();
833 fiz2 = _fjsp_setzero_v2r8();
834 fix3 = _fjsp_setzero_v2r8();
835 fiy3 = _fjsp_setzero_v2r8();
836 fiz3 = _fjsp_setzero_v2r8();
838 /* Start inner kernel loop */
839 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
842 /* Get j neighbor index, and coordinate index */
845 j_coord_offsetA = DIM*jnrA;
846 j_coord_offsetB = DIM*jnrB;
848 /* load j atom coordinates */
849 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
852 /* Calculate displacement vector */
853 dx00 = _fjsp_sub_v2r8(ix0,jx0);
854 dy00 = _fjsp_sub_v2r8(iy0,jy0);
855 dz00 = _fjsp_sub_v2r8(iz0,jz0);
856 dx10 = _fjsp_sub_v2r8(ix1,jx0);
857 dy10 = _fjsp_sub_v2r8(iy1,jy0);
858 dz10 = _fjsp_sub_v2r8(iz1,jz0);
859 dx20 = _fjsp_sub_v2r8(ix2,jx0);
860 dy20 = _fjsp_sub_v2r8(iy2,jy0);
861 dz20 = _fjsp_sub_v2r8(iz2,jz0);
862 dx30 = _fjsp_sub_v2r8(ix3,jx0);
863 dy30 = _fjsp_sub_v2r8(iy3,jy0);
864 dz30 = _fjsp_sub_v2r8(iz3,jz0);
866 /* Calculate squared distance and things based on it */
867 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
868 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
869 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
870 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
872 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
873 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
874 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
875 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
877 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
878 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
879 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
881 /* Load parameters for j particles */
882 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
883 vdwjidx0A = 2*vdwtype[jnrA+0];
884 vdwjidx0B = 2*vdwtype[jnrB+0];
886 fjx0 = _fjsp_setzero_v2r8();
887 fjy0 = _fjsp_setzero_v2r8();
888 fjz0 = _fjsp_setzero_v2r8();
890 /**************************
891 * CALCULATE INTERACTIONS *
892 **************************/
894 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
896 /* Compute parameters for interactions between i and j atoms */
897 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
898 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
900 /* Calculate table index by multiplying r with table scale and truncate to integer */
901 rt = _fjsp_mul_v2r8(r00,vftabscale);
902 itab_tmp = _fjsp_dtox_v2r8(rt);
903 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
904 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
905 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
910 /* CUBIC SPLINE TABLE DISPERSION */
911 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
912 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
913 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
914 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
915 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
916 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
917 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
918 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
919 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
921 /* CUBIC SPLINE TABLE REPULSION */
922 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
923 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
924 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
925 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
926 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
927 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
928 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
929 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
930 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
931 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
935 /* Update vectorial force */
936 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
937 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
938 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
940 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
941 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
942 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
944 /**************************
945 * CALCULATE INTERACTIONS *
946 **************************/
948 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
950 /* Compute parameters for interactions between i and j atoms */
951 qq10 = _fjsp_mul_v2r8(iq1,jq0);
953 /* EWALD ELECTROSTATICS */
955 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
956 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
957 itab_tmp = _fjsp_dtox_v2r8(ewrt);
958 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
959 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
961 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
963 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
964 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
968 /* Update vectorial force */
969 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
970 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
971 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
973 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
974 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
975 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
977 /**************************
978 * CALCULATE INTERACTIONS *
979 **************************/
981 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
983 /* Compute parameters for interactions between i and j atoms */
984 qq20 = _fjsp_mul_v2r8(iq2,jq0);
986 /* EWALD ELECTROSTATICS */
988 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
989 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
990 itab_tmp = _fjsp_dtox_v2r8(ewrt);
991 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
992 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
994 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
996 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
997 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1001 /* Update vectorial force */
1002 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1003 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1004 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1006 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1007 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1008 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1010 /**************************
1011 * CALCULATE INTERACTIONS *
1012 **************************/
1014 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1016 /* Compute parameters for interactions between i and j atoms */
1017 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1019 /* EWALD ELECTROSTATICS */
1021 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1022 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1023 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1024 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1025 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1027 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1029 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1030 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1034 /* Update vectorial force */
1035 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1036 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1037 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1039 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1040 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1041 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1043 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1045 /* Inner loop uses 171 flops */
1048 if(jidx<j_index_end)
1052 j_coord_offsetA = DIM*jnrA;
1054 /* load j atom coordinates */
1055 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1058 /* Calculate displacement vector */
1059 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1060 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1061 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1062 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1063 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1064 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1065 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1066 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1067 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1068 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1069 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1070 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1072 /* Calculate squared distance and things based on it */
1073 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1074 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1075 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1076 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1078 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1079 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1080 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1081 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1083 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1084 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1085 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1087 /* Load parameters for j particles */
1088 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1089 vdwjidx0A = 2*vdwtype[jnrA+0];
1091 fjx0 = _fjsp_setzero_v2r8();
1092 fjy0 = _fjsp_setzero_v2r8();
1093 fjz0 = _fjsp_setzero_v2r8();
1095 /**************************
1096 * CALCULATE INTERACTIONS *
1097 **************************/
1099 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1101 /* Compute parameters for interactions between i and j atoms */
1102 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1104 /* Calculate table index by multiplying r with table scale and truncate to integer */
1105 rt = _fjsp_mul_v2r8(r00,vftabscale);
1106 itab_tmp = _fjsp_dtox_v2r8(rt);
1107 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1108 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1109 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1114 /* CUBIC SPLINE TABLE DISPERSION */
1115 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1116 F = _fjsp_setzero_v2r8();
1117 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1118 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1119 H = _fjsp_setzero_v2r8();
1120 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1121 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1122 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1123 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1125 /* CUBIC SPLINE TABLE REPULSION */
1126 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1127 F = _fjsp_setzero_v2r8();
1128 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1129 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1130 H = _fjsp_setzero_v2r8();
1131 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1132 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1133 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1134 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1135 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1139 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1141 /* Update vectorial force */
1142 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1143 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1144 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1146 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1147 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1148 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1150 /**************************
1151 * CALCULATE INTERACTIONS *
1152 **************************/
1154 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1156 /* Compute parameters for interactions between i and j atoms */
1157 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1159 /* EWALD ELECTROSTATICS */
1161 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1162 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1163 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1164 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1165 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1167 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1168 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1169 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1173 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1175 /* Update vectorial force */
1176 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1177 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1178 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1180 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1181 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1182 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1184 /**************************
1185 * CALCULATE INTERACTIONS *
1186 **************************/
1188 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1190 /* Compute parameters for interactions between i and j atoms */
1191 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1193 /* EWALD ELECTROSTATICS */
1195 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1196 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1197 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1198 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1199 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1201 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1202 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1203 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1207 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1209 /* Update vectorial force */
1210 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1211 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1212 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1214 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1215 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1216 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1218 /**************************
1219 * CALCULATE INTERACTIONS *
1220 **************************/
1222 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1224 /* Compute parameters for interactions between i and j atoms */
1225 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1227 /* EWALD ELECTROSTATICS */
1229 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1230 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1231 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1232 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1233 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1235 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1236 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1237 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1241 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1243 /* Update vectorial force */
1244 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1245 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1246 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1248 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1249 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1250 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1252 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1254 /* Inner loop uses 171 flops */
1257 /* End of innermost loop */
1259 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1260 f+i_coord_offset,fshift+i_shift_offset);
1262 /* Increment number of inner iterations */
1263 inneriter += j_index_end - j_index_start;
1265 /* Outer loop uses 24 flops */
1268 /* Increment number of outer iterations */
1271 /* Update outer/inner flops */
1273 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*171);