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_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: None
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_VdwNone_GeomP1P1_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;
81 int vdwjidx0A,vdwjidx0B;
82 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
84 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
87 _fjsp_v2r8 dummy_mask,cutoff_mask;
88 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
89 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
90 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
97 jindex = nlist->jindex;
99 shiftidx = nlist->shift;
101 shiftvec = fr->shift_vec[0];
102 fshift = fr->fshift[0];
103 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
104 charge = mdatoms->chargeA;
106 /* Avoid stupid compiler warnings */
114 /* Start outer loop over neighborlists */
115 for(iidx=0; iidx<nri; iidx++)
117 /* Load shift vector for this list */
118 i_shift_offset = DIM*shiftidx[iidx];
120 /* Load limits for loop over neighbors */
121 j_index_start = jindex[iidx];
122 j_index_end = jindex[iidx+1];
124 /* Get outer coordinate index */
126 i_coord_offset = DIM*inr;
128 /* Load i particle coords and add shift vector */
129 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
131 fix0 = _fjsp_setzero_v2r8();
132 fiy0 = _fjsp_setzero_v2r8();
133 fiz0 = _fjsp_setzero_v2r8();
135 /* Load parameters for i particles */
136 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
138 /* Reset potential sums */
139 velecsum = _fjsp_setzero_v2r8();
141 /* Start inner kernel loop */
142 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
145 /* Get j neighbor index, and coordinate index */
148 j_coord_offsetA = DIM*jnrA;
149 j_coord_offsetB = DIM*jnrB;
151 /* load j atom coordinates */
152 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
155 /* Calculate displacement vector */
156 dx00 = _fjsp_sub_v2r8(ix0,jx0);
157 dy00 = _fjsp_sub_v2r8(iy0,jy0);
158 dz00 = _fjsp_sub_v2r8(iz0,jz0);
160 /* Calculate squared distance and things based on it */
161 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
163 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
165 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
167 /* Load parameters for j particles */
168 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
170 /**************************
171 * CALCULATE INTERACTIONS *
172 **************************/
174 /* Compute parameters for interactions between i and j atoms */
175 qq00 = _fjsp_mul_v2r8(iq0,jq0);
177 /* COULOMB ELECTROSTATICS */
178 velec = _fjsp_mul_v2r8(qq00,rinv00);
179 felec = _fjsp_mul_v2r8(velec,rinvsq00);
181 /* Update potential sum for this i atom from the interaction with this j atom. */
182 velecsum = _fjsp_add_v2r8(velecsum,velec);
186 /* Update vectorial force */
187 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
188 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
189 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
191 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
193 /* Inner loop uses 31 flops */
200 j_coord_offsetA = DIM*jnrA;
202 /* load j atom coordinates */
203 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
206 /* Calculate displacement vector */
207 dx00 = _fjsp_sub_v2r8(ix0,jx0);
208 dy00 = _fjsp_sub_v2r8(iy0,jy0);
209 dz00 = _fjsp_sub_v2r8(iz0,jz0);
211 /* Calculate squared distance and things based on it */
212 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
214 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
216 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
218 /* Load parameters for j particles */
219 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
221 /**************************
222 * CALCULATE INTERACTIONS *
223 **************************/
225 /* Compute parameters for interactions between i and j atoms */
226 qq00 = _fjsp_mul_v2r8(iq0,jq0);
228 /* COULOMB ELECTROSTATICS */
229 velec = _fjsp_mul_v2r8(qq00,rinv00);
230 felec = _fjsp_mul_v2r8(velec,rinvsq00);
232 /* Update potential sum for this i atom from the interaction with this j atom. */
233 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
234 velecsum = _fjsp_add_v2r8(velecsum,velec);
238 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
240 /* Update vectorial force */
241 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
242 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
243 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
245 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
247 /* Inner loop uses 31 flops */
250 /* End of innermost loop */
252 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
253 f+i_coord_offset,fshift+i_shift_offset);
256 /* Update potential energies */
257 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
259 /* Increment number of inner iterations */
260 inneriter += j_index_end - j_index_start;
262 /* Outer loop uses 8 flops */
265 /* Increment number of outer iterations */
268 /* Update outer/inner flops */
270 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*31);
273 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
274 * Electrostatics interaction: Coulomb
275 * VdW interaction: None
276 * Geometry: Particle-Particle
277 * Calculate force/pot: Force
280 nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
281 (t_nblist * gmx_restrict nlist,
282 rvec * gmx_restrict xx,
283 rvec * gmx_restrict ff,
284 t_forcerec * gmx_restrict fr,
285 t_mdatoms * gmx_restrict mdatoms,
286 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
287 t_nrnb * gmx_restrict nrnb)
289 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
290 * just 0 for non-waters.
291 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
292 * jnr indices corresponding to data put in the four positions in the SIMD register.
294 int i_shift_offset,i_coord_offset,outeriter,inneriter;
295 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
297 int j_coord_offsetA,j_coord_offsetB;
298 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
300 real *shiftvec,*fshift,*x,*f;
301 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
303 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
304 int vdwjidx0A,vdwjidx0B;
305 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
306 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
307 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
310 _fjsp_v2r8 dummy_mask,cutoff_mask;
311 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
312 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
313 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
320 jindex = nlist->jindex;
322 shiftidx = nlist->shift;
324 shiftvec = fr->shift_vec[0];
325 fshift = fr->fshift[0];
326 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
327 charge = mdatoms->chargeA;
329 /* Avoid stupid compiler warnings */
337 /* Start outer loop over neighborlists */
338 for(iidx=0; iidx<nri; iidx++)
340 /* Load shift vector for this list */
341 i_shift_offset = DIM*shiftidx[iidx];
343 /* Load limits for loop over neighbors */
344 j_index_start = jindex[iidx];
345 j_index_end = jindex[iidx+1];
347 /* Get outer coordinate index */
349 i_coord_offset = DIM*inr;
351 /* Load i particle coords and add shift vector */
352 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
354 fix0 = _fjsp_setzero_v2r8();
355 fiy0 = _fjsp_setzero_v2r8();
356 fiz0 = _fjsp_setzero_v2r8();
358 /* Load parameters for i particles */
359 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
361 /* Start inner kernel loop */
362 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
365 /* Get j neighbor index, and coordinate index */
368 j_coord_offsetA = DIM*jnrA;
369 j_coord_offsetB = DIM*jnrB;
371 /* load j atom coordinates */
372 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
375 /* Calculate displacement vector */
376 dx00 = _fjsp_sub_v2r8(ix0,jx0);
377 dy00 = _fjsp_sub_v2r8(iy0,jy0);
378 dz00 = _fjsp_sub_v2r8(iz0,jz0);
380 /* Calculate squared distance and things based on it */
381 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
383 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
385 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
387 /* Load parameters for j particles */
388 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
390 /**************************
391 * CALCULATE INTERACTIONS *
392 **************************/
394 /* Compute parameters for interactions between i and j atoms */
395 qq00 = _fjsp_mul_v2r8(iq0,jq0);
397 /* COULOMB ELECTROSTATICS */
398 velec = _fjsp_mul_v2r8(qq00,rinv00);
399 felec = _fjsp_mul_v2r8(velec,rinvsq00);
403 /* Update vectorial force */
404 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
405 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
406 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
408 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
410 /* Inner loop uses 30 flops */
417 j_coord_offsetA = DIM*jnrA;
419 /* load j atom coordinates */
420 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
423 /* Calculate displacement vector */
424 dx00 = _fjsp_sub_v2r8(ix0,jx0);
425 dy00 = _fjsp_sub_v2r8(iy0,jy0);
426 dz00 = _fjsp_sub_v2r8(iz0,jz0);
428 /* Calculate squared distance and things based on it */
429 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
431 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
433 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
435 /* Load parameters for j particles */
436 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
438 /**************************
439 * CALCULATE INTERACTIONS *
440 **************************/
442 /* Compute parameters for interactions between i and j atoms */
443 qq00 = _fjsp_mul_v2r8(iq0,jq0);
445 /* COULOMB ELECTROSTATICS */
446 velec = _fjsp_mul_v2r8(qq00,rinv00);
447 felec = _fjsp_mul_v2r8(velec,rinvsq00);
451 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
453 /* Update vectorial force */
454 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
455 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
456 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
458 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
460 /* Inner loop uses 30 flops */
463 /* End of innermost loop */
465 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
466 f+i_coord_offset,fshift+i_shift_offset);
468 /* Increment number of inner iterations */
469 inneriter += j_index_end - j_index_start;
471 /* Outer loop uses 7 flops */
474 /* Increment number of outer iterations */
477 /* Update outer/inner flops */
479 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*30);