2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_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 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->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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
356 /* COULOMB ELECTROSTATICS */
357 velec = _fjsp_mul_v2r8(qq00,rinv00);
358 felec = _fjsp_mul_v2r8(velec,rinvsq00);
360 /* LENNARD-JONES DISPERSION/REPULSION */
362 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
363 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
364 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
365 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
366 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
368 /* Update potential sum for this i atom from the interaction with this j atom. */
369 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
370 velecsum = _fjsp_add_v2r8(velecsum,velec);
371 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
372 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
374 fscal = _fjsp_add_v2r8(felec,fvdw);
376 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
378 /* Update vectorial force */
379 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
380 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
381 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
383 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
384 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
385 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
387 /**************************
388 * CALCULATE INTERACTIONS *
389 **************************/
391 /* Compute parameters for interactions between i and j atoms */
392 qq10 = _fjsp_mul_v2r8(iq1,jq0);
394 /* COULOMB ELECTROSTATICS */
395 velec = _fjsp_mul_v2r8(qq10,rinv10);
396 felec = _fjsp_mul_v2r8(velec,rinvsq10);
398 /* Update potential sum for this i atom from the interaction with this j atom. */
399 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
400 velecsum = _fjsp_add_v2r8(velecsum,velec);
404 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
406 /* Update vectorial force */
407 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
408 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
409 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
411 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
412 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
413 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
415 /**************************
416 * CALCULATE INTERACTIONS *
417 **************************/
419 /* Compute parameters for interactions between i and j atoms */
420 qq20 = _fjsp_mul_v2r8(iq2,jq0);
422 /* COULOMB ELECTROSTATICS */
423 velec = _fjsp_mul_v2r8(qq20,rinv20);
424 felec = _fjsp_mul_v2r8(velec,rinvsq20);
426 /* Update potential sum for this i atom from the interaction with this j atom. */
427 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
428 velecsum = _fjsp_add_v2r8(velecsum,velec);
432 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
434 /* Update vectorial force */
435 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
436 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
437 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
439 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
440 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
441 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
443 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
445 /* Inner loop uses 108 flops */
448 /* End of innermost loop */
450 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
451 f+i_coord_offset,fshift+i_shift_offset);
454 /* Update potential energies */
455 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
456 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
458 /* Increment number of inner iterations */
459 inneriter += j_index_end - j_index_start;
461 /* Outer loop uses 20 flops */
464 /* Increment number of outer iterations */
467 /* Update outer/inner flops */
469 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*108);
472 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
473 * Electrostatics interaction: Coulomb
474 * VdW interaction: LennardJones
475 * Geometry: Water3-Particle
476 * Calculate force/pot: Force
479 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
480 (t_nblist * gmx_restrict nlist,
481 rvec * gmx_restrict xx,
482 rvec * gmx_restrict ff,
483 t_forcerec * gmx_restrict fr,
484 t_mdatoms * gmx_restrict mdatoms,
485 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
486 t_nrnb * gmx_restrict nrnb)
488 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
489 * just 0 for non-waters.
490 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
491 * jnr indices corresponding to data put in the four positions in the SIMD register.
493 int i_shift_offset,i_coord_offset,outeriter,inneriter;
494 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
496 int j_coord_offsetA,j_coord_offsetB;
497 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
499 real *shiftvec,*fshift,*x,*f;
500 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
502 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
504 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
506 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
507 int vdwjidx0A,vdwjidx0B;
508 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
509 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
510 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
511 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
512 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
515 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
518 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
519 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
521 _fjsp_v2r8 dummy_mask,cutoff_mask;
522 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
523 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
524 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
531 jindex = nlist->jindex;
533 shiftidx = nlist->shift;
535 shiftvec = fr->shift_vec[0];
536 fshift = fr->fshift[0];
537 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
538 charge = mdatoms->chargeA;
539 nvdwtype = fr->ntype;
541 vdwtype = mdatoms->typeA;
543 /* Setup water-specific parameters */
544 inr = nlist->iinr[0];
545 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
546 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
547 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
548 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
550 /* Avoid stupid compiler warnings */
558 /* Start outer loop over neighborlists */
559 for(iidx=0; iidx<nri; iidx++)
561 /* Load shift vector for this list */
562 i_shift_offset = DIM*shiftidx[iidx];
564 /* Load limits for loop over neighbors */
565 j_index_start = jindex[iidx];
566 j_index_end = jindex[iidx+1];
568 /* Get outer coordinate index */
570 i_coord_offset = DIM*inr;
572 /* Load i particle coords and add shift vector */
573 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
574 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
576 fix0 = _fjsp_setzero_v2r8();
577 fiy0 = _fjsp_setzero_v2r8();
578 fiz0 = _fjsp_setzero_v2r8();
579 fix1 = _fjsp_setzero_v2r8();
580 fiy1 = _fjsp_setzero_v2r8();
581 fiz1 = _fjsp_setzero_v2r8();
582 fix2 = _fjsp_setzero_v2r8();
583 fiy2 = _fjsp_setzero_v2r8();
584 fiz2 = _fjsp_setzero_v2r8();
586 /* Start inner kernel loop */
587 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
590 /* Get j neighbor index, and coordinate index */
593 j_coord_offsetA = DIM*jnrA;
594 j_coord_offsetB = DIM*jnrB;
596 /* load j atom coordinates */
597 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
600 /* Calculate displacement vector */
601 dx00 = _fjsp_sub_v2r8(ix0,jx0);
602 dy00 = _fjsp_sub_v2r8(iy0,jy0);
603 dz00 = _fjsp_sub_v2r8(iz0,jz0);
604 dx10 = _fjsp_sub_v2r8(ix1,jx0);
605 dy10 = _fjsp_sub_v2r8(iy1,jy0);
606 dz10 = _fjsp_sub_v2r8(iz1,jz0);
607 dx20 = _fjsp_sub_v2r8(ix2,jx0);
608 dy20 = _fjsp_sub_v2r8(iy2,jy0);
609 dz20 = _fjsp_sub_v2r8(iz2,jz0);
611 /* Calculate squared distance and things based on it */
612 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
613 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
614 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
616 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
617 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
618 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
620 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
621 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
622 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
624 /* Load parameters for j particles */
625 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
626 vdwjidx0A = 2*vdwtype[jnrA+0];
627 vdwjidx0B = 2*vdwtype[jnrB+0];
629 fjx0 = _fjsp_setzero_v2r8();
630 fjy0 = _fjsp_setzero_v2r8();
631 fjz0 = _fjsp_setzero_v2r8();
633 /**************************
634 * CALCULATE INTERACTIONS *
635 **************************/
637 /* Compute parameters for interactions between i and j atoms */
638 qq00 = _fjsp_mul_v2r8(iq0,jq0);
639 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
640 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
642 /* COULOMB ELECTROSTATICS */
643 velec = _fjsp_mul_v2r8(qq00,rinv00);
644 felec = _fjsp_mul_v2r8(velec,rinvsq00);
646 /* LENNARD-JONES DISPERSION/REPULSION */
648 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
649 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
651 fscal = _fjsp_add_v2r8(felec,fvdw);
653 /* Update vectorial force */
654 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
655 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
656 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
658 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
659 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
660 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
662 /**************************
663 * CALCULATE INTERACTIONS *
664 **************************/
666 /* Compute parameters for interactions between i and j atoms */
667 qq10 = _fjsp_mul_v2r8(iq1,jq0);
669 /* COULOMB ELECTROSTATICS */
670 velec = _fjsp_mul_v2r8(qq10,rinv10);
671 felec = _fjsp_mul_v2r8(velec,rinvsq10);
675 /* Update vectorial force */
676 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
677 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
678 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
680 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
681 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
682 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
684 /**************************
685 * CALCULATE INTERACTIONS *
686 **************************/
688 /* Compute parameters for interactions between i and j atoms */
689 qq20 = _fjsp_mul_v2r8(iq2,jq0);
691 /* COULOMB ELECTROSTATICS */
692 velec = _fjsp_mul_v2r8(qq20,rinv20);
693 felec = _fjsp_mul_v2r8(velec,rinvsq20);
697 /* Update vectorial force */
698 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
699 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
700 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
702 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
703 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
704 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
706 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
708 /* Inner loop uses 100 flops */
715 j_coord_offsetA = DIM*jnrA;
717 /* load j atom coordinates */
718 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
721 /* Calculate displacement vector */
722 dx00 = _fjsp_sub_v2r8(ix0,jx0);
723 dy00 = _fjsp_sub_v2r8(iy0,jy0);
724 dz00 = _fjsp_sub_v2r8(iz0,jz0);
725 dx10 = _fjsp_sub_v2r8(ix1,jx0);
726 dy10 = _fjsp_sub_v2r8(iy1,jy0);
727 dz10 = _fjsp_sub_v2r8(iz1,jz0);
728 dx20 = _fjsp_sub_v2r8(ix2,jx0);
729 dy20 = _fjsp_sub_v2r8(iy2,jy0);
730 dz20 = _fjsp_sub_v2r8(iz2,jz0);
732 /* Calculate squared distance and things based on it */
733 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
734 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
735 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
737 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
738 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
739 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
741 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
742 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
743 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
745 /* Load parameters for j particles */
746 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
747 vdwjidx0A = 2*vdwtype[jnrA+0];
749 fjx0 = _fjsp_setzero_v2r8();
750 fjy0 = _fjsp_setzero_v2r8();
751 fjz0 = _fjsp_setzero_v2r8();
753 /**************************
754 * CALCULATE INTERACTIONS *
755 **************************/
757 /* Compute parameters for interactions between i and j atoms */
758 qq00 = _fjsp_mul_v2r8(iq0,jq0);
759 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
761 /* COULOMB ELECTROSTATICS */
762 velec = _fjsp_mul_v2r8(qq00,rinv00);
763 felec = _fjsp_mul_v2r8(velec,rinvsq00);
765 /* LENNARD-JONES DISPERSION/REPULSION */
767 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
768 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
770 fscal = _fjsp_add_v2r8(felec,fvdw);
772 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
774 /* Update vectorial force */
775 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
776 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
777 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
779 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
780 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
781 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
783 /**************************
784 * CALCULATE INTERACTIONS *
785 **************************/
787 /* Compute parameters for interactions between i and j atoms */
788 qq10 = _fjsp_mul_v2r8(iq1,jq0);
790 /* COULOMB ELECTROSTATICS */
791 velec = _fjsp_mul_v2r8(qq10,rinv10);
792 felec = _fjsp_mul_v2r8(velec,rinvsq10);
796 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
798 /* Update vectorial force */
799 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
800 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
801 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
803 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
804 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
805 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
807 /**************************
808 * CALCULATE INTERACTIONS *
809 **************************/
811 /* Compute parameters for interactions between i and j atoms */
812 qq20 = _fjsp_mul_v2r8(iq2,jq0);
814 /* COULOMB ELECTROSTATICS */
815 velec = _fjsp_mul_v2r8(qq20,rinv20);
816 felec = _fjsp_mul_v2r8(velec,rinvsq20);
820 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
822 /* Update vectorial force */
823 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
824 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
825 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
827 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
828 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
829 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
831 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
833 /* Inner loop uses 100 flops */
836 /* End of innermost loop */
838 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
839 f+i_coord_offset,fshift+i_shift_offset);
841 /* Increment number of inner iterations */
842 inneriter += j_index_end - j_index_start;
844 /* Outer loop uses 18 flops */
847 /* Increment number of outer iterations */
850 /* Update outer/inner flops */
852 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*100);