2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, 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/gmxlib/nrnb.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwLJEwSh_GeomP1P1_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: None
52 * VdW interaction: LJEwald
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecNone_VdwLJEwSh_GeomP1P1_VF_sparc64_hpc_ace_double
58 (t_nblist
* gmx_restrict nlist
,
59 rvec
* gmx_restrict xx
,
60 rvec
* gmx_restrict ff
,
61 struct 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
;
85 _fjsp_v2r8 rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,sh_vdw_invrcut6
;
88 _fjsp_v2r8 one_sixth
= gmx_fjsp_set1_v2r8(1.0/6.0);
89 _fjsp_v2r8 one_twelfth
= gmx_fjsp_set1_v2r8(1.0/12.0);
92 _fjsp_v2r8 ewclj
,ewclj2
,ewclj6
,ewcljrsq
,poly
,exponent
,f6A
,f6B
,sh_lj_ewald
;
93 _fjsp_v2r8 one_half
= gmx_fjsp_set1_v2r8(0.5);
94 _fjsp_v2r8 minus_one
= gmx_fjsp_set1_v2r8(-1.0);
96 _fjsp_v2r8 dummy_mask
,cutoff_mask
;
97 _fjsp_v2r8 one
= gmx_fjsp_set1_v2r8(1.0);
98 _fjsp_v2r8 two
= gmx_fjsp_set1_v2r8(2.0);
99 union { _fjsp_v2r8 simd
; long long int i
[2]; } vfconv
,gbconv
,ewconv
;
106 jindex
= nlist
->jindex
;
108 shiftidx
= nlist
->shift
;
110 shiftvec
= fr
->shift_vec
[0];
111 fshift
= fr
->fshift
[0];
112 nvdwtype
= fr
->ntype
;
114 vdwtype
= mdatoms
->typeA
;
115 vdwgridparam
= fr
->ljpme_c6grid
;
116 sh_lj_ewald
= gmx_fjsp_set1_v2r8(fr
->ic
->sh_lj_ewald
);
117 ewclj
= gmx_fjsp_set1_v2r8(fr
->ic
->ewaldcoeff_lj
);
118 ewclj2
= _fjsp_mul_v2r8(minus_one
,_fjsp_mul_v2r8(ewclj
,ewclj
));
120 rcutoff_scalar
= fr
->ic
->rvdw
;
121 rcutoff
= gmx_fjsp_set1_v2r8(rcutoff_scalar
);
122 rcutoff2
= _fjsp_mul_v2r8(rcutoff
,rcutoff
);
124 sh_vdw_invrcut6
= gmx_fjsp_set1_v2r8(fr
->ic
->sh_invrc6
);
125 rvdw
= gmx_fjsp_set1_v2r8(fr
->ic
->rvdw
);
127 /* Avoid stupid compiler warnings */
135 /* Start outer loop over neighborlists */
136 for(iidx
=0; iidx
<nri
; iidx
++)
138 /* Load shift vector for this list */
139 i_shift_offset
= DIM
*shiftidx
[iidx
];
141 /* Load limits for loop over neighbors */
142 j_index_start
= jindex
[iidx
];
143 j_index_end
= jindex
[iidx
+1];
145 /* Get outer coordinate index */
147 i_coord_offset
= DIM
*inr
;
149 /* Load i particle coords and add shift vector */
150 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec
+i_shift_offset
,x
+i_coord_offset
,&ix0
,&iy0
,&iz0
);
152 fix0
= _fjsp_setzero_v2r8();
153 fiy0
= _fjsp_setzero_v2r8();
154 fiz0
= _fjsp_setzero_v2r8();
156 /* Load parameters for i particles */
157 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
159 /* Reset potential sums */
160 vvdwsum
= _fjsp_setzero_v2r8();
162 /* Start inner kernel loop */
163 for(jidx
=j_index_start
; jidx
<j_index_end
-1; jidx
+=2)
166 /* Get j neighbor index, and coordinate index */
169 j_coord_offsetA
= DIM
*jnrA
;
170 j_coord_offsetB
= DIM
*jnrB
;
172 /* load j atom coordinates */
173 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x
+j_coord_offsetA
,x
+j_coord_offsetB
,
176 /* Calculate displacement vector */
177 dx00
= _fjsp_sub_v2r8(ix0
,jx0
);
178 dy00
= _fjsp_sub_v2r8(iy0
,jy0
);
179 dz00
= _fjsp_sub_v2r8(iz0
,jz0
);
181 /* Calculate squared distance and things based on it */
182 rsq00
= gmx_fjsp_calc_rsq_v2r8(dx00
,dy00
,dz00
);
184 rinv00
= gmx_fjsp_invsqrt_v2r8(rsq00
);
186 rinvsq00
= _fjsp_mul_v2r8(rinv00
,rinv00
);
188 /* Load parameters for j particles */
189 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
190 vdwjidx0B
= 2*vdwtype
[jnrB
+0];
192 /**************************
193 * CALCULATE INTERACTIONS *
194 **************************/
196 if (gmx_fjsp_any_lt_v2r8(rsq00
,rcutoff2
))
199 r00
= _fjsp_mul_v2r8(rsq00
,rinv00
);
201 /* Compute parameters for interactions between i and j atoms */
202 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam
+vdwioffset0
+vdwjidx0A
,
203 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
205 c6grid_00
= gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam
+vdwioffset0
+vdwjidx0A
,
206 vdwgridparam
+vdwioffset0
+vdwjidx0B
);
208 /* Analytical LJ-PME */
209 rinvsix
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00
,rinvsq00
),rinvsq00
);
210 ewcljrsq
= _fjsp_mul_v2r8(ewclj2
,rsq00
);
211 ewclj6
= _fjsp_mul_v2r8(ewclj2
,_fjsp_mul_v2r8(ewclj2
,ewclj2
));
212 exponent
= gmx_simd_exp_d(ewcljrsq
);
213 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
214 poly
= _fjsp_mul_v2r8(exponent
,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq
,ewcljrsq
),one_half
,_fjsp_sub_v2r8(one
,ewcljrsq
)));
215 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
216 vvdw6
= _fjsp_mul_v2r8(_fjsp_madd_v2r8(c6grid_00
,_fjsp_sub_v2r8(poly
,one
),c6_00
),rinvsix
);
217 vvdw12
= _fjsp_mul_v2r8(c12_00
,_fjsp_mul_v2r8(rinvsix
,rinvsix
));
218 vvdw
= _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00
,_fjsp_mul_v2r8(sh_vdw_invrcut6
,sh_vdw_invrcut6
),vvdw12
),one_twelfth
,
219 _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw6
,_fjsp_madd_v2r8(c6grid_00
,sh_lj_ewald
,_fjsp_mul_v2r8(c6_00
,sh_vdw_invrcut6
))),one_sixth
));
220 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
221 fvdw
= _fjsp_mul_v2r8(_fjsp_add_v2r8(vvdw12
,_fjsp_msub_v2r8(_fjsp_mul_v2r8(c6grid_00
,one_sixth
),_fjsp_mul_v2r8(exponent
,ewclj6
),vvdw6
)),rinvsq00
);
223 cutoff_mask
= _fjsp_cmplt_v2r8(rsq00
,rcutoff2
);
225 /* Update potential sum for this i atom from the interaction with this j atom. */
226 vvdw
= _fjsp_and_v2r8(vvdw
,cutoff_mask
);
227 vvdwsum
= _fjsp_add_v2r8(vvdwsum
,vvdw
);
231 fscal
= _fjsp_and_v2r8(fscal
,cutoff_mask
);
233 /* Update vectorial force */
234 fix0
= _fjsp_madd_v2r8(dx00
,fscal
,fix0
);
235 fiy0
= _fjsp_madd_v2r8(dy00
,fscal
,fiy0
);
236 fiz0
= _fjsp_madd_v2r8(dz00
,fscal
,fiz0
);
238 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f
+j_coord_offsetA
,f
+j_coord_offsetB
,fscal
,dx00
,dy00
,dz00
);
242 /* Inner loop uses 59 flops */
249 j_coord_offsetA
= DIM
*jnrA
;
251 /* load j atom coordinates */
252 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x
+j_coord_offsetA
,
255 /* Calculate displacement vector */
256 dx00
= _fjsp_sub_v2r8(ix0
,jx0
);
257 dy00
= _fjsp_sub_v2r8(iy0
,jy0
);
258 dz00
= _fjsp_sub_v2r8(iz0
,jz0
);
260 /* Calculate squared distance and things based on it */
261 rsq00
= gmx_fjsp_calc_rsq_v2r8(dx00
,dy00
,dz00
);
263 rinv00
= gmx_fjsp_invsqrt_v2r8(rsq00
);
265 rinvsq00
= _fjsp_mul_v2r8(rinv00
,rinv00
);
267 /* Load parameters for j particles */
268 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
270 /**************************
271 * CALCULATE INTERACTIONS *
272 **************************/
274 if (gmx_fjsp_any_lt_v2r8(rsq00
,rcutoff2
))
277 r00
= _fjsp_mul_v2r8(rsq00
,rinv00
);
279 /* Compute parameters for interactions between i and j atoms */
280 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam
+vdwioffset0
+vdwjidx0A
,
281 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
283 c6grid_00
= gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam
+vdwioffset0
+vdwjidx0A
,
284 vdwgridparam
+vdwioffset0
+vdwjidx0B
);
286 /* Analytical LJ-PME */
287 rinvsix
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00
,rinvsq00
),rinvsq00
);
288 ewcljrsq
= _fjsp_mul_v2r8(ewclj2
,rsq00
);
289 ewclj6
= _fjsp_mul_v2r8(ewclj2
,_fjsp_mul_v2r8(ewclj2
,ewclj2
));
290 exponent
= gmx_simd_exp_d(ewcljrsq
);
291 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
292 poly
= _fjsp_mul_v2r8(exponent
,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq
,ewcljrsq
),one_half
,_fjsp_sub_v2r8(one
,ewcljrsq
)));
293 /* vvdw6 = [C6 - C6grid * (1-poly)]/r6 */
294 vvdw6
= _fjsp_mul_v2r8(_fjsp_madd_v2r8(c6grid_00
,_fjsp_sub_v2r8(poly
,one
),c6_00
),rinvsix
);
295 vvdw12
= _fjsp_mul_v2r8(c12_00
,_fjsp_mul_v2r8(rinvsix
,rinvsix
));
296 vvdw
= _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00
,_fjsp_mul_v2r8(sh_vdw_invrcut6
,sh_vdw_invrcut6
),vvdw12
),one_twelfth
,
297 _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw6
,_fjsp_madd_v2r8(c6grid_00
,sh_lj_ewald
,_fjsp_mul_v2r8(c6_00
,sh_vdw_invrcut6
))),one_sixth
));
298 /* fvdw = vvdw12/r - (vvdw6/r + (C6grid * exponent * beta^6)/r) */
299 fvdw
= _fjsp_mul_v2r8(_fjsp_add_v2r8(vvdw12
,_fjsp_msub_v2r8(_fjsp_mul_v2r8(c6grid_00
,one_sixth
),_fjsp_mul_v2r8(exponent
,ewclj6
),vvdw6
)),rinvsq00
);
301 cutoff_mask
= _fjsp_cmplt_v2r8(rsq00
,rcutoff2
);
303 /* Update potential sum for this i atom from the interaction with this j atom. */
304 vvdw
= _fjsp_and_v2r8(vvdw
,cutoff_mask
);
305 vvdw
= _fjsp_unpacklo_v2r8(vvdw
,_fjsp_setzero_v2r8());
306 vvdwsum
= _fjsp_add_v2r8(vvdwsum
,vvdw
);
310 fscal
= _fjsp_and_v2r8(fscal
,cutoff_mask
);
312 fscal
= _fjsp_unpacklo_v2r8(fscal
,_fjsp_setzero_v2r8());
314 /* Update vectorial force */
315 fix0
= _fjsp_madd_v2r8(dx00
,fscal
,fix0
);
316 fiy0
= _fjsp_madd_v2r8(dy00
,fscal
,fiy0
);
317 fiz0
= _fjsp_madd_v2r8(dz00
,fscal
,fiz0
);
319 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f
+j_coord_offsetA
,fscal
,dx00
,dy00
,dz00
);
323 /* Inner loop uses 59 flops */
326 /* End of innermost loop */
328 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0
,fiy0
,fiz0
,
329 f
+i_coord_offset
,fshift
+i_shift_offset
);
332 /* Update potential energies */
333 gmx_fjsp_update_1pot_v2r8(vvdwsum
,kernel_data
->energygrp_vdw
+ggid
);
335 /* Increment number of inner iterations */
336 inneriter
+= j_index_end
- j_index_start
;
338 /* Outer loop uses 7 flops */
341 /* Increment number of outer iterations */
344 /* Update outer/inner flops */
346 inc_nrnb(nrnb
,eNR_NBKERNEL_VDW_VF
,outeriter
*7 + inneriter
*59);
349 * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwLJEwSh_GeomP1P1_F_sparc64_hpc_ace_double
350 * Electrostatics interaction: None
351 * VdW interaction: LJEwald
352 * Geometry: Particle-Particle
353 * Calculate force/pot: Force
356 nb_kernel_ElecNone_VdwLJEwSh_GeomP1P1_F_sparc64_hpc_ace_double
357 (t_nblist
* gmx_restrict nlist
,
358 rvec
* gmx_restrict xx
,
359 rvec
* gmx_restrict ff
,
360 struct t_forcerec
* gmx_restrict fr
,
361 t_mdatoms
* gmx_restrict mdatoms
,
362 nb_kernel_data_t gmx_unused
* gmx_restrict kernel_data
,
363 t_nrnb
* gmx_restrict nrnb
)
365 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
366 * just 0 for non-waters.
367 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
368 * jnr indices corresponding to data put in the four positions in the SIMD register.
370 int i_shift_offset
,i_coord_offset
,outeriter
,inneriter
;
371 int j_index_start
,j_index_end
,jidx
,nri
,inr
,ggid
,iidx
;
373 int j_coord_offsetA
,j_coord_offsetB
;
374 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
376 real
*shiftvec
,*fshift
,*x
,*f
;
377 _fjsp_v2r8 tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
,jidxall
;
379 _fjsp_v2r8 ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
380 int vdwjidx0A
,vdwjidx0B
;
381 _fjsp_v2r8 jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
382 _fjsp_v2r8 dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
;
384 _fjsp_v2r8 rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,sh_vdw_invrcut6
;
387 _fjsp_v2r8 one_sixth
= gmx_fjsp_set1_v2r8(1.0/6.0);
388 _fjsp_v2r8 one_twelfth
= gmx_fjsp_set1_v2r8(1.0/12.0);
389 _fjsp_v2r8 c6grid_00
;
391 _fjsp_v2r8 ewclj
,ewclj2
,ewclj6
,ewcljrsq
,poly
,exponent
,f6A
,f6B
,sh_lj_ewald
;
392 _fjsp_v2r8 one_half
= gmx_fjsp_set1_v2r8(0.5);
393 _fjsp_v2r8 minus_one
= gmx_fjsp_set1_v2r8(-1.0);
395 _fjsp_v2r8 dummy_mask
,cutoff_mask
;
396 _fjsp_v2r8 one
= gmx_fjsp_set1_v2r8(1.0);
397 _fjsp_v2r8 two
= gmx_fjsp_set1_v2r8(2.0);
398 union { _fjsp_v2r8 simd
; long long int i
[2]; } vfconv
,gbconv
,ewconv
;
405 jindex
= nlist
->jindex
;
407 shiftidx
= nlist
->shift
;
409 shiftvec
= fr
->shift_vec
[0];
410 fshift
= fr
->fshift
[0];
411 nvdwtype
= fr
->ntype
;
413 vdwtype
= mdatoms
->typeA
;
414 vdwgridparam
= fr
->ljpme_c6grid
;
415 sh_lj_ewald
= gmx_fjsp_set1_v2r8(fr
->ic
->sh_lj_ewald
);
416 ewclj
= gmx_fjsp_set1_v2r8(fr
->ic
->ewaldcoeff_lj
);
417 ewclj2
= _fjsp_mul_v2r8(minus_one
,_fjsp_mul_v2r8(ewclj
,ewclj
));
419 rcutoff_scalar
= fr
->ic
->rvdw
;
420 rcutoff
= gmx_fjsp_set1_v2r8(rcutoff_scalar
);
421 rcutoff2
= _fjsp_mul_v2r8(rcutoff
,rcutoff
);
423 sh_vdw_invrcut6
= gmx_fjsp_set1_v2r8(fr
->ic
->sh_invrc6
);
424 rvdw
= gmx_fjsp_set1_v2r8(fr
->ic
->rvdw
);
426 /* Avoid stupid compiler warnings */
434 /* Start outer loop over neighborlists */
435 for(iidx
=0; iidx
<nri
; iidx
++)
437 /* Load shift vector for this list */
438 i_shift_offset
= DIM
*shiftidx
[iidx
];
440 /* Load limits for loop over neighbors */
441 j_index_start
= jindex
[iidx
];
442 j_index_end
= jindex
[iidx
+1];
444 /* Get outer coordinate index */
446 i_coord_offset
= DIM
*inr
;
448 /* Load i particle coords and add shift vector */
449 gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec
+i_shift_offset
,x
+i_coord_offset
,&ix0
,&iy0
,&iz0
);
451 fix0
= _fjsp_setzero_v2r8();
452 fiy0
= _fjsp_setzero_v2r8();
453 fiz0
= _fjsp_setzero_v2r8();
455 /* Load parameters for i particles */
456 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
458 /* Start inner kernel loop */
459 for(jidx
=j_index_start
; jidx
<j_index_end
-1; jidx
+=2)
462 /* Get j neighbor index, and coordinate index */
465 j_coord_offsetA
= DIM
*jnrA
;
466 j_coord_offsetB
= DIM
*jnrB
;
468 /* load j atom coordinates */
469 gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x
+j_coord_offsetA
,x
+j_coord_offsetB
,
472 /* Calculate displacement vector */
473 dx00
= _fjsp_sub_v2r8(ix0
,jx0
);
474 dy00
= _fjsp_sub_v2r8(iy0
,jy0
);
475 dz00
= _fjsp_sub_v2r8(iz0
,jz0
);
477 /* Calculate squared distance and things based on it */
478 rsq00
= gmx_fjsp_calc_rsq_v2r8(dx00
,dy00
,dz00
);
480 rinv00
= gmx_fjsp_invsqrt_v2r8(rsq00
);
482 rinvsq00
= _fjsp_mul_v2r8(rinv00
,rinv00
);
484 /* Load parameters for j particles */
485 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
486 vdwjidx0B
= 2*vdwtype
[jnrB
+0];
488 /**************************
489 * CALCULATE INTERACTIONS *
490 **************************/
492 if (gmx_fjsp_any_lt_v2r8(rsq00
,rcutoff2
))
495 r00
= _fjsp_mul_v2r8(rsq00
,rinv00
);
497 /* Compute parameters for interactions between i and j atoms */
498 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam
+vdwioffset0
+vdwjidx0A
,
499 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
501 c6grid_00
= gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam
+vdwioffset0
+vdwjidx0A
,
502 vdwgridparam
+vdwioffset0
+vdwjidx0B
);
504 /* Analytical LJ-PME */
505 rinvsix
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00
,rinvsq00
),rinvsq00
);
506 ewcljrsq
= _fjsp_mul_v2r8(ewclj2
,rsq00
);
507 ewclj6
= _fjsp_mul_v2r8(ewclj2
,_fjsp_mul_v2r8(ewclj2
,ewclj2
));
508 exponent
= gmx_simd_exp_d(ewcljrsq
);
509 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
510 poly
= _fjsp_mul_v2r8(exponent
,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq
,ewcljrsq
),one_half
,_fjsp_sub_v2r8(one
,ewcljrsq
)));
511 /* f6A = 6 * C6grid * (1 - poly) */
512 f6A
= _fjsp_mul_v2r8(c6grid_00
,_fjsp_sub_v2r8(one
,poly
));
513 /* f6B = C6grid * exponent * beta^6 */
514 f6B
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00
,one_sixth
),_fjsp_mul_v2r8(exponent
,ewclj6
));
515 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
516 fvdw
= _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00
,rinvsix
,_fjsp_sub_v2r8(c6_00
,f6A
)),rinvsix
,f6B
),rinvsq00
);
518 cutoff_mask
= _fjsp_cmplt_v2r8(rsq00
,rcutoff2
);
522 fscal
= _fjsp_and_v2r8(fscal
,cutoff_mask
);
524 /* Update vectorial force */
525 fix0
= _fjsp_madd_v2r8(dx00
,fscal
,fix0
);
526 fiy0
= _fjsp_madd_v2r8(dy00
,fscal
,fiy0
);
527 fiz0
= _fjsp_madd_v2r8(dz00
,fscal
,fiz0
);
529 gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f
+j_coord_offsetA
,f
+j_coord_offsetB
,fscal
,dx00
,dy00
,dz00
);
533 /* Inner loop uses 51 flops */
540 j_coord_offsetA
= DIM
*jnrA
;
542 /* load j atom coordinates */
543 gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x
+j_coord_offsetA
,
546 /* Calculate displacement vector */
547 dx00
= _fjsp_sub_v2r8(ix0
,jx0
);
548 dy00
= _fjsp_sub_v2r8(iy0
,jy0
);
549 dz00
= _fjsp_sub_v2r8(iz0
,jz0
);
551 /* Calculate squared distance and things based on it */
552 rsq00
= gmx_fjsp_calc_rsq_v2r8(dx00
,dy00
,dz00
);
554 rinv00
= gmx_fjsp_invsqrt_v2r8(rsq00
);
556 rinvsq00
= _fjsp_mul_v2r8(rinv00
,rinv00
);
558 /* Load parameters for j particles */
559 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
561 /**************************
562 * CALCULATE INTERACTIONS *
563 **************************/
565 if (gmx_fjsp_any_lt_v2r8(rsq00
,rcutoff2
))
568 r00
= _fjsp_mul_v2r8(rsq00
,rinv00
);
570 /* Compute parameters for interactions between i and j atoms */
571 gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam
+vdwioffset0
+vdwjidx0A
,
572 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
574 c6grid_00
= gmx_fjsp_load_2real_swizzle_v2r8(vdwgridparam
+vdwioffset0
+vdwjidx0A
,
575 vdwgridparam
+vdwioffset0
+vdwjidx0B
);
577 /* Analytical LJ-PME */
578 rinvsix
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00
,rinvsq00
),rinvsq00
);
579 ewcljrsq
= _fjsp_mul_v2r8(ewclj2
,rsq00
);
580 ewclj6
= _fjsp_mul_v2r8(ewclj2
,_fjsp_mul_v2r8(ewclj2
,ewclj2
));
581 exponent
= gmx_simd_exp_d(ewcljrsq
);
582 /* poly = exp(-(beta*r)^2) * (1 + (beta*r)^2 + (beta*r)^4 /2) */
583 poly
= _fjsp_mul_v2r8(exponent
,_fjsp_madd_v2r8(_fjsp_mul_v2r8(ewcljrsq
,ewcljrsq
),one_half
,_fjsp_sub_v2r8(one
,ewcljrsq
)));
584 /* f6A = 6 * C6grid * (1 - poly) */
585 f6A
= _fjsp_mul_v2r8(c6grid_00
,_fjsp_sub_v2r8(one
,poly
));
586 /* f6B = C6grid * exponent * beta^6 */
587 f6B
= _fjsp_mul_v2r8(_fjsp_mul_v2r8(c6grid_00
,one_sixth
),_fjsp_mul_v2r8(exponent
,ewclj6
));
588 /* fvdw = 12*C12/r13 - ((6*C6 - f6A)/r6 + f6B)/r */
589 fvdw
= _fjsp_mul_v2r8(_fjsp_madd_v2r8(_fjsp_msub_v2r8(c12_00
,rinvsix
,_fjsp_sub_v2r8(c6_00
,f6A
)),rinvsix
,f6B
),rinvsq00
);
591 cutoff_mask
= _fjsp_cmplt_v2r8(rsq00
,rcutoff2
);
595 fscal
= _fjsp_and_v2r8(fscal
,cutoff_mask
);
597 fscal
= _fjsp_unpacklo_v2r8(fscal
,_fjsp_setzero_v2r8());
599 /* Update vectorial force */
600 fix0
= _fjsp_madd_v2r8(dx00
,fscal
,fix0
);
601 fiy0
= _fjsp_madd_v2r8(dy00
,fscal
,fiy0
);
602 fiz0
= _fjsp_madd_v2r8(dz00
,fscal
,fiz0
);
604 gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f
+j_coord_offsetA
,fscal
,dx00
,dy00
,dz00
);
608 /* Inner loop uses 51 flops */
611 /* End of innermost loop */
613 gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0
,fiy0
,fiz0
,
614 f
+i_coord_offset
,fshift
+i_shift_offset
);
616 /* Increment number of inner iterations */
617 inneriter
+= j_index_end
- j_index_start
;
619 /* Outer loop uses 6 flops */
622 /* Increment number of outer iterations */
625 /* Update outer/inner flops */
627 inc_nrnb(nrnb
,eNR_NBKERNEL_VDW_F
,outeriter
*6 + inneriter
*51);