2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
428 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
430 /* REACTION-FIELD ELECTROSTATICS */
431 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
432 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
434 /* LENNARD-JONES DISPERSION/REPULSION */
436 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
437 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
438 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
439 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
440 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
442 d = _fjsp_sub_v2r8(r00,rswitch);
443 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
444 d2 = _fjsp_mul_v2r8(d,d);
445 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
447 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
449 /* Evaluate switch function */
450 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
451 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
452 vvdw = _fjsp_mul_v2r8(vvdw,sw);
453 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,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);
459 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
460 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
461 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
463 fscal = _fjsp_add_v2r8(felec,fvdw);
465 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
467 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
469 /* Update vectorial force */
470 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
471 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
472 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
474 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
475 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
476 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
484 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
487 /* Compute parameters for interactions between i and j atoms */
488 qq10 = _fjsp_mul_v2r8(iq1,jq0);
490 /* REACTION-FIELD ELECTROSTATICS */
491 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
492 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
494 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
496 /* Update potential sum for this i atom from the interaction with this j atom. */
497 velec = _fjsp_and_v2r8(velec,cutoff_mask);
498 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
499 velecsum = _fjsp_add_v2r8(velecsum,velec);
503 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
505 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
507 /* Update vectorial force */
508 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
509 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
510 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
512 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
513 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
514 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
518 /**************************
519 * CALCULATE INTERACTIONS *
520 **************************/
522 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
525 /* Compute parameters for interactions between i and j atoms */
526 qq20 = _fjsp_mul_v2r8(iq2,jq0);
528 /* REACTION-FIELD ELECTROSTATICS */
529 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
530 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
532 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
534 /* Update potential sum for this i atom from the interaction with this j atom. */
535 velec = _fjsp_and_v2r8(velec,cutoff_mask);
536 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
537 velecsum = _fjsp_add_v2r8(velecsum,velec);
541 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
543 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
545 /* Update vectorial force */
546 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
547 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
548 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
550 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
551 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
552 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
556 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
558 /* Inner loop uses 154 flops */
561 /* End of innermost loop */
563 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
564 f+i_coord_offset,fshift+i_shift_offset);
567 /* Update potential energies */
568 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
569 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
571 /* Increment number of inner iterations */
572 inneriter += j_index_end - j_index_start;
574 /* Outer loop uses 20 flops */
577 /* Increment number of outer iterations */
580 /* Update outer/inner flops */
582 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
585 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
586 * Electrostatics interaction: ReactionField
587 * VdW interaction: LennardJones
588 * Geometry: Water3-Particle
589 * Calculate force/pot: Force
592 nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
593 (t_nblist * gmx_restrict nlist,
594 rvec * gmx_restrict xx,
595 rvec * gmx_restrict ff,
596 t_forcerec * gmx_restrict fr,
597 t_mdatoms * gmx_restrict mdatoms,
598 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
599 t_nrnb * gmx_restrict nrnb)
601 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
602 * just 0 for non-waters.
603 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
604 * jnr indices corresponding to data put in the four positions in the SIMD register.
606 int i_shift_offset,i_coord_offset,outeriter,inneriter;
607 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
609 int j_coord_offsetA,j_coord_offsetB;
610 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
612 real *shiftvec,*fshift,*x,*f;
613 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
615 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
617 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
619 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
620 int vdwjidx0A,vdwjidx0B;
621 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
622 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
623 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
624 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
625 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
628 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
631 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
632 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
633 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
634 real rswitch_scalar,d_scalar;
636 _fjsp_v2r8 dummy_mask,cutoff_mask;
637 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
638 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
639 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
646 jindex = nlist->jindex;
648 shiftidx = nlist->shift;
650 shiftvec = fr->shift_vec[0];
651 fshift = fr->fshift[0];
652 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
653 charge = mdatoms->chargeA;
654 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
655 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
656 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
657 nvdwtype = fr->ntype;
659 vdwtype = mdatoms->typeA;
661 /* Setup water-specific parameters */
662 inr = nlist->iinr[0];
663 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
664 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
665 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
666 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
668 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
669 rcutoff_scalar = fr->rcoulomb;
670 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
671 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
673 rswitch_scalar = fr->rvdw_switch;
674 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
675 /* Setup switch parameters */
676 d_scalar = rcutoff_scalar-rswitch_scalar;
677 d = gmx_fjsp_set1_v2r8(d_scalar);
678 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
679 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
680 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
681 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
682 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
683 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
685 /* Avoid stupid compiler warnings */
693 /* Start outer loop over neighborlists */
694 for(iidx=0; iidx<nri; iidx++)
696 /* Load shift vector for this list */
697 i_shift_offset = DIM*shiftidx[iidx];
699 /* Load limits for loop over neighbors */
700 j_index_start = jindex[iidx];
701 j_index_end = jindex[iidx+1];
703 /* Get outer coordinate index */
705 i_coord_offset = DIM*inr;
707 /* Load i particle coords and add shift vector */
708 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
709 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
711 fix0 = _fjsp_setzero_v2r8();
712 fiy0 = _fjsp_setzero_v2r8();
713 fiz0 = _fjsp_setzero_v2r8();
714 fix1 = _fjsp_setzero_v2r8();
715 fiy1 = _fjsp_setzero_v2r8();
716 fiz1 = _fjsp_setzero_v2r8();
717 fix2 = _fjsp_setzero_v2r8();
718 fiy2 = _fjsp_setzero_v2r8();
719 fiz2 = _fjsp_setzero_v2r8();
721 /* Start inner kernel loop */
722 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
725 /* Get j neighbor index, and coordinate index */
728 j_coord_offsetA = DIM*jnrA;
729 j_coord_offsetB = DIM*jnrB;
731 /* load j atom coordinates */
732 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
735 /* Calculate displacement vector */
736 dx00 = _fjsp_sub_v2r8(ix0,jx0);
737 dy00 = _fjsp_sub_v2r8(iy0,jy0);
738 dz00 = _fjsp_sub_v2r8(iz0,jz0);
739 dx10 = _fjsp_sub_v2r8(ix1,jx0);
740 dy10 = _fjsp_sub_v2r8(iy1,jy0);
741 dz10 = _fjsp_sub_v2r8(iz1,jz0);
742 dx20 = _fjsp_sub_v2r8(ix2,jx0);
743 dy20 = _fjsp_sub_v2r8(iy2,jy0);
744 dz20 = _fjsp_sub_v2r8(iz2,jz0);
746 /* Calculate squared distance and things based on it */
747 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
748 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
749 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
751 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
752 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
753 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
755 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
756 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
757 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
759 /* Load parameters for j particles */
760 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
761 vdwjidx0A = 2*vdwtype[jnrA+0];
762 vdwjidx0B = 2*vdwtype[jnrB+0];
764 fjx0 = _fjsp_setzero_v2r8();
765 fjy0 = _fjsp_setzero_v2r8();
766 fjz0 = _fjsp_setzero_v2r8();
768 /**************************
769 * CALCULATE INTERACTIONS *
770 **************************/
772 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
775 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
777 /* Compute parameters for interactions between i and j atoms */
778 qq00 = _fjsp_mul_v2r8(iq0,jq0);
779 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
780 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
782 /* REACTION-FIELD ELECTROSTATICS */
783 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
785 /* LENNARD-JONES DISPERSION/REPULSION */
787 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
788 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
789 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
790 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
791 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
793 d = _fjsp_sub_v2r8(r00,rswitch);
794 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
795 d2 = _fjsp_mul_v2r8(d,d);
796 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
798 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
800 /* Evaluate switch function */
801 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
802 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
803 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
805 fscal = _fjsp_add_v2r8(felec,fvdw);
807 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
809 /* Update vectorial force */
810 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
811 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
812 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
814 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
815 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
816 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
820 /**************************
821 * CALCULATE INTERACTIONS *
822 **************************/
824 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
827 /* Compute parameters for interactions between i and j atoms */
828 qq10 = _fjsp_mul_v2r8(iq1,jq0);
830 /* REACTION-FIELD ELECTROSTATICS */
831 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
833 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
837 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
839 /* Update vectorial force */
840 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
841 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
842 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
844 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
845 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
846 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
854 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
857 /* Compute parameters for interactions between i and j atoms */
858 qq20 = _fjsp_mul_v2r8(iq2,jq0);
860 /* REACTION-FIELD ELECTROSTATICS */
861 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
863 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
867 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
869 /* Update vectorial force */
870 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
871 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
872 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
874 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
875 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
876 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
880 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
882 /* Inner loop uses 133 flops */
889 j_coord_offsetA = DIM*jnrA;
891 /* load j atom coordinates */
892 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
895 /* Calculate displacement vector */
896 dx00 = _fjsp_sub_v2r8(ix0,jx0);
897 dy00 = _fjsp_sub_v2r8(iy0,jy0);
898 dz00 = _fjsp_sub_v2r8(iz0,jz0);
899 dx10 = _fjsp_sub_v2r8(ix1,jx0);
900 dy10 = _fjsp_sub_v2r8(iy1,jy0);
901 dz10 = _fjsp_sub_v2r8(iz1,jz0);
902 dx20 = _fjsp_sub_v2r8(ix2,jx0);
903 dy20 = _fjsp_sub_v2r8(iy2,jy0);
904 dz20 = _fjsp_sub_v2r8(iz2,jz0);
906 /* Calculate squared distance and things based on it */
907 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
908 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
909 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
911 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
912 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
913 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
915 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
916 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
917 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
919 /* Load parameters for j particles */
920 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
921 vdwjidx0A = 2*vdwtype[jnrA+0];
923 fjx0 = _fjsp_setzero_v2r8();
924 fjy0 = _fjsp_setzero_v2r8();
925 fjz0 = _fjsp_setzero_v2r8();
927 /**************************
928 * CALCULATE INTERACTIONS *
929 **************************/
931 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
934 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
936 /* Compute parameters for interactions between i and j atoms */
937 qq00 = _fjsp_mul_v2r8(iq0,jq0);
938 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
939 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
941 /* REACTION-FIELD ELECTROSTATICS */
942 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
944 /* LENNARD-JONES DISPERSION/REPULSION */
946 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
947 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
948 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
949 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
950 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
952 d = _fjsp_sub_v2r8(r00,rswitch);
953 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
954 d2 = _fjsp_mul_v2r8(d,d);
955 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
957 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
959 /* Evaluate switch function */
960 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
961 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
962 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
964 fscal = _fjsp_add_v2r8(felec,fvdw);
966 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
968 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
970 /* Update vectorial force */
971 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
972 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
973 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
975 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
976 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
977 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
981 /**************************
982 * CALCULATE INTERACTIONS *
983 **************************/
985 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
988 /* Compute parameters for interactions between i and j atoms */
989 qq10 = _fjsp_mul_v2r8(iq1,jq0);
991 /* REACTION-FIELD ELECTROSTATICS */
992 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
994 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
998 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1000 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1002 /* Update vectorial force */
1003 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1004 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1005 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1007 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1008 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1009 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1013 /**************************
1014 * CALCULATE INTERACTIONS *
1015 **************************/
1017 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1020 /* Compute parameters for interactions between i and j atoms */
1021 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1023 /* REACTION-FIELD ELECTROSTATICS */
1024 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1026 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1030 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1032 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1034 /* Update vectorial force */
1035 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1036 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1037 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1039 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1040 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1041 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1045 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1047 /* Inner loop uses 133 flops */
1050 /* End of innermost loop */
1052 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1053 f+i_coord_offset,fshift+i_shift_offset);
1055 /* Increment number of inner iterations */
1056 inneriter += j_index_end - j_index_start;
1058 /* Outer loop uses 18 flops */
1061 /* Increment number of outer iterations */
1064 /* Update outer/inner flops */
1066 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*133);