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_ElecCoul_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwLJ_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);
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
121 charge = mdatoms->chargeA;
122 nvdwtype = fr->ntype;
124 vdwtype = mdatoms->typeA;
126 /* Setup water-specific parameters */
127 inr = nlist->iinr[0];
128 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
129 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
130 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
131 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
133 /* Avoid stupid compiler warnings */
141 /* Start outer loop over neighborlists */
142 for(iidx=0; iidx<nri; iidx++)
144 /* Load shift vector for this list */
145 i_shift_offset = DIM*shiftidx[iidx];
147 /* Load limits for loop over neighbors */
148 j_index_start = jindex[iidx];
149 j_index_end = jindex[iidx+1];
151 /* Get outer coordinate index */
153 i_coord_offset = DIM*inr;
155 /* Load i particle coords and add shift vector */
156 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
157 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
159 fix0 = _fjsp_setzero_v2r8();
160 fiy0 = _fjsp_setzero_v2r8();
161 fiz0 = _fjsp_setzero_v2r8();
162 fix1 = _fjsp_setzero_v2r8();
163 fiy1 = _fjsp_setzero_v2r8();
164 fiz1 = _fjsp_setzero_v2r8();
165 fix2 = _fjsp_setzero_v2r8();
166 fiy2 = _fjsp_setzero_v2r8();
167 fiz2 = _fjsp_setzero_v2r8();
168 fix3 = _fjsp_setzero_v2r8();
169 fiy3 = _fjsp_setzero_v2r8();
170 fiz3 = _fjsp_setzero_v2r8();
172 /* Reset potential sums */
173 velecsum = _fjsp_setzero_v2r8();
174 vvdwsum = _fjsp_setzero_v2r8();
176 /* Start inner kernel loop */
177 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
180 /* Get j neighbor index, and coordinate index */
183 j_coord_offsetA = DIM*jnrA;
184 j_coord_offsetB = DIM*jnrB;
186 /* load j atom coordinates */
187 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
190 /* Calculate displacement vector */
191 dx00 = _fjsp_sub_v2r8(ix0,jx0);
192 dy00 = _fjsp_sub_v2r8(iy0,jy0);
193 dz00 = _fjsp_sub_v2r8(iz0,jz0);
194 dx10 = _fjsp_sub_v2r8(ix1,jx0);
195 dy10 = _fjsp_sub_v2r8(iy1,jy0);
196 dz10 = _fjsp_sub_v2r8(iz1,jz0);
197 dx20 = _fjsp_sub_v2r8(ix2,jx0);
198 dy20 = _fjsp_sub_v2r8(iy2,jy0);
199 dz20 = _fjsp_sub_v2r8(iz2,jz0);
200 dx30 = _fjsp_sub_v2r8(ix3,jx0);
201 dy30 = _fjsp_sub_v2r8(iy3,jy0);
202 dz30 = _fjsp_sub_v2r8(iz3,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);
208 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
210 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
211 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
212 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
214 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
215 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
216 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
217 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
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 /* Compute parameters for interactions between i and j atoms */
233 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
234 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
236 /* LENNARD-JONES DISPERSION/REPULSION */
238 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
239 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
240 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
241 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
242 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
244 /* Update potential sum for this i atom from the interaction with this j atom. */
245 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
249 /* Update vectorial force */
250 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
251 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
252 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
254 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
255 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
256 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
258 /**************************
259 * CALCULATE INTERACTIONS *
260 **************************/
262 /* Compute parameters for interactions between i and j atoms */
263 qq10 = _fjsp_mul_v2r8(iq1,jq0);
265 /* COULOMB ELECTROSTATICS */
266 velec = _fjsp_mul_v2r8(qq10,rinv10);
267 felec = _fjsp_mul_v2r8(velec,rinvsq10);
269 /* Update potential sum for this i atom from the interaction with this j atom. */
270 velecsum = _fjsp_add_v2r8(velecsum,velec);
274 /* Update vectorial force */
275 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
276 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
277 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
279 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
280 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
281 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
283 /**************************
284 * CALCULATE INTERACTIONS *
285 **************************/
287 /* Compute parameters for interactions between i and j atoms */
288 qq20 = _fjsp_mul_v2r8(iq2,jq0);
290 /* COULOMB ELECTROSTATICS */
291 velec = _fjsp_mul_v2r8(qq20,rinv20);
292 felec = _fjsp_mul_v2r8(velec,rinvsq20);
294 /* Update potential sum for this i atom from the interaction with this j atom. */
295 velecsum = _fjsp_add_v2r8(velecsum,velec);
299 /* Update vectorial force */
300 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
301 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
302 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
304 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
305 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
306 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
308 /**************************
309 * CALCULATE INTERACTIONS *
310 **************************/
312 /* Compute parameters for interactions between i and j atoms */
313 qq30 = _fjsp_mul_v2r8(iq3,jq0);
315 /* COULOMB ELECTROSTATICS */
316 velec = _fjsp_mul_v2r8(qq30,rinv30);
317 felec = _fjsp_mul_v2r8(velec,rinvsq30);
319 /* Update potential sum for this i atom from the interaction with this j atom. */
320 velecsum = _fjsp_add_v2r8(velecsum,velec);
324 /* Update vectorial force */
325 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
326 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
327 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
329 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
330 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
331 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
333 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
335 /* Inner loop uses 131 flops */
342 j_coord_offsetA = DIM*jnrA;
344 /* load j atom coordinates */
345 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
348 /* Calculate displacement vector */
349 dx00 = _fjsp_sub_v2r8(ix0,jx0);
350 dy00 = _fjsp_sub_v2r8(iy0,jy0);
351 dz00 = _fjsp_sub_v2r8(iz0,jz0);
352 dx10 = _fjsp_sub_v2r8(ix1,jx0);
353 dy10 = _fjsp_sub_v2r8(iy1,jy0);
354 dz10 = _fjsp_sub_v2r8(iz1,jz0);
355 dx20 = _fjsp_sub_v2r8(ix2,jx0);
356 dy20 = _fjsp_sub_v2r8(iy2,jy0);
357 dz20 = _fjsp_sub_v2r8(iz2,jz0);
358 dx30 = _fjsp_sub_v2r8(ix3,jx0);
359 dy30 = _fjsp_sub_v2r8(iy3,jy0);
360 dz30 = _fjsp_sub_v2r8(iz3,jz0);
362 /* Calculate squared distance and things based on it */
363 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
364 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
365 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
366 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
368 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
369 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
370 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
372 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
373 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
374 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
375 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
377 /* Load parameters for j particles */
378 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
379 vdwjidx0A = 2*vdwtype[jnrA+0];
381 fjx0 = _fjsp_setzero_v2r8();
382 fjy0 = _fjsp_setzero_v2r8();
383 fjz0 = _fjsp_setzero_v2r8();
385 /**************************
386 * CALCULATE INTERACTIONS *
387 **************************/
389 /* Compute parameters for interactions between i and j atoms */
390 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
392 /* LENNARD-JONES DISPERSION/REPULSION */
394 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
395 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
396 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
397 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
398 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
400 /* Update potential sum for this i atom from the interaction with this j atom. */
401 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
402 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
406 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
408 /* Update vectorial force */
409 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
410 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
411 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
413 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
414 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
415 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
417 /**************************
418 * CALCULATE INTERACTIONS *
419 **************************/
421 /* Compute parameters for interactions between i and j atoms */
422 qq10 = _fjsp_mul_v2r8(iq1,jq0);
424 /* COULOMB ELECTROSTATICS */
425 velec = _fjsp_mul_v2r8(qq10,rinv10);
426 felec = _fjsp_mul_v2r8(velec,rinvsq10);
428 /* Update potential sum for this i atom from the interaction with this j atom. */
429 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
430 velecsum = _fjsp_add_v2r8(velecsum,velec);
434 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
436 /* Update vectorial force */
437 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
438 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
439 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
441 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
442 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
443 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
445 /**************************
446 * CALCULATE INTERACTIONS *
447 **************************/
449 /* Compute parameters for interactions between i and j atoms */
450 qq20 = _fjsp_mul_v2r8(iq2,jq0);
452 /* COULOMB ELECTROSTATICS */
453 velec = _fjsp_mul_v2r8(qq20,rinv20);
454 felec = _fjsp_mul_v2r8(velec,rinvsq20);
456 /* Update potential sum for this i atom from the interaction with this j atom. */
457 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
458 velecsum = _fjsp_add_v2r8(velecsum,velec);
462 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
464 /* Update vectorial force */
465 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
466 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
467 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
469 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
470 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
471 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
473 /**************************
474 * CALCULATE INTERACTIONS *
475 **************************/
477 /* Compute parameters for interactions between i and j atoms */
478 qq30 = _fjsp_mul_v2r8(iq3,jq0);
480 /* COULOMB ELECTROSTATICS */
481 velec = _fjsp_mul_v2r8(qq30,rinv30);
482 felec = _fjsp_mul_v2r8(velec,rinvsq30);
484 /* Update potential sum for this i atom from the interaction with this j atom. */
485 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
486 velecsum = _fjsp_add_v2r8(velecsum,velec);
490 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
492 /* Update vectorial force */
493 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
494 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
495 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
497 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
498 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
499 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
501 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
503 /* Inner loop uses 131 flops */
506 /* End of innermost loop */
508 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
509 f+i_coord_offset,fshift+i_shift_offset);
512 /* Update potential energies */
513 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
514 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
516 /* Increment number of inner iterations */
517 inneriter += j_index_end - j_index_start;
519 /* Outer loop uses 26 flops */
522 /* Increment number of outer iterations */
525 /* Update outer/inner flops */
527 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*131);
530 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
531 * Electrostatics interaction: Coulomb
532 * VdW interaction: LennardJones
533 * Geometry: Water4-Particle
534 * Calculate force/pot: Force
537 nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
538 (t_nblist * gmx_restrict nlist,
539 rvec * gmx_restrict xx,
540 rvec * gmx_restrict ff,
541 t_forcerec * gmx_restrict fr,
542 t_mdatoms * gmx_restrict mdatoms,
543 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
544 t_nrnb * gmx_restrict nrnb)
546 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
547 * just 0 for non-waters.
548 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
549 * jnr indices corresponding to data put in the four positions in the SIMD register.
551 int i_shift_offset,i_coord_offset,outeriter,inneriter;
552 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
554 int j_coord_offsetA,j_coord_offsetB;
555 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
557 real *shiftvec,*fshift,*x,*f;
558 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
560 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
562 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
564 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
566 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
567 int vdwjidx0A,vdwjidx0B;
568 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
569 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
570 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
571 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
572 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
573 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
576 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
579 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
580 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
582 _fjsp_v2r8 dummy_mask,cutoff_mask;
583 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
584 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
585 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
592 jindex = nlist->jindex;
594 shiftidx = nlist->shift;
596 shiftvec = fr->shift_vec[0];
597 fshift = fr->fshift[0];
598 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
599 charge = mdatoms->chargeA;
600 nvdwtype = fr->ntype;
602 vdwtype = mdatoms->typeA;
604 /* Setup water-specific parameters */
605 inr = nlist->iinr[0];
606 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
607 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
608 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
609 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
611 /* Avoid stupid compiler warnings */
619 /* Start outer loop over neighborlists */
620 for(iidx=0; iidx<nri; iidx++)
622 /* Load shift vector for this list */
623 i_shift_offset = DIM*shiftidx[iidx];
625 /* Load limits for loop over neighbors */
626 j_index_start = jindex[iidx];
627 j_index_end = jindex[iidx+1];
629 /* Get outer coordinate index */
631 i_coord_offset = DIM*inr;
633 /* Load i particle coords and add shift vector */
634 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
635 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
637 fix0 = _fjsp_setzero_v2r8();
638 fiy0 = _fjsp_setzero_v2r8();
639 fiz0 = _fjsp_setzero_v2r8();
640 fix1 = _fjsp_setzero_v2r8();
641 fiy1 = _fjsp_setzero_v2r8();
642 fiz1 = _fjsp_setzero_v2r8();
643 fix2 = _fjsp_setzero_v2r8();
644 fiy2 = _fjsp_setzero_v2r8();
645 fiz2 = _fjsp_setzero_v2r8();
646 fix3 = _fjsp_setzero_v2r8();
647 fiy3 = _fjsp_setzero_v2r8();
648 fiz3 = _fjsp_setzero_v2r8();
650 /* Start inner kernel loop */
651 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
654 /* Get j neighbor index, and coordinate index */
657 j_coord_offsetA = DIM*jnrA;
658 j_coord_offsetB = DIM*jnrB;
660 /* load j atom coordinates */
661 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
664 /* Calculate displacement vector */
665 dx00 = _fjsp_sub_v2r8(ix0,jx0);
666 dy00 = _fjsp_sub_v2r8(iy0,jy0);
667 dz00 = _fjsp_sub_v2r8(iz0,jz0);
668 dx10 = _fjsp_sub_v2r8(ix1,jx0);
669 dy10 = _fjsp_sub_v2r8(iy1,jy0);
670 dz10 = _fjsp_sub_v2r8(iz1,jz0);
671 dx20 = _fjsp_sub_v2r8(ix2,jx0);
672 dy20 = _fjsp_sub_v2r8(iy2,jy0);
673 dz20 = _fjsp_sub_v2r8(iz2,jz0);
674 dx30 = _fjsp_sub_v2r8(ix3,jx0);
675 dy30 = _fjsp_sub_v2r8(iy3,jy0);
676 dz30 = _fjsp_sub_v2r8(iz3,jz0);
678 /* Calculate squared distance and things based on it */
679 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
680 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
681 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
682 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
684 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
685 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
686 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
688 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
689 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
690 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
691 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
693 /* Load parameters for j particles */
694 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
695 vdwjidx0A = 2*vdwtype[jnrA+0];
696 vdwjidx0B = 2*vdwtype[jnrB+0];
698 fjx0 = _fjsp_setzero_v2r8();
699 fjy0 = _fjsp_setzero_v2r8();
700 fjz0 = _fjsp_setzero_v2r8();
702 /**************************
703 * CALCULATE INTERACTIONS *
704 **************************/
706 /* Compute parameters for interactions between i and j atoms */
707 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
708 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
710 /* LENNARD-JONES DISPERSION/REPULSION */
712 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
713 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
717 /* Update vectorial force */
718 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
719 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
720 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
722 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
723 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
724 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
726 /**************************
727 * CALCULATE INTERACTIONS *
728 **************************/
730 /* Compute parameters for interactions between i and j atoms */
731 qq10 = _fjsp_mul_v2r8(iq1,jq0);
733 /* COULOMB ELECTROSTATICS */
734 velec = _fjsp_mul_v2r8(qq10,rinv10);
735 felec = _fjsp_mul_v2r8(velec,rinvsq10);
739 /* Update vectorial force */
740 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
741 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
742 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
744 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
745 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
746 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
748 /**************************
749 * CALCULATE INTERACTIONS *
750 **************************/
752 /* Compute parameters for interactions between i and j atoms */
753 qq20 = _fjsp_mul_v2r8(iq2,jq0);
755 /* COULOMB ELECTROSTATICS */
756 velec = _fjsp_mul_v2r8(qq20,rinv20);
757 felec = _fjsp_mul_v2r8(velec,rinvsq20);
761 /* Update vectorial force */
762 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
763 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
764 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
766 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
767 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
768 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
770 /**************************
771 * CALCULATE INTERACTIONS *
772 **************************/
774 /* Compute parameters for interactions between i and j atoms */
775 qq30 = _fjsp_mul_v2r8(iq3,jq0);
777 /* COULOMB ELECTROSTATICS */
778 velec = _fjsp_mul_v2r8(qq30,rinv30);
779 felec = _fjsp_mul_v2r8(velec,rinvsq30);
783 /* Update vectorial force */
784 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
785 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
786 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
788 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
789 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
790 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
792 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
794 /* Inner loop uses 123 flops */
801 j_coord_offsetA = DIM*jnrA;
803 /* load j atom coordinates */
804 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
807 /* Calculate displacement vector */
808 dx00 = _fjsp_sub_v2r8(ix0,jx0);
809 dy00 = _fjsp_sub_v2r8(iy0,jy0);
810 dz00 = _fjsp_sub_v2r8(iz0,jz0);
811 dx10 = _fjsp_sub_v2r8(ix1,jx0);
812 dy10 = _fjsp_sub_v2r8(iy1,jy0);
813 dz10 = _fjsp_sub_v2r8(iz1,jz0);
814 dx20 = _fjsp_sub_v2r8(ix2,jx0);
815 dy20 = _fjsp_sub_v2r8(iy2,jy0);
816 dz20 = _fjsp_sub_v2r8(iz2,jz0);
817 dx30 = _fjsp_sub_v2r8(ix3,jx0);
818 dy30 = _fjsp_sub_v2r8(iy3,jy0);
819 dz30 = _fjsp_sub_v2r8(iz3,jz0);
821 /* Calculate squared distance and things based on it */
822 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
823 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
824 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
825 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
827 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
828 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
829 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
831 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
832 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
833 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
834 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
836 /* Load parameters for j particles */
837 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
838 vdwjidx0A = 2*vdwtype[jnrA+0];
840 fjx0 = _fjsp_setzero_v2r8();
841 fjy0 = _fjsp_setzero_v2r8();
842 fjz0 = _fjsp_setzero_v2r8();
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* Compute parameters for interactions between i and j atoms */
849 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
851 /* LENNARD-JONES DISPERSION/REPULSION */
853 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
854 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
858 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
860 /* Update vectorial force */
861 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
862 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
863 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
865 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
866 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
867 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
869 /**************************
870 * CALCULATE INTERACTIONS *
871 **************************/
873 /* Compute parameters for interactions between i and j atoms */
874 qq10 = _fjsp_mul_v2r8(iq1,jq0);
876 /* COULOMB ELECTROSTATICS */
877 velec = _fjsp_mul_v2r8(qq10,rinv10);
878 felec = _fjsp_mul_v2r8(velec,rinvsq10);
882 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
884 /* Update vectorial force */
885 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
886 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
887 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
889 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
890 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
891 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
897 /* Compute parameters for interactions between i and j atoms */
898 qq20 = _fjsp_mul_v2r8(iq2,jq0);
900 /* COULOMB ELECTROSTATICS */
901 velec = _fjsp_mul_v2r8(qq20,rinv20);
902 felec = _fjsp_mul_v2r8(velec,rinvsq20);
906 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
908 /* Update vectorial force */
909 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
910 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
911 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
913 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
914 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
915 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
917 /**************************
918 * CALCULATE INTERACTIONS *
919 **************************/
921 /* Compute parameters for interactions between i and j atoms */
922 qq30 = _fjsp_mul_v2r8(iq3,jq0);
924 /* COULOMB ELECTROSTATICS */
925 velec = _fjsp_mul_v2r8(qq30,rinv30);
926 felec = _fjsp_mul_v2r8(velec,rinvsq30);
930 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
932 /* Update vectorial force */
933 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
934 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
935 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
937 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
938 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
939 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
941 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
943 /* Inner loop uses 123 flops */
946 /* End of innermost loop */
948 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
949 f+i_coord_offset,fshift+i_shift_offset);
951 /* Increment number of inner iterations */
952 inneriter += j_index_end - j_index_start;
954 /* Outer loop uses 24 flops */
957 /* Increment number of outer iterations */
960 /* Update outer/inner flops */
962 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*123);