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 "types/simple.h"
46 #include "gromacs/legacyheaders/vec.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: None
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_VdwNone_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 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 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
90 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
91 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
92 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 dummy_mask,cutoff_mask;
96 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
97 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
98 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
105 jindex = nlist->jindex;
107 shiftidx = nlist->shift;
109 shiftvec = fr->shift_vec[0];
110 fshift = fr->fshift[0];
111 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
112 charge = mdatoms->chargeA;
113 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
114 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
115 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
117 /* Setup water-specific parameters */
118 inr = nlist->iinr[0];
119 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
120 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
121 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
123 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
124 rcutoff_scalar = fr->rcoulomb;
125 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
126 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
128 /* Avoid stupid compiler warnings */
136 /* Start outer loop over neighborlists */
137 for(iidx=0; iidx<nri; iidx++)
139 /* Load shift vector for this list */
140 i_shift_offset = DIM*shiftidx[iidx];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
152 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
154 fix1 = _fjsp_setzero_v2r8();
155 fiy1 = _fjsp_setzero_v2r8();
156 fiz1 = _fjsp_setzero_v2r8();
157 fix2 = _fjsp_setzero_v2r8();
158 fiy2 = _fjsp_setzero_v2r8();
159 fiz2 = _fjsp_setzero_v2r8();
160 fix3 = _fjsp_setzero_v2r8();
161 fiy3 = _fjsp_setzero_v2r8();
162 fiz3 = _fjsp_setzero_v2r8();
164 /* Reset potential sums */
165 velecsum = _fjsp_setzero_v2r8();
167 /* Start inner kernel loop */
168 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
171 /* Get j neighbor index, and coordinate index */
174 j_coord_offsetA = DIM*jnrA;
175 j_coord_offsetB = DIM*jnrB;
177 /* load j atom coordinates */
178 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
181 /* Calculate displacement vector */
182 dx10 = _fjsp_sub_v2r8(ix1,jx0);
183 dy10 = _fjsp_sub_v2r8(iy1,jy0);
184 dz10 = _fjsp_sub_v2r8(iz1,jz0);
185 dx20 = _fjsp_sub_v2r8(ix2,jx0);
186 dy20 = _fjsp_sub_v2r8(iy2,jy0);
187 dz20 = _fjsp_sub_v2r8(iz2,jz0);
188 dx30 = _fjsp_sub_v2r8(ix3,jx0);
189 dy30 = _fjsp_sub_v2r8(iy3,jy0);
190 dz30 = _fjsp_sub_v2r8(iz3,jz0);
192 /* Calculate squared distance and things based on it */
193 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
194 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
195 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
197 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
198 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
199 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
201 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
202 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
203 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
205 /* Load parameters for j particles */
206 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
208 fjx0 = _fjsp_setzero_v2r8();
209 fjy0 = _fjsp_setzero_v2r8();
210 fjz0 = _fjsp_setzero_v2r8();
212 /**************************
213 * CALCULATE INTERACTIONS *
214 **************************/
216 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
219 /* Compute parameters for interactions between i and j atoms */
220 qq10 = _fjsp_mul_v2r8(iq1,jq0);
222 /* REACTION-FIELD ELECTROSTATICS */
223 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
224 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
226 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
228 /* Update potential sum for this i atom from the interaction with this j atom. */
229 velec = _fjsp_and_v2r8(velec,cutoff_mask);
230 velecsum = _fjsp_add_v2r8(velecsum,velec);
234 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
236 /* Update vectorial force */
237 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
238 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
239 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
241 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
242 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
243 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
247 /**************************
248 * CALCULATE INTERACTIONS *
249 **************************/
251 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
254 /* Compute parameters for interactions between i and j atoms */
255 qq20 = _fjsp_mul_v2r8(iq2,jq0);
257 /* REACTION-FIELD ELECTROSTATICS */
258 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
259 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
261 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
263 /* Update potential sum for this i atom from the interaction with this j atom. */
264 velec = _fjsp_and_v2r8(velec,cutoff_mask);
265 velecsum = _fjsp_add_v2r8(velecsum,velec);
269 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
271 /* Update vectorial force */
272 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
273 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
274 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
276 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
277 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
278 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
282 /**************************
283 * CALCULATE INTERACTIONS *
284 **************************/
286 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
289 /* Compute parameters for interactions between i and j atoms */
290 qq30 = _fjsp_mul_v2r8(iq3,jq0);
292 /* REACTION-FIELD ELECTROSTATICS */
293 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
294 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
296 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
298 /* Update potential sum for this i atom from the interaction with this j atom. */
299 velec = _fjsp_and_v2r8(velec,cutoff_mask);
300 velecsum = _fjsp_add_v2r8(velecsum,velec);
304 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
306 /* Update vectorial force */
307 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
308 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
309 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
311 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
312 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
313 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
317 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
319 /* Inner loop uses 120 flops */
326 j_coord_offsetA = DIM*jnrA;
328 /* load j atom coordinates */
329 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
332 /* Calculate displacement vector */
333 dx10 = _fjsp_sub_v2r8(ix1,jx0);
334 dy10 = _fjsp_sub_v2r8(iy1,jy0);
335 dz10 = _fjsp_sub_v2r8(iz1,jz0);
336 dx20 = _fjsp_sub_v2r8(ix2,jx0);
337 dy20 = _fjsp_sub_v2r8(iy2,jy0);
338 dz20 = _fjsp_sub_v2r8(iz2,jz0);
339 dx30 = _fjsp_sub_v2r8(ix3,jx0);
340 dy30 = _fjsp_sub_v2r8(iy3,jy0);
341 dz30 = _fjsp_sub_v2r8(iz3,jz0);
343 /* Calculate squared distance and things based on it */
344 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
345 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
346 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
348 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
349 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
350 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
352 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
353 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
354 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
356 /* Load parameters for j particles */
357 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
359 fjx0 = _fjsp_setzero_v2r8();
360 fjy0 = _fjsp_setzero_v2r8();
361 fjz0 = _fjsp_setzero_v2r8();
363 /**************************
364 * CALCULATE INTERACTIONS *
365 **************************/
367 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
370 /* Compute parameters for interactions between i and j atoms */
371 qq10 = _fjsp_mul_v2r8(iq1,jq0);
373 /* REACTION-FIELD ELECTROSTATICS */
374 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
375 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
377 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
379 /* Update potential sum for this i atom from the interaction with this j atom. */
380 velec = _fjsp_and_v2r8(velec,cutoff_mask);
381 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
382 velecsum = _fjsp_add_v2r8(velecsum,velec);
386 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
388 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
390 /* Update vectorial force */
391 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
392 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
393 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
395 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
396 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
397 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
401 /**************************
402 * CALCULATE INTERACTIONS *
403 **************************/
405 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
408 /* Compute parameters for interactions between i and j atoms */
409 qq20 = _fjsp_mul_v2r8(iq2,jq0);
411 /* REACTION-FIELD ELECTROSTATICS */
412 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
413 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
415 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
417 /* Update potential sum for this i atom from the interaction with this j atom. */
418 velec = _fjsp_and_v2r8(velec,cutoff_mask);
419 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
420 velecsum = _fjsp_add_v2r8(velecsum,velec);
424 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
426 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
428 /* Update vectorial force */
429 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
430 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
431 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
433 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
434 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
435 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
439 /**************************
440 * CALCULATE INTERACTIONS *
441 **************************/
443 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
446 /* Compute parameters for interactions between i and j atoms */
447 qq30 = _fjsp_mul_v2r8(iq3,jq0);
449 /* REACTION-FIELD ELECTROSTATICS */
450 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
451 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
453 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
455 /* Update potential sum for this i atom from the interaction with this j atom. */
456 velec = _fjsp_and_v2r8(velec,cutoff_mask);
457 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
458 velecsum = _fjsp_add_v2r8(velecsum,velec);
462 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
464 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
466 /* Update vectorial force */
467 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
468 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
469 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
471 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
472 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
473 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
477 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
479 /* Inner loop uses 120 flops */
482 /* End of innermost loop */
484 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
485 f+i_coord_offset+DIM,fshift+i_shift_offset);
488 /* Update potential energies */
489 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
491 /* Increment number of inner iterations */
492 inneriter += j_index_end - j_index_start;
494 /* Outer loop uses 19 flops */
497 /* Increment number of outer iterations */
500 /* Update outer/inner flops */
502 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_VF,outeriter*19 + inneriter*120);
505 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4P1_F_sparc64_hpc_ace_double
506 * Electrostatics interaction: ReactionField
507 * VdW interaction: None
508 * Geometry: Water4-Particle
509 * Calculate force/pot: Force
512 nb_kernel_ElecRFCut_VdwNone_GeomW4P1_F_sparc64_hpc_ace_double
513 (t_nblist * gmx_restrict nlist,
514 rvec * gmx_restrict xx,
515 rvec * gmx_restrict ff,
516 t_forcerec * gmx_restrict fr,
517 t_mdatoms * gmx_restrict mdatoms,
518 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
519 t_nrnb * gmx_restrict nrnb)
521 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
522 * just 0 for non-waters.
523 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
524 * jnr indices corresponding to data put in the four positions in the SIMD register.
526 int i_shift_offset,i_coord_offset,outeriter,inneriter;
527 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
529 int j_coord_offsetA,j_coord_offsetB;
530 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
532 real *shiftvec,*fshift,*x,*f;
533 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
535 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
537 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
539 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
540 int vdwjidx0A,vdwjidx0B;
541 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
542 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
543 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
544 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
545 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
548 _fjsp_v2r8 dummy_mask,cutoff_mask;
549 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
550 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
551 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
558 jindex = nlist->jindex;
560 shiftidx = nlist->shift;
562 shiftvec = fr->shift_vec[0];
563 fshift = fr->fshift[0];
564 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
565 charge = mdatoms->chargeA;
566 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
567 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
568 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
570 /* Setup water-specific parameters */
571 inr = nlist->iinr[0];
572 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
573 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
574 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
576 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
577 rcutoff_scalar = fr->rcoulomb;
578 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
579 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
581 /* Avoid stupid compiler warnings */
589 /* Start outer loop over neighborlists */
590 for(iidx=0; iidx<nri; iidx++)
592 /* Load shift vector for this list */
593 i_shift_offset = DIM*shiftidx[iidx];
595 /* Load limits for loop over neighbors */
596 j_index_start = jindex[iidx];
597 j_index_end = jindex[iidx+1];
599 /* Get outer coordinate index */
601 i_coord_offset = DIM*inr;
603 /* Load i particle coords and add shift vector */
604 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
605 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
607 fix1 = _fjsp_setzero_v2r8();
608 fiy1 = _fjsp_setzero_v2r8();
609 fiz1 = _fjsp_setzero_v2r8();
610 fix2 = _fjsp_setzero_v2r8();
611 fiy2 = _fjsp_setzero_v2r8();
612 fiz2 = _fjsp_setzero_v2r8();
613 fix3 = _fjsp_setzero_v2r8();
614 fiy3 = _fjsp_setzero_v2r8();
615 fiz3 = _fjsp_setzero_v2r8();
617 /* Start inner kernel loop */
618 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
621 /* Get j neighbor index, and coordinate index */
624 j_coord_offsetA = DIM*jnrA;
625 j_coord_offsetB = DIM*jnrB;
627 /* load j atom coordinates */
628 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
631 /* Calculate displacement vector */
632 dx10 = _fjsp_sub_v2r8(ix1,jx0);
633 dy10 = _fjsp_sub_v2r8(iy1,jy0);
634 dz10 = _fjsp_sub_v2r8(iz1,jz0);
635 dx20 = _fjsp_sub_v2r8(ix2,jx0);
636 dy20 = _fjsp_sub_v2r8(iy2,jy0);
637 dz20 = _fjsp_sub_v2r8(iz2,jz0);
638 dx30 = _fjsp_sub_v2r8(ix3,jx0);
639 dy30 = _fjsp_sub_v2r8(iy3,jy0);
640 dz30 = _fjsp_sub_v2r8(iz3,jz0);
642 /* Calculate squared distance and things based on it */
643 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
644 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
645 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
647 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
648 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
649 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
651 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
652 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
653 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
655 /* Load parameters for j particles */
656 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
658 fjx0 = _fjsp_setzero_v2r8();
659 fjy0 = _fjsp_setzero_v2r8();
660 fjz0 = _fjsp_setzero_v2r8();
662 /**************************
663 * CALCULATE INTERACTIONS *
664 **************************/
666 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
669 /* Compute parameters for interactions between i and j atoms */
670 qq10 = _fjsp_mul_v2r8(iq1,jq0);
672 /* REACTION-FIELD ELECTROSTATICS */
673 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
675 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
679 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
681 /* Update vectorial force */
682 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
683 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
684 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
686 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
687 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
688 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
692 /**************************
693 * CALCULATE INTERACTIONS *
694 **************************/
696 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
699 /* Compute parameters for interactions between i and j atoms */
700 qq20 = _fjsp_mul_v2r8(iq2,jq0);
702 /* REACTION-FIELD ELECTROSTATICS */
703 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
705 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
709 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
711 /* Update vectorial force */
712 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
713 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
714 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
716 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
717 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
718 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
722 /**************************
723 * CALCULATE INTERACTIONS *
724 **************************/
726 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
729 /* Compute parameters for interactions between i and j atoms */
730 qq30 = _fjsp_mul_v2r8(iq3,jq0);
732 /* REACTION-FIELD ELECTROSTATICS */
733 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
735 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
739 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
741 /* Update vectorial force */
742 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
743 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
744 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
746 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
747 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
748 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
752 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
754 /* Inner loop uses 102 flops */
761 j_coord_offsetA = DIM*jnrA;
763 /* load j atom coordinates */
764 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
767 /* Calculate displacement vector */
768 dx10 = _fjsp_sub_v2r8(ix1,jx0);
769 dy10 = _fjsp_sub_v2r8(iy1,jy0);
770 dz10 = _fjsp_sub_v2r8(iz1,jz0);
771 dx20 = _fjsp_sub_v2r8(ix2,jx0);
772 dy20 = _fjsp_sub_v2r8(iy2,jy0);
773 dz20 = _fjsp_sub_v2r8(iz2,jz0);
774 dx30 = _fjsp_sub_v2r8(ix3,jx0);
775 dy30 = _fjsp_sub_v2r8(iy3,jy0);
776 dz30 = _fjsp_sub_v2r8(iz3,jz0);
778 /* Calculate squared distance and things based on it */
779 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
780 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
781 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
783 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
784 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
785 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
787 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
788 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
789 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
791 /* Load parameters for j particles */
792 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
794 fjx0 = _fjsp_setzero_v2r8();
795 fjy0 = _fjsp_setzero_v2r8();
796 fjz0 = _fjsp_setzero_v2r8();
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
802 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
805 /* Compute parameters for interactions between i and j atoms */
806 qq10 = _fjsp_mul_v2r8(iq1,jq0);
808 /* REACTION-FIELD ELECTROSTATICS */
809 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
811 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
815 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
817 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
819 /* Update vectorial force */
820 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
821 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
822 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
824 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
825 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
826 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
830 /**************************
831 * CALCULATE INTERACTIONS *
832 **************************/
834 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
837 /* Compute parameters for interactions between i and j atoms */
838 qq20 = _fjsp_mul_v2r8(iq2,jq0);
840 /* REACTION-FIELD ELECTROSTATICS */
841 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
843 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
847 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
849 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
851 /* Update vectorial force */
852 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
853 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
854 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
856 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
857 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
858 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
862 /**************************
863 * CALCULATE INTERACTIONS *
864 **************************/
866 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
869 /* Compute parameters for interactions between i and j atoms */
870 qq30 = _fjsp_mul_v2r8(iq3,jq0);
872 /* REACTION-FIELD ELECTROSTATICS */
873 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
875 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
879 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
881 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
883 /* Update vectorial force */
884 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
885 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
886 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
888 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
889 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
890 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
894 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
896 /* Inner loop uses 102 flops */
899 /* End of innermost loop */
901 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
902 f+i_coord_offset+DIM,fshift+i_shift_offset);
904 /* Increment number of inner iterations */
905 inneriter += j_index_end - j_index_start;
907 /* Outer loop uses 18 flops */
910 /* Increment number of outer iterations */
913 /* Update outer/inner flops */
915 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_F,outeriter*18 + inneriter*102);