LCOV - code coverage report
Current view: top level - src - input_cp2k_loc.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:06f838d) Lines: 100.0 % 210 210
Test Date: 2026-06-05 07:04:50 Functions: 100.0 % 4 4

            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              : MODULE input_cp2k_loc
       8              :    USE bibliography,                    ONLY: Hunt2003
       9              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      10              :                                               cp_print_key_section_create,&
      11              :                                               debug_print_level,&
      12              :                                               high_print_level,&
      13              :                                               low_print_level
      14              :    USE input_constants,                 ONLY: &
      15              :         do_loc_both, do_loc_cpo_atomic, do_loc_cpo_random, do_loc_cpo_restart, &
      16              :         do_loc_cpo_space_nmo, do_loc_cpo_space_wan, do_loc_crazy, do_loc_cs, do_loc_direct, &
      17              :         do_loc_gapo, do_loc_homo, do_loc_jacobi, do_loc_l1_norm_sd, do_loc_lumo, do_loc_max, &
      18              :         do_loc_min, do_loc_mixed, do_loc_none, do_loc_scdm, op_loc_berry, op_loc_boys, op_loc_pipek
      19              :    USE input_cp2k_mm,                   ONLY: create_dipoles_section
      20              :    USE input_cp2k_motion_print,         ONLY: add_format_keyword
      21              :    USE input_keyword_types,             ONLY: keyword_create,&
      22              :                                               keyword_release,&
      23              :                                               keyword_type
      24              :    USE input_section_types,             ONLY: section_add_keyword,&
      25              :                                               section_add_subsection,&
      26              :                                               section_create,&
      27              :                                               section_release,&
      28              :                                               section_type
      29              :    USE input_val_types,                 ONLY: integer_t,&
      30              :                                               lchar_t,&
      31              :                                               real_t
      32              :    USE kinds,                           ONLY: dp
      33              :    USE string_utilities,                ONLY: s2a
      34              : #include "./base/base_uses.f90"
      35              : 
      36              :    IMPLICIT NONE
      37              :    PRIVATE
      38              : 
      39              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_loc'
      40              : 
      41              :    PUBLIC :: create_localize_section, print_wanniers
      42              : 
      43              : CONTAINS
      44              : 
      45              : ! **************************************************************************************************
      46              : !> \brief parameters fo the localization of wavefunctions
      47              : !> \param section ...
      48              : !> \par History
      49              : !>      03.2005 created [MI]
      50              : ! **************************************************************************************************
      51              : 
      52        41162 :    SUBROUTINE create_localize_section(section)
      53              : 
      54              :       TYPE(section_type), POINTER                        :: section
      55              : 
      56              :       TYPE(keyword_type), POINTER                        :: keyword
      57              :       TYPE(section_type), POINTER                        :: print_key, print_section, subsection
      58              : 
      59        41162 :       CPASSERT(.NOT. ASSOCIATED(section))
      60              : 
      61        41162 :       NULLIFY (keyword, print_key)
      62              :       CALL section_create(section, __LOCATION__, name="LOCALIZE", &
      63              :                           description="Use one of the available methods to define the localization"// &
      64              :                           " and possibly to optimize it to a minimum or a maximum.", &
      65        41162 :                           n_keywords=8, n_subsections=0, repeats=.FALSE.)
      66              : 
      67              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
      68              :                           description="controls the activation of the MOS localization procedure", &
      69        41162 :                           usage="&LOCALIZE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      70        41162 :       CALL section_add_keyword(section, keyword)
      71        41162 :       CALL keyword_release(keyword)
      72              : 
      73              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
      74              :                           description="Maximum number of iterations used for localization methods", &
      75        41162 :                           usage="MAX_ITER 2000", default_i_val=10000)
      76        41162 :       CALL section_add_keyword(section, keyword)
      77        41162 :       CALL keyword_release(keyword)
      78              : 
      79              :       CALL keyword_create( &
      80              :          keyword, __LOCATION__, name="MAX_CRAZY_ANGLE", &
      81              :          description="Largest allowed angle for the crazy rotations algorithm (smaller is slower but more stable).", &
      82        41162 :          usage="MAX_CRAZY_ANGLE 0.1", unit_str="rad", default_r_val=0.2_dp)
      83        41162 :       CALL section_add_keyword(section, keyword)
      84        41162 :       CALL keyword_release(keyword)
      85              : 
      86              :       CALL keyword_create(keyword, __LOCATION__, name="CRAZY_SCALE", &
      87              :                           description="scale angles", &
      88        41162 :                           usage="CRAZY_SCALE 0.9", default_r_val=1.0_dp)
      89        41162 :       CALL section_add_keyword(section, keyword)
      90        41162 :       CALL keyword_release(keyword)
      91              : 
      92              :       CALL keyword_create(keyword, __LOCATION__, name="CRAZY_USE_DIAG", &
      93              :                           description="Use diagonalization (slow) or pade based calculation of matrix exponentials.", &
      94        41162 :                           usage="CRAZY_USE_DIAG ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      95        41162 :       CALL section_add_keyword(section, keyword)
      96        41162 :       CALL keyword_release(keyword)
      97              : 
      98              :       CALL keyword_create( &
      99              :          keyword, __LOCATION__, name="USE_HISTORY", &
     100              :          description="Generate an improved initial guess based on a history of results, which is useful during MD. "// &
     101              :          "Will only work if the number of states to be localized remains constant.", &
     102        41162 :          usage="USE_HISTORY ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     103        41162 :       CALL section_add_keyword(section, keyword)
     104        41162 :       CALL keyword_release(keyword)
     105              : 
     106              :       CALL keyword_create(keyword, __LOCATION__, name="EACH", &
     107              :                           description="localize each n steps", &
     108        41162 :                           default_i_val=1)
     109        41162 :       CALL section_add_keyword(section, keyword)
     110        41162 :       CALL keyword_release(keyword)
     111              : 
     112              :       CALL keyword_create( &
     113              :          keyword, __LOCATION__, name="EPS_OCCUPATION", &
     114              :          description="Tolerance in the occupation number to select only fully occupied orbitals for the rotation", &
     115        41162 :          usage="EPS_OCCUPATION 1.E-5", default_r_val=1.0E-8_dp)
     116        41162 :       CALL section_add_keyword(section, keyword)
     117        41162 :       CALL keyword_release(keyword)
     118              : 
     119              :       CALL keyword_create(keyword, __LOCATION__, name="OUT_ITER_EACH", &
     120              :                           description="Every how many iterations of the localization algorithm "// &
     121              :                           "(Jacobi) the tolerance value is printed out", &
     122        41162 :                           usage="OUT_ITER_EACH 100", default_i_val=100)
     123        41162 :       CALL section_add_keyword(section, keyword)
     124        41162 :       CALL keyword_release(keyword)
     125              : 
     126              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_LOCALIZATION", &
     127              :                           description="Tolerance used in the convergence criterion of the localization methods.", &
     128        41162 :                           usage="EPS_LOCALIZATION 1.0E-2", default_r_val=1.0E-4_dp)
     129        41162 :       CALL section_add_keyword(section, keyword)
     130        41162 :       CALL keyword_release(keyword)
     131              : 
     132              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_OR_MAX", &
     133              :                           description="Requires the maximization of the spread of the wfn", &
     134              :                           usage="MIN_OR_MAX (SPREADMIN|SPREADMAX)", &
     135              :                           enum_c_vals=["SPREADMIN", "SPREADMAX"], &
     136              :                           enum_i_vals=[do_loc_min, do_loc_max], &
     137       123486 :                           default_i_val=do_loc_min)
     138        41162 :       CALL section_add_keyword(section, keyword)
     139        41162 :       CALL keyword_release(keyword)
     140              : 
     141              :       CALL keyword_create( &
     142              :          keyword, __LOCATION__, name="METHOD", &
     143              :          description="Method of optimization if any", &
     144              :          usage="METHOD (JACOBI|CRAZY|DIRECT|GAPO|L1SD|SCDM|CS|NONE)", &
     145              :          enum_c_vals=s2a("NONE", "JACOBI", "CRAZY", "GAPO", "L1SD", "DIRECT", "SCDM", "CS"), &
     146              :          enum_i_vals=[do_loc_none, &
     147              :                       do_loc_jacobi, &
     148              :                       do_loc_crazy, &
     149              :                       do_loc_gapo, &
     150              :                       do_loc_l1_norm_sd, &
     151              :                       do_loc_direct, &
     152              :                       do_loc_scdm, &
     153              :                       do_loc_cs], &
     154              :          enum_desc=s2a("No localization is applied", &
     155              :                        "Using 2 x 2 rotations of the orbitals, slow but robust", &
     156              :                        "A new fast method is applied, might be slightly less robust than jacobi, but usually much faster", &
     157              :                        "Gradient ascent for partially occupied wannier functions", &
     158              :                        "Steepest descent minimization of an approximate l1 norm", &
     159              :                        "Using a direct minimisation approacha", &
     160              :                        "Use QR factorization", &
     161              :                        "Using the Cardoso-Souloumiac algorithm for complex matrices"), &
     162        41162 :          default_i_val=do_loc_jacobi)
     163        41162 :       CALL section_add_keyword(section, keyword)
     164        41162 :       CALL keyword_release(keyword)
     165              : 
     166              :       CALL keyword_create(keyword, __LOCATION__, name="CPO_GUESS", &
     167              :                           description="Initial guess for coefficients if METHOD GAPO is used", &
     168              :                           usage="CPO_GUESS (ATOMIC|RESTART|RANDOM)", &
     169              :                           enum_c_vals=s2a("ATOMIC", "RESTART", "RANDOM"), &
     170              :                           enum_i_vals=[do_loc_cpo_atomic, do_loc_cpo_restart, do_loc_cpo_random], &
     171        41162 :                           default_i_val=do_loc_cpo_atomic)
     172        41162 :       CALL section_add_keyword(section, keyword)
     173        41162 :       CALL keyword_release(keyword)
     174              : 
     175              :       CALL keyword_create(keyword, __LOCATION__, name="CPO_GUESS_SPACE", &
     176              :                           description="Orbital space from which initial guess for coefficients is determined "// &
     177              :                           "if METHOD GAPO and CPO_GUESS ATOMIC are employed", &
     178              :                           usage="CPO_GUESS_SPACE (WAN|ALL)", &
     179              :                           enum_c_vals=s2a("WAN", "ALL"), &
     180              :                           enum_i_vals=[do_loc_cpo_space_wan, do_loc_cpo_space_nmo], &
     181        41162 :                           default_i_val=do_loc_cpo_space_wan)
     182        41162 :       CALL section_add_keyword(section, keyword)
     183        41162 :       CALL keyword_release(keyword)
     184              : 
     185              :       CALL keyword_create(keyword, __LOCATION__, name="CG_PO", &
     186              :                           description="Use conjugate gradient in conjunction with METHOD GAPO. If FALSE, "// &
     187              :                           "steepest descent is used instead.", &
     188              :                           usage="CG_PO", default_l_val=.TRUE., &
     189        41162 :                           lone_keyword_l_val=.TRUE.)
     190        41162 :       CALL section_add_keyword(section, keyword)
     191        41162 :       CALL keyword_release(keyword)
     192              : 
     193              :       CALL keyword_create(keyword, __LOCATION__, name="JACOBI_FALLBACK", &
     194              :                           description="Use Jacobi method in case no convergence was achieved"// &
     195              :                           " by using the crazy rotations method.", &
     196              :                           usage="JACOBI_FALLBACK", default_l_val=.TRUE., &
     197        41162 :                           lone_keyword_l_val=.TRUE.)
     198        41162 :       CALL section_add_keyword(section, keyword)
     199        41162 :       CALL keyword_release(keyword)
     200              : 
     201              :       CALL keyword_create(keyword, __LOCATION__, name="JACOBI_REFINEMENT", &
     202              :                           description="Use Jacobi method to refine the localisation obtained by SCDM", &
     203              :                           usage="JACOBI_REFINEMENT", default_l_val=.FALSE., &
     204        41162 :                           lone_keyword_l_val=.TRUE.)
     205        41162 :       CALL section_add_keyword(section, keyword)
     206        41162 :       CALL keyword_release(keyword)
     207              : 
     208              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
     209              :                           description="Restart the localization from a set of orbitals"// &
     210              :                           " read from a localization restart file.", &
     211              :                           usage="RESTART", default_l_val=.FALSE., &
     212        41162 :                           lone_keyword_l_val=.TRUE.)
     213        41162 :       CALL section_add_keyword(section, keyword)
     214        41162 :       CALL keyword_release(keyword)
     215              : 
     216              :       CALL keyword_create(keyword, __LOCATION__, name="LOCHOMO_RESTART_FILE_NAME", &
     217              :                           description="File name where to read the MOS from "// &
     218              :                           "which to restart the localization procedure for occupied states", &
     219              :                           usage="LOCHOMO_RESTART_FILE_NAME <FILENAME>", &
     220        41162 :                           type_of_var=lchar_t)
     221        41162 :       CALL section_add_keyword(section, keyword)
     222        41162 :       CALL keyword_release(keyword)
     223              : 
     224              :       CALL keyword_create(keyword, __LOCATION__, name="LOCMIXD_RESTART_FILE_NAME", &
     225              :                           description="File name where to read the MOS from "// &
     226              :                           "which to restart the localization procedure for MIXED states", &
     227              :                           usage="LOCMIXD_RESTART_FILE_NAME <FILENAME>", &
     228        41162 :                           type_of_var=lchar_t)
     229        41162 :       CALL section_add_keyword(section, keyword)
     230        41162 :       CALL keyword_release(keyword)
     231              : 
     232              :       CALL keyword_create(keyword, __LOCATION__, name="LOCLUMO_RESTART_FILE_NAME", &
     233              :                           description="File name where to read the MOS from "// &
     234              :                           "which to restart the localization procedure for unoccupied states", &
     235              :                           usage="LOCLUMO_RESTART_FILE_NAME <FILENAME>", &
     236        41162 :                           type_of_var=lchar_t)
     237        41162 :       CALL section_add_keyword(section, keyword)
     238        41162 :       CALL keyword_release(keyword)
     239              : 
     240              :       CALL keyword_create(keyword, __LOCATION__, name="OPERATOR", &
     241              :                           description="Type of opertator which defines the spread functional", &
     242              :                           usage="OPERATOR (BERRY|BOYS|PIPEK)", &
     243              :                           enum_c_vals=s2a("BERRY", "BOYS", "PIPEK"), &
     244              :                           enum_i_vals=[op_loc_berry, op_loc_boys, op_loc_pipek], &
     245        41162 :                           default_i_val=op_loc_berry)
     246        41162 :       CALL section_add_keyword(section, keyword)
     247        41162 :       CALL keyword_release(keyword)
     248              : 
     249              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
     250              :                           description="Indexes of the occupied wfn to be localized "// &
     251              :                           "This keyword can be repeated several times "// &
     252              :                           "(useful if you have to specify many indexes).", &
     253              :                           usage="LIST 1 2", &
     254        41162 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     255        41162 :       CALL section_add_keyword(section, keyword)
     256        41162 :       CALL keyword_release(keyword)
     257              : 
     258              :       CALL keyword_create(keyword, __LOCATION__, name="LIST_UNOCCUPIED", &
     259              :                           description="Indexes of the unoccupied states to be localized, "// &
     260              :                           "up to now only valid in combination with GPW. "// &
     261              :                           "This keyword has to be present if unoccupied states should be localized. "// &
     262              :                           "This keyword can be repeated several times "// &
     263              :                           "(useful if you have to specify many indexes).", &
     264              :                           usage="LIST_UNOCCUPIED 1 2", &
     265        41162 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     266        41162 :       CALL section_add_keyword(section, keyword)
     267        41162 :       CALL keyword_release(keyword)
     268              : 
     269              :       CALL keyword_create(keyword, __LOCATION__, name="NEXTRA", &
     270              :                           description="Number of orbitals above fully occupied MOs to be localized, "// &
     271              :                           "up to now only valid in combination with GPW. "// &
     272              :                           "This keyword has to be present for STATES MIXED option. "// &
     273              :                           "Otherwise, only the fully occupied MOs are localized.", &
     274        41162 :                           usage="NEXTRA 5", default_i_val=0)
     275        41162 :       CALL section_add_keyword(section, keyword)
     276        41162 :       CALL keyword_release(keyword)
     277              : 
     278              :       CALL keyword_create(keyword, __LOCATION__, name="STATES", &
     279              :                           description="Which states to localize, LUMO up to now only available in GPW", &
     280              :                           usage="STATES (HOMO|LUMO|MIXED|ALL)", &
     281              :                           enum_c_vals=s2a("OCCUPIED", "UNOCCUPIED", "MIXED", "ALL"), &
     282              :                           enum_i_vals=[do_loc_homo, do_loc_lumo, do_loc_mixed, do_loc_both], &
     283        41162 :                           default_i_val=do_loc_homo)
     284        41162 :       CALL section_add_keyword(section, keyword)
     285        41162 :       CALL keyword_release(keyword)
     286              : 
     287              :       CALL keyword_create( &
     288              :          keyword, __LOCATION__, &
     289              :          name="ENERGY_RANGE", &
     290              :          description="Select the orbitals to be localized within the given energy range."// &
     291              :          " This type of selection cannot be added on top of the selection through a LIST. It reads to reals that are"// &
     292              :          " lower and higher boundaries of the energy range.", &
     293              :          usage="ENERGY_RANGE lower_bound {real}, higher_bound {real}", &
     294              :          repeats=.FALSE., &
     295              :          n_var=2, default_r_vals=[0._dp, 0._dp], unit_str='eV', &
     296        41162 :          type_of_var=real_t)
     297        41162 :       CALL section_add_keyword(section, keyword)
     298        41162 :       CALL keyword_release(keyword)
     299              : 
     300        41162 :       NULLIFY (print_section)
     301              :       CALL section_create(print_section, __LOCATION__, name="PRINT", &
     302              :                           description="Collects all printing options related to the Wannier centers and "// &
     303              :                           "properties computed with Wannier centers.", &
     304        41162 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     305        41162 :       NULLIFY (print_key)
     306              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     307              :                                        description="Controls the printing basic info about the method", &
     308        41162 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     309        41162 :       CALL section_add_subsection(print_section, print_key)
     310        41162 :       CALL section_release(print_key)
     311              :       ! Add printing of wannier infos
     312        41162 :       CALL print_wanniers(print_section)
     313        41162 :       NULLIFY (subsection)
     314              :       ! Total Dipoles with wannier
     315        41162 :       CALL create_dipoles_section(subsection, "TOTAL_DIPOLE", debug_print_level + 1)
     316        41162 :       CALL section_add_subsection(print_section, subsection)
     317        41162 :       CALL section_release(subsection)
     318              :       ! Molecular Dipoles with wannier
     319        41162 :       CALL create_dipoles_section(subsection, "MOLECULAR_DIPOLES", debug_print_level + 1)
     320        41162 :       CALL section_add_subsection(print_section, subsection)
     321        41162 :       CALL section_release(subsection)
     322              :       ! Molecular Mulipole Moments with wannier
     323              :       CALL cp_print_key_section_create(subsection, __LOCATION__, name="MOLECULAR_MOMENTS", &
     324              :                                        description="Section controlling the calculation of molecular multipole moments.", &
     325        41162 :                                        print_level=debug_print_level + 1, filename="__STD_OUT__")
     326              :       CALL keyword_create(keyword, __LOCATION__, name="ORDER", &
     327              :                           description="Maximum order of mulitpoles to be calculated.", &
     328        41162 :                           usage="ORDER {integer}", default_i_val=2, type_of_var=integer_t)
     329        41162 :       CALL section_add_keyword(subsection, keyword)
     330        41162 :       CALL keyword_release(keyword)
     331              :       !
     332        41162 :       CALL section_add_subsection(print_section, subsection)
     333        41162 :       CALL section_release(subsection)
     334              :       !
     335              :       CALL cp_print_key_section_create(subsection, __LOCATION__, name="LOCALIZED_MOMENTS", &
     336              :                                        description="Section controlling the calculation of "// &
     337              :                                        "localized moments", &
     338        41162 :                                        print_level=debug_print_level + 1, filename="__STD_OUT__")
     339              :       !
     340              :       CALL keyword_create(keyword, __LOCATION__, &
     341              :                           name="MAX_MOMENT", &
     342              :                           description="Maximum moment to be calculated.", &
     343              :                           usage="MAX_MOMENT {integer}", &
     344              :                           repeats=.FALSE., &
     345              :                           n_var=1, &
     346              :                           type_of_var=integer_t, &
     347        41162 :                           default_i_val=1)
     348        41162 :       CALL section_add_keyword(subsection, keyword)
     349        41162 :       CALL keyword_release(keyword)
     350              :       !
     351              :       CALL keyword_create(keyword, __LOCATION__, &
     352              :                           name="MAGNETIC", &
     353              :                           description="Calculate also magnetic moments.", &
     354              :                           usage="MAGNETIC .TRUE.", &
     355              :                           repeats=.FALSE., &
     356              :                           n_var=1, &
     357              :                           default_l_val=.FALSE., &
     358        41162 :                           lone_keyword_l_val=.TRUE.)
     359        41162 :       CALL section_add_keyword(subsection, keyword)
     360        41162 :       CALL keyword_release(keyword)
     361              :       !
     362              :       CALL keyword_create(keyword, __LOCATION__, &
     363              :                           name="VEL_REPRS", &
     364              :                           description="Calculate expectation values of the el. multipole "// &
     365              :                           "moments in their velocity representation during RTP. Implemented up "// &
     366              :                           "to el. quadrupole moment.", &
     367              :                           usage="VEL_REPRS .TRUE.", &
     368              :                           repeats=.FALSE., &
     369              :                           n_var=1, &
     370              :                           default_l_val=.FALSE., &
     371        41162 :                           lone_keyword_l_val=.TRUE.)
     372        41162 :       CALL section_add_keyword(subsection, keyword)
     373        41162 :       CALL keyword_release(keyword)
     374              :       !
     375              :       CALL keyword_create(keyword, __LOCATION__, &
     376              :                           name="COM_NL", &
     377              :                           description="Include non local commutator for velocity "// &
     378              :                           "representations. Necessary for origin independent results.", &
     379              :                           usage="COM_NL .TRUE.", &
     380              :                           repeats=.FALSE., &
     381              :                           n_var=1, &
     382              :                           default_l_val=.FALSE., &
     383        41162 :                           lone_keyword_l_val=.TRUE.)
     384        41162 :       CALL section_add_keyword(subsection, keyword)
     385        41162 :       CALL keyword_release(keyword)
     386              :       !
     387        41162 :       CALL section_add_subsection(print_section, subsection)
     388        41162 :       CALL section_release(subsection)
     389              :       ! Molecular States with wannier
     390        41162 :       CALL create_molecular_states_section(subsection)
     391        41162 :       CALL section_add_subsection(print_section, subsection)
     392        41162 :       CALL section_release(subsection)
     393              :       ! Wannier States with wannier
     394        41162 :       CALL create_wannier_states_section(subsection)
     395        41162 :       CALL section_add_subsection(print_section, subsection)
     396        41162 :       CALL section_release(subsection)
     397              :       !
     398        41162 :       CALL section_add_subsection(section, print_section)
     399        41162 :       CALL section_release(print_section)
     400              : 
     401        41162 :    END SUBROUTINE create_localize_section
     402              : 
     403              : ! **************************************************************************************************
     404              : !> \brief Controls the printing of the basic info coming from the LOCALIZE
     405              : !>        section
     406              : !> \param section ...
     407              : !> \author teo
     408              : ! **************************************************************************************************
     409        51440 :    SUBROUTINE print_wanniers(section)
     410              :       TYPE(section_type), POINTER                        :: section
     411              : 
     412              :       TYPE(keyword_type), POINTER                        :: keyword
     413              :       TYPE(section_type), POINTER                        :: print_key
     414              : 
     415        51440 :       CPASSERT(ASSOCIATED(section))
     416        51440 :       NULLIFY (print_key, keyword)
     417              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_CUBES", &
     418              :                                        description="Controls the printing of the wannier functions ", &
     419        51440 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
     420              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     421              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     422              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     423              :                           " 1 number valid for all components.", &
     424        51440 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     425        51440 :       CALL section_add_keyword(print_key, keyword)
     426        51440 :       CALL keyword_release(keyword)
     427              : 
     428              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY", &
     429              :                           description="Controls the printing of the Wannier function "// &
     430              :                           "electronic densities", &
     431        51440 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     432        51440 :       CALL section_add_keyword(print_key, keyword)
     433        51440 :       CALL keyword_release(keyword)
     434              : 
     435              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
     436              :                           variants=["CUBES_LU"], &
     437              :                           description="The lower and upper index of the states to be printed as cube", &
     438              :                           usage="CUBES_LU_BOUNDS integer integer", &
     439       102880 :                           n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
     440        51440 :       CALL section_add_keyword(print_key, keyword)
     441        51440 :       CALL keyword_release(keyword)
     442              : 
     443              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
     444              :                           description="Indexes of the states to be printed as cube files"// &
     445              :                           " This keyword can be repeated several times"// &
     446              :                           " (useful if you have to specify many indexes).", &
     447              :                           usage="CUBES_LIST 1 2", &
     448        51440 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     449        51440 :       CALL section_add_keyword(print_key, keyword)
     450        51440 :       CALL keyword_release(keyword)
     451              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
     452              :                           description="append the cube files when they already exist", &
     453        51440 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     454        51440 :       CALL section_add_keyword(print_key, keyword)
     455        51440 :       CALL keyword_release(keyword)
     456              : 
     457        51440 :       CALL section_add_subsection(section, print_key)
     458        51440 :       CALL section_release(print_key)
     459              : 
     460        51440 :       NULLIFY (print_key)
     461              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_CENTERS", &
     462              :                                        description="Controls the printing of the wannier functions", &
     463              :                                        print_level=high_print_level, add_last=add_last_numeric, filename="", &
     464        51440 :                                        unit_str="angstrom")
     465              : 
     466              :       CALL keyword_create(keyword, __LOCATION__, name="IONS+CENTERS", &
     467              :                           description="prints out the wannier centers together with the particles", &
     468              :                           usage="IONS+CENTERS", default_l_val=.FALSE., &
     469        51440 :                           lone_keyword_l_val=.TRUE.)
     470        51440 :       CALL section_add_keyword(print_key, keyword)
     471        51440 :       CALL keyword_release(keyword)
     472              : 
     473              :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
     474        51440 :                               description="Specifies the format of the output file when IONS+CENTERS is enabled.")
     475        51440 :       CALL section_add_subsection(section, print_key)
     476        51440 :       CALL section_release(print_key)
     477              : 
     478        51440 :       NULLIFY (print_key)
     479              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_SPREADS", &
     480              :                                        description="Controls the printing of the wannier functions", &
     481        51440 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
     482              : 
     483              :       CALL keyword_create(keyword, __LOCATION__, name="SECOND_MOMENTS", &
     484              :                           description="Prints out the upper triangular part of the position covariance matrix. "// &
     485              :                           "Default is to use a non-periodic position operator. ", &
     486              :                           usage="SECOND_MOMENTS", default_l_val=.FALSE., &
     487        51440 :                           lone_keyword_l_val=.TRUE.)
     488        51440 :       CALL section_add_keyword(print_key, keyword)
     489        51440 :       CALL keyword_release(keyword)
     490              : 
     491              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
     492              :                           description="For the covariance matrix, use the periodic position operator."// &
     493              :                           " Requires setting LMAXN1 in QS section to 6 or higher.", &
     494              :                           usage="PERIODIC", default_l_val=.FALSE., &
     495        51440 :                           lone_keyword_l_val=.TRUE.)
     496        51440 :       CALL section_add_keyword(print_key, keyword)
     497        51440 :       CALL keyword_release(keyword)
     498              : 
     499        51440 :       CALL section_add_subsection(section, print_key)
     500        51440 :       CALL section_release(print_key)
     501              : 
     502        51440 :       NULLIFY (print_key)
     503              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LOC_RESTART", &
     504              :                                        description="Controls the printing of restart file for localized MOS", &
     505        51440 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
     506        51440 :       CALL section_add_subsection(section, print_key)
     507        51440 :       CALL section_release(print_key)
     508              : 
     509        51440 :    END SUBROUTINE print_wanniers
     510              : 
     511              : ! **************************************************************************************************
     512              : !> \brief creates the input section for the molecular states
     513              : !> \param print_key ...
     514              : !> \author teo
     515              : ! **************************************************************************************************
     516        41162 :    SUBROUTINE create_molecular_states_section(print_key)
     517              :       TYPE(section_type), POINTER                        :: print_key
     518              : 
     519              :       TYPE(keyword_type), POINTER                        :: keyword
     520              :       TYPE(section_type), POINTER                        :: print_key2
     521              : 
     522        41162 :       CPASSERT(.NOT. ASSOCIATED(print_key))
     523        41162 :       NULLIFY (print_key2, keyword)
     524              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOLECULAR_STATES", &
     525              :                                        description="Controls printing of molecular states ", &
     526        82324 :                                        print_level=high_print_level, filename=" ", citations=[Hunt2003])
     527              : 
     528              :       CALL keyword_create( &
     529              :          keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
     530              :          description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
     531              :          "Default is all states.", &
     532        41162 :          usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
     533        41162 :       CALL section_add_keyword(print_key, keyword)
     534        41162 :       CALL keyword_release(keyword)
     535              : 
     536              :       CALL keyword_create(keyword, __LOCATION__, name="MARK_STATES", &
     537              :                           description="Can be used to mark given molecular states."// &
     538              :                           " Sets a mark to both, occupied and unoccupied states. "// &
     539              :                           "Occupied states are counted beginning with HOMO=1, "// &
     540              :                           "unoccupied states are counted beginning with LUMO=1, "// &
     541              :                           "This is only meaningful in combination with WFN_MIX. "// &
     542              :                           "First integer specifies the molecule, second integer specifies the state.", &
     543              :                           usage="MARK_STATES integer integer", &
     544        41162 :                           n_var=2, default_i_vals=[-1, -1], type_of_var=integer_t, repeats=.TRUE.)
     545        41162 :       CALL section_add_keyword(print_key, keyword)
     546        41162 :       CALL keyword_release(keyword)
     547              : 
     548              :       CALL cp_print_key_section_create(print_key2, __LOCATION__, "cubes", &
     549              :                                        description="Controls the printing of cube files", &
     550        41162 :                                        print_level=high_print_level, filename="")
     551              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     552              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     553              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     554              :                           " 1 number valid for all components.", &
     555        41162 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     556        41162 :       CALL section_add_keyword(print_key2, keyword)
     557        41162 :       CALL keyword_release(keyword)
     558        41162 :       CALL section_add_subsection(print_key, print_key2)
     559        41162 :       CALL section_release(print_key2)
     560        41162 :    END SUBROUTINE create_molecular_states_section
     561              : 
     562              : ! **************************************************************************************************
     563              : !> \brief ...
     564              : !> \param print_key ...
     565              : ! **************************************************************************************************
     566        41162 :    SUBROUTINE create_wannier_states_section(print_key)
     567              :       TYPE(section_type), POINTER                        :: print_key
     568              : 
     569              :       TYPE(keyword_type), POINTER                        :: keyword
     570              :       TYPE(section_type), POINTER                        :: print_key2
     571              : 
     572        41162 :       CPASSERT(.NOT. ASSOCIATED(print_key))
     573        41162 :       NULLIFY (print_key2, keyword)
     574              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_STATES", &
     575              :                                        description="Controls printing of Wannier states ", &
     576        41162 :                                        print_level=high_print_level, filename=" ")
     577              : 
     578              :       CALL keyword_create( &
     579              :          keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
     580              :          description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
     581              :          "Default is all states.", &
     582        41162 :          usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
     583        41162 :       CALL section_add_keyword(print_key, keyword)
     584        41162 :       CALL keyword_release(keyword)
     585              : 
     586              :       CALL keyword_create(keyword, __LOCATION__, name="MARK_STATES", &
     587              :                           description="Can be used to mark given molecular states."// &
     588              :                           " Sets a mark to both, occupied and unoccupied states. "// &
     589              :                           "Occupied states are counted beginning with HOMO=1, "// &
     590              :                           "unoccupied states are counted beginning with LUMO=1, "// &
     591              :                           "This is only meaningful in combination with WFN_MIX. "// &
     592              :                           "First integer specifies the molecule, second integer specifies the state.", &
     593              :                           usage="MARK_STATES integer integer", &
     594        41162 :                           n_var=2, default_i_vals=[-1, -1], type_of_var=integer_t, repeats=.TRUE.)
     595        41162 :       CALL section_add_keyword(print_key, keyword)
     596        41162 :       CALL keyword_release(keyword)
     597              : 
     598              :       CALL keyword_create(keyword, __LOCATION__, name="CARTESIAN", &
     599              :                           description="Print the Wannier states in the Cartesian basis instead of the default spherical basis.", &
     600        41162 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     601        41162 :       CALL section_add_keyword(print_key, keyword)
     602        41162 :       CALL keyword_release(keyword)
     603              : 
     604              :       CALL cp_print_key_section_create(print_key2, __LOCATION__, "cubes", &
     605              :                                        description="Controls the printing of cube files", &
     606        41162 :                                        print_level=high_print_level, filename="")
     607              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     608              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     609              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     610              :                           " 1 number valid for all components.", &
     611        41162 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     612        41162 :       CALL section_add_keyword(print_key2, keyword)
     613        41162 :       CALL keyword_release(keyword)
     614        41162 :       CALL section_add_subsection(print_key, print_key2)
     615        41162 :       CALL section_release(print_key2)
     616        41162 :    END SUBROUTINE create_wannier_states_section
     617              : 
     618              : END MODULE input_cp2k_loc
        

Generated by: LCOV version 2.0-1