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 "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: None
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_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;
105 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
106 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
107 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
109 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
110 rcutoff_scalar = fr->rcoulomb;
111 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
112 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
114 /* Avoid stupid compiler warnings */
122 /* Start outer loop over neighborlists */
123 for(iidx=0; iidx<nri; iidx++)
125 /* Load shift vector for this list */
126 i_shift_offset = DIM*shiftidx[iidx];
128 /* Load limits for loop over neighbors */
129 j_index_start = jindex[iidx];
130 j_index_end = jindex[iidx+1];
132 /* Get outer coordinate index */
134 i_coord_offset = DIM*inr;
136 /* Load i particle coords and add shift vector */
137 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
139 fix0 = _fjsp_setzero_v2r8();
140 fiy0 = _fjsp_setzero_v2r8();
141 fiz0 = _fjsp_setzero_v2r8();
143 /* Load parameters for i particles */
144 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
146 /* Reset potential sums */
147 velecsum = _fjsp_setzero_v2r8();
149 /* Start inner kernel loop */
150 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
153 /* Get j neighbor index, and coordinate index */
156 j_coord_offsetA = DIM*jnrA;
157 j_coord_offsetB = DIM*jnrB;
159 /* load j atom coordinates */
160 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
163 /* Calculate displacement vector */
164 dx00 = _fjsp_sub_v2r8(ix0,jx0);
165 dy00 = _fjsp_sub_v2r8(iy0,jy0);
166 dz00 = _fjsp_sub_v2r8(iz0,jz0);
168 /* Calculate squared distance and things based on it */
169 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
171 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
173 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
175 /* Load parameters for j particles */
176 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
178 /**************************
179 * CALCULATE INTERACTIONS *
180 **************************/
182 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
185 /* Compute parameters for interactions between i and j atoms */
186 qq00 = _fjsp_mul_v2r8(iq0,jq0);
188 /* REACTION-FIELD ELECTROSTATICS */
189 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
190 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
192 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
194 /* Update potential sum for this i atom from the interaction with this j atom. */
195 velec = _fjsp_and_v2r8(velec,cutoff_mask);
196 velecsum = _fjsp_add_v2r8(velecsum,velec);
200 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
202 /* Update vectorial force */
203 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
204 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
205 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
207 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
211 /* Inner loop uses 39 flops */
218 j_coord_offsetA = DIM*jnrA;
220 /* load j atom coordinates */
221 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
224 /* Calculate displacement vector */
225 dx00 = _fjsp_sub_v2r8(ix0,jx0);
226 dy00 = _fjsp_sub_v2r8(iy0,jy0);
227 dz00 = _fjsp_sub_v2r8(iz0,jz0);
229 /* Calculate squared distance and things based on it */
230 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
232 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
234 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
236 /* Load parameters for j particles */
237 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
239 /**************************
240 * CALCULATE INTERACTIONS *
241 **************************/
243 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
246 /* Compute parameters for interactions between i and j atoms */
247 qq00 = _fjsp_mul_v2r8(iq0,jq0);
249 /* REACTION-FIELD ELECTROSTATICS */
250 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
251 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
253 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
255 /* Update potential sum for this i atom from the interaction with this j atom. */
256 velec = _fjsp_and_v2r8(velec,cutoff_mask);
257 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
258 velecsum = _fjsp_add_v2r8(velecsum,velec);
262 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
264 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
266 /* Update vectorial force */
267 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
268 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
269 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
271 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
275 /* Inner loop uses 39 flops */
278 /* End of innermost loop */
280 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
281 f+i_coord_offset,fshift+i_shift_offset);
284 /* Update potential energies */
285 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
287 /* Increment number of inner iterations */
288 inneriter += j_index_end - j_index_start;
290 /* Outer loop uses 8 flops */
293 /* Increment number of outer iterations */
296 /* Update outer/inner flops */
298 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*39);
301 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
302 * Electrostatics interaction: ReactionField
303 * VdW interaction: None
304 * Geometry: Particle-Particle
305 * Calculate force/pot: Force
308 nb_kernel_ElecRFCut_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
309 (t_nblist * gmx_restrict nlist,
310 rvec * gmx_restrict xx,
311 rvec * gmx_restrict ff,
312 t_forcerec * gmx_restrict fr,
313 t_mdatoms * gmx_restrict mdatoms,
314 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
315 t_nrnb * gmx_restrict nrnb)
317 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
318 * just 0 for non-waters.
319 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
320 * jnr indices corresponding to data put in the four positions in the SIMD register.
322 int i_shift_offset,i_coord_offset,outeriter,inneriter;
323 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
325 int j_coord_offsetA,j_coord_offsetB;
326 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
328 real *shiftvec,*fshift,*x,*f;
329 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
331 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
332 int vdwjidx0A,vdwjidx0B;
333 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
334 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
335 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
338 _fjsp_v2r8 dummy_mask,cutoff_mask;
339 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
340 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
341 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
348 jindex = nlist->jindex;
350 shiftidx = nlist->shift;
352 shiftvec = fr->shift_vec[0];
353 fshift = fr->fshift[0];
354 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
355 charge = mdatoms->chargeA;
356 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
357 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
358 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
360 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
361 rcutoff_scalar = fr->rcoulomb;
362 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
363 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
365 /* Avoid stupid compiler warnings */
373 /* Start outer loop over neighborlists */
374 for(iidx=0; iidx<nri; iidx++)
376 /* Load shift vector for this list */
377 i_shift_offset = DIM*shiftidx[iidx];
379 /* Load limits for loop over neighbors */
380 j_index_start = jindex[iidx];
381 j_index_end = jindex[iidx+1];
383 /* Get outer coordinate index */
385 i_coord_offset = DIM*inr;
387 /* Load i particle coords and add shift vector */
388 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
390 fix0 = _fjsp_setzero_v2r8();
391 fiy0 = _fjsp_setzero_v2r8();
392 fiz0 = _fjsp_setzero_v2r8();
394 /* Load parameters for i particles */
395 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
397 /* Start inner kernel loop */
398 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
401 /* Get j neighbor index, and coordinate index */
404 j_coord_offsetA = DIM*jnrA;
405 j_coord_offsetB = DIM*jnrB;
407 /* load j atom coordinates */
408 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
411 /* Calculate displacement vector */
412 dx00 = _fjsp_sub_v2r8(ix0,jx0);
413 dy00 = _fjsp_sub_v2r8(iy0,jy0);
414 dz00 = _fjsp_sub_v2r8(iz0,jz0);
416 /* Calculate squared distance and things based on it */
417 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
419 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
421 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
423 /* Load parameters for j particles */
424 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
426 /**************************
427 * CALCULATE INTERACTIONS *
428 **************************/
430 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
433 /* Compute parameters for interactions between i and j atoms */
434 qq00 = _fjsp_mul_v2r8(iq0,jq0);
436 /* REACTION-FIELD ELECTROSTATICS */
437 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
439 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
443 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
445 /* Update vectorial force */
446 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
447 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
448 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
450 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
454 /* Inner loop uses 33 flops */
461 j_coord_offsetA = DIM*jnrA;
463 /* load j atom coordinates */
464 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
467 /* Calculate displacement vector */
468 dx00 = _fjsp_sub_v2r8(ix0,jx0);
469 dy00 = _fjsp_sub_v2r8(iy0,jy0);
470 dz00 = _fjsp_sub_v2r8(iz0,jz0);
472 /* Calculate squared distance and things based on it */
473 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
475 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
477 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
479 /* Load parameters for j particles */
480 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
482 /**************************
483 * CALCULATE INTERACTIONS *
484 **************************/
486 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
489 /* Compute parameters for interactions between i and j atoms */
490 qq00 = _fjsp_mul_v2r8(iq0,jq0);
492 /* REACTION-FIELD ELECTROSTATICS */
493 felec = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
495 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
499 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
501 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
503 /* Update vectorial force */
504 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
505 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
506 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
508 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
512 /* Inner loop uses 33 flops */
515 /* End of innermost loop */
517 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
518 f+i_coord_offset,fshift+i_shift_offset);
520 /* Increment number of inner iterations */
521 inneriter += j_index_end - j_index_start;
523 /* Outer loop uses 7 flops */
526 /* Increment number of outer iterations */
529 /* Update outer/inner flops */
531 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*33);