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 "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: None
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwNone_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
82 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
84 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
88 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
89 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 dummy_mask,cutoff_mask;
94 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
95 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
96 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
103 jindex = nlist->jindex;
105 shiftidx = nlist->shift;
107 shiftvec = fr->shift_vec[0];
108 fshift = fr->fshift[0];
109 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
110 charge = mdatoms->chargeA;
111 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
112 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
113 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
115 /* Setup water-specific parameters */
116 inr = nlist->iinr[0];
117 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
118 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
119 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
121 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
122 rcutoff_scalar = fr->rcoulomb;
123 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
124 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
126 /* Avoid stupid compiler warnings */
134 /* Start outer loop over neighborlists */
135 for(iidx=0; iidx<nri; iidx++)
137 /* Load shift vector for this list */
138 i_shift_offset = DIM*shiftidx[iidx];
140 /* Load limits for loop over neighbors */
141 j_index_start = jindex[iidx];
142 j_index_end = jindex[iidx+1];
144 /* Get outer coordinate index */
146 i_coord_offset = DIM*inr;
148 /* Load i particle coords and add shift vector */
149 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
150 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
152 fix1 = _fjsp_setzero_v2r8();
153 fiy1 = _fjsp_setzero_v2r8();
154 fiz1 = _fjsp_setzero_v2r8();
155 fix2 = _fjsp_setzero_v2r8();
156 fiy2 = _fjsp_setzero_v2r8();
157 fiz2 = _fjsp_setzero_v2r8();
158 fix3 = _fjsp_setzero_v2r8();
159 fiy3 = _fjsp_setzero_v2r8();
160 fiz3 = _fjsp_setzero_v2r8();
162 /* Reset potential sums */
163 velecsum = _fjsp_setzero_v2r8();
165 /* Start inner kernel loop */
166 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
169 /* Get j neighbor index, and coordinate index */
172 j_coord_offsetA = DIM*jnrA;
173 j_coord_offsetB = DIM*jnrB;
175 /* load j atom coordinates */
176 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
179 /* Calculate displacement vector */
180 dx10 = _fjsp_sub_v2r8(ix1,jx0);
181 dy10 = _fjsp_sub_v2r8(iy1,jy0);
182 dz10 = _fjsp_sub_v2r8(iz1,jz0);
183 dx20 = _fjsp_sub_v2r8(ix2,jx0);
184 dy20 = _fjsp_sub_v2r8(iy2,jy0);
185 dz20 = _fjsp_sub_v2r8(iz2,jz0);
186 dx30 = _fjsp_sub_v2r8(ix3,jx0);
187 dy30 = _fjsp_sub_v2r8(iy3,jy0);
188 dz30 = _fjsp_sub_v2r8(iz3,jz0);
190 /* Calculate squared distance and things based on it */
191 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
192 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
193 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
195 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
196 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
197 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
199 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
200 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
201 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
203 /* Load parameters for j particles */
204 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
206 fjx0 = _fjsp_setzero_v2r8();
207 fjy0 = _fjsp_setzero_v2r8();
208 fjz0 = _fjsp_setzero_v2r8();
210 /**************************
211 * CALCULATE INTERACTIONS *
212 **************************/
214 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
217 /* Compute parameters for interactions between i and j atoms */
218 qq10 = _fjsp_mul_v2r8(iq1,jq0);
220 /* REACTION-FIELD ELECTROSTATICS */
221 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
222 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
224 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
226 /* Update potential sum for this i atom from the interaction with this j atom. */
227 velec = _fjsp_and_v2r8(velec,cutoff_mask);
228 velecsum = _fjsp_add_v2r8(velecsum,velec);
232 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
234 /* Update vectorial force */
235 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
236 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
237 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
239 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
240 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
241 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
245 /**************************
246 * CALCULATE INTERACTIONS *
247 **************************/
249 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
252 /* Compute parameters for interactions between i and j atoms */
253 qq20 = _fjsp_mul_v2r8(iq2,jq0);
255 /* REACTION-FIELD ELECTROSTATICS */
256 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
257 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
259 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
261 /* Update potential sum for this i atom from the interaction with this j atom. */
262 velec = _fjsp_and_v2r8(velec,cutoff_mask);
263 velecsum = _fjsp_add_v2r8(velecsum,velec);
267 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
269 /* Update vectorial force */
270 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
271 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
272 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
274 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
275 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
276 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
280 /**************************
281 * CALCULATE INTERACTIONS *
282 **************************/
284 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
287 /* Compute parameters for interactions between i and j atoms */
288 qq30 = _fjsp_mul_v2r8(iq3,jq0);
290 /* REACTION-FIELD ELECTROSTATICS */
291 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
292 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
294 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
296 /* Update potential sum for this i atom from the interaction with this j atom. */
297 velec = _fjsp_and_v2r8(velec,cutoff_mask);
298 velecsum = _fjsp_add_v2r8(velecsum,velec);
302 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
304 /* Update vectorial force */
305 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
306 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
307 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
309 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
310 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
311 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
315 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
317 /* Inner loop uses 120 flops */
324 j_coord_offsetA = DIM*jnrA;
326 /* load j atom coordinates */
327 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
330 /* Calculate displacement vector */
331 dx10 = _fjsp_sub_v2r8(ix1,jx0);
332 dy10 = _fjsp_sub_v2r8(iy1,jy0);
333 dz10 = _fjsp_sub_v2r8(iz1,jz0);
334 dx20 = _fjsp_sub_v2r8(ix2,jx0);
335 dy20 = _fjsp_sub_v2r8(iy2,jy0);
336 dz20 = _fjsp_sub_v2r8(iz2,jz0);
337 dx30 = _fjsp_sub_v2r8(ix3,jx0);
338 dy30 = _fjsp_sub_v2r8(iy3,jy0);
339 dz30 = _fjsp_sub_v2r8(iz3,jz0);
341 /* Calculate squared distance and things based on it */
342 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
343 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
344 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
346 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
347 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
348 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
350 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
351 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
352 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
354 /* Load parameters for j particles */
355 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
357 fjx0 = _fjsp_setzero_v2r8();
358 fjy0 = _fjsp_setzero_v2r8();
359 fjz0 = _fjsp_setzero_v2r8();
361 /**************************
362 * CALCULATE INTERACTIONS *
363 **************************/
365 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
368 /* Compute parameters for interactions between i and j atoms */
369 qq10 = _fjsp_mul_v2r8(iq1,jq0);
371 /* REACTION-FIELD ELECTROSTATICS */
372 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
373 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
375 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
377 /* Update potential sum for this i atom from the interaction with this j atom. */
378 velec = _fjsp_and_v2r8(velec,cutoff_mask);
379 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
380 velecsum = _fjsp_add_v2r8(velecsum,velec);
384 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
386 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
388 /* Update vectorial force */
389 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
390 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
391 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
393 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
394 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
395 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
399 /**************************
400 * CALCULATE INTERACTIONS *
401 **************************/
403 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
406 /* Compute parameters for interactions between i and j atoms */
407 qq20 = _fjsp_mul_v2r8(iq2,jq0);
409 /* REACTION-FIELD ELECTROSTATICS */
410 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
411 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
413 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
415 /* Update potential sum for this i atom from the interaction with this j atom. */
416 velec = _fjsp_and_v2r8(velec,cutoff_mask);
417 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
418 velecsum = _fjsp_add_v2r8(velecsum,velec);
422 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
424 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
426 /* Update vectorial force */
427 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
428 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
429 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
431 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
432 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
433 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
437 /**************************
438 * CALCULATE INTERACTIONS *
439 **************************/
441 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
444 /* Compute parameters for interactions between i and j atoms */
445 qq30 = _fjsp_mul_v2r8(iq3,jq0);
447 /* REACTION-FIELD ELECTROSTATICS */
448 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
449 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
451 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
453 /* Update potential sum for this i atom from the interaction with this j atom. */
454 velec = _fjsp_and_v2r8(velec,cutoff_mask);
455 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
456 velecsum = _fjsp_add_v2r8(velecsum,velec);
460 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
462 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
464 /* Update vectorial force */
465 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
466 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
467 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
469 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
470 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
471 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
475 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
477 /* Inner loop uses 120 flops */
480 /* End of innermost loop */
482 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
483 f+i_coord_offset+DIM,fshift+i_shift_offset);
486 /* Update potential energies */
487 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
489 /* Increment number of inner iterations */
490 inneriter += j_index_end - j_index_start;
492 /* Outer loop uses 19 flops */
495 /* Increment number of outer iterations */
498 /* Update outer/inner flops */
500 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_VF,outeriter*19 + inneriter*120);
503 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4P1_F_sparc64_hpc_ace_double
504 * Electrostatics interaction: ReactionField
505 * VdW interaction: None
506 * Geometry: Water4-Particle
507 * Calculate force/pot: Force
510 nb_kernel_ElecRFCut_VdwNone_GeomW4P1_F_sparc64_hpc_ace_double
511 (t_nblist * gmx_restrict nlist,
512 rvec * gmx_restrict xx,
513 rvec * gmx_restrict ff,
514 t_forcerec * gmx_restrict fr,
515 t_mdatoms * gmx_restrict mdatoms,
516 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
517 t_nrnb * gmx_restrict nrnb)
519 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
520 * just 0 for non-waters.
521 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
522 * jnr indices corresponding to data put in the four positions in the SIMD register.
524 int i_shift_offset,i_coord_offset,outeriter,inneriter;
525 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
527 int j_coord_offsetA,j_coord_offsetB;
528 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
530 real *shiftvec,*fshift,*x,*f;
531 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
533 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
535 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
537 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
538 int vdwjidx0A,vdwjidx0B;
539 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
540 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
541 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
542 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
543 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
546 _fjsp_v2r8 dummy_mask,cutoff_mask;
547 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
548 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
549 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
556 jindex = nlist->jindex;
558 shiftidx = nlist->shift;
560 shiftvec = fr->shift_vec[0];
561 fshift = fr->fshift[0];
562 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
563 charge = mdatoms->chargeA;
564 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
565 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
566 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
568 /* Setup water-specific parameters */
569 inr = nlist->iinr[0];
570 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
571 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
572 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
574 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
575 rcutoff_scalar = fr->rcoulomb;
576 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
577 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
579 /* Avoid stupid compiler warnings */
587 /* Start outer loop over neighborlists */
588 for(iidx=0; iidx<nri; iidx++)
590 /* Load shift vector for this list */
591 i_shift_offset = DIM*shiftidx[iidx];
593 /* Load limits for loop over neighbors */
594 j_index_start = jindex[iidx];
595 j_index_end = jindex[iidx+1];
597 /* Get outer coordinate index */
599 i_coord_offset = DIM*inr;
601 /* Load i particle coords and add shift vector */
602 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
603 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
605 fix1 = _fjsp_setzero_v2r8();
606 fiy1 = _fjsp_setzero_v2r8();
607 fiz1 = _fjsp_setzero_v2r8();
608 fix2 = _fjsp_setzero_v2r8();
609 fiy2 = _fjsp_setzero_v2r8();
610 fiz2 = _fjsp_setzero_v2r8();
611 fix3 = _fjsp_setzero_v2r8();
612 fiy3 = _fjsp_setzero_v2r8();
613 fiz3 = _fjsp_setzero_v2r8();
615 /* Start inner kernel loop */
616 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
619 /* Get j neighbor index, and coordinate index */
622 j_coord_offsetA = DIM*jnrA;
623 j_coord_offsetB = DIM*jnrB;
625 /* load j atom coordinates */
626 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
629 /* Calculate displacement vector */
630 dx10 = _fjsp_sub_v2r8(ix1,jx0);
631 dy10 = _fjsp_sub_v2r8(iy1,jy0);
632 dz10 = _fjsp_sub_v2r8(iz1,jz0);
633 dx20 = _fjsp_sub_v2r8(ix2,jx0);
634 dy20 = _fjsp_sub_v2r8(iy2,jy0);
635 dz20 = _fjsp_sub_v2r8(iz2,jz0);
636 dx30 = _fjsp_sub_v2r8(ix3,jx0);
637 dy30 = _fjsp_sub_v2r8(iy3,jy0);
638 dz30 = _fjsp_sub_v2r8(iz3,jz0);
640 /* Calculate squared distance and things based on it */
641 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
642 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
643 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
645 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
646 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
647 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
649 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
650 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
651 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
653 /* Load parameters for j particles */
654 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
656 fjx0 = _fjsp_setzero_v2r8();
657 fjy0 = _fjsp_setzero_v2r8();
658 fjz0 = _fjsp_setzero_v2r8();
660 /**************************
661 * CALCULATE INTERACTIONS *
662 **************************/
664 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
667 /* Compute parameters for interactions between i and j atoms */
668 qq10 = _fjsp_mul_v2r8(iq1,jq0);
670 /* REACTION-FIELD ELECTROSTATICS */
671 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
673 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
677 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
679 /* Update vectorial force */
680 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
681 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
682 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
684 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
685 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
686 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
690 /**************************
691 * CALCULATE INTERACTIONS *
692 **************************/
694 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
697 /* Compute parameters for interactions between i and j atoms */
698 qq20 = _fjsp_mul_v2r8(iq2,jq0);
700 /* REACTION-FIELD ELECTROSTATICS */
701 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
703 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
707 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
709 /* Update vectorial force */
710 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
711 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
712 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
714 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
715 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
716 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
720 /**************************
721 * CALCULATE INTERACTIONS *
722 **************************/
724 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
727 /* Compute parameters for interactions between i and j atoms */
728 qq30 = _fjsp_mul_v2r8(iq3,jq0);
730 /* REACTION-FIELD ELECTROSTATICS */
731 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
733 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
737 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
739 /* Update vectorial force */
740 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
741 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
742 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
744 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
745 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
746 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
750 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
752 /* Inner loop uses 102 flops */
759 j_coord_offsetA = DIM*jnrA;
761 /* load j atom coordinates */
762 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
765 /* Calculate displacement vector */
766 dx10 = _fjsp_sub_v2r8(ix1,jx0);
767 dy10 = _fjsp_sub_v2r8(iy1,jy0);
768 dz10 = _fjsp_sub_v2r8(iz1,jz0);
769 dx20 = _fjsp_sub_v2r8(ix2,jx0);
770 dy20 = _fjsp_sub_v2r8(iy2,jy0);
771 dz20 = _fjsp_sub_v2r8(iz2,jz0);
772 dx30 = _fjsp_sub_v2r8(ix3,jx0);
773 dy30 = _fjsp_sub_v2r8(iy3,jy0);
774 dz30 = _fjsp_sub_v2r8(iz3,jz0);
776 /* Calculate squared distance and things based on it */
777 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
778 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
779 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
781 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
782 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
783 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
785 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
786 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
787 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
789 /* Load parameters for j particles */
790 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
792 fjx0 = _fjsp_setzero_v2r8();
793 fjy0 = _fjsp_setzero_v2r8();
794 fjz0 = _fjsp_setzero_v2r8();
796 /**************************
797 * CALCULATE INTERACTIONS *
798 **************************/
800 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
803 /* Compute parameters for interactions between i and j atoms */
804 qq10 = _fjsp_mul_v2r8(iq1,jq0);
806 /* REACTION-FIELD ELECTROSTATICS */
807 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
809 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
813 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
815 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
817 /* Update vectorial force */
818 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
819 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
820 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
822 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
823 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
824 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
828 /**************************
829 * CALCULATE INTERACTIONS *
830 **************************/
832 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
835 /* Compute parameters for interactions between i and j atoms */
836 qq20 = _fjsp_mul_v2r8(iq2,jq0);
838 /* REACTION-FIELD ELECTROSTATICS */
839 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
841 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
845 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
847 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
849 /* Update vectorial force */
850 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
851 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
852 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
854 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
855 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
856 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
860 /**************************
861 * CALCULATE INTERACTIONS *
862 **************************/
864 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
867 /* Compute parameters for interactions between i and j atoms */
868 qq30 = _fjsp_mul_v2r8(iq3,jq0);
870 /* REACTION-FIELD ELECTROSTATICS */
871 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
873 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
877 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
879 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
881 /* Update vectorial force */
882 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
883 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
884 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
886 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
887 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
888 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
892 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
894 /* Inner loop uses 102 flops */
897 /* End of innermost loop */
899 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
900 f+i_coord_offset+DIM,fshift+i_shift_offset);
902 /* Increment number of inner iterations */
903 inneriter += j_index_end - j_index_start;
905 /* Outer loop uses 18 flops */
908 /* Increment number of outer iterations */
911 /* Update outer/inner flops */
913 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_F,outeriter*18 + inneriter*102);