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_GeomW3P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: None
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_VdwNone_GeomW3P1_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;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85 int vdwjidx0A,vdwjidx0B;
86 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
89 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
90 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
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 /* Setup water-specific parameters */
113 inr = nlist->iinr[0];
114 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
115 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
116 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
118 /* Avoid stupid compiler warnings */
126 /* Start outer loop over neighborlists */
127 for(iidx=0; iidx<nri; iidx++)
129 /* Load shift vector for this list */
130 i_shift_offset = DIM*shiftidx[iidx];
132 /* Load limits for loop over neighbors */
133 j_index_start = jindex[iidx];
134 j_index_end = jindex[iidx+1];
136 /* Get outer coordinate index */
138 i_coord_offset = DIM*inr;
140 /* Load i particle coords and add shift vector */
141 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
142 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
144 fix0 = _fjsp_setzero_v2r8();
145 fiy0 = _fjsp_setzero_v2r8();
146 fiz0 = _fjsp_setzero_v2r8();
147 fix1 = _fjsp_setzero_v2r8();
148 fiy1 = _fjsp_setzero_v2r8();
149 fiz1 = _fjsp_setzero_v2r8();
150 fix2 = _fjsp_setzero_v2r8();
151 fiy2 = _fjsp_setzero_v2r8();
152 fiz2 = _fjsp_setzero_v2r8();
154 /* Reset potential sums */
155 velecsum = _fjsp_setzero_v2r8();
157 /* Start inner kernel loop */
158 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
161 /* Get j neighbor index, and coordinate index */
164 j_coord_offsetA = DIM*jnrA;
165 j_coord_offsetB = DIM*jnrB;
167 /* load j atom coordinates */
168 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
171 /* Calculate displacement vector */
172 dx00 = _fjsp_sub_v2r8(ix0,jx0);
173 dy00 = _fjsp_sub_v2r8(iy0,jy0);
174 dz00 = _fjsp_sub_v2r8(iz0,jz0);
175 dx10 = _fjsp_sub_v2r8(ix1,jx0);
176 dy10 = _fjsp_sub_v2r8(iy1,jy0);
177 dz10 = _fjsp_sub_v2r8(iz1,jz0);
178 dx20 = _fjsp_sub_v2r8(ix2,jx0);
179 dy20 = _fjsp_sub_v2r8(iy2,jy0);
180 dz20 = _fjsp_sub_v2r8(iz2,jz0);
182 /* Calculate squared distance and things based on it */
183 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
184 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
185 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
187 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
188 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
189 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
191 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
192 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
193 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
195 /* Load parameters for j particles */
196 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
198 fjx0 = _fjsp_setzero_v2r8();
199 fjy0 = _fjsp_setzero_v2r8();
200 fjz0 = _fjsp_setzero_v2r8();
202 /**************************
203 * CALCULATE INTERACTIONS *
204 **************************/
206 /* Compute parameters for interactions between i and j atoms */
207 qq00 = _fjsp_mul_v2r8(iq0,jq0);
209 /* COULOMB ELECTROSTATICS */
210 velec = _fjsp_mul_v2r8(qq00,rinv00);
211 felec = _fjsp_mul_v2r8(velec,rinvsq00);
213 /* Update potential sum for this i atom from the interaction with this j atom. */
214 velecsum = _fjsp_add_v2r8(velecsum,velec);
218 /* Update vectorial force */
219 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
220 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
221 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
223 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
224 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
225 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
227 /**************************
228 * CALCULATE INTERACTIONS *
229 **************************/
231 /* Compute parameters for interactions between i and j atoms */
232 qq10 = _fjsp_mul_v2r8(iq1,jq0);
234 /* COULOMB ELECTROSTATICS */
235 velec = _fjsp_mul_v2r8(qq10,rinv10);
236 felec = _fjsp_mul_v2r8(velec,rinvsq10);
238 /* Update potential sum for this i atom from the interaction with this j atom. */
239 velecsum = _fjsp_add_v2r8(velecsum,velec);
243 /* Update vectorial force */
244 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
245 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
246 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
248 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
249 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
250 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
252 /**************************
253 * CALCULATE INTERACTIONS *
254 **************************/
256 /* Compute parameters for interactions between i and j atoms */
257 qq20 = _fjsp_mul_v2r8(iq2,jq0);
259 /* COULOMB ELECTROSTATICS */
260 velec = _fjsp_mul_v2r8(qq20,rinv20);
261 felec = _fjsp_mul_v2r8(velec,rinvsq20);
263 /* Update potential sum for this i atom from the interaction with this j atom. */
264 velecsum = _fjsp_add_v2r8(velecsum,velec);
268 /* Update vectorial force */
269 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
270 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
271 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
273 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
274 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
275 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
277 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
279 /* Inner loop uses 96 flops */
286 j_coord_offsetA = DIM*jnrA;
288 /* load j atom coordinates */
289 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
292 /* Calculate displacement vector */
293 dx00 = _fjsp_sub_v2r8(ix0,jx0);
294 dy00 = _fjsp_sub_v2r8(iy0,jy0);
295 dz00 = _fjsp_sub_v2r8(iz0,jz0);
296 dx10 = _fjsp_sub_v2r8(ix1,jx0);
297 dy10 = _fjsp_sub_v2r8(iy1,jy0);
298 dz10 = _fjsp_sub_v2r8(iz1,jz0);
299 dx20 = _fjsp_sub_v2r8(ix2,jx0);
300 dy20 = _fjsp_sub_v2r8(iy2,jy0);
301 dz20 = _fjsp_sub_v2r8(iz2,jz0);
303 /* Calculate squared distance and things based on it */
304 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
305 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
306 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
308 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
309 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
310 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
312 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
313 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
314 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
316 /* Load parameters for j particles */
317 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
319 fjx0 = _fjsp_setzero_v2r8();
320 fjy0 = _fjsp_setzero_v2r8();
321 fjz0 = _fjsp_setzero_v2r8();
323 /**************************
324 * CALCULATE INTERACTIONS *
325 **************************/
327 /* Compute parameters for interactions between i and j atoms */
328 qq00 = _fjsp_mul_v2r8(iq0,jq0);
330 /* COULOMB ELECTROSTATICS */
331 velec = _fjsp_mul_v2r8(qq00,rinv00);
332 felec = _fjsp_mul_v2r8(velec,rinvsq00);
334 /* Update potential sum for this i atom from the interaction with this j atom. */
335 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
336 velecsum = _fjsp_add_v2r8(velecsum,velec);
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 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
348 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
349 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
351 /**************************
352 * CALCULATE INTERACTIONS *
353 **************************/
355 /* Compute parameters for interactions between i and j atoms */
356 qq10 = _fjsp_mul_v2r8(iq1,jq0);
358 /* COULOMB ELECTROSTATICS */
359 velec = _fjsp_mul_v2r8(qq10,rinv10);
360 felec = _fjsp_mul_v2r8(velec,rinvsq10);
362 /* Update potential sum for this i atom from the interaction with this j atom. */
363 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
364 velecsum = _fjsp_add_v2r8(velecsum,velec);
368 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
370 /* Update vectorial force */
371 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
372 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
373 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
375 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
376 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
377 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
379 /**************************
380 * CALCULATE INTERACTIONS *
381 **************************/
383 /* Compute parameters for interactions between i and j atoms */
384 qq20 = _fjsp_mul_v2r8(iq2,jq0);
386 /* COULOMB ELECTROSTATICS */
387 velec = _fjsp_mul_v2r8(qq20,rinv20);
388 felec = _fjsp_mul_v2r8(velec,rinvsq20);
390 /* Update potential sum for this i atom from the interaction with this j atom. */
391 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
392 velecsum = _fjsp_add_v2r8(velecsum,velec);
396 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
398 /* Update vectorial force */
399 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
400 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
401 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
403 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
404 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
405 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
407 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
409 /* Inner loop uses 96 flops */
412 /* End of innermost loop */
414 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
415 f+i_coord_offset,fshift+i_shift_offset);
418 /* Update potential energies */
419 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
421 /* Increment number of inner iterations */
422 inneriter += j_index_end - j_index_start;
424 /* Outer loop uses 19 flops */
427 /* Increment number of outer iterations */
430 /* Update outer/inner flops */
432 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3_VF,outeriter*19 + inneriter*96);
435 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomW3P1_F_sparc64_hpc_ace_double
436 * Electrostatics interaction: Coulomb
437 * VdW interaction: None
438 * Geometry: Water3-Particle
439 * Calculate force/pot: Force
442 nb_kernel_ElecCoul_VdwNone_GeomW3P1_F_sparc64_hpc_ace_double
443 (t_nblist * gmx_restrict nlist,
444 rvec * gmx_restrict xx,
445 rvec * gmx_restrict ff,
446 t_forcerec * gmx_restrict fr,
447 t_mdatoms * gmx_restrict mdatoms,
448 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
449 t_nrnb * gmx_restrict nrnb)
451 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
452 * just 0 for non-waters.
453 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
454 * jnr indices corresponding to data put in the four positions in the SIMD register.
456 int i_shift_offset,i_coord_offset,outeriter,inneriter;
457 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
459 int j_coord_offsetA,j_coord_offsetB;
460 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
462 real *shiftvec,*fshift,*x,*f;
463 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
465 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
467 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
469 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
470 int vdwjidx0A,vdwjidx0B;
471 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
472 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
473 _fjsp_v2r8 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
474 _fjsp_v2r8 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
475 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
478 _fjsp_v2r8 dummy_mask,cutoff_mask;
479 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
480 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
481 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
488 jindex = nlist->jindex;
490 shiftidx = nlist->shift;
492 shiftvec = fr->shift_vec[0];
493 fshift = fr->fshift[0];
494 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
495 charge = mdatoms->chargeA;
497 /* Setup water-specific parameters */
498 inr = nlist->iinr[0];
499 iq0 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
500 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
501 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
503 /* Avoid stupid compiler warnings */
511 /* Start outer loop over neighborlists */
512 for(iidx=0; iidx<nri; iidx++)
514 /* Load shift vector for this list */
515 i_shift_offset = DIM*shiftidx[iidx];
517 /* Load limits for loop over neighbors */
518 j_index_start = jindex[iidx];
519 j_index_end = jindex[iidx+1];
521 /* Get outer coordinate index */
523 i_coord_offset = DIM*inr;
525 /* Load i particle coords and add shift vector */
526 gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
527 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
529 fix0 = _fjsp_setzero_v2r8();
530 fiy0 = _fjsp_setzero_v2r8();
531 fiz0 = _fjsp_setzero_v2r8();
532 fix1 = _fjsp_setzero_v2r8();
533 fiy1 = _fjsp_setzero_v2r8();
534 fiz1 = _fjsp_setzero_v2r8();
535 fix2 = _fjsp_setzero_v2r8();
536 fiy2 = _fjsp_setzero_v2r8();
537 fiz2 = _fjsp_setzero_v2r8();
539 /* Start inner kernel loop */
540 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
543 /* Get j neighbor index, and coordinate index */
546 j_coord_offsetA = DIM*jnrA;
547 j_coord_offsetB = DIM*jnrB;
549 /* load j atom coordinates */
550 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
553 /* Calculate displacement vector */
554 dx00 = _fjsp_sub_v2r8(ix0,jx0);
555 dy00 = _fjsp_sub_v2r8(iy0,jy0);
556 dz00 = _fjsp_sub_v2r8(iz0,jz0);
557 dx10 = _fjsp_sub_v2r8(ix1,jx0);
558 dy10 = _fjsp_sub_v2r8(iy1,jy0);
559 dz10 = _fjsp_sub_v2r8(iz1,jz0);
560 dx20 = _fjsp_sub_v2r8(ix2,jx0);
561 dy20 = _fjsp_sub_v2r8(iy2,jy0);
562 dz20 = _fjsp_sub_v2r8(iz2,jz0);
564 /* Calculate squared distance and things based on it */
565 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
566 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
567 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
569 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
570 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
571 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
573 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
574 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
575 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
577 /* Load parameters for j particles */
578 jq0 = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
580 fjx0 = _fjsp_setzero_v2r8();
581 fjy0 = _fjsp_setzero_v2r8();
582 fjz0 = _fjsp_setzero_v2r8();
584 /**************************
585 * CALCULATE INTERACTIONS *
586 **************************/
588 /* Compute parameters for interactions between i and j atoms */
589 qq00 = _fjsp_mul_v2r8(iq0,jq0);
591 /* COULOMB ELECTROSTATICS */
592 velec = _fjsp_mul_v2r8(qq00,rinv00);
593 felec = _fjsp_mul_v2r8(velec,rinvsq00);
597 /* Update vectorial force */
598 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
599 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
600 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
602 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
603 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
604 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
606 /**************************
607 * CALCULATE INTERACTIONS *
608 **************************/
610 /* Compute parameters for interactions between i and j atoms */
611 qq10 = _fjsp_mul_v2r8(iq1,jq0);
613 /* COULOMB ELECTROSTATICS */
614 velec = _fjsp_mul_v2r8(qq10,rinv10);
615 felec = _fjsp_mul_v2r8(velec,rinvsq10);
619 /* Update vectorial force */
620 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
621 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
622 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
624 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
625 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
626 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
628 /**************************
629 * CALCULATE INTERACTIONS *
630 **************************/
632 /* Compute parameters for interactions between i and j atoms */
633 qq20 = _fjsp_mul_v2r8(iq2,jq0);
635 /* COULOMB ELECTROSTATICS */
636 velec = _fjsp_mul_v2r8(qq20,rinv20);
637 felec = _fjsp_mul_v2r8(velec,rinvsq20);
641 /* Update vectorial force */
642 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
643 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
644 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
646 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
647 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
648 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
650 gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
652 /* Inner loop uses 93 flops */
659 j_coord_offsetA = DIM*jnrA;
661 /* load j atom coordinates */
662 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
665 /* Calculate displacement vector */
666 dx00 = _fjsp_sub_v2r8(ix0,jx0);
667 dy00 = _fjsp_sub_v2r8(iy0,jy0);
668 dz00 = _fjsp_sub_v2r8(iz0,jz0);
669 dx10 = _fjsp_sub_v2r8(ix1,jx0);
670 dy10 = _fjsp_sub_v2r8(iy1,jy0);
671 dz10 = _fjsp_sub_v2r8(iz1,jz0);
672 dx20 = _fjsp_sub_v2r8(ix2,jx0);
673 dy20 = _fjsp_sub_v2r8(iy2,jy0);
674 dz20 = _fjsp_sub_v2r8(iz2,jz0);
676 /* Calculate squared distance and things based on it */
677 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
678 rsq10 = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
679 rsq20 = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
681 rinv00 = gmx_fjsp_invsqrt_v2r8(rsq00);
682 rinv10 = gmx_fjsp_invsqrt_v2r8(rsq10);
683 rinv20 = gmx_fjsp_invsqrt_v2r8(rsq20);
685 rinvsq00 = _fjsp_mul_v2r8(rinv00,rinv00);
686 rinvsq10 = _fjsp_mul_v2r8(rinv10,rinv10);
687 rinvsq20 = _fjsp_mul_v2r8(rinv20,rinv20);
689 /* Load parameters for j particles */
690 jq0 = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
692 fjx0 = _fjsp_setzero_v2r8();
693 fjy0 = _fjsp_setzero_v2r8();
694 fjz0 = _fjsp_setzero_v2r8();
696 /**************************
697 * CALCULATE INTERACTIONS *
698 **************************/
700 /* Compute parameters for interactions between i and j atoms */
701 qq00 = _fjsp_mul_v2r8(iq0,jq0);
703 /* COULOMB ELECTROSTATICS */
704 velec = _fjsp_mul_v2r8(qq00,rinv00);
705 felec = _fjsp_mul_v2r8(velec,rinvsq00);
709 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
711 /* Update vectorial force */
712 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
713 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
714 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
716 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
717 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
718 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
720 /**************************
721 * CALCULATE INTERACTIONS *
722 **************************/
724 /* Compute parameters for interactions between i and j atoms */
725 qq10 = _fjsp_mul_v2r8(iq1,jq0);
727 /* COULOMB ELECTROSTATICS */
728 velec = _fjsp_mul_v2r8(qq10,rinv10);
729 felec = _fjsp_mul_v2r8(velec,rinvsq10);
733 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
735 /* Update vectorial force */
736 fix1 = _fjsp_madd_v2r8(dx10,fscal,fix1);
737 fiy1 = _fjsp_madd_v2r8(dy10,fscal,fiy1);
738 fiz1 = _fjsp_madd_v2r8(dz10,fscal,fiz1);
740 fjx0 = _fjsp_madd_v2r8(dx10,fscal,fjx0);
741 fjy0 = _fjsp_madd_v2r8(dy10,fscal,fjy0);
742 fjz0 = _fjsp_madd_v2r8(dz10,fscal,fjz0);
744 /**************************
745 * CALCULATE INTERACTIONS *
746 **************************/
748 /* Compute parameters for interactions between i and j atoms */
749 qq20 = _fjsp_mul_v2r8(iq2,jq0);
751 /* COULOMB ELECTROSTATICS */
752 velec = _fjsp_mul_v2r8(qq20,rinv20);
753 felec = _fjsp_mul_v2r8(velec,rinvsq20);
757 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
759 /* Update vectorial force */
760 fix2 = _fjsp_madd_v2r8(dx20,fscal,fix2);
761 fiy2 = _fjsp_madd_v2r8(dy20,fscal,fiy2);
762 fiz2 = _fjsp_madd_v2r8(dz20,fscal,fiz2);
764 fjx0 = _fjsp_madd_v2r8(dx20,fscal,fjx0);
765 fjy0 = _fjsp_madd_v2r8(dy20,fscal,fjy0);
766 fjz0 = _fjsp_madd_v2r8(dz20,fscal,fjz0);
768 gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
770 /* Inner loop uses 93 flops */
773 /* End of innermost loop */
775 gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
776 f+i_coord_offset,fshift+i_shift_offset);
778 /* Increment number of inner iterations */
779 inneriter += j_index_end - j_index_start;
781 /* Outer loop uses 18 flops */
784 /* Increment number of outer iterations */
787 /* Update outer/inner flops */
789 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3_F,outeriter*18 + inneriter*93);