LCOV - code coverage report
Current view: top level - src - eeq_input.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 35 36 97.2 %
Date: 2024-11-21 06:45:46 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       68320 :    SUBROUTINE create_eeq_control_section(section)
      50             :       TYPE(section_type), POINTER                        :: section
      51             : 
      52             :       TYPE(keyword_type), POINTER                        :: keyword
      53             : 
      54       68320 :       CPASSERT(.NOT. ASSOCIATED(section))
      55             :       CALL section_create(section, __LOCATION__, name="EEQ", &
      56             :                           description="Parameters needed for EEQ method and solver", &
      57       68320 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
      58             : 
      59       68320 :       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       68320 :                           usage="DIRECT", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      63       68320 :       CALL section_add_keyword(section, keyword)
      64       68320 :       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       68320 :                           usage="SPARSE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      69       68320 :       CALL section_add_keyword(section, keyword)
      70       68320 :       CALL keyword_release(keyword)
      71             : 
      72             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DIIS", &
      73             :                           description="Accuracy for the iterative solver.", &
      74       68320 :                           usage="EPS_DIIS 1.0E-10", default_r_val=1.0e-10_dp)
      75       68320 :       CALL section_add_keyword(section, keyword)
      76       68320 :       CALL keyword_release(keyword)
      77             : 
      78             :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
      79             :                           description="Step length of initial steepest descent steps.", &
      80       68320 :                           usage="ALPHA 1.0", default_r_val=0.75_dp)
      81       68320 :       CALL section_add_keyword(section, keyword)
      82       68320 :       CALL keyword_release(keyword)
      83             : 
      84             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DIIS", &
      85             :                           description="Max. number of iterations for EEQ solver.", &
      86       68320 :                           usage="MAX_DIIS  100", default_i_val=500)
      87       68320 :       CALL section_add_keyword(section, keyword)
      88       68320 :       CALL keyword_release(keyword)
      89             : 
      90             :       CALL keyword_create(keyword, __LOCATION__, name="MDIIS", &
      91             :                           description="Max. number of DIIS vectors used.", &
      92       68320 :                           usage="MDIIS 10", default_i_val=12)
      93       68320 :       CALL section_add_keyword(section, keyword)
      94       68320 :       CALL keyword_release(keyword)
      95             : 
      96             :       CALL keyword_create(keyword, __LOCATION__, name="SDIIS", &
      97             :                           description="Number of vectors accumulated before starting DIIS.", &
      98       68320 :                           usage="SDIIS 4", default_i_val=3)
      99       68320 :       CALL section_add_keyword(section, keyword)
     100       68320 :       CALL keyword_release(keyword)
     101             : 
     102       68320 :    END SUBROUTINE create_eeq_control_section
     103             : 
     104             : ! **************************************************************************************************
     105             : !> \brief ...
     106             : !> \param eeq_section ...
     107             : !> \param eeq_sparam ...
     108             : ! **************************************************************************************************
     109         298 :    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         298 :       CALL section_vals_val_get(eeq_section, "DIRECT", l_val=eeq_sparam%direct)
     115         298 :       CALL section_vals_val_get(eeq_section, "SPARSE", l_val=eeq_sparam%sparse)
     116         298 :       CALL section_vals_val_get(eeq_section, "EPS_DIIS", r_val=eeq_sparam%eps_diis)
     117         298 :       CALL section_vals_val_get(eeq_section, "ALPHA", r_val=eeq_sparam%alpha)
     118         298 :       CALL section_vals_val_get(eeq_section, "MAX_DIIS", i_val=eeq_sparam%max_diis)
     119         298 :       CALL section_vals_val_get(eeq_section, "MDIIS", i_val=eeq_sparam%mdiis)
     120         298 :       CALL section_vals_val_get(eeq_section, "SDIIS", i_val=eeq_sparam%sdiis)
     121             : 
     122         298 :    END SUBROUTINE read_eeq_param
     123             : 
     124           0 : END MODULE eeq_input

Generated by: LCOV version 1.15