2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_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;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
97 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
98 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
99 real rswitch_scalar,d_scalar;
101 _fjsp_v2r8 dummy_mask,cutoff_mask;
102 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
103 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
104 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
111 jindex = nlist->jindex;
113 shiftidx = nlist->shift;
115 shiftvec = fr->shift_vec[0];
116 fshift = fr->fshift[0];
117 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
118 charge = mdatoms->chargeA;
119 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
120 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
121 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
122 nvdwtype = fr->ntype;
124 vdwtype = mdatoms->typeA;
126 /* Setup water-specific parameters */
127 inr = nlist->iinr[0];
128 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+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 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
133 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
134 rcutoff_scalar = fr->rcoulomb;
135 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
136 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
138 rswitch_scalar = fr->rvdw_switch;
139 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
140 /* Setup switch parameters */
141 d_scalar = rcutoff_scalar-rswitch_scalar;
142 d = gmx_fjsp_set1_v2r8(d_scalar);
143 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
144 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
145 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
146 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
147 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
148 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
150 /* Avoid stupid compiler warnings */
158 /* Start outer loop over neighborlists */
159 for(iidx=0; iidx<nri; iidx++)
161 /* Load shift vector for this list */
162 i_shift_offset = DIM*shiftidx[iidx];
164 /* Load limits for loop over neighbors */
165 j_index_start = jindex[iidx];
166 j_index_end = jindex[iidx+1];
168 /* Get outer coordinate index */
170 i_coord_offset = DIM*inr;
172 /* Load i particle coords and add shift vector */
173 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
174 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
176 fix0 = _fjsp_setzero_v2r8();
177 fiy0 = _fjsp_setzero_v2r8();
178 fiz0 = _fjsp_setzero_v2r8();
179 fix1 = _fjsp_setzero_v2r8();
180 fiy1 = _fjsp_setzero_v2r8();
181 fiz1 = _fjsp_setzero_v2r8();
182 fix2 = _fjsp_setzero_v2r8();
183 fiy2 = _fjsp_setzero_v2r8();
184 fiz2 = _fjsp_setzero_v2r8();
186 /* Reset potential sums */
187 velecsum = _fjsp_setzero_v2r8();
188 vvdwsum = _fjsp_setzero_v2r8();
190 /* Start inner kernel loop */
191 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
194 /* Get j neighbor index, and coordinate index */
197 j_coord_offsetA = DIM*jnrA;
198 j_coord_offsetB = DIM*jnrB;
200 /* load j atom coordinates */
201 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
204 /* Calculate displacement vector */
205 dx00 = _fjsp_sub_v2r8(ix0,jx0);
206 dy00 = _fjsp_sub_v2r8(iy0,jy0);
207 dz00 = _fjsp_sub_v2r8(iz0,jz0);
208 dx10 = _fjsp_sub_v2r8(ix1,jx0);
209 dy10 = _fjsp_sub_v2r8(iy1,jy0);
210 dz10 = _fjsp_sub_v2r8(iz1,jz0);
211 dx20 = _fjsp_sub_v2r8(ix2,jx0);
212 dy20 = _fjsp_sub_v2r8(iy2,jy0);
213 dz20 = _fjsp_sub_v2r8(iz2,jz0);
215 /* Calculate squared distance and things based on it */
216 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
217 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
218 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
220 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
221 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
222 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
224 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
225 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
226 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
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 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
246 /* Compute parameters for interactions between i and j atoms */
247 qq00 = _fjsp_mul_v2r8(iq0,jq0);
248 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
249 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
251 /* REACTION-FIELD ELECTROSTATICS */
252 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
253 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
255 /* LENNARD-JONES DISPERSION/REPULSION */
257 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
258 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
259 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
260 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
261 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
263 d = _fjsp_sub_v2r8(r00,rswitch);
264 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
265 d2 = _fjsp_mul_v2r8(d,d);
266 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
268 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
270 /* Evaluate switch function */
271 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
272 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
273 vvdw = _fjsp_mul_v2r8(vvdw,sw);
274 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
276 /* Update potential sum for this i atom from the interaction with this j atom. */
277 velec = _fjsp_and_v2r8(velec,cutoff_mask);
278 velecsum = _fjsp_add_v2r8(velecsum,velec);
279 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
280 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
282 fscal = _fjsp_add_v2r8(felec,fvdw);
284 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
286 /* Update vectorial force */
287 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
288 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
289 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
291 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
292 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
293 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
297 /**************************
298 * CALCULATE INTERACTIONS *
299 **************************/
301 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
304 /* Compute parameters for interactions between i and j atoms */
305 qq10 = _fjsp_mul_v2r8(iq1,jq0);
307 /* REACTION-FIELD ELECTROSTATICS */
308 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
309 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
311 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
313 /* Update potential sum for this i atom from the interaction with this j atom. */
314 velec = _fjsp_and_v2r8(velec,cutoff_mask);
315 velecsum = _fjsp_add_v2r8(velecsum,velec);
319 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
321 /* Update vectorial force */
322 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
323 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
324 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
326 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
327 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
328 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
332 /**************************
333 * CALCULATE INTERACTIONS *
334 **************************/
336 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
339 /* Compute parameters for interactions between i and j atoms */
340 qq20 = _fjsp_mul_v2r8(iq2,jq0);
342 /* REACTION-FIELD ELECTROSTATICS */
343 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
344 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
346 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
348 /* Update potential sum for this i atom from the interaction with this j atom. */
349 velec = _fjsp_and_v2r8(velec,cutoff_mask);
350 velecsum = _fjsp_add_v2r8(velecsum,velec);
354 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
356 /* Update vectorial force */
357 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
358 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
359 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
361 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
362 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
363 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
367 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
369 /* Inner loop uses 154 flops */
376 j_coord_offsetA = DIM*jnrA;
378 /* load j atom coordinates */
379 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
382 /* Calculate displacement vector */
383 dx00 = _fjsp_sub_v2r8(ix0,jx0);
384 dy00 = _fjsp_sub_v2r8(iy0,jy0);
385 dz00 = _fjsp_sub_v2r8(iz0,jz0);
386 dx10 = _fjsp_sub_v2r8(ix1,jx0);
387 dy10 = _fjsp_sub_v2r8(iy1,jy0);
388 dz10 = _fjsp_sub_v2r8(iz1,jz0);
389 dx20 = _fjsp_sub_v2r8(ix2,jx0);
390 dy20 = _fjsp_sub_v2r8(iy2,jy0);
391 dz20 = _fjsp_sub_v2r8(iz2,jz0);
393 /* Calculate squared distance and things based on it */
394 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
395 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
396 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
398 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
399 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
400 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
402 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
403 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
404 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
406 /* Load parameters for j particles */
407 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
408 vdwjidx0A = 2*vdwtype[jnrA+0];
410 fjx0 = _fjsp_setzero_v2r8();
411 fjy0 = _fjsp_setzero_v2r8();
412 fjz0 = _fjsp_setzero_v2r8();
414 /**************************
415 * CALCULATE INTERACTIONS *
416 **************************/
418 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
421 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
423 /* Compute parameters for interactions between i and j atoms */
424 qq00 = _fjsp_mul_v2r8(iq0,jq0);
425 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
427 /* REACTION-FIELD ELECTROSTATICS */
428 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
429 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
431 /* LENNARD-JONES DISPERSION/REPULSION */
433 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
434 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
435 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
436 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
437 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
439 d = _fjsp_sub_v2r8(r00,rswitch);
440 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
441 d2 = _fjsp_mul_v2r8(d,d);
442 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
444 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
446 /* Evaluate switch function */
447 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
448 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
449 vvdw = _fjsp_mul_v2r8(vvdw,sw);
450 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
452 /* Update potential sum for this i atom from the interaction with this j atom. */
453 velec = _fjsp_and_v2r8(velec,cutoff_mask);
454 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
455 velecsum = _fjsp_add_v2r8(velecsum,velec);
456 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
457 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
458 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
460 fscal = _fjsp_add_v2r8(felec,fvdw);
462 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
464 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
466 /* Update vectorial force */
467 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
468 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
469 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
471 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
472 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
473 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
481 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
484 /* Compute parameters for interactions between i and j atoms */
485 qq10 = _fjsp_mul_v2r8(iq1,jq0);
487 /* REACTION-FIELD ELECTROSTATICS */
488 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
489 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
491 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
493 /* Update potential sum for this i atom from the interaction with this j atom. */
494 velec = _fjsp_and_v2r8(velec,cutoff_mask);
495 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
496 velecsum = _fjsp_add_v2r8(velecsum,velec);
500 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
502 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
504 /* Update vectorial force */
505 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
506 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
507 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
509 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
510 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
511 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
515 /**************************
516 * CALCULATE INTERACTIONS *
517 **************************/
519 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
522 /* Compute parameters for interactions between i and j atoms */
523 qq20 = _fjsp_mul_v2r8(iq2,jq0);
525 /* REACTION-FIELD ELECTROSTATICS */
526 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
527 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
529 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
531 /* Update potential sum for this i atom from the interaction with this j atom. */
532 velec = _fjsp_and_v2r8(velec,cutoff_mask);
533 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
534 velecsum = _fjsp_add_v2r8(velecsum,velec);
538 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
540 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
542 /* Update vectorial force */
543 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
544 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
545 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
547 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
548 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
549 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
553 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
555 /* Inner loop uses 154 flops */
558 /* End of innermost loop */
560 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
561 f+i_coord_offset,fshift+i_shift_offset);
564 /* Update potential energies */
565 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
566 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
568 /* Increment number of inner iterations */
569 inneriter += j_index_end - j_index_start;
571 /* Outer loop uses 20 flops */
574 /* Increment number of outer iterations */
577 /* Update outer/inner flops */
579 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*154);
582 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
583 * Electrostatics interaction: ReactionField
584 * VdW interaction: LennardJones
585 * Geometry: Water3-Particle
586 * Calculate force/pot: Force
589 nb_kernel_ElecRFCut_VdwLJSw_GeomW3P1_F_sparc64_hpc_ace_double
590 (t_nblist * gmx_restrict nlist,
591 rvec * gmx_restrict xx,
592 rvec * gmx_restrict ff,
593 t_forcerec * gmx_restrict fr,
594 t_mdatoms * gmx_restrict mdatoms,
595 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
596 t_nrnb * gmx_restrict nrnb)
598 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
599 * just 0 for non-waters.
600 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
601 * jnr indices corresponding to data put in the four positions in the SIMD register.
603 int i_shift_offset,i_coord_offset,outeriter,inneriter;
604 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
606 int j_coord_offsetA,j_coord_offsetB;
607 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
609 real *shiftvec,*fshift,*x,*f;
610 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
612 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
614 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
616 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
617 int vdwjidx0A,vdwjidx0B;
618 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
619 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
620 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
621 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
622 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
625 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
628 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
629 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
630 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
631 real rswitch_scalar,d_scalar;
633 _fjsp_v2r8 dummy_mask,cutoff_mask;
634 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
635 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
636 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
643 jindex = nlist->jindex;
645 shiftidx = nlist->shift;
647 shiftvec = fr->shift_vec[0];
648 fshift = fr->fshift[0];
649 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
650 charge = mdatoms->chargeA;
651 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
652 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
653 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
654 nvdwtype = fr->ntype;
656 vdwtype = mdatoms->typeA;
658 /* Setup water-specific parameters */
659 inr = nlist->iinr[0];
660 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
661 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
662 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
663 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
665 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
666 rcutoff_scalar = fr->rcoulomb;
667 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
668 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
670 rswitch_scalar = fr->rvdw_switch;
671 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
672 /* Setup switch parameters */
673 d_scalar = rcutoff_scalar-rswitch_scalar;
674 d = gmx_fjsp_set1_v2r8(d_scalar);
675 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
676 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
677 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
678 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
679 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
680 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
682 /* Avoid stupid compiler warnings */
690 /* Start outer loop over neighborlists */
691 for(iidx=0; iidx<nri; iidx++)
693 /* Load shift vector for this list */
694 i_shift_offset = DIM*shiftidx[iidx];
696 /* Load limits for loop over neighbors */
697 j_index_start = jindex[iidx];
698 j_index_end = jindex[iidx+1];
700 /* Get outer coordinate index */
702 i_coord_offset = DIM*inr;
704 /* Load i particle coords and add shift vector */
705 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
706 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
708 fix0 = _fjsp_setzero_v2r8();
709 fiy0 = _fjsp_setzero_v2r8();
710 fiz0 = _fjsp_setzero_v2r8();
711 fix1 = _fjsp_setzero_v2r8();
712 fiy1 = _fjsp_setzero_v2r8();
713 fiz1 = _fjsp_setzero_v2r8();
714 fix2 = _fjsp_setzero_v2r8();
715 fiy2 = _fjsp_setzero_v2r8();
716 fiz2 = _fjsp_setzero_v2r8();
718 /* Start inner kernel loop */
719 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
722 /* Get j neighbor index, and coordinate index */
725 j_coord_offsetA = DIM*jnrA;
726 j_coord_offsetB = DIM*jnrB;
728 /* load j atom coordinates */
729 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
732 /* Calculate displacement vector */
733 dx00 = _fjsp_sub_v2r8(ix0,jx0);
734 dy00 = _fjsp_sub_v2r8(iy0,jy0);
735 dz00 = _fjsp_sub_v2r8(iz0,jz0);
736 dx10 = _fjsp_sub_v2r8(ix1,jx0);
737 dy10 = _fjsp_sub_v2r8(iy1,jy0);
738 dz10 = _fjsp_sub_v2r8(iz1,jz0);
739 dx20 = _fjsp_sub_v2r8(ix2,jx0);
740 dy20 = _fjsp_sub_v2r8(iy2,jy0);
741 dz20 = _fjsp_sub_v2r8(iz2,jz0);
743 /* Calculate squared distance and things based on it */
744 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
745 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
746 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
748 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
749 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
750 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
752 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
753 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
754 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
756 /* Load parameters for j particles */
757 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
758 vdwjidx0A = 2*vdwtype[jnrA+0];
759 vdwjidx0B = 2*vdwtype[jnrB+0];
761 fjx0 = _fjsp_setzero_v2r8();
762 fjy0 = _fjsp_setzero_v2r8();
763 fjz0 = _fjsp_setzero_v2r8();
765 /**************************
766 * CALCULATE INTERACTIONS *
767 **************************/
769 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
772 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
774 /* Compute parameters for interactions between i and j atoms */
775 qq00 = _fjsp_mul_v2r8(iq0,jq0);
776 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
777 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
779 /* REACTION-FIELD ELECTROSTATICS */
780 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
782 /* LENNARD-JONES DISPERSION/REPULSION */
784 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
785 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
786 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
787 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
788 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
790 d = _fjsp_sub_v2r8(r00,rswitch);
791 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
792 d2 = _fjsp_mul_v2r8(d,d);
793 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
795 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
797 /* Evaluate switch function */
798 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
799 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
800 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
802 fscal = _fjsp_add_v2r8(felec,fvdw);
804 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
806 /* Update vectorial force */
807 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
808 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
809 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
811 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
812 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
813 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
817 /**************************
818 * CALCULATE INTERACTIONS *
819 **************************/
821 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
824 /* Compute parameters for interactions between i and j atoms */
825 qq10 = _fjsp_mul_v2r8(iq1,jq0);
827 /* REACTION-FIELD ELECTROSTATICS */
828 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
830 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
834 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
836 /* Update vectorial force */
837 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
838 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
839 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
841 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
842 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
843 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
847 /**************************
848 * CALCULATE INTERACTIONS *
849 **************************/
851 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
854 /* Compute parameters for interactions between i and j atoms */
855 qq20 = _fjsp_mul_v2r8(iq2,jq0);
857 /* REACTION-FIELD ELECTROSTATICS */
858 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
860 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
864 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
866 /* Update vectorial force */
867 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
868 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
869 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
871 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
872 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
873 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
877 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
879 /* Inner loop uses 133 flops */
886 j_coord_offsetA = DIM*jnrA;
888 /* load j atom coordinates */
889 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
892 /* Calculate displacement vector */
893 dx00 = _fjsp_sub_v2r8(ix0,jx0);
894 dy00 = _fjsp_sub_v2r8(iy0,jy0);
895 dz00 = _fjsp_sub_v2r8(iz0,jz0);
896 dx10 = _fjsp_sub_v2r8(ix1,jx0);
897 dy10 = _fjsp_sub_v2r8(iy1,jy0);
898 dz10 = _fjsp_sub_v2r8(iz1,jz0);
899 dx20 = _fjsp_sub_v2r8(ix2,jx0);
900 dy20 = _fjsp_sub_v2r8(iy2,jy0);
901 dz20 = _fjsp_sub_v2r8(iz2,jz0);
903 /* Calculate squared distance and things based on it */
904 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
905 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
906 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
908 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
909 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
910 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
912 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
913 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
914 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
916 /* Load parameters for j particles */
917 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
918 vdwjidx0A = 2*vdwtype[jnrA+0];
920 fjx0 = _fjsp_setzero_v2r8();
921 fjy0 = _fjsp_setzero_v2r8();
922 fjz0 = _fjsp_setzero_v2r8();
924 /**************************
925 * CALCULATE INTERACTIONS *
926 **************************/
928 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
931 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
933 /* Compute parameters for interactions between i and j atoms */
934 qq00 = _fjsp_mul_v2r8(iq0,jq0);
935 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
937 /* REACTION-FIELD ELECTROSTATICS */
938 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
940 /* LENNARD-JONES DISPERSION/REPULSION */
942 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
943 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
944 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
945 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
946 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
948 d = _fjsp_sub_v2r8(r00,rswitch);
949 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
950 d2 = _fjsp_mul_v2r8(d,d);
951 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
953 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
955 /* Evaluate switch function */
956 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
957 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
958 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
960 fscal = _fjsp_add_v2r8(felec,fvdw);
962 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
964 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
966 /* Update vectorial force */
967 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
968 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
969 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
971 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
972 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
973 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
977 /**************************
978 * CALCULATE INTERACTIONS *
979 **************************/
981 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
984 /* Compute parameters for interactions between i and j atoms */
985 qq10 = _fjsp_mul_v2r8(iq1,jq0);
987 /* REACTION-FIELD ELECTROSTATICS */
988 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
990 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
994 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
996 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
998 /* Update vectorial force */
999 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1000 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1001 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1003 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1004 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1005 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1009 /**************************
1010 * CALCULATE INTERACTIONS *
1011 **************************/
1013 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1016 /* Compute parameters for interactions between i and j atoms */
1017 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1019 /* REACTION-FIELD ELECTROSTATICS */
1020 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1022 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1026 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1028 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1030 /* Update vectorial force */
1031 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1032 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1033 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1035 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1036 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1037 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1041 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1043 /* Inner loop uses 133 flops */
1046 /* End of innermost loop */
1048 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1049 f+i_coord_offset,fshift+i_shift_offset);
1051 /* Increment number of inner iterations */
1052 inneriter += j_index_end - j_index_start;
1054 /* Outer loop uses 18 flops */
1057 /* Increment number of outer iterations */
1060 /* Update outer/inner flops */
1062 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*133);