2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017,2018, 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/gmxlib/nrnb.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 struct 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->ic->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->ic->rcoulomb;
138 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
139 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
141 rswitch_scalar = fr->ic->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_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
471 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
473 /* LENNARD-JONES DISPERSION/REPULSION */
475 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
476 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
477 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
478 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
479 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
481 d = _fjsp_sub_v2r8(r00,rswitch);
482 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
483 d2 = _fjsp_mul_v2r8(d,d);
484 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
486 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
488 /* Evaluate switch function */
489 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
490 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
491 vvdw = _fjsp_mul_v2r8(vvdw,sw);
492 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
494 /* Update potential sum for this i atom from the interaction with this j atom. */
495 vvdw = _fjsp_and_v2r8(vvdw,cutoff_mask);
496 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
497 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
501 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
503 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
505 /* Update vectorial force */
506 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
507 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
508 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
510 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
511 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
512 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
520 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
523 /* Compute parameters for interactions between i and j atoms */
524 qq10 = _fjsp_mul_v2r8(iq1,jq0);
526 /* REACTION-FIELD ELECTROSTATICS */
527 velec = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
528 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
530 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
532 /* Update potential sum for this i atom from the interaction with this j atom. */
533 velec = _fjsp_and_v2r8(velec,cutoff_mask);
534 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
535 velecsum = _fjsp_add_v2r8(velecsum,velec);
539 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
541 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
543 /* Update vectorial force */
544 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
545 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
546 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
548 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
549 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
550 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
554 /**************************
555 * CALCULATE INTERACTIONS *
556 **************************/
558 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
561 /* Compute parameters for interactions between i and j atoms */
562 qq20 = _fjsp_mul_v2r8(iq2,jq0);
564 /* REACTION-FIELD ELECTROSTATICS */
565 velec = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
566 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
568 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
570 /* Update potential sum for this i atom from the interaction with this j atom. */
571 velec = _fjsp_and_v2r8(velec,cutoff_mask);
572 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
573 velecsum = _fjsp_add_v2r8(velecsum,velec);
577 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
579 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
581 /* Update vectorial force */
582 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
583 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
584 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
586 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
587 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
588 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
592 /**************************
593 * CALCULATE INTERACTIONS *
594 **************************/
596 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
599 /* Compute parameters for interactions between i and j atoms */
600 qq30 = _fjsp_mul_v2r8(iq3,jq0);
602 /* REACTION-FIELD ELECTROSTATICS */
603 velec = _fjsp_mul_v2r8(qq30,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq30,rinv30),crf));
604 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
606 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
608 /* Update potential sum for this i atom from the interaction with this j atom. */
609 velec = _fjsp_and_v2r8(velec,cutoff_mask);
610 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
611 velecsum = _fjsp_add_v2r8(velecsum,velec);
615 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
617 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
619 /* Update vectorial force */
620 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
621 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
622 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
624 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
625 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
626 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
630 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
632 /* Inner loop uses 182 flops */
635 /* End of innermost loop */
637 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
638 f+i_coord_offset,fshift+i_shift_offset);
641 /* Update potential energies */
642 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
643 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
645 /* Increment number of inner iterations */
646 inneriter += j_index_end - j_index_start;
648 /* Outer loop uses 26 flops */
651 /* Increment number of outer iterations */
654 /* Update outer/inner flops */
656 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*182);
659 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
660 * Electrostatics interaction: ReactionField
661 * VdW interaction: LennardJones
662 * Geometry: Water4-Particle
663 * Calculate force/pot: Force
666 nb_kernel_ElecRFCut_VdwLJSw_GeomW4P1_F_sparc64_hpc_ace_double
667 (t_nblist * gmx_restrict nlist,
668 rvec * gmx_restrict xx,
669 rvec * gmx_restrict ff,
670 struct t_forcerec * gmx_restrict fr,
671 t_mdatoms * gmx_restrict mdatoms,
672 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
673 t_nrnb * gmx_restrict nrnb)
675 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
676 * just 0 for non-waters.
677 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
678 * jnr indices corresponding to data put in the four positions in the SIMD register.
680 int i_shift_offset,i_coord_offset,outeriter,inneriter;
681 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
683 int j_coord_offsetA,j_coord_offsetB;
684 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
686 real *shiftvec,*fshift,*x,*f;
687 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
689 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
691 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
693 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
695 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
696 int vdwjidx0A,vdwjidx0B;
697 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
698 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
699 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
700 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
701 _fjsp_v2r8 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
702 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
705 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
708 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
709 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
710 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
711 real rswitch_scalar,d_scalar;
713 _fjsp_v2r8 dummy_mask,cutoff_mask;
714 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
715 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
716 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
723 jindex = nlist->jindex;
725 shiftidx = nlist->shift;
727 shiftvec = fr->shift_vec[0];
728 fshift = fr->fshift[0];
729 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
730 charge = mdatoms->chargeA;
731 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
732 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
733 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
734 nvdwtype = fr->ntype;
736 vdwtype = mdatoms->typeA;
738 /* Setup water-specific parameters */
739 inr = nlist->iinr[0];
740 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
741 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
742 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
743 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
745 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
746 rcutoff_scalar = fr->ic->rcoulomb;
747 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
748 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
750 rswitch_scalar = fr->ic->rvdw_switch;
751 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
752 /* Setup switch parameters */
753 d_scalar = rcutoff_scalar-rswitch_scalar;
754 d = gmx_fjsp_set1_v2r8(d_scalar);
755 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
756 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
757 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
758 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
759 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
760 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
762 /* Avoid stupid compiler warnings */
770 /* Start outer loop over neighborlists */
771 for(iidx=0; iidx<nri; iidx++)
773 /* Load shift vector for this list */
774 i_shift_offset = DIM*shiftidx[iidx];
776 /* Load limits for loop over neighbors */
777 j_index_start = jindex[iidx];
778 j_index_end = jindex[iidx+1];
780 /* Get outer coordinate index */
782 i_coord_offset = DIM*inr;
784 /* Load i particle coords and add shift vector */
785 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
786 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
788 fix0 = _fjsp_setzero_v2r8();
789 fiy0 = _fjsp_setzero_v2r8();
790 fiz0 = _fjsp_setzero_v2r8();
791 fix1 = _fjsp_setzero_v2r8();
792 fiy1 = _fjsp_setzero_v2r8();
793 fiz1 = _fjsp_setzero_v2r8();
794 fix2 = _fjsp_setzero_v2r8();
795 fiy2 = _fjsp_setzero_v2r8();
796 fiz2 = _fjsp_setzero_v2r8();
797 fix3 = _fjsp_setzero_v2r8();
798 fiy3 = _fjsp_setzero_v2r8();
799 fiz3 = _fjsp_setzero_v2r8();
801 /* Start inner kernel loop */
802 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
805 /* Get j neighbor index, and coordinate index */
808 j_coord_offsetA = DIM*jnrA;
809 j_coord_offsetB = DIM*jnrB;
811 /* load j atom coordinates */
812 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
815 /* Calculate displacement vector */
816 dx00 = _fjsp_sub_v2r8(ix0,jx0);
817 dy00 = _fjsp_sub_v2r8(iy0,jy0);
818 dz00 = _fjsp_sub_v2r8(iz0,jz0);
819 dx10 = _fjsp_sub_v2r8(ix1,jx0);
820 dy10 = _fjsp_sub_v2r8(iy1,jy0);
821 dz10 = _fjsp_sub_v2r8(iz1,jz0);
822 dx20 = _fjsp_sub_v2r8(ix2,jx0);
823 dy20 = _fjsp_sub_v2r8(iy2,jy0);
824 dz20 = _fjsp_sub_v2r8(iz2,jz0);
825 dx30 = _fjsp_sub_v2r8(ix3,jx0);
826 dy30 = _fjsp_sub_v2r8(iy3,jy0);
827 dz30 = _fjsp_sub_v2r8(iz3,jz0);
829 /* Calculate squared distance and things based on it */
830 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
831 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
832 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
833 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
835 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
836 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
837 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
838 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
840 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
841 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
842 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
843 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
845 /* Load parameters for j particles */
846 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
847 vdwjidx0A = 2*vdwtype[jnrA+0];
848 vdwjidx0B = 2*vdwtype[jnrB+0];
850 fjx0 = _fjsp_setzero_v2r8();
851 fjy0 = _fjsp_setzero_v2r8();
852 fjz0 = _fjsp_setzero_v2r8();
854 /**************************
855 * CALCULATE INTERACTIONS *
856 **************************/
858 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
861 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
863 /* Compute parameters for interactions between i and j atoms */
864 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
865 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
867 /* LENNARD-JONES DISPERSION/REPULSION */
869 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
870 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
871 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
872 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
873 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
875 d = _fjsp_sub_v2r8(r00,rswitch);
876 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
877 d2 = _fjsp_mul_v2r8(d,d);
878 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
880 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
882 /* Evaluate switch function */
883 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
884 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
885 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
889 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
891 /* Update vectorial force */
892 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
893 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
894 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
896 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
897 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
898 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
902 /**************************
903 * CALCULATE INTERACTIONS *
904 **************************/
906 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
909 /* Compute parameters for interactions between i and j atoms */
910 qq10 = _fjsp_mul_v2r8(iq1,jq0);
912 /* REACTION-FIELD ELECTROSTATICS */
913 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
915 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
919 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
921 /* Update vectorial force */
922 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
923 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
924 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
926 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
927 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
928 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
932 /**************************
933 * CALCULATE INTERACTIONS *
934 **************************/
936 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
939 /* Compute parameters for interactions between i and j atoms */
940 qq20 = _fjsp_mul_v2r8(iq2,jq0);
942 /* REACTION-FIELD ELECTROSTATICS */
943 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
945 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
949 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
951 /* Update vectorial force */
952 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
953 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
954 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
956 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
957 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
958 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
962 /**************************
963 * CALCULATE INTERACTIONS *
964 **************************/
966 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
969 /* Compute parameters for interactions between i and j atoms */
970 qq30 = _fjsp_mul_v2r8(iq3,jq0);
972 /* REACTION-FIELD ELECTROSTATICS */
973 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
975 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
979 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
981 /* Update vectorial force */
982 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
983 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
984 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
986 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
987 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
988 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
992 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
994 /* Inner loop uses 161 flops */
1001 j_coord_offsetA = DIM*jnrA;
1003 /* load j atom coordinates */
1004 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1007 /* Calculate displacement vector */
1008 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1009 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1010 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1011 dx10 = _fjsp_sub_v2r8(ix1,jx0);
1012 dy10 = _fjsp_sub_v2r8(iy1,jy0);
1013 dz10 = _fjsp_sub_v2r8(iz1,jz0);
1014 dx20 = _fjsp_sub_v2r8(ix2,jx0);
1015 dy20 = _fjsp_sub_v2r8(iy2,jy0);
1016 dz20 = _fjsp_sub_v2r8(iz2,jz0);
1017 dx30 = _fjsp_sub_v2r8(ix3,jx0);
1018 dy30 = _fjsp_sub_v2r8(iy3,jy0);
1019 dz30 = _fjsp_sub_v2r8(iz3,jz0);
1021 /* Calculate squared distance and things based on it */
1022 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1023 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1024 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1025 rsq30 = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1027 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
1028 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
1029 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
1030 rinv30 = gmx_fjsp_invsqrt_v2r8(rsq30);
1032 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
1033 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
1034 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
1035 rinvsq30 = _fjsp_mul_v2r8(rinv30,rinv30);
1037 /* Load parameters for j particles */
1038 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1039 vdwjidx0A = 2*vdwtype[jnrA+0];
1041 fjx0 = _fjsp_setzero_v2r8();
1042 fjy0 = _fjsp_setzero_v2r8();
1043 fjz0 = _fjsp_setzero_v2r8();
1045 /**************************
1046 * CALCULATE INTERACTIONS *
1047 **************************/
1049 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1052 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
1054 /* Compute parameters for interactions between i and j atoms */
1055 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1056 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1058 /* LENNARD-JONES DISPERSION/REPULSION */
1060 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1061 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
1062 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
1063 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
1064 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
1066 d = _fjsp_sub_v2r8(r00,rswitch);
1067 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
1068 d2 = _fjsp_mul_v2r8(d,d);
1069 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
1071 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
1073 /* Evaluate switch function */
1074 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1075 fvdw = _fjsp_msub_v2r8( fvdw,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(vvdw,dsw)) );
1076 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1080 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1082 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1084 /* Update vectorial force */
1085 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1086 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1087 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1089 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1090 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1091 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1095 /**************************
1096 * CALCULATE INTERACTIONS *
1097 **************************/
1099 if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
1102 /* Compute parameters for interactions between i and j atoms */
1103 qq10 = _fjsp_mul_v2r8(iq1,jq0);
1105 /* REACTION-FIELD ELECTROSTATICS */
1106 felec = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
1108 cutoff_mask = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
1112 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1114 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1116 /* Update vectorial force */
1117 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
1118 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1119 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1121 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1122 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1123 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1127 /**************************
1128 * CALCULATE INTERACTIONS *
1129 **************************/
1131 if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
1134 /* Compute parameters for interactions between i and j atoms */
1135 qq20 = _fjsp_mul_v2r8(iq2,jq0);
1137 /* REACTION-FIELD ELECTROSTATICS */
1138 felec = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
1140 cutoff_mask = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
1144 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1146 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1148 /* Update vectorial force */
1149 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
1150 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1151 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1153 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1154 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1155 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1159 /**************************
1160 * CALCULATE INTERACTIONS *
1161 **************************/
1163 if (gmx_fjsp_any_lt_v2r8(rsq30,rcutoff2))
1166 /* Compute parameters for interactions between i and j atoms */
1167 qq30 = _fjsp_mul_v2r8(iq3,jq0);
1169 /* REACTION-FIELD ELECTROSTATICS */
1170 felec = _fjsp_mul_v2r8(qq30,_fjsp_msub_v2r8(rinv30,rinvsq30,krf2));
1172 cutoff_mask = _fjsp_cmplt_v2r8(rsq30,rcutoff2);
1176 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
1178 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1180 /* Update vectorial force */
1181 fix3 = _fjsp_madd_v2r8(dx30,fscal,fix3);
1182 fiy3 = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1183 fiz3 = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1185 fjx0 = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1186 fjy0 = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1187 fjz0 = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1191 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1193 /* Inner loop uses 161 flops */
1196 /* End of innermost loop */
1198 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1199 f+i_coord_offset,fshift+i_shift_offset);
1201 /* Increment number of inner iterations */
1202 inneriter += j_index_end - j_index_start;
1204 /* Outer loop uses 24 flops */
1207 /* Increment number of outer iterations */
1210 /* Update outer/inner flops */
1212 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*161);