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.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
99 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
102 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
105 _fjsp_v2r8 dummy_mask,cutoff_mask;
106 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
107 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
108 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
115 jindex = nlist->jindex;
117 shiftidx = nlist->shift;
119 shiftvec = fr->shift_vec[0];
120 fshift = fr->fshift[0];
121 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
122 charge = mdatoms->chargeA;
123 nvdwtype = fr->ntype;
125 vdwtype = mdatoms->typeA;
127 vftab = kernel_data->table_vdw->data;
128 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
130 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
131 ewtab = fr->ic->tabq_coul_FDV0;
132 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
133 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
135 /* Setup water-specific parameters */
136 inr = nlist->iinr[0];
137 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
138 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
139 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
140 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
142 /* Avoid stupid compiler warnings */
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
166 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
168 fix0 = _fjsp_setzero_v2r8();
169 fiy0 = _fjsp_setzero_v2r8();
170 fiz0 = _fjsp_setzero_v2r8();
171 fix1 = _fjsp_setzero_v2r8();
172 fiy1 = _fjsp_setzero_v2r8();
173 fiz1 = _fjsp_setzero_v2r8();
174 fix2 = _fjsp_setzero_v2r8();
175 fiy2 = _fjsp_setzero_v2r8();
176 fiz2 = _fjsp_setzero_v2r8();
178 /* Reset potential sums */
179 velecsum = _fjsp_setzero_v2r8();
180 vvdwsum = _fjsp_setzero_v2r8();
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
186 /* Get j neighbor index, and coordinate index */
189 j_coord_offsetA = DIM*jnrA;
190 j_coord_offsetB = DIM*jnrB;
192 /* load j atom coordinates */
193 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
196 /* Calculate displacement vector */
197 dx00 = _fjsp_sub_v2r8(ix0,jx0);
198 dy00 = _fjsp_sub_v2r8(iy0,jy0);
199 dz00 = _fjsp_sub_v2r8(iz0,jz0);
200 dx10 = _fjsp_sub_v2r8(ix1,jx0);
201 dy10 = _fjsp_sub_v2r8(iy1,jy0);
202 dz10 = _fjsp_sub_v2r8(iz1,jz0);
203 dx20 = _fjsp_sub_v2r8(ix2,jx0);
204 dy20 = _fjsp_sub_v2r8(iy2,jy0);
205 dz20 = _fjsp_sub_v2r8(iz2,jz0);
207 /* Calculate squared distance and things based on it */
208 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
209 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
210 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
212 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
213 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
214 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
216 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
217 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
218 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
220 /* Load parameters for j particles */
221 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
222 vdwjidx0A = 2*vdwtype[jnrA+0];
223 vdwjidx0B = 2*vdwtype[jnrB+0];
225 fjx0 = _fjsp_setzero_v2r8();
226 fjy0 = _fjsp_setzero_v2r8();
227 fjz0 = _fjsp_setzero_v2r8();
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
233 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
235 /* Compute parameters for interactions between i and j atoms */
236 qq00 = _fjsp_mul_v2r8(iq0,jq0);
237 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
238 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
240 /* Calculate table index by multiplying r with table scale and truncate to integer */
241 rt = _fjsp_mul_v2r8(r00,vftabscale);
242 itab_tmp = _fjsp_dtox_v2r8(rt);
243 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
244 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
245 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
250 /* EWALD ELECTROSTATICS */
252 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
253 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
254 itab_tmp = _fjsp_dtox_v2r8(ewrt);
255 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
256 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
258 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
259 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
260 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
261 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
262 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
263 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
264 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
265 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
266 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
267 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
269 /* CUBIC SPLINE TABLE DISPERSION */
270 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
271 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
272 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
273 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
274 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
275 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
276 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
277 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
278 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
279 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
280 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
282 /* CUBIC SPLINE TABLE REPULSION */
283 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
284 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
285 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
286 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
287 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
288 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
289 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
290 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
291 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
292 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
293 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
294 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
295 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
297 /* Update potential sum for this i atom from the interaction with this j atom. */
298 velecsum = _fjsp_add_v2r8(velecsum,velec);
299 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
301 fscal = _fjsp_add_v2r8(felec,fvdw);
303 /* Update vectorial force */
304 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
305 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
306 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
308 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
309 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
310 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
312 /**************************
313 * CALCULATE INTERACTIONS *
314 **************************/
316 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
318 /* Compute parameters for interactions between i and j atoms */
319 qq10 = _fjsp_mul_v2r8(iq1,jq0);
321 /* EWALD ELECTROSTATICS */
323 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
324 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
325 itab_tmp = _fjsp_dtox_v2r8(ewrt);
326 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
327 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
329 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
330 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
331 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
332 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
333 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
334 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
335 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
336 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
337 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
338 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
340 /* Update potential sum for this i atom from the interaction with this j atom. */
341 velecsum = _fjsp_add_v2r8(velecsum,velec);
345 /* Update vectorial force */
346 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
347 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
348 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
350 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
351 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
352 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
358 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
360 /* Compute parameters for interactions between i and j atoms */
361 qq20 = _fjsp_mul_v2r8(iq2,jq0);
363 /* EWALD ELECTROSTATICS */
365 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
366 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
367 itab_tmp = _fjsp_dtox_v2r8(ewrt);
368 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
369 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
371 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
372 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
373 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
374 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
375 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
376 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
377 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
378 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
379 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
380 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
382 /* Update potential sum for this i atom from the interaction with this j atom. */
383 velecsum = _fjsp_add_v2r8(velecsum,velec);
387 /* Update vectorial force */
388 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
389 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
390 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
392 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
393 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
394 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
396 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
398 /* Inner loop uses 169 flops */
405 j_coord_offsetA = DIM*jnrA;
407 /* load j atom coordinates */
408 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
411 /* Calculate displacement vector */
412 dx00 = _fjsp_sub_v2r8(ix0,jx0);
413 dy00 = _fjsp_sub_v2r8(iy0,jy0);
414 dz00 = _fjsp_sub_v2r8(iz0,jz0);
415 dx10 = _fjsp_sub_v2r8(ix1,jx0);
416 dy10 = _fjsp_sub_v2r8(iy1,jy0);
417 dz10 = _fjsp_sub_v2r8(iz1,jz0);
418 dx20 = _fjsp_sub_v2r8(ix2,jx0);
419 dy20 = _fjsp_sub_v2r8(iy2,jy0);
420 dz20 = _fjsp_sub_v2r8(iz2,jz0);
422 /* Calculate squared distance and things based on it */
423 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
424 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
425 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
427 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
428 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
429 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
431 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
432 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
433 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
435 /* Load parameters for j particles */
436 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
437 vdwjidx0A = 2*vdwtype[jnrA+0];
439 fjx0 = _fjsp_setzero_v2r8();
440 fjy0 = _fjsp_setzero_v2r8();
441 fjz0 = _fjsp_setzero_v2r8();
443 /**************************
444 * CALCULATE INTERACTIONS *
445 **************************/
447 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
449 /* Compute parameters for interactions between i and j atoms */
450 qq00 = _fjsp_mul_v2r8(iq0,jq0);
451 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
452 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
454 /* Calculate table index by multiplying r with table scale and truncate to integer */
455 rt = _fjsp_mul_v2r8(r00,vftabscale);
456 itab_tmp = _fjsp_dtox_v2r8(rt);
457 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
458 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
459 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
464 /* EWALD ELECTROSTATICS */
466 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
467 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
468 itab_tmp = _fjsp_dtox_v2r8(ewrt);
469 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
470 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
472 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
473 ewtabD = _fjsp_setzero_v2r8();
474 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
475 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
476 ewtabFn = _fjsp_setzero_v2r8();
477 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
478 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
479 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
480 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
481 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
483 /* CUBIC SPLINE TABLE DISPERSION */
484 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
485 F = _fjsp_setzero_v2r8();
486 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
487 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
488 H = _fjsp_setzero_v2r8();
489 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
490 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
491 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
492 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
493 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
494 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
496 /* CUBIC SPLINE TABLE REPULSION */
497 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
498 F = _fjsp_setzero_v2r8();
499 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
500 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
501 H = _fjsp_setzero_v2r8();
502 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
503 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
504 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
505 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
506 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
507 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
508 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
509 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
511 /* Update potential sum for this i atom from the interaction with this j atom. */
512 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
513 velecsum = _fjsp_add_v2r8(velecsum,velec);
514 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
515 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
517 fscal = _fjsp_add_v2r8(felec,fvdw);
519 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
521 /* Update vectorial force */
522 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
523 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
524 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
526 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
527 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
528 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
530 /**************************
531 * CALCULATE INTERACTIONS *
532 **************************/
534 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
536 /* Compute parameters for interactions between i and j atoms */
537 qq10 = _fjsp_mul_v2r8(iq1,jq0);
539 /* EWALD ELECTROSTATICS */
541 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
542 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
543 itab_tmp = _fjsp_dtox_v2r8(ewrt);
544 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
545 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
547 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
548 ewtabD = _fjsp_setzero_v2r8();
549 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
550 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
551 ewtabFn = _fjsp_setzero_v2r8();
552 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
553 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
554 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
555 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
556 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
558 /* Update potential sum for this i atom from the interaction with this j atom. */
559 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
560 velecsum = _fjsp_add_v2r8(velecsum,velec);
564 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
566 /* Update vectorial force */
567 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
568 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
569 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
571 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
572 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
573 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
575 /**************************
576 * CALCULATE INTERACTIONS *
577 **************************/
579 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
581 /* Compute parameters for interactions between i and j atoms */
582 qq20 = _fjsp_mul_v2r8(iq2,jq0);
584 /* EWALD ELECTROSTATICS */
586 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
587 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
588 itab_tmp = _fjsp_dtox_v2r8(ewrt);
589 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
590 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
592 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
593 ewtabD = _fjsp_setzero_v2r8();
594 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
595 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
596 ewtabFn = _fjsp_setzero_v2r8();
597 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
598 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
599 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
600 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
601 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
603 /* Update potential sum for this i atom from the interaction with this j atom. */
604 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
605 velecsum = _fjsp_add_v2r8(velecsum,velec);
609 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
611 /* Update vectorial force */
612 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
613 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
614 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
616 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
617 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
618 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
620 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
622 /* Inner loop uses 169 flops */
625 /* End of innermost loop */
627 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
628 f+i_coord_offset,fshift+i_shift_offset);
631 /* Update potential energies */
632 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
633 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
635 /* Increment number of inner iterations */
636 inneriter += j_index_end - j_index_start;
638 /* Outer loop uses 20 flops */
641 /* Increment number of outer iterations */
644 /* Update outer/inner flops */
646 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*169);
649 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
650 * Electrostatics interaction: Ewald
651 * VdW interaction: CubicSplineTable
652 * Geometry: Water3-Particle
653 * Calculate force/pot: Force
656 nb_kernel_ElecEw_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
657 (t_nblist * gmx_restrict nlist,
658 rvec * gmx_restrict xx,
659 rvec * gmx_restrict ff,
660 t_forcerec * gmx_restrict fr,
661 t_mdatoms * gmx_restrict mdatoms,
662 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
663 t_nrnb * gmx_restrict nrnb)
665 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
666 * just 0 for non-waters.
667 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
668 * jnr indices corresponding to data put in the four positions in the SIMD register.
670 int i_shift_offset,i_coord_offset,outeriter,inneriter;
671 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
673 int j_coord_offsetA,j_coord_offsetB;
674 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
676 real *shiftvec,*fshift,*x,*f;
677 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
679 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
681 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
683 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
684 int vdwjidx0A,vdwjidx0B;
685 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
686 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
687 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
688 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
689 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
692 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
695 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
696 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
697 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
699 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
702 _fjsp_v2r8 dummy_mask,cutoff_mask;
703 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
704 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
705 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
712 jindex = nlist->jindex;
714 shiftidx = nlist->shift;
716 shiftvec = fr->shift_vec[0];
717 fshift = fr->fshift[0];
718 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
719 charge = mdatoms->chargeA;
720 nvdwtype = fr->ntype;
722 vdwtype = mdatoms->typeA;
724 vftab = kernel_data->table_vdw->data;
725 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
727 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
728 ewtab = fr->ic->tabq_coul_F;
729 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
730 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
732 /* Setup water-specific parameters */
733 inr = nlist->iinr[0];
734 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
735 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
736 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
737 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
739 /* Avoid stupid compiler warnings */
747 /* Start outer loop over neighborlists */
748 for(iidx=0; iidx<nri; iidx++)
750 /* Load shift vector for this list */
751 i_shift_offset = DIM*shiftidx[iidx];
753 /* Load limits for loop over neighbors */
754 j_index_start = jindex[iidx];
755 j_index_end = jindex[iidx+1];
757 /* Get outer coordinate index */
759 i_coord_offset = DIM*inr;
761 /* Load i particle coords and add shift vector */
762 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
763 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
765 fix0 = _fjsp_setzero_v2r8();
766 fiy0 = _fjsp_setzero_v2r8();
767 fiz0 = _fjsp_setzero_v2r8();
768 fix1 = _fjsp_setzero_v2r8();
769 fiy1 = _fjsp_setzero_v2r8();
770 fiz1 = _fjsp_setzero_v2r8();
771 fix2 = _fjsp_setzero_v2r8();
772 fiy2 = _fjsp_setzero_v2r8();
773 fiz2 = _fjsp_setzero_v2r8();
775 /* Start inner kernel loop */
776 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
779 /* Get j neighbor index, and coordinate index */
782 j_coord_offsetA = DIM*jnrA;
783 j_coord_offsetB = DIM*jnrB;
785 /* load j atom coordinates */
786 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
789 /* Calculate displacement vector */
790 dx00 = _fjsp_sub_v2r8(ix0,jx0);
791 dy00 = _fjsp_sub_v2r8(iy0,jy0);
792 dz00 = _fjsp_sub_v2r8(iz0,jz0);
793 dx10 = _fjsp_sub_v2r8(ix1,jx0);
794 dy10 = _fjsp_sub_v2r8(iy1,jy0);
795 dz10 = _fjsp_sub_v2r8(iz1,jz0);
796 dx20 = _fjsp_sub_v2r8(ix2,jx0);
797 dy20 = _fjsp_sub_v2r8(iy2,jy0);
798 dz20 = _fjsp_sub_v2r8(iz2,jz0);
800 /* Calculate squared distance and things based on it */
801 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
802 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
803 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
805 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
806 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
807 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
809 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
810 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
811 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
813 /* Load parameters for j particles */
814 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
815 vdwjidx0A = 2*vdwtype[jnrA+0];
816 vdwjidx0B = 2*vdwtype[jnrB+0];
818 fjx0 = _fjsp_setzero_v2r8();
819 fjy0 = _fjsp_setzero_v2r8();
820 fjz0 = _fjsp_setzero_v2r8();
822 /**************************
823 * CALCULATE INTERACTIONS *
824 **************************/
826 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
828 /* Compute parameters for interactions between i and j atoms */
829 qq00 = _fjsp_mul_v2r8(iq0,jq0);
830 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
831 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
833 /* Calculate table index by multiplying r with table scale and truncate to integer */
834 rt = _fjsp_mul_v2r8(r00,vftabscale);
835 itab_tmp = _fjsp_dtox_v2r8(rt);
836 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
837 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
838 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
843 /* EWALD ELECTROSTATICS */
845 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
846 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
847 itab_tmp = _fjsp_dtox_v2r8(ewrt);
848 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
849 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
851 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
853 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
854 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
856 /* CUBIC SPLINE TABLE DISPERSION */
857 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
858 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
859 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
860 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
861 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
862 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
863 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
864 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
865 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
867 /* CUBIC SPLINE TABLE REPULSION */
868 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
869 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
870 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
871 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
872 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
873 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
874 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
875 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
876 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
877 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
879 fscal = _fjsp_add_v2r8(felec,fvdw);
881 /* Update vectorial force */
882 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
883 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
884 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
886 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
887 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
888 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
890 /**************************
891 * CALCULATE INTERACTIONS *
892 **************************/
894 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
896 /* Compute parameters for interactions between i and j atoms */
897 qq10 = _fjsp_mul_v2r8(iq1,jq0);
899 /* EWALD ELECTROSTATICS */
901 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
902 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
903 itab_tmp = _fjsp_dtox_v2r8(ewrt);
904 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
905 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
907 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
909 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
910 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
914 /* Update vectorial force */
915 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
916 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
917 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
919 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
920 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
921 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
923 /**************************
924 * CALCULATE INTERACTIONS *
925 **************************/
927 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
929 /* Compute parameters for interactions between i and j atoms */
930 qq20 = _fjsp_mul_v2r8(iq2,jq0);
932 /* EWALD ELECTROSTATICS */
934 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
935 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
936 itab_tmp = _fjsp_dtox_v2r8(ewrt);
937 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
938 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
940 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
942 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
943 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
947 /* Update vectorial force */
948 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
949 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
950 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
952 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
953 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
954 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
956 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
958 /* Inner loop uses 146 flops */
965 j_coord_offsetA = DIM*jnrA;
967 /* load j atom coordinates */
968 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
971 /* Calculate displacement vector */
972 dx00 = _fjsp_sub_v2r8(ix0,jx0);
973 dy00 = _fjsp_sub_v2r8(iy0,jy0);
974 dz00 = _fjsp_sub_v2r8(iz0,jz0);
975 dx10 = _fjsp_sub_v2r8(ix1,jx0);
976 dy10 = _fjsp_sub_v2r8(iy1,jy0);
977 dz10 = _fjsp_sub_v2r8(iz1,jz0);
978 dx20 = _fjsp_sub_v2r8(ix2,jx0);
979 dy20 = _fjsp_sub_v2r8(iy2,jy0);
980 dz20 = _fjsp_sub_v2r8(iz2,jz0);
982 /* Calculate squared distance and things based on it */
983 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
984 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
985 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
987 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
988 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
989 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
991 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
992 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
993 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
995 /* Load parameters for j particles */
996 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
997 vdwjidx0A = 2*vdwtype[jnrA+0];
999 fjx0 = _fjsp_setzero_v2r8();
1000 fjy0 = _fjsp_setzero_v2r8();
1001 fjz0 = _fjsp_setzero_v2r8();
1003 /**************************
1004 * CALCULATE INTERACTIONS *
1005 **************************/
1007 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1009 /* Compute parameters for interactions between i and j atoms */
1010 qq00 = _fjsp_mul_v2r8(iq0,jq0);
1011 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1012 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1014 /* Calculate table index by multiplying r with table scale and truncate to integer */
1015 rt = _fjsp_mul_v2r8(r00,vftabscale);
1016 itab_tmp = _fjsp_dtox_v2r8(rt);
1017 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1018 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1019 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1024 /* EWALD ELECTROSTATICS */
1026 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1027 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
1028 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1029 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1030 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1032 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1033 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1034 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
1036 /* CUBIC SPLINE TABLE DISPERSION */
1037 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1038 F = _fjsp_setzero_v2r8();
1039 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1040 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1041 H = _fjsp_setzero_v2r8();
1042 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1043 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1044 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1045 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1047 /* CUBIC SPLINE TABLE REPULSION */
1048 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1049 F = _fjsp_setzero_v2r8();
1050 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1051 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1052 H = _fjsp_setzero_v2r8();
1053 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1054 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1055 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1056 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1057 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1059 fscal = _fjsp_add_v2r8(felec,fvdw);
1061 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1063 /* Update vectorial force */
1064 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1065 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1066 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1068 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1069 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1070 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1072 /**************************
1073 * CALCULATE INTERACTIONS *
1074 **************************/
1076 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1078 /* Compute parameters for interactions between i and j atoms */
1079 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1081 /* EWALD ELECTROSTATICS */
1083 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1084 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1085 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1086 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1087 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1089 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1090 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1091 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1095 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1097 /* Update vectorial force */
1098 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1099 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1100 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1102 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1103 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1104 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1106 /**************************
1107 * CALCULATE INTERACTIONS *
1108 **************************/
1110 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1112 /* Compute parameters for interactions between i and j atoms */
1113 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1115 /* EWALD ELECTROSTATICS */
1117 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1118 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1119 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1120 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1121 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1123 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1124 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1125 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1129 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1131 /* Update vectorial force */
1132 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1133 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1134 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1136 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1137 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1138 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1140 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1142 /* Inner loop uses 146 flops */
1145 /* End of innermost loop */
1147 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1148 f+i_coord_offset,fshift+i_shift_offset);
1150 /* Increment number of inner iterations */
1151 inneriter += j_index_end - j_index_start;
1153 /* Outer loop uses 18 flops */
1156 /* Increment number of outer iterations */
1159 /* Update outer/inner flops */
1161 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*146);