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 "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_VdwLJ_GeomW4P1_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;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
102 _fjsp_v2r8 dummy_mask,cutoff_mask;
103 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
104 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
105 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
112 jindex = nlist->jindex;
114 shiftidx = nlist->shift;
116 shiftvec = fr->shift_vec[0];
117 fshift = fr->fshift[0];
118 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
119 charge = mdatoms->chargeA;
120 nvdwtype = fr->ntype;
122 vdwtype = mdatoms->typeA;
124 /* Setup water-specific parameters */
125 inr = nlist->iinr[0];
126 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
127 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
128 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
129 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
131 /* Avoid stupid compiler warnings */
139 /* Start outer loop over neighborlists */
140 for(iidx=0; iidx<nri; iidx++)
142 /* Load shift vector for this list */
143 i_shift_offset = DIM*shiftidx[iidx];
145 /* Load limits for loop over neighbors */
146 j_index_start = jindex[iidx];
147 j_index_end = jindex[iidx+1];
149 /* Get outer coordinate index */
151 i_coord_offset = DIM*inr;
153 /* Load i particle coords and add shift vector */
154 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
155 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
157 fix0 = _fjsp_setzero_v2r8();
158 fiy0 = _fjsp_setzero_v2r8();
159 fiz0 = _fjsp_setzero_v2r8();
160 fix1 = _fjsp_setzero_v2r8();
161 fiy1 = _fjsp_setzero_v2r8();
162 fiz1 = _fjsp_setzero_v2r8();
163 fix2 = _fjsp_setzero_v2r8();
164 fiy2 = _fjsp_setzero_v2r8();
165 fiz2 = _fjsp_setzero_v2r8();
166 fix3 = _fjsp_setzero_v2r8();
167 fiy3 = _fjsp_setzero_v2r8();
168 fiz3 = _fjsp_setzero_v2r8();
170 /* Reset potential sums */
171 velecsum = _fjsp_setzero_v2r8();
172 vvdwsum = _fjsp_setzero_v2r8();
174 /* Start inner kernel loop */
175 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
178 /* Get j neighbor index, and coordinate index */
181 j_coord_offsetA = DIM*jnrA;
182 j_coord_offsetB = DIM*jnrB;
184 /* load j atom coordinates */
185 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
188 /* Calculate displacement vector */
189 dx00 = _fjsp_sub_v2r8(ix0,jx0);
190 dy00 = _fjsp_sub_v2r8(iy0,jy0);
191 dz00 = _fjsp_sub_v2r8(iz0,jz0);
192 dx10 = _fjsp_sub_v2r8(ix1,jx0);
193 dy10 = _fjsp_sub_v2r8(iy1,jy0);
194 dz10 = _fjsp_sub_v2r8(iz1,jz0);
195 dx20 = _fjsp_sub_v2r8(ix2,jx0);
196 dy20 = _fjsp_sub_v2r8(iy2,jy0);
197 dz20 = _fjsp_sub_v2r8(iz2,jz0);
198 dx30 = _fjsp_sub_v2r8(ix3,jx0);
199 dy30 = _fjsp_sub_v2r8(iy3,jy0);
200 dz30 = _fjsp_sub_v2r8(iz3,jz0);
202 /* Calculate squared distance and things based on it */
203 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
204 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
205 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
206 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
208 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
209 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
210 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
212 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
213 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
214 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
215 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
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 /* Compute parameters for interactions between i and j atoms */
231 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
232 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
234 /* LENNARD-JONES DISPERSION/REPULSION */
236 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
237 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
238 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
239 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
240 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
242 /* Update potential sum for this i atom from the interaction with this j atom. */
243 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
247 /* Update vectorial force */
248 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
249 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
250 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
252 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
253 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
254 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
256 /**************************
257 * CALCULATE INTERACTIONS *
258 **************************/
260 /* Compute parameters for interactions between i and j atoms */
261 qq10 = _fjsp_mul_v2r8(iq1,jq0);
263 /* COULOMB ELECTROSTATICS */
264 velec = _fjsp_mul_v2r8(qq10,rinv10);
265 felec = _fjsp_mul_v2r8(velec,rinvsq10);
267 /* Update potential sum for this i atom from the interaction with this j atom. */
268 velecsum = _fjsp_add_v2r8(velecsum,velec);
272 /* Update vectorial force */
273 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
274 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
275 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
277 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
278 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
279 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
281 /**************************
282 * CALCULATE INTERACTIONS *
283 **************************/
285 /* Compute parameters for interactions between i and j atoms */
286 qq20 = _fjsp_mul_v2r8(iq2,jq0);
288 /* COULOMB ELECTROSTATICS */
289 velec = _fjsp_mul_v2r8(qq20,rinv20);
290 felec = _fjsp_mul_v2r8(velec,rinvsq20);
292 /* Update potential sum for this i atom from the interaction with this j atom. */
293 velecsum = _fjsp_add_v2r8(velecsum,velec);
297 /* Update vectorial force */
298 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
299 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
300 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
302 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
303 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
304 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 /* Compute parameters for interactions between i and j atoms */
311 qq30 = _fjsp_mul_v2r8(iq3,jq0);
313 /* COULOMB ELECTROSTATICS */
314 velec = _fjsp_mul_v2r8(qq30,rinv30);
315 felec = _fjsp_mul_v2r8(velec,rinvsq30);
317 /* Update potential sum for this i atom from the interaction with this j atom. */
318 velecsum = _fjsp_add_v2r8(velecsum,velec);
322 /* Update vectorial force */
323 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
324 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
325 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
327 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
328 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
329 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
331 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
333 /* Inner loop uses 131 flops */
340 j_coord_offsetA = DIM*jnrA;
342 /* load j atom coordinates */
343 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
346 /* Calculate displacement vector */
347 dx00 = _fjsp_sub_v2r8(ix0,jx0);
348 dy00 = _fjsp_sub_v2r8(iy0,jy0);
349 dz00 = _fjsp_sub_v2r8(iz0,jz0);
350 dx10 = _fjsp_sub_v2r8(ix1,jx0);
351 dy10 = _fjsp_sub_v2r8(iy1,jy0);
352 dz10 = _fjsp_sub_v2r8(iz1,jz0);
353 dx20 = _fjsp_sub_v2r8(ix2,jx0);
354 dy20 = _fjsp_sub_v2r8(iy2,jy0);
355 dz20 = _fjsp_sub_v2r8(iz2,jz0);
356 dx30 = _fjsp_sub_v2r8(ix3,jx0);
357 dy30 = _fjsp_sub_v2r8(iy3,jy0);
358 dz30 = _fjsp_sub_v2r8(iz3,jz0);
360 /* Calculate squared distance and things based on it */
361 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
362 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
363 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
364 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
366 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
367 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
368 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
370 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
371 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
372 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
373 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
375 /* Load parameters for j particles */
376 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
377 vdwjidx0A = 2*vdwtype[jnrA+0];
379 fjx0 = _fjsp_setzero_v2r8();
380 fjy0 = _fjsp_setzero_v2r8();
381 fjz0 = _fjsp_setzero_v2r8();
383 /**************************
384 * CALCULATE INTERACTIONS *
385 **************************/
387 /* Compute parameters for interactions between i and j atoms */
388 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
390 /* LENNARD-JONES DISPERSION/REPULSION */
392 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
393 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
394 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
395 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
396 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
398 /* Update potential sum for this i atom from the interaction with this j atom. */
399 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
400 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
404 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
406 /* Update vectorial force */
407 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
408 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
409 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
411 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
412 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
413 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
415 /**************************
416 * CALCULATE INTERACTIONS *
417 **************************/
419 /* Compute parameters for interactions between i and j atoms */
420 qq10 = _fjsp_mul_v2r8(iq1,jq0);
422 /* COULOMB ELECTROSTATICS */
423 velec = _fjsp_mul_v2r8(qq10,rinv10);
424 felec = _fjsp_mul_v2r8(velec,rinvsq10);
426 /* Update potential sum for this i atom from the interaction with this j atom. */
427 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
428 velecsum = _fjsp_add_v2r8(velecsum,velec);
432 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
434 /* Update vectorial force */
435 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
436 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
437 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
439 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
440 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
441 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
443 /**************************
444 * CALCULATE INTERACTIONS *
445 **************************/
447 /* Compute parameters for interactions between i and j atoms */
448 qq20 = _fjsp_mul_v2r8(iq2,jq0);
450 /* COULOMB ELECTROSTATICS */
451 velec = _fjsp_mul_v2r8(qq20,rinv20);
452 felec = _fjsp_mul_v2r8(velec,rinvsq20);
454 /* Update potential sum for this i atom from the interaction with this j atom. */
455 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
456 velecsum = _fjsp_add_v2r8(velecsum,velec);
460 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
462 /* Update vectorial force */
463 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
464 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
465 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
467 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
468 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
469 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
471 /**************************
472 * CALCULATE INTERACTIONS *
473 **************************/
475 /* Compute parameters for interactions between i and j atoms */
476 qq30 = _fjsp_mul_v2r8(iq3,jq0);
478 /* COULOMB ELECTROSTATICS */
479 velec = _fjsp_mul_v2r8(qq30,rinv30);
480 felec = _fjsp_mul_v2r8(velec,rinvsq30);
482 /* Update potential sum for this i atom from the interaction with this j atom. */
483 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
484 velecsum = _fjsp_add_v2r8(velecsum,velec);
488 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
490 /* Update vectorial force */
491 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
492 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
493 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
495 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
496 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
497 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
499 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
501 /* Inner loop uses 131 flops */
504 /* End of innermost loop */
506 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
507 f+i_coord_offset,fshift+i_shift_offset);
510 /* Update potential energies */
511 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
512 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
514 /* Increment number of inner iterations */
515 inneriter += j_index_end - j_index_start;
517 /* Outer loop uses 26 flops */
520 /* Increment number of outer iterations */
523 /* Update outer/inner flops */
525 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*131);
528 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
529 * Electrostatics interaction: Coulomb
530 * VdW interaction: LennardJones
531 * Geometry: Water4-Particle
532 * Calculate force/pot: Force
535 nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
536 (t_nblist * gmx_restrict nlist,
537 rvec * gmx_restrict xx,
538 rvec * gmx_restrict ff,
539 t_forcerec * gmx_restrict fr,
540 t_mdatoms * gmx_restrict mdatoms,
541 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
542 t_nrnb * gmx_restrict nrnb)
544 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
545 * just 0 for non-waters.
546 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
547 * jnr indices corresponding to data put in the four positions in the SIMD register.
549 int i_shift_offset,i_coord_offset,outeriter,inneriter;
550 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
552 int j_coord_offsetA,j_coord_offsetB;
553 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
555 real *shiftvec,*fshift,*x,*f;
556 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
558 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
560 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
562 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
564 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
565 int vdwjidx0A,vdwjidx0B;
566 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
567 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
568 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
569 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
570 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
571 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
574 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
577 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
578 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
580 _fjsp_v2r8 dummy_mask,cutoff_mask;
581 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
582 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
583 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
590 jindex = nlist->jindex;
592 shiftidx = nlist->shift;
594 shiftvec = fr->shift_vec[0];
595 fshift = fr->fshift[0];
596 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
597 charge = mdatoms->chargeA;
598 nvdwtype = fr->ntype;
600 vdwtype = mdatoms->typeA;
602 /* Setup water-specific parameters */
603 inr = nlist->iinr[0];
604 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
605 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
606 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
607 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
609 /* Avoid stupid compiler warnings */
617 /* Start outer loop over neighborlists */
618 for(iidx=0; iidx<nri; iidx++)
620 /* Load shift vector for this list */
621 i_shift_offset = DIM*shiftidx[iidx];
623 /* Load limits for loop over neighbors */
624 j_index_start = jindex[iidx];
625 j_index_end = jindex[iidx+1];
627 /* Get outer coordinate index */
629 i_coord_offset = DIM*inr;
631 /* Load i particle coords and add shift vector */
632 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
633 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
635 fix0 = _fjsp_setzero_v2r8();
636 fiy0 = _fjsp_setzero_v2r8();
637 fiz0 = _fjsp_setzero_v2r8();
638 fix1 = _fjsp_setzero_v2r8();
639 fiy1 = _fjsp_setzero_v2r8();
640 fiz1 = _fjsp_setzero_v2r8();
641 fix2 = _fjsp_setzero_v2r8();
642 fiy2 = _fjsp_setzero_v2r8();
643 fiz2 = _fjsp_setzero_v2r8();
644 fix3 = _fjsp_setzero_v2r8();
645 fiy3 = _fjsp_setzero_v2r8();
646 fiz3 = _fjsp_setzero_v2r8();
648 /* Start inner kernel loop */
649 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
652 /* Get j neighbor index, and coordinate index */
655 j_coord_offsetA = DIM*jnrA;
656 j_coord_offsetB = DIM*jnrB;
658 /* load j atom coordinates */
659 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
662 /* Calculate displacement vector */
663 dx00 = _fjsp_sub_v2r8(ix0,jx0);
664 dy00 = _fjsp_sub_v2r8(iy0,jy0);
665 dz00 = _fjsp_sub_v2r8(iz0,jz0);
666 dx10 = _fjsp_sub_v2r8(ix1,jx0);
667 dy10 = _fjsp_sub_v2r8(iy1,jy0);
668 dz10 = _fjsp_sub_v2r8(iz1,jz0);
669 dx20 = _fjsp_sub_v2r8(ix2,jx0);
670 dy20 = _fjsp_sub_v2r8(iy2,jy0);
671 dz20 = _fjsp_sub_v2r8(iz2,jz0);
672 dx30 = _fjsp_sub_v2r8(ix3,jx0);
673 dy30 = _fjsp_sub_v2r8(iy3,jy0);
674 dz30 = _fjsp_sub_v2r8(iz3,jz0);
676 /* Calculate squared distance and things based on it */
677 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
678 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
679 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
680 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
682 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
683 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
684 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
686 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
687 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
688 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
689 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
691 /* Load parameters for j particles */
692 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
693 vdwjidx0A = 2*vdwtype[jnrA+0];
694 vdwjidx0B = 2*vdwtype[jnrB+0];
696 fjx0 = _fjsp_setzero_v2r8();
697 fjy0 = _fjsp_setzero_v2r8();
698 fjz0 = _fjsp_setzero_v2r8();
700 /**************************
701 * CALCULATE INTERACTIONS *
702 **************************/
704 /* Compute parameters for interactions between i and j atoms */
705 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
706 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
708 /* LENNARD-JONES DISPERSION/REPULSION */
710 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
711 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
715 /* Update vectorial force */
716 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
717 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
718 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
720 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
721 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
722 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
724 /**************************
725 * CALCULATE INTERACTIONS *
726 **************************/
728 /* Compute parameters for interactions between i and j atoms */
729 qq10 = _fjsp_mul_v2r8(iq1,jq0);
731 /* COULOMB ELECTROSTATICS */
732 velec = _fjsp_mul_v2r8(qq10,rinv10);
733 felec = _fjsp_mul_v2r8(velec,rinvsq10);
737 /* Update vectorial force */
738 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
739 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
740 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
742 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
743 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
744 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
746 /**************************
747 * CALCULATE INTERACTIONS *
748 **************************/
750 /* Compute parameters for interactions between i and j atoms */
751 qq20 = _fjsp_mul_v2r8(iq2,jq0);
753 /* COULOMB ELECTROSTATICS */
754 velec = _fjsp_mul_v2r8(qq20,rinv20);
755 felec = _fjsp_mul_v2r8(velec,rinvsq20);
759 /* Update vectorial force */
760 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
761 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
762 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
764 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
765 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
766 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
768 /**************************
769 * CALCULATE INTERACTIONS *
770 **************************/
772 /* Compute parameters for interactions between i and j atoms */
773 qq30 = _fjsp_mul_v2r8(iq3,jq0);
775 /* COULOMB ELECTROSTATICS */
776 velec = _fjsp_mul_v2r8(qq30,rinv30);
777 felec = _fjsp_mul_v2r8(velec,rinvsq30);
781 /* Update vectorial force */
782 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
783 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
784 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
786 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
787 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
788 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
790 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
792 /* Inner loop uses 123 flops */
799 j_coord_offsetA = DIM*jnrA;
801 /* load j atom coordinates */
802 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
805 /* Calculate displacement vector */
806 dx00 = _fjsp_sub_v2r8(ix0,jx0);
807 dy00 = _fjsp_sub_v2r8(iy0,jy0);
808 dz00 = _fjsp_sub_v2r8(iz0,jz0);
809 dx10 = _fjsp_sub_v2r8(ix1,jx0);
810 dy10 = _fjsp_sub_v2r8(iy1,jy0);
811 dz10 = _fjsp_sub_v2r8(iz1,jz0);
812 dx20 = _fjsp_sub_v2r8(ix2,jx0);
813 dy20 = _fjsp_sub_v2r8(iy2,jy0);
814 dz20 = _fjsp_sub_v2r8(iz2,jz0);
815 dx30 = _fjsp_sub_v2r8(ix3,jx0);
816 dy30 = _fjsp_sub_v2r8(iy3,jy0);
817 dz30 = _fjsp_sub_v2r8(iz3,jz0);
819 /* Calculate squared distance and things based on it */
820 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
821 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
822 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
823 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
825 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
826 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
827 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
829 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
830 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
831 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
832 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
834 /* Load parameters for j particles */
835 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
836 vdwjidx0A = 2*vdwtype[jnrA+0];
838 fjx0 = _fjsp_setzero_v2r8();
839 fjy0 = _fjsp_setzero_v2r8();
840 fjz0 = _fjsp_setzero_v2r8();
842 /**************************
843 * CALCULATE INTERACTIONS *
844 **************************/
846 /* Compute parameters for interactions between i and j atoms */
847 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
849 /* LENNARD-JONES DISPERSION/REPULSION */
851 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
852 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
856 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
858 /* Update vectorial force */
859 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
860 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
861 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
863 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
864 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
865 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
867 /**************************
868 * CALCULATE INTERACTIONS *
869 **************************/
871 /* Compute parameters for interactions between i and j atoms */
872 qq10 = _fjsp_mul_v2r8(iq1,jq0);
874 /* COULOMB ELECTROSTATICS */
875 velec = _fjsp_mul_v2r8(qq10,rinv10);
876 felec = _fjsp_mul_v2r8(velec,rinvsq10);
880 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
882 /* Update vectorial force */
883 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
884 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
885 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
887 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
888 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
889 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
891 /**************************
892 * CALCULATE INTERACTIONS *
893 **************************/
895 /* Compute parameters for interactions between i and j atoms */
896 qq20 = _fjsp_mul_v2r8(iq2,jq0);
898 /* COULOMB ELECTROSTATICS */
899 velec = _fjsp_mul_v2r8(qq20,rinv20);
900 felec = _fjsp_mul_v2r8(velec,rinvsq20);
904 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
906 /* Update vectorial force */
907 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
908 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
909 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
911 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
912 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
913 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
915 /**************************
916 * CALCULATE INTERACTIONS *
917 **************************/
919 /* Compute parameters for interactions between i and j atoms */
920 qq30 = _fjsp_mul_v2r8(iq3,jq0);
922 /* COULOMB ELECTROSTATICS */
923 velec = _fjsp_mul_v2r8(qq30,rinv30);
924 felec = _fjsp_mul_v2r8(velec,rinvsq30);
928 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
930 /* Update vectorial force */
931 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
932 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
933 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
935 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
936 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
937 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
939 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
941 /* Inner loop uses 123 flops */
944 /* End of innermost loop */
946 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
947 f+i_coord_offset,fshift+i_shift_offset);
949 /* Increment number of inner iterations */
950 inneriter += j_index_end - j_index_start;
952 /* Outer loop uses 24 flops */
955 /* Increment number of outer iterations */
958 /* Update outer/inner flops */
960 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*123);