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_GeomW4W4_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water4-Water4
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwCSTab_GeomW4W4_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;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 int vdwjidx1A,vdwjidx1B;
92 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
93 int vdwjidx2A,vdwjidx2B;
94 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
95 int vdwjidx3A,vdwjidx3B;
96 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
97 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
98 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
99 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
100 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
101 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
102 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
103 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
104 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
105 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
106 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
107 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
110 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
113 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
114 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
115 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
118 _fjsp_v2r8 dummy_mask,cutoff_mask;
119 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
120 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
121 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
128 jindex = nlist->jindex;
130 shiftidx = nlist->shift;
132 shiftvec = fr->shift_vec[0];
133 fshift = fr->fshift[0];
134 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
135 charge = mdatoms->chargeA;
136 nvdwtype = fr->ntype;
138 vdwtype = mdatoms->typeA;
140 vftab = kernel_data->table_vdw->data;
141 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
143 /* Setup water-specific parameters */
144 inr = nlist->iinr[0];
145 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
146 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
147 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
148 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
150 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
151 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
152 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
153 vdwjidx0A = 2*vdwtype[inr+0];
154 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
155 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
156 qq11 = _fjsp_mul_v2r8(iq1,jq1);
157 qq12 = _fjsp_mul_v2r8(iq1,jq2);
158 qq13 = _fjsp_mul_v2r8(iq1,jq3);
159 qq21 = _fjsp_mul_v2r8(iq2,jq1);
160 qq22 = _fjsp_mul_v2r8(iq2,jq2);
161 qq23 = _fjsp_mul_v2r8(iq2,jq3);
162 qq31 = _fjsp_mul_v2r8(iq3,jq1);
163 qq32 = _fjsp_mul_v2r8(iq3,jq2);
164 qq33 = _fjsp_mul_v2r8(iq3,jq3);
166 /* Avoid stupid compiler warnings */
174 /* Start outer loop over neighborlists */
175 for(iidx=0; iidx<nri; iidx++)
177 /* Load shift vector for this list */
178 i_shift_offset = DIM*shiftidx[iidx];
180 /* Load limits for loop over neighbors */
181 j_index_start = jindex[iidx];
182 j_index_end = jindex[iidx+1];
184 /* Get outer coordinate index */
186 i_coord_offset = DIM*inr;
188 /* Load i particle coords and add shift vector */
189 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
190 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
192 fix0 = _fjsp_setzero_v2r8();
193 fiy0 = _fjsp_setzero_v2r8();
194 fiz0 = _fjsp_setzero_v2r8();
195 fix1 = _fjsp_setzero_v2r8();
196 fiy1 = _fjsp_setzero_v2r8();
197 fiz1 = _fjsp_setzero_v2r8();
198 fix2 = _fjsp_setzero_v2r8();
199 fiy2 = _fjsp_setzero_v2r8();
200 fiz2 = _fjsp_setzero_v2r8();
201 fix3 = _fjsp_setzero_v2r8();
202 fiy3 = _fjsp_setzero_v2r8();
203 fiz3 = _fjsp_setzero_v2r8();
205 /* Reset potential sums */
206 velecsum = _fjsp_setzero_v2r8();
207 vvdwsum = _fjsp_setzero_v2r8();
209 /* Start inner kernel loop */
210 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
213 /* Get j neighbor index, and coordinate index */
216 j_coord_offsetA = DIM*jnrA;
217 j_coord_offsetB = DIM*jnrB;
219 /* load j atom coordinates */
220 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
221 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
222 &jy2,&jz2,&jx3,&jy3,&jz3);
224 /* Calculate displacement vector */
225 dx00 = _fjsp_sub_v2r8(ix0,jx0);
226 dy00 = _fjsp_sub_v2r8(iy0,jy0);
227 dz00 = _fjsp_sub_v2r8(iz0,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 dx13 = _fjsp_sub_v2r8(ix1,jx3);
235 dy13 = _fjsp_sub_v2r8(iy1,jy3);
236 dz13 = _fjsp_sub_v2r8(iz1,jz3);
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);
243 dx23 = _fjsp_sub_v2r8(ix2,jx3);
244 dy23 = _fjsp_sub_v2r8(iy2,jy3);
245 dz23 = _fjsp_sub_v2r8(iz2,jz3);
246 dx31 = _fjsp_sub_v2r8(ix3,jx1);
247 dy31 = _fjsp_sub_v2r8(iy3,jy1);
248 dz31 = _fjsp_sub_v2r8(iz3,jz1);
249 dx32 = _fjsp_sub_v2r8(ix3,jx2);
250 dy32 = _fjsp_sub_v2r8(iy3,jy2);
251 dz32 = _fjsp_sub_v2r8(iz3,jz2);
252 dx33 = _fjsp_sub_v2r8(ix3,jx3);
253 dy33 = _fjsp_sub_v2r8(iy3,jy3);
254 dz33 = _fjsp_sub_v2r8(iz3,jz3);
256 /* Calculate squared distance and things based on it */
257 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
258 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
259 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
260 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
261 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
262 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
263 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
264 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
265 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
266 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
268 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
269 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
270 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
271 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
272 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
273 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
274 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
275 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
276 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
277 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
279 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
280 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
281 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
282 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
283 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
284 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
285 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
286 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
287 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
289 fjx0 = _fjsp_setzero_v2r8();
290 fjy0 = _fjsp_setzero_v2r8();
291 fjz0 = _fjsp_setzero_v2r8();
292 fjx1 = _fjsp_setzero_v2r8();
293 fjy1 = _fjsp_setzero_v2r8();
294 fjz1 = _fjsp_setzero_v2r8();
295 fjx2 = _fjsp_setzero_v2r8();
296 fjy2 = _fjsp_setzero_v2r8();
297 fjz2 = _fjsp_setzero_v2r8();
298 fjx3 = _fjsp_setzero_v2r8();
299 fjy3 = _fjsp_setzero_v2r8();
300 fjz3 = _fjsp_setzero_v2r8();
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
308 /* Calculate table index by multiplying r with table scale and truncate to integer */
309 rt = _fjsp_mul_v2r8(r00,vftabscale);
310 itab_tmp = _fjsp_dtox_v2r8(rt);
311 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
312 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
313 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
318 /* CUBIC SPLINE TABLE DISPERSION */
319 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
320 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
321 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
322 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
323 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
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 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
328 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
329 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
331 /* CUBIC SPLINE TABLE REPULSION */
332 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
333 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
334 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
335 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
336 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
337 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
338 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
339 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
340 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
341 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
342 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
343 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
344 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
346 /* Update potential sum for this i atom from the interaction with this j atom. */
347 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
351 /* Update vectorial force */
352 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
353 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
354 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
356 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
357 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
358 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
360 /**************************
361 * CALCULATE INTERACTIONS *
362 **************************/
364 /* COULOMB ELECTROSTATICS */
365 velec = _fjsp_mul_v2r8(qq11,rinv11);
366 felec = _fjsp_mul_v2r8(velec,rinvsq11);
368 /* Update potential sum for this i atom from the interaction with this j atom. */
369 velecsum = _fjsp_add_v2r8(velecsum,velec);
373 /* Update vectorial force */
374 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
375 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
376 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
378 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
379 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
380 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 /* COULOMB ELECTROSTATICS */
387 velec = _fjsp_mul_v2r8(qq12,rinv12);
388 felec = _fjsp_mul_v2r8(velec,rinvsq12);
390 /* Update potential sum for this i atom from the interaction with this j atom. */
391 velecsum = _fjsp_add_v2r8(velecsum,velec);
395 /* Update vectorial force */
396 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
397 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
398 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
400 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
401 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
402 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
404 /**************************
405 * CALCULATE INTERACTIONS *
406 **************************/
408 /* COULOMB ELECTROSTATICS */
409 velec = _fjsp_mul_v2r8(qq13,rinv13);
410 felec = _fjsp_mul_v2r8(velec,rinvsq13);
412 /* Update potential sum for this i atom from the interaction with this j atom. */
413 velecsum = _fjsp_add_v2r8(velecsum,velec);
417 /* Update vectorial force */
418 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
419 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
420 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
422 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
423 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
424 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
426 /**************************
427 * CALCULATE INTERACTIONS *
428 **************************/
430 /* COULOMB ELECTROSTATICS */
431 velec = _fjsp_mul_v2r8(qq21,rinv21);
432 felec = _fjsp_mul_v2r8(velec,rinvsq21);
434 /* Update potential sum for this i atom from the interaction with this j atom. */
435 velecsum = _fjsp_add_v2r8(velecsum,velec);
439 /* Update vectorial force */
440 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
441 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
442 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
444 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
445 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
446 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
448 /**************************
449 * CALCULATE INTERACTIONS *
450 **************************/
452 /* COULOMB ELECTROSTATICS */
453 velec = _fjsp_mul_v2r8(qq22,rinv22);
454 felec = _fjsp_mul_v2r8(velec,rinvsq22);
456 /* Update potential sum for this i atom from the interaction with this j atom. */
457 velecsum = _fjsp_add_v2r8(velecsum,velec);
461 /* Update vectorial force */
462 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
463 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
464 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
466 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
467 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
468 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
470 /**************************
471 * CALCULATE INTERACTIONS *
472 **************************/
474 /* COULOMB ELECTROSTATICS */
475 velec = _fjsp_mul_v2r8(qq23,rinv23);
476 felec = _fjsp_mul_v2r8(velec,rinvsq23);
478 /* Update potential sum for this i atom from the interaction with this j atom. */
479 velecsum = _fjsp_add_v2r8(velecsum,velec);
483 /* Update vectorial force */
484 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
485 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
486 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
488 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
489 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
490 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
492 /**************************
493 * CALCULATE INTERACTIONS *
494 **************************/
496 /* COULOMB ELECTROSTATICS */
497 velec = _fjsp_mul_v2r8(qq31,rinv31);
498 felec = _fjsp_mul_v2r8(velec,rinvsq31);
500 /* Update potential sum for this i atom from the interaction with this j atom. */
501 velecsum = _fjsp_add_v2r8(velecsum,velec);
505 /* Update vectorial force */
506 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
507 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
508 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
510 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
511 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
512 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
514 /**************************
515 * CALCULATE INTERACTIONS *
516 **************************/
518 /* COULOMB ELECTROSTATICS */
519 velec = _fjsp_mul_v2r8(qq32,rinv32);
520 felec = _fjsp_mul_v2r8(velec,rinvsq32);
522 /* Update potential sum for this i atom from the interaction with this j atom. */
523 velecsum = _fjsp_add_v2r8(velecsum,velec);
527 /* Update vectorial force */
528 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
529 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
530 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
532 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
533 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
534 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
536 /**************************
537 * CALCULATE INTERACTIONS *
538 **************************/
540 /* COULOMB ELECTROSTATICS */
541 velec = _fjsp_mul_v2r8(qq33,rinv33);
542 felec = _fjsp_mul_v2r8(velec,rinvsq33);
544 /* Update potential sum for this i atom from the interaction with this j atom. */
545 velecsum = _fjsp_add_v2r8(velecsum,velec);
549 /* Update vectorial force */
550 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
551 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
552 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
554 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
555 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
556 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
558 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
560 /* Inner loop uses 341 flops */
567 j_coord_offsetA = DIM*jnrA;
569 /* load j atom coordinates */
570 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
571 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
572 &jy2,&jz2,&jx3,&jy3,&jz3);
574 /* Calculate displacement vector */
575 dx00 = _fjsp_sub_v2r8(ix0,jx0);
576 dy00 = _fjsp_sub_v2r8(iy0,jy0);
577 dz00 = _fjsp_sub_v2r8(iz0,jz0);
578 dx11 = _fjsp_sub_v2r8(ix1,jx1);
579 dy11 = _fjsp_sub_v2r8(iy1,jy1);
580 dz11 = _fjsp_sub_v2r8(iz1,jz1);
581 dx12 = _fjsp_sub_v2r8(ix1,jx2);
582 dy12 = _fjsp_sub_v2r8(iy1,jy2);
583 dz12 = _fjsp_sub_v2r8(iz1,jz2);
584 dx13 = _fjsp_sub_v2r8(ix1,jx3);
585 dy13 = _fjsp_sub_v2r8(iy1,jy3);
586 dz13 = _fjsp_sub_v2r8(iz1,jz3);
587 dx21 = _fjsp_sub_v2r8(ix2,jx1);
588 dy21 = _fjsp_sub_v2r8(iy2,jy1);
589 dz21 = _fjsp_sub_v2r8(iz2,jz1);
590 dx22 = _fjsp_sub_v2r8(ix2,jx2);
591 dy22 = _fjsp_sub_v2r8(iy2,jy2);
592 dz22 = _fjsp_sub_v2r8(iz2,jz2);
593 dx23 = _fjsp_sub_v2r8(ix2,jx3);
594 dy23 = _fjsp_sub_v2r8(iy2,jy3);
595 dz23 = _fjsp_sub_v2r8(iz2,jz3);
596 dx31 = _fjsp_sub_v2r8(ix3,jx1);
597 dy31 = _fjsp_sub_v2r8(iy3,jy1);
598 dz31 = _fjsp_sub_v2r8(iz3,jz1);
599 dx32 = _fjsp_sub_v2r8(ix3,jx2);
600 dy32 = _fjsp_sub_v2r8(iy3,jy2);
601 dz32 = _fjsp_sub_v2r8(iz3,jz2);
602 dx33 = _fjsp_sub_v2r8(ix3,jx3);
603 dy33 = _fjsp_sub_v2r8(iy3,jy3);
604 dz33 = _fjsp_sub_v2r8(iz3,jz3);
606 /* Calculate squared distance and things based on it */
607 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
608 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
609 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
610 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
611 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
612 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
613 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
614 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
615 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
616 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
618 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
619 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
620 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
621 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
622 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
623 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
624 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
625 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
626 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
627 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
629 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
630 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
631 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
632 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
633 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
634 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
635 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
636 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
637 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
639 fjx0 = _fjsp_setzero_v2r8();
640 fjy0 = _fjsp_setzero_v2r8();
641 fjz0 = _fjsp_setzero_v2r8();
642 fjx1 = _fjsp_setzero_v2r8();
643 fjy1 = _fjsp_setzero_v2r8();
644 fjz1 = _fjsp_setzero_v2r8();
645 fjx2 = _fjsp_setzero_v2r8();
646 fjy2 = _fjsp_setzero_v2r8();
647 fjz2 = _fjsp_setzero_v2r8();
648 fjx3 = _fjsp_setzero_v2r8();
649 fjy3 = _fjsp_setzero_v2r8();
650 fjz3 = _fjsp_setzero_v2r8();
652 /**************************
653 * CALCULATE INTERACTIONS *
654 **************************/
656 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
658 /* Calculate table index by multiplying r with table scale and truncate to integer */
659 rt = _fjsp_mul_v2r8(r00,vftabscale);
660 itab_tmp = _fjsp_dtox_v2r8(rt);
661 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
662 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
663 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
668 /* CUBIC SPLINE TABLE DISPERSION */
669 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
670 F = _fjsp_setzero_v2r8();
671 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
672 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
673 H = _fjsp_setzero_v2r8();
674 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
675 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
676 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
677 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
678 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
679 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
681 /* CUBIC SPLINE TABLE REPULSION */
682 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
683 F = _fjsp_setzero_v2r8();
684 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
685 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
686 H = _fjsp_setzero_v2r8();
687 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
688 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
689 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
690 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
691 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
692 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
693 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
694 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
696 /* Update potential sum for this i atom from the interaction with this j atom. */
697 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
698 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
702 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
704 /* Update vectorial force */
705 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
706 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
707 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
709 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
710 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
711 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
713 /**************************
714 * CALCULATE INTERACTIONS *
715 **************************/
717 /* COULOMB ELECTROSTATICS */
718 velec = _fjsp_mul_v2r8(qq11,rinv11);
719 felec = _fjsp_mul_v2r8(velec,rinvsq11);
721 /* Update potential sum for this i atom from the interaction with this j atom. */
722 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
723 velecsum = _fjsp_add_v2r8(velecsum,velec);
727 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
729 /* Update vectorial force */
730 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
731 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
732 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
734 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
735 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
736 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
738 /**************************
739 * CALCULATE INTERACTIONS *
740 **************************/
742 /* COULOMB ELECTROSTATICS */
743 velec = _fjsp_mul_v2r8(qq12,rinv12);
744 felec = _fjsp_mul_v2r8(velec,rinvsq12);
746 /* Update potential sum for this i atom from the interaction with this j atom. */
747 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
748 velecsum = _fjsp_add_v2r8(velecsum,velec);
752 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
754 /* Update vectorial force */
755 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
756 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
757 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
759 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
760 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
761 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
763 /**************************
764 * CALCULATE INTERACTIONS *
765 **************************/
767 /* COULOMB ELECTROSTATICS */
768 velec = _fjsp_mul_v2r8(qq13,rinv13);
769 felec = _fjsp_mul_v2r8(velec,rinvsq13);
771 /* Update potential sum for this i atom from the interaction with this j atom. */
772 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
773 velecsum = _fjsp_add_v2r8(velecsum,velec);
777 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
779 /* Update vectorial force */
780 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
781 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
782 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
784 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
785 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
786 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
788 /**************************
789 * CALCULATE INTERACTIONS *
790 **************************/
792 /* COULOMB ELECTROSTATICS */
793 velec = _fjsp_mul_v2r8(qq21,rinv21);
794 felec = _fjsp_mul_v2r8(velec,rinvsq21);
796 /* Update potential sum for this i atom from the interaction with this j atom. */
797 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
798 velecsum = _fjsp_add_v2r8(velecsum,velec);
802 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
804 /* Update vectorial force */
805 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
806 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
807 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
809 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
810 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
811 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
813 /**************************
814 * CALCULATE INTERACTIONS *
815 **************************/
817 /* COULOMB ELECTROSTATICS */
818 velec = _fjsp_mul_v2r8(qq22,rinv22);
819 felec = _fjsp_mul_v2r8(velec,rinvsq22);
821 /* Update potential sum for this i atom from the interaction with this j atom. */
822 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
823 velecsum = _fjsp_add_v2r8(velecsum,velec);
827 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
829 /* Update vectorial force */
830 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
831 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
832 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
834 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
835 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
836 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
838 /**************************
839 * CALCULATE INTERACTIONS *
840 **************************/
842 /* COULOMB ELECTROSTATICS */
843 velec = _fjsp_mul_v2r8(qq23,rinv23);
844 felec = _fjsp_mul_v2r8(velec,rinvsq23);
846 /* Update potential sum for this i atom from the interaction with this j atom. */
847 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
848 velecsum = _fjsp_add_v2r8(velecsum,velec);
852 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
854 /* Update vectorial force */
855 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
856 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
857 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
859 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
860 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
861 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
863 /**************************
864 * CALCULATE INTERACTIONS *
865 **************************/
867 /* COULOMB ELECTROSTATICS */
868 velec = _fjsp_mul_v2r8(qq31,rinv31);
869 felec = _fjsp_mul_v2r8(velec,rinvsq31);
871 /* Update potential sum for this i atom from the interaction with this j atom. */
872 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
873 velecsum = _fjsp_add_v2r8(velecsum,velec);
877 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
879 /* Update vectorial force */
880 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
881 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
882 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
884 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
885 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
886 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
892 /* COULOMB ELECTROSTATICS */
893 velec = _fjsp_mul_v2r8(qq32,rinv32);
894 felec = _fjsp_mul_v2r8(velec,rinvsq32);
896 /* Update potential sum for this i atom from the interaction with this j atom. */
897 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
898 velecsum = _fjsp_add_v2r8(velecsum,velec);
902 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
904 /* Update vectorial force */
905 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
906 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
907 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
909 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
910 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
911 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
913 /**************************
914 * CALCULATE INTERACTIONS *
915 **************************/
917 /* COULOMB ELECTROSTATICS */
918 velec = _fjsp_mul_v2r8(qq33,rinv33);
919 felec = _fjsp_mul_v2r8(velec,rinvsq33);
921 /* Update potential sum for this i atom from the interaction with this j atom. */
922 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
923 velecsum = _fjsp_add_v2r8(velecsum,velec);
927 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
929 /* Update vectorial force */
930 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
931 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
932 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
934 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
935 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
936 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
938 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
940 /* Inner loop uses 341 flops */
943 /* End of innermost loop */
945 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
946 f+i_coord_offset,fshift+i_shift_offset);
949 /* Update potential energies */
950 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
951 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
953 /* Increment number of inner iterations */
954 inneriter += j_index_end - j_index_start;
956 /* Outer loop uses 26 flops */
959 /* Increment number of outer iterations */
962 /* Update outer/inner flops */
964 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*341);
967 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW4W4_F_sparc64_hpc_ace_double
968 * Electrostatics interaction: Coulomb
969 * VdW interaction: CubicSplineTable
970 * Geometry: Water4-Water4
971 * Calculate force/pot: Force
974 nb_kernel_ElecCoul_VdwCSTab_GeomW4W4_F_sparc64_hpc_ace_double
975 (t_nblist * gmx_restrict nlist,
976 rvec * gmx_restrict xx,
977 rvec * gmx_restrict ff,
978 t_forcerec * gmx_restrict fr,
979 t_mdatoms * gmx_restrict mdatoms,
980 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
981 t_nrnb * gmx_restrict nrnb)
983 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
984 * just 0 for non-waters.
985 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
986 * jnr indices corresponding to data put in the four positions in the SIMD register.
988 int i_shift_offset,i_coord_offset,outeriter,inneriter;
989 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
991 int j_coord_offsetA,j_coord_offsetB;
992 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
994 real *shiftvec,*fshift,*x,*f;
995 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
997 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
999 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1001 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1003 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
1004 int vdwjidx0A,vdwjidx0B;
1005 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1006 int vdwjidx1A,vdwjidx1B;
1007 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1008 int vdwjidx2A,vdwjidx2B;
1009 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1010 int vdwjidx3A,vdwjidx3B;
1011 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
1012 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1013 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1014 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1015 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
1016 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1017 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1018 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
1019 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
1020 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
1021 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
1022 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
1025 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1028 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
1029 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1030 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
1032 _fjsp_v2r8 itab_tmp;
1033 _fjsp_v2r8 dummy_mask,cutoff_mask;
1034 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
1035 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
1036 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1043 jindex = nlist->jindex;
1045 shiftidx = nlist->shift;
1047 shiftvec = fr->shift_vec[0];
1048 fshift = fr->fshift[0];
1049 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
1050 charge = mdatoms->chargeA;
1051 nvdwtype = fr->ntype;
1052 vdwparam = fr->nbfp;
1053 vdwtype = mdatoms->typeA;
1055 vftab = kernel_data->table_vdw->data;
1056 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
1058 /* Setup water-specific parameters */
1059 inr = nlist->iinr[0];
1060 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1061 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1062 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
1063 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
1065 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
1066 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
1067 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
1068 vdwjidx0A = 2*vdwtype[inr+0];
1069 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1070 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1071 qq11 = _fjsp_mul_v2r8(iq1,jq1);
1072 qq12 = _fjsp_mul_v2r8(iq1,jq2);
1073 qq13 = _fjsp_mul_v2r8(iq1,jq3);
1074 qq21 = _fjsp_mul_v2r8(iq2,jq1);
1075 qq22 = _fjsp_mul_v2r8(iq2,jq2);
1076 qq23 = _fjsp_mul_v2r8(iq2,jq3);
1077 qq31 = _fjsp_mul_v2r8(iq3,jq1);
1078 qq32 = _fjsp_mul_v2r8(iq3,jq2);
1079 qq33 = _fjsp_mul_v2r8(iq3,jq3);
1081 /* Avoid stupid compiler warnings */
1083 j_coord_offsetA = 0;
1084 j_coord_offsetB = 0;
1089 /* Start outer loop over neighborlists */
1090 for(iidx=0; iidx<nri; iidx++)
1092 /* Load shift vector for this list */
1093 i_shift_offset = DIM*shiftidx[iidx];
1095 /* Load limits for loop over neighbors */
1096 j_index_start = jindex[iidx];
1097 j_index_end = jindex[iidx+1];
1099 /* Get outer coordinate index */
1101 i_coord_offset = DIM*inr;
1103 /* Load i particle coords and add shift vector */
1104 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1105 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1107 fix0 = _fjsp_setzero_v2r8();
1108 fiy0 = _fjsp_setzero_v2r8();
1109 fiz0 = _fjsp_setzero_v2r8();
1110 fix1 = _fjsp_setzero_v2r8();
1111 fiy1 = _fjsp_setzero_v2r8();
1112 fiz1 = _fjsp_setzero_v2r8();
1113 fix2 = _fjsp_setzero_v2r8();
1114 fiy2 = _fjsp_setzero_v2r8();
1115 fiz2 = _fjsp_setzero_v2r8();
1116 fix3 = _fjsp_setzero_v2r8();
1117 fiy3 = _fjsp_setzero_v2r8();
1118 fiz3 = _fjsp_setzero_v2r8();
1120 /* Start inner kernel loop */
1121 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1124 /* Get j neighbor index, and coordinate index */
1126 jnrB = jjnr[jidx+1];
1127 j_coord_offsetA = DIM*jnrA;
1128 j_coord_offsetB = DIM*jnrB;
1130 /* load j atom coordinates */
1131 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1132 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1133 &jy2,&jz2,&jx3,&jy3,&jz3);
1135 /* Calculate displacement vector */
1136 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1137 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1138 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1139 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1140 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1141 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1142 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1143 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1144 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1145 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1146 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1147 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1148 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1149 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1150 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1151 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1152 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1153 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1154 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1155 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1156 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1157 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1158 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1159 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1160 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1161 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1162 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1163 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1164 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1165 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1167 /* Calculate squared distance and things based on it */
1168 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1169 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1170 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1171 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1172 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1173 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1174 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1175 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1176 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1177 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1179 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1180 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1181 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1182 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1183 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1184 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1185 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1186 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1187 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1188 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1190 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1191 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1192 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1193 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1194 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1195 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1196 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1197 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1198 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1200 fjx0 = _fjsp_setzero_v2r8();
1201 fjy0 = _fjsp_setzero_v2r8();
1202 fjz0 = _fjsp_setzero_v2r8();
1203 fjx1 = _fjsp_setzero_v2r8();
1204 fjy1 = _fjsp_setzero_v2r8();
1205 fjz1 = _fjsp_setzero_v2r8();
1206 fjx2 = _fjsp_setzero_v2r8();
1207 fjy2 = _fjsp_setzero_v2r8();
1208 fjz2 = _fjsp_setzero_v2r8();
1209 fjx3 = _fjsp_setzero_v2r8();
1210 fjy3 = _fjsp_setzero_v2r8();
1211 fjz3 = _fjsp_setzero_v2r8();
1213 /**************************
1214 * CALCULATE INTERACTIONS *
1215 **************************/
1217 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1219 /* Calculate table index by multiplying r with table scale and truncate to integer */
1220 rt = _fjsp_mul_v2r8(r00,vftabscale);
1221 itab_tmp = _fjsp_dtox_v2r8(rt);
1222 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1223 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1224 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1229 /* CUBIC SPLINE TABLE DISPERSION */
1230 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1231 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1232 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1233 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1234 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
1235 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1236 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1237 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1238 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1240 /* CUBIC SPLINE TABLE REPULSION */
1241 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1242 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
1243 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1244 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1245 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
1246 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1247 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1248 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1249 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1250 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1254 /* Update vectorial force */
1255 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1256 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1257 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1259 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1260 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1261 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1263 /**************************
1264 * CALCULATE INTERACTIONS *
1265 **************************/
1267 /* COULOMB ELECTROSTATICS */
1268 velec = _fjsp_mul_v2r8(qq11,rinv11);
1269 felec = _fjsp_mul_v2r8(velec,rinvsq11);
1273 /* Update vectorial force */
1274 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1275 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1276 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1278 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1279 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1280 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1282 /**************************
1283 * CALCULATE INTERACTIONS *
1284 **************************/
1286 /* COULOMB ELECTROSTATICS */
1287 velec = _fjsp_mul_v2r8(qq12,rinv12);
1288 felec = _fjsp_mul_v2r8(velec,rinvsq12);
1292 /* Update vectorial force */
1293 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1294 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1295 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1297 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1298 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1299 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1301 /**************************
1302 * CALCULATE INTERACTIONS *
1303 **************************/
1305 /* COULOMB ELECTROSTATICS */
1306 velec = _fjsp_mul_v2r8(qq13,rinv13);
1307 felec = _fjsp_mul_v2r8(velec,rinvsq13);
1311 /* Update vectorial force */
1312 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1313 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1314 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1316 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1317 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1318 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1320 /**************************
1321 * CALCULATE INTERACTIONS *
1322 **************************/
1324 /* COULOMB ELECTROSTATICS */
1325 velec = _fjsp_mul_v2r8(qq21,rinv21);
1326 felec = _fjsp_mul_v2r8(velec,rinvsq21);
1330 /* Update vectorial force */
1331 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1332 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1333 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1335 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1336 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1337 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1339 /**************************
1340 * CALCULATE INTERACTIONS *
1341 **************************/
1343 /* COULOMB ELECTROSTATICS */
1344 velec = _fjsp_mul_v2r8(qq22,rinv22);
1345 felec = _fjsp_mul_v2r8(velec,rinvsq22);
1349 /* Update vectorial force */
1350 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1351 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1352 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1354 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1355 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1356 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1358 /**************************
1359 * CALCULATE INTERACTIONS *
1360 **************************/
1362 /* COULOMB ELECTROSTATICS */
1363 velec = _fjsp_mul_v2r8(qq23,rinv23);
1364 felec = _fjsp_mul_v2r8(velec,rinvsq23);
1368 /* Update vectorial force */
1369 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1370 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1371 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1373 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1374 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1375 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1377 /**************************
1378 * CALCULATE INTERACTIONS *
1379 **************************/
1381 /* COULOMB ELECTROSTATICS */
1382 velec = _fjsp_mul_v2r8(qq31,rinv31);
1383 felec = _fjsp_mul_v2r8(velec,rinvsq31);
1387 /* Update vectorial force */
1388 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1389 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1390 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1392 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1393 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1394 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1396 /**************************
1397 * CALCULATE INTERACTIONS *
1398 **************************/
1400 /* COULOMB ELECTROSTATICS */
1401 velec = _fjsp_mul_v2r8(qq32,rinv32);
1402 felec = _fjsp_mul_v2r8(velec,rinvsq32);
1406 /* Update vectorial force */
1407 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1408 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1409 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1411 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1412 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1413 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1415 /**************************
1416 * CALCULATE INTERACTIONS *
1417 **************************/
1419 /* COULOMB ELECTROSTATICS */
1420 velec = _fjsp_mul_v2r8(qq33,rinv33);
1421 felec = _fjsp_mul_v2r8(velec,rinvsq33);
1425 /* Update vectorial force */
1426 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1427 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1428 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1430 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1431 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1432 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1434 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1436 /* Inner loop uses 324 flops */
1439 if(jidx<j_index_end)
1443 j_coord_offsetA = DIM*jnrA;
1445 /* load j atom coordinates */
1446 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1447 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1448 &jy2,&jz2,&jx3,&jy3,&jz3);
1450 /* Calculate displacement vector */
1451 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1452 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1453 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1454 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1455 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1456 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1457 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1458 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1459 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1460 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1461 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1462 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1463 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1464 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1465 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1466 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1467 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1468 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1469 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1470 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1471 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1472 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1473 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1474 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1475 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1476 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1477 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1478 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1479 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1480 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1482 /* Calculate squared distance and things based on it */
1483 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1484 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1485 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1486 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1487 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1488 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1489 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1490 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1491 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1492 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1494 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1495 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1496 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1497 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1498 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1499 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1500 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1501 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1502 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1503 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1505 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1506 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1507 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1508 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1509 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1510 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1511 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1512 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1513 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1515 fjx0 = _fjsp_setzero_v2r8();
1516 fjy0 = _fjsp_setzero_v2r8();
1517 fjz0 = _fjsp_setzero_v2r8();
1518 fjx1 = _fjsp_setzero_v2r8();
1519 fjy1 = _fjsp_setzero_v2r8();
1520 fjz1 = _fjsp_setzero_v2r8();
1521 fjx2 = _fjsp_setzero_v2r8();
1522 fjy2 = _fjsp_setzero_v2r8();
1523 fjz2 = _fjsp_setzero_v2r8();
1524 fjx3 = _fjsp_setzero_v2r8();
1525 fjy3 = _fjsp_setzero_v2r8();
1526 fjz3 = _fjsp_setzero_v2r8();
1528 /**************************
1529 * CALCULATE INTERACTIONS *
1530 **************************/
1532 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1534 /* Calculate table index by multiplying r with table scale and truncate to integer */
1535 rt = _fjsp_mul_v2r8(r00,vftabscale);
1536 itab_tmp = _fjsp_dtox_v2r8(rt);
1537 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1538 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1539 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1544 /* CUBIC SPLINE TABLE DISPERSION */
1545 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1546 F = _fjsp_setzero_v2r8();
1547 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1548 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1549 H = _fjsp_setzero_v2r8();
1550 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1551 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1552 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1553 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1555 /* CUBIC SPLINE TABLE REPULSION */
1556 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1557 F = _fjsp_setzero_v2r8();
1558 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1559 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1560 H = _fjsp_setzero_v2r8();
1561 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1562 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1563 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1564 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1565 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1569 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1571 /* Update vectorial force */
1572 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1573 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1574 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1576 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1577 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1578 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1580 /**************************
1581 * CALCULATE INTERACTIONS *
1582 **************************/
1584 /* COULOMB ELECTROSTATICS */
1585 velec = _fjsp_mul_v2r8(qq11,rinv11);
1586 felec = _fjsp_mul_v2r8(velec,rinvsq11);
1590 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1592 /* Update vectorial force */
1593 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1594 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1595 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1597 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1598 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1599 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1601 /**************************
1602 * CALCULATE INTERACTIONS *
1603 **************************/
1605 /* COULOMB ELECTROSTATICS */
1606 velec = _fjsp_mul_v2r8(qq12,rinv12);
1607 felec = _fjsp_mul_v2r8(velec,rinvsq12);
1611 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1613 /* Update vectorial force */
1614 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1615 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1616 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1618 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1619 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1620 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1622 /**************************
1623 * CALCULATE INTERACTIONS *
1624 **************************/
1626 /* COULOMB ELECTROSTATICS */
1627 velec = _fjsp_mul_v2r8(qq13,rinv13);
1628 felec = _fjsp_mul_v2r8(velec,rinvsq13);
1632 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1634 /* Update vectorial force */
1635 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1636 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1637 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1639 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1640 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1641 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1643 /**************************
1644 * CALCULATE INTERACTIONS *
1645 **************************/
1647 /* COULOMB ELECTROSTATICS */
1648 velec = _fjsp_mul_v2r8(qq21,rinv21);
1649 felec = _fjsp_mul_v2r8(velec,rinvsq21);
1653 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1655 /* Update vectorial force */
1656 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1657 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1658 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1660 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1661 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1662 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1664 /**************************
1665 * CALCULATE INTERACTIONS *
1666 **************************/
1668 /* COULOMB ELECTROSTATICS */
1669 velec = _fjsp_mul_v2r8(qq22,rinv22);
1670 felec = _fjsp_mul_v2r8(velec,rinvsq22);
1674 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1676 /* Update vectorial force */
1677 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1678 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1679 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1681 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1682 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1683 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1685 /**************************
1686 * CALCULATE INTERACTIONS *
1687 **************************/
1689 /* COULOMB ELECTROSTATICS */
1690 velec = _fjsp_mul_v2r8(qq23,rinv23);
1691 felec = _fjsp_mul_v2r8(velec,rinvsq23);
1695 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1697 /* Update vectorial force */
1698 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1699 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1700 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1702 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1703 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1704 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1706 /**************************
1707 * CALCULATE INTERACTIONS *
1708 **************************/
1710 /* COULOMB ELECTROSTATICS */
1711 velec = _fjsp_mul_v2r8(qq31,rinv31);
1712 felec = _fjsp_mul_v2r8(velec,rinvsq31);
1716 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1718 /* Update vectorial force */
1719 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1720 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1721 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1723 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1724 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1725 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1727 /**************************
1728 * CALCULATE INTERACTIONS *
1729 **************************/
1731 /* COULOMB ELECTROSTATICS */
1732 velec = _fjsp_mul_v2r8(qq32,rinv32);
1733 felec = _fjsp_mul_v2r8(velec,rinvsq32);
1737 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1739 /* Update vectorial force */
1740 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1741 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1742 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1744 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1745 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1746 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1748 /**************************
1749 * CALCULATE INTERACTIONS *
1750 **************************/
1752 /* COULOMB ELECTROSTATICS */
1753 velec = _fjsp_mul_v2r8(qq33,rinv33);
1754 felec = _fjsp_mul_v2r8(velec,rinvsq33);
1758 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1760 /* Update vectorial force */
1761 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1762 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1763 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1765 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1766 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1767 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1769 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1771 /* Inner loop uses 324 flops */
1774 /* End of innermost loop */
1776 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1777 f+i_coord_offset,fshift+i_shift_offset);
1779 /* Increment number of inner iterations */
1780 inneriter += j_index_end - j_index_start;
1782 /* Outer loop uses 24 flops */
1785 /* Increment number of outer iterations */
1788 /* Update outer/inner flops */
1790 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*324);