2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, 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_ElecCoul_VdwLJ_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: LennardJones
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_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;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
93 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
97 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
99 _fjsp_v2r8 dummy_mask,cutoff_mask;
100 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
101 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
102 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
109 jindex = nlist->jindex;
111 shiftidx = nlist->shift;
113 shiftvec = fr->shift_vec[0];
114 fshift = fr->fshift[0];
115 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
116 charge = mdatoms->chargeA;
117 nvdwtype = fr->ntype;
119 vdwtype = mdatoms->typeA;
121 /* Setup water-specific parameters */
122 inr = nlist->iinr[0];
123 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
124 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
125 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
126 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
128 /* Avoid stupid compiler warnings */
136 /* Start outer loop over neighborlists */
137 for(iidx=0; iidx<nri; iidx++)
139 /* Load shift vector for this list */
140 i_shift_offset = DIM*shiftidx[iidx];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
152 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
154 fix0 = _fjsp_setzero_v2r8();
155 fiy0 = _fjsp_setzero_v2r8();
156 fiz0 = _fjsp_setzero_v2r8();
157 fix1 = _fjsp_setzero_v2r8();
158 fiy1 = _fjsp_setzero_v2r8();
159 fiz1 = _fjsp_setzero_v2r8();
160 fix2 = _fjsp_setzero_v2r8();
161 fiy2 = _fjsp_setzero_v2r8();
162 fiz2 = _fjsp_setzero_v2r8();
164 /* Reset potential sums */
165 velecsum = _fjsp_setzero_v2r8();
166 vvdwsum = _fjsp_setzero_v2r8();
168 /* Start inner kernel loop */
169 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
172 /* Get j neighbor index, and coordinate index */
175 j_coord_offsetA = DIM*jnrA;
176 j_coord_offsetB = DIM*jnrB;
178 /* load j atom coordinates */
179 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
182 /* Calculate displacement vector */
183 dx00 = _fjsp_sub_v2r8(ix0,jx0);
184 dy00 = _fjsp_sub_v2r8(iy0,jy0);
185 dz00 = _fjsp_sub_v2r8(iz0,jz0);
186 dx10 = _fjsp_sub_v2r8(ix1,jx0);
187 dy10 = _fjsp_sub_v2r8(iy1,jy0);
188 dz10 = _fjsp_sub_v2r8(iz1,jz0);
189 dx20 = _fjsp_sub_v2r8(ix2,jx0);
190 dy20 = _fjsp_sub_v2r8(iy2,jy0);
191 dz20 = _fjsp_sub_v2r8(iz2,jz0);
193 /* Calculate squared distance and things based on it */
194 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
195 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
196 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
198 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
199 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
200 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
202 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
203 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
204 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
206 /* Load parameters for j particles */
207 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
208 vdwjidx0A = 2*vdwtype[jnrA+0];
209 vdwjidx0B = 2*vdwtype[jnrB+0];
211 fjx0 = _fjsp_setzero_v2r8();
212 fjy0 = _fjsp_setzero_v2r8();
213 fjz0 = _fjsp_setzero_v2r8();
215 /**************************
216 * CALCULATE INTERACTIONS *
217 **************************/
219 /* Compute parameters for interactions between i and j atoms */
220 qq00 = _fjsp_mul_v2r8(iq0,jq0);
221 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
222 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
224 /* COULOMB ELECTROSTATICS */
225 velec = _fjsp_mul_v2r8(qq00,rinv00);
226 felec = _fjsp_mul_v2r8(velec,rinvsq00);
228 /* LENNARD-JONES DISPERSION/REPULSION */
230 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
231 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
232 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
233 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
234 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
236 /* Update potential sum for this i atom from the interaction with this j atom. */
237 velecsum = _fjsp_add_v2r8(velecsum,velec);
238 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
240 fscal = _fjsp_add_v2r8(felec,fvdw);
242 /* Update vectorial force */
243 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
244 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
245 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
247 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
248 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
249 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
251 /**************************
252 * CALCULATE INTERACTIONS *
253 **************************/
255 /* Compute parameters for interactions between i and j atoms */
256 qq10 = _fjsp_mul_v2r8(iq1,jq0);
258 /* COULOMB ELECTROSTATICS */
259 velec = _fjsp_mul_v2r8(qq10,rinv10);
260 felec = _fjsp_mul_v2r8(velec,rinvsq10);
262 /* Update potential sum for this i atom from the interaction with this j atom. */
263 velecsum = _fjsp_add_v2r8(velecsum,velec);
267 /* Update vectorial force */
268 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
269 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
270 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
272 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
273 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
274 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
276 /**************************
277 * CALCULATE INTERACTIONS *
278 **************************/
280 /* Compute parameters for interactions between i and j atoms */
281 qq20 = _fjsp_mul_v2r8(iq2,jq0);
283 /* COULOMB ELECTROSTATICS */
284 velec = _fjsp_mul_v2r8(qq20,rinv20);
285 felec = _fjsp_mul_v2r8(velec,rinvsq20);
287 /* Update potential sum for this i atom from the interaction with this j atom. */
288 velecsum = _fjsp_add_v2r8(velecsum,velec);
292 /* Update vectorial force */
293 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
294 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
295 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
297 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
298 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
299 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
301 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
303 /* Inner loop uses 108 flops */
310 j_coord_offsetA = DIM*jnrA;
312 /* load j atom coordinates */
313 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
316 /* Calculate displacement vector */
317 dx00 = _fjsp_sub_v2r8(ix0,jx0);
318 dy00 = _fjsp_sub_v2r8(iy0,jy0);
319 dz00 = _fjsp_sub_v2r8(iz0,jz0);
320 dx10 = _fjsp_sub_v2r8(ix1,jx0);
321 dy10 = _fjsp_sub_v2r8(iy1,jy0);
322 dz10 = _fjsp_sub_v2r8(iz1,jz0);
323 dx20 = _fjsp_sub_v2r8(ix2,jx0);
324 dy20 = _fjsp_sub_v2r8(iy2,jy0);
325 dz20 = _fjsp_sub_v2r8(iz2,jz0);
327 /* Calculate squared distance and things based on it */
328 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
329 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
330 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
332 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
333 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
334 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
336 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
337 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
338 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
340 /* Load parameters for j particles */
341 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
342 vdwjidx0A = 2*vdwtype[jnrA+0];
344 fjx0 = _fjsp_setzero_v2r8();
345 fjy0 = _fjsp_setzero_v2r8();
346 fjz0 = _fjsp_setzero_v2r8();
348 /**************************
349 * CALCULATE INTERACTIONS *
350 **************************/
352 /* Compute parameters for interactions between i and j atoms */
353 qq00 = _fjsp_mul_v2r8(iq0,jq0);
354 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
355 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
357 /* COULOMB ELECTROSTATICS */
358 velec = _fjsp_mul_v2r8(qq00,rinv00);
359 felec = _fjsp_mul_v2r8(velec,rinvsq00);
361 /* LENNARD-JONES DISPERSION/REPULSION */
363 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
364 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
365 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
366 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
367 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
369 /* Update potential sum for this i atom from the interaction with this j atom. */
370 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
371 velecsum = _fjsp_add_v2r8(velecsum,velec);
372 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
373 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
375 fscal = _fjsp_add_v2r8(felec,fvdw);
377 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
379 /* Update vectorial force */
380 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
381 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
382 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
384 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
385 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
386 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
388 /**************************
389 * CALCULATE INTERACTIONS *
390 **************************/
392 /* Compute parameters for interactions between i and j atoms */
393 qq10 = _fjsp_mul_v2r8(iq1,jq0);
395 /* COULOMB ELECTROSTATICS */
396 velec = _fjsp_mul_v2r8(qq10,rinv10);
397 felec = _fjsp_mul_v2r8(velec,rinvsq10);
399 /* Update potential sum for this i atom from the interaction with this j atom. */
400 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
401 velecsum = _fjsp_add_v2r8(velecsum,velec);
405 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
407 /* Update vectorial force */
408 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
409 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
410 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
412 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
413 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
414 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
416 /**************************
417 * CALCULATE INTERACTIONS *
418 **************************/
420 /* Compute parameters for interactions between i and j atoms */
421 qq20 = _fjsp_mul_v2r8(iq2,jq0);
423 /* COULOMB ELECTROSTATICS */
424 velec = _fjsp_mul_v2r8(qq20,rinv20);
425 felec = _fjsp_mul_v2r8(velec,rinvsq20);
427 /* Update potential sum for this i atom from the interaction with this j atom. */
428 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
429 velecsum = _fjsp_add_v2r8(velecsum,velec);
433 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
435 /* Update vectorial force */
436 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
437 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
438 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
440 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
441 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
442 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
444 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
446 /* Inner loop uses 108 flops */
449 /* End of innermost loop */
451 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
452 f+i_coord_offset,fshift+i_shift_offset);
455 /* Update potential energies */
456 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
457 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
459 /* Increment number of inner iterations */
460 inneriter += j_index_end - j_index_start;
462 /* Outer loop uses 20 flops */
465 /* Increment number of outer iterations */
468 /* Update outer/inner flops */
470 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*108);
473 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
474 * Electrostatics interaction: Coulomb
475 * VdW interaction: LennardJones
476 * Geometry: Water3-Particle
477 * Calculate force/pot: Force
480 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
481 (t_nblist * gmx_restrict nlist,
482 rvec * gmx_restrict xx,
483 rvec * gmx_restrict ff,
484 struct t_forcerec * gmx_restrict fr,
485 t_mdatoms * gmx_restrict mdatoms,
486 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
487 t_nrnb * gmx_restrict nrnb)
489 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
490 * just 0 for non-waters.
491 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
492 * jnr indices corresponding to data put in the four positions in the SIMD register.
494 int i_shift_offset,i_coord_offset,outeriter,inneriter;
495 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
497 int j_coord_offsetA,j_coord_offsetB;
498 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
500 real *shiftvec,*fshift,*x,*f;
501 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
503 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
505 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
507 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
508 int vdwjidx0A,vdwjidx0B;
509 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
510 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
511 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
512 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
513 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
516 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
519 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
520 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
522 _fjsp_v2r8 dummy_mask,cutoff_mask;
523 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
524 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
525 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
532 jindex = nlist->jindex;
534 shiftidx = nlist->shift;
536 shiftvec = fr->shift_vec[0];
537 fshift = fr->fshift[0];
538 facel = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
539 charge = mdatoms->chargeA;
540 nvdwtype = fr->ntype;
542 vdwtype = mdatoms->typeA;
544 /* Setup water-specific parameters */
545 inr = nlist->iinr[0];
546 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
547 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
548 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
549 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
551 /* Avoid stupid compiler warnings */
559 /* Start outer loop over neighborlists */
560 for(iidx=0; iidx<nri; iidx++)
562 /* Load shift vector for this list */
563 i_shift_offset = DIM*shiftidx[iidx];
565 /* Load limits for loop over neighbors */
566 j_index_start = jindex[iidx];
567 j_index_end = jindex[iidx+1];
569 /* Get outer coordinate index */
571 i_coord_offset = DIM*inr;
573 /* Load i particle coords and add shift vector */
574 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
575 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
577 fix0 = _fjsp_setzero_v2r8();
578 fiy0 = _fjsp_setzero_v2r8();
579 fiz0 = _fjsp_setzero_v2r8();
580 fix1 = _fjsp_setzero_v2r8();
581 fiy1 = _fjsp_setzero_v2r8();
582 fiz1 = _fjsp_setzero_v2r8();
583 fix2 = _fjsp_setzero_v2r8();
584 fiy2 = _fjsp_setzero_v2r8();
585 fiz2 = _fjsp_setzero_v2r8();
587 /* Start inner kernel loop */
588 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
591 /* Get j neighbor index, and coordinate index */
594 j_coord_offsetA = DIM*jnrA;
595 j_coord_offsetB = DIM*jnrB;
597 /* load j atom coordinates */
598 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
601 /* Calculate displacement vector */
602 dx00 = _fjsp_sub_v2r8(ix0,jx0);
603 dy00 = _fjsp_sub_v2r8(iy0,jy0);
604 dz00 = _fjsp_sub_v2r8(iz0,jz0);
605 dx10 = _fjsp_sub_v2r8(ix1,jx0);
606 dy10 = _fjsp_sub_v2r8(iy1,jy0);
607 dz10 = _fjsp_sub_v2r8(iz1,jz0);
608 dx20 = _fjsp_sub_v2r8(ix2,jx0);
609 dy20 = _fjsp_sub_v2r8(iy2,jy0);
610 dz20 = _fjsp_sub_v2r8(iz2,jz0);
612 /* Calculate squared distance and things based on it */
613 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
614 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
615 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
617 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
618 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
619 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
621 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
622 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
623 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
625 /* Load parameters for j particles */
626 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
627 vdwjidx0A = 2*vdwtype[jnrA+0];
628 vdwjidx0B = 2*vdwtype[jnrB+0];
630 fjx0 = _fjsp_setzero_v2r8();
631 fjy0 = _fjsp_setzero_v2r8();
632 fjz0 = _fjsp_setzero_v2r8();
634 /**************************
635 * CALCULATE INTERACTIONS *
636 **************************/
638 /* Compute parameters for interactions between i and j atoms */
639 qq00 = _fjsp_mul_v2r8(iq0,jq0);
640 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
641 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
643 /* COULOMB ELECTROSTATICS */
644 velec = _fjsp_mul_v2r8(qq00,rinv00);
645 felec = _fjsp_mul_v2r8(velec,rinvsq00);
647 /* LENNARD-JONES DISPERSION/REPULSION */
649 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
650 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
652 fscal = _fjsp_add_v2r8(felec,fvdw);
654 /* Update vectorial force */
655 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
656 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
657 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
659 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
660 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
661 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
663 /**************************
664 * CALCULATE INTERACTIONS *
665 **************************/
667 /* Compute parameters for interactions between i and j atoms */
668 qq10 = _fjsp_mul_v2r8(iq1,jq0);
670 /* COULOMB ELECTROSTATICS */
671 velec = _fjsp_mul_v2r8(qq10,rinv10);
672 felec = _fjsp_mul_v2r8(velec,rinvsq10);
676 /* Update vectorial force */
677 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
678 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
679 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
681 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
682 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
683 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
685 /**************************
686 * CALCULATE INTERACTIONS *
687 **************************/
689 /* Compute parameters for interactions between i and j atoms */
690 qq20 = _fjsp_mul_v2r8(iq2,jq0);
692 /* COULOMB ELECTROSTATICS */
693 velec = _fjsp_mul_v2r8(qq20,rinv20);
694 felec = _fjsp_mul_v2r8(velec,rinvsq20);
698 /* Update vectorial force */
699 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
700 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
701 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
703 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
704 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
705 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
707 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
709 /* Inner loop uses 100 flops */
716 j_coord_offsetA = DIM*jnrA;
718 /* load j atom coordinates */
719 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
722 /* Calculate displacement vector */
723 dx00 = _fjsp_sub_v2r8(ix0,jx0);
724 dy00 = _fjsp_sub_v2r8(iy0,jy0);
725 dz00 = _fjsp_sub_v2r8(iz0,jz0);
726 dx10 = _fjsp_sub_v2r8(ix1,jx0);
727 dy10 = _fjsp_sub_v2r8(iy1,jy0);
728 dz10 = _fjsp_sub_v2r8(iz1,jz0);
729 dx20 = _fjsp_sub_v2r8(ix2,jx0);
730 dy20 = _fjsp_sub_v2r8(iy2,jy0);
731 dz20 = _fjsp_sub_v2r8(iz2,jz0);
733 /* Calculate squared distance and things based on it */
734 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
735 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
736 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
738 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
739 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
740 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
742 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
743 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
744 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
746 /* Load parameters for j particles */
747 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
748 vdwjidx0A = 2*vdwtype[jnrA+0];
750 fjx0 = _fjsp_setzero_v2r8();
751 fjy0 = _fjsp_setzero_v2r8();
752 fjz0 = _fjsp_setzero_v2r8();
754 /**************************
755 * CALCULATE INTERACTIONS *
756 **************************/
758 /* Compute parameters for interactions between i and j atoms */
759 qq00 = _fjsp_mul_v2r8(iq0,jq0);
760 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
761 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
763 /* COULOMB ELECTROSTATICS */
764 velec = _fjsp_mul_v2r8(qq00,rinv00);
765 felec = _fjsp_mul_v2r8(velec,rinvsq00);
767 /* LENNARD-JONES DISPERSION/REPULSION */
769 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
770 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
772 fscal = _fjsp_add_v2r8(felec,fvdw);
774 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
776 /* Update vectorial force */
777 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
778 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
779 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
781 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
782 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
783 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
785 /**************************
786 * CALCULATE INTERACTIONS *
787 **************************/
789 /* Compute parameters for interactions between i and j atoms */
790 qq10 = _fjsp_mul_v2r8(iq1,jq0);
792 /* COULOMB ELECTROSTATICS */
793 velec = _fjsp_mul_v2r8(qq10,rinv10);
794 felec = _fjsp_mul_v2r8(velec,rinvsq10);
798 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
800 /* Update vectorial force */
801 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
802 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
803 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
805 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
806 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
807 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
809 /**************************
810 * CALCULATE INTERACTIONS *
811 **************************/
813 /* Compute parameters for interactions between i and j atoms */
814 qq20 = _fjsp_mul_v2r8(iq2,jq0);
816 /* COULOMB ELECTROSTATICS */
817 velec = _fjsp_mul_v2r8(qq20,rinv20);
818 felec = _fjsp_mul_v2r8(velec,rinvsq20);
822 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
824 /* Update vectorial force */
825 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
826 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
827 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
829 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
830 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
831 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
833 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
835 /* Inner loop uses 100 flops */
838 /* End of innermost loop */
840 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
841 f+i_coord_offset,fshift+i_shift_offset);
843 /* Increment number of inner iterations */
844 inneriter += j_index_end - j_index_start;
846 /* Outer loop uses 18 flops */
849 /* Increment number of outer iterations */
852 /* Update outer/inner flops */
854 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*100);