LCOV - code coverage report
Current view: top level - src - eeq_input.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 35 36 97.2 %
Date: 2024-12-21 06:28:57 Functions: 2 3 66.7 %

          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: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief Input definition and setup for EEQ model
      10             : !> \author JGH [2024]
      11             : ! **************************************************************************************************
      12             : MODULE eeq_input
      13             :    USE input_keyword_types,             ONLY: keyword_create,&
      14             :                                               keyword_release,&
      15             :                                               keyword_type
      16             :    USE input_section_types,             ONLY: section_add_keyword,&
      17             :                                               section_create,&
      18             :                                               section_type,&
      19             :                                               section_vals_type,&
      20             :                                               section_vals_val_get
      21             :    USE kinds,                           ONLY: dp
      22             : #include "./base/base_uses.f90"
      23             : 
      24             :    IMPLICIT NONE
      25             :    PRIVATE
      26             : 
      27             :    TYPE eeq_solver_type
      28             :       LOGICAL                                :: direct = .FALSE.
      29             :       LOGICAL                                :: sparse = .FALSE.
      30             :       REAL(KIND=dp)                          :: eps_diis = 1.0E-09_dp
      31             :       REAL(KIND=dp)                          :: alpha = 0.75_dp
      32             :       INTEGER                                :: mdiis = 12
      33             :       INTEGER                                :: sdiis = 3
      34             :       INTEGER                                :: max_diis = 500
      35             :    END TYPE eeq_solver_type
      36             : 
      37             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'eeq_input'
      38             : 
      39             :    PUBLIC :: eeq_solver_type
      40             :    PUBLIC :: read_eeq_param
      41             :    PUBLIC :: create_eeq_control_section
      42             : 
      43             : CONTAINS
      44             : 
      45             : ! **************************************************************************************************
      46             : !> \brief ...
      47             : !> \param section ...
      48             : ! **************************************************************************************************
      49       73472 :    SUBROUTINE create_eeq_control_section(section)
      50             :       TYPE(section_type), POINTER                        :: section
      51             : 
      52             :       TYPE(keyword_type), POINTER                        :: keyword
      53             : 
      54       73472 :       CPASSERT(.NOT. ASSOCIATED(section))
      55             :       CALL section_create(section, __LOCATION__, name="EEQ", &
      56             :                           description="Parameters needed for EEQ method and solver", &
      57       73472 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
      58             : 
      59       73472 :       NULLIFY (keyword)
      60             :       CALL keyword_create(keyword, __LOCATION__, name="DIRECT", &
      61             :                           description="Use a direct method to solve the EEQ equations in PBC (matrix solver)", &
      62       73472 :                           usage="DIRECT", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      63       73472 :       CALL section_add_keyword(section, keyword)
      64       73472 :       CALL keyword_release(keyword)
      65             : 
      66             :       CALL keyword_create(keyword, __LOCATION__, name="SPARSE", &
      67             :                           description="Use a sparse method to solve the EEQ equations. (NYA)", &
      68       73472 :                           usage="SPARSE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      69       73472 :       CALL section_add_keyword(section, keyword)
      70       73472 :       CALL keyword_release(keyword)
      71             : 
      72             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DIIS", &
      73             :                           description="Accuracy for the iterative solver.", &
      74       73472 :                           usage="EPS_DIIS 1.0E-10", default_r_val=1.0e-10_dp)
      75       73472 :       CALL section_add_keyword(section, keyword)
      76       73472 :       CALL keyword_release(keyword)
      77             : 
      78             :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
      79             :                           description="Step length of initial steepest descent steps.", &
      80       73472 :                           usage="ALPHA 1.0", default_r_val=0.75_dp)
      81       73472 :       CALL section_add_keyword(section, keyword)
      82       73472 :       CALL keyword_release(keyword)
      83             : 
      84             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DIIS", &
      85             :                           description="Max. number of iterations for EEQ solver.", &
      86       73472 :                           usage="MAX_DIIS  100", default_i_val=500)
      87       73472 :       CALL section_add_keyword(section, keyword)
      88       73472 :       CALL keyword_release(keyword)
      89             : 
      90             :       CALL keyword_create(keyword, __LOCATION__, name="MDIIS", &
      91             :                           description="Max. number of DIIS vectors used.", &
      92       73472 :                           usage="MDIIS 10", default_i_val=12)
      93       73472 :       CALL section_add_keyword(section, keyword)
      94       73472 :       CALL keyword_release(keyword)
      95             : 
      96             :       CALL keyword_create(keyword, __LOCATION__, name="SDIIS", &
      97             :                           description="Number of vectors accumulated before starting DIIS.", &
      98       73472 :                           usage="SDIIS 4", default_i_val=3)
      99       73472 :       CALL section_add_keyword(section, keyword)
     100       73472 :       CALL keyword_release(keyword)
     101             : 
     102       73472 :    END SUBROUTINE create_eeq_control_section
     103             : 
     104             : ! **************************************************************************************************
     105             : !> \brief ...
     106             : !> \param eeq_section ...
     107             : !> \param eeq_sparam ...
     108             : ! **************************************************************************************************
     109         924 :    SUBROUTINE read_eeq_param(eeq_section, eeq_sparam)
     110             : 
     111             :       TYPE(section_vals_type), POINTER                   :: eeq_section
     112             :       TYPE(eeq_solver_type), INTENT(INOUT)               :: eeq_sparam
     113             : 
     114         924 :       CALL section_vals_val_get(eeq_section, "DIRECT", l_val=eeq_sparam%direct)
     115         924 :       CALL section_vals_val_get(eeq_section, "SPARSE", l_val=eeq_sparam%sparse)
     116         924 :       CALL section_vals_val_get(eeq_section, "EPS_DIIS", r_val=eeq_sparam%eps_diis)
     117         924 :       CALL section_vals_val_get(eeq_section, "ALPHA", r_val=eeq_sparam%alpha)
     118         924 :       CALL section_vals_val_get(eeq_section, "MAX_DIIS", i_val=eeq_sparam%max_diis)
     119         924 :       CALL section_vals_val_get(eeq_section, "MDIIS", i_val=eeq_sparam%mdiis)
     120         924 :       CALL section_vals_val_get(eeq_section, "SDIIS", i_val=eeq_sparam%sdiis)
     121             : 
     122         924 :    END SUBROUTINE read_eeq_param
     123             : 
     124           0 : END MODULE eeq_input

Generated by: LCOV version 1.15