2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: LennardJones
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_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);
101 _fjsp_v2r8 dummy_mask,cutoff_mask;
102 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
103 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
104 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
111 jindex = nlist->jindex;
113 shiftidx = nlist->shift;
115 shiftvec = fr->shift_vec[0];
116 fshift = fr->fshift[0];
117 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
118 charge = mdatoms->chargeA;
119 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
120 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
121 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
122 nvdwtype = fr->ntype;
124 vdwtype = mdatoms->typeA;
126 /* Setup water-specific parameters */
127 inr = nlist->iinr[0];
128 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
129 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
130 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
131 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
133 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
134 rcutoff_scalar = fr->rcoulomb;
135 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
136 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
138 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
139 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
141 /* Avoid stupid compiler warnings */
149 /* Start outer loop over neighborlists */
150 for(iidx=0; iidx<nri; iidx++)
152 /* Load shift vector for this list */
153 i_shift_offset = DIM*shiftidx[iidx];
155 /* Load limits for loop over neighbors */
156 j_index_start = jindex[iidx];
157 j_index_end = jindex[iidx+1];
159 /* Get outer coordinate index */
161 i_coord_offset = DIM*inr;
163 /* Load i particle coords and add shift vector */
164 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
165 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
167 fix0 = _fjsp_setzero_v2r8();
168 fiy0 = _fjsp_setzero_v2r8();
169 fiz0 = _fjsp_setzero_v2r8();
170 fix1 = _fjsp_setzero_v2r8();
171 fiy1 = _fjsp_setzero_v2r8();
172 fiz1 = _fjsp_setzero_v2r8();
173 fix2 = _fjsp_setzero_v2r8();
174 fiy2 = _fjsp_setzero_v2r8();
175 fiz2 = _fjsp_setzero_v2r8();
177 /* Reset potential sums */
178 velecsum = _fjsp_setzero_v2r8();
179 vvdwsum = _fjsp_setzero_v2r8();
181 /* Start inner kernel loop */
182 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
185 /* Get j neighbor index, and coordinate index */
188 j_coord_offsetA = DIM*jnrA;
189 j_coord_offsetB = DIM*jnrB;
191 /* load j atom coordinates */
192 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
195 /* Calculate displacement vector */
196 dx00 = _fjsp_sub_v2r8(ix0,jx0);
197 dy00 = _fjsp_sub_v2r8(iy0,jy0);
198 dz00 = _fjsp_sub_v2r8(iz0,jz0);
199 dx10 = _fjsp_sub_v2r8(ix1,jx0);
200 dy10 = _fjsp_sub_v2r8(iy1,jy0);
201 dz10 = _fjsp_sub_v2r8(iz1,jz0);
202 dx20 = _fjsp_sub_v2r8(ix2,jx0);
203 dy20 = _fjsp_sub_v2r8(iy2,jy0);
204 dz20 = _fjsp_sub_v2r8(iz2,jz0);
206 /* Calculate squared distance and things based on it */
207 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
208 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
209 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
211 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
212 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
213 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
215 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
216 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
217 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
219 /* Load parameters for j particles */
220 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
221 vdwjidx0A = 2*vdwtype[jnrA+0];
222 vdwjidx0B = 2*vdwtype[jnrB+0];
224 fjx0 = _fjsp_setzero_v2r8();
225 fjy0 = _fjsp_setzero_v2r8();
226 fjz0 = _fjsp_setzero_v2r8();
228 /**************************
229 * CALCULATE INTERACTIONS *
230 **************************/
232 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
235 /* Compute parameters for interactions between i and j atoms */
236 qq00 = _fjsp_mul_v2r8(iq0,jq0);
237 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
238 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
240 /* REACTION-FIELD ELECTROSTATICS */
241 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
242 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
244 /* LENNARD-JONES DISPERSION/REPULSION */
246 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
247 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
248 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
249 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
250 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
251 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
253 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
255 /* Update potential sum for this i atom from the interaction with this j atom. */
256 velec = _fjsp_and_v2r8(velec,cutoff_mask);
257 velecsum = _fjsp_add_v2r8(velecsum,velec);
258 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
259 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
261 fscal = _fjsp_add_v2r8(felec,fvdw);
263 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
265 /* Update vectorial force */
266 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
267 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
268 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
270 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
271 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
272 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
276 /**************************
277 * CALCULATE INTERACTIONS *
278 **************************/
280 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
283 /* Compute parameters for interactions between i and j atoms */
284 qq10 = _fjsp_mul_v2r8(iq1,jq0);
286 /* REACTION-FIELD ELECTROSTATICS */
287 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
288 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
290 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
292 /* Update potential sum for this i atom from the interaction with this j atom. */
293 velec = _fjsp_and_v2r8(velec,cutoff_mask);
294 velecsum = _fjsp_add_v2r8(velecsum,velec);
298 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
300 /* Update vectorial force */
301 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
302 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
303 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
305 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
306 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
307 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
311 /**************************
312 * CALCULATE INTERACTIONS *
313 **************************/
315 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
318 /* Compute parameters for interactions between i and j atoms */
319 qq20 = _fjsp_mul_v2r8(iq2,jq0);
321 /* REACTION-FIELD ELECTROSTATICS */
322 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
323 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
325 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
327 /* Update potential sum for this i atom from the interaction with this j atom. */
328 velec = _fjsp_and_v2r8(velec,cutoff_mask);
329 velecsum = _fjsp_add_v2r8(velecsum,velec);
333 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
335 /* Update vectorial force */
336 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
337 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
338 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
340 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
341 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
342 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
346 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
348 /* Inner loop uses 138 flops */
355 j_coord_offsetA = DIM*jnrA;
357 /* load j atom coordinates */
358 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
361 /* Calculate displacement vector */
362 dx00 = _fjsp_sub_v2r8(ix0,jx0);
363 dy00 = _fjsp_sub_v2r8(iy0,jy0);
364 dz00 = _fjsp_sub_v2r8(iz0,jz0);
365 dx10 = _fjsp_sub_v2r8(ix1,jx0);
366 dy10 = _fjsp_sub_v2r8(iy1,jy0);
367 dz10 = _fjsp_sub_v2r8(iz1,jz0);
368 dx20 = _fjsp_sub_v2r8(ix2,jx0);
369 dy20 = _fjsp_sub_v2r8(iy2,jy0);
370 dz20 = _fjsp_sub_v2r8(iz2,jz0);
372 /* Calculate squared distance and things based on it */
373 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
374 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
375 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
377 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
378 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
379 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
381 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
382 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
383 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
385 /* Load parameters for j particles */
386 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
387 vdwjidx0A = 2*vdwtype[jnrA+0];
389 fjx0 = _fjsp_setzero_v2r8();
390 fjy0 = _fjsp_setzero_v2r8();
391 fjz0 = _fjsp_setzero_v2r8();
393 /**************************
394 * CALCULATE INTERACTIONS *
395 **************************/
397 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
400 /* Compute parameters for interactions between i and j atoms */
401 qq00 = _fjsp_mul_v2r8(iq0,jq0);
402 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
404 /* REACTION-FIELD ELECTROSTATICS */
405 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
406 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
408 /* LENNARD-JONES DISPERSION/REPULSION */
410 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
411 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
412 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
413 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
414 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
415 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
417 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
419 /* Update potential sum for this i atom from the interaction with this j atom. */
420 velec = _fjsp_and_v2r8(velec,cutoff_mask);
421 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
422 velecsum = _fjsp_add_v2r8(velecsum,velec);
423 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
424 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
425 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
427 fscal = _fjsp_add_v2r8(felec,fvdw);
429 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
431 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
433 /* Update vectorial force */
434 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
435 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
436 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
438 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
439 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
440 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
444 /**************************
445 * CALCULATE INTERACTIONS *
446 **************************/
448 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
451 /* Compute parameters for interactions between i and j atoms */
452 qq10 = _fjsp_mul_v2r8(iq1,jq0);
454 /* REACTION-FIELD ELECTROSTATICS */
455 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
456 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
458 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
460 /* Update potential sum for this i atom from the interaction with this j atom. */
461 velec = _fjsp_and_v2r8(velec,cutoff_mask);
462 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
463 velecsum = _fjsp_add_v2r8(velecsum,velec);
467 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
469 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
471 /* Update vectorial force */
472 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
473 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
474 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
476 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
477 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
478 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
482 /**************************
483 * CALCULATE INTERACTIONS *
484 **************************/
486 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
489 /* Compute parameters for interactions between i and j atoms */
490 qq20 = _fjsp_mul_v2r8(iq2,jq0);
492 /* REACTION-FIELD ELECTROSTATICS */
493 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
494 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
496 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
498 /* Update potential sum for this i atom from the interaction with this j atom. */
499 velec = _fjsp_and_v2r8(velec,cutoff_mask);
500 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
501 velecsum = _fjsp_add_v2r8(velecsum,velec);
505 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
507 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
509 /* Update vectorial force */
510 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
511 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
512 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
514 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
515 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
516 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
520 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
522 /* Inner loop uses 138 flops */
525 /* End of innermost loop */
527 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
528 f+i_coord_offset,fshift+i_shift_offset);
531 /* Update potential energies */
532 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
533 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
535 /* Increment number of inner iterations */
536 inneriter += j_index_end - j_index_start;
538 /* Outer loop uses 20 flops */
541 /* Increment number of outer iterations */
544 /* Update outer/inner flops */
546 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*138);
549 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
550 * Electrostatics interaction: ReactionField
551 * VdW interaction: LennardJones
552 * Geometry: Water3-Particle
553 * Calculate force/pot: Force
556 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
557 (t_nblist * gmx_restrict nlist,
558 rvec * gmx_restrict xx,
559 rvec * gmx_restrict ff,
560 t_forcerec * gmx_restrict fr,
561 t_mdatoms * gmx_restrict mdatoms,
562 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
563 t_nrnb * gmx_restrict nrnb)
565 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
566 * just 0 for non-waters.
567 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
568 * jnr indices corresponding to data put in the four positions in the SIMD register.
570 int i_shift_offset,i_coord_offset,outeriter,inneriter;
571 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
573 int j_coord_offsetA,j_coord_offsetB;
574 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
576 real *shiftvec,*fshift,*x,*f;
577 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
579 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
581 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
583 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
584 int vdwjidx0A,vdwjidx0B;
585 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
586 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
587 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
588 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
589 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
592 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
595 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
596 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
598 _fjsp_v2r8 dummy_mask,cutoff_mask;
599 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
600 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
601 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
608 jindex = nlist->jindex;
610 shiftidx = nlist->shift;
612 shiftvec = fr->shift_vec[0];
613 fshift = fr->fshift[0];
614 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
615 charge = mdatoms->chargeA;
616 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
617 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
618 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
619 nvdwtype = fr->ntype;
621 vdwtype = mdatoms->typeA;
623 /* Setup water-specific parameters */
624 inr = nlist->iinr[0];
625 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
626 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
627 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
628 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
630 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
631 rcutoff_scalar = fr->rcoulomb;
632 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
633 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
635 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
636 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
638 /* Avoid stupid compiler warnings */
646 /* Start outer loop over neighborlists */
647 for(iidx=0; iidx<nri; iidx++)
649 /* Load shift vector for this list */
650 i_shift_offset = DIM*shiftidx[iidx];
652 /* Load limits for loop over neighbors */
653 j_index_start = jindex[iidx];
654 j_index_end = jindex[iidx+1];
656 /* Get outer coordinate index */
658 i_coord_offset = DIM*inr;
660 /* Load i particle coords and add shift vector */
661 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
662 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
664 fix0 = _fjsp_setzero_v2r8();
665 fiy0 = _fjsp_setzero_v2r8();
666 fiz0 = _fjsp_setzero_v2r8();
667 fix1 = _fjsp_setzero_v2r8();
668 fiy1 = _fjsp_setzero_v2r8();
669 fiz1 = _fjsp_setzero_v2r8();
670 fix2 = _fjsp_setzero_v2r8();
671 fiy2 = _fjsp_setzero_v2r8();
672 fiz2 = _fjsp_setzero_v2r8();
674 /* Start inner kernel loop */
675 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
678 /* Get j neighbor index, and coordinate index */
681 j_coord_offsetA = DIM*jnrA;
682 j_coord_offsetB = DIM*jnrB;
684 /* load j atom coordinates */
685 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
688 /* Calculate displacement vector */
689 dx00 = _fjsp_sub_v2r8(ix0,jx0);
690 dy00 = _fjsp_sub_v2r8(iy0,jy0);
691 dz00 = _fjsp_sub_v2r8(iz0,jz0);
692 dx10 = _fjsp_sub_v2r8(ix1,jx0);
693 dy10 = _fjsp_sub_v2r8(iy1,jy0);
694 dz10 = _fjsp_sub_v2r8(iz1,jz0);
695 dx20 = _fjsp_sub_v2r8(ix2,jx0);
696 dy20 = _fjsp_sub_v2r8(iy2,jy0);
697 dz20 = _fjsp_sub_v2r8(iz2,jz0);
699 /* Calculate squared distance and things based on it */
700 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
701 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
702 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
704 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
705 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
706 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
708 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
709 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
710 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
712 /* Load parameters for j particles */
713 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
714 vdwjidx0A = 2*vdwtype[jnrA+0];
715 vdwjidx0B = 2*vdwtype[jnrB+0];
717 fjx0 = _fjsp_setzero_v2r8();
718 fjy0 = _fjsp_setzero_v2r8();
719 fjz0 = _fjsp_setzero_v2r8();
721 /**************************
722 * CALCULATE INTERACTIONS *
723 **************************/
725 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
728 /* Compute parameters for interactions between i and j atoms */
729 qq00 = _fjsp_mul_v2r8(iq0,jq0);
730 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
731 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
733 /* REACTION-FIELD ELECTROSTATICS */
734 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
736 /* LENNARD-JONES DISPERSION/REPULSION */
738 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
739 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
741 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
743 fscal = _fjsp_add_v2r8(felec,fvdw);
745 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
747 /* Update vectorial force */
748 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
749 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
750 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
752 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
753 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
754 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
758 /**************************
759 * CALCULATE INTERACTIONS *
760 **************************/
762 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
765 /* Compute parameters for interactions between i and j atoms */
766 qq10 = _fjsp_mul_v2r8(iq1,jq0);
768 /* REACTION-FIELD ELECTROSTATICS */
769 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
771 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
775 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
777 /* Update vectorial force */
778 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
779 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
780 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
782 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
783 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
784 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
788 /**************************
789 * CALCULATE INTERACTIONS *
790 **************************/
792 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
795 /* Compute parameters for interactions between i and j atoms */
796 qq20 = _fjsp_mul_v2r8(iq2,jq0);
798 /* REACTION-FIELD ELECTROSTATICS */
799 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
801 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
805 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
807 /* Update vectorial force */
808 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
809 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
810 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
812 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
813 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
814 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
818 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
820 /* Inner loop uses 109 flops */
827 j_coord_offsetA = DIM*jnrA;
829 /* load j atom coordinates */
830 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
833 /* Calculate displacement vector */
834 dx00 = _fjsp_sub_v2r8(ix0,jx0);
835 dy00 = _fjsp_sub_v2r8(iy0,jy0);
836 dz00 = _fjsp_sub_v2r8(iz0,jz0);
837 dx10 = _fjsp_sub_v2r8(ix1,jx0);
838 dy10 = _fjsp_sub_v2r8(iy1,jy0);
839 dz10 = _fjsp_sub_v2r8(iz1,jz0);
840 dx20 = _fjsp_sub_v2r8(ix2,jx0);
841 dy20 = _fjsp_sub_v2r8(iy2,jy0);
842 dz20 = _fjsp_sub_v2r8(iz2,jz0);
844 /* Calculate squared distance and things based on it */
845 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
846 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
847 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
849 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
850 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
851 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
853 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
854 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
855 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
857 /* Load parameters for j particles */
858 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
859 vdwjidx0A = 2*vdwtype[jnrA+0];
861 fjx0 = _fjsp_setzero_v2r8();
862 fjy0 = _fjsp_setzero_v2r8();
863 fjz0 = _fjsp_setzero_v2r8();
865 /**************************
866 * CALCULATE INTERACTIONS *
867 **************************/
869 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
872 /* Compute parameters for interactions between i and j atoms */
873 qq00 = _fjsp_mul_v2r8(iq0,jq0);
874 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
876 /* REACTION-FIELD ELECTROSTATICS */
877 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
879 /* LENNARD-JONES DISPERSION/REPULSION */
881 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
882 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
884 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
886 fscal = _fjsp_add_v2r8(felec,fvdw);
888 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
890 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
892 /* Update vectorial force */
893 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
894 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
895 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
897 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
898 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
899 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
903 /**************************
904 * CALCULATE INTERACTIONS *
905 **************************/
907 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
910 /* Compute parameters for interactions between i and j atoms */
911 qq10 = _fjsp_mul_v2r8(iq1,jq0);
913 /* REACTION-FIELD ELECTROSTATICS */
914 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
916 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
920 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
922 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
924 /* Update vectorial force */
925 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
926 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
927 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
929 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
930 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
931 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
935 /**************************
936 * CALCULATE INTERACTIONS *
937 **************************/
939 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
942 /* Compute parameters for interactions between i and j atoms */
943 qq20 = _fjsp_mul_v2r8(iq2,jq0);
945 /* REACTION-FIELD ELECTROSTATICS */
946 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
948 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
952 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
954 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
956 /* Update vectorial force */
957 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
958 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
959 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
961 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
962 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
963 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
967 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
969 /* Inner loop uses 109 flops */
972 /* End of innermost loop */
974 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
975 f+i_coord_offset,fshift+i_shift_offset);
977 /* Increment number of inner iterations */
978 inneriter += j_index_end - j_index_start;
980 /* Outer loop uses 18 flops */
983 /* Increment number of outer iterations */
986 /* Update outer/inner flops */
988 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109);