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_ElecEw_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_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;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
105 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
108 _fjsp_v2r8 dummy_mask,cutoff_mask;
109 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
110 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
111 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
118 jindex = nlist->jindex;
120 shiftidx = nlist->shift;
122 shiftvec = fr->shift_vec[0];
123 fshift = fr->fshift[0];
124 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
125 charge = mdatoms->chargeA;
126 nvdwtype = fr->ntype;
128 vdwtype = mdatoms->typeA;
130 vftab = kernel_data->table_vdw->data;
131 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
133 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
134 ewtab = fr->ic->tabq_coul_FDV0;
135 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
136 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
138 /* Setup water-specific parameters */
139 inr = nlist->iinr[0];
140 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
141 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
142 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
143 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
145 /* Avoid stupid compiler warnings */
153 /* Start outer loop over neighborlists */
154 for(iidx=0; iidx<nri; iidx++)
156 /* Load shift vector for this list */
157 i_shift_offset = DIM*shiftidx[iidx];
159 /* Load limits for loop over neighbors */
160 j_index_start = jindex[iidx];
161 j_index_end = jindex[iidx+1];
163 /* Get outer coordinate index */
165 i_coord_offset = DIM*inr;
167 /* Load i particle coords and add shift vector */
168 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
169 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
171 fix0 = _fjsp_setzero_v2r8();
172 fiy0 = _fjsp_setzero_v2r8();
173 fiz0 = _fjsp_setzero_v2r8();
174 fix1 = _fjsp_setzero_v2r8();
175 fiy1 = _fjsp_setzero_v2r8();
176 fiz1 = _fjsp_setzero_v2r8();
177 fix2 = _fjsp_setzero_v2r8();
178 fiy2 = _fjsp_setzero_v2r8();
179 fiz2 = _fjsp_setzero_v2r8();
180 fix3 = _fjsp_setzero_v2r8();
181 fiy3 = _fjsp_setzero_v2r8();
182 fiz3 = _fjsp_setzero_v2r8();
184 /* Reset potential sums */
185 velecsum = _fjsp_setzero_v2r8();
186 vvdwsum = _fjsp_setzero_v2r8();
188 /* Start inner kernel loop */
189 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
192 /* Get j neighbor index, and coordinate index */
195 j_coord_offsetA = DIM*jnrA;
196 j_coord_offsetB = DIM*jnrB;
198 /* load j atom coordinates */
199 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
202 /* Calculate displacement vector */
203 dx00 = _fjsp_sub_v2r8(ix0,jx0);
204 dy00 = _fjsp_sub_v2r8(iy0,jy0);
205 dz00 = _fjsp_sub_v2r8(iz0,jz0);
206 dx10 = _fjsp_sub_v2r8(ix1,jx0);
207 dy10 = _fjsp_sub_v2r8(iy1,jy0);
208 dz10 = _fjsp_sub_v2r8(iz1,jz0);
209 dx20 = _fjsp_sub_v2r8(ix2,jx0);
210 dy20 = _fjsp_sub_v2r8(iy2,jy0);
211 dz20 = _fjsp_sub_v2r8(iz2,jz0);
212 dx30 = _fjsp_sub_v2r8(ix3,jx0);
213 dy30 = _fjsp_sub_v2r8(iy3,jy0);
214 dz30 = _fjsp_sub_v2r8(iz3,jz0);
216 /* Calculate squared distance and things based on it */
217 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
218 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
219 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
220 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
222 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
223 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
224 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
225 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
227 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
228 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
229 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
231 /* Load parameters for j particles */
232 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
233 vdwjidx0A = 2*vdwtype[jnrA+0];
234 vdwjidx0B = 2*vdwtype[jnrB+0];
236 fjx0 = _fjsp_setzero_v2r8();
237 fjy0 = _fjsp_setzero_v2r8();
238 fjz0 = _fjsp_setzero_v2r8();
240 /**************************
241 * CALCULATE INTERACTIONS *
242 **************************/
244 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
246 /* Compute parameters for interactions between i and j atoms */
247 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
248 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
250 /* Calculate table index by multiplying r with table scale and truncate to integer */
251 rt = _fjsp_mul_v2r8(r00,vftabscale);
252 itab_tmp = _fjsp_dtox_v2r8(rt);
253 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
254 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
255 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
260 /* CUBIC SPLINE TABLE DISPERSION */
261 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
262 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
263 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
264 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
265 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
266 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
267 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
268 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
269 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
270 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
271 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
273 /* CUBIC SPLINE TABLE REPULSION */
274 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
275 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
276 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
277 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
278 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
279 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
280 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
281 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
282 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
283 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
284 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
285 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
286 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
288 /* Update potential sum for this i atom from the interaction with this j atom. */
289 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
293 /* Update vectorial force */
294 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
295 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
296 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
298 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
299 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
300 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
308 /* Compute parameters for interactions between i and j atoms */
309 qq10 = _fjsp_mul_v2r8(iq1,jq0);
311 /* EWALD ELECTROSTATICS */
313 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
314 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
315 itab_tmp = _fjsp_dtox_v2r8(ewrt);
316 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
317 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
319 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
320 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
321 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
322 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
323 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
324 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
325 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
326 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
327 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
328 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
330 /* Update potential sum for this i atom from the interaction with this j atom. */
331 velecsum = _fjsp_add_v2r8(velecsum,velec);
335 /* Update vectorial force */
336 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
337 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
338 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
340 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
341 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
342 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
344 /**************************
345 * CALCULATE INTERACTIONS *
346 **************************/
348 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
350 /* Compute parameters for interactions between i and j atoms */
351 qq20 = _fjsp_mul_v2r8(iq2,jq0);
353 /* EWALD ELECTROSTATICS */
355 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
356 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
357 itab_tmp = _fjsp_dtox_v2r8(ewrt);
358 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
359 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
361 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
362 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
363 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
364 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
365 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
366 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
367 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
368 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
369 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
370 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
372 /* Update potential sum for this i atom from the interaction with this j atom. */
373 velecsum = _fjsp_add_v2r8(velecsum,velec);
377 /* Update vectorial force */
378 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
379 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
380 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
382 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
383 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
384 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
386 /**************************
387 * CALCULATE INTERACTIONS *
388 **************************/
390 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
392 /* Compute parameters for interactions between i and j atoms */
393 qq30 = _fjsp_mul_v2r8(iq3,jq0);
395 /* EWALD ELECTROSTATICS */
397 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
398 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
399 itab_tmp = _fjsp_dtox_v2r8(ewrt);
400 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
401 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
403 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
404 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
405 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
406 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
407 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
408 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
409 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
410 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
411 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
412 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
414 /* Update potential sum for this i atom from the interaction with this j atom. */
415 velecsum = _fjsp_add_v2r8(velecsum,velec);
419 /* Update vectorial force */
420 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
421 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
422 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
424 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
425 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
426 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
428 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
430 /* Inner loop uses 194 flops */
437 j_coord_offsetA = DIM*jnrA;
439 /* load j atom coordinates */
440 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
443 /* Calculate displacement vector */
444 dx00 = _fjsp_sub_v2r8(ix0,jx0);
445 dy00 = _fjsp_sub_v2r8(iy0,jy0);
446 dz00 = _fjsp_sub_v2r8(iz0,jz0);
447 dx10 = _fjsp_sub_v2r8(ix1,jx0);
448 dy10 = _fjsp_sub_v2r8(iy1,jy0);
449 dz10 = _fjsp_sub_v2r8(iz1,jz0);
450 dx20 = _fjsp_sub_v2r8(ix2,jx0);
451 dy20 = _fjsp_sub_v2r8(iy2,jy0);
452 dz20 = _fjsp_sub_v2r8(iz2,jz0);
453 dx30 = _fjsp_sub_v2r8(ix3,jx0);
454 dy30 = _fjsp_sub_v2r8(iy3,jy0);
455 dz30 = _fjsp_sub_v2r8(iz3,jz0);
457 /* Calculate squared distance and things based on it */
458 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
459 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
460 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
461 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
463 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
464 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
465 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
466 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
468 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
469 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
470 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
472 /* Load parameters for j particles */
473 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
474 vdwjidx0A = 2*vdwtype[jnrA+0];
476 fjx0 = _fjsp_setzero_v2r8();
477 fjy0 = _fjsp_setzero_v2r8();
478 fjz0 = _fjsp_setzero_v2r8();
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
486 /* Compute parameters for interactions between i and j atoms */
487 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
489 /* Calculate table index by multiplying r with table scale and truncate to integer */
490 rt = _fjsp_mul_v2r8(r00,vftabscale);
491 itab_tmp = _fjsp_dtox_v2r8(rt);
492 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
493 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
494 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
499 /* CUBIC SPLINE TABLE DISPERSION */
500 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
501 F = _fjsp_setzero_v2r8();
502 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
503 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
504 H = _fjsp_setzero_v2r8();
505 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
506 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
507 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
508 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
509 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
510 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
512 /* CUBIC SPLINE TABLE REPULSION */
513 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
514 F = _fjsp_setzero_v2r8();
515 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
516 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
517 H = _fjsp_setzero_v2r8();
518 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
519 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
520 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
521 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
522 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
523 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
524 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
525 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
527 /* Update potential sum for this i atom from the interaction with this j atom. */
528 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
529 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
533 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
535 /* Update vectorial force */
536 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
537 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
538 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
540 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
541 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
542 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
544 /**************************
545 * CALCULATE INTERACTIONS *
546 **************************/
548 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
550 /* Compute parameters for interactions between i and j atoms */
551 qq10 = _fjsp_mul_v2r8(iq1,jq0);
553 /* EWALD ELECTROSTATICS */
555 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
556 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
557 itab_tmp = _fjsp_dtox_v2r8(ewrt);
558 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
559 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
561 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
562 ewtabD = _fjsp_setzero_v2r8();
563 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
564 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
565 ewtabFn = _fjsp_setzero_v2r8();
566 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
567 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
568 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
569 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
570 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
572 /* Update potential sum for this i atom from the interaction with this j atom. */
573 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
574 velecsum = _fjsp_add_v2r8(velecsum,velec);
578 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
580 /* Update vectorial force */
581 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
582 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
583 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
585 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
586 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
587 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
589 /**************************
590 * CALCULATE INTERACTIONS *
591 **************************/
593 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
595 /* Compute parameters for interactions between i and j atoms */
596 qq20 = _fjsp_mul_v2r8(iq2,jq0);
598 /* EWALD ELECTROSTATICS */
600 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
601 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
602 itab_tmp = _fjsp_dtox_v2r8(ewrt);
603 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
604 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
606 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
607 ewtabD = _fjsp_setzero_v2r8();
608 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
609 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
610 ewtabFn = _fjsp_setzero_v2r8();
611 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
612 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
613 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
614 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
615 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
617 /* Update potential sum for this i atom from the interaction with this j atom. */
618 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
619 velecsum = _fjsp_add_v2r8(velecsum,velec);
623 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
625 /* Update vectorial force */
626 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
627 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
628 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
630 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
631 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
632 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
634 /**************************
635 * CALCULATE INTERACTIONS *
636 **************************/
638 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
640 /* Compute parameters for interactions between i and j atoms */
641 qq30 = _fjsp_mul_v2r8(iq3,jq0);
643 /* EWALD ELECTROSTATICS */
645 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
646 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
647 itab_tmp = _fjsp_dtox_v2r8(ewrt);
648 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
649 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
651 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
652 ewtabD = _fjsp_setzero_v2r8();
653 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
654 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
655 ewtabFn = _fjsp_setzero_v2r8();
656 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
657 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
658 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
659 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
660 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
662 /* Update potential sum for this i atom from the interaction with this j atom. */
663 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
664 velecsum = _fjsp_add_v2r8(velecsum,velec);
668 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
670 /* Update vectorial force */
671 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
672 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
673 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
675 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
676 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
677 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
679 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
681 /* Inner loop uses 194 flops */
684 /* End of innermost loop */
686 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
687 f+i_coord_offset,fshift+i_shift_offset);
690 /* Update potential energies */
691 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
692 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
694 /* Increment number of inner iterations */
695 inneriter += j_index_end - j_index_start;
697 /* Outer loop uses 26 flops */
700 /* Increment number of outer iterations */
703 /* Update outer/inner flops */
705 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*194);
708 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
709 * Electrostatics interaction: Ewald
710 * VdW interaction: CubicSplineTable
711 * Geometry: Water4-Particle
712 * Calculate force/pot: Force
715 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
716 (t_nblist * gmx_restrict nlist,
717 rvec * gmx_restrict xx,
718 rvec * gmx_restrict ff,
719 t_forcerec * gmx_restrict fr,
720 t_mdatoms * gmx_restrict mdatoms,
721 nb_kernel_data_t * gmx_restrict kernel_data,
722 t_nrnb * gmx_restrict nrnb)
724 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
725 * just 0 for non-waters.
726 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
727 * jnr indices corresponding to data put in the four positions in the SIMD register.
729 int i_shift_offset,i_coord_offset,outeriter,inneriter;
730 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
732 int j_coord_offsetA,j_coord_offsetB;
733 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
735 real *shiftvec,*fshift,*x,*f;
736 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
738 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
740 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
742 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
744 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
745 int vdwjidx0A,vdwjidx0B;
746 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
747 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
748 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
749 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
750 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
751 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
754 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
757 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
758 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
759 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
761 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
764 _fjsp_v2r8 dummy_mask,cutoff_mask;
765 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
766 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
767 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
774 jindex = nlist->jindex;
776 shiftidx = nlist->shift;
778 shiftvec = fr->shift_vec[0];
779 fshift = fr->fshift[0];
780 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
781 charge = mdatoms->chargeA;
782 nvdwtype = fr->ntype;
784 vdwtype = mdatoms->typeA;
786 vftab = kernel_data->table_vdw->data;
787 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
789 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
790 ewtab = fr->ic->tabq_coul_F;
791 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
792 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
794 /* Setup water-specific parameters */
795 inr = nlist->iinr[0];
796 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
797 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
798 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
799 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
801 /* Avoid stupid compiler warnings */
809 /* Start outer loop over neighborlists */
810 for(iidx=0; iidx<nri; iidx++)
812 /* Load shift vector for this list */
813 i_shift_offset = DIM*shiftidx[iidx];
815 /* Load limits for loop over neighbors */
816 j_index_start = jindex[iidx];
817 j_index_end = jindex[iidx+1];
819 /* Get outer coordinate index */
821 i_coord_offset = DIM*inr;
823 /* Load i particle coords and add shift vector */
824 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
825 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
827 fix0 = _fjsp_setzero_v2r8();
828 fiy0 = _fjsp_setzero_v2r8();
829 fiz0 = _fjsp_setzero_v2r8();
830 fix1 = _fjsp_setzero_v2r8();
831 fiy1 = _fjsp_setzero_v2r8();
832 fiz1 = _fjsp_setzero_v2r8();
833 fix2 = _fjsp_setzero_v2r8();
834 fiy2 = _fjsp_setzero_v2r8();
835 fiz2 = _fjsp_setzero_v2r8();
836 fix3 = _fjsp_setzero_v2r8();
837 fiy3 = _fjsp_setzero_v2r8();
838 fiz3 = _fjsp_setzero_v2r8();
840 /* Start inner kernel loop */
841 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
844 /* Get j neighbor index, and coordinate index */
847 j_coord_offsetA = DIM*jnrA;
848 j_coord_offsetB = DIM*jnrB;
850 /* load j atom coordinates */
851 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
854 /* Calculate displacement vector */
855 dx00 = _fjsp_sub_v2r8(ix0,jx0);
856 dy00 = _fjsp_sub_v2r8(iy0,jy0);
857 dz00 = _fjsp_sub_v2r8(iz0,jz0);
858 dx10 = _fjsp_sub_v2r8(ix1,jx0);
859 dy10 = _fjsp_sub_v2r8(iy1,jy0);
860 dz10 = _fjsp_sub_v2r8(iz1,jz0);
861 dx20 = _fjsp_sub_v2r8(ix2,jx0);
862 dy20 = _fjsp_sub_v2r8(iy2,jy0);
863 dz20 = _fjsp_sub_v2r8(iz2,jz0);
864 dx30 = _fjsp_sub_v2r8(ix3,jx0);
865 dy30 = _fjsp_sub_v2r8(iy3,jy0);
866 dz30 = _fjsp_sub_v2r8(iz3,jz0);
868 /* Calculate squared distance and things based on it */
869 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
870 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
871 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
872 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
874 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
875 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
876 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
877 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
879 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
880 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
881 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
883 /* Load parameters for j particles */
884 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
885 vdwjidx0A = 2*vdwtype[jnrA+0];
886 vdwjidx0B = 2*vdwtype[jnrB+0];
888 fjx0 = _fjsp_setzero_v2r8();
889 fjy0 = _fjsp_setzero_v2r8();
890 fjz0 = _fjsp_setzero_v2r8();
892 /**************************
893 * CALCULATE INTERACTIONS *
894 **************************/
896 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
898 /* Compute parameters for interactions between i and j atoms */
899 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
900 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
902 /* Calculate table index by multiplying r with table scale and truncate to integer */
903 rt = _fjsp_mul_v2r8(r00,vftabscale);
904 itab_tmp = _fjsp_dtox_v2r8(rt);
905 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
906 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
907 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
912 /* CUBIC SPLINE TABLE DISPERSION */
913 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
914 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
915 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
916 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
917 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
918 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
919 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
920 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
921 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
923 /* CUBIC SPLINE TABLE REPULSION */
924 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
925 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
926 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
927 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
928 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
929 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
930 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
931 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
932 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
933 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
937 /* Update vectorial force */
938 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
939 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
940 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
942 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
943 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
944 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
946 /**************************
947 * CALCULATE INTERACTIONS *
948 **************************/
950 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
952 /* Compute parameters for interactions between i and j atoms */
953 qq10 = _fjsp_mul_v2r8(iq1,jq0);
955 /* EWALD ELECTROSTATICS */
957 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
958 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
959 itab_tmp = _fjsp_dtox_v2r8(ewrt);
960 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
961 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
963 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
965 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
966 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
970 /* Update vectorial force */
971 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
972 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
973 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
975 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
976 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
977 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
979 /**************************
980 * CALCULATE INTERACTIONS *
981 **************************/
983 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
985 /* Compute parameters for interactions between i and j atoms */
986 qq20 = _fjsp_mul_v2r8(iq2,jq0);
988 /* EWALD ELECTROSTATICS */
990 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
991 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
992 itab_tmp = _fjsp_dtox_v2r8(ewrt);
993 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
994 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
996 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
998 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
999 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1003 /* Update vectorial force */
1004 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1005 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1006 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1008 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1009 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1010 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1012 /**************************
1013 * CALCULATE INTERACTIONS *
1014 **************************/
1016 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1018 /* Compute parameters for interactions between i and j atoms */
1019 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1021 /* EWALD ELECTROSTATICS */
1023 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1024 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1025 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1026 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1027 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1029 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1031 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1032 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1036 /* Update vectorial force */
1037 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1038 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1039 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1041 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1042 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1043 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1045 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1047 /* Inner loop uses 171 flops */
1050 if(jidx<j_index_end)
1054 j_coord_offsetA = DIM*jnrA;
1056 /* load j atom coordinates */
1057 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1060 /* Calculate displacement vector */
1061 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1062 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1063 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1064 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1065 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1066 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1067 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1068 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1069 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1070 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1071 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1072 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1074 /* Calculate squared distance and things based on it */
1075 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1076 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1077 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1078 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1080 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1081 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1082 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1083 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1085 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1086 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1087 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1089 /* Load parameters for j particles */
1090 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1091 vdwjidx0A = 2*vdwtype[jnrA+0];
1093 fjx0 = _fjsp_setzero_v2r8();
1094 fjy0 = _fjsp_setzero_v2r8();
1095 fjz0 = _fjsp_setzero_v2r8();
1097 /**************************
1098 * CALCULATE INTERACTIONS *
1099 **************************/
1101 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1103 /* Compute parameters for interactions between i and j atoms */
1104 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1106 /* Calculate table index by multiplying r with table scale and truncate to integer */
1107 rt = _fjsp_mul_v2r8(r00,vftabscale);
1108 itab_tmp = _fjsp_dtox_v2r8(rt);
1109 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1110 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1111 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1116 /* CUBIC SPLINE TABLE DISPERSION */
1117 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1118 F = _fjsp_setzero_v2r8();
1119 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1120 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1121 H = _fjsp_setzero_v2r8();
1122 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1123 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1124 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1125 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1127 /* CUBIC SPLINE TABLE REPULSION */
1128 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1129 F = _fjsp_setzero_v2r8();
1130 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1131 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1132 H = _fjsp_setzero_v2r8();
1133 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1134 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1135 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1136 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1137 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1141 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1143 /* Update vectorial force */
1144 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1145 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1146 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1148 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1149 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1150 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1152 /**************************
1153 * CALCULATE INTERACTIONS *
1154 **************************/
1156 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1158 /* Compute parameters for interactions between i and j atoms */
1159 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1161 /* EWALD ELECTROSTATICS */
1163 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1164 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1165 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1166 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1167 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1169 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1170 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1171 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1175 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1177 /* Update vectorial force */
1178 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1179 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1180 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1182 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1183 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1184 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1186 /**************************
1187 * CALCULATE INTERACTIONS *
1188 **************************/
1190 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1192 /* Compute parameters for interactions between i and j atoms */
1193 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1195 /* EWALD ELECTROSTATICS */
1197 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1198 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1199 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1200 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1201 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1203 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1204 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1205 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1209 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1211 /* Update vectorial force */
1212 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1213 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1214 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1216 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1217 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1218 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1220 /**************************
1221 * CALCULATE INTERACTIONS *
1222 **************************/
1224 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1226 /* Compute parameters for interactions between i and j atoms */
1227 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1229 /* EWALD ELECTROSTATICS */
1231 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1232 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1233 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1234 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1235 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1237 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1238 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1239 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1243 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1245 /* Update vectorial force */
1246 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1247 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1248 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1250 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1251 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1252 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1254 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1256 /* Inner loop uses 171 flops */
1259 /* End of innermost loop */
1261 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1262 f+i_coord_offset,fshift+i_shift_offset);
1264 /* Increment number of inner iterations */
1265 inneriter += j_index_end - j_index_start;
1267 /* Outer loop uses 24 flops */
1270 /* Increment number of outer iterations */
1273 /* Update outer/inner flops */
1275 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*171);