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_ElecRF_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_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 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
121 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
122 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
123 nvdwtype = fr->ntype;
125 vdwtype = mdatoms->typeA;
127 /* Setup water-specific parameters */
128 inr = nlist->iinr[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 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
132 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
134 /* Avoid stupid compiler warnings */
142 /* Start outer loop over neighborlists */
143 for(iidx=0; iidx<nri; iidx++)
145 /* Load shift vector for this list */
146 i_shift_offset = DIM*shiftidx[iidx];
148 /* Load limits for loop over neighbors */
149 j_index_start = jindex[iidx];
150 j_index_end = jindex[iidx+1];
152 /* Get outer coordinate index */
154 i_coord_offset = DIM*inr;
156 /* Load i particle coords and add shift vector */
157 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
158 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
160 fix0 = _fjsp_setzero_v2r8();
161 fiy0 = _fjsp_setzero_v2r8();
162 fiz0 = _fjsp_setzero_v2r8();
163 fix1 = _fjsp_setzero_v2r8();
164 fiy1 = _fjsp_setzero_v2r8();
165 fiz1 = _fjsp_setzero_v2r8();
166 fix2 = _fjsp_setzero_v2r8();
167 fiy2 = _fjsp_setzero_v2r8();
168 fiz2 = _fjsp_setzero_v2r8();
169 fix3 = _fjsp_setzero_v2r8();
170 fiy3 = _fjsp_setzero_v2r8();
171 fiz3 = _fjsp_setzero_v2r8();
173 /* Reset potential sums */
174 velecsum = _fjsp_setzero_v2r8();
175 vvdwsum = _fjsp_setzero_v2r8();
177 /* Start inner kernel loop */
178 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
181 /* Get j neighbor index, and coordinate index */
184 j_coord_offsetA = DIM*jnrA;
185 j_coord_offsetB = DIM*jnrB;
187 /* load j atom coordinates */
188 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
191 /* Calculate displacement vector */
192 dx00 = _fjsp_sub_v2r8(ix0,jx0);
193 dy00 = _fjsp_sub_v2r8(iy0,jy0);
194 dz00 = _fjsp_sub_v2r8(iz0,jz0);
195 dx10 = _fjsp_sub_v2r8(ix1,jx0);
196 dy10 = _fjsp_sub_v2r8(iy1,jy0);
197 dz10 = _fjsp_sub_v2r8(iz1,jz0);
198 dx20 = _fjsp_sub_v2r8(ix2,jx0);
199 dy20 = _fjsp_sub_v2r8(iy2,jy0);
200 dz20 = _fjsp_sub_v2r8(iz2,jz0);
201 dx30 = _fjsp_sub_v2r8(ix3,jx0);
202 dy30 = _fjsp_sub_v2r8(iy3,jy0);
203 dz30 = _fjsp_sub_v2r8(iz3,jz0);
205 /* Calculate squared distance and things based on it */
206 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
207 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
208 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
209 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
211 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
212 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
213 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
215 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
216 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
217 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
218 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
220 /* Load parameters for j particles */
221 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
222 vdwjidx0A = 2*vdwtype[jnrA+0];
223 vdwjidx0B = 2*vdwtype[jnrB+0];
225 fjx0 = _fjsp_setzero_v2r8();
226 fjy0 = _fjsp_setzero_v2r8();
227 fjz0 = _fjsp_setzero_v2r8();
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
233 /* Compute parameters for interactions between i and j atoms */
234 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
235 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
237 /* LENNARD-JONES DISPERSION/REPULSION */
239 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
240 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
241 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
242 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
243 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
245 /* Update potential sum for this i atom from the interaction with this j atom. */
246 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
250 /* Update vectorial force */
251 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
252 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
253 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
255 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
256 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
257 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
259 /**************************
260 * CALCULATE INTERACTIONS *
261 **************************/
263 /* Compute parameters for interactions between i and j atoms */
264 qq10 = _fjsp_mul_v2r8(iq1,jq0);
266 /* REACTION-FIELD ELECTROSTATICS */
267 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
268 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
270 /* Update potential sum for this i atom from the interaction with this j atom. */
271 velecsum = _fjsp_add_v2r8(velecsum,velec);
275 /* Update vectorial force */
276 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
277 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
278 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
280 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
281 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
282 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
284 /**************************
285 * CALCULATE INTERACTIONS *
286 **************************/
288 /* Compute parameters for interactions between i and j atoms */
289 qq20 = _fjsp_mul_v2r8(iq2,jq0);
291 /* REACTION-FIELD ELECTROSTATICS */
292 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
293 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
295 /* Update potential sum for this i atom from the interaction with this j atom. */
296 velecsum = _fjsp_add_v2r8(velecsum,velec);
300 /* Update vectorial force */
301 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
302 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
303 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
305 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
306 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
307 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
309 /**************************
310 * CALCULATE INTERACTIONS *
311 **************************/
313 /* Compute parameters for interactions between i and j atoms */
314 qq30 = _fjsp_mul_v2r8(iq3,jq0);
316 /* REACTION-FIELD ELECTROSTATICS */
317 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
318 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
320 /* Update potential sum for this i atom from the interaction with this j atom. */
321 velecsum = _fjsp_add_v2r8(velecsum,velec);
325 /* Update vectorial force */
326 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
327 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
328 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
330 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
331 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
332 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
334 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
336 /* Inner loop uses 143 flops */
343 j_coord_offsetA = DIM*jnrA;
345 /* load j atom coordinates */
346 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
349 /* Calculate displacement vector */
350 dx00 = _fjsp_sub_v2r8(ix0,jx0);
351 dy00 = _fjsp_sub_v2r8(iy0,jy0);
352 dz00 = _fjsp_sub_v2r8(iz0,jz0);
353 dx10 = _fjsp_sub_v2r8(ix1,jx0);
354 dy10 = _fjsp_sub_v2r8(iy1,jy0);
355 dz10 = _fjsp_sub_v2r8(iz1,jz0);
356 dx20 = _fjsp_sub_v2r8(ix2,jx0);
357 dy20 = _fjsp_sub_v2r8(iy2,jy0);
358 dz20 = _fjsp_sub_v2r8(iz2,jz0);
359 dx30 = _fjsp_sub_v2r8(ix3,jx0);
360 dy30 = _fjsp_sub_v2r8(iy3,jy0);
361 dz30 = _fjsp_sub_v2r8(iz3,jz0);
363 /* Calculate squared distance and things based on it */
364 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
365 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
366 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
367 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
369 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
370 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
371 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
373 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
374 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
375 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
376 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
378 /* Load parameters for j particles */
379 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
380 vdwjidx0A = 2*vdwtype[jnrA+0];
382 fjx0 = _fjsp_setzero_v2r8();
383 fjy0 = _fjsp_setzero_v2r8();
384 fjz0 = _fjsp_setzero_v2r8();
386 /**************************
387 * CALCULATE INTERACTIONS *
388 **************************/
390 /* Compute parameters for interactions between i and j atoms */
391 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
393 /* LENNARD-JONES DISPERSION/REPULSION */
395 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
396 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
397 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
398 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
399 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
401 /* Update potential sum for this i atom from the interaction with this j atom. */
402 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
403 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
407 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
409 /* Update vectorial force */
410 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
411 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
412 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
414 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
415 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
416 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
418 /**************************
419 * CALCULATE INTERACTIONS *
420 **************************/
422 /* Compute parameters for interactions between i and j atoms */
423 qq10 = _fjsp_mul_v2r8(iq1,jq0);
425 /* REACTION-FIELD ELECTROSTATICS */
426 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
427 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
429 /* Update potential sum for this i atom from the interaction with this j atom. */
430 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
431 velecsum = _fjsp_add_v2r8(velecsum,velec);
435 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
437 /* Update vectorial force */
438 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
439 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
440 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
442 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
443 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
444 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
446 /**************************
447 * CALCULATE INTERACTIONS *
448 **************************/
450 /* Compute parameters for interactions between i and j atoms */
451 qq20 = _fjsp_mul_v2r8(iq2,jq0);
453 /* REACTION-FIELD ELECTROSTATICS */
454 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
455 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
457 /* Update potential sum for this i atom from the interaction with this j atom. */
458 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
459 velecsum = _fjsp_add_v2r8(velecsum,velec);
463 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
465 /* Update vectorial force */
466 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
467 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
468 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
470 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
471 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
472 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
474 /**************************
475 * CALCULATE INTERACTIONS *
476 **************************/
478 /* Compute parameters for interactions between i and j atoms */
479 qq30 = _fjsp_mul_v2r8(iq3,jq0);
481 /* REACTION-FIELD ELECTROSTATICS */
482 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
483 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
485 /* Update potential sum for this i atom from the interaction with this j atom. */
486 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
487 velecsum = _fjsp_add_v2r8(velecsum,velec);
491 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
493 /* Update vectorial force */
494 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
495 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
496 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
498 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
499 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
500 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
502 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
504 /* Inner loop uses 143 flops */
507 /* End of innermost loop */
509 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
510 f+i_coord_offset,fshift+i_shift_offset);
513 /* Update potential energies */
514 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
515 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
517 /* Increment number of inner iterations */
518 inneriter += j_index_end - j_index_start;
520 /* Outer loop uses 26 flops */
523 /* Increment number of outer iterations */
526 /* Update outer/inner flops */
528 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*143);
531 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
532 * Electrostatics interaction: ReactionField
533 * VdW interaction: LennardJones
534 * Geometry: Water4-Particle
535 * Calculate force/pot: Force
538 nb_kernel_ElecRF_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
539 (t_nblist * gmx_restrict nlist,
540 rvec * gmx_restrict xx,
541 rvec * gmx_restrict ff,
542 t_forcerec * gmx_restrict fr,
543 t_mdatoms * gmx_restrict mdatoms,
544 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
545 t_nrnb * gmx_restrict nrnb)
547 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
548 * just 0 for non-waters.
549 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
550 * jnr indices corresponding to data put in the four positions in the SIMD register.
552 int i_shift_offset,i_coord_offset,outeriter,inneriter;
553 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
555 int j_coord_offsetA,j_coord_offsetB;
556 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
558 real *shiftvec,*fshift,*x,*f;
559 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
561 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
563 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
565 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
567 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
568 int vdwjidx0A,vdwjidx0B;
569 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
570 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
571 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
572 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
573 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
574 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
577 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
580 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
581 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
583 _fjsp_v2r8 dummy_mask,cutoff_mask;
584 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
585 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
586 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
593 jindex = nlist->jindex;
595 shiftidx = nlist->shift;
597 shiftvec = fr->shift_vec[0];
598 fshift = fr->fshift[0];
599 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
600 charge = mdatoms->chargeA;
601 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
602 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
603 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
604 nvdwtype = fr->ntype;
606 vdwtype = mdatoms->typeA;
608 /* Setup water-specific parameters */
609 inr = nlist->iinr[0];
610 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
611 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
612 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
613 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
615 /* Avoid stupid compiler warnings */
623 /* Start outer loop over neighborlists */
624 for(iidx=0; iidx<nri; iidx++)
626 /* Load shift vector for this list */
627 i_shift_offset = DIM*shiftidx[iidx];
629 /* Load limits for loop over neighbors */
630 j_index_start = jindex[iidx];
631 j_index_end = jindex[iidx+1];
633 /* Get outer coordinate index */
635 i_coord_offset = DIM*inr;
637 /* Load i particle coords and add shift vector */
638 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
639 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
641 fix0 = _fjsp_setzero_v2r8();
642 fiy0 = _fjsp_setzero_v2r8();
643 fiz0 = _fjsp_setzero_v2r8();
644 fix1 = _fjsp_setzero_v2r8();
645 fiy1 = _fjsp_setzero_v2r8();
646 fiz1 = _fjsp_setzero_v2r8();
647 fix2 = _fjsp_setzero_v2r8();
648 fiy2 = _fjsp_setzero_v2r8();
649 fiz2 = _fjsp_setzero_v2r8();
650 fix3 = _fjsp_setzero_v2r8();
651 fiy3 = _fjsp_setzero_v2r8();
652 fiz3 = _fjsp_setzero_v2r8();
654 /* Start inner kernel loop */
655 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
658 /* Get j neighbor index, and coordinate index */
661 j_coord_offsetA = DIM*jnrA;
662 j_coord_offsetB = DIM*jnrB;
664 /* load j atom coordinates */
665 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
668 /* Calculate displacement vector */
669 dx00 = _fjsp_sub_v2r8(ix0,jx0);
670 dy00 = _fjsp_sub_v2r8(iy0,jy0);
671 dz00 = _fjsp_sub_v2r8(iz0,jz0);
672 dx10 = _fjsp_sub_v2r8(ix1,jx0);
673 dy10 = _fjsp_sub_v2r8(iy1,jy0);
674 dz10 = _fjsp_sub_v2r8(iz1,jz0);
675 dx20 = _fjsp_sub_v2r8(ix2,jx0);
676 dy20 = _fjsp_sub_v2r8(iy2,jy0);
677 dz20 = _fjsp_sub_v2r8(iz2,jz0);
678 dx30 = _fjsp_sub_v2r8(ix3,jx0);
679 dy30 = _fjsp_sub_v2r8(iy3,jy0);
680 dz30 = _fjsp_sub_v2r8(iz3,jz0);
682 /* Calculate squared distance and things based on it */
683 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
684 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
685 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
686 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
688 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
689 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
690 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
692 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
693 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
694 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
695 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
697 /* Load parameters for j particles */
698 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
699 vdwjidx0A = 2*vdwtype[jnrA+0];
700 vdwjidx0B = 2*vdwtype[jnrB+0];
702 fjx0 = _fjsp_setzero_v2r8();
703 fjy0 = _fjsp_setzero_v2r8();
704 fjz0 = _fjsp_setzero_v2r8();
706 /**************************
707 * CALCULATE INTERACTIONS *
708 **************************/
710 /* Compute parameters for interactions between i and j atoms */
711 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
712 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
714 /* LENNARD-JONES DISPERSION/REPULSION */
716 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
717 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
721 /* Update vectorial force */
722 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
723 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
724 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
726 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
727 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
728 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
730 /**************************
731 * CALCULATE INTERACTIONS *
732 **************************/
734 /* Compute parameters for interactions between i and j atoms */
735 qq10 = _fjsp_mul_v2r8(iq1,jq0);
737 /* REACTION-FIELD ELECTROSTATICS */
738 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
742 /* Update vectorial force */
743 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
744 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
745 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
747 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
748 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
749 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
751 /**************************
752 * CALCULATE INTERACTIONS *
753 **************************/
755 /* Compute parameters for interactions between i and j atoms */
756 qq20 = _fjsp_mul_v2r8(iq2,jq0);
758 /* REACTION-FIELD ELECTROSTATICS */
759 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
763 /* Update vectorial force */
764 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
765 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
766 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
768 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
769 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
770 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
772 /**************************
773 * CALCULATE INTERACTIONS *
774 **************************/
776 /* Compute parameters for interactions between i and j atoms */
777 qq30 = _fjsp_mul_v2r8(iq3,jq0);
779 /* REACTION-FIELD ELECTROSTATICS */
780 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
784 /* Update vectorial force */
785 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
786 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
787 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
789 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
790 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
791 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
793 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
795 /* Inner loop uses 123 flops */
802 j_coord_offsetA = DIM*jnrA;
804 /* load j atom coordinates */
805 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
808 /* Calculate displacement vector */
809 dx00 = _fjsp_sub_v2r8(ix0,jx0);
810 dy00 = _fjsp_sub_v2r8(iy0,jy0);
811 dz00 = _fjsp_sub_v2r8(iz0,jz0);
812 dx10 = _fjsp_sub_v2r8(ix1,jx0);
813 dy10 = _fjsp_sub_v2r8(iy1,jy0);
814 dz10 = _fjsp_sub_v2r8(iz1,jz0);
815 dx20 = _fjsp_sub_v2r8(ix2,jx0);
816 dy20 = _fjsp_sub_v2r8(iy2,jy0);
817 dz20 = _fjsp_sub_v2r8(iz2,jz0);
818 dx30 = _fjsp_sub_v2r8(ix3,jx0);
819 dy30 = _fjsp_sub_v2r8(iy3,jy0);
820 dz30 = _fjsp_sub_v2r8(iz3,jz0);
822 /* Calculate squared distance and things based on it */
823 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
824 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
825 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
826 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
828 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
829 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
830 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
832 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
833 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
834 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
835 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
837 /* Load parameters for j particles */
838 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
839 vdwjidx0A = 2*vdwtype[jnrA+0];
841 fjx0 = _fjsp_setzero_v2r8();
842 fjy0 = _fjsp_setzero_v2r8();
843 fjz0 = _fjsp_setzero_v2r8();
845 /**************************
846 * CALCULATE INTERACTIONS *
847 **************************/
849 /* Compute parameters for interactions between i and j atoms */
850 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
852 /* LENNARD-JONES DISPERSION/REPULSION */
854 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
855 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
859 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
861 /* Update vectorial force */
862 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
863 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
864 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
866 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
867 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
868 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
870 /**************************
871 * CALCULATE INTERACTIONS *
872 **************************/
874 /* Compute parameters for interactions between i and j atoms */
875 qq10 = _fjsp_mul_v2r8(iq1,jq0);
877 /* REACTION-FIELD ELECTROSTATICS */
878 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
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 /* REACTION-FIELD ELECTROSTATICS */
901 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
905 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
907 /* Update vectorial force */
908 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
909 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
910 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
912 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
913 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
914 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
916 /**************************
917 * CALCULATE INTERACTIONS *
918 **************************/
920 /* Compute parameters for interactions between i and j atoms */
921 qq30 = _fjsp_mul_v2r8(iq3,jq0);
923 /* REACTION-FIELD ELECTROSTATICS */
924 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
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);