Line data Source code
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 : ******************************************************************************/
19 7862 : void grid_ref_collocate_pgf_product(
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 7862 : const double pab[n2][n1], double *grid) {
28 :
29 7862 : int la_min_diff, la_max_diff, lb_min_diff, lb_max_diff;
30 7862 : grid_ref_prepare_get_ldiffs(func, &la_min_diff, &la_max_diff, &lb_min_diff,
31 : &lb_max_diff);
32 :
33 7862 : const int la_min_cab = imax(la_min + la_min_diff, 0);
34 7862 : const int lb_min_cab = imax(lb_min + lb_min_diff, 0);
35 7862 : const int la_max_cab = la_max + la_max_diff;
36 7862 : const int lb_max_cab = lb_max + lb_max_diff;
37 7862 : const int n1_cab = ncoset(la_max_cab);
38 7862 : const int n2_cab = ncoset(lb_max_cab);
39 :
40 7862 : const size_t cab_size = n2_cab * n1_cab;
41 7862 : double cab[cab_size];
42 7862 : memset(cab, 0, cab_size * sizeof(double));
43 :
44 7862 : grid_ref_prepare_pab(func, o1, o2, la_max, la_min, lb_max, lb_min, zeta, zetb,
45 7862 : n1, n2, pab, n1_cab, n2_cab, (double(*)[n1_cab])cab);
46 7862 : 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 7862 : }
50 :
51 : // EOF
|