2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: LennardJones
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_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;
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 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
99 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
101 real rswitch_scalar,d_scalar;
103 _fjsp_v2r8 dummy_mask,cutoff_mask;
104 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
105 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
106 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
119 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
120 charge = mdatoms->chargeA;
121 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
122 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
123 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
124 nvdwtype = fr->ntype;
126 vdwtype = mdatoms->typeA;
128 /* Setup water-specific parameters */
129 inr = nlist->iinr[0];
130 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+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 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
135 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
136 rcutoff_scalar = fr->rcoulomb;
137 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
138 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
140 rswitch_scalar = fr->rvdw_switch;
141 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
142 /* Setup switch parameters */
143 d_scalar = rcutoff_scalar-rswitch_scalar;
144 d = gmx_fjsp_set1_v2r8(d_scalar);
145 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
146 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
147 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
148 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
149 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
150 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
152 /* Avoid stupid compiler warnings */
160 /* Start outer loop over neighborlists */
161 for(iidx=0; iidx<nri; iidx++)
163 /* Load shift vector for this list */
164 i_shift_offset = DIM*shiftidx[iidx];
166 /* Load limits for loop over neighbors */
167 j_index_start = jindex[iidx];
168 j_index_end = jindex[iidx+1];
170 /* Get outer coordinate index */
172 i_coord_offset = DIM*inr;
174 /* Load i particle coords and add shift vector */
175 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
176 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
178 fix0 = _fjsp_setzero_v2r8();
179 fiy0 = _fjsp_setzero_v2r8();
180 fiz0 = _fjsp_setzero_v2r8();
181 fix1 = _fjsp_setzero_v2r8();
182 fiy1 = _fjsp_setzero_v2r8();
183 fiz1 = _fjsp_setzero_v2r8();
184 fix2 = _fjsp_setzero_v2r8();
185 fiy2 = _fjsp_setzero_v2r8();
186 fiz2 = _fjsp_setzero_v2r8();
188 /* Reset potential sums */
189 velecsum = _fjsp_setzero_v2r8();
190 vvdwsum = _fjsp_setzero_v2r8();
192 /* Start inner kernel loop */
193 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
196 /* Get j neighbor index, and coordinate index */
199 j_coord_offsetA = DIM*jnrA;
200 j_coord_offsetB = DIM*jnrB;
202 /* load j atom coordinates */
203 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
206 /* Calculate displacement vector */
207 dx00 = _fjsp_sub_v2r8(ix0,jx0);
208 dy00 = _fjsp_sub_v2r8(iy0,jy0);
209 dz00 = _fjsp_sub_v2r8(iz0,jz0);
210 dx10 = _fjsp_sub_v2r8(ix1,jx0);
211 dy10 = _fjsp_sub_v2r8(iy1,jy0);
212 dz10 = _fjsp_sub_v2r8(iz1,jz0);
213 dx20 = _fjsp_sub_v2r8(ix2,jx0);
214 dy20 = _fjsp_sub_v2r8(iy2,jy0);
215 dz20 = _fjsp_sub_v2r8(iz2,jz0);
217 /* Calculate squared distance and things based on it */
218 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
219 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
220 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
222 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
223 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
224 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
226 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
227 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
228 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
230 /* Load parameters for j particles */
231 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
232 vdwjidx0A = 2*vdwtype[jnrA+0];
233 vdwjidx0B = 2*vdwtype[jnrB+0];
235 fjx0 = _fjsp_setzero_v2r8();
236 fjy0 = _fjsp_setzero_v2r8();
237 fjz0 = _fjsp_setzero_v2r8();
239 /**************************
240 * CALCULATE INTERACTIONS *
241 **************************/
243 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
246 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
248 /* Compute parameters for interactions between i and j atoms */
249 qq00 = _fjsp_mul_v2r8(iq0,jq0);
250 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
251 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
253 /* REACTION-FIELD ELECTROSTATICS */
254 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
255 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
257 /* LENNARD-JONES DISPERSION/REPULSION */
259 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
260 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
261 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
262 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
263 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
265 d = _fjsp_sub_v2r8(r00,rswitch);
266 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
267 d2 = _fjsp_mul_v2r8(d,d);
268 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
270 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
272 /* Evaluate switch function */
273 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
274 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
275 vvdw = _fjsp_mul_v2r8(vvdw,sw);
276 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
278 /* Update potential sum for this i atom from the interaction with this j atom. */
279 velec = _fjsp_and_v2r8(velec,cutoff_mask);
280 velecsum = _fjsp_add_v2r8(velecsum,velec);
281 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
282 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
284 fscal = _fjsp_add_v2r8(felec,fvdw);
286 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
288 /* Update vectorial force */
289 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
290 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
291 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
293 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
294 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
295 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
299 /**************************
300 * CALCULATE INTERACTIONS *
301 **************************/
303 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
306 /* Compute parameters for interactions between i and j atoms */
307 qq10 = _fjsp_mul_v2r8(iq1,jq0);
309 /* REACTION-FIELD ELECTROSTATICS */
310 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
311 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
313 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
315 /* Update potential sum for this i atom from the interaction with this j atom. */
316 velec = _fjsp_and_v2r8(velec,cutoff_mask);
317 velecsum = _fjsp_add_v2r8(velecsum,velec);
321 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
323 /* Update vectorial force */
324 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
325 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
326 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
328 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
329 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
330 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
334 /**************************
335 * CALCULATE INTERACTIONS *
336 **************************/
338 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
341 /* Compute parameters for interactions between i and j atoms */
342 qq20 = _fjsp_mul_v2r8(iq2,jq0);
344 /* REACTION-FIELD ELECTROSTATICS */
345 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
346 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
348 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
350 /* Update potential sum for this i atom from the interaction with this j atom. */
351 velec = _fjsp_and_v2r8(velec,cutoff_mask);
352 velecsum = _fjsp_add_v2r8(velecsum,velec);
356 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
358 /* Update vectorial force */
359 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
360 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
361 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
363 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
364 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
365 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
369 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
371 /* Inner loop uses 154 flops */
378 j_coord_offsetA = DIM*jnrA;
380 /* load j atom coordinates */
381 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
384 /* Calculate displacement vector */
385 dx00 = _fjsp_sub_v2r8(ix0,jx0);
386 dy00 = _fjsp_sub_v2r8(iy0,jy0);
387 dz00 = _fjsp_sub_v2r8(iz0,jz0);
388 dx10 = _fjsp_sub_v2r8(ix1,jx0);
389 dy10 = _fjsp_sub_v2r8(iy1,jy0);
390 dz10 = _fjsp_sub_v2r8(iz1,jz0);
391 dx20 = _fjsp_sub_v2r8(ix2,jx0);
392 dy20 = _fjsp_sub_v2r8(iy2,jy0);
393 dz20 = _fjsp_sub_v2r8(iz2,jz0);
395 /* Calculate squared distance and things based on it */
396 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
397 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
398 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
400 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
401 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
402 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
404 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
405 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
406 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
408 /* Load parameters for j particles */
409 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
410 vdwjidx0A = 2*vdwtype[jnrA+0];
412 fjx0 = _fjsp_setzero_v2r8();
413 fjy0 = _fjsp_setzero_v2r8();
414 fjz0 = _fjsp_setzero_v2r8();
416 /**************************
417 * CALCULATE INTERACTIONS *
418 **************************/
420 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
423 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
425 /* Compute parameters for interactions between i and j atoms */
426 qq00 = _fjsp_mul_v2r8(iq0,jq0);
427 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
429 /* REACTION-FIELD ELECTROSTATICS */
430 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
431 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
433 /* LENNARD-JONES DISPERSION/REPULSION */
435 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
436 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
437 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
438 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
439 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
441 d = _fjsp_sub_v2r8(r00,rswitch);
442 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
443 d2 = _fjsp_mul_v2r8(d,d);
444 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
446 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
448 /* Evaluate switch function */
449 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
450 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
451 vvdw = _fjsp_mul_v2r8(vvdw,sw);
452 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
454 /* Update potential sum for this i atom from the interaction with this j atom. */
455 velec = _fjsp_and_v2r8(velec,cutoff_mask);
456 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
457 velecsum = _fjsp_add_v2r8(velecsum,velec);
458 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
459 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
460 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
462 fscal = _fjsp_add_v2r8(felec,fvdw);
464 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
466 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
468 /* Update vectorial force */
469 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
470 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
471 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
473 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
474 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
475 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
479 /**************************
480 * CALCULATE INTERACTIONS *
481 **************************/
483 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
486 /* Compute parameters for interactions between i and j atoms */
487 qq10 = _fjsp_mul_v2r8(iq1,jq0);
489 /* REACTION-FIELD ELECTROSTATICS */
490 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
491 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
493 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
495 /* Update potential sum for this i atom from the interaction with this j atom. */
496 velec = _fjsp_and_v2r8(velec,cutoff_mask);
497 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
498 velecsum = _fjsp_add_v2r8(velecsum,velec);
502 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
504 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
506 /* Update vectorial force */
507 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
508 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
509 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
511 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
512 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
513 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
517 /**************************
518 * CALCULATE INTERACTIONS *
519 **************************/
521 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
524 /* Compute parameters for interactions between i and j atoms */
525 qq20 = _fjsp_mul_v2r8(iq2,jq0);
527 /* REACTION-FIELD ELECTROSTATICS */
528 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
529 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
531 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
533 /* Update potential sum for this i atom from the interaction with this j atom. */
534 velec = _fjsp_and_v2r8(velec,cutoff_mask);
535 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
536 velecsum = _fjsp_add_v2r8(velecsum,velec);
540 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
542 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
544 /* Update vectorial force */
545 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
546 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
547 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
549 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
550 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
551 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
555 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
557 /* Inner loop uses 154 flops */
560 /* End of innermost loop */
562 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
563 f+i_coord_offset,fshift+i_shift_offset);
566 /* Update potential energies */
567 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
568 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
570 /* Increment number of inner iterations */
571 inneriter += j_index_end - j_index_start;
573 /* Outer loop uses 20 flops */
576 /* Increment number of outer iterations */
579 /* Update outer/inner flops */
581 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
584 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
585 * Electrostatics interaction: ReactionField
586 * VdW interaction: LennardJones
587 * Geometry: Water3-Particle
588 * Calculate force/pot: Force
591 nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
592 (t_nblist * gmx_restrict nlist,
593 rvec * gmx_restrict xx,
594 rvec * gmx_restrict ff,
595 t_forcerec * gmx_restrict fr,
596 t_mdatoms * gmx_restrict mdatoms,
597 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
598 t_nrnb * gmx_restrict nrnb)
600 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
601 * just 0 for non-waters.
602 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
603 * jnr indices corresponding to data put in the four positions in the SIMD register.
605 int i_shift_offset,i_coord_offset,outeriter,inneriter;
606 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
608 int j_coord_offsetA,j_coord_offsetB;
609 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
611 real *shiftvec,*fshift,*x,*f;
612 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
614 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
616 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
618 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
619 int vdwjidx0A,vdwjidx0B;
620 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
621 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
622 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
623 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
624 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
627 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
630 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
631 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
632 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
633 real rswitch_scalar,d_scalar;
635 _fjsp_v2r8 dummy_mask,cutoff_mask;
636 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
637 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
638 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
645 jindex = nlist->jindex;
647 shiftidx = nlist->shift;
649 shiftvec = fr->shift_vec[0];
650 fshift = fr->fshift[0];
651 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
652 charge = mdatoms->chargeA;
653 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
654 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
655 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
656 nvdwtype = fr->ntype;
658 vdwtype = mdatoms->typeA;
660 /* Setup water-specific parameters */
661 inr = nlist->iinr[0];
662 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
663 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
664 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
665 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
667 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
668 rcutoff_scalar = fr->rcoulomb;
669 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
670 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
672 rswitch_scalar = fr->rvdw_switch;
673 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
674 /* Setup switch parameters */
675 d_scalar = rcutoff_scalar-rswitch_scalar;
676 d = gmx_fjsp_set1_v2r8(d_scalar);
677 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
678 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
679 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
680 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
681 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
682 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
684 /* Avoid stupid compiler warnings */
692 /* Start outer loop over neighborlists */
693 for(iidx=0; iidx<nri; iidx++)
695 /* Load shift vector for this list */
696 i_shift_offset = DIM*shiftidx[iidx];
698 /* Load limits for loop over neighbors */
699 j_index_start = jindex[iidx];
700 j_index_end = jindex[iidx+1];
702 /* Get outer coordinate index */
704 i_coord_offset = DIM*inr;
706 /* Load i particle coords and add shift vector */
707 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
708 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
710 fix0 = _fjsp_setzero_v2r8();
711 fiy0 = _fjsp_setzero_v2r8();
712 fiz0 = _fjsp_setzero_v2r8();
713 fix1 = _fjsp_setzero_v2r8();
714 fiy1 = _fjsp_setzero_v2r8();
715 fiz1 = _fjsp_setzero_v2r8();
716 fix2 = _fjsp_setzero_v2r8();
717 fiy2 = _fjsp_setzero_v2r8();
718 fiz2 = _fjsp_setzero_v2r8();
720 /* Start inner kernel loop */
721 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
724 /* Get j neighbor index, and coordinate index */
727 j_coord_offsetA = DIM*jnrA;
728 j_coord_offsetB = DIM*jnrB;
730 /* load j atom coordinates */
731 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
734 /* Calculate displacement vector */
735 dx00 = _fjsp_sub_v2r8(ix0,jx0);
736 dy00 = _fjsp_sub_v2r8(iy0,jy0);
737 dz00 = _fjsp_sub_v2r8(iz0,jz0);
738 dx10 = _fjsp_sub_v2r8(ix1,jx0);
739 dy10 = _fjsp_sub_v2r8(iy1,jy0);
740 dz10 = _fjsp_sub_v2r8(iz1,jz0);
741 dx20 = _fjsp_sub_v2r8(ix2,jx0);
742 dy20 = _fjsp_sub_v2r8(iy2,jy0);
743 dz20 = _fjsp_sub_v2r8(iz2,jz0);
745 /* Calculate squared distance and things based on it */
746 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
747 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
748 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
750 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
751 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
752 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
754 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
755 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
756 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
758 /* Load parameters for j particles */
759 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
760 vdwjidx0A = 2*vdwtype[jnrA+0];
761 vdwjidx0B = 2*vdwtype[jnrB+0];
763 fjx0 = _fjsp_setzero_v2r8();
764 fjy0 = _fjsp_setzero_v2r8();
765 fjz0 = _fjsp_setzero_v2r8();
767 /**************************
768 * CALCULATE INTERACTIONS *
769 **************************/
771 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
774 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
776 /* Compute parameters for interactions between i and j atoms */
777 qq00 = _fjsp_mul_v2r8(iq0,jq0);
778 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
779 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
781 /* REACTION-FIELD ELECTROSTATICS */
782 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
784 /* LENNARD-JONES DISPERSION/REPULSION */
786 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
787 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
788 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
789 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
790 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
792 d = _fjsp_sub_v2r8(r00,rswitch);
793 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
794 d2 = _fjsp_mul_v2r8(d,d);
795 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
797 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
799 /* Evaluate switch function */
800 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
801 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
802 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
804 fscal = _fjsp_add_v2r8(felec,fvdw);
806 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
808 /* Update vectorial force */
809 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
810 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
811 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
813 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
814 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
815 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
819 /**************************
820 * CALCULATE INTERACTIONS *
821 **************************/
823 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
826 /* Compute parameters for interactions between i and j atoms */
827 qq10 = _fjsp_mul_v2r8(iq1,jq0);
829 /* REACTION-FIELD ELECTROSTATICS */
830 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
832 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
836 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
838 /* Update vectorial force */
839 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
840 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
841 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
843 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
844 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
845 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
849 /**************************
850 * CALCULATE INTERACTIONS *
851 **************************/
853 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
856 /* Compute parameters for interactions between i and j atoms */
857 qq20 = _fjsp_mul_v2r8(iq2,jq0);
859 /* REACTION-FIELD ELECTROSTATICS */
860 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
862 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
866 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
868 /* Update vectorial force */
869 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
870 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
871 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
873 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
874 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
875 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
879 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
881 /* Inner loop uses 133 flops */
888 j_coord_offsetA = DIM*jnrA;
890 /* load j atom coordinates */
891 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
894 /* Calculate displacement vector */
895 dx00 = _fjsp_sub_v2r8(ix0,jx0);
896 dy00 = _fjsp_sub_v2r8(iy0,jy0);
897 dz00 = _fjsp_sub_v2r8(iz0,jz0);
898 dx10 = _fjsp_sub_v2r8(ix1,jx0);
899 dy10 = _fjsp_sub_v2r8(iy1,jy0);
900 dz10 = _fjsp_sub_v2r8(iz1,jz0);
901 dx20 = _fjsp_sub_v2r8(ix2,jx0);
902 dy20 = _fjsp_sub_v2r8(iy2,jy0);
903 dz20 = _fjsp_sub_v2r8(iz2,jz0);
905 /* Calculate squared distance and things based on it */
906 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
907 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
908 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
910 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
911 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
912 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
914 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
915 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
916 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
918 /* Load parameters for j particles */
919 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
920 vdwjidx0A = 2*vdwtype[jnrA+0];
922 fjx0 = _fjsp_setzero_v2r8();
923 fjy0 = _fjsp_setzero_v2r8();
924 fjz0 = _fjsp_setzero_v2r8();
926 /**************************
927 * CALCULATE INTERACTIONS *
928 **************************/
930 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
933 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
935 /* Compute parameters for interactions between i and j atoms */
936 qq00 = _fjsp_mul_v2r8(iq0,jq0);
937 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
939 /* REACTION-FIELD ELECTROSTATICS */
940 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
942 /* LENNARD-JONES DISPERSION/REPULSION */
944 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
945 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
946 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
947 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
948 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
950 d = _fjsp_sub_v2r8(r00,rswitch);
951 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
952 d2 = _fjsp_mul_v2r8(d,d);
953 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
955 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
957 /* Evaluate switch function */
958 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
959 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
960 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
962 fscal = _fjsp_add_v2r8(felec,fvdw);
964 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
966 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
968 /* Update vectorial force */
969 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
970 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
971 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
973 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
974 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
975 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
979 /**************************
980 * CALCULATE INTERACTIONS *
981 **************************/
983 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
986 /* Compute parameters for interactions between i and j atoms */
987 qq10 = _fjsp_mul_v2r8(iq1,jq0);
989 /* REACTION-FIELD ELECTROSTATICS */
990 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
992 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
996 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
998 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1000 /* Update vectorial force */
1001 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1002 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1003 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1005 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1006 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1007 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1011 /**************************
1012 * CALCULATE INTERACTIONS *
1013 **************************/
1015 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1018 /* Compute parameters for interactions between i and j atoms */
1019 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1021 /* REACTION-FIELD ELECTROSTATICS */
1022 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1024 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1028 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1030 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1032 /* Update vectorial force */
1033 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1034 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1035 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1037 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1038 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1039 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1043 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1045 /* Inner loop uses 133 flops */
1048 /* End of innermost loop */
1050 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1051 f+i_coord_offset,fshift+i_shift_offset);
1053 /* Increment number of inner iterations */
1054 inneriter += j_index_end - j_index_start;
1056 /* Outer loop uses 18 flops */
1059 /* Increment number of outer iterations */
1062 /* Update outer/inner flops */
1064 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*133);