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 "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
49 #include "kernelutil_sparc64_hpc_ace_double.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Coulomb
54 * VdW interaction: None
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecCoul_VdwNone_GeomP1P1_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;
83 int vdwjidx0A,vdwjidx0B;
84 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
85 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
86 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
89 _fjsp_v2r8 dummy_mask,cutoff_mask;
90 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
91 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
92 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
99 jindex = nlist->jindex;
101 shiftidx = nlist->shift;
103 shiftvec = fr->shift_vec[0];
104 fshift = fr->fshift[0];
105 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
106 charge = mdatoms->chargeA;
108 /* Avoid stupid compiler warnings */
116 /* Start outer loop over neighborlists */
117 for(iidx=0; iidx<nri; iidx++)
119 /* Load shift vector for this list */
120 i_shift_offset = DIM*shiftidx[iidx];
122 /* Load limits for loop over neighbors */
123 j_index_start = jindex[iidx];
124 j_index_end = jindex[iidx+1];
126 /* Get outer coordinate index */
128 i_coord_offset = DIM*inr;
130 /* Load i particle coords and add shift vector */
131 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
133 fix0 = _fjsp_setzero_v2r8();
134 fiy0 = _fjsp_setzero_v2r8();
135 fiz0 = _fjsp_setzero_v2r8();
137 /* Load parameters for i particles */
138 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
140 /* Reset potential sums */
141 velecsum = _fjsp_setzero_v2r8();
143 /* Start inner kernel loop */
144 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
147 /* Get j neighbor index, and coordinate index */
150 j_coord_offsetA = DIM*jnrA;
151 j_coord_offsetB = DIM*jnrB;
153 /* load j atom coordinates */
154 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
157 /* Calculate displacement vector */
158 dx00 = _fjsp_sub_v2r8(ix0,jx0);
159 dy00 = _fjsp_sub_v2r8(iy0,jy0);
160 dz00 = _fjsp_sub_v2r8(iz0,jz0);
162 /* Calculate squared distance and things based on it */
163 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
165 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
167 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
169 /* Load parameters for j particles */
170 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
172 /**************************
173 * CALCULATE INTERACTIONS *
174 **************************/
176 /* Compute parameters for interactions between i and j atoms */
177 qq00 = _fjsp_mul_v2r8(iq0,jq0);
179 /* COULOMB ELECTROSTATICS */
180 velec = _fjsp_mul_v2r8(qq00,rinv00);
181 felec = _fjsp_mul_v2r8(velec,rinvsq00);
183 /* Update potential sum for this i atom from the interaction with this j atom. */
184 velecsum = _fjsp_add_v2r8(velecsum,velec);
188 /* Update vectorial force */
189 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
190 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
191 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
193 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
195 /* Inner loop uses 31 flops */
202 j_coord_offsetA = DIM*jnrA;
204 /* load j atom coordinates */
205 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
208 /* Calculate displacement vector */
209 dx00 = _fjsp_sub_v2r8(ix0,jx0);
210 dy00 = _fjsp_sub_v2r8(iy0,jy0);
211 dz00 = _fjsp_sub_v2r8(iz0,jz0);
213 /* Calculate squared distance and things based on it */
214 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
216 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
218 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
220 /* Load parameters for j particles */
221 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
223 /**************************
224 * CALCULATE INTERACTIONS *
225 **************************/
227 /* Compute parameters for interactions between i and j atoms */
228 qq00 = _fjsp_mul_v2r8(iq0,jq0);
230 /* COULOMB ELECTROSTATICS */
231 velec = _fjsp_mul_v2r8(qq00,rinv00);
232 felec = _fjsp_mul_v2r8(velec,rinvsq00);
234 /* Update potential sum for this i atom from the interaction with this j atom. */
235 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
236 velecsum = _fjsp_add_v2r8(velecsum,velec);
240 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
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 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
249 /* Inner loop uses 31 flops */
252 /* End of innermost loop */
254 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
255 f+i_coord_offset,fshift+i_shift_offset);
258 /* Update potential energies */
259 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
261 /* Increment number of inner iterations */
262 inneriter += j_index_end - j_index_start;
264 /* Outer loop uses 8 flops */
267 /* Increment number of outer iterations */
270 /* Update outer/inner flops */
272 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*31);
275 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
276 * Electrostatics interaction: Coulomb
277 * VdW interaction: None
278 * Geometry: Particle-Particle
279 * Calculate force/pot: Force
282 nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
283 (t_nblist * gmx_restrict nlist,
284 rvec * gmx_restrict xx,
285 rvec * gmx_restrict ff,
286 t_forcerec * gmx_restrict fr,
287 t_mdatoms * gmx_restrict mdatoms,
288 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
289 t_nrnb * gmx_restrict nrnb)
291 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
292 * just 0 for non-waters.
293 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
294 * jnr indices corresponding to data put in the four positions in the SIMD register.
296 int i_shift_offset,i_coord_offset,outeriter,inneriter;
297 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
299 int j_coord_offsetA,j_coord_offsetB;
300 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
302 real *shiftvec,*fshift,*x,*f;
303 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
305 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
306 int vdwjidx0A,vdwjidx0B;
307 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
308 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
309 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
312 _fjsp_v2r8 dummy_mask,cutoff_mask;
313 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
314 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
315 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
322 jindex = nlist->jindex;
324 shiftidx = nlist->shift;
326 shiftvec = fr->shift_vec[0];
327 fshift = fr->fshift[0];
328 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
329 charge = mdatoms->chargeA;
331 /* Avoid stupid compiler warnings */
339 /* Start outer loop over neighborlists */
340 for(iidx=0; iidx<nri; iidx++)
342 /* Load shift vector for this list */
343 i_shift_offset = DIM*shiftidx[iidx];
345 /* Load limits for loop over neighbors */
346 j_index_start = jindex[iidx];
347 j_index_end = jindex[iidx+1];
349 /* Get outer coordinate index */
351 i_coord_offset = DIM*inr;
353 /* Load i particle coords and add shift vector */
354 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
356 fix0 = _fjsp_setzero_v2r8();
357 fiy0 = _fjsp_setzero_v2r8();
358 fiz0 = _fjsp_setzero_v2r8();
360 /* Load parameters for i particles */
361 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
363 /* Start inner kernel loop */
364 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
367 /* Get j neighbor index, and coordinate index */
370 j_coord_offsetA = DIM*jnrA;
371 j_coord_offsetB = DIM*jnrB;
373 /* load j atom coordinates */
374 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
377 /* Calculate displacement vector */
378 dx00 = _fjsp_sub_v2r8(ix0,jx0);
379 dy00 = _fjsp_sub_v2r8(iy0,jy0);
380 dz00 = _fjsp_sub_v2r8(iz0,jz0);
382 /* Calculate squared distance and things based on it */
383 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
385 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
387 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
389 /* Load parameters for j particles */
390 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
392 /**************************
393 * CALCULATE INTERACTIONS *
394 **************************/
396 /* Compute parameters for interactions between i and j atoms */
397 qq00 = _fjsp_mul_v2r8(iq0,jq0);
399 /* COULOMB ELECTROSTATICS */
400 velec = _fjsp_mul_v2r8(qq00,rinv00);
401 felec = _fjsp_mul_v2r8(velec,rinvsq00);
405 /* Update vectorial force */
406 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
407 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
408 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
410 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
412 /* Inner loop uses 30 flops */
419 j_coord_offsetA = DIM*jnrA;
421 /* load j atom coordinates */
422 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
425 /* Calculate displacement vector */
426 dx00 = _fjsp_sub_v2r8(ix0,jx0);
427 dy00 = _fjsp_sub_v2r8(iy0,jy0);
428 dz00 = _fjsp_sub_v2r8(iz0,jz0);
430 /* Calculate squared distance and things based on it */
431 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
433 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
435 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
437 /* Load parameters for j particles */
438 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
440 /**************************
441 * CALCULATE INTERACTIONS *
442 **************************/
444 /* Compute parameters for interactions between i and j atoms */
445 qq00 = _fjsp_mul_v2r8(iq0,jq0);
447 /* COULOMB ELECTROSTATICS */
448 velec = _fjsp_mul_v2r8(qq00,rinv00);
449 felec = _fjsp_mul_v2r8(velec,rinvsq00);
453 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
455 /* Update vectorial force */
456 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
457 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
458 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
460 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
462 /* Inner loop uses 30 flops */
465 /* End of innermost loop */
467 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
468 f+i_coord_offset,fshift+i_shift_offset);
470 /* Increment number of inner iterations */
471 inneriter += j_index_end - j_index_start;
473 /* Outer loop uses 7 flops */
476 /* Increment number of outer iterations */
479 /* Update outer/inner flops */
481 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*30);