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.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 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;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
97 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
99 _fjsp_v2r8 dummy_mask,cutoff_mask;
100 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
101 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
102 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
109 jindex = nlist->jindex;
111 shiftidx = nlist->shift;
113 shiftvec = fr->shift_vec[0];
114 fshift = fr->fshift[0];
115 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
116 charge = mdatoms->chargeA;
117 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
118 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
119 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
120 nvdwtype = fr->ntype;
122 vdwtype = mdatoms->typeA;
124 /* Setup water-specific parameters */
125 inr = nlist->iinr[0];
126 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
127 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
128 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
129 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
131 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
132 rcutoff_scalar = fr->rcoulomb;
133 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
134 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
136 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
137 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
139 /* Avoid stupid compiler warnings */
147 /* Start outer loop over neighborlists */
148 for(iidx=0; iidx<nri; iidx++)
150 /* Load shift vector for this list */
151 i_shift_offset = DIM*shiftidx[iidx];
153 /* Load limits for loop over neighbors */
154 j_index_start = jindex[iidx];
155 j_index_end = jindex[iidx+1];
157 /* Get outer coordinate index */
159 i_coord_offset = DIM*inr;
161 /* Load i particle coords and add shift vector */
162 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
163 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
165 fix0 = _fjsp_setzero_v2r8();
166 fiy0 = _fjsp_setzero_v2r8();
167 fiz0 = _fjsp_setzero_v2r8();
168 fix1 = _fjsp_setzero_v2r8();
169 fiy1 = _fjsp_setzero_v2r8();
170 fiz1 = _fjsp_setzero_v2r8();
171 fix2 = _fjsp_setzero_v2r8();
172 fiy2 = _fjsp_setzero_v2r8();
173 fiz2 = _fjsp_setzero_v2r8();
175 /* Reset potential sums */
176 velecsum = _fjsp_setzero_v2r8();
177 vvdwsum = _fjsp_setzero_v2r8();
179 /* Start inner kernel loop */
180 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
183 /* Get j neighbor index, and coordinate index */
186 j_coord_offsetA = DIM*jnrA;
187 j_coord_offsetB = DIM*jnrB;
189 /* load j atom coordinates */
190 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
193 /* Calculate displacement vector */
194 dx00 = _fjsp_sub_v2r8(ix0,jx0);
195 dy00 = _fjsp_sub_v2r8(iy0,jy0);
196 dz00 = _fjsp_sub_v2r8(iz0,jz0);
197 dx10 = _fjsp_sub_v2r8(ix1,jx0);
198 dy10 = _fjsp_sub_v2r8(iy1,jy0);
199 dz10 = _fjsp_sub_v2r8(iz1,jz0);
200 dx20 = _fjsp_sub_v2r8(ix2,jx0);
201 dy20 = _fjsp_sub_v2r8(iy2,jy0);
202 dz20 = _fjsp_sub_v2r8(iz2,jz0);
204 /* Calculate squared distance and things based on it */
205 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
206 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
207 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
209 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
210 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
211 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
213 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
214 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
215 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
217 /* Load parameters for j particles */
218 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
219 vdwjidx0A = 2*vdwtype[jnrA+0];
220 vdwjidx0B = 2*vdwtype[jnrB+0];
222 fjx0 = _fjsp_setzero_v2r8();
223 fjy0 = _fjsp_setzero_v2r8();
224 fjz0 = _fjsp_setzero_v2r8();
226 /**************************
227 * CALCULATE INTERACTIONS *
228 **************************/
230 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
233 /* Compute parameters for interactions between i and j atoms */
234 qq00 = _fjsp_mul_v2r8(iq0,jq0);
235 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
236 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
238 /* REACTION-FIELD ELECTROSTATICS */
239 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
240 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
242 /* LENNARD-JONES DISPERSION/REPULSION */
244 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
245 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
246 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
247 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
248 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
249 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
251 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
253 /* Update potential sum for this i atom from the interaction with this j atom. */
254 velec = _fjsp_and_v2r8(velec,cutoff_mask);
255 velecsum = _fjsp_add_v2r8(velecsum,velec);
256 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
257 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
259 fscal = _fjsp_add_v2r8(felec,fvdw);
261 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
263 /* Update vectorial force */
264 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
265 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
266 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
268 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
269 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
270 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
274 /**************************
275 * CALCULATE INTERACTIONS *
276 **************************/
278 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
281 /* Compute parameters for interactions between i and j atoms */
282 qq10 = _fjsp_mul_v2r8(iq1,jq0);
284 /* REACTION-FIELD ELECTROSTATICS */
285 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
286 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
288 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
290 /* Update potential sum for this i atom from the interaction with this j atom. */
291 velec = _fjsp_and_v2r8(velec,cutoff_mask);
292 velecsum = _fjsp_add_v2r8(velecsum,velec);
296 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
298 /* Update vectorial force */
299 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
300 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
301 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
303 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
304 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
305 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
309 /**************************
310 * CALCULATE INTERACTIONS *
311 **************************/
313 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
316 /* Compute parameters for interactions between i and j atoms */
317 qq20 = _fjsp_mul_v2r8(iq2,jq0);
319 /* REACTION-FIELD ELECTROSTATICS */
320 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
321 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
323 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
325 /* Update potential sum for this i atom from the interaction with this j atom. */
326 velec = _fjsp_and_v2r8(velec,cutoff_mask);
327 velecsum = _fjsp_add_v2r8(velecsum,velec);
331 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
333 /* Update vectorial force */
334 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
335 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
336 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
338 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
339 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
340 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
344 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
346 /* Inner loop uses 138 flops */
353 j_coord_offsetA = DIM*jnrA;
355 /* load j atom coordinates */
356 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
359 /* Calculate displacement vector */
360 dx00 = _fjsp_sub_v2r8(ix0,jx0);
361 dy00 = _fjsp_sub_v2r8(iy0,jy0);
362 dz00 = _fjsp_sub_v2r8(iz0,jz0);
363 dx10 = _fjsp_sub_v2r8(ix1,jx0);
364 dy10 = _fjsp_sub_v2r8(iy1,jy0);
365 dz10 = _fjsp_sub_v2r8(iz1,jz0);
366 dx20 = _fjsp_sub_v2r8(ix2,jx0);
367 dy20 = _fjsp_sub_v2r8(iy2,jy0);
368 dz20 = _fjsp_sub_v2r8(iz2,jz0);
370 /* Calculate squared distance and things based on it */
371 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
372 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
373 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
375 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
376 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
377 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
379 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
380 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
381 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
383 /* Load parameters for j particles */
384 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
385 vdwjidx0A = 2*vdwtype[jnrA+0];
387 fjx0 = _fjsp_setzero_v2r8();
388 fjy0 = _fjsp_setzero_v2r8();
389 fjz0 = _fjsp_setzero_v2r8();
391 /**************************
392 * CALCULATE INTERACTIONS *
393 **************************/
395 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
398 /* Compute parameters for interactions between i and j atoms */
399 qq00 = _fjsp_mul_v2r8(iq0,jq0);
400 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
402 /* REACTION-FIELD ELECTROSTATICS */
403 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
404 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
406 /* LENNARD-JONES DISPERSION/REPULSION */
408 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
409 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
410 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
411 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
412 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
413 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
415 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
417 /* Update potential sum for this i atom from the interaction with this j atom. */
418 velec = _fjsp_and_v2r8(velec,cutoff_mask);
419 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
420 velecsum = _fjsp_add_v2r8(velecsum,velec);
421 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
422 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
423 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
425 fscal = _fjsp_add_v2r8(felec,fvdw);
427 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
429 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
431 /* Update vectorial force */
432 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
433 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
434 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
436 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
437 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
438 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
442 /**************************
443 * CALCULATE INTERACTIONS *
444 **************************/
446 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
449 /* Compute parameters for interactions between i and j atoms */
450 qq10 = _fjsp_mul_v2r8(iq1,jq0);
452 /* REACTION-FIELD ELECTROSTATICS */
453 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
454 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
456 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
458 /* Update potential sum for this i atom from the interaction with this j atom. */
459 velec = _fjsp_and_v2r8(velec,cutoff_mask);
460 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
461 velecsum = _fjsp_add_v2r8(velecsum,velec);
465 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
467 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
469 /* Update vectorial force */
470 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
471 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
472 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
474 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
475 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
476 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
487 /* Compute parameters for interactions between i and j atoms */
488 qq20 = _fjsp_mul_v2r8(iq2,jq0);
490 /* REACTION-FIELD ELECTROSTATICS */
491 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
492 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
494 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
496 /* Update potential sum for this i atom from the interaction with this j atom. */
497 velec = _fjsp_and_v2r8(velec,cutoff_mask);
498 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
499 velecsum = _fjsp_add_v2r8(velecsum,velec);
503 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
505 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
507 /* Update vectorial force */
508 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
509 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
510 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
512 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
513 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
514 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
518 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
520 /* Inner loop uses 138 flops */
523 /* End of innermost loop */
525 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
526 f+i_coord_offset,fshift+i_shift_offset);
529 /* Update potential energies */
530 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
531 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
533 /* Increment number of inner iterations */
534 inneriter += j_index_end - j_index_start;
536 /* Outer loop uses 20 flops */
539 /* Increment number of outer iterations */
542 /* Update outer/inner flops */
544 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*138);
547 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
548 * Electrostatics interaction: ReactionField
549 * VdW interaction: LennardJones
550 * Geometry: Water3-Particle
551 * Calculate force/pot: Force
554 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
555 (t_nblist * gmx_restrict nlist,
556 rvec * gmx_restrict xx,
557 rvec * gmx_restrict ff,
558 t_forcerec * gmx_restrict fr,
559 t_mdatoms * gmx_restrict mdatoms,
560 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
561 t_nrnb * gmx_restrict nrnb)
563 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
564 * just 0 for non-waters.
565 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
566 * jnr indices corresponding to data put in the four positions in the SIMD register.
568 int i_shift_offset,i_coord_offset,outeriter,inneriter;
569 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
571 int j_coord_offsetA,j_coord_offsetB;
572 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
574 real *shiftvec,*fshift,*x,*f;
575 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
577 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
579 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
581 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
582 int vdwjidx0A,vdwjidx0B;
583 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
584 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
585 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
586 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
587 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
590 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
593 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
594 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
596 _fjsp_v2r8 dummy_mask,cutoff_mask;
597 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
598 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
599 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
606 jindex = nlist->jindex;
608 shiftidx = nlist->shift;
610 shiftvec = fr->shift_vec[0];
611 fshift = fr->fshift[0];
612 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
613 charge = mdatoms->chargeA;
614 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
615 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
616 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
617 nvdwtype = fr->ntype;
619 vdwtype = mdatoms->typeA;
621 /* Setup water-specific parameters */
622 inr = nlist->iinr[0];
623 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
624 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
625 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
626 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
628 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
629 rcutoff_scalar = fr->rcoulomb;
630 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
631 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
633 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
634 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
636 /* Avoid stupid compiler warnings */
644 /* Start outer loop over neighborlists */
645 for(iidx=0; iidx<nri; iidx++)
647 /* Load shift vector for this list */
648 i_shift_offset = DIM*shiftidx[iidx];
650 /* Load limits for loop over neighbors */
651 j_index_start = jindex[iidx];
652 j_index_end = jindex[iidx+1];
654 /* Get outer coordinate index */
656 i_coord_offset = DIM*inr;
658 /* Load i particle coords and add shift vector */
659 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
660 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
662 fix0 = _fjsp_setzero_v2r8();
663 fiy0 = _fjsp_setzero_v2r8();
664 fiz0 = _fjsp_setzero_v2r8();
665 fix1 = _fjsp_setzero_v2r8();
666 fiy1 = _fjsp_setzero_v2r8();
667 fiz1 = _fjsp_setzero_v2r8();
668 fix2 = _fjsp_setzero_v2r8();
669 fiy2 = _fjsp_setzero_v2r8();
670 fiz2 = _fjsp_setzero_v2r8();
672 /* Start inner kernel loop */
673 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
676 /* Get j neighbor index, and coordinate index */
679 j_coord_offsetA = DIM*jnrA;
680 j_coord_offsetB = DIM*jnrB;
682 /* load j atom coordinates */
683 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
686 /* Calculate displacement vector */
687 dx00 = _fjsp_sub_v2r8(ix0,jx0);
688 dy00 = _fjsp_sub_v2r8(iy0,jy0);
689 dz00 = _fjsp_sub_v2r8(iz0,jz0);
690 dx10 = _fjsp_sub_v2r8(ix1,jx0);
691 dy10 = _fjsp_sub_v2r8(iy1,jy0);
692 dz10 = _fjsp_sub_v2r8(iz1,jz0);
693 dx20 = _fjsp_sub_v2r8(ix2,jx0);
694 dy20 = _fjsp_sub_v2r8(iy2,jy0);
695 dz20 = _fjsp_sub_v2r8(iz2,jz0);
697 /* Calculate squared distance and things based on it */
698 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
699 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
700 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
702 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
703 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
704 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
706 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
707 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
708 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
710 /* Load parameters for j particles */
711 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
712 vdwjidx0A = 2*vdwtype[jnrA+0];
713 vdwjidx0B = 2*vdwtype[jnrB+0];
715 fjx0 = _fjsp_setzero_v2r8();
716 fjy0 = _fjsp_setzero_v2r8();
717 fjz0 = _fjsp_setzero_v2r8();
719 /**************************
720 * CALCULATE INTERACTIONS *
721 **************************/
723 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
726 /* Compute parameters for interactions between i and j atoms */
727 qq00 = _fjsp_mul_v2r8(iq0,jq0);
728 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
729 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
731 /* REACTION-FIELD ELECTROSTATICS */
732 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
734 /* LENNARD-JONES DISPERSION/REPULSION */
736 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
737 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
739 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
741 fscal = _fjsp_add_v2r8(felec,fvdw);
743 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
745 /* Update vectorial force */
746 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
747 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
748 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
750 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
751 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
752 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
756 /**************************
757 * CALCULATE INTERACTIONS *
758 **************************/
760 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
763 /* Compute parameters for interactions between i and j atoms */
764 qq10 = _fjsp_mul_v2r8(iq1,jq0);
766 /* REACTION-FIELD ELECTROSTATICS */
767 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
769 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
773 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
775 /* Update vectorial force */
776 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
777 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
778 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
780 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
781 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
782 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
786 /**************************
787 * CALCULATE INTERACTIONS *
788 **************************/
790 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
793 /* Compute parameters for interactions between i and j atoms */
794 qq20 = _fjsp_mul_v2r8(iq2,jq0);
796 /* REACTION-FIELD ELECTROSTATICS */
797 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
799 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
803 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
805 /* Update vectorial force */
806 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
807 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
808 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
810 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
811 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
812 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
816 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
818 /* Inner loop uses 109 flops */
825 j_coord_offsetA = DIM*jnrA;
827 /* load j atom coordinates */
828 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
831 /* Calculate displacement vector */
832 dx00 = _fjsp_sub_v2r8(ix0,jx0);
833 dy00 = _fjsp_sub_v2r8(iy0,jy0);
834 dz00 = _fjsp_sub_v2r8(iz0,jz0);
835 dx10 = _fjsp_sub_v2r8(ix1,jx0);
836 dy10 = _fjsp_sub_v2r8(iy1,jy0);
837 dz10 = _fjsp_sub_v2r8(iz1,jz0);
838 dx20 = _fjsp_sub_v2r8(ix2,jx0);
839 dy20 = _fjsp_sub_v2r8(iy2,jy0);
840 dz20 = _fjsp_sub_v2r8(iz2,jz0);
842 /* Calculate squared distance and things based on it */
843 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
844 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
845 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
847 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
848 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
849 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
851 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
852 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
853 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
855 /* Load parameters for j particles */
856 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
857 vdwjidx0A = 2*vdwtype[jnrA+0];
859 fjx0 = _fjsp_setzero_v2r8();
860 fjy0 = _fjsp_setzero_v2r8();
861 fjz0 = _fjsp_setzero_v2r8();
863 /**************************
864 * CALCULATE INTERACTIONS *
865 **************************/
867 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
870 /* Compute parameters for interactions between i and j atoms */
871 qq00 = _fjsp_mul_v2r8(iq0,jq0);
872 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
874 /* REACTION-FIELD ELECTROSTATICS */
875 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
877 /* LENNARD-JONES DISPERSION/REPULSION */
879 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
880 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
882 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
884 fscal = _fjsp_add_v2r8(felec,fvdw);
886 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
888 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
890 /* Update vectorial force */
891 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
892 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
893 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
895 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
896 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
897 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
901 /**************************
902 * CALCULATE INTERACTIONS *
903 **************************/
905 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
908 /* Compute parameters for interactions between i and j atoms */
909 qq10 = _fjsp_mul_v2r8(iq1,jq0);
911 /* REACTION-FIELD ELECTROSTATICS */
912 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
914 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
918 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
920 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
922 /* Update vectorial force */
923 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
924 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
925 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
927 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
928 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
929 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
933 /**************************
934 * CALCULATE INTERACTIONS *
935 **************************/
937 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
940 /* Compute parameters for interactions between i and j atoms */
941 qq20 = _fjsp_mul_v2r8(iq2,jq0);
943 /* REACTION-FIELD ELECTROSTATICS */
944 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
946 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
950 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
952 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
954 /* Update vectorial force */
955 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
956 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
957 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
959 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
960 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
961 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
965 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
967 /* Inner loop uses 109 flops */
970 /* End of innermost loop */
972 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
973 f+i_coord_offset,fshift+i_shift_offset);
975 /* Increment number of inner iterations */
976 inneriter += j_index_end - j_index_start;
978 /* Outer loop uses 18 flops */
981 /* Increment number of outer iterations */
984 /* Update outer/inner flops */
986 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109);