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_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEwSh_VdwLJSh_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 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 nvdwtype = fr->ntype;
126 vdwtype = mdatoms->typeA;
128 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
129 ewtab = fr->ic->tabq_coul_FDV0;
130 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
131 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
133 /* Setup water-specific parameters */
134 inr = nlist->iinr[0];
135 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
136 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
137 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
138 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
140 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
141 rcutoff_scalar = fr->rcoulomb;
142 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
143 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
145 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
146 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
148 /* Avoid stupid compiler warnings */
156 /* Start outer loop over neighborlists */
157 for(iidx=0; iidx<nri; iidx++)
159 /* Load shift vector for this list */
160 i_shift_offset = DIM*shiftidx[iidx];
162 /* Load limits for loop over neighbors */
163 j_index_start = jindex[iidx];
164 j_index_end = jindex[iidx+1];
166 /* Get outer coordinate index */
168 i_coord_offset = DIM*inr;
170 /* Load i particle coords and add shift vector */
171 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
172 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
174 fix0 = _fjsp_setzero_v2r8();
175 fiy0 = _fjsp_setzero_v2r8();
176 fiz0 = _fjsp_setzero_v2r8();
177 fix1 = _fjsp_setzero_v2r8();
178 fiy1 = _fjsp_setzero_v2r8();
179 fiz1 = _fjsp_setzero_v2r8();
180 fix2 = _fjsp_setzero_v2r8();
181 fiy2 = _fjsp_setzero_v2r8();
182 fiz2 = _fjsp_setzero_v2r8();
183 fix3 = _fjsp_setzero_v2r8();
184 fiy3 = _fjsp_setzero_v2r8();
185 fiz3 = _fjsp_setzero_v2r8();
187 /* Reset potential sums */
188 velecsum = _fjsp_setzero_v2r8();
189 vvdwsum = _fjsp_setzero_v2r8();
191 /* Start inner kernel loop */
192 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
195 /* Get j neighbor index, and coordinate index */
198 j_coord_offsetA = DIM*jnrA;
199 j_coord_offsetB = DIM*jnrB;
201 /* load j atom coordinates */
202 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
205 /* Calculate displacement vector */
206 dx00 = _fjsp_sub_v2r8(ix0,jx0);
207 dy00 = _fjsp_sub_v2r8(iy0,jy0);
208 dz00 = _fjsp_sub_v2r8(iz0,jz0);
209 dx10 = _fjsp_sub_v2r8(ix1,jx0);
210 dy10 = _fjsp_sub_v2r8(iy1,jy0);
211 dz10 = _fjsp_sub_v2r8(iz1,jz0);
212 dx20 = _fjsp_sub_v2r8(ix2,jx0);
213 dy20 = _fjsp_sub_v2r8(iy2,jy0);
214 dz20 = _fjsp_sub_v2r8(iz2,jz0);
215 dx30 = _fjsp_sub_v2r8(ix3,jx0);
216 dy30 = _fjsp_sub_v2r8(iy3,jy0);
217 dz30 = _fjsp_sub_v2r8(iz3,jz0);
219 /* Calculate squared distance and things based on it */
220 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
221 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
222 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
223 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
225 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
226 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
227 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
229 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
230 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
231 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
232 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
234 /* Load parameters for j particles */
235 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
236 vdwjidx0A = 2*vdwtype[jnrA+0];
237 vdwjidx0B = 2*vdwtype[jnrB+0];
239 fjx0 = _fjsp_setzero_v2r8();
240 fjy0 = _fjsp_setzero_v2r8();
241 fjz0 = _fjsp_setzero_v2r8();
243 /**************************
244 * CALCULATE INTERACTIONS *
245 **************************/
247 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
250 /* Compute parameters for interactions between i and j atoms */
251 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
252 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
254 /* LENNARD-JONES DISPERSION/REPULSION */
256 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
257 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
258 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
259 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
260 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
261 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
263 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
265 /* Update potential sum for this i atom from the interaction with this j atom. */
266 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
267 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
271 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
273 /* Update vectorial force */
274 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
275 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
276 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
278 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
279 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
280 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
284 /**************************
285 * CALCULATE INTERACTIONS *
286 **************************/
288 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
291 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
293 /* Compute parameters for interactions between i and j atoms */
294 qq10 = _fjsp_mul_v2r8(iq1,jq0);
296 /* EWALD ELECTROSTATICS */
298 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
299 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
300 itab_tmp = _fjsp_dtox_v2r8(ewrt);
301 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
302 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
304 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
305 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
306 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
307 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
308 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
309 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
310 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
311 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
312 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
313 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
315 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
317 /* Update potential sum for this i atom from the interaction with this j atom. */
318 velec = _fjsp_and_v2r8(velec,cutoff_mask);
319 velecsum = _fjsp_add_v2r8(velecsum,velec);
323 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
325 /* Update vectorial force */
326 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
327 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
328 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
330 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
331 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
332 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
336 /**************************
337 * CALCULATE INTERACTIONS *
338 **************************/
340 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
343 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
345 /* Compute parameters for interactions between i and j atoms */
346 qq20 = _fjsp_mul_v2r8(iq2,jq0);
348 /* EWALD ELECTROSTATICS */
350 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
351 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
352 itab_tmp = _fjsp_dtox_v2r8(ewrt);
353 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
354 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
356 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
357 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
358 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
359 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
360 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
361 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
362 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
363 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
364 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
365 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
367 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
369 /* Update potential sum for this i atom from the interaction with this j atom. */
370 velec = _fjsp_and_v2r8(velec,cutoff_mask);
371 velecsum = _fjsp_add_v2r8(velecsum,velec);
375 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
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);
388 /**************************
389 * CALCULATE INTERACTIONS *
390 **************************/
392 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
395 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
397 /* Compute parameters for interactions between i and j atoms */
398 qq30 = _fjsp_mul_v2r8(iq3,jq0);
400 /* EWALD ELECTROSTATICS */
402 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
403 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
404 itab_tmp = _fjsp_dtox_v2r8(ewrt);
405 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
406 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
408 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
409 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
410 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
411 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
412 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
413 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
414 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
415 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
416 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
417 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
419 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
421 /* Update potential sum for this i atom from the interaction with this j atom. */
422 velec = _fjsp_and_v2r8(velec,cutoff_mask);
423 velecsum = _fjsp_add_v2r8(velecsum,velec);
427 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
429 /* Update vectorial force */
430 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
431 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
432 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
434 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
435 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
436 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
440 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
442 /* Inner loop uses 194 flops */
449 j_coord_offsetA = DIM*jnrA;
451 /* load j atom coordinates */
452 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
455 /* Calculate displacement vector */
456 dx00 = _fjsp_sub_v2r8(ix0,jx0);
457 dy00 = _fjsp_sub_v2r8(iy0,jy0);
458 dz00 = _fjsp_sub_v2r8(iz0,jz0);
459 dx10 = _fjsp_sub_v2r8(ix1,jx0);
460 dy10 = _fjsp_sub_v2r8(iy1,jy0);
461 dz10 = _fjsp_sub_v2r8(iz1,jz0);
462 dx20 = _fjsp_sub_v2r8(ix2,jx0);
463 dy20 = _fjsp_sub_v2r8(iy2,jy0);
464 dz20 = _fjsp_sub_v2r8(iz2,jz0);
465 dx30 = _fjsp_sub_v2r8(ix3,jx0);
466 dy30 = _fjsp_sub_v2r8(iy3,jy0);
467 dz30 = _fjsp_sub_v2r8(iz3,jz0);
469 /* Calculate squared distance and things based on it */
470 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
471 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
472 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
473 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
475 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
476 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
477 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
479 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
480 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
481 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
482 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
484 /* Load parameters for j particles */
485 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
486 vdwjidx0A = 2*vdwtype[jnrA+0];
488 fjx0 = _fjsp_setzero_v2r8();
489 fjy0 = _fjsp_setzero_v2r8();
490 fjz0 = _fjsp_setzero_v2r8();
492 /**************************
493 * CALCULATE INTERACTIONS *
494 **************************/
496 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
499 /* Compute parameters for interactions between i and j atoms */
500 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
502 /* LENNARD-JONES DISPERSION/REPULSION */
504 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
505 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
506 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
507 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
508 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
509 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
511 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
513 /* Update potential sum for this i atom from the interaction with this j atom. */
514 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
515 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
516 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
520 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
522 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
524 /* Update vectorial force */
525 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
526 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
527 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
529 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
530 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
531 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
535 /**************************
536 * CALCULATE INTERACTIONS *
537 **************************/
539 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
542 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
544 /* Compute parameters for interactions between i and j atoms */
545 qq10 = _fjsp_mul_v2r8(iq1,jq0);
547 /* EWALD ELECTROSTATICS */
549 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
550 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
551 itab_tmp = _fjsp_dtox_v2r8(ewrt);
552 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
553 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
555 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
556 ewtabD = _fjsp_setzero_v2r8();
557 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
558 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
559 ewtabFn = _fjsp_setzero_v2r8();
560 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
561 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
562 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
563 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv10,sh_ewald),velec));
564 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
566 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
568 /* Update potential sum for this i atom from the interaction with this j atom. */
569 velec = _fjsp_and_v2r8(velec,cutoff_mask);
570 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
571 velecsum = _fjsp_add_v2r8(velecsum,velec);
575 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
577 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
579 /* Update vectorial force */
580 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
581 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
582 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
584 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
585 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
586 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
590 /**************************
591 * CALCULATE INTERACTIONS *
592 **************************/
594 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
597 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
599 /* Compute parameters for interactions between i and j atoms */
600 qq20 = _fjsp_mul_v2r8(iq2,jq0);
602 /* EWALD ELECTROSTATICS */
604 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
605 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
606 itab_tmp = _fjsp_dtox_v2r8(ewrt);
607 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
608 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
610 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
611 ewtabD = _fjsp_setzero_v2r8();
612 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
613 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
614 ewtabFn = _fjsp_setzero_v2r8();
615 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
616 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
617 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
618 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv20,sh_ewald),velec));
619 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
621 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
623 /* Update potential sum for this i atom from the interaction with this j atom. */
624 velec = _fjsp_and_v2r8(velec,cutoff_mask);
625 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
626 velecsum = _fjsp_add_v2r8(velecsum,velec);
630 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
632 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
634 /* Update vectorial force */
635 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
636 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
637 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
639 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
640 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
641 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
645 /**************************
646 * CALCULATE INTERACTIONS *
647 **************************/
649 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
652 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
654 /* Compute parameters for interactions between i and j atoms */
655 qq30 = _fjsp_mul_v2r8(iq3,jq0);
657 /* EWALD ELECTROSTATICS */
659 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
660 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
661 itab_tmp = _fjsp_dtox_v2r8(ewrt);
662 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
663 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
665 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
666 ewtabD = _fjsp_setzero_v2r8();
667 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
668 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
669 ewtabFn = _fjsp_setzero_v2r8();
670 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
671 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
672 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
673 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv30,sh_ewald),velec));
674 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
676 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
678 /* Update potential sum for this i atom from the interaction with this j atom. */
679 velec = _fjsp_and_v2r8(velec,cutoff_mask);
680 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
681 velecsum = _fjsp_add_v2r8(velecsum,velec);
685 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
687 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
689 /* Update vectorial force */
690 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
691 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
692 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
694 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
695 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
696 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
700 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
702 /* Inner loop uses 194 flops */
705 /* End of innermost loop */
707 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
708 f+i_coord_offset,fshift+i_shift_offset);
711 /* Update potential energies */
712 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
713 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
715 /* Increment number of inner iterations */
716 inneriter += j_index_end - j_index_start;
718 /* Outer loop uses 26 flops */
721 /* Increment number of outer iterations */
724 /* Update outer/inner flops */
726 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*194);
729 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
730 * Electrostatics interaction: Ewald
731 * VdW interaction: LennardJones
732 * Geometry: Water4-Particle
733 * Calculate force/pot: Force
736 nb_kernel_ElecEwSh_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
737 (t_nblist * gmx_restrict nlist,
738 rvec * gmx_restrict xx,
739 rvec * gmx_restrict ff,
740 t_forcerec * gmx_restrict fr,
741 t_mdatoms * gmx_restrict mdatoms,
742 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
743 t_nrnb * gmx_restrict nrnb)
745 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
746 * just 0 for non-waters.
747 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
748 * jnr indices corresponding to data put in the four positions in the SIMD register.
750 int i_shift_offset,i_coord_offset,outeriter,inneriter;
751 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
753 int j_coord_offsetA,j_coord_offsetB;
754 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
756 real *shiftvec,*fshift,*x,*f;
757 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
759 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
761 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
763 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
765 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
766 int vdwjidx0A,vdwjidx0B;
767 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
768 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
769 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
770 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
771 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
772 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
775 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
778 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
779 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
780 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
783 _fjsp_v2r8 dummy_mask,cutoff_mask;
784 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
785 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
786 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
793 jindex = nlist->jindex;
795 shiftidx = nlist->shift;
797 shiftvec = fr->shift_vec[0];
798 fshift = fr->fshift[0];
799 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
800 charge = mdatoms->chargeA;
801 nvdwtype = fr->ntype;
803 vdwtype = mdatoms->typeA;
805 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
806 ewtab = fr->ic->tabq_coul_F;
807 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
808 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
810 /* Setup water-specific parameters */
811 inr = nlist->iinr[0];
812 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
813 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
814 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
815 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
817 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
818 rcutoff_scalar = fr->rcoulomb;
819 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
820 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
822 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
823 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
825 /* Avoid stupid compiler warnings */
833 /* Start outer loop over neighborlists */
834 for(iidx=0; iidx<nri; iidx++)
836 /* Load shift vector for this list */
837 i_shift_offset = DIM*shiftidx[iidx];
839 /* Load limits for loop over neighbors */
840 j_index_start = jindex[iidx];
841 j_index_end = jindex[iidx+1];
843 /* Get outer coordinate index */
845 i_coord_offset = DIM*inr;
847 /* Load i particle coords and add shift vector */
848 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
849 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
851 fix0 = _fjsp_setzero_v2r8();
852 fiy0 = _fjsp_setzero_v2r8();
853 fiz0 = _fjsp_setzero_v2r8();
854 fix1 = _fjsp_setzero_v2r8();
855 fiy1 = _fjsp_setzero_v2r8();
856 fiz1 = _fjsp_setzero_v2r8();
857 fix2 = _fjsp_setzero_v2r8();
858 fiy2 = _fjsp_setzero_v2r8();
859 fiz2 = _fjsp_setzero_v2r8();
860 fix3 = _fjsp_setzero_v2r8();
861 fiy3 = _fjsp_setzero_v2r8();
862 fiz3 = _fjsp_setzero_v2r8();
864 /* Start inner kernel loop */
865 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
868 /* Get j neighbor index, and coordinate index */
871 j_coord_offsetA = DIM*jnrA;
872 j_coord_offsetB = DIM*jnrB;
874 /* load j atom coordinates */
875 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
878 /* Calculate displacement vector */
879 dx00 = _fjsp_sub_v2r8(ix0,jx0);
880 dy00 = _fjsp_sub_v2r8(iy0,jy0);
881 dz00 = _fjsp_sub_v2r8(iz0,jz0);
882 dx10 = _fjsp_sub_v2r8(ix1,jx0);
883 dy10 = _fjsp_sub_v2r8(iy1,jy0);
884 dz10 = _fjsp_sub_v2r8(iz1,jz0);
885 dx20 = _fjsp_sub_v2r8(ix2,jx0);
886 dy20 = _fjsp_sub_v2r8(iy2,jy0);
887 dz20 = _fjsp_sub_v2r8(iz2,jz0);
888 dx30 = _fjsp_sub_v2r8(ix3,jx0);
889 dy30 = _fjsp_sub_v2r8(iy3,jy0);
890 dz30 = _fjsp_sub_v2r8(iz3,jz0);
892 /* Calculate squared distance and things based on it */
893 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
894 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
895 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
896 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
898 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
899 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
900 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
902 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
903 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
904 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
905 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
907 /* Load parameters for j particles */
908 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
909 vdwjidx0A = 2*vdwtype[jnrA+0];
910 vdwjidx0B = 2*vdwtype[jnrB+0];
912 fjx0 = _fjsp_setzero_v2r8();
913 fjy0 = _fjsp_setzero_v2r8();
914 fjz0 = _fjsp_setzero_v2r8();
916 /**************************
917 * CALCULATE INTERACTIONS *
918 **************************/
920 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
923 /* Compute parameters for interactions between i and j atoms */
924 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
925 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
927 /* LENNARD-JONES DISPERSION/REPULSION */
929 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
930 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
932 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
936 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
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);
949 /**************************
950 * CALCULATE INTERACTIONS *
951 **************************/
953 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
956 r10 = _fjsp_mul_v2r8(rsq10,rinv10);
958 /* Compute parameters for interactions between i and j atoms */
959 qq10 = _fjsp_mul_v2r8(iq1,jq0);
961 /* EWALD ELECTROSTATICS */
963 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
964 ewrt = _fjsp_mul_v2r8(r10,ewtabscale);
965 itab_tmp = _fjsp_dtox_v2r8(ewrt);
966 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
967 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
969 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
971 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
972 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
974 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
978 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
980 /* Update vectorial force */
981 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
982 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
983 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
985 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
986 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
987 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
991 /**************************
992 * CALCULATE INTERACTIONS *
993 **************************/
995 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
998 r20 = _fjsp_mul_v2r8(rsq20,rinv20);
1000 /* Compute parameters for interactions between i and j atoms */
1001 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1003 /* EWALD ELECTROSTATICS */
1005 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1006 ewrt = _fjsp_mul_v2r8(r20,ewtabscale);
1007 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1008 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1009 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1011 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1013 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1014 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1016 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1020 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1022 /* Update vectorial force */
1023 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1024 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1025 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1027 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1028 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1029 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1033 /**************************
1034 * CALCULATE INTERACTIONS *
1035 **************************/
1037 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1040 r30 = _fjsp_mul_v2r8(rsq30,rinv30);
1042 /* Compute parameters for interactions between i and j atoms */
1043 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1045 /* EWALD ELECTROSTATICS */
1047 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1048 ewrt = _fjsp_mul_v2r8(r30,ewtabscale);
1049 itab_tmp = _fjsp_dtox_v2r8(ewrt);
1050 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1051 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1053 gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1055 felec = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1056 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,rinv30),_fjsp_sub_v2r8(rinvsq30,felec));
1058 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1062 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1064 /* Update vectorial force */
1065 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1066 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1067 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1069 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1070 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1071 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1075 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1077 /* Inner loop uses 162 flops */
1080 if(jidx<j_index_end)
1084 j_coord_offsetA = DIM*jnrA;
1086 /* load j atom coordinates */
1087 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1090 /* Calculate displacement vector */
1091 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1092 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1093 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1094 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1095 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1096 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1097 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1098 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1099 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1100 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1101 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1102 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1104 /* Calculate squared distance and things based on it */
1105 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1106 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1107 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1108 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1110 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1111 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1112 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1114 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1115 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1116 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1117 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1119 /* Load parameters for j particles */
1120 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1121 vdwjidx0A = 2*vdwtype[jnrA+0];
1123 fjx0 = _fjsp_setzero_v2r8();
1124 fjy0 = _fjsp_setzero_v2r8();
1125 fjz0 = _fjsp_setzero_v2r8();
1127 /**************************
1128 * CALCULATE INTERACTIONS *
1129 **************************/
1131 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1134 /* Compute parameters for interactions between i and j atoms */
1135 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&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);