2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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 "types/simple.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_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;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
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 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
99 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
102 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
105 _fjsp_v2r8 dummy_mask,cutoff_mask;
106 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
107 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
108 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
115 jindex = nlist->jindex;
117 shiftidx = nlist->shift;
119 shiftvec = fr->shift_vec[0];
120 fshift = fr->fshift[0];
121 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
122 charge = mdatoms->chargeA;
123 nvdwtype = fr->ntype;
125 vdwtype = mdatoms->typeA;
127 vftab = kernel_data->table_vdw->data;
128 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
130 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
131 ewtab = fr->ic->tabq_coul_FDV0;
132 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
133 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
135 /* Setup water-specific parameters */
136 inr = nlist->iinr[0];
137 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+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 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
142 /* Avoid stupid compiler warnings */
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
166 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
168 fix0 = _fjsp_setzero_v2r8();
169 fiy0 = _fjsp_setzero_v2r8();
170 fiz0 = _fjsp_setzero_v2r8();
171 fix1 = _fjsp_setzero_v2r8();
172 fiy1 = _fjsp_setzero_v2r8();
173 fiz1 = _fjsp_setzero_v2r8();
174 fix2 = _fjsp_setzero_v2r8();
175 fiy2 = _fjsp_setzero_v2r8();
176 fiz2 = _fjsp_setzero_v2r8();
178 /* Reset potential sums */
179 velecsum = _fjsp_setzero_v2r8();
180 vvdwsum = _fjsp_setzero_v2r8();
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
186 /* Get j neighbor index, and coordinate index */
189 j_coord_offsetA = DIM*jnrA;
190 j_coord_offsetB = DIM*jnrB;
192 /* load j atom coordinates */
193 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
196 /* Calculate displacement vector */
197 dx00 = _fjsp_sub_v2r8(ix0,jx0);
198 dy00 = _fjsp_sub_v2r8(iy0,jy0);
199 dz00 = _fjsp_sub_v2r8(iz0,jz0);
200 dx10 = _fjsp_sub_v2r8(ix1,jx0);
201 dy10 = _fjsp_sub_v2r8(iy1,jy0);
202 dz10 = _fjsp_sub_v2r8(iz1,jz0);
203 dx20 = _fjsp_sub_v2r8(ix2,jx0);
204 dy20 = _fjsp_sub_v2r8(iy2,jy0);
205 dz20 = _fjsp_sub_v2r8(iz2,jz0);
207 /* Calculate squared distance and things based on it */
208 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
209 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
210 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
212 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
213 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
214 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
216 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
217 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
218 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
220 /* Load parameters for j particles */
221 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
222 vdwjidx0A = 2*vdwtype[jnrA+0];
223 vdwjidx0B = 2*vdwtype[jnrB+0];
225 fjx0 = _fjsp_setzero_v2r8();
226 fjy0 = _fjsp_setzero_v2r8();
227 fjz0 = _fjsp_setzero_v2r8();
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
233 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
235 /* Compute parameters for interactions between i and j atoms */
236 qq00 = _fjsp_mul_v2r8(iq0,jq0);
237 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
238 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
240 /* Calculate table index by multiplying r with table scale and truncate to integer */
241 rt = _fjsp_mul_v2r8(r00,vftabscale);
242 itab_tmp = _fjsp_dtox_v2r8(rt);
243 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
244 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
245 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
250 /* EWALD ELECTROSTATICS */
252 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
253 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
254 itab_tmp = _fjsp_dtox_v2r8(ewrt);
255 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
256 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
258 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
259 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
260 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
261 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
262 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
263 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
264 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
265 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
266 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
267 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
269 /* CUBIC SPLINE TABLE DISPERSION */
270 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
271 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
272 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
273 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
274 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
275 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
276 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
277 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
278 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
279 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
280 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
282 /* CUBIC SPLINE TABLE REPULSION */
283 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
284 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
285 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
286 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
287 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
288 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
289 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
290 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
291 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
292 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
293 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
294 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
295 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
297 /* Update potential sum for this i atom from the interaction with this j atom. */
298 velecsum = _fjsp_add_v2r8(velecsum,velec);
299 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
301 fscal = _fjsp_add_v2r8(felec,fvdw);
303 /* Update vectorial force */
304 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
305 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
306 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
308 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
309 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
310 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
312 /**************************
313 * CALCULATE INTERACTIONS *
314 **************************/
316 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
318 /* Compute parameters for interactions between i and j atoms */
319 qq10 = _fjsp_mul_v2r8(iq1,jq0);
321 /* EWALD ELECTROSTATICS */
323 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
324 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
325 itab_tmp = _fjsp_dtox_v2r8(ewrt);
326 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
327 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
329 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
330 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
331 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
332 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
333 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
334 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
335 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
336 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
337 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
338 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
340 /* Update potential sum for this i atom from the interaction with this j atom. */
341 velecsum = _fjsp_add_v2r8(velecsum,velec);
345 /* Update vectorial force */
346 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
347 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
348 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
350 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
351 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
352 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
358 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
360 /* Compute parameters for interactions between i and j atoms */
361 qq20 = _fjsp_mul_v2r8(iq2,jq0);
363 /* EWALD ELECTROSTATICS */
365 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
366 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
367 itab_tmp = _fjsp_dtox_v2r8(ewrt);
368 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
369 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
371 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
372 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
373 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
374 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
375 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
376 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
377 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
378 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
379 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
380 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
382 /* Update potential sum for this i atom from the interaction with this j atom. */
383 velecsum = _fjsp_add_v2r8(velecsum,velec);
387 /* Update vectorial force */
388 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
389 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
390 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
392 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
393 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
394 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
396 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
398 /* Inner loop uses 169 flops */
405 j_coord_offsetA = DIM*jnrA;
407 /* load j atom coordinates */
408 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
411 /* Calculate displacement vector */
412 dx00 = _fjsp_sub_v2r8(ix0,jx0);
413 dy00 = _fjsp_sub_v2r8(iy0,jy0);
414 dz00 = _fjsp_sub_v2r8(iz0,jz0);
415 dx10 = _fjsp_sub_v2r8(ix1,jx0);
416 dy10 = _fjsp_sub_v2r8(iy1,jy0);
417 dz10 = _fjsp_sub_v2r8(iz1,jz0);
418 dx20 = _fjsp_sub_v2r8(ix2,jx0);
419 dy20 = _fjsp_sub_v2r8(iy2,jy0);
420 dz20 = _fjsp_sub_v2r8(iz2,jz0);
422 /* Calculate squared distance and things based on it */
423 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
424 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
425 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
427 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
428 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
429 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
431 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
432 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
433 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
435 /* Load parameters for j particles */
436 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
437 vdwjidx0A = 2*vdwtype[jnrA+0];
439 fjx0 = _fjsp_setzero_v2r8();
440 fjy0 = _fjsp_setzero_v2r8();
441 fjz0 = _fjsp_setzero_v2r8();
443 /**************************
444 * CALCULATE INTERACTIONS *
445 **************************/
447 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
449 /* Compute parameters for interactions between i and j atoms */
450 qq00 = _fjsp_mul_v2r8(iq0,jq0);
451 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
453 /* Calculate table index by multiplying r with table scale and truncate to integer */
454 rt = _fjsp_mul_v2r8(r00,vftabscale);
455 itab_tmp = _fjsp_dtox_v2r8(rt);
456 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
457 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
458 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
463 /* EWALD ELECTROSTATICS */
465 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
466 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
467 itab_tmp = _fjsp_dtox_v2r8(ewrt);
468 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
469 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
471 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
472 ewtabD = _fjsp_setzero_v2r8();
473 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
474 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
475 ewtabFn = _fjsp_setzero_v2r8();
476 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
477 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
478 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
479 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
480 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
482 /* CUBIC SPLINE TABLE DISPERSION */
483 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
484 F = _fjsp_setzero_v2r8();
485 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
486 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
487 H = _fjsp_setzero_v2r8();
488 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
489 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
490 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
491 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
492 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
493 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
495 /* CUBIC SPLINE TABLE REPULSION */
496 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
497 F = _fjsp_setzero_v2r8();
498 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
499 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
500 H = _fjsp_setzero_v2r8();
501 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
502 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
503 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
504 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
505 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
506 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
507 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
508 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
510 /* Update potential sum for this i atom from the interaction with this j atom. */
511 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
512 velecsum = _fjsp_add_v2r8(velecsum,velec);
513 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
514 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
516 fscal = _fjsp_add_v2r8(felec,fvdw);
518 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
520 /* Update vectorial force */
521 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
522 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
523 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
525 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
526 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
527 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
529 /**************************
530 * CALCULATE INTERACTIONS *
531 **************************/
533 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
535 /* Compute parameters for interactions between i and j atoms */
536 qq10 = _fjsp_mul_v2r8(iq1,jq0);
538 /* EWALD ELECTROSTATICS */
540 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
541 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
542 itab_tmp = _fjsp_dtox_v2r8(ewrt);
543 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
544 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
546 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
547 ewtabD = _fjsp_setzero_v2r8();
548 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
549 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
550 ewtabFn = _fjsp_setzero_v2r8();
551 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
552 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
553 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
554 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
555 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
557 /* Update potential sum for this i atom from the interaction with this j atom. */
558 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
559 velecsum = _fjsp_add_v2r8(velecsum,velec);
563 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
565 /* Update vectorial force */
566 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
567 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
568 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
570 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
571 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
572 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
574 /**************************
575 * CALCULATE INTERACTIONS *
576 **************************/
578 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
580 /* Compute parameters for interactions between i and j atoms */
581 qq20 = _fjsp_mul_v2r8(iq2,jq0);
583 /* EWALD ELECTROSTATICS */
585 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
586 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
587 itab_tmp = _fjsp_dtox_v2r8(ewrt);
588 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
589 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
591 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
592 ewtabD = _fjsp_setzero_v2r8();
593 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
594 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
595 ewtabFn = _fjsp_setzero_v2r8();
596 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
597 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
598 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
599 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
600 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
602 /* Update potential sum for this i atom from the interaction with this j atom. */
603 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
604 velecsum = _fjsp_add_v2r8(velecsum,velec);
608 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
610 /* Update vectorial force */
611 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
612 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
613 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
615 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
616 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
617 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
619 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
621 /* Inner loop uses 169 flops */
624 /* End of innermost loop */
626 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
627 f+i_coord_offset,fshift+i_shift_offset);
630 /* Update potential energies */
631 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
632 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
634 /* Increment number of inner iterations */
635 inneriter += j_index_end - j_index_start;
637 /* Outer loop uses 20 flops */
640 /* Increment number of outer iterations */
643 /* Update outer/inner flops */
645 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*169);
648 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
649 * Electrostatics interaction: Ewald
650 * VdW interaction: CubicSplineTable
651 * Geometry: Water3-Particle
652 * Calculate force/pot: Force
655 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
656 (t_nblist * gmx_restrict nlist,
657 rvec * gmx_restrict xx,
658 rvec * gmx_restrict ff,
659 t_forcerec * gmx_restrict fr,
660 t_mdatoms * gmx_restrict mdatoms,
661 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
662 t_nrnb * gmx_restrict nrnb)
664 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
665 * just 0 for non-waters.
666 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
667 * jnr indices corresponding to data put in the four positions in the SIMD register.
669 int i_shift_offset,i_coord_offset,outeriter,inneriter;
670 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
672 int j_coord_offsetA,j_coord_offsetB;
673 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
675 real *shiftvec,*fshift,*x,*f;
676 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
678 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
680 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
682 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
683 int vdwjidx0A,vdwjidx0B;
684 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
685 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
686 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
687 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
688 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
691 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
694 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
695 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
696 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
698 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
701 _fjsp_v2r8 dummy_mask,cutoff_mask;
702 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
703 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
704 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
711 jindex = nlist->jindex;
713 shiftidx = nlist->shift;
715 shiftvec = fr->shift_vec[0];
716 fshift = fr->fshift[0];
717 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
718 charge = mdatoms->chargeA;
719 nvdwtype = fr->ntype;
721 vdwtype = mdatoms->typeA;
723 vftab = kernel_data->table_vdw->data;
724 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
726 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
727 ewtab = fr->ic->tabq_coul_F;
728 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
729 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
731 /* Setup water-specific parameters */
732 inr = nlist->iinr[0];
733 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
734 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
735 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
736 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
738 /* Avoid stupid compiler warnings */
746 /* Start outer loop over neighborlists */
747 for(iidx=0; iidx<nri; iidx++)
749 /* Load shift vector for this list */
750 i_shift_offset = DIM*shiftidx[iidx];
752 /* Load limits for loop over neighbors */
753 j_index_start = jindex[iidx];
754 j_index_end = jindex[iidx+1];
756 /* Get outer coordinate index */
758 i_coord_offset = DIM*inr;
760 /* Load i particle coords and add shift vector */
761 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
762 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
764 fix0 = _fjsp_setzero_v2r8();
765 fiy0 = _fjsp_setzero_v2r8();
766 fiz0 = _fjsp_setzero_v2r8();
767 fix1 = _fjsp_setzero_v2r8();
768 fiy1 = _fjsp_setzero_v2r8();
769 fiz1 = _fjsp_setzero_v2r8();
770 fix2 = _fjsp_setzero_v2r8();
771 fiy2 = _fjsp_setzero_v2r8();
772 fiz2 = _fjsp_setzero_v2r8();
774 /* Start inner kernel loop */
775 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
778 /* Get j neighbor index, and coordinate index */
781 j_coord_offsetA = DIM*jnrA;
782 j_coord_offsetB = DIM*jnrB;
784 /* load j atom coordinates */
785 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
788 /* Calculate displacement vector */
789 dx00 = _fjsp_sub_v2r8(ix0,jx0);
790 dy00 = _fjsp_sub_v2r8(iy0,jy0);
791 dz00 = _fjsp_sub_v2r8(iz0,jz0);
792 dx10 = _fjsp_sub_v2r8(ix1,jx0);
793 dy10 = _fjsp_sub_v2r8(iy1,jy0);
794 dz10 = _fjsp_sub_v2r8(iz1,jz0);
795 dx20 = _fjsp_sub_v2r8(ix2,jx0);
796 dy20 = _fjsp_sub_v2r8(iy2,jy0);
797 dz20 = _fjsp_sub_v2r8(iz2,jz0);
799 /* Calculate squared distance and things based on it */
800 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
801 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
802 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
804 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
805 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
806 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
808 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
809 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
810 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
812 /* Load parameters for j particles */
813 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
814 vdwjidx0A = 2*vdwtype[jnrA+0];
815 vdwjidx0B = 2*vdwtype[jnrB+0];
817 fjx0 = _fjsp_setzero_v2r8();
818 fjy0 = _fjsp_setzero_v2r8();
819 fjz0 = _fjsp_setzero_v2r8();
821 /**************************
822 * CALCULATE INTERACTIONS *
823 **************************/
825 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
827 /* Compute parameters for interactions between i and j atoms */
828 qq00 = _fjsp_mul_v2r8(iq0,jq0);
829 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
830 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
832 /* Calculate table index by multiplying r with table scale and truncate to integer */
833 rt = _fjsp_mul_v2r8(r00,vftabscale);
834 itab_tmp = _fjsp_dtox_v2r8(rt);
835 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
836 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
837 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
842 /* EWALD ELECTROSTATICS */
844 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
845 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
846 itab_tmp = _fjsp_dtox_v2r8(ewrt);
847 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
848 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
850 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
852 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
853 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
855 /* CUBIC SPLINE TABLE DISPERSION */
856 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
857 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
858 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
859 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
860 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
861 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
862 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
863 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
864 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
866 /* CUBIC SPLINE TABLE REPULSION */
867 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
868 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
869 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
870 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
871 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
872 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
873 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
874 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
875 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
876 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
878 fscal = _fjsp_add_v2r8(felec,fvdw);
880 /* Update vectorial force */
881 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
882 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
883 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
885 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
886 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
887 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
889 /**************************
890 * CALCULATE INTERACTIONS *
891 **************************/
893 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
895 /* Compute parameters for interactions between i and j atoms */
896 qq10 = _fjsp_mul_v2r8(iq1,jq0);
898 /* EWALD ELECTROSTATICS */
900 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
901 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
902 itab_tmp = _fjsp_dtox_v2r8(ewrt);
903 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
904 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
906 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
908 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
909 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
913 /* Update vectorial force */
914 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
915 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
916 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
918 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
919 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
920 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
922 /**************************
923 * CALCULATE INTERACTIONS *
924 **************************/
926 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
928 /* Compute parameters for interactions between i and j atoms */
929 qq20 = _fjsp_mul_v2r8(iq2,jq0);
931 /* EWALD ELECTROSTATICS */
933 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
934 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
935 itab_tmp = _fjsp_dtox_v2r8(ewrt);
936 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
937 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
939 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
941 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
942 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
946 /* Update vectorial force */
947 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
948 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
949 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
951 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
952 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
953 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
955 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
957 /* Inner loop uses 146 flops */
964 j_coord_offsetA = DIM*jnrA;
966 /* load j atom coordinates */
967 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
970 /* Calculate displacement vector */
971 dx00 = _fjsp_sub_v2r8(ix0,jx0);
972 dy00 = _fjsp_sub_v2r8(iy0,jy0);
973 dz00 = _fjsp_sub_v2r8(iz0,jz0);
974 dx10 = _fjsp_sub_v2r8(ix1,jx0);
975 dy10 = _fjsp_sub_v2r8(iy1,jy0);
976 dz10 = _fjsp_sub_v2r8(iz1,jz0);
977 dx20 = _fjsp_sub_v2r8(ix2,jx0);
978 dy20 = _fjsp_sub_v2r8(iy2,jy0);
979 dz20 = _fjsp_sub_v2r8(iz2,jz0);
981 /* Calculate squared distance and things based on it */
982 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
983 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
984 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
986 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
987 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
988 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
990 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
991 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
992 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
994 /* Load parameters for j particles */
995 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
996 vdwjidx0A = 2*vdwtype[jnrA+0];
998 fjx0 = _fjsp_setzero_v2r8();
999 fjy0 = _fjsp_setzero_v2r8();
1000 fjz0 = _fjsp_setzero_v2r8();
1002 /**************************
1003 * CALCULATE INTERACTIONS *
1004 **************************/
1006 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1008 /* Compute parameters for interactions between i and j atoms */
1009 qq00 = _fjsp_mul_v2r8(iq0,jq0);
1010 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1012 /* Calculate table index by multiplying r with table scale and truncate to integer */
1013 rt = _fjsp_mul_v2r8(r00,vftabscale);
1014 itab_tmp = _fjsp_dtox_v2r8(rt);
1015 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1016 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1017 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1022 /* EWALD ELECTROSTATICS */
1024 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1025 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
1026 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1027 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1028 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1030 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1031 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1032 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
1034 /* CUBIC SPLINE TABLE DISPERSION */
1035 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1036 F = _fjsp_setzero_v2r8();
1037 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1038 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1039 H = _fjsp_setzero_v2r8();
1040 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1041 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1042 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1043 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1045 /* CUBIC SPLINE TABLE REPULSION */
1046 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1047 F = _fjsp_setzero_v2r8();
1048 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1049 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1050 H = _fjsp_setzero_v2r8();
1051 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1052 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1053 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1054 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1055 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1057 fscal = _fjsp_add_v2r8(felec,fvdw);
1059 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1061 /* Update vectorial force */
1062 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1063 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1064 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1066 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1067 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1068 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1070 /**************************
1071 * CALCULATE INTERACTIONS *
1072 **************************/
1074 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1076 /* Compute parameters for interactions between i and j atoms */
1077 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1079 /* EWALD ELECTROSTATICS */
1081 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1082 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1083 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1084 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1085 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1087 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1088 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1089 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1093 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1095 /* Update vectorial force */
1096 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1097 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1098 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1100 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1101 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1102 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1104 /**************************
1105 * CALCULATE INTERACTIONS *
1106 **************************/
1108 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1110 /* Compute parameters for interactions between i and j atoms */
1111 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1113 /* EWALD ELECTROSTATICS */
1115 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1116 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1117 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1118 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1119 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1121 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1122 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1123 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1127 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1129 /* Update vectorial force */
1130 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1131 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1132 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1134 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1135 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1136 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1138 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1140 /* Inner loop uses 146 flops */
1143 /* End of innermost loop */
1145 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1146 f+i_coord_offset,fshift+i_shift_offset);
1148 /* Increment number of inner iterations */
1149 inneriter += j_index_end - j_index_start;
1151 /* Outer loop uses 18 flops */
1154 /* Increment number of outer iterations */
1157 /* Update outer/inner flops */
1159 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*146);