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_ElecEwSw_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
53 * Electrostatics interaction: Ewald
54 * VdW interaction: None
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
59 nb_kernel_ElecEwSw_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;
88 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
90 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
91 real rswitch_scalar,d_scalar;
93 _fjsp_v2r8 dummy_mask,cutoff_mask;
94 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
95 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
96 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
103 jindex = nlist->jindex;
105 shiftidx = nlist->shift;
107 shiftvec = fr->shift_vec[0];
108 fshift = fr->fshift[0];
109 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
110 charge = mdatoms->chargeA;
112 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
113 ewtab = fr->ic->tabq_coul_FDV0;
114 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
115 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
117 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
118 rcutoff_scalar = fr->rcoulomb;
119 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
120 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
122 rswitch_scalar = fr->rcoulomb_switch;
123 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
124 /* Setup switch parameters */
125 d_scalar = rcutoff_scalar-rswitch_scalar;
126 d = gmx_fjsp_set1_v2r8(d_scalar);
127 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
128 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
129 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
130 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
131 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
132 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
134 /* Avoid stupid compiler warnings */
142 /* Start outer loop over neighborlists */
143 for(iidx=0; iidx<nri; iidx++)
145 /* Load shift vector for this list */
146 i_shift_offset = DIM*shiftidx[iidx];
148 /* Load limits for loop over neighbors */
149 j_index_start = jindex[iidx];
150 j_index_end = jindex[iidx+1];
152 /* Get outer coordinate index */
154 i_coord_offset = DIM*inr;
156 /* Load i particle coords and add shift vector */
157 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
159 fix0 = _fjsp_setzero_v2r8();
160 fiy0 = _fjsp_setzero_v2r8();
161 fiz0 = _fjsp_setzero_v2r8();
163 /* Load parameters for i particles */
164 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
166 /* Reset potential sums */
167 velecsum = _fjsp_setzero_v2r8();
169 /* Start inner kernel loop */
170 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
173 /* Get j neighbor index, and coordinate index */
176 j_coord_offsetA = DIM*jnrA;
177 j_coord_offsetB = DIM*jnrB;
179 /* load j atom coordinates */
180 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
183 /* Calculate displacement vector */
184 dx00 = _fjsp_sub_v2r8(ix0,jx0);
185 dy00 = _fjsp_sub_v2r8(iy0,jy0);
186 dz00 = _fjsp_sub_v2r8(iz0,jz0);
188 /* Calculate squared distance and things based on it */
189 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
191 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
193 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
195 /* Load parameters for j particles */
196 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
198 /**************************
199 * CALCULATE INTERACTIONS *
200 **************************/
202 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
205 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
207 /* Compute parameters for interactions between i and j atoms */
208 qq00 = _fjsp_mul_v2r8(iq0,jq0);
210 /* EWALD ELECTROSTATICS */
212 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
213 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
214 itab_tmp = _fjsp_dtox_v2r8(ewrt);
215 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
216 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
218 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
219 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
220 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
221 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
222 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
223 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
224 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
225 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
226 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
227 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
229 d = _fjsp_sub_v2r8(r00,rswitch);
230 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
231 d2 = _fjsp_mul_v2r8(d,d);
232 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
234 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
236 /* Evaluate switch function */
237 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
238 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
239 velec = _fjsp_mul_v2r8(velec,sw);
240 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
242 /* Update potential sum for this i atom from the interaction with this j atom. */
243 velec = _fjsp_and_v2r8(velec,cutoff_mask);
244 velecsum = _fjsp_add_v2r8(velecsum,velec);
248 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
250 /* Update vectorial force */
251 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
252 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
253 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
255 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
259 /* Inner loop uses 68 flops */
266 j_coord_offsetA = DIM*jnrA;
268 /* load j atom coordinates */
269 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
272 /* Calculate displacement vector */
273 dx00 = _fjsp_sub_v2r8(ix0,jx0);
274 dy00 = _fjsp_sub_v2r8(iy0,jy0);
275 dz00 = _fjsp_sub_v2r8(iz0,jz0);
277 /* Calculate squared distance and things based on it */
278 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
280 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
282 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
284 /* Load parameters for j particles */
285 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
287 /**************************
288 * CALCULATE INTERACTIONS *
289 **************************/
291 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
294 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
296 /* Compute parameters for interactions between i and j atoms */
297 qq00 = _fjsp_mul_v2r8(iq0,jq0);
299 /* EWALD ELECTROSTATICS */
301 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
302 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
303 itab_tmp = _fjsp_dtox_v2r8(ewrt);
304 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
305 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
307 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
308 ewtabD = _fjsp_setzero_v2r8();
309 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
310 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
311 ewtabFn = _fjsp_setzero_v2r8();
312 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
313 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
314 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
315 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
316 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
318 d = _fjsp_sub_v2r8(r00,rswitch);
319 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
320 d2 = _fjsp_mul_v2r8(d,d);
321 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
323 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
325 /* Evaluate switch function */
326 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
327 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
328 velec = _fjsp_mul_v2r8(velec,sw);
329 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
331 /* Update potential sum for this i atom from the interaction with this j atom. */
332 velec = _fjsp_and_v2r8(velec,cutoff_mask);
333 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
334 velecsum = _fjsp_add_v2r8(velecsum,velec);
338 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
340 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
342 /* Update vectorial force */
343 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
344 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
345 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
347 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
351 /* Inner loop uses 68 flops */
354 /* End of innermost loop */
356 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
357 f+i_coord_offset,fshift+i_shift_offset);
360 /* Update potential energies */
361 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
363 /* Increment number of inner iterations */
364 inneriter += j_index_end - j_index_start;
366 /* Outer loop uses 8 flops */
369 /* Increment number of outer iterations */
372 /* Update outer/inner flops */
374 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*68);
377 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
378 * Electrostatics interaction: Ewald
379 * VdW interaction: None
380 * Geometry: Particle-Particle
381 * Calculate force/pot: Force
384 nb_kernel_ElecEwSw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
385 (t_nblist * gmx_restrict nlist,
386 rvec * gmx_restrict xx,
387 rvec * gmx_restrict ff,
388 t_forcerec * gmx_restrict fr,
389 t_mdatoms * gmx_restrict mdatoms,
390 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
391 t_nrnb * gmx_restrict nrnb)
393 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
394 * just 0 for non-waters.
395 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
396 * jnr indices corresponding to data put in the four positions in the SIMD register.
398 int i_shift_offset,i_coord_offset,outeriter,inneriter;
399 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
401 int j_coord_offsetA,j_coord_offsetB;
402 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
404 real *shiftvec,*fshift,*x,*f;
405 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
407 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
408 int vdwjidx0A,vdwjidx0B;
409 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
410 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
411 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
413 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
415 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
416 real rswitch_scalar,d_scalar;
418 _fjsp_v2r8 dummy_mask,cutoff_mask;
419 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
420 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
421 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
428 jindex = nlist->jindex;
430 shiftidx = nlist->shift;
432 shiftvec = fr->shift_vec[0];
433 fshift = fr->fshift[0];
434 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
435 charge = mdatoms->chargeA;
437 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
438 ewtab = fr->ic->tabq_coul_FDV0;
439 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
440 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
442 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
443 rcutoff_scalar = fr->rcoulomb;
444 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
445 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
447 rswitch_scalar = fr->rcoulomb_switch;
448 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
449 /* Setup switch parameters */
450 d_scalar = rcutoff_scalar-rswitch_scalar;
451 d = gmx_fjsp_set1_v2r8(d_scalar);
452 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
453 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
454 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
455 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
456 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
457 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
459 /* Avoid stupid compiler warnings */
467 /* Start outer loop over neighborlists */
468 for(iidx=0; iidx<nri; iidx++)
470 /* Load shift vector for this list */
471 i_shift_offset = DIM*shiftidx[iidx];
473 /* Load limits for loop over neighbors */
474 j_index_start = jindex[iidx];
475 j_index_end = jindex[iidx+1];
477 /* Get outer coordinate index */
479 i_coord_offset = DIM*inr;
481 /* Load i particle coords and add shift vector */
482 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
484 fix0 = _fjsp_setzero_v2r8();
485 fiy0 = _fjsp_setzero_v2r8();
486 fiz0 = _fjsp_setzero_v2r8();
488 /* Load parameters for i particles */
489 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
491 /* Start inner kernel loop */
492 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
495 /* Get j neighbor index, and coordinate index */
498 j_coord_offsetA = DIM*jnrA;
499 j_coord_offsetB = DIM*jnrB;
501 /* load j atom coordinates */
502 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
505 /* Calculate displacement vector */
506 dx00 = _fjsp_sub_v2r8(ix0,jx0);
507 dy00 = _fjsp_sub_v2r8(iy0,jy0);
508 dz00 = _fjsp_sub_v2r8(iz0,jz0);
510 /* Calculate squared distance and things based on it */
511 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
513 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
515 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
517 /* Load parameters for j particles */
518 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
520 /**************************
521 * CALCULATE INTERACTIONS *
522 **************************/
524 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
527 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
529 /* Compute parameters for interactions between i and j atoms */
530 qq00 = _fjsp_mul_v2r8(iq0,jq0);
532 /* EWALD ELECTROSTATICS */
534 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
535 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
536 itab_tmp = _fjsp_dtox_v2r8(ewrt);
537 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
538 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
540 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
541 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
542 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
543 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
544 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
545 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
546 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
547 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
548 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
549 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
551 d = _fjsp_sub_v2r8(r00,rswitch);
552 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
553 d2 = _fjsp_mul_v2r8(d,d);
554 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
556 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
558 /* Evaluate switch function */
559 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
560 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
561 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
565 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
567 /* Update vectorial force */
568 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
569 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
570 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
572 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
576 /* Inner loop uses 65 flops */
583 j_coord_offsetA = DIM*jnrA;
585 /* load j atom coordinates */
586 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
589 /* Calculate displacement vector */
590 dx00 = _fjsp_sub_v2r8(ix0,jx0);
591 dy00 = _fjsp_sub_v2r8(iy0,jy0);
592 dz00 = _fjsp_sub_v2r8(iz0,jz0);
594 /* Calculate squared distance and things based on it */
595 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
597 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
599 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
601 /* Load parameters for j particles */
602 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
604 /**************************
605 * CALCULATE INTERACTIONS *
606 **************************/
608 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
611 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
613 /* Compute parameters for interactions between i and j atoms */
614 qq00 = _fjsp_mul_v2r8(iq0,jq0);
616 /* EWALD ELECTROSTATICS */
618 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
619 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
620 itab_tmp = _fjsp_dtox_v2r8(ewrt);
621 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
622 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
624 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
625 ewtabD = _fjsp_setzero_v2r8();
626 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
627 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
628 ewtabFn = _fjsp_setzero_v2r8();
629 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
630 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
631 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
632 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
633 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
635 d = _fjsp_sub_v2r8(r00,rswitch);
636 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
637 d2 = _fjsp_mul_v2r8(d,d);
638 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
640 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
642 /* Evaluate switch function */
643 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
644 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
645 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
649 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
651 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
653 /* Update vectorial force */
654 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
655 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
656 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
658 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
662 /* Inner loop uses 65 flops */
665 /* End of innermost loop */
667 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
668 f+i_coord_offset,fshift+i_shift_offset);
670 /* Increment number of inner iterations */
671 inneriter += j_index_end - j_index_start;
673 /* Outer loop uses 7 flops */
676 /* Increment number of outer iterations */
679 /* Update outer/inner flops */
681 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*65);