2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_VF_sparc64_hpc_ace_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
96 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
100 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
102 real rswitch_scalar,d_scalar;
104 _fjsp_v2r8 dummy_mask,cutoff_mask;
105 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
106 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
107 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
114 jindex = nlist->jindex;
116 shiftidx = nlist->shift;
118 shiftvec = fr->shift_vec[0];
119 fshift = fr->fshift[0];
120 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
121 charge = mdatoms->chargeA;
122 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
123 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
124 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
125 nvdwtype = fr->ntype;
127 vdwtype = mdatoms->typeA;
129 /* Setup water-specific parameters */
130 inr = nlist->iinr[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 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
134 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
136 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
137 rcutoff_scalar = fr->rcoulomb;
138 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
139 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
141 rswitch_scalar = fr->rvdw_switch;
142 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
143 /* Setup switch parameters */
144 d_scalar = rcutoff_scalar-rswitch_scalar;
145 d = gmx_fjsp_set1_v2r8(d_scalar);
146 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
147 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
148 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
149 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
150 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
151 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
153 /* Avoid stupid compiler warnings */
161 /* Start outer loop over neighborlists */
162 for(iidx=0; iidx<nri; iidx++)
164 /* Load shift vector for this list */
165 i_shift_offset = DIM*shiftidx[iidx];
167 /* Load limits for loop over neighbors */
168 j_index_start = jindex[iidx];
169 j_index_end = jindex[iidx+1];
171 /* Get outer coordinate index */
173 i_coord_offset = DIM*inr;
175 /* Load i particle coords and add shift vector */
176 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
177 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
179 fix0 = _fjsp_setzero_v2r8();
180 fiy0 = _fjsp_setzero_v2r8();
181 fiz0 = _fjsp_setzero_v2r8();
182 fix1 = _fjsp_setzero_v2r8();
183 fiy1 = _fjsp_setzero_v2r8();
184 fiz1 = _fjsp_setzero_v2r8();
185 fix2 = _fjsp_setzero_v2r8();
186 fiy2 = _fjsp_setzero_v2r8();
187 fiz2 = _fjsp_setzero_v2r8();
188 fix3 = _fjsp_setzero_v2r8();
189 fiy3 = _fjsp_setzero_v2r8();
190 fiz3 = _fjsp_setzero_v2r8();
192 /* Reset potential sums */
193 velecsum = _fjsp_setzero_v2r8();
194 vvdwsum = _fjsp_setzero_v2r8();
196 /* Start inner kernel loop */
197 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
200 /* Get j neighbor index, and coordinate index */
203 j_coord_offsetA = DIM*jnrA;
204 j_coord_offsetB = DIM*jnrB;
206 /* load j atom coordinates */
207 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
210 /* Calculate displacement vector */
211 dx00 = _fjsp_sub_v2r8(ix0,jx0);
212 dy00 = _fjsp_sub_v2r8(iy0,jy0);
213 dz00 = _fjsp_sub_v2r8(iz0,jz0);
214 dx10 = _fjsp_sub_v2r8(ix1,jx0);
215 dy10 = _fjsp_sub_v2r8(iy1,jy0);
216 dz10 = _fjsp_sub_v2r8(iz1,jz0);
217 dx20 = _fjsp_sub_v2r8(ix2,jx0);
218 dy20 = _fjsp_sub_v2r8(iy2,jy0);
219 dz20 = _fjsp_sub_v2r8(iz2,jz0);
220 dx30 = _fjsp_sub_v2r8(ix3,jx0);
221 dy30 = _fjsp_sub_v2r8(iy3,jy0);
222 dz30 = _fjsp_sub_v2r8(iz3,jz0);
224 /* Calculate squared distance and things based on it */
225 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
226 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
227 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
228 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
230 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
231 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
232 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
233 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
235 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
236 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
237 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
238 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
240 /* Load parameters for j particles */
241 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
242 vdwjidx0A = 2*vdwtype[jnrA+0];
243 vdwjidx0B = 2*vdwtype[jnrB+0];
245 fjx0 = _fjsp_setzero_v2r8();
246 fjy0 = _fjsp_setzero_v2r8();
247 fjz0 = _fjsp_setzero_v2r8();
249 /**************************
250 * CALCULATE INTERACTIONS *
251 **************************/
253 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
256 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
258 /* Compute parameters for interactions between i and j atoms */
259 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
260 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
262 /* LENNARD-JONES DISPERSION/REPULSION */
264 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
265 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
266 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
267 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
268 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
270 d = _fjsp_sub_v2r8(r00,rswitch);
271 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
272 d2 = _fjsp_mul_v2r8(d,d);
273 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
275 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
277 /* Evaluate switch function */
278 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
279 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
280 vvdw = _fjsp_mul_v2r8(vvdw,sw);
281 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
283 /* Update potential sum for this i atom from the interaction with this j atom. */
284 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
285 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
289 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
291 /* Update vectorial force */
292 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
293 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
294 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
296 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
297 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
298 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
309 /* Compute parameters for interactions between i and j atoms */
310 qq10 = _fjsp_mul_v2r8(iq1,jq0);
312 /* REACTION-FIELD ELECTROSTATICS */
313 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
314 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
316 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
318 /* Update potential sum for this i atom from the interaction with this j atom. */
319 velec = _fjsp_and_v2r8(velec,cutoff_mask);
320 velecsum = _fjsp_add_v2r8(velecsum,velec);
324 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
326 /* Update vectorial force */
327 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
328 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
329 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
331 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
332 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
333 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
337 /**************************
338 * CALCULATE INTERACTIONS *
339 **************************/
341 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
344 /* Compute parameters for interactions between i and j atoms */
345 qq20 = _fjsp_mul_v2r8(iq2,jq0);
347 /* REACTION-FIELD ELECTROSTATICS */
348 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
349 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
351 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
353 /* Update potential sum for this i atom from the interaction with this j atom. */
354 velec = _fjsp_and_v2r8(velec,cutoff_mask);
355 velecsum = _fjsp_add_v2r8(velecsum,velec);
359 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
361 /* Update vectorial force */
362 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
363 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
364 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
366 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
367 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
368 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
372 /**************************
373 * CALCULATE INTERACTIONS *
374 **************************/
376 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
379 /* Compute parameters for interactions between i and j atoms */
380 qq30 = _fjsp_mul_v2r8(iq3,jq0);
382 /* REACTION-FIELD ELECTROSTATICS */
383 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
384 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
386 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
388 /* Update potential sum for this i atom from the interaction with this j atom. */
389 velec = _fjsp_and_v2r8(velec,cutoff_mask);
390 velecsum = _fjsp_add_v2r8(velecsum,velec);
394 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
396 /* Update vectorial force */
397 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
398 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
399 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
401 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
402 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
403 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
407 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
409 /* Inner loop uses 182 flops */
416 j_coord_offsetA = DIM*jnrA;
418 /* load j atom coordinates */
419 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
422 /* Calculate displacement vector */
423 dx00 = _fjsp_sub_v2r8(ix0,jx0);
424 dy00 = _fjsp_sub_v2r8(iy0,jy0);
425 dz00 = _fjsp_sub_v2r8(iz0,jz0);
426 dx10 = _fjsp_sub_v2r8(ix1,jx0);
427 dy10 = _fjsp_sub_v2r8(iy1,jy0);
428 dz10 = _fjsp_sub_v2r8(iz1,jz0);
429 dx20 = _fjsp_sub_v2r8(ix2,jx0);
430 dy20 = _fjsp_sub_v2r8(iy2,jy0);
431 dz20 = _fjsp_sub_v2r8(iz2,jz0);
432 dx30 = _fjsp_sub_v2r8(ix3,jx0);
433 dy30 = _fjsp_sub_v2r8(iy3,jy0);
434 dz30 = _fjsp_sub_v2r8(iz3,jz0);
436 /* Calculate squared distance and things based on it */
437 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
438 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
439 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
440 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
442 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
443 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
444 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
445 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
447 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
448 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
449 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
450 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
452 /* Load parameters for j particles */
453 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
454 vdwjidx0A = 2*vdwtype[jnrA+0];
456 fjx0 = _fjsp_setzero_v2r8();
457 fjy0 = _fjsp_setzero_v2r8();
458 fjz0 = _fjsp_setzero_v2r8();
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
467 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
469 /* Compute parameters for interactions between i and j atoms */
470 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
472 /* LENNARD-JONES DISPERSION/REPULSION */
474 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
475 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
476 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
477 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
478 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
480 d = _fjsp_sub_v2r8(r00,rswitch);
481 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
482 d2 = _fjsp_mul_v2r8(d,d);
483 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
485 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
487 /* Evaluate switch function */
488 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
489 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
490 vvdw = _fjsp_mul_v2r8(vvdw,sw);
491 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
493 /* Update potential sum for this i atom from the interaction with this j atom. */
494 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
495 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
496 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
500 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
502 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
504 /* Update vectorial force */
505 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
506 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
507 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
509 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
510 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
511 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
515 /**************************
516 * CALCULATE INTERACTIONS *
517 **************************/
519 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
522 /* Compute parameters for interactions between i and j atoms */
523 qq10 = _fjsp_mul_v2r8(iq1,jq0);
525 /* REACTION-FIELD ELECTROSTATICS */
526 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
527 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
529 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,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 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
544 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
545 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
547 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
548 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
549 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
553 /**************************
554 * CALCULATE INTERACTIONS *
555 **************************/
557 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
560 /* Compute parameters for interactions between i and j atoms */
561 qq20 = _fjsp_mul_v2r8(iq2,jq0);
563 /* REACTION-FIELD ELECTROSTATICS */
564 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
565 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
567 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
569 /* Update potential sum for this i atom from the interaction with this j atom. */
570 velec = _fjsp_and_v2r8(velec,cutoff_mask);
571 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
572 velecsum = _fjsp_add_v2r8(velecsum,velec);
576 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
578 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
580 /* Update vectorial force */
581 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
582 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
583 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
585 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
586 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
587 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
591 /**************************
592 * CALCULATE INTERACTIONS *
593 **************************/
595 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
598 /* Compute parameters for interactions between i and j atoms */
599 qq30 = _fjsp_mul_v2r8(iq3,jq0);
601 /* REACTION-FIELD ELECTROSTATICS */
602 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
603 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
605 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
607 /* Update potential sum for this i atom from the interaction with this j atom. */
608 velec = _fjsp_and_v2r8(velec,cutoff_mask);
609 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
610 velecsum = _fjsp_add_v2r8(velecsum,velec);
614 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
616 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
618 /* Update vectorial force */
619 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
620 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
621 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
623 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
624 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
625 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
629 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
631 /* Inner loop uses 182 flops */
634 /* End of innermost loop */
636 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
637 f+i_coord_offset,fshift+i_shift_offset);
640 /* Update potential energies */
641 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
642 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
644 /* Increment number of inner iterations */
645 inneriter += j_index_end - j_index_start;
647 /* Outer loop uses 26 flops */
650 /* Increment number of outer iterations */
653 /* Update outer/inner flops */
655 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*182);
658 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
659 * Electrostatics interaction: ReactionField
660 * VdW interaction: LennardJones
661 * Geometry: Water4-Particle
662 * Calculate force/pot: Force
665 nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
666 (t_nblist * gmx_restrict nlist,
667 rvec * gmx_restrict xx,
668 rvec * gmx_restrict ff,
669 t_forcerec * gmx_restrict fr,
670 t_mdatoms * gmx_restrict mdatoms,
671 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
672 t_nrnb * gmx_restrict nrnb)
674 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
675 * just 0 for non-waters.
676 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
677 * jnr indices corresponding to data put in the four positions in the SIMD register.
679 int i_shift_offset,i_coord_offset,outeriter,inneriter;
680 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
682 int j_coord_offsetA,j_coord_offsetB;
683 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
685 real *shiftvec,*fshift,*x,*f;
686 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
688 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
690 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
692 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
694 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
695 int vdwjidx0A,vdwjidx0B;
696 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
697 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
698 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
699 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
700 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
701 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
704 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
707 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
708 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
709 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
710 real rswitch_scalar,d_scalar;
712 _fjsp_v2r8 dummy_mask,cutoff_mask;
713 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
714 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
715 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
722 jindex = nlist->jindex;
724 shiftidx = nlist->shift;
726 shiftvec = fr->shift_vec[0];
727 fshift = fr->fshift[0];
728 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
729 charge = mdatoms->chargeA;
730 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
731 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
732 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
733 nvdwtype = fr->ntype;
735 vdwtype = mdatoms->typeA;
737 /* Setup water-specific parameters */
738 inr = nlist->iinr[0];
739 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
740 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
741 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
742 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
744 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
745 rcutoff_scalar = fr->rcoulomb;
746 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
747 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
749 rswitch_scalar = fr->rvdw_switch;
750 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
751 /* Setup switch parameters */
752 d_scalar = rcutoff_scalar-rswitch_scalar;
753 d = gmx_fjsp_set1_v2r8(d_scalar);
754 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
755 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
756 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
757 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
758 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
759 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
761 /* Avoid stupid compiler warnings */
769 /* Start outer loop over neighborlists */
770 for(iidx=0; iidx<nri; iidx++)
772 /* Load shift vector for this list */
773 i_shift_offset = DIM*shiftidx[iidx];
775 /* Load limits for loop over neighbors */
776 j_index_start = jindex[iidx];
777 j_index_end = jindex[iidx+1];
779 /* Get outer coordinate index */
781 i_coord_offset = DIM*inr;
783 /* Load i particle coords and add shift vector */
784 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
785 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
787 fix0 = _fjsp_setzero_v2r8();
788 fiy0 = _fjsp_setzero_v2r8();
789 fiz0 = _fjsp_setzero_v2r8();
790 fix1 = _fjsp_setzero_v2r8();
791 fiy1 = _fjsp_setzero_v2r8();
792 fiz1 = _fjsp_setzero_v2r8();
793 fix2 = _fjsp_setzero_v2r8();
794 fiy2 = _fjsp_setzero_v2r8();
795 fiz2 = _fjsp_setzero_v2r8();
796 fix3 = _fjsp_setzero_v2r8();
797 fiy3 = _fjsp_setzero_v2r8();
798 fiz3 = _fjsp_setzero_v2r8();
800 /* Start inner kernel loop */
801 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
804 /* Get j neighbor index, and coordinate index */
807 j_coord_offsetA = DIM*jnrA;
808 j_coord_offsetB = DIM*jnrB;
810 /* load j atom coordinates */
811 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
814 /* Calculate displacement vector */
815 dx00 = _fjsp_sub_v2r8(ix0,jx0);
816 dy00 = _fjsp_sub_v2r8(iy0,jy0);
817 dz00 = _fjsp_sub_v2r8(iz0,jz0);
818 dx10 = _fjsp_sub_v2r8(ix1,jx0);
819 dy10 = _fjsp_sub_v2r8(iy1,jy0);
820 dz10 = _fjsp_sub_v2r8(iz1,jz0);
821 dx20 = _fjsp_sub_v2r8(ix2,jx0);
822 dy20 = _fjsp_sub_v2r8(iy2,jy0);
823 dz20 = _fjsp_sub_v2r8(iz2,jz0);
824 dx30 = _fjsp_sub_v2r8(ix3,jx0);
825 dy30 = _fjsp_sub_v2r8(iy3,jy0);
826 dz30 = _fjsp_sub_v2r8(iz3,jz0);
828 /* Calculate squared distance and things based on it */
829 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
830 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
831 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
832 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
834 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
835 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
836 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
837 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
839 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
840 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
841 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
842 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
844 /* Load parameters for j particles */
845 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
846 vdwjidx0A = 2*vdwtype[jnrA+0];
847 vdwjidx0B = 2*vdwtype[jnrB+0];
849 fjx0 = _fjsp_setzero_v2r8();
850 fjy0 = _fjsp_setzero_v2r8();
851 fjz0 = _fjsp_setzero_v2r8();
853 /**************************
854 * CALCULATE INTERACTIONS *
855 **************************/
857 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
860 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
862 /* Compute parameters for interactions between i and j atoms */
863 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
864 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
866 /* LENNARD-JONES DISPERSION/REPULSION */
868 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
869 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
870 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
871 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
872 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
874 d = _fjsp_sub_v2r8(r00,rswitch);
875 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
876 d2 = _fjsp_mul_v2r8(d,d);
877 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
879 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
881 /* Evaluate switch function */
882 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
883 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
884 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
888 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
890 /* Update vectorial force */
891 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
892 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
893 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
895 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
896 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
897 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
901 /**************************
902 * CALCULATE INTERACTIONS *
903 **************************/
905 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
908 /* Compute parameters for interactions between i and j atoms */
909 qq10 = _fjsp_mul_v2r8(iq1,jq0);
911 /* REACTION-FIELD ELECTROSTATICS */
912 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
914 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
918 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
920 /* Update vectorial force */
921 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
922 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
923 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
925 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
926 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
927 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
931 /**************************
932 * CALCULATE INTERACTIONS *
933 **************************/
935 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
938 /* Compute parameters for interactions between i and j atoms */
939 qq20 = _fjsp_mul_v2r8(iq2,jq0);
941 /* REACTION-FIELD ELECTROSTATICS */
942 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
944 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
948 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
950 /* Update vectorial force */
951 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
952 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
953 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
955 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
956 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
957 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
961 /**************************
962 * CALCULATE INTERACTIONS *
963 **************************/
965 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
968 /* Compute parameters for interactions between i and j atoms */
969 qq30 = _fjsp_mul_v2r8(iq3,jq0);
971 /* REACTION-FIELD ELECTROSTATICS */
972 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
974 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
978 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
980 /* Update vectorial force */
981 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
982 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
983 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
985 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
986 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
987 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
991 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
993 /* Inner loop uses 161 flops */
1000 j_coord_offsetA = DIM*jnrA;
1002 /* load j atom coordinates */
1003 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1006 /* Calculate displacement vector */
1007 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1008 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1009 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1010 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1011 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1012 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1013 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1014 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1015 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1016 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1017 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1018 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1020 /* Calculate squared distance and things based on it */
1021 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1022 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1023 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1024 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1026 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1027 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1028 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1029 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1031 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1032 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1033 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1034 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1036 /* Load parameters for j particles */
1037 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1038 vdwjidx0A = 2*vdwtype[jnrA+0];
1040 fjx0 = _fjsp_setzero_v2r8();
1041 fjy0 = _fjsp_setzero_v2r8();
1042 fjz0 = _fjsp_setzero_v2r8();
1044 /**************************
1045 * CALCULATE INTERACTIONS *
1046 **************************/
1048 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1051 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1053 /* Compute parameters for interactions between i and j atoms */
1054 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1056 /* LENNARD-JONES DISPERSION/REPULSION */
1058 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1059 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
1060 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
1061 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
1062 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
1064 d = _fjsp_sub_v2r8(r00,rswitch);
1065 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
1066 d2 = _fjsp_mul_v2r8(d,d);
1067 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
1069 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
1071 /* Evaluate switch function */
1072 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1073 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
1074 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1078 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1080 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1082 /* Update vectorial force */
1083 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1084 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1085 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1087 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1088 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1089 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1093 /**************************
1094 * CALCULATE INTERACTIONS *
1095 **************************/
1097 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1100 /* Compute parameters for interactions between i and j atoms */
1101 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1103 /* REACTION-FIELD ELECTROSTATICS */
1104 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1106 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1110 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1112 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1114 /* Update vectorial force */
1115 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1116 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1117 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1119 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1120 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1121 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1125 /**************************
1126 * CALCULATE INTERACTIONS *
1127 **************************/
1129 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1132 /* Compute parameters for interactions between i and j atoms */
1133 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1135 /* REACTION-FIELD ELECTROSTATICS */
1136 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1138 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1142 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1144 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1146 /* Update vectorial force */
1147 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1148 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1149 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1151 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1152 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1153 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1157 /**************************
1158 * CALCULATE INTERACTIONS *
1159 **************************/
1161 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1164 /* Compute parameters for interactions between i and j atoms */
1165 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1167 /* REACTION-FIELD ELECTROSTATICS */
1168 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1170 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1174 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1176 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1178 /* Update vectorial force */
1179 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1180 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1181 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1183 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1184 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1185 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1189 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1191 /* Inner loop uses 161 flops */
1194 /* End of innermost loop */
1196 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1197 f+i_coord_offset,fshift+i_shift_offset);
1199 /* Increment number of inner iterations */
1200 inneriter += j_index_end - j_index_start;
1202 /* Outer loop uses 24 flops */
1205 /* Increment number of outer iterations */
1208 /* Update outer/inner flops */
1210 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*161);