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_ElecCoul_VdwCSTab_GeomW3W3_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water3-Water3
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_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 int vdwjidx1A,vdwjidx1B;
90 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
91 int vdwjidx2A,vdwjidx2B;
92 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
93 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
94 _fjsp_v2r8 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
95 _fjsp_v2r8 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
96 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
97 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
98 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
99 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
100 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
101 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
102 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
105 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
108 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
109 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
110 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
113 _fjsp_v2r8 dummy_mask,cutoff_mask;
114 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
115 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
116 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
123 jindex = nlist->jindex;
125 shiftidx = nlist->shift;
127 shiftvec = fr->shift_vec[0];
128 fshift = fr->fshift[0];
129 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
130 charge = mdatoms->chargeA;
131 nvdwtype = fr->ntype;
133 vdwtype = mdatoms->typeA;
135 vftab = kernel_data->table_vdw->data;
136 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
138 /* Setup water-specific parameters */
139 inr = nlist->iinr[0];
140 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
141 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
142 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
143 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
145 jq0 = gmx_fjsp_set1_v2r8(charge[inr+0]);
146 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
147 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
148 vdwjidx0A = 2*vdwtype[inr+0];
149 qq00 = _fjsp_mul_v2r8(iq0,jq0);
150 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
151 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
152 qq01 = _fjsp_mul_v2r8(iq0,jq1);
153 qq02 = _fjsp_mul_v2r8(iq0,jq2);
154 qq10 = _fjsp_mul_v2r8(iq1,jq0);
155 qq11 = _fjsp_mul_v2r8(iq1,jq1);
156 qq12 = _fjsp_mul_v2r8(iq1,jq2);
157 qq20 = _fjsp_mul_v2r8(iq2,jq0);
158 qq21 = _fjsp_mul_v2r8(iq2,jq1);
159 qq22 = _fjsp_mul_v2r8(iq2,jq2);
161 /* Avoid stupid compiler warnings */
169 /* Start outer loop over neighborlists */
170 for(iidx=0; iidx<nri; iidx++)
172 /* Load shift vector for this list */
173 i_shift_offset = DIM*shiftidx[iidx];
175 /* Load limits for loop over neighbors */
176 j_index_start = jindex[iidx];
177 j_index_end = jindex[iidx+1];
179 /* Get outer coordinate index */
181 i_coord_offset = DIM*inr;
183 /* Load i particle coords and add shift vector */
184 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
185 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
187 fix0 = _fjsp_setzero_v2r8();
188 fiy0 = _fjsp_setzero_v2r8();
189 fiz0 = _fjsp_setzero_v2r8();
190 fix1 = _fjsp_setzero_v2r8();
191 fiy1 = _fjsp_setzero_v2r8();
192 fiz1 = _fjsp_setzero_v2r8();
193 fix2 = _fjsp_setzero_v2r8();
194 fiy2 = _fjsp_setzero_v2r8();
195 fiz2 = _fjsp_setzero_v2r8();
197 /* Reset potential sums */
198 velecsum = _fjsp_setzero_v2r8();
199 vvdwsum = _fjsp_setzero_v2r8();
201 /* Start inner kernel loop */
202 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
205 /* Get j neighbor index, and coordinate index */
208 j_coord_offsetA = DIM*jnrA;
209 j_coord_offsetB = DIM*jnrB;
211 /* load j atom coordinates */
212 gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
213 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
215 /* Calculate displacement vector */
216 dx00 = _fjsp_sub_v2r8(ix0,jx0);
217 dy00 = _fjsp_sub_v2r8(iy0,jy0);
218 dz00 = _fjsp_sub_v2r8(iz0,jz0);
219 dx01 = _fjsp_sub_v2r8(ix0,jx1);
220 dy01 = _fjsp_sub_v2r8(iy0,jy1);
221 dz01 = _fjsp_sub_v2r8(iz0,jz1);
222 dx02 = _fjsp_sub_v2r8(ix0,jx2);
223 dy02 = _fjsp_sub_v2r8(iy0,jy2);
224 dz02 = _fjsp_sub_v2r8(iz0,jz2);
225 dx10 = _fjsp_sub_v2r8(ix1,jx0);
226 dy10 = _fjsp_sub_v2r8(iy1,jy0);
227 dz10 = _fjsp_sub_v2r8(iz1,jz0);
228 dx11 = _fjsp_sub_v2r8(ix1,jx1);
229 dy11 = _fjsp_sub_v2r8(iy1,jy1);
230 dz11 = _fjsp_sub_v2r8(iz1,jz1);
231 dx12 = _fjsp_sub_v2r8(ix1,jx2);
232 dy12 = _fjsp_sub_v2r8(iy1,jy2);
233 dz12 = _fjsp_sub_v2r8(iz1,jz2);
234 dx20 = _fjsp_sub_v2r8(ix2,jx0);
235 dy20 = _fjsp_sub_v2r8(iy2,jy0);
236 dz20 = _fjsp_sub_v2r8(iz2,jz0);
237 dx21 = _fjsp_sub_v2r8(ix2,jx1);
238 dy21 = _fjsp_sub_v2r8(iy2,jy1);
239 dz21 = _fjsp_sub_v2r8(iz2,jz1);
240 dx22 = _fjsp_sub_v2r8(ix2,jx2);
241 dy22 = _fjsp_sub_v2r8(iy2,jy2);
242 dz22 = _fjsp_sub_v2r8(iz2,jz2);
244 /* Calculate squared distance and things based on it */
245 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
246 rsq01 = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
247 rsq02 = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
248 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
249 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
250 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
251 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
252 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
253 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
255 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
256 rinv01 = gmx_fjsp_invsqrt_v2r8(rsq01);
257 rinv02 = gmx_fjsp_invsqrt_v2r8(rsq02);
258 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
259 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
260 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
261 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
262 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
263 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
265 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
266 rinvsq01 = _fjsp_mul_v2r8(rinv01,rinv01);
267 rinvsq02 = _fjsp_mul_v2r8(rinv02,rinv02);
268 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
269 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
270 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
271 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
272 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
273 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
275 fjx0 = _fjsp_setzero_v2r8();
276 fjy0 = _fjsp_setzero_v2r8();
277 fjz0 = _fjsp_setzero_v2r8();
278 fjx1 = _fjsp_setzero_v2r8();
279 fjy1 = _fjsp_setzero_v2r8();
280 fjz1 = _fjsp_setzero_v2r8();
281 fjx2 = _fjsp_setzero_v2r8();
282 fjy2 = _fjsp_setzero_v2r8();
283 fjz2 = _fjsp_setzero_v2r8();
285 /**************************
286 * CALCULATE INTERACTIONS *
287 **************************/
289 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
291 /* Calculate table index by multiplying r with table scale and truncate to integer */
292 rt = _fjsp_mul_v2r8(r00,vftabscale);
293 itab_tmp = _fjsp_dtox_v2r8(rt);
294 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
295 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
296 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
301 /* COULOMB ELECTROSTATICS */
302 velec = _fjsp_mul_v2r8(qq00,rinv00);
303 felec = _fjsp_mul_v2r8(velec,rinvsq00);
305 /* CUBIC SPLINE TABLE DISPERSION */
306 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
307 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
308 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
309 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
310 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
311 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
312 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
313 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
314 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
315 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
316 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
318 /* CUBIC SPLINE TABLE REPULSION */
319 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
320 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
321 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
322 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
323 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
324 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
325 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
326 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
327 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
328 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
329 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
330 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
331 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
333 /* Update potential sum for this i atom from the interaction with this j atom. */
334 velecsum = _fjsp_add_v2r8(velecsum,velec);
335 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
337 fscal = _fjsp_add_v2r8(felec,fvdw);
339 /* Update vectorial force */
340 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
341 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
342 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
344 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
345 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
346 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
348 /**************************
349 * CALCULATE INTERACTIONS *
350 **************************/
352 /* COULOMB ELECTROSTATICS */
353 velec = _fjsp_mul_v2r8(qq01,rinv01);
354 felec = _fjsp_mul_v2r8(velec,rinvsq01);
356 /* Update potential sum for this i atom from the interaction with this j atom. */
357 velecsum = _fjsp_add_v2r8(velecsum,velec);
361 /* Update vectorial force */
362 fix0 = _fjsp_madd_v2r8(dx01,fscal,fix0);
363 fiy0 = _fjsp_madd_v2r8(dy01,fscal,fiy0);
364 fiz0 = _fjsp_madd_v2r8(dz01,fscal,fiz0);
366 fjx1 = _fjsp_madd_v2r8(dx01,fscal,fjx1);
367 fjy1 = _fjsp_madd_v2r8(dy01,fscal,fjy1);
368 fjz1 = _fjsp_madd_v2r8(dz01,fscal,fjz1);
370 /**************************
371 * CALCULATE INTERACTIONS *
372 **************************/
374 /* COULOMB ELECTROSTATICS */
375 velec = _fjsp_mul_v2r8(qq02,rinv02);
376 felec = _fjsp_mul_v2r8(velec,rinvsq02);
378 /* Update potential sum for this i atom from the interaction with this j atom. */
379 velecsum = _fjsp_add_v2r8(velecsum,velec);
383 /* Update vectorial force */
384 fix0 = _fjsp_madd_v2r8(dx02,fscal,fix0);
385 fiy0 = _fjsp_madd_v2r8(dy02,fscal,fiy0);
386 fiz0 = _fjsp_madd_v2r8(dz02,fscal,fiz0);
388 fjx2 = _fjsp_madd_v2r8(dx02,fscal,fjx2);
389 fjy2 = _fjsp_madd_v2r8(dy02,fscal,fjy2);
390 fjz2 = _fjsp_madd_v2r8(dz02,fscal,fjz2);
392 /**************************
393 * CALCULATE INTERACTIONS *
394 **************************/
396 /* COULOMB ELECTROSTATICS */
397 velec = _fjsp_mul_v2r8(qq10,rinv10);
398 felec = _fjsp_mul_v2r8(velec,rinvsq10);
400 /* Update potential sum for this i atom from the interaction with this j atom. */
401 velecsum = _fjsp_add_v2r8(velecsum,velec);
405 /* Update vectorial force */
406 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
407 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
408 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
410 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
411 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
412 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
414 /**************************
415 * CALCULATE INTERACTIONS *
416 **************************/
418 /* COULOMB ELECTROSTATICS */
419 velec = _fjsp_mul_v2r8(qq11,rinv11);
420 felec = _fjsp_mul_v2r8(velec,rinvsq11);
422 /* Update potential sum for this i atom from the interaction with this j atom. */
423 velecsum = _fjsp_add_v2r8(velecsum,velec);
427 /* Update vectorial force */
428 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
429 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
430 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
432 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
433 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
434 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
436 /**************************
437 * CALCULATE INTERACTIONS *
438 **************************/
440 /* COULOMB ELECTROSTATICS */
441 velec = _fjsp_mul_v2r8(qq12,rinv12);
442 felec = _fjsp_mul_v2r8(velec,rinvsq12);
444 /* Update potential sum for this i atom from the interaction with this j atom. */
445 velecsum = _fjsp_add_v2r8(velecsum,velec);
449 /* Update vectorial force */
450 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
451 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
452 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
454 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
455 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
456 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
458 /**************************
459 * CALCULATE INTERACTIONS *
460 **************************/
462 /* COULOMB ELECTROSTATICS */
463 velec = _fjsp_mul_v2r8(qq20,rinv20);
464 felec = _fjsp_mul_v2r8(velec,rinvsq20);
466 /* Update potential sum for this i atom from the interaction with this j atom. */
467 velecsum = _fjsp_add_v2r8(velecsum,velec);
471 /* Update vectorial force */
472 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
473 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
474 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
476 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
477 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
478 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 /* COULOMB ELECTROSTATICS */
485 velec = _fjsp_mul_v2r8(qq21,rinv21);
486 felec = _fjsp_mul_v2r8(velec,rinvsq21);
488 /* Update potential sum for this i atom from the interaction with this j atom. */
489 velecsum = _fjsp_add_v2r8(velecsum,velec);
493 /* Update vectorial force */
494 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
495 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
496 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
498 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
499 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
500 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
502 /**************************
503 * CALCULATE INTERACTIONS *
504 **************************/
506 /* COULOMB ELECTROSTATICS */
507 velec = _fjsp_mul_v2r8(qq22,rinv22);
508 felec = _fjsp_mul_v2r8(velec,rinvsq22);
510 /* Update potential sum for this i atom from the interaction with this j atom. */
511 velecsum = _fjsp_add_v2r8(velecsum,velec);
515 /* Update vectorial force */
516 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
517 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
518 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
520 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
521 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
522 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
524 gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
526 /* Inner loop uses 314 flops */
533 j_coord_offsetA = DIM*jnrA;
535 /* load j atom coordinates */
536 gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
537 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
539 /* Calculate displacement vector */
540 dx00 = _fjsp_sub_v2r8(ix0,jx0);
541 dy00 = _fjsp_sub_v2r8(iy0,jy0);
542 dz00 = _fjsp_sub_v2r8(iz0,jz0);
543 dx01 = _fjsp_sub_v2r8(ix0,jx1);
544 dy01 = _fjsp_sub_v2r8(iy0,jy1);
545 dz01 = _fjsp_sub_v2r8(iz0,jz1);
546 dx02 = _fjsp_sub_v2r8(ix0,jx2);
547 dy02 = _fjsp_sub_v2r8(iy0,jy2);
548 dz02 = _fjsp_sub_v2r8(iz0,jz2);
549 dx10 = _fjsp_sub_v2r8(ix1,jx0);
550 dy10 = _fjsp_sub_v2r8(iy1,jy0);
551 dz10 = _fjsp_sub_v2r8(iz1,jz0);
552 dx11 = _fjsp_sub_v2r8(ix1,jx1);
553 dy11 = _fjsp_sub_v2r8(iy1,jy1);
554 dz11 = _fjsp_sub_v2r8(iz1,jz1);
555 dx12 = _fjsp_sub_v2r8(ix1,jx2);
556 dy12 = _fjsp_sub_v2r8(iy1,jy2);
557 dz12 = _fjsp_sub_v2r8(iz1,jz2);
558 dx20 = _fjsp_sub_v2r8(ix2,jx0);
559 dy20 = _fjsp_sub_v2r8(iy2,jy0);
560 dz20 = _fjsp_sub_v2r8(iz2,jz0);
561 dx21 = _fjsp_sub_v2r8(ix2,jx1);
562 dy21 = _fjsp_sub_v2r8(iy2,jy1);
563 dz21 = _fjsp_sub_v2r8(iz2,jz1);
564 dx22 = _fjsp_sub_v2r8(ix2,jx2);
565 dy22 = _fjsp_sub_v2r8(iy2,jy2);
566 dz22 = _fjsp_sub_v2r8(iz2,jz2);
568 /* Calculate squared distance and things based on it */
569 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
570 rsq01 = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
571 rsq02 = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
572 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
573 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
574 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
575 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
576 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
577 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
579 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
580 rinv01 = gmx_fjsp_invsqrt_v2r8(rsq01);
581 rinv02 = gmx_fjsp_invsqrt_v2r8(rsq02);
582 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
583 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
584 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
585 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
586 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
587 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
589 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
590 rinvsq01 = _fjsp_mul_v2r8(rinv01,rinv01);
591 rinvsq02 = _fjsp_mul_v2r8(rinv02,rinv02);
592 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
593 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
594 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
595 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
596 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
597 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
599 fjx0 = _fjsp_setzero_v2r8();
600 fjy0 = _fjsp_setzero_v2r8();
601 fjz0 = _fjsp_setzero_v2r8();
602 fjx1 = _fjsp_setzero_v2r8();
603 fjy1 = _fjsp_setzero_v2r8();
604 fjz1 = _fjsp_setzero_v2r8();
605 fjx2 = _fjsp_setzero_v2r8();
606 fjy2 = _fjsp_setzero_v2r8();
607 fjz2 = _fjsp_setzero_v2r8();
609 /**************************
610 * CALCULATE INTERACTIONS *
611 **************************/
613 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
615 /* Calculate table index by multiplying r with table scale and truncate to integer */
616 rt = _fjsp_mul_v2r8(r00,vftabscale);
617 itab_tmp = _fjsp_dtox_v2r8(rt);
618 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
619 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
620 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
625 /* COULOMB ELECTROSTATICS */
626 velec = _fjsp_mul_v2r8(qq00,rinv00);
627 felec = _fjsp_mul_v2r8(velec,rinvsq00);
629 /* CUBIC SPLINE TABLE DISPERSION */
630 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
631 F = _fjsp_setzero_v2r8();
632 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
633 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
634 H = _fjsp_setzero_v2r8();
635 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
636 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
637 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
638 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
639 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
640 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
642 /* CUBIC SPLINE TABLE REPULSION */
643 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
644 F = _fjsp_setzero_v2r8();
645 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
646 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
647 H = _fjsp_setzero_v2r8();
648 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
649 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
650 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
651 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
652 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
653 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
654 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
655 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
657 /* Update potential sum for this i atom from the interaction with this j atom. */
658 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
659 velecsum = _fjsp_add_v2r8(velecsum,velec);
660 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
661 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
663 fscal = _fjsp_add_v2r8(felec,fvdw);
665 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
667 /* Update vectorial force */
668 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
669 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
670 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
672 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
673 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
674 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
676 /**************************
677 * CALCULATE INTERACTIONS *
678 **************************/
680 /* COULOMB ELECTROSTATICS */
681 velec = _fjsp_mul_v2r8(qq01,rinv01);
682 felec = _fjsp_mul_v2r8(velec,rinvsq01);
684 /* Update potential sum for this i atom from the interaction with this j atom. */
685 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
686 velecsum = _fjsp_add_v2r8(velecsum,velec);
690 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
692 /* Update vectorial force */
693 fix0 = _fjsp_madd_v2r8(dx01,fscal,fix0);
694 fiy0 = _fjsp_madd_v2r8(dy01,fscal,fiy0);
695 fiz0 = _fjsp_madd_v2r8(dz01,fscal,fiz0);
697 fjx1 = _fjsp_madd_v2r8(dx01,fscal,fjx1);
698 fjy1 = _fjsp_madd_v2r8(dy01,fscal,fjy1);
699 fjz1 = _fjsp_madd_v2r8(dz01,fscal,fjz1);
701 /**************************
702 * CALCULATE INTERACTIONS *
703 **************************/
705 /* COULOMB ELECTROSTATICS */
706 velec = _fjsp_mul_v2r8(qq02,rinv02);
707 felec = _fjsp_mul_v2r8(velec,rinvsq02);
709 /* Update potential sum for this i atom from the interaction with this j atom. */
710 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
711 velecsum = _fjsp_add_v2r8(velecsum,velec);
715 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
717 /* Update vectorial force */
718 fix0 = _fjsp_madd_v2r8(dx02,fscal,fix0);
719 fiy0 = _fjsp_madd_v2r8(dy02,fscal,fiy0);
720 fiz0 = _fjsp_madd_v2r8(dz02,fscal,fiz0);
722 fjx2 = _fjsp_madd_v2r8(dx02,fscal,fjx2);
723 fjy2 = _fjsp_madd_v2r8(dy02,fscal,fjy2);
724 fjz2 = _fjsp_madd_v2r8(dz02,fscal,fjz2);
726 /**************************
727 * CALCULATE INTERACTIONS *
728 **************************/
730 /* COULOMB ELECTROSTATICS */
731 velec = _fjsp_mul_v2r8(qq10,rinv10);
732 felec = _fjsp_mul_v2r8(velec,rinvsq10);
734 /* Update potential sum for this i atom from the interaction with this j atom. */
735 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
736 velecsum = _fjsp_add_v2r8(velecsum,velec);
740 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
742 /* Update vectorial force */
743 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
744 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
745 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
747 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
748 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
749 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
751 /**************************
752 * CALCULATE INTERACTIONS *
753 **************************/
755 /* COULOMB ELECTROSTATICS */
756 velec = _fjsp_mul_v2r8(qq11,rinv11);
757 felec = _fjsp_mul_v2r8(velec,rinvsq11);
759 /* Update potential sum for this i atom from the interaction with this j atom. */
760 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
761 velecsum = _fjsp_add_v2r8(velecsum,velec);
765 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
767 /* Update vectorial force */
768 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
769 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
770 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
772 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
773 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
774 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
776 /**************************
777 * CALCULATE INTERACTIONS *
778 **************************/
780 /* COULOMB ELECTROSTATICS */
781 velec = _fjsp_mul_v2r8(qq12,rinv12);
782 felec = _fjsp_mul_v2r8(velec,rinvsq12);
784 /* Update potential sum for this i atom from the interaction with this j atom. */
785 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
786 velecsum = _fjsp_add_v2r8(velecsum,velec);
790 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
792 /* Update vectorial force */
793 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
794 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
795 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
797 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
798 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
799 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
801 /**************************
802 * CALCULATE INTERACTIONS *
803 **************************/
805 /* COULOMB ELECTROSTATICS */
806 velec = _fjsp_mul_v2r8(qq20,rinv20);
807 felec = _fjsp_mul_v2r8(velec,rinvsq20);
809 /* Update potential sum for this i atom from the interaction with this j atom. */
810 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
811 velecsum = _fjsp_add_v2r8(velecsum,velec);
815 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
817 /* Update vectorial force */
818 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
819 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
820 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
822 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
823 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
824 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
826 /**************************
827 * CALCULATE INTERACTIONS *
828 **************************/
830 /* COULOMB ELECTROSTATICS */
831 velec = _fjsp_mul_v2r8(qq21,rinv21);
832 felec = _fjsp_mul_v2r8(velec,rinvsq21);
834 /* Update potential sum for this i atom from the interaction with this j atom. */
835 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
836 velecsum = _fjsp_add_v2r8(velecsum,velec);
840 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
842 /* Update vectorial force */
843 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
844 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
845 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
847 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
848 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
849 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
851 /**************************
852 * CALCULATE INTERACTIONS *
853 **************************/
855 /* COULOMB ELECTROSTATICS */
856 velec = _fjsp_mul_v2r8(qq22,rinv22);
857 felec = _fjsp_mul_v2r8(velec,rinvsq22);
859 /* Update potential sum for this i atom from the interaction with this j atom. */
860 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
861 velecsum = _fjsp_add_v2r8(velecsum,velec);
865 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
867 /* Update vectorial force */
868 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
869 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
870 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
872 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
873 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
874 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
876 gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
878 /* Inner loop uses 314 flops */
881 /* End of innermost loop */
883 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
884 f+i_coord_offset,fshift+i_shift_offset);
887 /* Update potential energies */
888 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
889 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
891 /* Increment number of inner iterations */
892 inneriter += j_index_end - j_index_start;
894 /* Outer loop uses 20 flops */
897 /* Increment number of outer iterations */
900 /* Update outer/inner flops */
902 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*314);
905 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_sparc64_hpc_ace_double
906 * Electrostatics interaction: Coulomb
907 * VdW interaction: CubicSplineTable
908 * Geometry: Water3-Water3
909 * Calculate force/pot: Force
912 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_sparc64_hpc_ace_double
913 (t_nblist * gmx_restrict nlist,
914 rvec * gmx_restrict xx,
915 rvec * gmx_restrict ff,
916 t_forcerec * gmx_restrict fr,
917 t_mdatoms * gmx_restrict mdatoms,
918 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
919 t_nrnb * gmx_restrict nrnb)
921 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
922 * just 0 for non-waters.
923 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
924 * jnr indices corresponding to data put in the four positions in the SIMD register.
926 int i_shift_offset,i_coord_offset,outeriter,inneriter;
927 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
929 int j_coord_offsetA,j_coord_offsetB;
930 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
932 real *shiftvec,*fshift,*x,*f;
933 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
935 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
937 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
939 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
940 int vdwjidx0A,vdwjidx0B;
941 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
942 int vdwjidx1A,vdwjidx1B;
943 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
944 int vdwjidx2A,vdwjidx2B;
945 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
946 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
947 _fjsp_v2r8 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
948 _fjsp_v2r8 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
949 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
950 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
951 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
952 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
953 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
954 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
955 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
958 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
961 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
962 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
963 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
966 _fjsp_v2r8 dummy_mask,cutoff_mask;
967 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
968 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
969 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
976 jindex = nlist->jindex;
978 shiftidx = nlist->shift;
980 shiftvec = fr->shift_vec[0];
981 fshift = fr->fshift[0];
982 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
983 charge = mdatoms->chargeA;
984 nvdwtype = fr->ntype;
986 vdwtype = mdatoms->typeA;
988 vftab = kernel_data->table_vdw->data;
989 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
991 /* Setup water-specific parameters */
992 inr = nlist->iinr[0];
993 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
994 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
995 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
996 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
998 jq0 = gmx_fjsp_set1_v2r8(charge[inr+0]);
999 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
1000 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
1001 vdwjidx0A = 2*vdwtype[inr+0];
1002 qq00 = _fjsp_mul_v2r8(iq0,jq0);
1003 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1004 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1005 qq01 = _fjsp_mul_v2r8(iq0,jq1);
1006 qq02 = _fjsp_mul_v2r8(iq0,jq2);
1007 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1008 qq11 = _fjsp_mul_v2r8(iq1,jq1);
1009 qq12 = _fjsp_mul_v2r8(iq1,jq2);
1010 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1011 qq21 = _fjsp_mul_v2r8(iq2,jq1);
1012 qq22 = _fjsp_mul_v2r8(iq2,jq2);
1014 /* Avoid stupid compiler warnings */
1016 j_coord_offsetA = 0;
1017 j_coord_offsetB = 0;
1022 /* Start outer loop over neighborlists */
1023 for(iidx=0; iidx<nri; iidx++)
1025 /* Load shift vector for this list */
1026 i_shift_offset = DIM*shiftidx[iidx];
1028 /* Load limits for loop over neighbors */
1029 j_index_start = jindex[iidx];
1030 j_index_end = jindex[iidx+1];
1032 /* Get outer coordinate index */
1034 i_coord_offset = DIM*inr;
1036 /* Load i particle coords and add shift vector */
1037 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1038 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
1040 fix0 = _fjsp_setzero_v2r8();
1041 fiy0 = _fjsp_setzero_v2r8();
1042 fiz0 = _fjsp_setzero_v2r8();
1043 fix1 = _fjsp_setzero_v2r8();
1044 fiy1 = _fjsp_setzero_v2r8();
1045 fiz1 = _fjsp_setzero_v2r8();
1046 fix2 = _fjsp_setzero_v2r8();
1047 fiy2 = _fjsp_setzero_v2r8();
1048 fiz2 = _fjsp_setzero_v2r8();
1050 /* Start inner kernel loop */
1051 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1054 /* Get j neighbor index, and coordinate index */
1056 jnrB = jjnr[jidx+1];
1057 j_coord_offsetA = DIM*jnrA;
1058 j_coord_offsetB = DIM*jnrB;
1060 /* load j atom coordinates */
1061 gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1062 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1064 /* Calculate displacement vector */
1065 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1066 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1067 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1068 dx01 = _fjsp_sub_v2r8(ix0,jx1);
1069 dy01 = _fjsp_sub_v2r8(iy0,jy1);
1070 dz01 = _fjsp_sub_v2r8(iz0,jz1);
1071 dx02 = _fjsp_sub_v2r8(ix0,jx2);
1072 dy02 = _fjsp_sub_v2r8(iy0,jy2);
1073 dz02 = _fjsp_sub_v2r8(iz0,jz2);
1074 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1075 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1076 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1077 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1078 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1079 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1080 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1081 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1082 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1083 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1084 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1085 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1086 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1087 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1088 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1089 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1090 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1091 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1093 /* Calculate squared distance and things based on it */
1094 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1095 rsq01 = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1096 rsq02 = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1097 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1098 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1099 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1100 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1101 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1102 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1104 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1105 rinv01 = gmx_fjsp_invsqrt_v2r8(rsq01);
1106 rinv02 = gmx_fjsp_invsqrt_v2r8(rsq02);
1107 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1108 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1109 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1110 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1111 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1112 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1114 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1115 rinvsq01 = _fjsp_mul_v2r8(rinv01,rinv01);
1116 rinvsq02 = _fjsp_mul_v2r8(rinv02,rinv02);
1117 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1118 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1119 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1120 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1121 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1122 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1124 fjx0 = _fjsp_setzero_v2r8();
1125 fjy0 = _fjsp_setzero_v2r8();
1126 fjz0 = _fjsp_setzero_v2r8();
1127 fjx1 = _fjsp_setzero_v2r8();
1128 fjy1 = _fjsp_setzero_v2r8();
1129 fjz1 = _fjsp_setzero_v2r8();
1130 fjx2 = _fjsp_setzero_v2r8();
1131 fjy2 = _fjsp_setzero_v2r8();
1132 fjz2 = _fjsp_setzero_v2r8();
1134 /**************************
1135 * CALCULATE INTERACTIONS *
1136 **************************/
1138 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1140 /* Calculate table index by multiplying r with table scale and truncate to integer */
1141 rt = _fjsp_mul_v2r8(r00,vftabscale);
1142 itab_tmp = _fjsp_dtox_v2r8(rt);
1143 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1144 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1145 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1150 /* COULOMB ELECTROSTATICS */
1151 velec = _fjsp_mul_v2r8(qq00,rinv00);
1152 felec = _fjsp_mul_v2r8(velec,rinvsq00);
1154 /* CUBIC SPLINE TABLE DISPERSION */
1155 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1156 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1157 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1158 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1159 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
1160 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1161 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1162 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1163 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1165 /* CUBIC SPLINE TABLE REPULSION */
1166 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1167 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
1168 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1169 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1170 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
1171 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1172 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1173 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1174 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1175 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1177 fscal = _fjsp_add_v2r8(felec,fvdw);
1179 /* Update vectorial force */
1180 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1181 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1182 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1184 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1185 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1186 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1188 /**************************
1189 * CALCULATE INTERACTIONS *
1190 **************************/
1192 /* COULOMB ELECTROSTATICS */
1193 velec = _fjsp_mul_v2r8(qq01,rinv01);
1194 felec = _fjsp_mul_v2r8(velec,rinvsq01);
1198 /* Update vectorial force */
1199 fix0 = _fjsp_madd_v2r8(dx01,fscal,fix0);
1200 fiy0 = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1201 fiz0 = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1203 fjx1 = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1204 fjy1 = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1205 fjz1 = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1207 /**************************
1208 * CALCULATE INTERACTIONS *
1209 **************************/
1211 /* COULOMB ELECTROSTATICS */
1212 velec = _fjsp_mul_v2r8(qq02,rinv02);
1213 felec = _fjsp_mul_v2r8(velec,rinvsq02);
1217 /* Update vectorial force */
1218 fix0 = _fjsp_madd_v2r8(dx02,fscal,fix0);
1219 fiy0 = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1220 fiz0 = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1222 fjx2 = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1223 fjy2 = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1224 fjz2 = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1226 /**************************
1227 * CALCULATE INTERACTIONS *
1228 **************************/
1230 /* COULOMB ELECTROSTATICS */
1231 velec = _fjsp_mul_v2r8(qq10,rinv10);
1232 felec = _fjsp_mul_v2r8(velec,rinvsq10);
1236 /* Update vectorial force */
1237 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1238 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1239 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1241 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1242 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1243 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1245 /**************************
1246 * CALCULATE INTERACTIONS *
1247 **************************/
1249 /* COULOMB ELECTROSTATICS */
1250 velec = _fjsp_mul_v2r8(qq11,rinv11);
1251 felec = _fjsp_mul_v2r8(velec,rinvsq11);
1255 /* Update vectorial force */
1256 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1257 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1258 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1260 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1261 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1262 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1264 /**************************
1265 * CALCULATE INTERACTIONS *
1266 **************************/
1268 /* COULOMB ELECTROSTATICS */
1269 velec = _fjsp_mul_v2r8(qq12,rinv12);
1270 felec = _fjsp_mul_v2r8(velec,rinvsq12);
1274 /* Update vectorial force */
1275 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1276 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1277 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1279 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1280 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1281 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1283 /**************************
1284 * CALCULATE INTERACTIONS *
1285 **************************/
1287 /* COULOMB ELECTROSTATICS */
1288 velec = _fjsp_mul_v2r8(qq20,rinv20);
1289 felec = _fjsp_mul_v2r8(velec,rinvsq20);
1293 /* Update vectorial force */
1294 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1295 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1296 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1298 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1299 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1300 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1302 /**************************
1303 * CALCULATE INTERACTIONS *
1304 **************************/
1306 /* COULOMB ELECTROSTATICS */
1307 velec = _fjsp_mul_v2r8(qq21,rinv21);
1308 felec = _fjsp_mul_v2r8(velec,rinvsq21);
1312 /* Update vectorial force */
1313 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1314 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1315 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1317 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1318 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1319 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1321 /**************************
1322 * CALCULATE INTERACTIONS *
1323 **************************/
1325 /* COULOMB ELECTROSTATICS */
1326 velec = _fjsp_mul_v2r8(qq22,rinv22);
1327 felec = _fjsp_mul_v2r8(velec,rinvsq22);
1331 /* Update vectorial force */
1332 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1333 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1334 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1336 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1337 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1338 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1340 gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1342 /* Inner loop uses 297 flops */
1345 if(jidx<j_index_end)
1349 j_coord_offsetA = DIM*jnrA;
1351 /* load j atom coordinates */
1352 gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1353 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1355 /* Calculate displacement vector */
1356 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1357 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1358 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1359 dx01 = _fjsp_sub_v2r8(ix0,jx1);
1360 dy01 = _fjsp_sub_v2r8(iy0,jy1);
1361 dz01 = _fjsp_sub_v2r8(iz0,jz1);
1362 dx02 = _fjsp_sub_v2r8(ix0,jx2);
1363 dy02 = _fjsp_sub_v2r8(iy0,jy2);
1364 dz02 = _fjsp_sub_v2r8(iz0,jz2);
1365 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1366 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1367 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1368 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1369 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1370 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1371 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1372 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1373 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1374 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1375 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1376 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1377 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1378 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1379 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1380 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1381 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1382 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1384 /* Calculate squared distance and things based on it */
1385 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1386 rsq01 = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1387 rsq02 = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1388 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1389 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1390 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1391 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1392 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1393 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1395 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1396 rinv01 = gmx_fjsp_invsqrt_v2r8(rsq01);
1397 rinv02 = gmx_fjsp_invsqrt_v2r8(rsq02);
1398 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1399 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1400 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1401 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1402 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1403 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1405 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1406 rinvsq01 = _fjsp_mul_v2r8(rinv01,rinv01);
1407 rinvsq02 = _fjsp_mul_v2r8(rinv02,rinv02);
1408 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1409 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1410 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1411 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1412 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1413 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1415 fjx0 = _fjsp_setzero_v2r8();
1416 fjy0 = _fjsp_setzero_v2r8();
1417 fjz0 = _fjsp_setzero_v2r8();
1418 fjx1 = _fjsp_setzero_v2r8();
1419 fjy1 = _fjsp_setzero_v2r8();
1420 fjz1 = _fjsp_setzero_v2r8();
1421 fjx2 = _fjsp_setzero_v2r8();
1422 fjy2 = _fjsp_setzero_v2r8();
1423 fjz2 = _fjsp_setzero_v2r8();
1425 /**************************
1426 * CALCULATE INTERACTIONS *
1427 **************************/
1429 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1431 /* Calculate table index by multiplying r with table scale and truncate to integer */
1432 rt = _fjsp_mul_v2r8(r00,vftabscale);
1433 itab_tmp = _fjsp_dtox_v2r8(rt);
1434 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1435 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1436 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1441 /* COULOMB ELECTROSTATICS */
1442 velec = _fjsp_mul_v2r8(qq00,rinv00);
1443 felec = _fjsp_mul_v2r8(velec,rinvsq00);
1445 /* CUBIC SPLINE TABLE DISPERSION */
1446 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1447 F = _fjsp_setzero_v2r8();
1448 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1449 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1450 H = _fjsp_setzero_v2r8();
1451 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1452 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1453 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1454 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1456 /* CUBIC SPLINE TABLE REPULSION */
1457 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1458 F = _fjsp_setzero_v2r8();
1459 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1460 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1461 H = _fjsp_setzero_v2r8();
1462 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1463 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1464 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1465 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1466 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1468 fscal = _fjsp_add_v2r8(felec,fvdw);
1470 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1472 /* Update vectorial force */
1473 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1474 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1475 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1477 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1478 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1479 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1481 /**************************
1482 * CALCULATE INTERACTIONS *
1483 **************************/
1485 /* COULOMB ELECTROSTATICS */
1486 velec = _fjsp_mul_v2r8(qq01,rinv01);
1487 felec = _fjsp_mul_v2r8(velec,rinvsq01);
1491 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1493 /* Update vectorial force */
1494 fix0 = _fjsp_madd_v2r8(dx01,fscal,fix0);
1495 fiy0 = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1496 fiz0 = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1498 fjx1 = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1499 fjy1 = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1500 fjz1 = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1502 /**************************
1503 * CALCULATE INTERACTIONS *
1504 **************************/
1506 /* COULOMB ELECTROSTATICS */
1507 velec = _fjsp_mul_v2r8(qq02,rinv02);
1508 felec = _fjsp_mul_v2r8(velec,rinvsq02);
1512 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1514 /* Update vectorial force */
1515 fix0 = _fjsp_madd_v2r8(dx02,fscal,fix0);
1516 fiy0 = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1517 fiz0 = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1519 fjx2 = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1520 fjy2 = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1521 fjz2 = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1523 /**************************
1524 * CALCULATE INTERACTIONS *
1525 **************************/
1527 /* COULOMB ELECTROSTATICS */
1528 velec = _fjsp_mul_v2r8(qq10,rinv10);
1529 felec = _fjsp_mul_v2r8(velec,rinvsq10);
1533 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1535 /* Update vectorial force */
1536 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1537 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1538 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1540 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1541 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1542 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1544 /**************************
1545 * CALCULATE INTERACTIONS *
1546 **************************/
1548 /* COULOMB ELECTROSTATICS */
1549 velec = _fjsp_mul_v2r8(qq11,rinv11);
1550 felec = _fjsp_mul_v2r8(velec,rinvsq11);
1554 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1556 /* Update vectorial force */
1557 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1558 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1559 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1561 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1562 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1563 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1565 /**************************
1566 * CALCULATE INTERACTIONS *
1567 **************************/
1569 /* COULOMB ELECTROSTATICS */
1570 velec = _fjsp_mul_v2r8(qq12,rinv12);
1571 felec = _fjsp_mul_v2r8(velec,rinvsq12);
1575 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1577 /* Update vectorial force */
1578 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1579 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1580 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1582 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1583 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1584 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1586 /**************************
1587 * CALCULATE INTERACTIONS *
1588 **************************/
1590 /* COULOMB ELECTROSTATICS */
1591 velec = _fjsp_mul_v2r8(qq20,rinv20);
1592 felec = _fjsp_mul_v2r8(velec,rinvsq20);
1596 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1598 /* Update vectorial force */
1599 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1600 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1601 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1603 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1604 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1605 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1607 /**************************
1608 * CALCULATE INTERACTIONS *
1609 **************************/
1611 /* COULOMB ELECTROSTATICS */
1612 velec = _fjsp_mul_v2r8(qq21,rinv21);
1613 felec = _fjsp_mul_v2r8(velec,rinvsq21);
1617 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1619 /* Update vectorial force */
1620 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1621 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1622 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1624 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1625 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1626 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1628 /**************************
1629 * CALCULATE INTERACTIONS *
1630 **************************/
1632 /* COULOMB ELECTROSTATICS */
1633 velec = _fjsp_mul_v2r8(qq22,rinv22);
1634 felec = _fjsp_mul_v2r8(velec,rinvsq22);
1638 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1640 /* Update vectorial force */
1641 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1642 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1643 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1645 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1646 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1647 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1649 gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1651 /* Inner loop uses 297 flops */
1654 /* End of innermost loop */
1656 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1657 f+i_coord_offset,fshift+i_shift_offset);
1659 /* Increment number of inner iterations */
1660 inneriter += j_index_end - j_index_start;
1662 /* Outer loop uses 18 flops */
1665 /* Increment number of outer iterations */
1668 /* Update outer/inner flops */
1670 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*297);