LCOV - code coverage report
Current view: top level - src/grid/ref - grid_ref_collocate.c (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 100.0 % 17 17
Test Date: 2025-12-04 06:27:48 Functions: 100.0 % 1 1

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

Generated by: LCOV version 2.0-1