(git:34ef472)
grid_ref_collocate.c
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* CP2K: A general program to perform molecular dynamics simulations */
3 /* Copyright 2000-2024 CP2K developers group <https://cp2k.org> */
4 /* */
5 /* SPDX-License-Identifier: BSD-3-Clause */
6 /*----------------------------------------------------------------------------*/
7 
8 #define GRID_DO_COLLOCATE 1
9 #include "grid_ref_collocate.h"
10 #include "../common/grid_common.h"
11 #include "grid_ref_collint.h"
12 #include "grid_ref_prepare_pab.h"
13 
14 /*******************************************************************************
15  * \brief Collocates a single product of primitiv Gaussians.
16  * See grid_ref_collocate.h for details.
17  * \author Ole Schuett
18  ******************************************************************************/
20  const bool orthorhombic, const int border_mask, const enum grid_func func,
21  const int la_max, const int la_min, const int lb_max, const int lb_min,
22  const double zeta, const double zetb, const double rscale,
23  const double dh[3][3], const double dh_inv[3][3], const double ra[3],
24  const double rab[3], const int npts_global[3], const int npts_local[3],
25  const int shift_local[3], const int border_width[3], const double radius,
26  const int o1, const int o2, const int n1, const int n2,
27  const double pab[n2][n1], double *grid) {
28 
29  int la_min_diff, la_max_diff, lb_min_diff, lb_max_diff;
30  grid_ref_prepare_get_ldiffs(func, &la_min_diff, &la_max_diff, &lb_min_diff,
31  &lb_max_diff);
32 
33  const int la_min_cab = imax(la_min + la_min_diff, 0);
34  const int lb_min_cab = imax(lb_min + lb_min_diff, 0);
35  const int la_max_cab = la_max + la_max_diff;
36  const int lb_max_cab = lb_max + lb_max_diff;
37  const int n1_cab = ncoset(la_max_cab);
38  const int n2_cab = ncoset(lb_max_cab);
39 
40  const size_t cab_size = n2_cab * n1_cab;
41  double cab[cab_size];
42  memset(cab, 0, cab_size * sizeof(double));
43 
44  grid_ref_prepare_pab(func, o1, o2, la_max, la_min, lb_max, lb_min, zeta, zetb,
45  n1, n2, pab, n1_cab, n2_cab, (double(*)[n1_cab])cab);
46  cab_to_grid(orthorhombic, border_mask, la_max_cab, la_min_cab, lb_max_cab,
47  lb_min_cab, zeta, zetb, rscale, dh, dh_inv, ra, rab, npts_global,
48  npts_local, shift_local, border_width, radius, cab, grid);
49 }
50 
51 // EOF
static int imax(int x, int y)
Returns the larger of two given integer (missing from the C standard)
static GRID_HOST_DEVICE int ncoset(const int l)
Number of Cartesian orbitals up to given angular momentum quantum.
Definition: grid_common.h:73
grid_func
static void const int const int const int const int const int const double const int const int const int int GRID_CONST_WHEN_COLLOCATE double GRID_CONST_WHEN_INTEGRATE double * grid
static void const int const int const int const int const int const double const int const int const int npts_local[3]
static void cab_to_grid(const bool orthorhombic, const int border_mask, const int la_max, const int la_min, const int lb_max, const int lb_min, const double zeta, const double zetb, const double rscale, const double dh[3][3], const double dh_inv[3][3], const double ra[3], const double rab[3], const int npts_global[3], const int npts_local[3], const int shift_local[3], const int border_width[3], const double radius, GRID_CONST_WHEN_COLLOCATE double *cab, GRID_CONST_WHEN_INTEGRATE double *grid)
Collocates coefficients C_ab onto the grid.
void grid_ref_collocate_pgf_product(const bool orthorhombic, const int border_mask, const enum grid_func func, const int la_max, const int la_min, const int lb_max, const int lb_min, const double zeta, const double zetb, const double rscale, const double dh[3][3], const double dh_inv[3][3], const double ra[3], const double rab[3], const int npts_global[3], const int npts_local[3], const int shift_local[3], const int border_width[3], const double radius, const int o1, const int o2, const int n1, const int n2, const double pab[n2][n1], double *grid)
Collocates a single product of primitiv Gaussians. See grid_ref_collocate.h for details.
void grid_ref_prepare_pab(const enum grid_func func, const int o1, const int o2, const int la_max, const int la_min, const int lb_max, const int lb_min, const double zeta, const double zetb, const int n1, const int n2, const double pab[n2][n1], const int n1_prep, const int n2_prep, double pab_prep[n2_prep][n1_prep])
Selects and transforms a sub-block of the given density matrix block. See grid_ref_prepare_pab....
void grid_ref_prepare_get_ldiffs(const enum grid_func func, int *la_min_diff, int *la_max_diff, int *lb_min_diff, int *lb_max_diff)
Returns block size changes due to transformation grid_prepare_pab.