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 "types/simple.h"
46 #include "gromacs/math/vec.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: LennardJones
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEwSh_VdwLJSh_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 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
103 _fjsp_v2r8 dummy_mask,cutoff_mask;
104 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
105 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
106 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
119 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
120 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
126 ewtab = fr->ic->tabq_coul_FDV0;
127 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
128 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
130 /* Setup water-specific parameters */
131 inr = nlist->iinr[0];
132 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+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 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
137 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
138 rcutoff_scalar = fr->rcoulomb;
139 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
140 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
142 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
143 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
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_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
169 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
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();
181 /* Reset potential sums */
182 velecsum = _fjsp_setzero_v2r8();
183 vvdwsum = _fjsp_setzero_v2r8();
185 /* Start inner kernel loop */
186 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
189 /* Get j neighbor index, and coordinate index */
192 j_coord_offsetA = DIM*jnrA;
193 j_coord_offsetB = DIM*jnrB;
195 /* load j atom coordinates */
196 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
199 /* Calculate displacement vector */
200 dx00 = _fjsp_sub_v2r8(ix0,jx0);
201 dy00 = _fjsp_sub_v2r8(iy0,jy0);
202 dz00 = _fjsp_sub_v2r8(iz0,jz0);
203 dx10 = _fjsp_sub_v2r8(ix1,jx0);
204 dy10 = _fjsp_sub_v2r8(iy1,jy0);
205 dz10 = _fjsp_sub_v2r8(iz1,jz0);
206 dx20 = _fjsp_sub_v2r8(ix2,jx0);
207 dy20 = _fjsp_sub_v2r8(iy2,jy0);
208 dz20 = _fjsp_sub_v2r8(iz2,jz0);
210 /* Calculate squared distance and things based on it */
211 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
212 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
213 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
215 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
216 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
217 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
219 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
220 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
221 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
223 /* Load parameters for j particles */
224 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
225 vdwjidx0A = 2*vdwtype[jnrA+0];
226 vdwjidx0B = 2*vdwtype[jnrB+0];
228 fjx0 = _fjsp_setzero_v2r8();
229 fjy0 = _fjsp_setzero_v2r8();
230 fjz0 = _fjsp_setzero_v2r8();
232 /**************************
233 * CALCULATE INTERACTIONS *
234 **************************/
236 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
239 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
241 /* Compute parameters for interactions between i and j atoms */
242 qq00 = _fjsp_mul_v2r8(iq0,jq0);
243 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
244 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
246 /* EWALD ELECTROSTATICS */
248 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
249 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
250 itab_tmp = _fjsp_dtox_v2r8(ewrt);
251 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
252 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
254 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
255 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
256 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
257 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
258 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
259 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
260 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
261 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
262 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv00,sh_ewald),velec));
263 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
265 /* LENNARD-JONES DISPERSION/REPULSION */
267 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
268 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
269 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
270 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
271 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
272 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
274 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
276 /* Update potential sum for this i atom from the interaction with this j atom. */
277 velec = _fjsp_and_v2r8(velec,cutoff_mask);
278 velecsum = _fjsp_add_v2r8(velecsum,velec);
279 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
280 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
282 fscal = _fjsp_add_v2r8(felec,fvdw);
284 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
286 /* Update vectorial force */
287 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
288 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
289 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
291 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
292 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
293 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
297 /**************************
298 * CALCULATE INTERACTIONS *
299 **************************/
301 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
304 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
306 /* Compute parameters for interactions between i and j atoms */
307 qq10 = _fjsp_mul_v2r8(iq1,jq0);
309 /* EWALD ELECTROSTATICS */
311 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
312 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
313 itab_tmp = _fjsp_dtox_v2r8(ewrt);
314 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
315 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
317 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
318 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
319 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
320 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
321 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
322 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
323 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
324 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
325 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
326 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
328 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
330 /* Update potential sum for this i atom from the interaction with this j atom. */
331 velec = _fjsp_and_v2r8(velec,cutoff_mask);
332 velecsum = _fjsp_add_v2r8(velecsum,velec);
336 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
338 /* Update vectorial force */
339 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
340 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
341 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
343 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
344 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
345 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
349 /**************************
350 * CALCULATE INTERACTIONS *
351 **************************/
353 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
356 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
358 /* Compute parameters for interactions between i and j atoms */
359 qq20 = _fjsp_mul_v2r8(iq2,jq0);
361 /* EWALD ELECTROSTATICS */
363 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
364 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
365 itab_tmp = _fjsp_dtox_v2r8(ewrt);
366 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
367 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
369 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
370 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
371 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
372 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
373 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
374 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
375 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
376 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
377 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
378 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
380 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
382 /* Update potential sum for this i atom from the interaction with this j atom. */
383 velec = _fjsp_and_v2r8(velec,cutoff_mask);
384 velecsum = _fjsp_add_v2r8(velecsum,velec);
388 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
390 /* Update vectorial force */
391 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
392 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
393 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
395 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
396 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
397 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
401 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
403 /* Inner loop uses 168 flops */
410 j_coord_offsetA = DIM*jnrA;
412 /* load j atom coordinates */
413 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
416 /* Calculate displacement vector */
417 dx00 = _fjsp_sub_v2r8(ix0,jx0);
418 dy00 = _fjsp_sub_v2r8(iy0,jy0);
419 dz00 = _fjsp_sub_v2r8(iz0,jz0);
420 dx10 = _fjsp_sub_v2r8(ix1,jx0);
421 dy10 = _fjsp_sub_v2r8(iy1,jy0);
422 dz10 = _fjsp_sub_v2r8(iz1,jz0);
423 dx20 = _fjsp_sub_v2r8(ix2,jx0);
424 dy20 = _fjsp_sub_v2r8(iy2,jy0);
425 dz20 = _fjsp_sub_v2r8(iz2,jz0);
427 /* Calculate squared distance and things based on it */
428 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
429 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
430 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
432 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
433 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
434 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
436 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
437 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
438 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
440 /* Load parameters for j particles */
441 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
442 vdwjidx0A = 2*vdwtype[jnrA+0];
444 fjx0 = _fjsp_setzero_v2r8();
445 fjy0 = _fjsp_setzero_v2r8();
446 fjz0 = _fjsp_setzero_v2r8();
448 /**************************
449 * CALCULATE INTERACTIONS *
450 **************************/
452 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
455 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
457 /* Compute parameters for interactions between i and j atoms */
458 qq00 = _fjsp_mul_v2r8(iq0,jq0);
459 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
461 /* EWALD ELECTROSTATICS */
463 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
464 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
465 itab_tmp = _fjsp_dtox_v2r8(ewrt);
466 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
467 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
469 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
470 ewtabD = _fjsp_setzero_v2r8();
471 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
472 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
473 ewtabFn = _fjsp_setzero_v2r8();
474 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
475 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
476 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
477 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv00,sh_ewald),velec));
478 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
480 /* LENNARD-JONES DISPERSION/REPULSION */
482 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
483 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
484 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
485 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
486 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
487 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
489 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
491 /* Update potential sum for this i atom from the interaction with this j atom. */
492 velec = _fjsp_and_v2r8(velec,cutoff_mask);
493 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
494 velecsum = _fjsp_add_v2r8(velecsum,velec);
495 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
496 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
497 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
499 fscal = _fjsp_add_v2r8(felec,fvdw);
501 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
503 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
505 /* Update vectorial force */
506 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
507 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
508 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
510 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
511 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
512 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
520 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
523 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
525 /* Compute parameters for interactions between i and j atoms */
526 qq10 = _fjsp_mul_v2r8(iq1,jq0);
528 /* EWALD ELECTROSTATICS */
530 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
531 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
532 itab_tmp = _fjsp_dtox_v2r8(ewrt);
533 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
534 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
536 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
537 ewtabD = _fjsp_setzero_v2r8();
538 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
539 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
540 ewtabFn = _fjsp_setzero_v2r8();
541 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
542 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
543 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
544 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
545 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
547 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
549 /* Update potential sum for this i atom from the interaction with this j atom. */
550 velec = _fjsp_and_v2r8(velec,cutoff_mask);
551 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
552 velecsum = _fjsp_add_v2r8(velecsum,velec);
556 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
558 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
560 /* Update vectorial force */
561 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
562 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
563 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
565 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
566 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
567 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
571 /**************************
572 * CALCULATE INTERACTIONS *
573 **************************/
575 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
578 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
580 /* Compute parameters for interactions between i and j atoms */
581 qq20 = _fjsp_mul_v2r8(iq2,jq0);
583 /* EWALD ELECTROSTATICS */
585 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
586 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
587 itab_tmp = _fjsp_dtox_v2r8(ewrt);
588 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
589 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
591 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
592 ewtabD = _fjsp_setzero_v2r8();
593 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
594 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
595 ewtabFn = _fjsp_setzero_v2r8();
596 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
597 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
598 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
599 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
600 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
602 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
604 /* Update potential sum for this i atom from the interaction with this j atom. */
605 velec = _fjsp_and_v2r8(velec,cutoff_mask);
606 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
607 velecsum = _fjsp_add_v2r8(velecsum,velec);
611 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
613 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
615 /* Update vectorial force */
616 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
617 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
618 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
620 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
621 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
622 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
626 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
628 /* Inner loop uses 168 flops */
631 /* End of innermost loop */
633 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
634 f+i_coord_offset,fshift+i_shift_offset);
637 /* Update potential energies */
638 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
639 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
641 /* Increment number of inner iterations */
642 inneriter += j_index_end - j_index_start;
644 /* Outer loop uses 20 flops */
647 /* Increment number of outer iterations */
650 /* Update outer/inner flops */
652 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*168);
655 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
656 * Electrostatics interaction: Ewald
657 * VdW interaction: LennardJones
658 * Geometry: Water3-Particle
659 * Calculate force/pot: Force
662 nb_kernel_ElecEwSh_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
663 (t_nblist * gmx_restrict nlist,
664 rvec * gmx_restrict xx,
665 rvec * gmx_restrict ff,
666 t_forcerec * gmx_restrict fr,
667 t_mdatoms * gmx_restrict mdatoms,
668 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
669 t_nrnb * gmx_restrict nrnb)
671 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
672 * just 0 for non-waters.
673 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
674 * jnr indices corresponding to data put in the four positions in the SIMD register.
676 int i_shift_offset,i_coord_offset,outeriter,inneriter;
677 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
679 int j_coord_offsetA,j_coord_offsetB;
680 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
682 real *shiftvec,*fshift,*x,*f;
683 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
685 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
687 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
689 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
690 int vdwjidx0A,vdwjidx0B;
691 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
692 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
693 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
694 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
695 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
698 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
701 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
702 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
703 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
706 _fjsp_v2r8 dummy_mask,cutoff_mask;
707 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
708 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
709 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
716 jindex = nlist->jindex;
718 shiftidx = nlist->shift;
720 shiftvec = fr->shift_vec[0];
721 fshift = fr->fshift[0];
722 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
723 charge = mdatoms->chargeA;
724 nvdwtype = fr->ntype;
726 vdwtype = mdatoms->typeA;
728 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
729 ewtab = fr->ic->tabq_coul_F;
730 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
731 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
733 /* Setup water-specific parameters */
734 inr = nlist->iinr[0];
735 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
736 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
737 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
738 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
740 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
741 rcutoff_scalar = fr->rcoulomb;
742 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
743 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
745 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
746 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
748 /* Avoid stupid compiler warnings */
756 /* Start outer loop over neighborlists */
757 for(iidx=0; iidx<nri; iidx++)
759 /* Load shift vector for this list */
760 i_shift_offset = DIM*shiftidx[iidx];
762 /* Load limits for loop over neighbors */
763 j_index_start = jindex[iidx];
764 j_index_end = jindex[iidx+1];
766 /* Get outer coordinate index */
768 i_coord_offset = DIM*inr;
770 /* Load i particle coords and add shift vector */
771 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
772 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
774 fix0 = _fjsp_setzero_v2r8();
775 fiy0 = _fjsp_setzero_v2r8();
776 fiz0 = _fjsp_setzero_v2r8();
777 fix1 = _fjsp_setzero_v2r8();
778 fiy1 = _fjsp_setzero_v2r8();
779 fiz1 = _fjsp_setzero_v2r8();
780 fix2 = _fjsp_setzero_v2r8();
781 fiy2 = _fjsp_setzero_v2r8();
782 fiz2 = _fjsp_setzero_v2r8();
784 /* Start inner kernel loop */
785 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
788 /* Get j neighbor index, and coordinate index */
791 j_coord_offsetA = DIM*jnrA;
792 j_coord_offsetB = DIM*jnrB;
794 /* load j atom coordinates */
795 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
798 /* Calculate displacement vector */
799 dx00 = _fjsp_sub_v2r8(ix0,jx0);
800 dy00 = _fjsp_sub_v2r8(iy0,jy0);
801 dz00 = _fjsp_sub_v2r8(iz0,jz0);
802 dx10 = _fjsp_sub_v2r8(ix1,jx0);
803 dy10 = _fjsp_sub_v2r8(iy1,jy0);
804 dz10 = _fjsp_sub_v2r8(iz1,jz0);
805 dx20 = _fjsp_sub_v2r8(ix2,jx0);
806 dy20 = _fjsp_sub_v2r8(iy2,jy0);
807 dz20 = _fjsp_sub_v2r8(iz2,jz0);
809 /* Calculate squared distance and things based on it */
810 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
811 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
812 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
814 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
815 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
816 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
818 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
819 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
820 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
822 /* Load parameters for j particles */
823 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
824 vdwjidx0A = 2*vdwtype[jnrA+0];
825 vdwjidx0B = 2*vdwtype[jnrB+0];
827 fjx0 = _fjsp_setzero_v2r8();
828 fjy0 = _fjsp_setzero_v2r8();
829 fjz0 = _fjsp_setzero_v2r8();
831 /**************************
832 * CALCULATE INTERACTIONS *
833 **************************/
835 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
838 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
840 /* Compute parameters for interactions between i and j atoms */
841 qq00 = _fjsp_mul_v2r8(iq0,jq0);
842 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
843 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
845 /* EWALD ELECTROSTATICS */
847 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
848 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
849 itab_tmp = _fjsp_dtox_v2r8(ewrt);
850 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
851 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
853 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
855 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
856 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
858 /* LENNARD-JONES DISPERSION/REPULSION */
860 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
861 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
863 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
865 fscal = _fjsp_add_v2r8(felec,fvdw);
867 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
869 /* Update vectorial force */
870 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
871 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
872 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
874 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
875 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
876 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
880 /**************************
881 * CALCULATE INTERACTIONS *
882 **************************/
884 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
887 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
889 /* Compute parameters for interactions between i and j atoms */
890 qq10 = _fjsp_mul_v2r8(iq1,jq0);
892 /* EWALD ELECTROSTATICS */
894 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
895 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
896 itab_tmp = _fjsp_dtox_v2r8(ewrt);
897 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
898 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
900 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
902 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
903 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
905 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
909 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
911 /* Update vectorial force */
912 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
913 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
914 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
916 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
917 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
918 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
922 /**************************
923 * CALCULATE INTERACTIONS *
924 **************************/
926 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
929 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
931 /* Compute parameters for interactions between i and j atoms */
932 qq20 = _fjsp_mul_v2r8(iq2,jq0);
934 /* EWALD ELECTROSTATICS */
936 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
937 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
938 itab_tmp = _fjsp_dtox_v2r8(ewrt);
939 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
940 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
942 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
944 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
945 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
947 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
951 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
953 /* Update vectorial force */
954 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
955 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
956 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
958 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
959 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
960 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
964 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
966 /* Inner loop uses 136 flops */
973 j_coord_offsetA = DIM*jnrA;
975 /* load j atom coordinates */
976 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
979 /* Calculate displacement vector */
980 dx00 = _fjsp_sub_v2r8(ix0,jx0);
981 dy00 = _fjsp_sub_v2r8(iy0,jy0);
982 dz00 = _fjsp_sub_v2r8(iz0,jz0);
983 dx10 = _fjsp_sub_v2r8(ix1,jx0);
984 dy10 = _fjsp_sub_v2r8(iy1,jy0);
985 dz10 = _fjsp_sub_v2r8(iz1,jz0);
986 dx20 = _fjsp_sub_v2r8(ix2,jx0);
987 dy20 = _fjsp_sub_v2r8(iy2,jy0);
988 dz20 = _fjsp_sub_v2r8(iz2,jz0);
990 /* Calculate squared distance and things based on it */
991 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
992 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
993 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
995 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
996 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
997 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
999 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1000 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1001 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1003 /* Load parameters for j particles */
1004 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1005 vdwjidx0A = 2*vdwtype[jnrA+0];
1007 fjx0 = _fjsp_setzero_v2r8();
1008 fjy0 = _fjsp_setzero_v2r8();
1009 fjz0 = _fjsp_setzero_v2r8();
1011 /**************************
1012 * CALCULATE INTERACTIONS *
1013 **************************/
1015 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1018 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1020 /* Compute parameters for interactions between i and j atoms */
1021 qq00 = _fjsp_mul_v2r8(iq0,jq0);
1022 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
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 /* LENNARD-JONES DISPERSION/REPULSION */
1038 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1039 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1041 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1043 fscal = _fjsp_add_v2r8(felec,fvdw);
1045 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1047 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1049 /* Update vectorial force */
1050 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1051 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1052 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1054 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1055 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1056 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1060 /**************************
1061 * CALCULATE INTERACTIONS *
1062 **************************/
1064 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1067 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
1069 /* Compute parameters for interactions between i and j atoms */
1070 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1072 /* EWALD ELECTROSTATICS */
1074 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1075 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
1076 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1077 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1078 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1080 gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1081 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1082 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1084 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1088 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1090 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1092 /* Update vectorial force */
1093 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1094 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1095 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1097 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1098 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1099 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1103 /**************************
1104 * CALCULATE INTERACTIONS *
1105 **************************/
1107 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
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));
1127 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1131 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1133 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1135 /* Update vectorial force */
1136 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1137 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1138 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1140 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1141 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1142 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1146 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1148 /* Inner loop uses 136 flops */
1151 /* End of innermost loop */
1153 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1154 f+i_coord_offset,fshift+i_shift_offset);
1156 /* Increment number of inner iterations */
1157 inneriter += j_index_end - j_index_start;
1159 /* Outer loop uses 18 flops */
1162 /* Increment number of outer iterations */
1165 /* Update outer/inner flops */
1167 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*136);