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_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: CubicSplineTable
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_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 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
105 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
108 _fjsp_v2r8 dummy_mask,cutoff_mask;
109 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
110 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
111 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
118 jindex = nlist->jindex;
120 shiftidx = nlist->shift;
122 shiftvec = fr->shift_vec[0];
123 fshift = fr->fshift[0];
124 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
125 charge = mdatoms->chargeA;
126 nvdwtype = fr->ntype;
128 vdwtype = mdatoms->typeA;
130 vftab = kernel_data->table_vdw->data;
131 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
133 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
134 ewtab = fr->ic->tabq_coul_FDV0;
135 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
136 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
138 /* Setup water-specific parameters */
139 inr = nlist->iinr[0];
140 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
141 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
142 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
143 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
145 /* Avoid stupid compiler warnings */
153 /* Start outer loop over neighborlists */
154 for(iidx=0; iidx<nri; iidx++)
156 /* Load shift vector for this list */
157 i_shift_offset = DIM*shiftidx[iidx];
159 /* Load limits for loop over neighbors */
160 j_index_start = jindex[iidx];
161 j_index_end = jindex[iidx+1];
163 /* Get outer coordinate index */
165 i_coord_offset = DIM*inr;
167 /* Load i particle coords and add shift vector */
168 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
169 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
171 fix0 = _fjsp_setzero_v2r8();
172 fiy0 = _fjsp_setzero_v2r8();
173 fiz0 = _fjsp_setzero_v2r8();
174 fix1 = _fjsp_setzero_v2r8();
175 fiy1 = _fjsp_setzero_v2r8();
176 fiz1 = _fjsp_setzero_v2r8();
177 fix2 = _fjsp_setzero_v2r8();
178 fiy2 = _fjsp_setzero_v2r8();
179 fiz2 = _fjsp_setzero_v2r8();
180 fix3 = _fjsp_setzero_v2r8();
181 fiy3 = _fjsp_setzero_v2r8();
182 fiz3 = _fjsp_setzero_v2r8();
184 /* Reset potential sums */
185 velecsum = _fjsp_setzero_v2r8();
186 vvdwsum = _fjsp_setzero_v2r8();
188 /* Start inner kernel loop */
189 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
192 /* Get j neighbor index, and coordinate index */
195 j_coord_offsetA = DIM*jnrA;
196 j_coord_offsetB = DIM*jnrB;
198 /* load j atom coordinates */
199 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
202 /* Calculate displacement vector */
203 dx00 = _fjsp_sub_v2r8(ix0,jx0);
204 dy00 = _fjsp_sub_v2r8(iy0,jy0);
205 dz00 = _fjsp_sub_v2r8(iz0,jz0);
206 dx10 = _fjsp_sub_v2r8(ix1,jx0);
207 dy10 = _fjsp_sub_v2r8(iy1,jy0);
208 dz10 = _fjsp_sub_v2r8(iz1,jz0);
209 dx20 = _fjsp_sub_v2r8(ix2,jx0);
210 dy20 = _fjsp_sub_v2r8(iy2,jy0);
211 dz20 = _fjsp_sub_v2r8(iz2,jz0);
212 dx30 = _fjsp_sub_v2r8(ix3,jx0);
213 dy30 = _fjsp_sub_v2r8(iy3,jy0);
214 dz30 = _fjsp_sub_v2r8(iz3,jz0);
216 /* Calculate squared distance and things based on it */
217 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
218 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
219 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
220 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
222 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
223 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
224 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
225 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
227 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
228 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
229 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
231 /* Load parameters for j particles */
232 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
233 vdwjidx0A = 2*vdwtype[jnrA+0];
234 vdwjidx0B = 2*vdwtype[jnrB+0];
236 fjx0 = _fjsp_setzero_v2r8();
237 fjy0 = _fjsp_setzero_v2r8();
238 fjz0 = _fjsp_setzero_v2r8();
240 /**************************
241 * CALCULATE INTERACTIONS *
242 **************************/
244 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
246 /* Compute parameters for interactions between i and j atoms */
247 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
248 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
250 /* Calculate table index by multiplying r with table scale and truncate to integer */
251 rt = _fjsp_mul_v2r8(r00,vftabscale);
252 itab_tmp = _fjsp_dtox_v2r8(rt);
253 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
254 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
255 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
260 /* CUBIC SPLINE TABLE DISPERSION */
261 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
262 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
263 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
264 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
265 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
266 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
267 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
268 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
269 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
270 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
271 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
273 /* CUBIC SPLINE TABLE REPULSION */
274 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
275 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
276 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
277 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
278 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
279 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
280 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
281 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
282 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
283 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
284 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
285 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
286 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
288 /* Update potential sum for this i atom from the interaction with this j atom. */
289 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
293 /* Update vectorial force */
294 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
295 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
296 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
298 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
299 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
300 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
308 /* Compute parameters for interactions between i and j atoms */
309 qq10 = _fjsp_mul_v2r8(iq1,jq0);
311 /* EWALD ELECTROSTATICS */
313 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
314 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
315 itab_tmp = _fjsp_dtox_v2r8(ewrt);
316 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
317 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
319 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
320 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
321 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
322 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
323 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
324 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
325 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
326 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
327 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
328 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
330 /* Update potential sum for this i atom from the interaction with this j atom. */
331 velecsum = _fjsp_add_v2r8(velecsum,velec);
335 /* Update vectorial force */
336 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
337 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
338 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
340 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
341 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
342 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
344 /**************************
345 * CALCULATE INTERACTIONS *
346 **************************/
348 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
350 /* Compute parameters for interactions between i and j atoms */
351 qq20 = _fjsp_mul_v2r8(iq2,jq0);
353 /* EWALD ELECTROSTATICS */
355 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
356 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
357 itab_tmp = _fjsp_dtox_v2r8(ewrt);
358 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
359 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
361 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
362 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
363 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
364 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
365 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
366 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
367 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
368 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
369 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
370 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
372 /* Update potential sum for this i atom from the interaction with this j atom. */
373 velecsum = _fjsp_add_v2r8(velecsum,velec);
377 /* Update vectorial force */
378 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
379 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
380 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
382 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
383 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
384 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
386 /**************************
387 * CALCULATE INTERACTIONS *
388 **************************/
390 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
392 /* Compute parameters for interactions between i and j atoms */
393 qq30 = _fjsp_mul_v2r8(iq3,jq0);
395 /* EWALD ELECTROSTATICS */
397 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
398 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
399 itab_tmp = _fjsp_dtox_v2r8(ewrt);
400 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
401 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
403 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
404 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
405 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
406 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
407 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
408 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
409 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
410 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
411 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
412 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
414 /* Update potential sum for this i atom from the interaction with this j atom. */
415 velecsum = _fjsp_add_v2r8(velecsum,velec);
419 /* Update vectorial force */
420 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
421 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
422 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
424 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
425 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
426 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
428 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
430 /* Inner loop uses 194 flops */
437 j_coord_offsetA = DIM*jnrA;
439 /* load j atom coordinates */
440 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
443 /* Calculate displacement vector */
444 dx00 = _fjsp_sub_v2r8(ix0,jx0);
445 dy00 = _fjsp_sub_v2r8(iy0,jy0);
446 dz00 = _fjsp_sub_v2r8(iz0,jz0);
447 dx10 = _fjsp_sub_v2r8(ix1,jx0);
448 dy10 = _fjsp_sub_v2r8(iy1,jy0);
449 dz10 = _fjsp_sub_v2r8(iz1,jz0);
450 dx20 = _fjsp_sub_v2r8(ix2,jx0);
451 dy20 = _fjsp_sub_v2r8(iy2,jy0);
452 dz20 = _fjsp_sub_v2r8(iz2,jz0);
453 dx30 = _fjsp_sub_v2r8(ix3,jx0);
454 dy30 = _fjsp_sub_v2r8(iy3,jy0);
455 dz30 = _fjsp_sub_v2r8(iz3,jz0);
457 /* Calculate squared distance and things based on it */
458 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
459 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
460 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
461 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
463 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
464 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
465 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
466 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
468 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
469 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
470 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
472 /* Load parameters for j particles */
473 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
474 vdwjidx0A = 2*vdwtype[jnrA+0];
476 fjx0 = _fjsp_setzero_v2r8();
477 fjy0 = _fjsp_setzero_v2r8();
478 fjz0 = _fjsp_setzero_v2r8();
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
486 /* Compute parameters for interactions between i and j atoms */
487 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
488 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
490 /* Calculate table index by multiplying r with table scale and truncate to integer */
491 rt = _fjsp_mul_v2r8(r00,vftabscale);
492 itab_tmp = _fjsp_dtox_v2r8(rt);
493 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
494 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
495 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
500 /* CUBIC SPLINE TABLE DISPERSION */
501 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
502 F = _fjsp_setzero_v2r8();
503 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
504 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
505 H = _fjsp_setzero_v2r8();
506 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
507 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
508 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
509 vvdw6 = _fjsp_mul_v2r8(c6_00,VV);
510 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
511 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
513 /* CUBIC SPLINE TABLE REPULSION */
514 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
515 F = _fjsp_setzero_v2r8();
516 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
517 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
518 H = _fjsp_setzero_v2r8();
519 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
520 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
521 VV = _fjsp_madd_v2r8(vfeps,Fp,Y);
522 vvdw12 = _fjsp_mul_v2r8(c12_00,VV);
523 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
524 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
525 vvdw = _fjsp_add_v2r8(vvdw12,vvdw6);
526 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
528 /* Update potential sum for this i atom from the interaction with this j atom. */
529 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
530 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
534 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
536 /* Update vectorial force */
537 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
538 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
539 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
541 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
542 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
543 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
545 /**************************
546 * CALCULATE INTERACTIONS *
547 **************************/
549 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
551 /* Compute parameters for interactions between i and j atoms */
552 qq10 = _fjsp_mul_v2r8(iq1,jq0);
554 /* EWALD ELECTROSTATICS */
556 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
557 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
558 itab_tmp = _fjsp_dtox_v2r8(ewrt);
559 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
560 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
562 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
563 ewtabD = _fjsp_setzero_v2r8();
564 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
565 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
566 ewtabFn = _fjsp_setzero_v2r8();
567 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
568 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
569 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
570 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
571 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
573 /* Update potential sum for this i atom from the interaction with this j atom. */
574 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
575 velecsum = _fjsp_add_v2r8(velecsum,velec);
579 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
581 /* Update vectorial force */
582 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
583 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
584 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
586 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
587 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
588 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
590 /**************************
591 * CALCULATE INTERACTIONS *
592 **************************/
594 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
596 /* Compute parameters for interactions between i and j atoms */
597 qq20 = _fjsp_mul_v2r8(iq2,jq0);
599 /* EWALD ELECTROSTATICS */
601 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
602 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
603 itab_tmp = _fjsp_dtox_v2r8(ewrt);
604 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
605 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
607 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
608 ewtabD = _fjsp_setzero_v2r8();
609 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
610 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
611 ewtabFn = _fjsp_setzero_v2r8();
612 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
613 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
614 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
615 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
616 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
618 /* Update potential sum for this i atom from the interaction with this j atom. */
619 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
620 velecsum = _fjsp_add_v2r8(velecsum,velec);
624 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
626 /* Update vectorial force */
627 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
628 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
629 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
631 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
632 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
633 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
635 /**************************
636 * CALCULATE INTERACTIONS *
637 **************************/
639 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
641 /* Compute parameters for interactions between i and j atoms */
642 qq30 = _fjsp_mul_v2r8(iq3,jq0);
644 /* EWALD ELECTROSTATICS */
646 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
647 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
648 itab_tmp = _fjsp_dtox_v2r8(ewrt);
649 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
650 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
652 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
653 ewtabD = _fjsp_setzero_v2r8();
654 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
655 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
656 ewtabFn = _fjsp_setzero_v2r8();
657 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
658 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
659 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
660 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(rinv30,velec));
661 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
663 /* Update potential sum for this i atom from the interaction with this j atom. */
664 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
665 velecsum = _fjsp_add_v2r8(velecsum,velec);
669 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
671 /* Update vectorial force */
672 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
673 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
674 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
676 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
677 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
678 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
680 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
682 /* Inner loop uses 194 flops */
685 /* End of innermost loop */
687 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
688 f+i_coord_offset,fshift+i_shift_offset);
691 /* Update potential energies */
692 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
693 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
695 /* Increment number of inner iterations */
696 inneriter += j_index_end - j_index_start;
698 /* Outer loop uses 26 flops */
701 /* Increment number of outer iterations */
704 /* Update outer/inner flops */
706 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*194);
709 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
710 * Electrostatics interaction: Ewald
711 * VdW interaction: CubicSplineTable
712 * Geometry: Water4-Particle
713 * Calculate force/pot: Force
716 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
717 (t_nblist * gmx_restrict nlist,
718 rvec * gmx_restrict xx,
719 rvec * gmx_restrict ff,
720 t_forcerec * gmx_restrict fr,
721 t_mdatoms * gmx_restrict mdatoms,
722 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
723 t_nrnb * gmx_restrict nrnb)
725 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
726 * just 0 for non-waters.
727 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
728 * jnr indices corresponding to data put in the four positions in the SIMD register.
730 int i_shift_offset,i_coord_offset,outeriter,inneriter;
731 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
733 int j_coord_offsetA,j_coord_offsetB;
734 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
736 real *shiftvec,*fshift,*x,*f;
737 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
739 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
741 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
743 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
745 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
746 int vdwjidx0A,vdwjidx0B;
747 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
748 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
749 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
750 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
751 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
752 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
755 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
758 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
759 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
760 _fjsp_v2r8 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
762 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
765 _fjsp_v2r8 dummy_mask,cutoff_mask;
766 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
767 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
768 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
775 jindex = nlist->jindex;
777 shiftidx = nlist->shift;
779 shiftvec = fr->shift_vec[0];
780 fshift = fr->fshift[0];
781 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
782 charge = mdatoms->chargeA;
783 nvdwtype = fr->ntype;
785 vdwtype = mdatoms->typeA;
787 vftab = kernel_data->table_vdw->data;
788 vftabscale = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
790 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
791 ewtab = fr->ic->tabq_coul_F;
792 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
793 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
795 /* Setup water-specific parameters */
796 inr = nlist->iinr[0];
797 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
798 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
799 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
800 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
802 /* Avoid stupid compiler warnings */
810 /* Start outer loop over neighborlists */
811 for(iidx=0; iidx<nri; iidx++)
813 /* Load shift vector for this list */
814 i_shift_offset = DIM*shiftidx[iidx];
816 /* Load limits for loop over neighbors */
817 j_index_start = jindex[iidx];
818 j_index_end = jindex[iidx+1];
820 /* Get outer coordinate index */
822 i_coord_offset = DIM*inr;
824 /* Load i particle coords and add shift vector */
825 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
826 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
828 fix0 = _fjsp_setzero_v2r8();
829 fiy0 = _fjsp_setzero_v2r8();
830 fiz0 = _fjsp_setzero_v2r8();
831 fix1 = _fjsp_setzero_v2r8();
832 fiy1 = _fjsp_setzero_v2r8();
833 fiz1 = _fjsp_setzero_v2r8();
834 fix2 = _fjsp_setzero_v2r8();
835 fiy2 = _fjsp_setzero_v2r8();
836 fiz2 = _fjsp_setzero_v2r8();
837 fix3 = _fjsp_setzero_v2r8();
838 fiy3 = _fjsp_setzero_v2r8();
839 fiz3 = _fjsp_setzero_v2r8();
841 /* Start inner kernel loop */
842 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
845 /* Get j neighbor index, and coordinate index */
848 j_coord_offsetA = DIM*jnrA;
849 j_coord_offsetB = DIM*jnrB;
851 /* load j atom coordinates */
852 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
855 /* Calculate displacement vector */
856 dx00 = _fjsp_sub_v2r8(ix0,jx0);
857 dy00 = _fjsp_sub_v2r8(iy0,jy0);
858 dz00 = _fjsp_sub_v2r8(iz0,jz0);
859 dx10 = _fjsp_sub_v2r8(ix1,jx0);
860 dy10 = _fjsp_sub_v2r8(iy1,jy0);
861 dz10 = _fjsp_sub_v2r8(iz1,jz0);
862 dx20 = _fjsp_sub_v2r8(ix2,jx0);
863 dy20 = _fjsp_sub_v2r8(iy2,jy0);
864 dz20 = _fjsp_sub_v2r8(iz2,jz0);
865 dx30 = _fjsp_sub_v2r8(ix3,jx0);
866 dy30 = _fjsp_sub_v2r8(iy3,jy0);
867 dz30 = _fjsp_sub_v2r8(iz3,jz0);
869 /* Calculate squared distance and things based on it */
870 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
871 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
872 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
873 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
875 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
876 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
877 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
878 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
880 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
881 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
882 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
884 /* Load parameters for j particles */
885 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
886 vdwjidx0A = 2*vdwtype[jnrA+0];
887 vdwjidx0B = 2*vdwtype[jnrB+0];
889 fjx0 = _fjsp_setzero_v2r8();
890 fjy0 = _fjsp_setzero_v2r8();
891 fjz0 = _fjsp_setzero_v2r8();
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
897 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
899 /* Compute parameters for interactions between i and j atoms */
900 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
901 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
903 /* Calculate table index by multiplying r with table scale and truncate to integer */
904 rt = _fjsp_mul_v2r8(r00,vftabscale);
905 itab_tmp = _fjsp_dtox_v2r8(rt);
906 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
907 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
908 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
913 /* CUBIC SPLINE TABLE DISPERSION */
914 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
915 F = _fjsp_load_v2r8( vftab + vfconv.i[1] );
916 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
917 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
918 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
919 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
920 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
921 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
922 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
924 /* CUBIC SPLINE TABLE REPULSION */
925 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
926 F = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
927 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
928 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
929 H = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
930 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
931 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
932 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
933 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
934 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
938 /* Update vectorial force */
939 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
940 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
941 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
943 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
944 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
945 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
947 /**************************
948 * CALCULATE INTERACTIONS *
949 **************************/
951 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
953 /* Compute parameters for interactions between i and j atoms */
954 qq10 = _fjsp_mul_v2r8(iq1,jq0);
956 /* EWALD ELECTROSTATICS */
958 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
959 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
960 itab_tmp = _fjsp_dtox_v2r8(ewrt);
961 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
962 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
964 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
966 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
967 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
971 /* Update vectorial force */
972 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
973 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
974 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
976 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
977 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
978 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
980 /**************************
981 * CALCULATE INTERACTIONS *
982 **************************/
984 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
986 /* Compute parameters for interactions between i and j atoms */
987 qq20 = _fjsp_mul_v2r8(iq2,jq0);
989 /* EWALD ELECTROSTATICS */
991 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
992 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
993 itab_tmp = _fjsp_dtox_v2r8(ewrt);
994 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
995 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
997 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
999 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1000 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1004 /* Update vectorial force */
1005 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1006 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1007 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1009 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1010 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1011 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1013 /**************************
1014 * CALCULATE INTERACTIONS *
1015 **************************/
1017 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1019 /* Compute parameters for interactions between i and j atoms */
1020 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1022 /* EWALD ELECTROSTATICS */
1024 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1025 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1026 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1027 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1028 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1030 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1032 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1033 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1037 /* Update vectorial force */
1038 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1039 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1040 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1042 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1043 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1044 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1046 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1048 /* Inner loop uses 171 flops */
1051 if(jidx<j_index_end)
1055 j_coord_offsetA = DIM*jnrA;
1057 /* load j atom coordinates */
1058 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1061 /* Calculate displacement vector */
1062 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1063 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1064 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1065 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1066 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1067 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1068 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1069 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1070 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1071 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1072 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1073 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1075 /* Calculate squared distance and things based on it */
1076 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1077 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1078 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1079 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1081 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1082 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1083 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1084 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1086 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1087 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1088 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1090 /* Load parameters for j particles */
1091 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1092 vdwjidx0A = 2*vdwtype[jnrA+0];
1094 fjx0 = _fjsp_setzero_v2r8();
1095 fjy0 = _fjsp_setzero_v2r8();
1096 fjz0 = _fjsp_setzero_v2r8();
1098 /**************************
1099 * CALCULATE INTERACTIONS *
1100 **************************/
1102 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1104 /* Compute parameters for interactions between i and j atoms */
1105 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1106 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1108 /* Calculate table index by multiplying r with table scale and truncate to integer */
1109 rt = _fjsp_mul_v2r8(r00,vftabscale);
1110 itab_tmp = _fjsp_dtox_v2r8(rt);
1111 vfeps = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1112 twovfeps = _fjsp_add_v2r8(vfeps,vfeps);
1113 _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1118 /* CUBIC SPLINE TABLE DISPERSION */
1119 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1120 F = _fjsp_setzero_v2r8();
1121 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1122 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1123 H = _fjsp_setzero_v2r8();
1124 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1125 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1126 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1127 fvdw6 = _fjsp_mul_v2r8(c6_00,FF);
1129 /* CUBIC SPLINE TABLE REPULSION */
1130 Y = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1131 F = _fjsp_setzero_v2r8();
1132 GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1133 G = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1134 H = _fjsp_setzero_v2r8();
1135 GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1136 Fp = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1137 FF = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1138 fvdw12 = _fjsp_mul_v2r8(c12_00,FF);
1139 fvdw = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1143 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1145 /* Update vectorial force */
1146 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1147 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1148 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1150 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1151 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1152 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1154 /**************************
1155 * CALCULATE INTERACTIONS *
1156 **************************/
1158 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1160 /* Compute parameters for interactions between i and j atoms */
1161 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1163 /* EWALD ELECTROSTATICS */
1165 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1166 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1167 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1168 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1169 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1171 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1172 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1173 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1177 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1179 /* Update vectorial force */
1180 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1181 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1182 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1184 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1185 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1186 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1188 /**************************
1189 * CALCULATE INTERACTIONS *
1190 **************************/
1192 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1194 /* Compute parameters for interactions between i and j atoms */
1195 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1197 /* EWALD ELECTROSTATICS */
1199 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1200 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1201 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1202 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1203 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1205 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1206 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1207 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1211 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1213 /* Update vectorial force */
1214 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1215 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1216 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1218 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1219 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1220 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1222 /**************************
1223 * CALCULATE INTERACTIONS *
1224 **************************/
1226 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1228 /* Compute parameters for interactions between i and j atoms */
1229 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1231 /* EWALD ELECTROSTATICS */
1233 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1234 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1235 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1236 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1237 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1239 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1240 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1241 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1245 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1247 /* Update vectorial force */
1248 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1249 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1250 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1252 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1253 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1254 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1256 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1258 /* Inner loop uses 171 flops */
1261 /* End of innermost loop */
1263 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1264 f+i_coord_offset,fshift+i_shift_offset);
1266 /* Increment number of inner iterations */
1267 inneriter += j_index_end - j_index_start;
1269 /* Outer loop uses 24 flops */
1272 /* Increment number of outer iterations */
1275 /* Update outer/inner flops */
1277 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*171);