235 static bool initialized =
false;
242 for (
int lx = 0; lx <= 18; lx++) {
243 for (
int ly = 0; ly <= 18 - lx; ly++) {
244 for (
int lz = 0; lz <= 18 - lx - ly; lz++) {
245 const int i = coset(lx, ly, lz);
246 coset_inv_host[
i] = {{lx, ly, lz}};
251 offloadMemcpyToSymbol(
coset_inv, &coset_inv_host,
sizeof(coset_inv_host));
254 int binomial_coef_host[19][19] = {
255 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
256 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
257 {1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
258 {1, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
259 {1, 4, 6, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
260 {1, 5, 10, 10, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
261 {1, 6, 15, 20, 15, 6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
262 {1, 7, 21, 35, 35, 21, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
263 {1, 8, 28, 56, 70, 56, 28, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
264 {1, 9, 36, 84, 126, 126, 84, 36, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
265 {1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0},
266 {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1, 0, 0, 0, 0, 0, 0, 0},
267 {1, 12, 66, 220, 495, 792, 924, 792, 495, 220, 66, 12, 1, 0, 0, 0, 0, 0,
269 {1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1, 0, 0,
271 {1, 14, 91, 364, 1001, 2002, 3003, 3432, 3003, 2002, 1001, 364, 91, 14, 1,
273 {1, 15, 105, 455, 1365, 3003, 5005, 6435, 6435, 5005, 3003, 1365, 455,
274 105, 15, 1, 0, 0, 0},
275 {1, 16, 120, 560, 1820, 4368, 8008, 11440, 12870, 11440, 8008, 4368, 1820,
276 560, 120, 16, 1, 0, 0},
277 {1, 17, 136, 680, 2380, 6188, 12376, 19448, 24310, 24310, 19448, 12376,
278 6188, 2380, 680, 136, 17, 1, 0},
279 {1, 18, 153, 816, 3060, 8568, 18564, 31824, 43758, 48620, 43758, 31824,
280 18564, 8568, 3060, 816, 153, 18, 1}};
281 offloadMemcpyToSymbol(
binomial_coef, &binomial_coef_host[0][0],
282 sizeof(binomial_coef_host));
401 const T radius,
const T *
const __restrict__ dh_,
402 const T *
const __restrict__ dh_inv_,
const T3 *__restrict__ rp,
403 T3 *__restrict__ roffset, int3 *__restrict__ cubecenter,
404 int3 *__restrict__ lb_cube, int3 *__restrict__ cube_size) {
413 cubecenter->x = std::floor(rp1.x);
414 cubecenter->y = std::floor(rp1.y);
415 cubecenter->z = std::floor(rp1.z);
432 T norm1, norm2, norm3;
433 norm1 = dh_[0] * dh_[0] + dh_[1] * dh_[1] + dh_[2] * dh_[2];
434 norm2 = dh_[3] * dh_[3] + dh_[4] * dh_[4] + dh_[5] * dh_[5];
435 norm3 = dh_[6] * dh_[6] + dh_[7] * dh_[7] + dh_[8] * dh_[8];
437 norm1 = std::sqrt(norm1);
438 norm2 = std::sqrt(norm2);
439 norm3 = std::sqrt(norm3);
441 const T disr_radius =
442 std::min(norm1, std::min(norm2, norm3)) *
444 (
int)ceil(radius / std::min(norm1, std::min(norm2, norm3)))));
446 rp2.x = cubecenter->x;
447 rp2.y = cubecenter->y;
448 rp2.z = cubecenter->z;
468 lb_cube->x = std::ceil(-1e-8 - rp3.x);
469 lb_cube->y = std::ceil(-1e-8 - rp3.y);
470 lb_cube->z = std::ceil(-1e-8 - rp3.z);
483 cube_size->x = 2 - 2 * lb_cube->x;
484 cube_size->y = 2 - 2 * lb_cube->y;
485 cube_size->z = 2 - 2 * lb_cube->z;
490 lb_cube->x = INT_MAX;
492 lb_cube->y = INT_MAX;
494 lb_cube->z = INT_MAX;
497 for (
int i = -1;
i <= 1;
i++) {
498 for (
int j = -1; j <= 1; j++) {
499 for (
int k = -1; k <= 1; k++) {
501 r.x = rp->x + ((T)
i) * radius;
502 r.y = rp->y + ((T)j) * radius;
503 r.z = rp->z + ((T)k) * radius;
506 lb_cube->x = std::min(lb_cube->x, (
int)std::floor(roffset->x));
507 ub_cube.x = std::max(ub_cube.x, (
int)std::ceil(roffset->x));
509 lb_cube->y = std::min(lb_cube->y, (
int)std::floor(roffset->y));
510 ub_cube.y = std::max(ub_cube.y, (
int)std::ceil(roffset->y));
512 lb_cube->z = std::min(lb_cube->z, (
int)std::floor(roffset->z));
513 ub_cube.z = std::max(ub_cube.z, (
int)std::ceil(roffset->z));
518 cube_size->x = ub_cube.x - lb_cube->x;
519 cube_size->y = ub_cube.y - lb_cube->y;
520 cube_size->z = ub_cube.z - lb_cube->z;
524 roffset->x = cubecenter->x - rp1.x;
525 roffset->y = cubecenter->y - rp1.y;
526 roffset->z = cubecenter->z - rp1.z;
530 lb_cube->x -= cubecenter->x;
531 lb_cube->y -= cubecenter->y;
532 lb_cube->z -= cubecenter->z;