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_ElecRFCut_VdwLJSh_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_ElecRFCut_VdwLJSh_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 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
135 rcutoff_scalar = fr->rcoulomb;
136 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
137 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
139 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
140 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
142 /* Avoid stupid compiler warnings */
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
166 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
168 fix0 = _fjsp_setzero_v2r8();
169 fiy0 = _fjsp_setzero_v2r8();
170 fiz0 = _fjsp_setzero_v2r8();
171 fix1 = _fjsp_setzero_v2r8();
172 fiy1 = _fjsp_setzero_v2r8();
173 fiz1 = _fjsp_setzero_v2r8();
174 fix2 = _fjsp_setzero_v2r8();
175 fiy2 = _fjsp_setzero_v2r8();
176 fiz2 = _fjsp_setzero_v2r8();
177 fix3 = _fjsp_setzero_v2r8();
178 fiy3 = _fjsp_setzero_v2r8();
179 fiz3 = _fjsp_setzero_v2r8();
181 /* Reset potential sums */
182 velecsum = _fjsp_setzero_v2r8();
183 vvdwsum = _fjsp_setzero_v2r8();
185 /* Start inner kernel loop */
186 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
189 /* Get j neighbor index, and coordinate index */
192 j_coord_offsetA = DIM*jnrA;
193 j_coord_offsetB = DIM*jnrB;
195 /* load j atom coordinates */
196 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
199 /* Calculate displacement vector */
200 dx00 = _fjsp_sub_v2r8(ix0,jx0);
201 dy00 = _fjsp_sub_v2r8(iy0,jy0);
202 dz00 = _fjsp_sub_v2r8(iz0,jz0);
203 dx10 = _fjsp_sub_v2r8(ix1,jx0);
204 dy10 = _fjsp_sub_v2r8(iy1,jy0);
205 dz10 = _fjsp_sub_v2r8(iz1,jz0);
206 dx20 = _fjsp_sub_v2r8(ix2,jx0);
207 dy20 = _fjsp_sub_v2r8(iy2,jy0);
208 dz20 = _fjsp_sub_v2r8(iz2,jz0);
209 dx30 = _fjsp_sub_v2r8(ix3,jx0);
210 dy30 = _fjsp_sub_v2r8(iy3,jy0);
211 dz30 = _fjsp_sub_v2r8(iz3,jz0);
213 /* Calculate squared distance and things based on it */
214 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
215 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
216 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
217 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
219 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
220 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
221 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
223 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
224 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
225 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
226 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
228 /* Load parameters for j particles */
229 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
230 vdwjidx0A = 2*vdwtype[jnrA+0];
231 vdwjidx0B = 2*vdwtype[jnrB+0];
233 fjx0 = _fjsp_setzero_v2r8();
234 fjy0 = _fjsp_setzero_v2r8();
235 fjz0 = _fjsp_setzero_v2r8();
237 /**************************
238 * CALCULATE INTERACTIONS *
239 **************************/
241 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
244 /* Compute parameters for interactions between i and j atoms */
245 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
246 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
248 /* LENNARD-JONES DISPERSION/REPULSION */
250 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
251 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
252 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
253 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
254 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
255 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
257 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
259 /* Update potential sum for this i atom from the interaction with this j atom. */
260 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
261 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
265 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
267 /* Update vectorial force */
268 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
269 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
270 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
272 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
273 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
274 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
278 /**************************
279 * CALCULATE INTERACTIONS *
280 **************************/
282 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
285 /* Compute parameters for interactions between i and j atoms */
286 qq10 = _fjsp_mul_v2r8(iq1,jq0);
288 /* REACTION-FIELD ELECTROSTATICS */
289 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
290 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
292 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
294 /* Update potential sum for this i atom from the interaction with this j atom. */
295 velec = _fjsp_and_v2r8(velec,cutoff_mask);
296 velecsum = _fjsp_add_v2r8(velecsum,velec);
300 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
302 /* Update vectorial force */
303 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
304 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
305 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
307 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
308 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
309 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
313 /**************************
314 * CALCULATE INTERACTIONS *
315 **************************/
317 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
320 /* Compute parameters for interactions between i and j atoms */
321 qq20 = _fjsp_mul_v2r8(iq2,jq0);
323 /* REACTION-FIELD ELECTROSTATICS */
324 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
325 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
327 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
329 /* Update potential sum for this i atom from the interaction with this j atom. */
330 velec = _fjsp_and_v2r8(velec,cutoff_mask);
331 velecsum = _fjsp_add_v2r8(velecsum,velec);
335 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
337 /* Update vectorial force */
338 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
339 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
340 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
342 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
343 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
344 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
348 /**************************
349 * CALCULATE INTERACTIONS *
350 **************************/
352 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
355 /* Compute parameters for interactions between i and j atoms */
356 qq30 = _fjsp_mul_v2r8(iq3,jq0);
358 /* REACTION-FIELD ELECTROSTATICS */
359 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
360 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
362 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
364 /* Update potential sum for this i atom from the interaction with this j atom. */
365 velec = _fjsp_and_v2r8(velec,cutoff_mask);
366 velecsum = _fjsp_add_v2r8(velecsum,velec);
370 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
372 /* Update vectorial force */
373 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
374 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
375 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
377 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
378 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
379 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
383 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
385 /* Inner loop uses 164 flops */
392 j_coord_offsetA = DIM*jnrA;
394 /* load j atom coordinates */
395 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
398 /* Calculate displacement vector */
399 dx00 = _fjsp_sub_v2r8(ix0,jx0);
400 dy00 = _fjsp_sub_v2r8(iy0,jy0);
401 dz00 = _fjsp_sub_v2r8(iz0,jz0);
402 dx10 = _fjsp_sub_v2r8(ix1,jx0);
403 dy10 = _fjsp_sub_v2r8(iy1,jy0);
404 dz10 = _fjsp_sub_v2r8(iz1,jz0);
405 dx20 = _fjsp_sub_v2r8(ix2,jx0);
406 dy20 = _fjsp_sub_v2r8(iy2,jy0);
407 dz20 = _fjsp_sub_v2r8(iz2,jz0);
408 dx30 = _fjsp_sub_v2r8(ix3,jx0);
409 dy30 = _fjsp_sub_v2r8(iy3,jy0);
410 dz30 = _fjsp_sub_v2r8(iz3,jz0);
412 /* Calculate squared distance and things based on it */
413 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
414 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
415 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
416 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
418 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
419 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
420 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
422 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
423 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
424 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
425 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
427 /* Load parameters for j particles */
428 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
429 vdwjidx0A = 2*vdwtype[jnrA+0];
431 fjx0 = _fjsp_setzero_v2r8();
432 fjy0 = _fjsp_setzero_v2r8();
433 fjz0 = _fjsp_setzero_v2r8();
435 /**************************
436 * CALCULATE INTERACTIONS *
437 **************************/
439 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
442 /* Compute parameters for interactions between i and j atoms */
443 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
445 /* LENNARD-JONES DISPERSION/REPULSION */
447 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
448 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
449 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
450 vvdw = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
451 _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
452 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
454 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
456 /* Update potential sum for this i atom from the interaction with this j atom. */
457 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
458 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
459 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
463 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
465 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
467 /* Update vectorial force */
468 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
469 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
470 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
472 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
473 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
474 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
478 /**************************
479 * CALCULATE INTERACTIONS *
480 **************************/
482 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
485 /* Compute parameters for interactions between i and j atoms */
486 qq10 = _fjsp_mul_v2r8(iq1,jq0);
488 /* REACTION-FIELD ELECTROSTATICS */
489 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
490 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
492 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
494 /* Update potential sum for this i atom from the interaction with this j atom. */
495 velec = _fjsp_and_v2r8(velec,cutoff_mask);
496 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
497 velecsum = _fjsp_add_v2r8(velecsum,velec);
501 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
503 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
505 /* Update vectorial force */
506 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
507 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
508 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
510 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
511 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
512 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
520 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
523 /* Compute parameters for interactions between i and j atoms */
524 qq20 = _fjsp_mul_v2r8(iq2,jq0);
526 /* REACTION-FIELD ELECTROSTATICS */
527 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
528 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
530 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
532 /* Update potential sum for this i atom from the interaction with this j atom. */
533 velec = _fjsp_and_v2r8(velec,cutoff_mask);
534 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
535 velecsum = _fjsp_add_v2r8(velecsum,velec);
539 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
541 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
543 /* Update vectorial force */
544 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
545 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
546 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
548 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
549 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
550 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
554 /**************************
555 * CALCULATE INTERACTIONS *
556 **************************/
558 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
561 /* Compute parameters for interactions between i and j atoms */
562 qq30 = _fjsp_mul_v2r8(iq3,jq0);
564 /* REACTION-FIELD ELECTROSTATICS */
565 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
566 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
568 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
570 /* Update potential sum for this i atom from the interaction with this j atom. */
571 velec = _fjsp_and_v2r8(velec,cutoff_mask);
572 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
573 velecsum = _fjsp_add_v2r8(velecsum,velec);
577 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
579 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
581 /* Update vectorial force */
582 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
583 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
584 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
586 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
587 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
588 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
592 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
594 /* Inner loop uses 164 flops */
597 /* End of innermost loop */
599 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
600 f+i_coord_offset,fshift+i_shift_offset);
603 /* Update potential energies */
604 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
605 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
607 /* Increment number of inner iterations */
608 inneriter += j_index_end - j_index_start;
610 /* Outer loop uses 26 flops */
613 /* Increment number of outer iterations */
616 /* Update outer/inner flops */
618 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*164);
621 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
622 * Electrostatics interaction: ReactionField
623 * VdW interaction: LennardJones
624 * Geometry: Water4-Particle
625 * Calculate force/pot: Force
628 nb_kernel_ElecRFCut_VdwLJSh_GeomW4P1_F_sparc64_hpc_ace_double
629 (t_nblist * gmx_restrict nlist,
630 rvec * gmx_restrict xx,
631 rvec * gmx_restrict ff,
632 t_forcerec * gmx_restrict fr,
633 t_mdatoms * gmx_restrict mdatoms,
634 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
635 t_nrnb * gmx_restrict nrnb)
637 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
638 * just 0 for non-waters.
639 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
640 * jnr indices corresponding to data put in the four positions in the SIMD register.
642 int i_shift_offset,i_coord_offset,outeriter,inneriter;
643 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
645 int j_coord_offsetA,j_coord_offsetB;
646 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
648 real *shiftvec,*fshift,*x,*f;
649 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
651 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
653 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
655 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
657 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
658 int vdwjidx0A,vdwjidx0B;
659 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
660 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
661 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
662 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
663 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
664 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
667 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
670 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
671 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
673 _fjsp_v2r8 dummy_mask,cutoff_mask;
674 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
675 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
676 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
683 jindex = nlist->jindex;
685 shiftidx = nlist->shift;
687 shiftvec = fr->shift_vec[0];
688 fshift = fr->fshift[0];
689 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
690 charge = mdatoms->chargeA;
691 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
692 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
693 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
694 nvdwtype = fr->ntype;
696 vdwtype = mdatoms->typeA;
698 /* Setup water-specific parameters */
699 inr = nlist->iinr[0];
700 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
701 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
702 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
703 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
705 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
706 rcutoff_scalar = fr->rcoulomb;
707 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
708 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
710 sh_vdw_invrcut6 = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
711 rvdw = gmx_fjsp_set1_v2r8(fr->rvdw);
713 /* Avoid stupid compiler warnings */
721 /* Start outer loop over neighborlists */
722 for(iidx=0; iidx<nri; iidx++)
724 /* Load shift vector for this list */
725 i_shift_offset = DIM*shiftidx[iidx];
727 /* Load limits for loop over neighbors */
728 j_index_start = jindex[iidx];
729 j_index_end = jindex[iidx+1];
731 /* Get outer coordinate index */
733 i_coord_offset = DIM*inr;
735 /* Load i particle coords and add shift vector */
736 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
737 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
739 fix0 = _fjsp_setzero_v2r8();
740 fiy0 = _fjsp_setzero_v2r8();
741 fiz0 = _fjsp_setzero_v2r8();
742 fix1 = _fjsp_setzero_v2r8();
743 fiy1 = _fjsp_setzero_v2r8();
744 fiz1 = _fjsp_setzero_v2r8();
745 fix2 = _fjsp_setzero_v2r8();
746 fiy2 = _fjsp_setzero_v2r8();
747 fiz2 = _fjsp_setzero_v2r8();
748 fix3 = _fjsp_setzero_v2r8();
749 fiy3 = _fjsp_setzero_v2r8();
750 fiz3 = _fjsp_setzero_v2r8();
752 /* Start inner kernel loop */
753 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
756 /* Get j neighbor index, and coordinate index */
759 j_coord_offsetA = DIM*jnrA;
760 j_coord_offsetB = DIM*jnrB;
762 /* load j atom coordinates */
763 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
766 /* Calculate displacement vector */
767 dx00 = _fjsp_sub_v2r8(ix0,jx0);
768 dy00 = _fjsp_sub_v2r8(iy0,jy0);
769 dz00 = _fjsp_sub_v2r8(iz0,jz0);
770 dx10 = _fjsp_sub_v2r8(ix1,jx0);
771 dy10 = _fjsp_sub_v2r8(iy1,jy0);
772 dz10 = _fjsp_sub_v2r8(iz1,jz0);
773 dx20 = _fjsp_sub_v2r8(ix2,jx0);
774 dy20 = _fjsp_sub_v2r8(iy2,jy0);
775 dz20 = _fjsp_sub_v2r8(iz2,jz0);
776 dx30 = _fjsp_sub_v2r8(ix3,jx0);
777 dy30 = _fjsp_sub_v2r8(iy3,jy0);
778 dz30 = _fjsp_sub_v2r8(iz3,jz0);
780 /* Calculate squared distance and things based on it */
781 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
782 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
783 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
784 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
786 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
787 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
788 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
790 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
791 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
792 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
793 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
795 /* Load parameters for j particles */
796 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
797 vdwjidx0A = 2*vdwtype[jnrA+0];
798 vdwjidx0B = 2*vdwtype[jnrB+0];
800 fjx0 = _fjsp_setzero_v2r8();
801 fjy0 = _fjsp_setzero_v2r8();
802 fjz0 = _fjsp_setzero_v2r8();
804 /**************************
805 * CALCULATE INTERACTIONS *
806 **************************/
808 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
811 /* Compute parameters for interactions between i and j atoms */
812 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
813 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
815 /* LENNARD-JONES DISPERSION/REPULSION */
817 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
818 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
820 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
824 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
826 /* Update vectorial force */
827 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
828 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
829 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
831 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
832 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
833 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
837 /**************************
838 * CALCULATE INTERACTIONS *
839 **************************/
841 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
844 /* Compute parameters for interactions between i and j atoms */
845 qq10 = _fjsp_mul_v2r8(iq1,jq0);
847 /* REACTION-FIELD ELECTROSTATICS */
848 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
850 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
854 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
856 /* Update vectorial force */
857 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
858 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
859 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
861 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
862 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
863 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
867 /**************************
868 * CALCULATE INTERACTIONS *
869 **************************/
871 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
874 /* Compute parameters for interactions between i and j atoms */
875 qq20 = _fjsp_mul_v2r8(iq2,jq0);
877 /* REACTION-FIELD ELECTROSTATICS */
878 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
880 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
884 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
886 /* Update vectorial force */
887 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
888 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
889 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
891 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
892 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
893 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
897 /**************************
898 * CALCULATE INTERACTIONS *
899 **************************/
901 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
904 /* Compute parameters for interactions between i and j atoms */
905 qq30 = _fjsp_mul_v2r8(iq3,jq0);
907 /* REACTION-FIELD ELECTROSTATICS */
908 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
910 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
914 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
916 /* Update vectorial force */
917 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
918 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
919 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
921 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
922 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
923 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
927 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
929 /* Inner loop uses 135 flops */
936 j_coord_offsetA = DIM*jnrA;
938 /* load j atom coordinates */
939 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
942 /* Calculate displacement vector */
943 dx00 = _fjsp_sub_v2r8(ix0,jx0);
944 dy00 = _fjsp_sub_v2r8(iy0,jy0);
945 dz00 = _fjsp_sub_v2r8(iz0,jz0);
946 dx10 = _fjsp_sub_v2r8(ix1,jx0);
947 dy10 = _fjsp_sub_v2r8(iy1,jy0);
948 dz10 = _fjsp_sub_v2r8(iz1,jz0);
949 dx20 = _fjsp_sub_v2r8(ix2,jx0);
950 dy20 = _fjsp_sub_v2r8(iy2,jy0);
951 dz20 = _fjsp_sub_v2r8(iz2,jz0);
952 dx30 = _fjsp_sub_v2r8(ix3,jx0);
953 dy30 = _fjsp_sub_v2r8(iy3,jy0);
954 dz30 = _fjsp_sub_v2r8(iz3,jz0);
956 /* Calculate squared distance and things based on it */
957 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
958 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
959 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
960 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
962 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
963 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
964 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
966 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
967 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
968 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
969 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
971 /* Load parameters for j particles */
972 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
973 vdwjidx0A = 2*vdwtype[jnrA+0];
975 fjx0 = _fjsp_setzero_v2r8();
976 fjy0 = _fjsp_setzero_v2r8();
977 fjz0 = _fjsp_setzero_v2r8();
979 /**************************
980 * CALCULATE INTERACTIONS *
981 **************************/
983 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
986 /* Compute parameters for interactions between i and j atoms */
987 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
989 /* LENNARD-JONES DISPERSION/REPULSION */
991 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
992 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
994 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
998 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1000 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1002 /* Update vectorial force */
1003 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1004 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1005 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1007 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1008 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1009 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1013 /**************************
1014 * CALCULATE INTERACTIONS *
1015 **************************/
1017 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1020 /* Compute parameters for interactions between i and j atoms */
1021 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1023 /* REACTION-FIELD ELECTROSTATICS */
1024 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1026 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1030 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1032 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1034 /* Update vectorial force */
1035 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1036 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1037 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1039 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1040 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1041 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1045 /**************************
1046 * CALCULATE INTERACTIONS *
1047 **************************/
1049 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1052 /* Compute parameters for interactions between i and j atoms */
1053 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1055 /* REACTION-FIELD ELECTROSTATICS */
1056 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1058 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1062 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1064 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1066 /* Update vectorial force */
1067 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1068 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1069 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1071 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1072 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1073 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1077 /**************************
1078 * CALCULATE INTERACTIONS *
1079 **************************/
1081 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1084 /* Compute parameters for interactions between i and j atoms */
1085 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1087 /* REACTION-FIELD ELECTROSTATICS */
1088 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1090 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1094 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1096 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1098 /* Update vectorial force */
1099 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1100 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1101 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1103 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1104 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1105 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1109 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1111 /* Inner loop uses 135 flops */
1114 /* End of innermost loop */
1116 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1117 f+i_coord_offset,fshift+i_shift_offset);
1119 /* Increment number of inner iterations */
1120 inneriter += j_index_end - j_index_start;
1122 /* Outer loop uses 24 flops */
1125 /* Increment number of outer iterations */
1128 /* Update outer/inner flops */
1130 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*135);