LCOV - code coverage report
Current view: top level - src - qs_mom_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 29 29 100.0 %
Date: 2024-12-21 06:28:57 Functions: 1 1 100.0 %

          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 manage control variables for the maximum overlap method
      10             : ! **************************************************************************************************
      11             : MODULE qs_mom_types
      12             :    USE bibliography,                    ONLY: Barca2018,&
      13             :                                               Gilbert2008
      14             :    USE input_constants,                 ONLY: momproj_norm,&
      15             :                                               momproj_sum,&
      16             :                                               momtype_imom,&
      17             :                                               momtype_mom
      18             :    USE input_keyword_types,             ONLY: keyword_create,&
      19             :                                               keyword_release,&
      20             :                                               keyword_type
      21             :    USE input_section_types,             ONLY: section_add_keyword,&
      22             :                                               section_create,&
      23             :                                               section_type
      24             :    USE input_val_types,                 ONLY: integer_t
      25             :    USE string_utilities,                ONLY: s2a
      26             : #include "./base/base_uses.f90"
      27             : 
      28             :    IMPLICIT NONE
      29             : 
      30             :    PRIVATE
      31             : 
      32             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_mom_types'
      33             : 
      34             :    PUBLIC :: create_mom_section
      35             : 
      36             : CONTAINS
      37             : 
      38             : ! **************************************************************************************************
      39             : !> \brief Create CP2K input section for variable occupancy using the Maximum
      40             : !>        Overlap Method. Only with diagonalization methods, i.e. not with OT
      41             : !> \param section section to create
      42             : !> \date       20.06.2013
      43             : !> \par History
      44             : !>      06.2013 created [MattW]
      45             : !>      01.2016 (DE)OCC_ALPHA and (DE)OCC_BETA keywords accept a list of
      46             : !>              molecular orbitals. Added two extra keywords: START_ITER
      47             : !>              and PROJ_FORMULA [Sergey Chulkov]
      48             : !> \author     MattW
      49             : !> \version    1.0
      50             : ! **************************************************************************************************
      51       21541 :    SUBROUTINE create_mom_section(section)
      52             :       TYPE(section_type), POINTER                        :: section
      53             : 
      54             :       TYPE(keyword_type), POINTER                        :: keyword
      55             : 
      56       21541 :       CPASSERT(.NOT. ASSOCIATED(section))
      57             : 
      58             :       CALL section_create(section, __LOCATION__, &
      59             :                           name="MOM", &
      60             :                           description="Define type and parameters for the maximum overlap method (MOM) "// &
      61             :                           "to determine orbital occupancies. "// &
      62             :                           "The MOM procedures activated by this section are only active for diagonalization "// &
      63             :                           "methods, i.e. not with minimization methods based on OT. "// &
      64             :                           "Incompatible with core-level excitation spectra (XAS).", &
      65             :                           n_keywords=8, n_subsections=0, repeats=.FALSE., &
      66       64623 :                           citations=(/Gilbert2008, Barca2018/))
      67             : 
      68       21541 :       NULLIFY (keyword)
      69             : 
      70             :       CALL keyword_create(keyword, __LOCATION__, &
      71             :                           name="_SECTION_PARAMETERS_", &
      72             :                           description="Controls the activation of the MOM procedure", &
      73             :                           usage="MOM ON", &
      74             :                           default_l_val=.FALSE., &
      75       21541 :                           lone_keyword_l_val=.TRUE.)
      76       21541 :       CALL section_add_keyword(section, keyword)
      77       21541 :       CALL keyword_release(keyword)
      78             : 
      79             :       CALL keyword_create(keyword, __LOCATION__, name="MOM_TYPE", &
      80             :                           description="Revision of the maximum overlap method to be used", &
      81             :                           usage="MOM_TYPE mom", default_i_val=momtype_mom, &
      82             :                           enum_c_vals=s2a("MOM", "IMOM"), &
      83             :                           enum_desc=s2a( &
      84             :                           "Originally proposed MOM protocol which uses molecular orbitals"// &
      85             :                           " from the previous SCF cycle as reference", &
      86             :                           "Initial-MOM which uses molecular orbitals of the initial guess as reference"), &
      87       21541 :                           enum_i_vals=(/momtype_mom, momtype_imom/))
      88       21541 :       CALL section_add_keyword(section, keyword)
      89       21541 :       CALL keyword_release(keyword)
      90             : 
      91             :       CALL keyword_create(keyword, __LOCATION__, &
      92             :                           name="START_ITER", &
      93             :                           description="SCF iteration cycle to start the MOM procedure. "// &
      94             :                           "Could be used for ground state calculations only "// &
      95             :                           "in order to stabilise oscillating SCF iterations", &
      96             :                           repeats=.FALSE., &
      97             :                           n_var=1, &
      98             :                           type_of_var=integer_t, &
      99             :                           default_i_val=0, &
     100       21541 :                           usage="START_ITER 2")
     101       21541 :       CALL section_add_keyword(section, keyword)
     102       21541 :       CALL keyword_release(keyword)
     103             : 
     104             :       CALL keyword_create(keyword, __LOCATION__, &
     105             :                           name="DEOCC_ALPHA", &
     106             :                           description="Alpha orbitals to be deoccupied", &
     107             :                           repeats=.FALSE., &
     108             :                           n_var=-1, &
     109             :                           type_of_var=integer_t, &
     110             :                           default_i_val=0, &
     111       21541 :                           usage="DEOCC_ALPHA 10 11 ...")
     112       21541 :       CALL section_add_keyword(section, keyword)
     113       21541 :       CALL keyword_release(keyword)
     114             : 
     115             :       CALL keyword_create(keyword, __LOCATION__, &
     116             :                           name="DEOCC_BETA", &
     117             :                           description="Beta orbitals to be deoccupied", &
     118             :                           repeats=.FALSE., &
     119             :                           n_var=-1, &
     120             :                           type_of_var=integer_t, &
     121             :                           default_i_val=0, &
     122       21541 :                           usage="DEOCC_BETA 10 11 ...")
     123       21541 :       CALL section_add_keyword(section, keyword)
     124       21541 :       CALL keyword_release(keyword)
     125             : 
     126             :       CALL keyword_create(keyword, __LOCATION__, &
     127             :                           name="OCC_ALPHA", &
     128             :                           description="Alpha orbitals to be occupied", &
     129             :                           repeats=.FALSE., &
     130             :                           n_var=-1, &
     131             :                           type_of_var=integer_t, &
     132             :                           default_i_val=0, &
     133       21541 :                           usage="OCC_ALPHA 12 15 ...")
     134       21541 :       CALL section_add_keyword(section, keyword)
     135       21541 :       CALL keyword_release(keyword)
     136             : 
     137             :       CALL keyword_create(keyword, __LOCATION__, &
     138             :                           name="OCC_BETA", &
     139             :                           description="Beta orbitals to be occupied", &
     140             :                           repeats=.FALSE., &
     141             :                           n_var=-1, &
     142             :                           type_of_var=integer_t, &
     143             :                           default_i_val=0, &
     144       21541 :                           usage="OCC_BETA 12 15 ...")
     145       21541 :       CALL section_add_keyword(section, keyword)
     146       21541 :       CALL keyword_release(keyword)
     147             : 
     148             :       CALL keyword_create(keyword, __LOCATION__, name="PROJ_FORMULA", &
     149             :                           description="Projection formula to be used", &
     150             :                           usage="PROJ_FORMULA norm", default_i_val=momproj_norm, &
     151             :                           enum_c_vals=s2a("NORM", "SUM"), &
     152             :                           enum_desc=s2a( &
     153             :                           "The one which ignores the phase of molecular orbitals: proj_j = \sqrt(\sum_i overlap(i, j)^2)", &
     154             :                           "The one proposed in the original paper: proj_j = |\sum_i overlap(i, j)|"), &
     155       21541 :                           enum_i_vals=(/momproj_norm, momproj_sum/))
     156       21541 :       CALL section_add_keyword(section, keyword)
     157       21541 :       CALL keyword_release(keyword)
     158             : 
     159       21541 :    END SUBROUTINE create_mom_section
     160             : 
     161             : END MODULE qs_mom_types

Generated by: LCOV version 1.15