2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017,2018, 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/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct 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;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
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 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
121 charge = mdatoms->chargeA;
122 nvdwtype = fr->ntype;
124 vdwtype = mdatoms->typeA;
126 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
127 ewtab = fr->ic->tabq_coul_FDV0;
128 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
129 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
131 /* Setup water-specific parameters */
132 inr = nlist->iinr[0];
133 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
134 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
135 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
136 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
138 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
139 rcutoff_scalar = fr->ic->rcoulomb;
140 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
141 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
143 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
144 rvdw = gmx_fjsp_set1_v2r8(fr->ic->rvdw);
146 /* Avoid stupid compiler warnings */
154 /* Start outer loop over neighborlists */
155 for(iidx=0; iidx<nri; iidx++)
157 /* Load shift vector for this list */
158 i_shift_offset = DIM*shiftidx[iidx];
160 /* Load limits for loop over neighbors */
161 j_index_start = jindex[iidx];
162 j_index_end = jindex[iidx+1];
164 /* Get outer coordinate index */
166 i_coord_offset = DIM*inr;
168 /* Load i particle coords and add shift vector */
169 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
170 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
172 fix0 = _fjsp_setzero_v2r8();
173 fiy0 = _fjsp_setzero_v2r8();
174 fiz0 = _fjsp_setzero_v2r8();
175 fix1 = _fjsp_setzero_v2r8();
176 fiy1 = _fjsp_setzero_v2r8();
177 fiz1 = _fjsp_setzero_v2r8();
178 fix2 = _fjsp_setzero_v2r8();
179 fiy2 = _fjsp_setzero_v2r8();
180 fiz2 = _fjsp_setzero_v2r8();
181 fix3 = _fjsp_setzero_v2r8();
182 fiy3 = _fjsp_setzero_v2r8();
183 fiz3 = _fjsp_setzero_v2r8();
185 /* Reset potential sums */
186 velecsum = _fjsp_setzero_v2r8();
187 vvdwsum = _fjsp_setzero_v2r8();
189 /* Start inner kernel loop */
190 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
193 /* Get j neighbor index, and coordinate index */
196 j_coord_offsetA = DIM*jnrA;
197 j_coord_offsetB = DIM*jnrB;
199 /* load j atom coordinates */
200 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
203 /* Calculate displacement vector */
204 dx00 = _fjsp_sub_v2r8(ix0,jx0);
205 dy00 = _fjsp_sub_v2r8(iy0,jy0);
206 dz00 = _fjsp_sub_v2r8(iz0,jz0);
207 dx10 = _fjsp_sub_v2r8(ix1,jx0);
208 dy10 = _fjsp_sub_v2r8(iy1,jy0);
209 dz10 = _fjsp_sub_v2r8(iz1,jz0);
210 dx20 = _fjsp_sub_v2r8(ix2,jx0);
211 dy20 = _fjsp_sub_v2r8(iy2,jy0);
212 dz20 = _fjsp_sub_v2r8(iz2,jz0);
213 dx30 = _fjsp_sub_v2r8(ix3,jx0);
214 dy30 = _fjsp_sub_v2r8(iy3,jy0);
215 dz30 = _fjsp_sub_v2r8(iz3,jz0);
217 /* Calculate squared distance and things based on it */
218 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
219 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
220 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
221 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
223 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
224 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
225 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
227 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
228 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
229 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
230 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
232 /* Load parameters for j particles */
233 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
234 vdwjidx0A = 2*vdwtype[jnrA+0];
235 vdwjidx0B = 2*vdwtype[jnrB+0];
237 fjx0 = _fjsp_setzero_v2r8();
238 fjy0 = _fjsp_setzero_v2r8();
239 fjz0 = _fjsp_setzero_v2r8();
241 /**************************
242 * CALCULATE INTERACTIONS *
243 **************************/
245 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
248 /* Compute parameters for interactions between i and j atoms */
249 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
250 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
252 /* LENNARD-JONES DISPERSION/REPULSION */
254 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
255 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
256 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
257 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
258 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
259 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
261 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
263 /* Update potential sum for this i atom from the interaction with this j atom. */
264 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
265 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
269 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
271 /* Update vectorial force */
272 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
273 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
274 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
276 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
277 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
278 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
282 /**************************
283 * CALCULATE INTERACTIONS *
284 **************************/
286 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
289 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
291 /* Compute parameters for interactions between i and j atoms */
292 qq10 = _fjsp_mul_v2r8(iq1,jq0);
294 /* EWALD ELECTROSTATICS */
296 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
297 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
298 itab_tmp = _fjsp_dtox_v2r8(ewrt);
299 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
300 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
302 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
303 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
304 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
305 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
306 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
307 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
308 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
309 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
310 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
311 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
313 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
315 /* Update potential sum for this i atom from the interaction with this j atom. */
316 velec = _fjsp_and_v2r8(velec,cutoff_mask);
317 velecsum = _fjsp_add_v2r8(velecsum,velec);
321 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
323 /* Update vectorial force */
324 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
325 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
326 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
328 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
329 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
330 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
334 /**************************
335 * CALCULATE INTERACTIONS *
336 **************************/
338 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
341 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
343 /* Compute parameters for interactions between i and j atoms */
344 qq20 = _fjsp_mul_v2r8(iq2,jq0);
346 /* EWALD ELECTROSTATICS */
348 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
349 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
350 itab_tmp = _fjsp_dtox_v2r8(ewrt);
351 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
352 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
354 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
355 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
356 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
357 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
358 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
359 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
360 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
361 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
362 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
363 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
365 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
367 /* Update potential sum for this i atom from the interaction with this j atom. */
368 velec = _fjsp_and_v2r8(velec,cutoff_mask);
369 velecsum = _fjsp_add_v2r8(velecsum,velec);
373 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
375 /* Update vectorial force */
376 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
377 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
378 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
380 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
381 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
382 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
386 /**************************
387 * CALCULATE INTERACTIONS *
388 **************************/
390 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
393 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
395 /* Compute parameters for interactions between i and j atoms */
396 qq30 = _fjsp_mul_v2r8(iq3,jq0);
398 /* EWALD ELECTROSTATICS */
400 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
401 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
402 itab_tmp = _fjsp_dtox_v2r8(ewrt);
403 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
404 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
406 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
407 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
408 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
409 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
410 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
411 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
412 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
413 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
414 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
415 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
417 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
419 /* Update potential sum for this i atom from the interaction with this j atom. */
420 velec = _fjsp_and_v2r8(velec,cutoff_mask);
421 velecsum = _fjsp_add_v2r8(velecsum,velec);
425 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
427 /* Update vectorial force */
428 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
429 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
430 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
432 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
433 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
434 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
438 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
440 /* Inner loop uses 194 flops */
447 j_coord_offsetA = DIM*jnrA;
449 /* load j atom coordinates */
450 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
453 /* Calculate displacement vector */
454 dx00 = _fjsp_sub_v2r8(ix0,jx0);
455 dy00 = _fjsp_sub_v2r8(iy0,jy0);
456 dz00 = _fjsp_sub_v2r8(iz0,jz0);
457 dx10 = _fjsp_sub_v2r8(ix1,jx0);
458 dy10 = _fjsp_sub_v2r8(iy1,jy0);
459 dz10 = _fjsp_sub_v2r8(iz1,jz0);
460 dx20 = _fjsp_sub_v2r8(ix2,jx0);
461 dy20 = _fjsp_sub_v2r8(iy2,jy0);
462 dz20 = _fjsp_sub_v2r8(iz2,jz0);
463 dx30 = _fjsp_sub_v2r8(ix3,jx0);
464 dy30 = _fjsp_sub_v2r8(iy3,jy0);
465 dz30 = _fjsp_sub_v2r8(iz3,jz0);
467 /* Calculate squared distance and things based on it */
468 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
469 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
470 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
471 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
473 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
474 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
475 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
477 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
478 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
479 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
480 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
482 /* Load parameters for j particles */
483 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
484 vdwjidx0A = 2*vdwtype[jnrA+0];
486 fjx0 = _fjsp_setzero_v2r8();
487 fjy0 = _fjsp_setzero_v2r8();
488 fjz0 = _fjsp_setzero_v2r8();
490 /**************************
491 * CALCULATE INTERACTIONS *
492 **************************/
494 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
497 /* Compute parameters for interactions between i and j atoms */
498 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
499 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
501 /* LENNARD-JONES DISPERSION/REPULSION */
503 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
504 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
505 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
506 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
507 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
508 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
510 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
512 /* Update potential sum for this i atom from the interaction with this j atom. */
513 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
514 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
515 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
519 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
521 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
523 /* Update vectorial force */
524 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
525 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
526 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
528 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
529 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
530 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
534 /**************************
535 * CALCULATE INTERACTIONS *
536 **************************/
538 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
541 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
543 /* Compute parameters for interactions between i and j atoms */
544 qq10 = _fjsp_mul_v2r8(iq1,jq0);
546 /* EWALD ELECTROSTATICS */
548 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
549 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
550 itab_tmp = _fjsp_dtox_v2r8(ewrt);
551 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
552 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
554 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
555 ewtabD = _fjsp_setzero_v2r8();
556 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
557 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
558 ewtabFn = _fjsp_setzero_v2r8();
559 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
560 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
561 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
562 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
563 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
565 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
567 /* Update potential sum for this i atom from the interaction with this j atom. */
568 velec = _fjsp_and_v2r8(velec,cutoff_mask);
569 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
570 velecsum = _fjsp_add_v2r8(velecsum,velec);
574 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
576 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
578 /* Update vectorial force */
579 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
580 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
581 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
583 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
584 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
585 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
589 /**************************
590 * CALCULATE INTERACTIONS *
591 **************************/
593 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
596 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
598 /* Compute parameters for interactions between i and j atoms */
599 qq20 = _fjsp_mul_v2r8(iq2,jq0);
601 /* EWALD ELECTROSTATICS */
603 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
604 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
605 itab_tmp = _fjsp_dtox_v2r8(ewrt);
606 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
607 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
609 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
610 ewtabD = _fjsp_setzero_v2r8();
611 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
612 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
613 ewtabFn = _fjsp_setzero_v2r8();
614 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
615 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
616 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
617 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
618 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
620 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
622 /* Update potential sum for this i atom from the interaction with this j atom. */
623 velec = _fjsp_and_v2r8(velec,cutoff_mask);
624 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
625 velecsum = _fjsp_add_v2r8(velecsum,velec);
629 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
631 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
633 /* Update vectorial force */
634 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
635 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
636 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
638 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
639 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
640 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
644 /**************************
645 * CALCULATE INTERACTIONS *
646 **************************/
648 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
651 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
653 /* Compute parameters for interactions between i and j atoms */
654 qq30 = _fjsp_mul_v2r8(iq3,jq0);
656 /* EWALD ELECTROSTATICS */
658 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
659 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
660 itab_tmp = _fjsp_dtox_v2r8(ewrt);
661 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
662 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
664 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
665 ewtabD = _fjsp_setzero_v2r8();
666 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
667 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
668 ewtabFn = _fjsp_setzero_v2r8();
669 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
670 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
671 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
672 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
673 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
675 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
677 /* Update potential sum for this i atom from the interaction with this j atom. */
678 velec = _fjsp_and_v2r8(velec,cutoff_mask);
679 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
680 velecsum = _fjsp_add_v2r8(velecsum,velec);
684 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
686 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
688 /* Update vectorial force */
689 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
690 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
691 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
693 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
694 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
695 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
699 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
701 /* Inner loop uses 194 flops */
704 /* End of innermost loop */
706 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
707 f+i_coord_offset,fshift+i_shift_offset);
710 /* Update potential energies */
711 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
712 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
714 /* Increment number of inner iterations */
715 inneriter += j_index_end - j_index_start;
717 /* Outer loop uses 26 flops */
720 /* Increment number of outer iterations */
723 /* Update outer/inner flops */
725 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*194);
728 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
729 * Electrostatics interaction: Ewald
730 * VdW interaction: LennardJones
731 * Geometry: Water4-Particle
732 * Calculate force/pot: Force
735 nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
736 (t_nblist * gmx_restrict nlist,
737 rvec * gmx_restrict xx,
738 rvec * gmx_restrict ff,
739 struct t_forcerec * gmx_restrict fr,
740 t_mdatoms * gmx_restrict mdatoms,
741 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
742 t_nrnb * gmx_restrict nrnb)
744 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
745 * just 0 for non-waters.
746 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
747 * jnr indices corresponding to data put in the four positions in the SIMD register.
749 int i_shift_offset,i_coord_offset,outeriter,inneriter;
750 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
752 int j_coord_offsetA,j_coord_offsetB;
753 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
755 real *shiftvec,*fshift,*x,*f;
756 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
758 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
760 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
762 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
764 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
765 int vdwjidx0A,vdwjidx0B;
766 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
767 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
768 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
769 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
770 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
771 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
774 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
777 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
778 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
779 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
782 _fjsp_v2r8 dummy_mask,cutoff_mask;
783 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
784 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
785 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
792 jindex = nlist->jindex;
794 shiftidx = nlist->shift;
796 shiftvec = fr->shift_vec[0];
797 fshift = fr->fshift[0];
798 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
799 charge = mdatoms->chargeA;
800 nvdwtype = fr->ntype;
802 vdwtype = mdatoms->typeA;
804 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
805 ewtab = fr->ic->tabq_coul_F;
806 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
807 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
809 /* Setup water-specific parameters */
810 inr = nlist->iinr[0];
811 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
812 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
813 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
814 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
816 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
817 rcutoff_scalar = fr->ic->rcoulomb;
818 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
819 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
821 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
822 rvdw = gmx_fjsp_set1_v2r8(fr->ic->rvdw);
824 /* Avoid stupid compiler warnings */
832 /* Start outer loop over neighborlists */
833 for(iidx=0; iidx<nri; iidx++)
835 /* Load shift vector for this list */
836 i_shift_offset = DIM*shiftidx[iidx];
838 /* Load limits for loop over neighbors */
839 j_index_start = jindex[iidx];
840 j_index_end = jindex[iidx+1];
842 /* Get outer coordinate index */
844 i_coord_offset = DIM*inr;
846 /* Load i particle coords and add shift vector */
847 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
848 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
850 fix0 = _fjsp_setzero_v2r8();
851 fiy0 = _fjsp_setzero_v2r8();
852 fiz0 = _fjsp_setzero_v2r8();
853 fix1 = _fjsp_setzero_v2r8();
854 fiy1 = _fjsp_setzero_v2r8();
855 fiz1 = _fjsp_setzero_v2r8();
856 fix2 = _fjsp_setzero_v2r8();
857 fiy2 = _fjsp_setzero_v2r8();
858 fiz2 = _fjsp_setzero_v2r8();
859 fix3 = _fjsp_setzero_v2r8();
860 fiy3 = _fjsp_setzero_v2r8();
861 fiz3 = _fjsp_setzero_v2r8();
863 /* Start inner kernel loop */
864 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
867 /* Get j neighbor index, and coordinate index */
870 j_coord_offsetA = DIM*jnrA;
871 j_coord_offsetB = DIM*jnrB;
873 /* load j atom coordinates */
874 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
877 /* Calculate displacement vector */
878 dx00 = _fjsp_sub_v2r8(ix0,jx0);
879 dy00 = _fjsp_sub_v2r8(iy0,jy0);
880 dz00 = _fjsp_sub_v2r8(iz0,jz0);
881 dx10 = _fjsp_sub_v2r8(ix1,jx0);
882 dy10 = _fjsp_sub_v2r8(iy1,jy0);
883 dz10 = _fjsp_sub_v2r8(iz1,jz0);
884 dx20 = _fjsp_sub_v2r8(ix2,jx0);
885 dy20 = _fjsp_sub_v2r8(iy2,jy0);
886 dz20 = _fjsp_sub_v2r8(iz2,jz0);
887 dx30 = _fjsp_sub_v2r8(ix3,jx0);
888 dy30 = _fjsp_sub_v2r8(iy3,jy0);
889 dz30 = _fjsp_sub_v2r8(iz3,jz0);
891 /* Calculate squared distance and things based on it */
892 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
893 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
894 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
895 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
897 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
898 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
899 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
901 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
902 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
903 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
904 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
906 /* Load parameters for j particles */
907 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
908 vdwjidx0A = 2*vdwtype[jnrA+0];
909 vdwjidx0B = 2*vdwtype[jnrB+0];
911 fjx0 = _fjsp_setzero_v2r8();
912 fjy0 = _fjsp_setzero_v2r8();
913 fjz0 = _fjsp_setzero_v2r8();
915 /**************************
916 * CALCULATE INTERACTIONS *
917 **************************/
919 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
922 /* Compute parameters for interactions between i and j atoms */
923 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
924 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
926 /* LENNARD-JONES DISPERSION/REPULSION */
928 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
929 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
931 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
935 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
937 /* Update vectorial force */
938 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
939 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
940 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
942 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
943 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
944 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
948 /**************************
949 * CALCULATE INTERACTIONS *
950 **************************/
952 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
955 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
957 /* Compute parameters for interactions between i and j atoms */
958 qq10 = _fjsp_mul_v2r8(iq1,jq0);
960 /* EWALD ELECTROSTATICS */
962 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
963 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
964 itab_tmp = _fjsp_dtox_v2r8(ewrt);
965 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
966 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
968 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
970 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
971 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
973 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
977 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
979 /* Update vectorial force */
980 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
981 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
982 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
984 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
985 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
986 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
990 /**************************
991 * CALCULATE INTERACTIONS *
992 **************************/
994 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
997 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
999 /* Compute parameters for interactions between i and j atoms */
1000 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1002 /* EWALD ELECTROSTATICS */
1004 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1005 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1006 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1007 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1008 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1010 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1012 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1013 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1015 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1019 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1021 /* Update vectorial force */
1022 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1023 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1024 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1026 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1027 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1028 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1032 /**************************
1033 * CALCULATE INTERACTIONS *
1034 **************************/
1036 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1039 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1041 /* Compute parameters for interactions between i and j atoms */
1042 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1044 /* EWALD ELECTROSTATICS */
1046 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1047 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1048 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1049 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1050 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1052 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1054 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1055 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1057 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1061 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1063 /* Update vectorial force */
1064 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1065 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1066 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1068 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1069 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1070 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1074 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1076 /* Inner loop uses 162 flops */
1079 if(jidx<j_index_end)
1083 j_coord_offsetA = DIM*jnrA;
1085 /* load j atom coordinates */
1086 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1089 /* Calculate displacement vector */
1090 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1091 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1092 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1093 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1094 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1095 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1096 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1097 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1098 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1099 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1100 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1101 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1103 /* Calculate squared distance and things based on it */
1104 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1105 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1106 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1107 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1109 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1110 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1111 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1113 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1114 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1115 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1116 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1118 /* Load parameters for j particles */
1119 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1120 vdwjidx0A = 2*vdwtype[jnrA+0];
1122 fjx0 = _fjsp_setzero_v2r8();
1123 fjy0 = _fjsp_setzero_v2r8();
1124 fjz0 = _fjsp_setzero_v2r8();
1126 /**************************
1127 * CALCULATE INTERACTIONS *
1128 **************************/
1130 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1133 /* Compute parameters for interactions between i and j atoms */
1134 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1135 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1137 /* LENNARD-JONES DISPERSION/REPULSION */
1139 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1140 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1142 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1146 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1148 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1150 /* Update vectorial force */
1151 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1152 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1153 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1155 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1156 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1157 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1161 /**************************
1162 * CALCULATE INTERACTIONS *
1163 **************************/
1165 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1168 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1170 /* Compute parameters for interactions between i and j atoms */
1171 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1173 /* EWALD ELECTROSTATICS */
1175 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1176 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1177 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1178 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1179 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1181 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1182 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1183 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1185 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1189 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1191 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1193 /* Update vectorial force */
1194 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1195 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1196 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1198 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1199 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1200 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1204 /**************************
1205 * CALCULATE INTERACTIONS *
1206 **************************/
1208 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1211 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1213 /* Compute parameters for interactions between i and j atoms */
1214 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1216 /* EWALD ELECTROSTATICS */
1218 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1219 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1220 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1221 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1222 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1224 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1225 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1226 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1228 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1232 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1234 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1236 /* Update vectorial force */
1237 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1238 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1239 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1241 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1242 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1243 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1247 /**************************
1248 * CALCULATE INTERACTIONS *
1249 **************************/
1251 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1254 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1256 /* Compute parameters for interactions between i and j atoms */
1257 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1259 /* EWALD ELECTROSTATICS */
1261 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1262 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1263 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1264 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1265 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1267 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1268 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1269 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1271 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1275 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1277 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1279 /* Update vectorial force */
1280 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1281 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1282 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1284 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1285 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1286 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1290 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1292 /* Inner loop uses 162 flops */
1295 /* End of innermost loop */
1297 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1298 f+i_coord_offset,fshift+i_shift_offset);
1300 /* Increment number of inner iterations */
1301 inneriter += j_index_end - j_index_start;
1303 /* Outer loop uses 24 flops */
1306 /* Increment number of outer iterations */
1309 /* Update outer/inner flops */
1311 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*162);