2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "gromacs/legacyheaders/vec.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW3P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: LennardJones
55 * Geometry: Water3-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_VF_sparc64_hpc_ace_double
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int j_coord_offsetA,j_coord_offsetB;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
86 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
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 velec,felec,velecsum,facel,crf,krf,krf2;
95 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
99 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101 _fjsp_v2r8 dummy_mask,cutoff_mask;
102 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
103 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
104 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
111 jindex = nlist->jindex;
113 shiftidx = nlist->shift;
115 shiftvec = fr->shift_vec[0];
116 fshift = fr->fshift[0];
117 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
118 charge = mdatoms->chargeA;
119 nvdwtype = fr->ntype;
121 vdwtype = mdatoms->typeA;
123 /* Setup water-specific parameters */
124 inr = nlist->iinr[0];
125 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
126 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
127 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
128 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
130 /* Avoid stupid compiler warnings */
138 /* Start outer loop over neighborlists */
139 for(iidx=0; iidx<nri; iidx++)
141 /* Load shift vector for this list */
142 i_shift_offset = DIM*shiftidx[iidx];
144 /* Load limits for loop over neighbors */
145 j_index_start = jindex[iidx];
146 j_index_end = jindex[iidx+1];
148 /* Get outer coordinate index */
150 i_coord_offset = DIM*inr;
152 /* Load i particle coords and add shift vector */
153 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
154 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
156 fix0 = _fjsp_setzero_v2r8();
157 fiy0 = _fjsp_setzero_v2r8();
158 fiz0 = _fjsp_setzero_v2r8();
159 fix1 = _fjsp_setzero_v2r8();
160 fiy1 = _fjsp_setzero_v2r8();
161 fiz1 = _fjsp_setzero_v2r8();
162 fix2 = _fjsp_setzero_v2r8();
163 fiy2 = _fjsp_setzero_v2r8();
164 fiz2 = _fjsp_setzero_v2r8();
166 /* Reset potential sums */
167 velecsum = _fjsp_setzero_v2r8();
168 vvdwsum = _fjsp_setzero_v2r8();
170 /* Start inner kernel loop */
171 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
174 /* Get j neighbor index, and coordinate index */
177 j_coord_offsetA = DIM*jnrA;
178 j_coord_offsetB = DIM*jnrB;
180 /* load j atom coordinates */
181 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
184 /* Calculate displacement vector */
185 dx00 = _fjsp_sub_v2r8(ix0,jx0);
186 dy00 = _fjsp_sub_v2r8(iy0,jy0);
187 dz00 = _fjsp_sub_v2r8(iz0,jz0);
188 dx10 = _fjsp_sub_v2r8(ix1,jx0);
189 dy10 = _fjsp_sub_v2r8(iy1,jy0);
190 dz10 = _fjsp_sub_v2r8(iz1,jz0);
191 dx20 = _fjsp_sub_v2r8(ix2,jx0);
192 dy20 = _fjsp_sub_v2r8(iy2,jy0);
193 dz20 = _fjsp_sub_v2r8(iz2,jz0);
195 /* Calculate squared distance and things based on it */
196 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
197 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
198 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
200 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
201 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
202 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
204 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
205 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
206 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
208 /* Load parameters for j particles */
209 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
210 vdwjidx0A = 2*vdwtype[jnrA+0];
211 vdwjidx0B = 2*vdwtype[jnrB+0];
213 fjx0 = _fjsp_setzero_v2r8();
214 fjy0 = _fjsp_setzero_v2r8();
215 fjz0 = _fjsp_setzero_v2r8();
217 /**************************
218 * CALCULATE INTERACTIONS *
219 **************************/
221 /* Compute parameters for interactions between i and j atoms */
222 qq00 = _fjsp_mul_v2r8(iq0,jq0);
223 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
224 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
226 /* COULOMB ELECTROSTATICS */
227 velec = _fjsp_mul_v2r8(qq00,rinv00);
228 felec = _fjsp_mul_v2r8(velec,rinvsq00);
230 /* LENNARD-JONES DISPERSION/REPULSION */
232 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
233 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
234 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
235 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
236 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
238 /* Update potential sum for this i atom from the interaction with this j atom. */
239 velecsum = _fjsp_add_v2r8(velecsum,velec);
240 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
242 fscal = _fjsp_add_v2r8(felec,fvdw);
244 /* Update vectorial force */
245 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
246 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
247 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
249 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
250 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
251 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
253 /**************************
254 * CALCULATE INTERACTIONS *
255 **************************/
257 /* Compute parameters for interactions between i and j atoms */
258 qq10 = _fjsp_mul_v2r8(iq1,jq0);
260 /* COULOMB ELECTROSTATICS */
261 velec = _fjsp_mul_v2r8(qq10,rinv10);
262 felec = _fjsp_mul_v2r8(velec,rinvsq10);
264 /* Update potential sum for this i atom from the interaction with this j atom. */
265 velecsum = _fjsp_add_v2r8(velecsum,velec);
269 /* Update vectorial force */
270 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
271 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
272 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
274 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
275 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
276 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
278 /**************************
279 * CALCULATE INTERACTIONS *
280 **************************/
282 /* Compute parameters for interactions between i and j atoms */
283 qq20 = _fjsp_mul_v2r8(iq2,jq0);
285 /* COULOMB ELECTROSTATICS */
286 velec = _fjsp_mul_v2r8(qq20,rinv20);
287 felec = _fjsp_mul_v2r8(velec,rinvsq20);
289 /* Update potential sum for this i atom from the interaction with this j atom. */
290 velecsum = _fjsp_add_v2r8(velecsum,velec);
294 /* Update vectorial force */
295 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
296 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
297 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
299 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
300 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
301 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
303 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
305 /* Inner loop uses 108 flops */
312 j_coord_offsetA = DIM*jnrA;
314 /* load j atom coordinates */
315 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
318 /* Calculate displacement vector */
319 dx00 = _fjsp_sub_v2r8(ix0,jx0);
320 dy00 = _fjsp_sub_v2r8(iy0,jy0);
321 dz00 = _fjsp_sub_v2r8(iz0,jz0);
322 dx10 = _fjsp_sub_v2r8(ix1,jx0);
323 dy10 = _fjsp_sub_v2r8(iy1,jy0);
324 dz10 = _fjsp_sub_v2r8(iz1,jz0);
325 dx20 = _fjsp_sub_v2r8(ix2,jx0);
326 dy20 = _fjsp_sub_v2r8(iy2,jy0);
327 dz20 = _fjsp_sub_v2r8(iz2,jz0);
329 /* Calculate squared distance and things based on it */
330 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
331 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
332 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
334 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
335 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
336 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
338 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
339 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
340 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
342 /* Load parameters for j particles */
343 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
344 vdwjidx0A = 2*vdwtype[jnrA+0];
346 fjx0 = _fjsp_setzero_v2r8();
347 fjy0 = _fjsp_setzero_v2r8();
348 fjz0 = _fjsp_setzero_v2r8();
350 /**************************
351 * CALCULATE INTERACTIONS *
352 **************************/
354 /* Compute parameters for interactions between i and j atoms */
355 qq00 = _fjsp_mul_v2r8(iq0,jq0);
356 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
357 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
359 /* COULOMB ELECTROSTATICS */
360 velec = _fjsp_mul_v2r8(qq00,rinv00);
361 felec = _fjsp_mul_v2r8(velec,rinvsq00);
363 /* LENNARD-JONES DISPERSION/REPULSION */
365 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
366 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
367 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
368 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
369 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
371 /* Update potential sum for this i atom from the interaction with this j atom. */
372 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
373 velecsum = _fjsp_add_v2r8(velecsum,velec);
374 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
375 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
377 fscal = _fjsp_add_v2r8(felec,fvdw);
379 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
381 /* Update vectorial force */
382 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
383 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
384 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
386 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
387 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
388 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
390 /**************************
391 * CALCULATE INTERACTIONS *
392 **************************/
394 /* Compute parameters for interactions between i and j atoms */
395 qq10 = _fjsp_mul_v2r8(iq1,jq0);
397 /* COULOMB ELECTROSTATICS */
398 velec = _fjsp_mul_v2r8(qq10,rinv10);
399 felec = _fjsp_mul_v2r8(velec,rinvsq10);
401 /* Update potential sum for this i atom from the interaction with this j atom. */
402 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
403 velecsum = _fjsp_add_v2r8(velecsum,velec);
407 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
409 /* Update vectorial force */
410 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
411 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
412 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
414 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
415 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
416 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
418 /**************************
419 * CALCULATE INTERACTIONS *
420 **************************/
422 /* Compute parameters for interactions between i and j atoms */
423 qq20 = _fjsp_mul_v2r8(iq2,jq0);
425 /* COULOMB ELECTROSTATICS */
426 velec = _fjsp_mul_v2r8(qq20,rinv20);
427 felec = _fjsp_mul_v2r8(velec,rinvsq20);
429 /* Update potential sum for this i atom from the interaction with this j atom. */
430 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
431 velecsum = _fjsp_add_v2r8(velecsum,velec);
435 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
437 /* Update vectorial force */
438 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
439 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
440 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
442 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
443 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
444 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
446 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
448 /* Inner loop uses 108 flops */
451 /* End of innermost loop */
453 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
454 f+i_coord_offset,fshift+i_shift_offset);
457 /* Update potential energies */
458 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
459 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
461 /* Increment number of inner iterations */
462 inneriter += j_index_end - j_index_start;
464 /* Outer loop uses 20 flops */
467 /* Increment number of outer iterations */
470 /* Update outer/inner flops */
472 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*108);
475 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
476 * Electrostatics interaction: Coulomb
477 * VdW interaction: LennardJones
478 * Geometry: Water3-Particle
479 * Calculate force/pot: Force
482 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
483 (t_nblist * gmx_restrict nlist,
484 rvec * gmx_restrict xx,
485 rvec * gmx_restrict ff,
486 t_forcerec * gmx_restrict fr,
487 t_mdatoms * gmx_restrict mdatoms,
488 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
489 t_nrnb * gmx_restrict nrnb)
491 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
492 * just 0 for non-waters.
493 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
494 * jnr indices corresponding to data put in the four positions in the SIMD register.
496 int i_shift_offset,i_coord_offset,outeriter,inneriter;
497 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
499 int j_coord_offsetA,j_coord_offsetB;
500 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
502 real *shiftvec,*fshift,*x,*f;
503 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
505 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
507 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
509 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
510 int vdwjidx0A,vdwjidx0B;
511 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
512 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
513 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
514 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
515 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
518 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
521 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
522 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
524 _fjsp_v2r8 dummy_mask,cutoff_mask;
525 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
526 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
527 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
534 jindex = nlist->jindex;
536 shiftidx = nlist->shift;
538 shiftvec = fr->shift_vec[0];
539 fshift = fr->fshift[0];
540 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
541 charge = mdatoms->chargeA;
542 nvdwtype = fr->ntype;
544 vdwtype = mdatoms->typeA;
546 /* Setup water-specific parameters */
547 inr = nlist->iinr[0];
548 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
549 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
550 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
551 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
553 /* Avoid stupid compiler warnings */
561 /* Start outer loop over neighborlists */
562 for(iidx=0; iidx<nri; iidx++)
564 /* Load shift vector for this list */
565 i_shift_offset = DIM*shiftidx[iidx];
567 /* Load limits for loop over neighbors */
568 j_index_start = jindex[iidx];
569 j_index_end = jindex[iidx+1];
571 /* Get outer coordinate index */
573 i_coord_offset = DIM*inr;
575 /* Load i particle coords and add shift vector */
576 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
577 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
579 fix0 = _fjsp_setzero_v2r8();
580 fiy0 = _fjsp_setzero_v2r8();
581 fiz0 = _fjsp_setzero_v2r8();
582 fix1 = _fjsp_setzero_v2r8();
583 fiy1 = _fjsp_setzero_v2r8();
584 fiz1 = _fjsp_setzero_v2r8();
585 fix2 = _fjsp_setzero_v2r8();
586 fiy2 = _fjsp_setzero_v2r8();
587 fiz2 = _fjsp_setzero_v2r8();
589 /* Start inner kernel loop */
590 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
593 /* Get j neighbor index, and coordinate index */
596 j_coord_offsetA = DIM*jnrA;
597 j_coord_offsetB = DIM*jnrB;
599 /* load j atom coordinates */
600 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
603 /* Calculate displacement vector */
604 dx00 = _fjsp_sub_v2r8(ix0,jx0);
605 dy00 = _fjsp_sub_v2r8(iy0,jy0);
606 dz00 = _fjsp_sub_v2r8(iz0,jz0);
607 dx10 = _fjsp_sub_v2r8(ix1,jx0);
608 dy10 = _fjsp_sub_v2r8(iy1,jy0);
609 dz10 = _fjsp_sub_v2r8(iz1,jz0);
610 dx20 = _fjsp_sub_v2r8(ix2,jx0);
611 dy20 = _fjsp_sub_v2r8(iy2,jy0);
612 dz20 = _fjsp_sub_v2r8(iz2,jz0);
614 /* Calculate squared distance and things based on it */
615 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
616 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
617 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
619 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
620 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
621 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
623 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
624 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
625 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
627 /* Load parameters for j particles */
628 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
629 vdwjidx0A = 2*vdwtype[jnrA+0];
630 vdwjidx0B = 2*vdwtype[jnrB+0];
632 fjx0 = _fjsp_setzero_v2r8();
633 fjy0 = _fjsp_setzero_v2r8();
634 fjz0 = _fjsp_setzero_v2r8();
636 /**************************
637 * CALCULATE INTERACTIONS *
638 **************************/
640 /* Compute parameters for interactions between i and j atoms */
641 qq00 = _fjsp_mul_v2r8(iq0,jq0);
642 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
643 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
645 /* COULOMB ELECTROSTATICS */
646 velec = _fjsp_mul_v2r8(qq00,rinv00);
647 felec = _fjsp_mul_v2r8(velec,rinvsq00);
649 /* LENNARD-JONES DISPERSION/REPULSION */
651 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
652 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
654 fscal = _fjsp_add_v2r8(felec,fvdw);
656 /* Update vectorial force */
657 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
658 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
659 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
661 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
662 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
663 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
665 /**************************
666 * CALCULATE INTERACTIONS *
667 **************************/
669 /* Compute parameters for interactions between i and j atoms */
670 qq10 = _fjsp_mul_v2r8(iq1,jq0);
672 /* COULOMB ELECTROSTATICS */
673 velec = _fjsp_mul_v2r8(qq10,rinv10);
674 felec = _fjsp_mul_v2r8(velec,rinvsq10);
678 /* Update vectorial force */
679 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
680 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
681 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
683 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
684 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
685 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
687 /**************************
688 * CALCULATE INTERACTIONS *
689 **************************/
691 /* Compute parameters for interactions between i and j atoms */
692 qq20 = _fjsp_mul_v2r8(iq2,jq0);
694 /* COULOMB ELECTROSTATICS */
695 velec = _fjsp_mul_v2r8(qq20,rinv20);
696 felec = _fjsp_mul_v2r8(velec,rinvsq20);
700 /* Update vectorial force */
701 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
702 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
703 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
705 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
706 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
707 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
709 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
711 /* Inner loop uses 100 flops */
718 j_coord_offsetA = DIM*jnrA;
720 /* load j atom coordinates */
721 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
724 /* Calculate displacement vector */
725 dx00 = _fjsp_sub_v2r8(ix0,jx0);
726 dy00 = _fjsp_sub_v2r8(iy0,jy0);
727 dz00 = _fjsp_sub_v2r8(iz0,jz0);
728 dx10 = _fjsp_sub_v2r8(ix1,jx0);
729 dy10 = _fjsp_sub_v2r8(iy1,jy0);
730 dz10 = _fjsp_sub_v2r8(iz1,jz0);
731 dx20 = _fjsp_sub_v2r8(ix2,jx0);
732 dy20 = _fjsp_sub_v2r8(iy2,jy0);
733 dz20 = _fjsp_sub_v2r8(iz2,jz0);
735 /* Calculate squared distance and things based on it */
736 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
737 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
738 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
740 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
741 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
742 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
744 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
745 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
746 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
748 /* Load parameters for j particles */
749 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
750 vdwjidx0A = 2*vdwtype[jnrA+0];
752 fjx0 = _fjsp_setzero_v2r8();
753 fjy0 = _fjsp_setzero_v2r8();
754 fjz0 = _fjsp_setzero_v2r8();
756 /**************************
757 * CALCULATE INTERACTIONS *
758 **************************/
760 /* Compute parameters for interactions between i and j atoms */
761 qq00 = _fjsp_mul_v2r8(iq0,jq0);
762 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
763 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
765 /* COULOMB ELECTROSTATICS */
766 velec = _fjsp_mul_v2r8(qq00,rinv00);
767 felec = _fjsp_mul_v2r8(velec,rinvsq00);
769 /* LENNARD-JONES DISPERSION/REPULSION */
771 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
772 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
774 fscal = _fjsp_add_v2r8(felec,fvdw);
776 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
778 /* Update vectorial force */
779 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
780 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
781 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
783 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
784 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
785 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
787 /**************************
788 * CALCULATE INTERACTIONS *
789 **************************/
791 /* Compute parameters for interactions between i and j atoms */
792 qq10 = _fjsp_mul_v2r8(iq1,jq0);
794 /* COULOMB ELECTROSTATICS */
795 velec = _fjsp_mul_v2r8(qq10,rinv10);
796 felec = _fjsp_mul_v2r8(velec,rinvsq10);
800 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
802 /* Update vectorial force */
803 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
804 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
805 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
807 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
808 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
809 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
811 /**************************
812 * CALCULATE INTERACTIONS *
813 **************************/
815 /* Compute parameters for interactions between i and j atoms */
816 qq20 = _fjsp_mul_v2r8(iq2,jq0);
818 /* COULOMB ELECTROSTATICS */
819 velec = _fjsp_mul_v2r8(qq20,rinv20);
820 felec = _fjsp_mul_v2r8(velec,rinvsq20);
824 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
826 /* Update vectorial force */
827 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
828 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
829 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
831 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
832 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
833 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
835 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
837 /* Inner loop uses 100 flops */
840 /* End of innermost loop */
842 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
843 f+i_coord_offset,fshift+i_shift_offset);
845 /* Increment number of inner iterations */
846 inneriter += j_index_end - j_index_start;
848 /* Outer loop uses 18 flops */
851 /* Increment number of outer iterations */
854 /* Update outer/inner flops */
856 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*100);