LCOV - code coverage report
Current view: top level - src - low_rank_preconditioner_unittest.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:123285f) Lines: 90.0 % 10 9
Test Date: 2026-11-04 00:58:17 Functions: 100.0 % 2 2

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8            2 : PROGRAM low_rank_preconditioner_unittest
       9            2 :    USE kinds,                           ONLY: dp
      10              :    USE low_rank_preconditioner_model,   ONLY: low_rank_inverse_weight,&
      11              :                                               low_rank_select_rank
      12              : 
      13              :    IMPLICIT NONE
      14              : 
      15              :    REAL(KIND=dp), PARAMETER                            :: tolerance = 2.0E-14_dp
      16              :    INTEGER                                             :: selected_rank
      17              :    REAL(KIND=dp), DIMENSION(7)                         :: full_eigenvalues
      18              : 
      19            2 :    full_eigenvalues = [-0.8_dp, -0.2_dp, 0.2_dp, 0.4_dp, 0.7_dp, 0.7_dp, 1.4_dp]
      20            2 :    selected_rank = low_rank_select_rank(full_eigenvalues, 2, 3, 1.0E-8_dp)
      21            2 :    IF (selected_rank /= 2) ERROR STOP "Rank cap split a degenerate complementary manifold"
      22            2 :    selected_rank = low_rank_select_rank(full_eigenvalues, 2, 5, 1.0E-8_dp)
      23            2 :    IF (selected_rank /= 5) ERROR STOP "Full complementary space did not retain its rank"
      24            2 :    IF (ABS(low_rank_inverse_weight(1.5_dp, 0.0_dp, 0.08_dp) - 2.0_dp/3.0_dp) > tolerance) THEN
      25            0 :       ERROR STOP "Common-reference inverse weight differs from the spectral model"
      26              :    END IF
      27              : 
      28            2 : END PROGRAM low_rank_preconditioner_unittest
        

Generated by: LCOV version 2.0-1