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_ElecEwSw_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Ewald
52 * VdW interaction: None
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSw_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;
86 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
88 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
89 real rswitch_scalar,d_scalar;
91 _fjsp_v2r8 dummy_mask,cutoff_mask;
92 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
93 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
94 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
101 jindex = nlist->jindex;
103 shiftidx = nlist->shift;
105 shiftvec = fr->shift_vec[0];
106 fshift = fr->fshift[0];
107 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
108 charge = mdatoms->chargeA;
110 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
111 ewtab = fr->ic->tabq_coul_FDV0;
112 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
113 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
115 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
116 rcutoff_scalar = fr->rcoulomb;
117 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
118 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
120 rswitch_scalar = fr->rcoulomb_switch;
121 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
122 /* Setup switch parameters */
123 d_scalar = rcutoff_scalar-rswitch_scalar;
124 d = gmx_fjsp_set1_v2r8(d_scalar);
125 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
126 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
127 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
128 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
129 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
130 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
132 /* Avoid stupid compiler warnings */
140 /* Start outer loop over neighborlists */
141 for(iidx=0; iidx<nri; iidx++)
143 /* Load shift vector for this list */
144 i_shift_offset = DIM*shiftidx[iidx];
146 /* Load limits for loop over neighbors */
147 j_index_start = jindex[iidx];
148 j_index_end = jindex[iidx+1];
150 /* Get outer coordinate index */
152 i_coord_offset = DIM*inr;
154 /* Load i particle coords and add shift vector */
155 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
157 fix0 = _fjsp_setzero_v2r8();
158 fiy0 = _fjsp_setzero_v2r8();
159 fiz0 = _fjsp_setzero_v2r8();
161 /* Load parameters for i particles */
162 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
164 /* Reset potential sums */
165 velecsum = _fjsp_setzero_v2r8();
167 /* Start inner kernel loop */
168 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
171 /* Get j neighbor index, and coordinate index */
174 j_coord_offsetA = DIM*jnrA;
175 j_coord_offsetB = DIM*jnrB;
177 /* load j atom coordinates */
178 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
181 /* Calculate displacement vector */
182 dx00 = _fjsp_sub_v2r8(ix0,jx0);
183 dy00 = _fjsp_sub_v2r8(iy0,jy0);
184 dz00 = _fjsp_sub_v2r8(iz0,jz0);
186 /* Calculate squared distance and things based on it */
187 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
189 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
191 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
193 /* Load parameters for j particles */
194 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
196 /**************************
197 * CALCULATE INTERACTIONS *
198 **************************/
200 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
203 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
205 /* Compute parameters for interactions between i and j atoms */
206 qq00 = _fjsp_mul_v2r8(iq0,jq0);
208 /* EWALD ELECTROSTATICS */
210 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
211 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
212 itab_tmp = _fjsp_dtox_v2r8(ewrt);
213 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
214 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
216 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
217 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
218 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
219 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
220 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
221 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
222 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
223 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
224 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
225 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
227 d = _fjsp_sub_v2r8(r00,rswitch);
228 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
229 d2 = _fjsp_mul_v2r8(d,d);
230 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
232 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
234 /* Evaluate switch function */
235 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
236 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
237 velec = _fjsp_mul_v2r8(velec,sw);
238 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
240 /* Update potential sum for this i atom from the interaction with this j atom. */
241 velec = _fjsp_and_v2r8(velec,cutoff_mask);
242 velecsum = _fjsp_add_v2r8(velecsum,velec);
246 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
248 /* Update vectorial force */
249 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
250 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
251 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
253 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
257 /* Inner loop uses 68 flops */
264 j_coord_offsetA = DIM*jnrA;
266 /* load j atom coordinates */
267 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
270 /* Calculate displacement vector */
271 dx00 = _fjsp_sub_v2r8(ix0,jx0);
272 dy00 = _fjsp_sub_v2r8(iy0,jy0);
273 dz00 = _fjsp_sub_v2r8(iz0,jz0);
275 /* Calculate squared distance and things based on it */
276 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
278 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
280 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
282 /* Load parameters for j particles */
283 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
285 /**************************
286 * CALCULATE INTERACTIONS *
287 **************************/
289 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
292 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
294 /* Compute parameters for interactions between i and j atoms */
295 qq00 = _fjsp_mul_v2r8(iq0,jq0);
297 /* EWALD ELECTROSTATICS */
299 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
300 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
301 itab_tmp = _fjsp_dtox_v2r8(ewrt);
302 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
303 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
305 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
306 ewtabD = _fjsp_setzero_v2r8();
307 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
308 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
309 ewtabFn = _fjsp_setzero_v2r8();
310 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
311 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
312 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
313 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
314 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
316 d = _fjsp_sub_v2r8(r00,rswitch);
317 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
318 d2 = _fjsp_mul_v2r8(d,d);
319 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
321 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
323 /* Evaluate switch function */
324 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
325 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
326 velec = _fjsp_mul_v2r8(velec,sw);
327 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
329 /* Update potential sum for this i atom from the interaction with this j atom. */
330 velec = _fjsp_and_v2r8(velec,cutoff_mask);
331 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
332 velecsum = _fjsp_add_v2r8(velecsum,velec);
336 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
338 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
340 /* Update vectorial force */
341 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
342 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
343 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
345 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
349 /* Inner loop uses 68 flops */
352 /* End of innermost loop */
354 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
355 f+i_coord_offset,fshift+i_shift_offset);
358 /* Update potential energies */
359 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
361 /* Increment number of inner iterations */
362 inneriter += j_index_end - j_index_start;
364 /* Outer loop uses 8 flops */
367 /* Increment number of outer iterations */
370 /* Update outer/inner flops */
372 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*68);
375 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
376 * Electrostatics interaction: Ewald
377 * VdW interaction: None
378 * Geometry: Particle-Particle
379 * Calculate force/pot: Force
382 nb_kernel_ElecEwSw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
383 (t_nblist * gmx_restrict nlist,
384 rvec * gmx_restrict xx,
385 rvec * gmx_restrict ff,
386 t_forcerec * gmx_restrict fr,
387 t_mdatoms * gmx_restrict mdatoms,
388 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
389 t_nrnb * gmx_restrict nrnb)
391 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
392 * just 0 for non-waters.
393 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
394 * jnr indices corresponding to data put in the four positions in the SIMD register.
396 int i_shift_offset,i_coord_offset,outeriter,inneriter;
397 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
399 int j_coord_offsetA,j_coord_offsetB;
400 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
402 real *shiftvec,*fshift,*x,*f;
403 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
405 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
406 int vdwjidx0A,vdwjidx0B;
407 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
408 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
409 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
411 _fjsp_v2r8 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
413 _fjsp_v2r8 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
414 real rswitch_scalar,d_scalar;
416 _fjsp_v2r8 dummy_mask,cutoff_mask;
417 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
418 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
419 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
426 jindex = nlist->jindex;
428 shiftidx = nlist->shift;
430 shiftvec = fr->shift_vec[0];
431 fshift = fr->fshift[0];
432 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
433 charge = mdatoms->chargeA;
435 sh_ewald = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
436 ewtab = fr->ic->tabq_coul_FDV0;
437 ewtabscale = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
438 ewtabhalfspace = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
440 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
441 rcutoff_scalar = fr->rcoulomb;
442 rcutoff = gmx_fjsp_set1_v2r8(rcutoff_scalar);
443 rcutoff2 = _fjsp_mul_v2r8(rcutoff,rcutoff);
445 rswitch_scalar = fr->rcoulomb_switch;
446 rswitch = gmx_fjsp_set1_v2r8(rswitch_scalar);
447 /* Setup switch parameters */
448 d_scalar = rcutoff_scalar-rswitch_scalar;
449 d = gmx_fjsp_set1_v2r8(d_scalar);
450 swV3 = gmx_fjsp_set1_v2r8(-10.0/(d_scalar*d_scalar*d_scalar));
451 swV4 = gmx_fjsp_set1_v2r8( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
452 swV5 = gmx_fjsp_set1_v2r8( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
453 swF2 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar));
454 swF3 = gmx_fjsp_set1_v2r8( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
455 swF4 = gmx_fjsp_set1_v2r8(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
457 /* Avoid stupid compiler warnings */
465 /* Start outer loop over neighborlists */
466 for(iidx=0; iidx<nri; iidx++)
468 /* Load shift vector for this list */
469 i_shift_offset = DIM*shiftidx[iidx];
471 /* Load limits for loop over neighbors */
472 j_index_start = jindex[iidx];
473 j_index_end = jindex[iidx+1];
475 /* Get outer coordinate index */
477 i_coord_offset = DIM*inr;
479 /* Load i particle coords and add shift vector */
480 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
482 fix0 = _fjsp_setzero_v2r8();
483 fiy0 = _fjsp_setzero_v2r8();
484 fiz0 = _fjsp_setzero_v2r8();
486 /* Load parameters for i particles */
487 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
489 /* Start inner kernel loop */
490 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
493 /* Get j neighbor index, and coordinate index */
496 j_coord_offsetA = DIM*jnrA;
497 j_coord_offsetB = DIM*jnrB;
499 /* load j atom coordinates */
500 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
503 /* Calculate displacement vector */
504 dx00 = _fjsp_sub_v2r8(ix0,jx0);
505 dy00 = _fjsp_sub_v2r8(iy0,jy0);
506 dz00 = _fjsp_sub_v2r8(iz0,jz0);
508 /* Calculate squared distance and things based on it */
509 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
511 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
513 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
515 /* Load parameters for j particles */
516 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
518 /**************************
519 * CALCULATE INTERACTIONS *
520 **************************/
522 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
525 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
527 /* Compute parameters for interactions between i and j atoms */
528 qq00 = _fjsp_mul_v2r8(iq0,jq0);
530 /* EWALD ELECTROSTATICS */
532 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
533 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
534 itab_tmp = _fjsp_dtox_v2r8(ewrt);
535 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
536 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
538 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
539 ewtabD = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
540 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
541 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
542 ewtabFn = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
543 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
544 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
545 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
546 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
547 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
549 d = _fjsp_sub_v2r8(r00,rswitch);
550 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
551 d2 = _fjsp_mul_v2r8(d,d);
552 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
554 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
556 /* Evaluate switch function */
557 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
558 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
559 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
563 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
565 /* Update vectorial force */
566 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
567 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
568 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
570 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
574 /* Inner loop uses 65 flops */
581 j_coord_offsetA = DIM*jnrA;
583 /* load j atom coordinates */
584 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
587 /* Calculate displacement vector */
588 dx00 = _fjsp_sub_v2r8(ix0,jx0);
589 dy00 = _fjsp_sub_v2r8(iy0,jy0);
590 dz00 = _fjsp_sub_v2r8(iz0,jz0);
592 /* Calculate squared distance and things based on it */
593 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
595 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
597 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
599 /* Load parameters for j particles */
600 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
602 /**************************
603 * CALCULATE INTERACTIONS *
604 **************************/
606 if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
609 r00 = _fjsp_mul_v2r8(rsq00,rinv00);
611 /* Compute parameters for interactions between i and j atoms */
612 qq00 = _fjsp_mul_v2r8(iq0,jq0);
614 /* EWALD ELECTROSTATICS */
616 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
617 ewrt = _fjsp_mul_v2r8(r00,ewtabscale);
618 itab_tmp = _fjsp_dtox_v2r8(ewrt);
619 eweps = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
620 _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
622 ewtabF = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
623 ewtabD = _fjsp_setzero_v2r8();
624 GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
625 ewtabV = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
626 ewtabFn = _fjsp_setzero_v2r8();
627 GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
628 felec = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
629 velec = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
630 velec = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
631 felec = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
633 d = _fjsp_sub_v2r8(r00,rswitch);
634 d = _fjsp_max_v2r8(d,_fjsp_setzero_v2r8());
635 d2 = _fjsp_mul_v2r8(d,d);
636 sw = _fjsp_add_v2r8(one,_fjsp_mul_v2r8(d2,_fjsp_mul_v2r8(d,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swV5,swV4),swV3))));
638 dsw = _fjsp_mul_v2r8(d2,_fjsp_madd_v2r8(d,_fjsp_madd_v2r8(d,swF4,swF3),swF2));
640 /* Evaluate switch function */
641 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
642 felec = _fjsp_msub_v2r8( felec,sw , _fjsp_mul_v2r8(rinv00,_fjsp_mul_v2r8(velec,dsw)) );
643 cutoff_mask = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
647 fscal = _fjsp_and_v2r8(fscal,cutoff_mask);
649 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
651 /* Update vectorial force */
652 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
653 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
654 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
656 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
660 /* Inner loop uses 65 flops */
663 /* End of innermost loop */
665 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
666 f+i_coord_offset,fshift+i_shift_offset);
668 /* Increment number of inner iterations */
669 inneriter += j_index_end - j_index_start;
671 /* Outer loop uses 7 flops */
674 /* Increment number of outer iterations */
677 /* Update outer/inner flops */
679 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*65);