2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
97 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
98 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
100 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
103 _fjsp_v2r8 dummy_mask,cutoff_mask;
104 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
105 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
106 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
119 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
120 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 vftab = kernel_data->table_vdw->data;
126 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
128 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
129 ewtab = fr->ic->tabq_coul_FDV0;
130 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
131 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
133 /* Setup water-specific parameters */
134 inr = nlist->iinr[0];
135 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
136 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
137 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
138 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
140 /* Avoid stupid compiler warnings */
148 /* Start outer loop over neighborlists */
149 for(iidx=0; iidx<nri; iidx++)
151 /* Load shift vector for this list */
152 i_shift_offset = DIM*shiftidx[iidx];
154 /* Load limits for loop over neighbors */
155 j_index_start = jindex[iidx];
156 j_index_end = jindex[iidx+1];
158 /* Get outer coordinate index */
160 i_coord_offset = DIM*inr;
162 /* Load i particle coords and add shift vector */
163 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
164 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
166 fix0 = _fjsp_setzero_v2r8();
167 fiy0 = _fjsp_setzero_v2r8();
168 fiz0 = _fjsp_setzero_v2r8();
169 fix1 = _fjsp_setzero_v2r8();
170 fiy1 = _fjsp_setzero_v2r8();
171 fiz1 = _fjsp_setzero_v2r8();
172 fix2 = _fjsp_setzero_v2r8();
173 fiy2 = _fjsp_setzero_v2r8();
174 fiz2 = _fjsp_setzero_v2r8();
176 /* Reset potential sums */
177 velecsum = _fjsp_setzero_v2r8();
178 vvdwsum = _fjsp_setzero_v2r8();
180 /* Start inner kernel loop */
181 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
184 /* Get j neighbor index, and coordinate index */
187 j_coord_offsetA = DIM*jnrA;
188 j_coord_offsetB = DIM*jnrB;
190 /* load j atom coordinates */
191 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
194 /* Calculate displacement vector */
195 dx00 = _fjsp_sub_v2r8(ix0,jx0);
196 dy00 = _fjsp_sub_v2r8(iy0,jy0);
197 dz00 = _fjsp_sub_v2r8(iz0,jz0);
198 dx10 = _fjsp_sub_v2r8(ix1,jx0);
199 dy10 = _fjsp_sub_v2r8(iy1,jy0);
200 dz10 = _fjsp_sub_v2r8(iz1,jz0);
201 dx20 = _fjsp_sub_v2r8(ix2,jx0);
202 dy20 = _fjsp_sub_v2r8(iy2,jy0);
203 dz20 = _fjsp_sub_v2r8(iz2,jz0);
205 /* Calculate squared distance and things based on it */
206 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
207 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
208 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
210 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
211 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
212 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
214 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
215 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
216 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
218 /* Load parameters for j particles */
219 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
220 vdwjidx0A = 2*vdwtype[jnrA+0];
221 vdwjidx0B = 2*vdwtype[jnrB+0];
223 fjx0 = _fjsp_setzero_v2r8();
224 fjy0 = _fjsp_setzero_v2r8();
225 fjz0 = _fjsp_setzero_v2r8();
227 /**************************
228 * CALCULATE INTERACTIONS *
229 **************************/
231 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
233 /* Compute parameters for interactions between i and j atoms */
234 qq00 = _fjsp_mul_v2r8(iq0,jq0);
235 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
236 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
238 /* Calculate table index by multiplying r with table scale and truncate to integer */
239 rt = _fjsp_mul_v2r8(r00,vftabscale);
240 itab_tmp = _fjsp_dtox_v2r8(rt);
241 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
242 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
243 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
248 /* EWALD ELECTROSTATICS */
250 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
251 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
252 itab_tmp = _fjsp_dtox_v2r8(ewrt);
253 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
254 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
256 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
257 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
258 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
259 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
260 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
261 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
262 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
263 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
264 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
265 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
267 /* CUBIC SPLINE TABLE DISPERSION */
268 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
269 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
270 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
271 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
272 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
273 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
274 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
275 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
276 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
277 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
278 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
280 /* CUBIC SPLINE TABLE REPULSION */
281 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
282 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
283 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
284 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
285 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
286 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
287 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
288 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
289 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
290 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
291 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
292 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
293 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
295 /* Update potential sum for this i atom from the interaction with this j atom. */
296 velecsum = _fjsp_add_v2r8(velecsum,velec);
297 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
299 fscal = _fjsp_add_v2r8(felec,fvdw);
301 /* Update vectorial force */
302 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
303 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
304 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
306 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
307 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
308 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
310 /**************************
311 * CALCULATE INTERACTIONS *
312 **************************/
314 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
316 /* Compute parameters for interactions between i and j atoms */
317 qq10 = _fjsp_mul_v2r8(iq1,jq0);
319 /* EWALD ELECTROSTATICS */
321 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
322 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
323 itab_tmp = _fjsp_dtox_v2r8(ewrt);
324 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
325 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
327 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
328 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
329 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
330 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
331 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
332 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
333 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
334 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
335 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
336 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
338 /* Update potential sum for this i atom from the interaction with this j atom. */
339 velecsum = _fjsp_add_v2r8(velecsum,velec);
343 /* Update vectorial force */
344 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
345 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
346 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
348 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
349 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
350 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
352 /**************************
353 * CALCULATE INTERACTIONS *
354 **************************/
356 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
358 /* Compute parameters for interactions between i and j atoms */
359 qq20 = _fjsp_mul_v2r8(iq2,jq0);
361 /* EWALD ELECTROSTATICS */
363 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
364 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
365 itab_tmp = _fjsp_dtox_v2r8(ewrt);
366 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
367 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
369 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
370 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
371 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
372 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
373 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
374 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
375 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
376 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
377 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
378 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
380 /* Update potential sum for this i atom from the interaction with this j atom. */
381 velecsum = _fjsp_add_v2r8(velecsum,velec);
385 /* Update vectorial force */
386 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
387 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
388 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
390 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
391 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
392 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
394 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
396 /* Inner loop uses 169 flops */
403 j_coord_offsetA = DIM*jnrA;
405 /* load j atom coordinates */
406 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
409 /* Calculate displacement vector */
410 dx00 = _fjsp_sub_v2r8(ix0,jx0);
411 dy00 = _fjsp_sub_v2r8(iy0,jy0);
412 dz00 = _fjsp_sub_v2r8(iz0,jz0);
413 dx10 = _fjsp_sub_v2r8(ix1,jx0);
414 dy10 = _fjsp_sub_v2r8(iy1,jy0);
415 dz10 = _fjsp_sub_v2r8(iz1,jz0);
416 dx20 = _fjsp_sub_v2r8(ix2,jx0);
417 dy20 = _fjsp_sub_v2r8(iy2,jy0);
418 dz20 = _fjsp_sub_v2r8(iz2,jz0);
420 /* Calculate squared distance and things based on it */
421 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
422 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
423 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
425 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
426 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
427 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
429 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
430 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
431 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
433 /* Load parameters for j particles */
434 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
435 vdwjidx0A = 2*vdwtype[jnrA+0];
437 fjx0 = _fjsp_setzero_v2r8();
438 fjy0 = _fjsp_setzero_v2r8();
439 fjz0 = _fjsp_setzero_v2r8();
441 /**************************
442 * CALCULATE INTERACTIONS *
443 **************************/
445 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
447 /* Compute parameters for interactions between i and j atoms */
448 qq00 = _fjsp_mul_v2r8(iq0,jq0);
449 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
451 /* Calculate table index by multiplying r with table scale and truncate to integer */
452 rt = _fjsp_mul_v2r8(r00,vftabscale);
453 itab_tmp = _fjsp_dtox_v2r8(rt);
454 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
455 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
456 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
461 /* EWALD ELECTROSTATICS */
463 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
464 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
465 itab_tmp = _fjsp_dtox_v2r8(ewrt);
466 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
467 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
469 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
470 ewtabD = _fjsp_setzero_v2r8();
471 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
472 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
473 ewtabFn = _fjsp_setzero_v2r8();
474 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
475 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
476 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
477 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
478 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
480 /* CUBIC SPLINE TABLE DISPERSION */
481 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
482 F = _fjsp_setzero_v2r8();
483 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
484 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
485 H = _fjsp_setzero_v2r8();
486 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
487 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
488 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
489 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
490 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
491 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
493 /* CUBIC SPLINE TABLE REPULSION */
494 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
495 F = _fjsp_setzero_v2r8();
496 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
497 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
498 H = _fjsp_setzero_v2r8();
499 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
500 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
501 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
502 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
503 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
504 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
505 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
506 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
508 /* Update potential sum for this i atom from the interaction with this j atom. */
509 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
510 velecsum = _fjsp_add_v2r8(velecsum,velec);
511 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
512 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
514 fscal = _fjsp_add_v2r8(felec,fvdw);
516 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
518 /* Update vectorial force */
519 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
520 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
521 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
523 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
524 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
525 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
527 /**************************
528 * CALCULATE INTERACTIONS *
529 **************************/
531 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
533 /* Compute parameters for interactions between i and j atoms */
534 qq10 = _fjsp_mul_v2r8(iq1,jq0);
536 /* EWALD ELECTROSTATICS */
538 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
539 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
540 itab_tmp = _fjsp_dtox_v2r8(ewrt);
541 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
542 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
544 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
545 ewtabD = _fjsp_setzero_v2r8();
546 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
547 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
548 ewtabFn = _fjsp_setzero_v2r8();
549 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
550 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
551 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
552 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
553 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
555 /* Update potential sum for this i atom from the interaction with this j atom. */
556 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
557 velecsum = _fjsp_add_v2r8(velecsum,velec);
561 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
563 /* Update vectorial force */
564 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
565 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
566 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
568 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
569 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
570 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
572 /**************************
573 * CALCULATE INTERACTIONS *
574 **************************/
576 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
578 /* Compute parameters for interactions between i and j atoms */
579 qq20 = _fjsp_mul_v2r8(iq2,jq0);
581 /* EWALD ELECTROSTATICS */
583 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
584 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
585 itab_tmp = _fjsp_dtox_v2r8(ewrt);
586 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
587 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
589 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
590 ewtabD = _fjsp_setzero_v2r8();
591 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
592 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
593 ewtabFn = _fjsp_setzero_v2r8();
594 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
595 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
596 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
597 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
598 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
600 /* Update potential sum for this i atom from the interaction with this j atom. */
601 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
602 velecsum = _fjsp_add_v2r8(velecsum,velec);
606 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
608 /* Update vectorial force */
609 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
610 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
611 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
613 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
614 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
615 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
617 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
619 /* Inner loop uses 169 flops */
622 /* End of innermost loop */
624 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
625 f+i_coord_offset,fshift+i_shift_offset);
628 /* Update potential energies */
629 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
630 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
632 /* Increment number of inner iterations */
633 inneriter += j_index_end - j_index_start;
635 /* Outer loop uses 20 flops */
638 /* Increment number of outer iterations */
641 /* Update outer/inner flops */
643 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*169);
646 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
647 * Electrostatics interaction: Ewald
648 * VdW interaction: CubicSplineTable
649 * Geometry: Water3-Particle
650 * Calculate force/pot: Force
653 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
654 (t_nblist * gmx_restrict nlist,
655 rvec * gmx_restrict xx,
656 rvec * gmx_restrict ff,
657 t_forcerec * gmx_restrict fr,
658 t_mdatoms * gmx_restrict mdatoms,
659 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
660 t_nrnb * gmx_restrict nrnb)
662 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
663 * just 0 for non-waters.
664 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
665 * jnr indices corresponding to data put in the four positions in the SIMD register.
667 int i_shift_offset,i_coord_offset,outeriter,inneriter;
668 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
670 int j_coord_offsetA,j_coord_offsetB;
671 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
673 real *shiftvec,*fshift,*x,*f;
674 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
676 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
678 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
680 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
681 int vdwjidx0A,vdwjidx0B;
682 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
683 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
684 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
685 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
686 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
689 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
692 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
693 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
694 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
696 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
699 _fjsp_v2r8 dummy_mask,cutoff_mask;
700 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
701 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
702 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
709 jindex = nlist->jindex;
711 shiftidx = nlist->shift;
713 shiftvec = fr->shift_vec[0];
714 fshift = fr->fshift[0];
715 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
716 charge = mdatoms->chargeA;
717 nvdwtype = fr->ntype;
719 vdwtype = mdatoms->typeA;
721 vftab = kernel_data->table_vdw->data;
722 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
724 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
725 ewtab = fr->ic->tabq_coul_F;
726 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
727 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
729 /* Setup water-specific parameters */
730 inr = nlist->iinr[0];
731 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
732 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
733 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
734 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
736 /* Avoid stupid compiler warnings */
744 /* Start outer loop over neighborlists */
745 for(iidx=0; iidx<nri; iidx++)
747 /* Load shift vector for this list */
748 i_shift_offset = DIM*shiftidx[iidx];
750 /* Load limits for loop over neighbors */
751 j_index_start = jindex[iidx];
752 j_index_end = jindex[iidx+1];
754 /* Get outer coordinate index */
756 i_coord_offset = DIM*inr;
758 /* Load i particle coords and add shift vector */
759 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
760 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
762 fix0 = _fjsp_setzero_v2r8();
763 fiy0 = _fjsp_setzero_v2r8();
764 fiz0 = _fjsp_setzero_v2r8();
765 fix1 = _fjsp_setzero_v2r8();
766 fiy1 = _fjsp_setzero_v2r8();
767 fiz1 = _fjsp_setzero_v2r8();
768 fix2 = _fjsp_setzero_v2r8();
769 fiy2 = _fjsp_setzero_v2r8();
770 fiz2 = _fjsp_setzero_v2r8();
772 /* Start inner kernel loop */
773 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
776 /* Get j neighbor index, and coordinate index */
779 j_coord_offsetA = DIM*jnrA;
780 j_coord_offsetB = DIM*jnrB;
782 /* load j atom coordinates */
783 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
786 /* Calculate displacement vector */
787 dx00 = _fjsp_sub_v2r8(ix0,jx0);
788 dy00 = _fjsp_sub_v2r8(iy0,jy0);
789 dz00 = _fjsp_sub_v2r8(iz0,jz0);
790 dx10 = _fjsp_sub_v2r8(ix1,jx0);
791 dy10 = _fjsp_sub_v2r8(iy1,jy0);
792 dz10 = _fjsp_sub_v2r8(iz1,jz0);
793 dx20 = _fjsp_sub_v2r8(ix2,jx0);
794 dy20 = _fjsp_sub_v2r8(iy2,jy0);
795 dz20 = _fjsp_sub_v2r8(iz2,jz0);
797 /* Calculate squared distance and things based on it */
798 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
799 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
800 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
802 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
803 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
804 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
806 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
807 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
808 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
810 /* Load parameters for j particles */
811 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
812 vdwjidx0A = 2*vdwtype[jnrA+0];
813 vdwjidx0B = 2*vdwtype[jnrB+0];
815 fjx0 = _fjsp_setzero_v2r8();
816 fjy0 = _fjsp_setzero_v2r8();
817 fjz0 = _fjsp_setzero_v2r8();
819 /**************************
820 * CALCULATE INTERACTIONS *
821 **************************/
823 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
825 /* Compute parameters for interactions between i and j atoms */
826 qq00 = _fjsp_mul_v2r8(iq0,jq0);
827 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
828 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
830 /* Calculate table index by multiplying r with table scale and truncate to integer */
831 rt = _fjsp_mul_v2r8(r00,vftabscale);
832 itab_tmp = _fjsp_dtox_v2r8(rt);
833 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
834 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
835 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
840 /* EWALD ELECTROSTATICS */
842 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
843 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
844 itab_tmp = _fjsp_dtox_v2r8(ewrt);
845 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
846 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
848 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
850 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
851 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
853 /* CUBIC SPLINE TABLE DISPERSION */
854 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
855 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
856 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
857 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
858 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
859 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
860 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
861 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
862 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
864 /* CUBIC SPLINE TABLE REPULSION */
865 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
866 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
867 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
868 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
869 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
870 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
871 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
872 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
873 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
874 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
876 fscal = _fjsp_add_v2r8(felec,fvdw);
878 /* Update vectorial force */
879 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
880 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
881 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
883 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
884 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
885 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
887 /**************************
888 * CALCULATE INTERACTIONS *
889 **************************/
891 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
893 /* Compute parameters for interactions between i and j atoms */
894 qq10 = _fjsp_mul_v2r8(iq1,jq0);
896 /* EWALD ELECTROSTATICS */
898 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
899 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
900 itab_tmp = _fjsp_dtox_v2r8(ewrt);
901 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
902 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
904 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
906 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
907 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
911 /* Update vectorial force */
912 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
913 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
914 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
916 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
917 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
918 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
920 /**************************
921 * CALCULATE INTERACTIONS *
922 **************************/
924 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
926 /* Compute parameters for interactions between i and j atoms */
927 qq20 = _fjsp_mul_v2r8(iq2,jq0);
929 /* EWALD ELECTROSTATICS */
931 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
932 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
933 itab_tmp = _fjsp_dtox_v2r8(ewrt);
934 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
935 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
937 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
939 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
940 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
944 /* Update vectorial force */
945 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
946 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
947 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
949 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
950 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
951 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
953 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
955 /* Inner loop uses 146 flops */
962 j_coord_offsetA = DIM*jnrA;
964 /* load j atom coordinates */
965 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
968 /* Calculate displacement vector */
969 dx00 = _fjsp_sub_v2r8(ix0,jx0);
970 dy00 = _fjsp_sub_v2r8(iy0,jy0);
971 dz00 = _fjsp_sub_v2r8(iz0,jz0);
972 dx10 = _fjsp_sub_v2r8(ix1,jx0);
973 dy10 = _fjsp_sub_v2r8(iy1,jy0);
974 dz10 = _fjsp_sub_v2r8(iz1,jz0);
975 dx20 = _fjsp_sub_v2r8(ix2,jx0);
976 dy20 = _fjsp_sub_v2r8(iy2,jy0);
977 dz20 = _fjsp_sub_v2r8(iz2,jz0);
979 /* Calculate squared distance and things based on it */
980 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
981 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
982 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
984 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
985 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
986 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
988 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
989 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
990 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
992 /* Load parameters for j particles */
993 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
994 vdwjidx0A = 2*vdwtype[jnrA+0];
996 fjx0 = _fjsp_setzero_v2r8();
997 fjy0 = _fjsp_setzero_v2r8();
998 fjz0 = _fjsp_setzero_v2r8();
1000 /**************************
1001 * CALCULATE INTERACTIONS *
1002 **************************/
1004 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1006 /* Compute parameters for interactions between i and j atoms */
1007 qq00 = _fjsp_mul_v2r8(iq0,jq0);
1008 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1010 /* Calculate table index by multiplying r with table scale and truncate to integer */
1011 rt = _fjsp_mul_v2r8(r00,vftabscale);
1012 itab_tmp = _fjsp_dtox_v2r8(rt);
1013 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1014 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1015 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1020 /* EWALD ELECTROSTATICS */
1022 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1023 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
1024 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1025 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1026 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1028 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1029 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1030 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
1032 /* CUBIC SPLINE TABLE DISPERSION */
1033 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1034 F = _fjsp_setzero_v2r8();
1035 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1036 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1037 H = _fjsp_setzero_v2r8();
1038 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1039 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1040 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1041 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1043 /* CUBIC SPLINE TABLE REPULSION */
1044 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1045 F = _fjsp_setzero_v2r8();
1046 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1047 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1048 H = _fjsp_setzero_v2r8();
1049 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1050 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1051 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1052 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1053 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1055 fscal = _fjsp_add_v2r8(felec,fvdw);
1057 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1059 /* Update vectorial force */
1060 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1061 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1062 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1064 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1065 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1066 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1068 /**************************
1069 * CALCULATE INTERACTIONS *
1070 **************************/
1072 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1074 /* Compute parameters for interactions between i and j atoms */
1075 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1077 /* EWALD ELECTROSTATICS */
1079 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1080 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1081 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1082 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1083 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1085 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1086 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1087 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1091 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1093 /* Update vectorial force */
1094 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1095 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1096 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1098 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1099 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1100 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1102 /**************************
1103 * CALCULATE INTERACTIONS *
1104 **************************/
1106 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1108 /* Compute parameters for interactions between i and j atoms */
1109 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1111 /* EWALD ELECTROSTATICS */
1113 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1114 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1115 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1116 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1117 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1119 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1120 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1121 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1125 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1127 /* Update vectorial force */
1128 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1129 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1130 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1132 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1133 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1134 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1136 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1138 /* Inner loop uses 146 flops */
1141 /* End of innermost loop */
1143 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1144 f+i_coord_offset,fshift+i_shift_offset);
1146 /* Increment number of inner iterations */
1147 inneriter += j_index_end - j_index_start;
1149 /* Outer loop uses 18 flops */
1152 /* Increment number of outer iterations */
1155 /* Update outer/inner flops */
1157 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*146);