2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012, by the GROMACS development team, led by
5 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 * others, as listed in the AUTHORS file in the top-level source
7 * 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"
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_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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
358 /* COULOMB ELECTROSTATICS */
359 velec = _fjsp_mul_v2r8(qq00,rinv00);
360 felec = _fjsp_mul_v2r8(velec,rinvsq00);
362 /* LENNARD-JONES DISPERSION/REPULSION */
364 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
365 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
366 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
367 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
368 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
370 /* Update potential sum for this i atom from the interaction with this j atom. */
371 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
372 velecsum = _fjsp_add_v2r8(velecsum,velec);
373 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
374 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
376 fscal = _fjsp_add_v2r8(felec,fvdw);
378 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
380 /* Update vectorial force */
381 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
382 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
383 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
385 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
386 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
387 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
389 /**************************
390 * CALCULATE INTERACTIONS *
391 **************************/
393 /* Compute parameters for interactions between i and j atoms */
394 qq10 = _fjsp_mul_v2r8(iq1,jq0);
396 /* COULOMB ELECTROSTATICS */
397 velec = _fjsp_mul_v2r8(qq10,rinv10);
398 felec = _fjsp_mul_v2r8(velec,rinvsq10);
400 /* Update potential sum for this i atom from the interaction with this j atom. */
401 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
402 velecsum = _fjsp_add_v2r8(velecsum,velec);
406 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
408 /* Update vectorial force */
409 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
410 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
411 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
413 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
414 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
415 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
417 /**************************
418 * CALCULATE INTERACTIONS *
419 **************************/
421 /* Compute parameters for interactions between i and j atoms */
422 qq20 = _fjsp_mul_v2r8(iq2,jq0);
424 /* COULOMB ELECTROSTATICS */
425 velec = _fjsp_mul_v2r8(qq20,rinv20);
426 felec = _fjsp_mul_v2r8(velec,rinvsq20);
428 /* Update potential sum for this i atom from the interaction with this j atom. */
429 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
430 velecsum = _fjsp_add_v2r8(velecsum,velec);
434 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
436 /* Update vectorial force */
437 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
438 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
439 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
441 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
442 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
443 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
445 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
447 /* Inner loop uses 108 flops */
450 /* End of innermost loop */
452 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
453 f+i_coord_offset,fshift+i_shift_offset);
456 /* Update potential energies */
457 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
458 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
460 /* Increment number of inner iterations */
461 inneriter += j_index_end - j_index_start;
463 /* Outer loop uses 20 flops */
466 /* Increment number of outer iterations */
469 /* Update outer/inner flops */
471 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*108);
474 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
475 * Electrostatics interaction: Coulomb
476 * VdW interaction: LennardJones
477 * Geometry: Water3-Particle
478 * Calculate force/pot: Force
481 nb_kernel_ElecCoul_VdwLJ_GeomW3P1_F_sparc64_hpc_ace_double
482 (t_nblist * gmx_restrict nlist,
483 rvec * gmx_restrict xx,
484 rvec * gmx_restrict ff,
485 t_forcerec * gmx_restrict fr,
486 t_mdatoms * gmx_restrict mdatoms,
487 nb_kernel_data_t * gmx_restrict kernel_data,
488 t_nrnb * gmx_restrict nrnb)
490 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
491 * just 0 for non-waters.
492 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
493 * jnr indices corresponding to data put in the four positions in the SIMD register.
495 int i_shift_offset,i_coord_offset,outeriter,inneriter;
496 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
498 int j_coord_offsetA,j_coord_offsetB;
499 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
501 real *shiftvec,*fshift,*x,*f;
502 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
504 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
506 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
508 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
509 int vdwjidx0A,vdwjidx0B;
510 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
511 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
512 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
513 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
514 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
517 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
520 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
521 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
523 _fjsp_v2r8 dummy_mask,cutoff_mask;
524 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
525 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
526 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
533 jindex = nlist->jindex;
535 shiftidx = nlist->shift;
537 shiftvec = fr->shift_vec[0];
538 fshift = fr->fshift[0];
539 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
540 charge = mdatoms->chargeA;
541 nvdwtype = fr->ntype;
543 vdwtype = mdatoms->typeA;
545 /* Setup water-specific parameters */
546 inr = nlist->iinr[0];
547 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
548 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
549 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
550 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
552 /* Avoid stupid compiler warnings */
560 /* Start outer loop over neighborlists */
561 for(iidx=0; iidx<nri; iidx++)
563 /* Load shift vector for this list */
564 i_shift_offset = DIM*shiftidx[iidx];
566 /* Load limits for loop over neighbors */
567 j_index_start = jindex[iidx];
568 j_index_end = jindex[iidx+1];
570 /* Get outer coordinate index */
572 i_coord_offset = DIM*inr;
574 /* Load i particle coords and add shift vector */
575 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
576 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
578 fix0 = _fjsp_setzero_v2r8();
579 fiy0 = _fjsp_setzero_v2r8();
580 fiz0 = _fjsp_setzero_v2r8();
581 fix1 = _fjsp_setzero_v2r8();
582 fiy1 = _fjsp_setzero_v2r8();
583 fiz1 = _fjsp_setzero_v2r8();
584 fix2 = _fjsp_setzero_v2r8();
585 fiy2 = _fjsp_setzero_v2r8();
586 fiz2 = _fjsp_setzero_v2r8();
588 /* Start inner kernel loop */
589 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
592 /* Get j neighbor index, and coordinate index */
595 j_coord_offsetA = DIM*jnrA;
596 j_coord_offsetB = DIM*jnrB;
598 /* load j atom coordinates */
599 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
602 /* Calculate displacement vector */
603 dx00 = _fjsp_sub_v2r8(ix0,jx0);
604 dy00 = _fjsp_sub_v2r8(iy0,jy0);
605 dz00 = _fjsp_sub_v2r8(iz0,jz0);
606 dx10 = _fjsp_sub_v2r8(ix1,jx0);
607 dy10 = _fjsp_sub_v2r8(iy1,jy0);
608 dz10 = _fjsp_sub_v2r8(iz1,jz0);
609 dx20 = _fjsp_sub_v2r8(ix2,jx0);
610 dy20 = _fjsp_sub_v2r8(iy2,jy0);
611 dz20 = _fjsp_sub_v2r8(iz2,jz0);
613 /* Calculate squared distance and things based on it */
614 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
615 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
616 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
618 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
619 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
620 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
622 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
623 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
624 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
626 /* Load parameters for j particles */
627 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
628 vdwjidx0A = 2*vdwtype[jnrA+0];
629 vdwjidx0B = 2*vdwtype[jnrB+0];
631 fjx0 = _fjsp_setzero_v2r8();
632 fjy0 = _fjsp_setzero_v2r8();
633 fjz0 = _fjsp_setzero_v2r8();
635 /**************************
636 * CALCULATE INTERACTIONS *
637 **************************/
639 /* Compute parameters for interactions between i and j atoms */
640 qq00 = _fjsp_mul_v2r8(iq0,jq0);
641 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
642 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
644 /* COULOMB ELECTROSTATICS */
645 velec = _fjsp_mul_v2r8(qq00,rinv00);
646 felec = _fjsp_mul_v2r8(velec,rinvsq00);
648 /* LENNARD-JONES DISPERSION/REPULSION */
650 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
651 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
653 fscal = _fjsp_add_v2r8(felec,fvdw);
655 /* Update vectorial force */
656 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
657 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
658 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
660 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
661 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
662 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
664 /**************************
665 * CALCULATE INTERACTIONS *
666 **************************/
668 /* Compute parameters for interactions between i and j atoms */
669 qq10 = _fjsp_mul_v2r8(iq1,jq0);
671 /* COULOMB ELECTROSTATICS */
672 velec = _fjsp_mul_v2r8(qq10,rinv10);
673 felec = _fjsp_mul_v2r8(velec,rinvsq10);
677 /* Update vectorial force */
678 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
679 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
680 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
682 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
683 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
684 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
686 /**************************
687 * CALCULATE INTERACTIONS *
688 **************************/
690 /* Compute parameters for interactions between i and j atoms */
691 qq20 = _fjsp_mul_v2r8(iq2,jq0);
693 /* COULOMB ELECTROSTATICS */
694 velec = _fjsp_mul_v2r8(qq20,rinv20);
695 felec = _fjsp_mul_v2r8(velec,rinvsq20);
699 /* Update vectorial force */
700 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
701 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
702 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
704 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
705 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
706 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
708 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
710 /* Inner loop uses 100 flops */
717 j_coord_offsetA = DIM*jnrA;
719 /* load j atom coordinates */
720 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
723 /* Calculate displacement vector */
724 dx00 = _fjsp_sub_v2r8(ix0,jx0);
725 dy00 = _fjsp_sub_v2r8(iy0,jy0);
726 dz00 = _fjsp_sub_v2r8(iz0,jz0);
727 dx10 = _fjsp_sub_v2r8(ix1,jx0);
728 dy10 = _fjsp_sub_v2r8(iy1,jy0);
729 dz10 = _fjsp_sub_v2r8(iz1,jz0);
730 dx20 = _fjsp_sub_v2r8(ix2,jx0);
731 dy20 = _fjsp_sub_v2r8(iy2,jy0);
732 dz20 = _fjsp_sub_v2r8(iz2,jz0);
734 /* Calculate squared distance and things based on it */
735 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
736 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
737 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
739 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
740 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
741 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
743 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
744 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
745 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
747 /* Load parameters for j particles */
748 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
749 vdwjidx0A = 2*vdwtype[jnrA+0];
751 fjx0 = _fjsp_setzero_v2r8();
752 fjy0 = _fjsp_setzero_v2r8();
753 fjz0 = _fjsp_setzero_v2r8();
755 /**************************
756 * CALCULATE INTERACTIONS *
757 **************************/
759 /* Compute parameters for interactions between i and j atoms */
760 qq00 = _fjsp_mul_v2r8(iq0,jq0);
761 gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&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);