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.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRF_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 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
123 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
124 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
125 nvdwtype = fr->ntype;
127 vdwtype = mdatoms->typeA;
129 /* Setup water-specific parameters */
130 inr = nlist->iinr[0];
131 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
132 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
133 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
134 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
136 /* Avoid stupid compiler warnings */
144 /* Start outer loop over neighborlists */
145 for(iidx=0; iidx<nri; iidx++)
147 /* Load shift vector for this list */
148 i_shift_offset = DIM*shiftidx[iidx];
150 /* Load limits for loop over neighbors */
151 j_index_start = jindex[iidx];
152 j_index_end = jindex[iidx+1];
154 /* Get outer coordinate index */
156 i_coord_offset = DIM*inr;
158 /* Load i particle coords and add shift vector */
159 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
160 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
162 fix0 = _fjsp_setzero_v2r8();
163 fiy0 = _fjsp_setzero_v2r8();
164 fiz0 = _fjsp_setzero_v2r8();
165 fix1 = _fjsp_setzero_v2r8();
166 fiy1 = _fjsp_setzero_v2r8();
167 fiz1 = _fjsp_setzero_v2r8();
168 fix2 = _fjsp_setzero_v2r8();
169 fiy2 = _fjsp_setzero_v2r8();
170 fiz2 = _fjsp_setzero_v2r8();
171 fix3 = _fjsp_setzero_v2r8();
172 fiy3 = _fjsp_setzero_v2r8();
173 fiz3 = _fjsp_setzero_v2r8();
175 /* Reset potential sums */
176 velecsum = _fjsp_setzero_v2r8();
177 vvdwsum = _fjsp_setzero_v2r8();
179 /* Start inner kernel loop */
180 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
183 /* Get j neighbor index, and coordinate index */
186 j_coord_offsetA = DIM*jnrA;
187 j_coord_offsetB = DIM*jnrB;
189 /* load j atom coordinates */
190 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
193 /* Calculate displacement vector */
194 dx00 = _fjsp_sub_v2r8(ix0,jx0);
195 dy00 = _fjsp_sub_v2r8(iy0,jy0);
196 dz00 = _fjsp_sub_v2r8(iz0,jz0);
197 dx10 = _fjsp_sub_v2r8(ix1,jx0);
198 dy10 = _fjsp_sub_v2r8(iy1,jy0);
199 dz10 = _fjsp_sub_v2r8(iz1,jz0);
200 dx20 = _fjsp_sub_v2r8(ix2,jx0);
201 dy20 = _fjsp_sub_v2r8(iy2,jy0);
202 dz20 = _fjsp_sub_v2r8(iz2,jz0);
203 dx30 = _fjsp_sub_v2r8(ix3,jx0);
204 dy30 = _fjsp_sub_v2r8(iy3,jy0);
205 dz30 = _fjsp_sub_v2r8(iz3,jz0);
207 /* Calculate squared distance and things based on it */
208 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
209 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
210 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
211 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
213 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
214 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
215 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
217 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
218 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
219 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
220 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
222 /* Load parameters for j particles */
223 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
224 vdwjidx0A = 2*vdwtype[jnrA+0];
225 vdwjidx0B = 2*vdwtype[jnrB+0];
227 fjx0 = _fjsp_setzero_v2r8();
228 fjy0 = _fjsp_setzero_v2r8();
229 fjz0 = _fjsp_setzero_v2r8();
231 /**************************
232 * CALCULATE INTERACTIONS *
233 **************************/
235 /* Compute parameters for interactions between i and j atoms */
236 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
237 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
239 /* LENNARD-JONES DISPERSION/REPULSION */
241 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
242 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
243 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
244 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
245 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
247 /* Update potential sum for this i atom from the interaction with this j atom. */
248 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
252 /* Update vectorial force */
253 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
254 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
255 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
257 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
258 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
259 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
261 /**************************
262 * CALCULATE INTERACTIONS *
263 **************************/
265 /* Compute parameters for interactions between i and j atoms */
266 qq10 = _fjsp_mul_v2r8(iq1,jq0);
268 /* REACTION-FIELD ELECTROSTATICS */
269 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
270 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
272 /* Update potential sum for this i atom from the interaction with this j atom. */
273 velecsum = _fjsp_add_v2r8(velecsum,velec);
277 /* Update vectorial force */
278 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
279 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
280 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
282 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
283 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
284 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
286 /**************************
287 * CALCULATE INTERACTIONS *
288 **************************/
290 /* Compute parameters for interactions between i and j atoms */
291 qq20 = _fjsp_mul_v2r8(iq2,jq0);
293 /* REACTION-FIELD ELECTROSTATICS */
294 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
295 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
297 /* Update potential sum for this i atom from the interaction with this j atom. */
298 velecsum = _fjsp_add_v2r8(velecsum,velec);
302 /* Update vectorial force */
303 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
304 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
305 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
307 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
308 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
309 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
311 /**************************
312 * CALCULATE INTERACTIONS *
313 **************************/
315 /* Compute parameters for interactions between i and j atoms */
316 qq30 = _fjsp_mul_v2r8(iq3,jq0);
318 /* REACTION-FIELD ELECTROSTATICS */
319 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
320 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
322 /* Update potential sum for this i atom from the interaction with this j atom. */
323 velecsum = _fjsp_add_v2r8(velecsum,velec);
327 /* Update vectorial force */
328 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
329 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
330 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
332 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
333 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
334 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
336 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
338 /* Inner loop uses 143 flops */
345 j_coord_offsetA = DIM*jnrA;
347 /* load j atom coordinates */
348 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
351 /* Calculate displacement vector */
352 dx00 = _fjsp_sub_v2r8(ix0,jx0);
353 dy00 = _fjsp_sub_v2r8(iy0,jy0);
354 dz00 = _fjsp_sub_v2r8(iz0,jz0);
355 dx10 = _fjsp_sub_v2r8(ix1,jx0);
356 dy10 = _fjsp_sub_v2r8(iy1,jy0);
357 dz10 = _fjsp_sub_v2r8(iz1,jz0);
358 dx20 = _fjsp_sub_v2r8(ix2,jx0);
359 dy20 = _fjsp_sub_v2r8(iy2,jy0);
360 dz20 = _fjsp_sub_v2r8(iz2,jz0);
361 dx30 = _fjsp_sub_v2r8(ix3,jx0);
362 dy30 = _fjsp_sub_v2r8(iy3,jy0);
363 dz30 = _fjsp_sub_v2r8(iz3,jz0);
365 /* Calculate squared distance and things based on it */
366 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
367 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
368 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
369 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
371 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
372 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
373 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
375 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
376 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
377 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
378 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
380 /* Load parameters for j particles */
381 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
382 vdwjidx0A = 2*vdwtype[jnrA+0];
384 fjx0 = _fjsp_setzero_v2r8();
385 fjy0 = _fjsp_setzero_v2r8();
386 fjz0 = _fjsp_setzero_v2r8();
388 /**************************
389 * CALCULATE INTERACTIONS *
390 **************************/
392 /* Compute parameters for interactions between i and j atoms */
393 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
395 /* LENNARD-JONES DISPERSION/REPULSION */
397 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
398 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
399 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
400 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
401 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
403 /* Update potential sum for this i atom from the interaction with this j atom. */
404 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
405 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
409 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
411 /* Update vectorial force */
412 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
413 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
414 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
416 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
417 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
418 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* Compute parameters for interactions between i and j atoms */
425 qq10 = _fjsp_mul_v2r8(iq1,jq0);
427 /* REACTION-FIELD ELECTROSTATICS */
428 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
429 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
431 /* Update potential sum for this i atom from the interaction with this j atom. */
432 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
433 velecsum = _fjsp_add_v2r8(velecsum,velec);
437 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
439 /* Update vectorial force */
440 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
441 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
442 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
444 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
445 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
446 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
448 /**************************
449 * CALCULATE INTERACTIONS *
450 **************************/
452 /* Compute parameters for interactions between i and j atoms */
453 qq20 = _fjsp_mul_v2r8(iq2,jq0);
455 /* REACTION-FIELD ELECTROSTATICS */
456 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
457 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
459 /* Update potential sum for this i atom from the interaction with this j atom. */
460 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
461 velecsum = _fjsp_add_v2r8(velecsum,velec);
465 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
467 /* Update vectorial force */
468 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
469 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
470 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
472 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
473 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
474 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
476 /**************************
477 * CALCULATE INTERACTIONS *
478 **************************/
480 /* Compute parameters for interactions between i and j atoms */
481 qq30 = _fjsp_mul_v2r8(iq3,jq0);
483 /* REACTION-FIELD ELECTROSTATICS */
484 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
485 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
487 /* Update potential sum for this i atom from the interaction with this j atom. */
488 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
489 velecsum = _fjsp_add_v2r8(velecsum,velec);
493 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
495 /* Update vectorial force */
496 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
497 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
498 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
500 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
501 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
502 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
504 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
506 /* Inner loop uses 143 flops */
509 /* End of innermost loop */
511 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
512 f+i_coord_offset,fshift+i_shift_offset);
515 /* Update potential energies */
516 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
517 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
519 /* Increment number of inner iterations */
520 inneriter += j_index_end - j_index_start;
522 /* Outer loop uses 26 flops */
525 /* Increment number of outer iterations */
528 /* Update outer/inner flops */
530 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*143);
533 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
534 * Electrostatics interaction: ReactionField
535 * VdW interaction: LennardJones
536 * Geometry: Water4-Particle
537 * Calculate force/pot: Force
540 nb_kernel_ElecRF_VdwLJ_GeomW4P1_F_sparc64_hpc_ace_double
541 (t_nblist * gmx_restrict nlist,
542 rvec * gmx_restrict xx,
543 rvec * gmx_restrict ff,
544 t_forcerec * gmx_restrict fr,
545 t_mdatoms * gmx_restrict mdatoms,
546 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
547 t_nrnb * gmx_restrict nrnb)
549 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
550 * just 0 for non-waters.
551 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
552 * jnr indices corresponding to data put in the four positions in the SIMD register.
554 int i_shift_offset,i_coord_offset,outeriter,inneriter;
555 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
557 int j_coord_offsetA,j_coord_offsetB;
558 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
560 real *shiftvec,*fshift,*x,*f;
561 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
563 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
565 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
567 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
569 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
570 int vdwjidx0A,vdwjidx0B;
571 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
572 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
573 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
574 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
575 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
576 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
579 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
582 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
583 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
585 _fjsp_v2r8 dummy_mask,cutoff_mask;
586 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
587 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
588 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
595 jindex = nlist->jindex;
597 shiftidx = nlist->shift;
599 shiftvec = fr->shift_vec[0];
600 fshift = fr->fshift[0];
601 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
602 charge = mdatoms->chargeA;
603 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
604 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
605 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
606 nvdwtype = fr->ntype;
608 vdwtype = mdatoms->typeA;
610 /* Setup water-specific parameters */
611 inr = nlist->iinr[0];
612 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
613 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
614 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
615 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
617 /* Avoid stupid compiler warnings */
625 /* Start outer loop over neighborlists */
626 for(iidx=0; iidx<nri; iidx++)
628 /* Load shift vector for this list */
629 i_shift_offset = DIM*shiftidx[iidx];
631 /* Load limits for loop over neighbors */
632 j_index_start = jindex[iidx];
633 j_index_end = jindex[iidx+1];
635 /* Get outer coordinate index */
637 i_coord_offset = DIM*inr;
639 /* Load i particle coords and add shift vector */
640 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
641 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
643 fix0 = _fjsp_setzero_v2r8();
644 fiy0 = _fjsp_setzero_v2r8();
645 fiz0 = _fjsp_setzero_v2r8();
646 fix1 = _fjsp_setzero_v2r8();
647 fiy1 = _fjsp_setzero_v2r8();
648 fiz1 = _fjsp_setzero_v2r8();
649 fix2 = _fjsp_setzero_v2r8();
650 fiy2 = _fjsp_setzero_v2r8();
651 fiz2 = _fjsp_setzero_v2r8();
652 fix3 = _fjsp_setzero_v2r8();
653 fiy3 = _fjsp_setzero_v2r8();
654 fiz3 = _fjsp_setzero_v2r8();
656 /* Start inner kernel loop */
657 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
660 /* Get j neighbor index, and coordinate index */
663 j_coord_offsetA = DIM*jnrA;
664 j_coord_offsetB = DIM*jnrB;
666 /* load j atom coordinates */
667 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
670 /* Calculate displacement vector */
671 dx00 = _fjsp_sub_v2r8(ix0,jx0);
672 dy00 = _fjsp_sub_v2r8(iy0,jy0);
673 dz00 = _fjsp_sub_v2r8(iz0,jz0);
674 dx10 = _fjsp_sub_v2r8(ix1,jx0);
675 dy10 = _fjsp_sub_v2r8(iy1,jy0);
676 dz10 = _fjsp_sub_v2r8(iz1,jz0);
677 dx20 = _fjsp_sub_v2r8(ix2,jx0);
678 dy20 = _fjsp_sub_v2r8(iy2,jy0);
679 dz20 = _fjsp_sub_v2r8(iz2,jz0);
680 dx30 = _fjsp_sub_v2r8(ix3,jx0);
681 dy30 = _fjsp_sub_v2r8(iy3,jy0);
682 dz30 = _fjsp_sub_v2r8(iz3,jz0);
684 /* Calculate squared distance and things based on it */
685 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
686 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
687 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
688 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
690 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
691 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
692 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
694 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
695 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
696 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
697 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
699 /* Load parameters for j particles */
700 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
701 vdwjidx0A = 2*vdwtype[jnrA+0];
702 vdwjidx0B = 2*vdwtype[jnrB+0];
704 fjx0 = _fjsp_setzero_v2r8();
705 fjy0 = _fjsp_setzero_v2r8();
706 fjz0 = _fjsp_setzero_v2r8();
708 /**************************
709 * CALCULATE INTERACTIONS *
710 **************************/
712 /* Compute parameters for interactions between i and j atoms */
713 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
714 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
716 /* LENNARD-JONES DISPERSION/REPULSION */
718 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
719 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
723 /* Update vectorial force */
724 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
725 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
726 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
728 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
729 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
730 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
732 /**************************
733 * CALCULATE INTERACTIONS *
734 **************************/
736 /* Compute parameters for interactions between i and j atoms */
737 qq10 = _fjsp_mul_v2r8(iq1,jq0);
739 /* REACTION-FIELD ELECTROSTATICS */
740 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
744 /* Update vectorial force */
745 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
746 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
747 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
749 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
750 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
751 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
753 /**************************
754 * CALCULATE INTERACTIONS *
755 **************************/
757 /* Compute parameters for interactions between i and j atoms */
758 qq20 = _fjsp_mul_v2r8(iq2,jq0);
760 /* REACTION-FIELD ELECTROSTATICS */
761 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
765 /* Update vectorial force */
766 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
767 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
768 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
770 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
771 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
772 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
774 /**************************
775 * CALCULATE INTERACTIONS *
776 **************************/
778 /* Compute parameters for interactions between i and j atoms */
779 qq30 = _fjsp_mul_v2r8(iq3,jq0);
781 /* REACTION-FIELD ELECTROSTATICS */
782 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
786 /* Update vectorial force */
787 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
788 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
789 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
791 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
792 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
793 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
795 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
797 /* Inner loop uses 123 flops */
804 j_coord_offsetA = DIM*jnrA;
806 /* load j atom coordinates */
807 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
810 /* Calculate displacement vector */
811 dx00 = _fjsp_sub_v2r8(ix0,jx0);
812 dy00 = _fjsp_sub_v2r8(iy0,jy0);
813 dz00 = _fjsp_sub_v2r8(iz0,jz0);
814 dx10 = _fjsp_sub_v2r8(ix1,jx0);
815 dy10 = _fjsp_sub_v2r8(iy1,jy0);
816 dz10 = _fjsp_sub_v2r8(iz1,jz0);
817 dx20 = _fjsp_sub_v2r8(ix2,jx0);
818 dy20 = _fjsp_sub_v2r8(iy2,jy0);
819 dz20 = _fjsp_sub_v2r8(iz2,jz0);
820 dx30 = _fjsp_sub_v2r8(ix3,jx0);
821 dy30 = _fjsp_sub_v2r8(iy3,jy0);
822 dz30 = _fjsp_sub_v2r8(iz3,jz0);
824 /* Calculate squared distance and things based on it */
825 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
826 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
827 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
828 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
830 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
831 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
832 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
834 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
835 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
836 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
837 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
839 /* Load parameters for j particles */
840 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
841 vdwjidx0A = 2*vdwtype[jnrA+0];
843 fjx0 = _fjsp_setzero_v2r8();
844 fjy0 = _fjsp_setzero_v2r8();
845 fjz0 = _fjsp_setzero_v2r8();
847 /**************************
848 * CALCULATE INTERACTIONS *
849 **************************/
851 /* Compute parameters for interactions between i and j atoms */
852 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
854 /* LENNARD-JONES DISPERSION/REPULSION */
856 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
857 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
861 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
863 /* Update vectorial force */
864 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
865 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
866 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
868 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
869 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
870 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
872 /**************************
873 * CALCULATE INTERACTIONS *
874 **************************/
876 /* Compute parameters for interactions between i and j atoms */
877 qq10 = _fjsp_mul_v2r8(iq1,jq0);
879 /* REACTION-FIELD ELECTROSTATICS */
880 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
884 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
886 /* Update vectorial force */
887 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
888 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
889 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
891 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
892 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
893 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
895 /**************************
896 * CALCULATE INTERACTIONS *
897 **************************/
899 /* Compute parameters for interactions between i and j atoms */
900 qq20 = _fjsp_mul_v2r8(iq2,jq0);
902 /* REACTION-FIELD ELECTROSTATICS */
903 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
907 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
909 /* Update vectorial force */
910 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
911 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
912 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
914 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
915 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
916 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
918 /**************************
919 * CALCULATE INTERACTIONS *
920 **************************/
922 /* Compute parameters for interactions between i and j atoms */
923 qq30 = _fjsp_mul_v2r8(iq3,jq0);
925 /* REACTION-FIELD ELECTROSTATICS */
926 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
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);