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_GeomW4P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: LennardJones
55 * Geometry: Water4-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_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;
88 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89 int vdwjidx0A,vdwjidx0B;
90 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
98 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
101 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
102 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
104 real rswitch_scalar,d_scalar;
106 _fjsp_v2r8 dummy_mask,cutoff_mask;
107 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
108 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
109 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
116 jindex = nlist->jindex;
118 shiftidx = nlist->shift;
120 shiftvec = fr->shift_vec[0];
121 fshift = fr->fshift[0];
122 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
123 charge = mdatoms->chargeA;
124 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
125 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
126 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
127 nvdwtype = fr->ntype;
129 vdwtype = mdatoms->typeA;
131 /* Setup water-specific parameters */
132 inr = nlist->iinr[0];
133 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
134 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
135 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
136 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
138 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
139 rcutoff_scalar = fr->rcoulomb;
140 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
141 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
143 rswitch_scalar = fr->rvdw_switch;
144 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
145 /* Setup switch parameters */
146 d_scalar = rcutoff_scalar-rswitch_scalar;
147 d = gmx_fjsp_set1_v2r8(d_scalar);
148 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
149 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
150 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
151 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
152 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
153 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
155 /* Avoid stupid compiler warnings */
163 /* Start outer loop over neighborlists */
164 for(iidx=0; iidx<nri; iidx++)
166 /* Load shift vector for this list */
167 i_shift_offset = DIM*shiftidx[iidx];
169 /* Load limits for loop over neighbors */
170 j_index_start = jindex[iidx];
171 j_index_end = jindex[iidx+1];
173 /* Get outer coordinate index */
175 i_coord_offset = DIM*inr;
177 /* Load i particle coords and add shift vector */
178 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
179 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
181 fix0 = _fjsp_setzero_v2r8();
182 fiy0 = _fjsp_setzero_v2r8();
183 fiz0 = _fjsp_setzero_v2r8();
184 fix1 = _fjsp_setzero_v2r8();
185 fiy1 = _fjsp_setzero_v2r8();
186 fiz1 = _fjsp_setzero_v2r8();
187 fix2 = _fjsp_setzero_v2r8();
188 fiy2 = _fjsp_setzero_v2r8();
189 fiz2 = _fjsp_setzero_v2r8();
190 fix3 = _fjsp_setzero_v2r8();
191 fiy3 = _fjsp_setzero_v2r8();
192 fiz3 = _fjsp_setzero_v2r8();
194 /* Reset potential sums */
195 velecsum = _fjsp_setzero_v2r8();
196 vvdwsum = _fjsp_setzero_v2r8();
198 /* Start inner kernel loop */
199 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
202 /* Get j neighbor index, and coordinate index */
205 j_coord_offsetA = DIM*jnrA;
206 j_coord_offsetB = DIM*jnrB;
208 /* load j atom coordinates */
209 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
212 /* Calculate displacement vector */
213 dx00 = _fjsp_sub_v2r8(ix0,jx0);
214 dy00 = _fjsp_sub_v2r8(iy0,jy0);
215 dz00 = _fjsp_sub_v2r8(iz0,jz0);
216 dx10 = _fjsp_sub_v2r8(ix1,jx0);
217 dy10 = _fjsp_sub_v2r8(iy1,jy0);
218 dz10 = _fjsp_sub_v2r8(iz1,jz0);
219 dx20 = _fjsp_sub_v2r8(ix2,jx0);
220 dy20 = _fjsp_sub_v2r8(iy2,jy0);
221 dz20 = _fjsp_sub_v2r8(iz2,jz0);
222 dx30 = _fjsp_sub_v2r8(ix3,jx0);
223 dy30 = _fjsp_sub_v2r8(iy3,jy0);
224 dz30 = _fjsp_sub_v2r8(iz3,jz0);
226 /* Calculate squared distance and things based on it */
227 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
228 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
229 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
230 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
232 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
233 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
234 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
235 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
237 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
238 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
239 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
240 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
242 /* Load parameters for j particles */
243 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
244 vdwjidx0A = 2*vdwtype[jnrA+0];
245 vdwjidx0B = 2*vdwtype[jnrB+0];
247 fjx0 = _fjsp_setzero_v2r8();
248 fjy0 = _fjsp_setzero_v2r8();
249 fjz0 = _fjsp_setzero_v2r8();
251 /**************************
252 * CALCULATE INTERACTIONS *
253 **************************/
255 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
258 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
260 /* Compute parameters for interactions between i and j atoms */
261 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
262 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
264 /* LENNARD-JONES DISPERSION/REPULSION */
266 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
267 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
268 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
269 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
270 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
272 d = _fjsp_sub_v2r8(r00,rswitch);
273 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
274 d2 = _fjsp_mul_v2r8(d,d);
275 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
277 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
279 /* Evaluate switch function */
280 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
281 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
282 vvdw = _fjsp_mul_v2r8(vvdw,sw);
283 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
285 /* Update potential sum for this i atom from the interaction with this j atom. */
286 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
287 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
291 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
293 /* Update vectorial force */
294 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
295 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
296 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
298 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
299 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
300 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
311 /* Compute parameters for interactions between i and j atoms */
312 qq10 = _fjsp_mul_v2r8(iq1,jq0);
314 /* REACTION-FIELD ELECTROSTATICS */
315 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
316 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
318 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
320 /* Update potential sum for this i atom from the interaction with this j atom. */
321 velec = _fjsp_and_v2r8(velec,cutoff_mask);
322 velecsum = _fjsp_add_v2r8(velecsum,velec);
326 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
328 /* Update vectorial force */
329 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
330 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
331 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
333 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
334 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
335 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
339 /**************************
340 * CALCULATE INTERACTIONS *
341 **************************/
343 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
346 /* Compute parameters for interactions between i and j atoms */
347 qq20 = _fjsp_mul_v2r8(iq2,jq0);
349 /* REACTION-FIELD ELECTROSTATICS */
350 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
351 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
353 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
355 /* Update potential sum for this i atom from the interaction with this j atom. */
356 velec = _fjsp_and_v2r8(velec,cutoff_mask);
357 velecsum = _fjsp_add_v2r8(velecsum,velec);
361 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
363 /* Update vectorial force */
364 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
365 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
366 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
368 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
369 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
370 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
374 /**************************
375 * CALCULATE INTERACTIONS *
376 **************************/
378 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
381 /* Compute parameters for interactions between i and j atoms */
382 qq30 = _fjsp_mul_v2r8(iq3,jq0);
384 /* REACTION-FIELD ELECTROSTATICS */
385 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
386 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
388 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
390 /* Update potential sum for this i atom from the interaction with this j atom. */
391 velec = _fjsp_and_v2r8(velec,cutoff_mask);
392 velecsum = _fjsp_add_v2r8(velecsum,velec);
396 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
398 /* Update vectorial force */
399 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
400 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
401 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
403 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
404 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
405 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
409 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
411 /* Inner loop uses 182 flops */
418 j_coord_offsetA = DIM*jnrA;
420 /* load j atom coordinates */
421 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
424 /* Calculate displacement vector */
425 dx00 = _fjsp_sub_v2r8(ix0,jx0);
426 dy00 = _fjsp_sub_v2r8(iy0,jy0);
427 dz00 = _fjsp_sub_v2r8(iz0,jz0);
428 dx10 = _fjsp_sub_v2r8(ix1,jx0);
429 dy10 = _fjsp_sub_v2r8(iy1,jy0);
430 dz10 = _fjsp_sub_v2r8(iz1,jz0);
431 dx20 = _fjsp_sub_v2r8(ix2,jx0);
432 dy20 = _fjsp_sub_v2r8(iy2,jy0);
433 dz20 = _fjsp_sub_v2r8(iz2,jz0);
434 dx30 = _fjsp_sub_v2r8(ix3,jx0);
435 dy30 = _fjsp_sub_v2r8(iy3,jy0);
436 dz30 = _fjsp_sub_v2r8(iz3,jz0);
438 /* Calculate squared distance and things based on it */
439 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
440 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
441 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
442 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
444 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
445 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
446 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
447 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
449 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
450 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
451 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
452 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
454 /* Load parameters for j particles */
455 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
456 vdwjidx0A = 2*vdwtype[jnrA+0];
458 fjx0 = _fjsp_setzero_v2r8();
459 fjy0 = _fjsp_setzero_v2r8();
460 fjz0 = _fjsp_setzero_v2r8();
462 /**************************
463 * CALCULATE INTERACTIONS *
464 **************************/
466 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
469 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
471 /* Compute parameters for interactions between i and j atoms */
472 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
473 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
475 /* LENNARD-JONES DISPERSION/REPULSION */
477 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
478 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
479 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
480 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
481 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
483 d = _fjsp_sub_v2r8(r00,rswitch);
484 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
485 d2 = _fjsp_mul_v2r8(d,d);
486 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
488 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
490 /* Evaluate switch function */
491 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
492 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
493 vvdw = _fjsp_mul_v2r8(vvdw,sw);
494 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
496 /* Update potential sum for this i atom from the interaction with this j atom. */
497 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
498 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
499 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
503 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
505 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
507 /* Update vectorial force */
508 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
509 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
510 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
512 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
513 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
514 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
518 /**************************
519 * CALCULATE INTERACTIONS *
520 **************************/
522 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
525 /* Compute parameters for interactions between i and j atoms */
526 qq10 = _fjsp_mul_v2r8(iq1,jq0);
528 /* REACTION-FIELD ELECTROSTATICS */
529 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
530 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
532 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,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 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
547 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
548 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
550 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
551 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
552 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
556 /**************************
557 * CALCULATE INTERACTIONS *
558 **************************/
560 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
563 /* Compute parameters for interactions between i and j atoms */
564 qq20 = _fjsp_mul_v2r8(iq2,jq0);
566 /* REACTION-FIELD ELECTROSTATICS */
567 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
568 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
570 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
572 /* Update potential sum for this i atom from the interaction with this j atom. */
573 velec = _fjsp_and_v2r8(velec,cutoff_mask);
574 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
575 velecsum = _fjsp_add_v2r8(velecsum,velec);
579 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
581 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
583 /* Update vectorial force */
584 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
585 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
586 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
588 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
589 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
590 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
594 /**************************
595 * CALCULATE INTERACTIONS *
596 **************************/
598 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
601 /* Compute parameters for interactions between i and j atoms */
602 qq30 = _fjsp_mul_v2r8(iq3,jq0);
604 /* REACTION-FIELD ELECTROSTATICS */
605 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
606 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
608 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
610 /* Update potential sum for this i atom from the interaction with this j atom. */
611 velec = _fjsp_and_v2r8(velec,cutoff_mask);
612 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
613 velecsum = _fjsp_add_v2r8(velecsum,velec);
617 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
619 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
621 /* Update vectorial force */
622 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
623 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
624 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
626 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
627 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
628 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
632 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
634 /* Inner loop uses 182 flops */
637 /* End of innermost loop */
639 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
640 f+i_coord_offset,fshift+i_shift_offset);
643 /* Update potential energies */
644 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
645 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
647 /* Increment number of inner iterations */
648 inneriter += j_index_end - j_index_start;
650 /* Outer loop uses 26 flops */
653 /* Increment number of outer iterations */
656 /* Update outer/inner flops */
658 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*182);
661 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
662 * Electrostatics interaction: ReactionField
663 * VdW interaction: LennardJones
664 * Geometry: Water4-Particle
665 * Calculate force/pot: Force
668 nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
669 (t_nblist * gmx_restrict nlist,
670 rvec * gmx_restrict xx,
671 rvec * gmx_restrict ff,
672 t_forcerec * gmx_restrict fr,
673 t_mdatoms * gmx_restrict mdatoms,
674 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
675 t_nrnb * gmx_restrict nrnb)
677 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
678 * just 0 for non-waters.
679 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
680 * jnr indices corresponding to data put in the four positions in the SIMD register.
682 int i_shift_offset,i_coord_offset,outeriter,inneriter;
683 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
685 int j_coord_offsetA,j_coord_offsetB;
686 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
688 real *shiftvec,*fshift,*x,*f;
689 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
691 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
693 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
695 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
697 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
698 int vdwjidx0A,vdwjidx0B;
699 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
700 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
701 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
702 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
703 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
704 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
707 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
710 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
711 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
712 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
713 real rswitch_scalar,d_scalar;
715 _fjsp_v2r8 dummy_mask,cutoff_mask;
716 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
717 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
718 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
725 jindex = nlist->jindex;
727 shiftidx = nlist->shift;
729 shiftvec = fr->shift_vec[0];
730 fshift = fr->fshift[0];
731 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
732 charge = mdatoms->chargeA;
733 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
734 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
735 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
736 nvdwtype = fr->ntype;
738 vdwtype = mdatoms->typeA;
740 /* Setup water-specific parameters */
741 inr = nlist->iinr[0];
742 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
743 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
744 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
745 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
747 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
748 rcutoff_scalar = fr->rcoulomb;
749 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
750 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
752 rswitch_scalar = fr->rvdw_switch;
753 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
754 /* Setup switch parameters */
755 d_scalar = rcutoff_scalar-rswitch_scalar;
756 d = gmx_fjsp_set1_v2r8(d_scalar);
757 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
758 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
759 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
760 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
761 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
762 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
764 /* Avoid stupid compiler warnings */
772 /* Start outer loop over neighborlists */
773 for(iidx=0; iidx<nri; iidx++)
775 /* Load shift vector for this list */
776 i_shift_offset = DIM*shiftidx[iidx];
778 /* Load limits for loop over neighbors */
779 j_index_start = jindex[iidx];
780 j_index_end = jindex[iidx+1];
782 /* Get outer coordinate index */
784 i_coord_offset = DIM*inr;
786 /* Load i particle coords and add shift vector */
787 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
788 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
790 fix0 = _fjsp_setzero_v2r8();
791 fiy0 = _fjsp_setzero_v2r8();
792 fiz0 = _fjsp_setzero_v2r8();
793 fix1 = _fjsp_setzero_v2r8();
794 fiy1 = _fjsp_setzero_v2r8();
795 fiz1 = _fjsp_setzero_v2r8();
796 fix2 = _fjsp_setzero_v2r8();
797 fiy2 = _fjsp_setzero_v2r8();
798 fiz2 = _fjsp_setzero_v2r8();
799 fix3 = _fjsp_setzero_v2r8();
800 fiy3 = _fjsp_setzero_v2r8();
801 fiz3 = _fjsp_setzero_v2r8();
803 /* Start inner kernel loop */
804 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
807 /* Get j neighbor index, and coordinate index */
810 j_coord_offsetA = DIM*jnrA;
811 j_coord_offsetB = DIM*jnrB;
813 /* load j atom coordinates */
814 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
817 /* Calculate displacement vector */
818 dx00 = _fjsp_sub_v2r8(ix0,jx0);
819 dy00 = _fjsp_sub_v2r8(iy0,jy0);
820 dz00 = _fjsp_sub_v2r8(iz0,jz0);
821 dx10 = _fjsp_sub_v2r8(ix1,jx0);
822 dy10 = _fjsp_sub_v2r8(iy1,jy0);
823 dz10 = _fjsp_sub_v2r8(iz1,jz0);
824 dx20 = _fjsp_sub_v2r8(ix2,jx0);
825 dy20 = _fjsp_sub_v2r8(iy2,jy0);
826 dz20 = _fjsp_sub_v2r8(iz2,jz0);
827 dx30 = _fjsp_sub_v2r8(ix3,jx0);
828 dy30 = _fjsp_sub_v2r8(iy3,jy0);
829 dz30 = _fjsp_sub_v2r8(iz3,jz0);
831 /* Calculate squared distance and things based on it */
832 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
833 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
834 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
835 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
837 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
838 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
839 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
840 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
842 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
843 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
844 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
845 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
847 /* Load parameters for j particles */
848 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
849 vdwjidx0A = 2*vdwtype[jnrA+0];
850 vdwjidx0B = 2*vdwtype[jnrB+0];
852 fjx0 = _fjsp_setzero_v2r8();
853 fjy0 = _fjsp_setzero_v2r8();
854 fjz0 = _fjsp_setzero_v2r8();
856 /**************************
857 * CALCULATE INTERACTIONS *
858 **************************/
860 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
863 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
865 /* Compute parameters for interactions between i and j atoms */
866 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
867 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
869 /* LENNARD-JONES DISPERSION/REPULSION */
871 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
872 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
873 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
874 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
875 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
877 d = _fjsp_sub_v2r8(r00,rswitch);
878 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
879 d2 = _fjsp_mul_v2r8(d,d);
880 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
882 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
884 /* Evaluate switch function */
885 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
886 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
887 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
891 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
893 /* Update vectorial force */
894 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
895 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
896 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
898 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
899 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
900 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
908 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
911 /* Compute parameters for interactions between i and j atoms */
912 qq10 = _fjsp_mul_v2r8(iq1,jq0);
914 /* REACTION-FIELD ELECTROSTATICS */
915 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
917 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
921 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
923 /* Update vectorial force */
924 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
925 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
926 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
928 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
929 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
930 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
934 /**************************
935 * CALCULATE INTERACTIONS *
936 **************************/
938 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
941 /* Compute parameters for interactions between i and j atoms */
942 qq20 = _fjsp_mul_v2r8(iq2,jq0);
944 /* REACTION-FIELD ELECTROSTATICS */
945 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
947 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
951 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
953 /* Update vectorial force */
954 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
955 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
956 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
958 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
959 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
960 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
964 /**************************
965 * CALCULATE INTERACTIONS *
966 **************************/
968 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
971 /* Compute parameters for interactions between i and j atoms */
972 qq30 = _fjsp_mul_v2r8(iq3,jq0);
974 /* REACTION-FIELD ELECTROSTATICS */
975 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
977 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
981 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
983 /* Update vectorial force */
984 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
985 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
986 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
988 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
989 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
990 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
994 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
996 /* Inner loop uses 161 flops */
1003 j_coord_offsetA = DIM*jnrA;
1005 /* load j atom coordinates */
1006 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1009 /* Calculate displacement vector */
1010 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1011 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1012 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1013 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1014 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1015 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1016 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1017 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1018 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1019 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1020 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1021 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1023 /* Calculate squared distance and things based on it */
1024 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1025 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1026 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1027 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1029 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1030 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1031 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1032 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1034 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1035 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1036 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1037 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1039 /* Load parameters for j particles */
1040 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1041 vdwjidx0A = 2*vdwtype[jnrA+0];
1043 fjx0 = _fjsp_setzero_v2r8();
1044 fjy0 = _fjsp_setzero_v2r8();
1045 fjz0 = _fjsp_setzero_v2r8();
1047 /**************************
1048 * CALCULATE INTERACTIONS *
1049 **************************/
1051 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1054 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1056 /* Compute parameters for interactions between i and j atoms */
1057 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1058 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1060 /* LENNARD-JONES DISPERSION/REPULSION */
1062 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1063 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
1064 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
1065 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
1066 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
1068 d = _fjsp_sub_v2r8(r00,rswitch);
1069 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
1070 d2 = _fjsp_mul_v2r8(d,d);
1071 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
1073 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
1075 /* Evaluate switch function */
1076 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1077 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
1078 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1082 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1084 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1086 /* Update vectorial force */
1087 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1088 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1089 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1091 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1092 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1093 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1097 /**************************
1098 * CALCULATE INTERACTIONS *
1099 **************************/
1101 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1104 /* Compute parameters for interactions between i and j atoms */
1105 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1107 /* REACTION-FIELD ELECTROSTATICS */
1108 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1110 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1114 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1116 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1118 /* Update vectorial force */
1119 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1120 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1121 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1123 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1124 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1125 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1129 /**************************
1130 * CALCULATE INTERACTIONS *
1131 **************************/
1133 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1136 /* Compute parameters for interactions between i and j atoms */
1137 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1139 /* REACTION-FIELD ELECTROSTATICS */
1140 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1142 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1146 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1148 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1150 /* Update vectorial force */
1151 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1152 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1153 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1155 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1156 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1157 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1161 /**************************
1162 * CALCULATE INTERACTIONS *
1163 **************************/
1165 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1168 /* Compute parameters for interactions between i and j atoms */
1169 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1171 /* REACTION-FIELD ELECTROSTATICS */
1172 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1174 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1178 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1180 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1182 /* Update vectorial force */
1183 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1184 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1185 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1187 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1188 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1189 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1193 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1195 /* Inner loop uses 161 flops */
1198 /* End of innermost loop */
1200 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1201 f+i_coord_offset,fshift+i_shift_offset);
1203 /* Increment number of inner iterations */
1204 inneriter += j_index_end - j_index_start;
1206 /* Outer loop uses 24 flops */
1209 /* Increment number of outer iterations */
1212 /* Update outer/inner flops */
1214 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*161);