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

            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              : ! **************************************************************************************************
       9              : !> \brief function that build the active space section of the input
      10              : !> \par History
      11              : !>      10.2005 moved out of input_cp2k [fawzi]
      12              : !>      07.2024 moved out of input_cp2k_dft [JGH]
      13              : !> \author fawzi
      14              : ! **************************************************************************************************
      15              : MODULE input_cp2k_as
      16              :    USE cp_output_handling, ONLY: cp_print_key_section_create, &
      17              :                                  debug_print_level, &
      18              :                                  high_print_level, &
      19              :                                  low_print_level, &
      20              :                                  medium_print_level, &
      21              :                                  silent_print_level
      22              :    USE input_constants, ONLY: &
      23              :       casci_canonical, eri_method_full_gpw, eri_method_gpw_ht, eri_operator_coulomb, &
      24              :       eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, eri_operator_lr_trunc, &
      25              :       eri_operator_trunc, eri_operator_yukawa, fci_solver, gaussian, gto_cartesian, &
      26              :       gto_spherical, manual_selection, mao_projection, no_solver, qiskit_solver, &
      27              :       wannier_projection
      28              :    USE input_cp2k_loc, ONLY: create_localize_section
      29              :    USE input_cp2k_xc, ONLY: create_xc_section
      30              :    USE input_keyword_types, ONLY: keyword_create, &
      31              :                                   keyword_release, &
      32              :                                   keyword_type
      33              :    USE input_section_types, ONLY: section_add_keyword, &
      34              :                                   section_add_subsection, &
      35              :                                   section_create, &
      36              :                                   section_release, &
      37              :                                   section_type
      38              :    USE input_val_types, ONLY: char_t, &
      39              :                               integer_t, &
      40              :                               lchar_t, &
      41              :                               logical_t, &
      42              :                               real_t
      43              :    USE kinds, ONLY: dp
      44              :    USE qs_density_mixing_types, ONLY: create_mixing_section
      45              :    USE string_utilities, ONLY: s2a
      46              : #include "./base/base_uses.f90"
      47              : 
      48              :    IMPLICIT NONE
      49              :    PRIVATE
      50              : 
      51              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_as'
      52              : 
      53              :    PUBLIC :: create_active_space_section
      54              : 
      55              : CONTAINS
      56              : 
      57              : ! **************************************************************************************************
      58              : !> \brief      Create CP2K input section for the calculation of an active space Hamiltonian
      59              : !> \param section ...
      60              : !> \par History:
      61              : !>      - Creation 06.04.2016
      62              : !> \author     JHU
      63              : ! **************************************************************************************************
      64         1481 :    SUBROUTINE create_active_space_section(section)
      65              : 
      66              :       TYPE(section_type), POINTER                        :: section
      67              : 
      68              :       TYPE(keyword_type), POINTER                        :: keyword
      69              :       TYPE(section_type), POINTER                        :: print_key, subsection
      70              : 
      71         1481 :       CPASSERT(.NOT. ASSOCIATED(section))
      72              : 
      73              :       CALL section_create(section, __LOCATION__, name="ACTIVE_SPACE", &
      74              :                           description="Define parameters and method to calculate an electronic active space", &
      75         1481 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
      76              : 
      77         1481 :       NULLIFY (keyword, subsection, print_key)
      78              : 
      79              :       CALL keyword_create(keyword, __LOCATION__, &
      80              :                           name="_SECTION_PARAMETERS_", &
      81              :                           description="Controls the activation of the ACTIVE_SPACE section", &
      82              :                           usage="&ACTIVE_SPACE ON", &
      83              :                           default_l_val=.FALSE., &
      84         1481 :                           lone_keyword_l_val=.TRUE.)
      85         1481 :       CALL section_add_keyword(section, keyword)
      86         1481 :       CALL keyword_release(keyword)
      87              : 
      88              :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ELECTRONS", &
      89              :                           description="The number of active electrons in the CAS space", &
      90         1481 :                           usage="ACTIVE_ELECTRONS 4", n_var=1, default_i_val=-1, type_of_var=integer_t)
      91         1481 :       CALL section_add_keyword(section, keyword)
      92         1481 :       CALL keyword_release(keyword)
      93              : 
      94              :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ORBITALS", &
      95              :                           description="The number of active orbitals defining the CAS space.", &
      96         1481 :                           usage="ACTIVE_ORBITALS 2", n_var=1, default_i_val=-1, type_of_var=integer_t)
      97         1481 :       CALL section_add_keyword(section, keyword)
      98         1481 :       CALL keyword_release(keyword)
      99              : 
     100              :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ORBITAL_INDICES", &
     101              :                           description="The indices of the active orbitals. Requires ORBITAL_SELECTION MANUAL! "// &
     102              :                           "Need to be as many indices as active orbitals times the number of spin "// &
     103              :                           "channels (2 if ROKS or UKS/LSD else 1). The indices refer to the canonical "// &
     104              :                           "SCF orbitals ordered by energy: if the SCF orbitals are not canonical (e.g. OT), "// &
     105              :                           "they are first rotated into canonical orbitals, so the indices do not refer to "// &
     106              :                           "the original OT orbitals. With OT%ON_THE_FLY_LOC the indices refer to the "// &
     107              :                           "localized orbitals.", &
     108              :                           usage="ACTIVE_ORBITAL_INDICES 2 3 {...}", n_var=-1, default_i_vals=[-1], &
     109         1481 :                           type_of_var=integer_t)
     110         1481 :       CALL section_add_keyword(section, keyword)
     111         1481 :       CALL keyword_release(keyword)
     112              : 
     113              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FCIDUMP", &
     114              :                                        description="Controls the writing of a file in FCIDUMP format.", &
     115         1481 :                                        print_level=high_print_level, filename="")
     116         1481 :       CALL section_add_subsection(section, print_key)
     117         1481 :       CALL section_release(print_key)
     118              : 
     119              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOLDEN", &
     120              :                                        description="Writes the orbitals of the active space Hamiltonian in "// &
     121              :                                        "Molden format: the inactive orbitals first, then the active orbitals "// &
     122              :                                        "in the orbital order of the FCIDUMP file. These are exactly the "// &
     123              :                                        "orbitals used for the integrals, also for ORBITAL_SELECTION MANUAL.", &
     124         1481 :                                        print_level=high_print_level, filename="ACTIVE_SPACE")
     125              :       CALL keyword_create(keyword, __LOCATION__, name="UNIT", &
     126              :                           description="Unit for coordinates and cell in the MOLDEN file.", &
     127              :                           usage="UNIT ANGSTROM", &
     128              :                           enum_c_vals=s2a("BOHR", "ANGSTROM"), &
     129              :                           enum_desc=s2a("Write in Bohr (AU)", "Write in Angstrom"), &
     130              :                           enum_i_vals=[1, 2], &
     131         1481 :                           default_i_val=1)
     132         1481 :       CALL section_add_keyword(print_key, keyword)
     133         1481 :       CALL keyword_release(keyword)
     134              :       CALL keyword_create(keyword, __LOCATION__, name="WRITE_CELL", &
     135              :                           description="Controls whether the [Cell] block is written to the MOLDEN file.", &
     136              :                           usage="WRITE_CELL T", &
     137         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     138         1481 :       CALL section_add_keyword(print_key, keyword)
     139         1481 :       CALL keyword_release(keyword)
     140              :       CALL keyword_create(keyword, __LOCATION__, name="WRITE_PSEUDO", &
     141              :                           description="Controls whether the [Pseudo] block is written to the MOLDEN file.", &
     142              :                           usage="WRITE_PSEUDO T", &
     143         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     144         1481 :       CALL section_add_keyword(print_key, keyword)
     145         1481 :       CALL keyword_release(keyword)
     146              :       CALL keyword_create(keyword, __LOCATION__, name="MARK_GHOST", &
     147              :                           description="Controls whether ghost atoms are marked in the [Atoms] block by "// &
     148              :                           "setting their atomic number to zero.", &
     149              :                           usage="MARK_GHOST T", &
     150         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     151         1481 :       CALL section_add_keyword(print_key, keyword)
     152         1481 :       CALL keyword_release(keyword)
     153              :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
     154              :                           description="Specifies the number of significant digits retained. "// &
     155              :                           "The default keeps full precision for use in other programs.", &
     156              :                           usage="NDIGITS {int}", &
     157         1481 :                           default_i_val=15)
     158         1481 :       CALL section_add_keyword(print_key, keyword)
     159         1481 :       CALL keyword_release(keyword)
     160              :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
     161              :                           description="Representation of Gaussian-type orbitals", &
     162              :                           default_i_val=gto_spherical, &
     163              :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
     164              :                           enum_desc=s2a( &
     165              :                           "Cartesian Gaussian orbitals. Use with caution", &
     166              :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
     167         1481 :                           enum_i_vals=[gto_cartesian, gto_spherical])
     168         1481 :       CALL section_add_keyword(print_key, keyword)
     169         1481 :       CALL keyword_release(keyword)
     170         1481 :       CALL section_add_subsection(section, print_key)
     171         1481 :       CALL section_release(print_key)
     172              : 
     173              :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_SELECTION", &
     174              :                           description="Method used to select active space orbitals. CANONICAL and MANUAL "// &
     175              :                           "use the canonical SCF orbitals unchanged; non-canonical SCF orbitals (e.g. "// &
     176              :                           "from OT) are first rotated once into canonical orbitals, separately within the "// &
     177              :                           "occupied and the unoccupied orbitals. Not done for ROKS and for OT%ON_THE_FLY_LOC, "// &
     178              :                           "where CANONICAL is not possible.", &
     179              :                           usage="ORBITAL_SELECTION CANONICAL", &
     180              :                           default_i_val=casci_canonical, &
     181              :                           enum_c_vals=s2a("CANONICAL", "WANNIER_PROJECTION", "MAO", "MANUAL"), &
     182              :                           enum_i_vals=[casci_canonical, wannier_projection, mao_projection, manual_selection], &
     183              :                           enum_desc=s2a("Select orbitals using energy ordering of canonical orbitals", &
     184              :                                         "Select orbitals from projected Wannier functions", &
     185              :                                         "Select orbitals from modified atomic orbitals", &
     186         1481 :                                         "Select canonical orbitals by their indices given in ACTIVE_ORBITAL_INDICES"))
     187              : 
     188         1481 :       CALL section_add_keyword(section, keyword)
     189         1481 :       CALL keyword_release(keyword)
     190              : 
     191              :       CALL keyword_create(keyword, __LOCATION__, name="SUBSPACE_ATOM", &
     192              :                           description="Number of atom that defines the subspace to be projected on.", &
     193              :                           usage="SUBSPACE_ATOM x", default_i_val=-1, &
     194         1481 :                           type_of_var=integer_t)
     195         1481 :       CALL section_add_keyword(section, keyword)
     196         1481 :       CALL keyword_release(keyword)
     197              : 
     198              :       CALL keyword_create(keyword, __LOCATION__, name="SUBSPACE_SHELL", &
     199              :                           description="Shell definition for subsapce.", &
     200              :                           usage="SUBSPACE_SHELL 3d4s", default_c_val="X", &
     201         1481 :                           type_of_var=char_t)
     202         1481 :       CALL section_add_keyword(section, keyword)
     203         1481 :       CALL keyword_release(keyword)
     204              : 
     205              :       CALL keyword_create(keyword, __LOCATION__, name="SCF_EMBEDDING", &
     206              :                           description="Whether to turn on the self-consistent embedding scheme", &
     207         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.FALSE.)
     208         1481 :       CALL section_add_keyword(section, keyword)
     209         1481 :       CALL keyword_release(keyword)
     210              : 
     211              :       CALL keyword_create(keyword, __LOCATION__, name="QCSCHEMA", &
     212              :                           description="Name of the QCSchema file, may include a path", &
     213              :                           usage="QCSCHEMA <FILENAME>", &
     214              :                           type_of_var=lchar_t, repeats=.FALSE., &
     215         1481 :                           default_lc_val="")
     216         1481 :       CALL section_add_keyword(section, keyword)
     217         1481 :       CALL keyword_release(keyword)
     218              : 
     219              :       CALL keyword_create(keyword, __LOCATION__, name="AS_SOLVER", &
     220              :                           description="The active space solver for the embedding approach", &
     221              :                           usage="AS_SOLVER FCI", &
     222              :                           default_i_val=no_solver, &
     223              :                           enum_c_vals=s2a("NONE", "QISKIT", "FCI"), &
     224              :                           enum_i_vals=[no_solver, qiskit_solver, fci_solver], &
     225              :                           enum_desc=s2a("NO solver, used to produce FCIDUMP/QCSchema files", &
     226              :                                         "QISKIT active space solver", &
     227         1481 :                                         "LibFCI full-CI active space solver"))
     228         1481 :       CALL section_add_keyword(section, keyword)
     229         1481 :       CALL keyword_release(keyword)
     230              : 
     231              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FCI", &
     232              :                           description="Squared residual norm (energy variance) threshold, in hartree squared, "// &
     233              :                           "for AS_SOLVER FCI. This controls the inner FCI solver, not the embedding iterations. "// &
     234              :                           "Loose values can give inaccurate one-particle density matrices.", &
     235         1481 :                           usage="EPS_FCI 1.0E-20", type_of_var=real_t, default_r_val=1.0E-20_dp)
     236         1481 :       CALL section_add_keyword(section, keyword)
     237         1481 :       CALL keyword_release(keyword)
     238              : 
     239              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
     240              :                           description="Energy convergence threshold of the DFT embedding scheme.", &
     241              :                           usage="EPS_ITER 1.0E-6 ", type_of_var=real_t, &
     242         1481 :                           default_r_val=1.0E-6_dp)
     243         1481 :       CALL section_add_keyword(section, keyword)
     244         1481 :       CALL keyword_release(keyword)
     245              : 
     246              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     247              :                           description="Fraction of new density to be mixed with previous one in SCF embedding. "// &
     248              :                           "Kept for backwards compatibility; prefer ACTIVE_SPACE%MIXING%ALPHA.", &
     249              :                           usage="ALPHA 0.25", type_of_var=real_t, &
     250         1481 :                           default_r_val=0.8_dp)
     251         1481 :       CALL section_add_keyword(section, keyword)
     252         1481 :       CALL keyword_release(keyword)
     253              : 
     254              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
     255              :                           description="Max number of iterations for the DFT embedding scheme.", &
     256              :                           usage="MAX_ITER 50", type_of_var=integer_t, &
     257         1481 :                           default_i_val=50)
     258         1481 :       CALL section_add_keyword(section, keyword)
     259         1481 :       CALL keyword_release(keyword)
     260              : 
     261         1481 :       CALL create_print_orb_section(subsection)
     262         1481 :       CALL section_add_subsection(section, subsection)
     263         1481 :       CALL section_release(subsection)
     264              : 
     265         1481 :       CALL create_eri_section(subsection)
     266         1481 :       CALL section_add_subsection(section, subsection)
     267         1481 :       CALL section_release(subsection)
     268              : 
     269         1481 :       CALL create_eri_gpw(subsection)
     270         1481 :       CALL section_add_subsection(section, subsection)
     271         1481 :       CALL section_release(subsection)
     272              : 
     273         1481 :       CALL create_localize_section(subsection)
     274         1481 :       CALL section_add_subsection(section, subsection)
     275         1481 :       CALL section_release(subsection)
     276              : 
     277         1481 :       CALL create_mixing_section(subsection, active_space=.TRUE.)
     278         1481 :       CALL section_add_subsection(section, subsection)
     279         1481 :       CALL section_release(subsection)
     280              : 
     281         1481 :       CALL create_socket_section(subsection)
     282         1481 :       CALL section_add_subsection(section, subsection)
     283         1481 :       CALL section_release(subsection)
     284              : 
     285         1481 :       CALL create_xc_section(subsection)
     286         1481 :       CALL section_add_subsection(section, subsection)
     287         1481 :       CALL section_release(subsection)
     288              : 
     289         1481 :    END SUBROUTINE create_active_space_section
     290              : 
     291              : ! **************************************************************************************************
     292              : !> \brief ...
     293              : !> \param section ...
     294              : ! **************************************************************************************************
     295         1481 :    SUBROUTINE create_socket_section(section)
     296              :       TYPE(section_type), POINTER                        :: section
     297              : 
     298              :       TYPE(keyword_type), POINTER                        :: keyword
     299              : 
     300         1481 :       CPASSERT(.NOT. ASSOCIATED(section))
     301              :       CALL section_create(section, __LOCATION__, name="SOCKET", &
     302              :                           description="Parameters to set up the socket communicating to the external active space solver.", &
     303         1481 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     304              : 
     305         1481 :       NULLIFY (keyword)
     306              :       CALL keyword_create(keyword, __LOCATION__, name="INET", &
     307              :                           description="Use an INET socket rather than a UNIX socket.", &
     308              :                           usage="INET <LOGICAL>", &
     309         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     310         1481 :       CALL section_add_keyword(section, keyword)
     311         1481 :       CALL keyword_release(keyword)
     312              : 
     313              :       CALL keyword_create(keyword, __LOCATION__, name="PORT", &
     314              :                           description="Port number for the socket client.", &
     315              :                           usage="port <INTEGER>", &
     316         1481 :                           default_i_val=12345)
     317         1481 :       CALL section_add_keyword(section, keyword)
     318         1481 :       CALL keyword_release(keyword)
     319              : 
     320              :       CALL keyword_create(keyword, __LOCATION__, name="HOST", &
     321              :                           description="Host name for the socket client.", &
     322              :                           usage="host <HOSTNAME>", &
     323         1481 :                           default_c_val="embedding_socket")
     324         1481 :       CALL section_add_keyword(section, keyword)
     325         1481 :       CALL keyword_release(keyword)
     326              : 
     327         1481 :    END SUBROUTINE create_socket_section
     328              : 
     329              : ! **************************************************************************************************
     330              : !> \brief ...
     331              : !> \param section ...
     332              : ! **************************************************************************************************
     333         1481 :    SUBROUTINE create_print_orb_section(section)
     334              :       TYPE(section_type), POINTER                        :: section
     335              : 
     336              :       TYPE(keyword_type), POINTER                        :: keyword
     337              : 
     338         1481 :       CPASSERT(.NOT. ASSOCIATED(section))
     339              :       CALL section_create(section, __LOCATION__, name="PRINT_ORBITAL_CUBES", &
     340              :                           description="Controls printing of active orbital cube files.", &
     341         1481 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     342              : 
     343         1481 :       NULLIFY (keyword)
     344              :       CALL keyword_create(keyword, __LOCATION__, name="FILENAME", &
     345              :                           description="Body of Filename for the cube files.", &
     346              :                           usage="FILENAME {name}", default_c_val="ActiveOrbital", &
     347         1481 :                           type_of_var=char_t)
     348         1481 :       CALL section_add_keyword(section, keyword)
     349         1481 :       CALL keyword_release(keyword)
     350              : 
     351              :       CALL keyword_create(keyword, __LOCATION__, name="ALIST", &
     352              :                           description="List of alpha orbitals to be printed. -1 defaults to all values", &
     353              :                           usage="ALIST {1 2 3 ...}", n_var=-1, default_i_vals=[-1], &
     354         1481 :                           lone_keyword_i_val=-1, type_of_var=integer_t)
     355         1481 :       CALL section_add_keyword(section, keyword)
     356         1481 :       CALL keyword_release(keyword)
     357              : 
     358              :       CALL keyword_create(keyword, __LOCATION__, name="BLIST", &
     359              :                           description="List of beta orbitals to be printed. -1 defaults to all values", &
     360              :                           usage="BLIST {1 2 3 ...}", n_var=-1, default_i_vals=[-1], &
     361         1481 :                           lone_keyword_i_val=-1, type_of_var=integer_t)
     362         1481 :       CALL section_add_keyword(section, keyword)
     363         1481 :       CALL keyword_release(keyword)
     364              : 
     365              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
     366              :                           description="The stride (X,Y,Z) used to write the cube file"// &
     367              :                           " (larger values result in smaller cube files)."// &
     368              :                           " You can provide 3 numbers (for X,Y,Z) or 1 number valid for all components", &
     369              :                           usage="STRIDE {2 2 2}", n_var=-1, default_i_vals=[2, 2, 2], &
     370         1481 :                           type_of_var=integer_t)
     371         1481 :       CALL section_add_keyword(section, keyword)
     372         1481 :       CALL keyword_release(keyword)
     373              : 
     374              :       CALL keyword_create(keyword, __LOCATION__, name="STOP_AFTER_CUBES", &
     375              :                           description="Whether to stop the computation after printing the cubes.", &
     376         1481 :                           default_l_val=.FALSE., lone_keyword_l_val=.FALSE.)
     377         1481 :       CALL section_add_keyword(section, keyword)
     378         1481 :       CALL keyword_release(keyword)
     379              : 
     380         1481 :    END SUBROUTINE create_print_orb_section
     381              : 
     382              : ! **************************************************************************************************
     383              : !> \brief ...
     384              : !> \param section ...
     385              : ! **************************************************************************************************
     386         1481 :    SUBROUTINE create_eri_section(section)
     387              :       TYPE(section_type), POINTER                        :: section
     388              : 
     389              :       TYPE(keyword_type), POINTER                        :: keyword
     390              : 
     391         1481 :       CPASSERT(.NOT. ASSOCIATED(section))
     392              :       CALL section_create(section, __LOCATION__, name="ERI", &
     393              :                           description="Parameters for the electron repulsion integrals.", &
     394         1481 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     395              : 
     396         1481 :       NULLIFY (keyword)
     397              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
     398              :                           description="Method used in ERI calculation.", &
     399              :                           usage="METHOD FULL_GPW", &
     400              :                           enum_c_vals=s2a("FULL_GPW", "GPW_HALF_TRANSFORM"), &
     401              :                           enum_i_vals=[eri_method_full_gpw, eri_method_gpw_ht], &
     402              :                           enum_desc=s2a("Use the GPW approach with MOs", &
     403              :                                         "Use the GPW approach for half-transformed MO ERIs"), &
     404         1481 :                           default_i_val=eri_method_full_gpw)
     405         1481 :       CALL section_add_keyword(section, keyword)
     406         1481 :       CALL keyword_release(keyword)
     407              : 
     408              :       CALL keyword_create(keyword, __LOCATION__, name="OPERATOR", &
     409              :                           description="Operator used in ERI calculation.", &
     410              :                           usage="OPERATOR LONGRANGE", &
     411              :                           enum_c_vals=s2a("COULOMB", "YUKAWA", "LONGRANGE", &
     412              :                                           "SHORTRANGE", "GAUSSIAN", "TRUNCATED", "LR_TRUNC"), &
     413              :                           enum_i_vals=[eri_operator_coulomb, eri_operator_yukawa, &
     414              :                                        eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, &
     415              :                                        eri_operator_trunc, eri_operator_lr_trunc], &
     416              :                           enum_desc=s2a("Coulomb operator: $\frac{1}{r}$", &
     417              :                                         "Yukawa operator: $\frac{\exp{(-\omega \cdot r)}}{r}$", &
     418              :                                         "Longrange operator: $\frac{\mathrm{erf}(\omega \cdot r)}{r}$", &
     419              :                                         "Shortrange operator: $\frac{\mathrm{erfc}(\omega \cdot r)}{r}$", &
     420              :                                         "Gaussian operator: exp(-omega*R2)/R", &
     421              :                                         "Truncated Coulomb operator: $\frac{1}{r} \text{ if } (r \lt R_c) \text{ else } 0$", &
     422              :                                         "Truncated longrange operator: "// &
     423              :                                         "$\frac{\mathrm{erf}(\omega \cdot r)}{r} \text{ if } (r \lt R_c) \text{ else } 0$"), &
     424         1481 :                           default_i_val=eri_operator_coulomb)
     425         1481 :       CALL section_add_keyword(section, keyword)
     426         1481 :       CALL keyword_release(keyword)
     427              : 
     428              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODICITY", &
     429              :                           description="Periodicity used for operators in ERI calclulation.", &
     430              :                           usage="PERIODICITY 1 1 1", n_var=-1, default_i_vals=[0, 0, 0], &
     431         1481 :                           type_of_var=integer_t)
     432         1481 :       CALL section_add_keyword(section, keyword)
     433         1481 :       CALL keyword_release(keyword)
     434              : 
     435              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     436              :                           description="Range-separation parameter $\omega$ for ERI operator.", &
     437              :                           usage="OMEGA 0.25", type_of_var=real_t, &
     438         1481 :                           default_r_val=0.4_dp)
     439         1481 :       CALL section_add_keyword(section, keyword)
     440         1481 :       CALL keyword_release(keyword)
     441              : 
     442              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     443              :                           description="Cutoff radius (in Angstroms) $R_c$ for the truncated "// &
     444              :                           "$\frac{1}{r}$ and longrange potentials. "// &
     445              :                           "Only valid when doing truncated calculations.", &
     446              :                           usage="CUTOFF_RADIUS 10.0", type_of_var=real_t, &
     447         1481 :                           unit_str="angstrom", default_r_val=0.0_dp)
     448         1481 :       CALL section_add_keyword(section, keyword)
     449         1481 :       CALL keyword_release(keyword)
     450              : 
     451              :       CALL keyword_create( &
     452              :          keyword, __LOCATION__, name="EPS_INTEGRAL", &
     453              :          description="Accuracy of ERIs that will be stored.", &
     454              :          usage="EPS_INTEGRAL 1.0E-10 ", type_of_var=real_t, &
     455         1481 :          default_r_val=1.0E-12_dp)
     456         1481 :       CALL section_add_keyword(section, keyword)
     457         1481 :       CALL keyword_release(keyword)
     458              : 
     459         1481 :    END SUBROUTINE create_eri_section
     460              : 
     461              : ! **************************************************************************************************
     462              : !> \brief ...
     463              : !> \param section ...
     464              : ! **************************************************************************************************
     465         1481 :    SUBROUTINE create_eri_gpw(section)
     466              :       TYPE(section_type), POINTER                        :: section
     467              : 
     468              :       TYPE(keyword_type), POINTER                        :: keyword
     469              : 
     470         1481 :       CPASSERT(.NOT. ASSOCIATED(section))
     471              :       CALL section_create(section, __LOCATION__, name="ERI_GPW", &
     472              :                           description="Parameters for the GPW approach to electron repulsion integrals.", &
     473         1481 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     474              : 
     475         1481 :       NULLIFY (keyword)
     476              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GRID", &
     477              :                           description="Determines a threshold for the GPW based integration", &
     478              :                           usage="EPS_GRID 1.0E-9 ", type_of_var=real_t, &
     479         1481 :                           default_r_val=1.0E-8_dp)
     480         1481 :       CALL section_add_keyword(section, keyword)
     481         1481 :       CALL keyword_release(keyword)
     482              : 
     483              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
     484              :                           description="Determines a threshold for the sparse matrix multiplications if METHOD "// &
     485              :                           "GPW_HALF_TRANSFORM is used", &
     486              :                           usage="EPS_FILTER 1.0E-9 ", type_of_var=real_t, &
     487         1481 :                           default_r_val=1.0E-9_dp)
     488         1481 :       CALL section_add_keyword(section, keyword)
     489         1481 :       CALL keyword_release(keyword)
     490              : 
     491              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
     492              :                           description="The cutoff of the finest grid level in the GPW integration.", &
     493              :                           usage="CUTOFF 300", type_of_var=real_t, &
     494         1481 :                           default_r_val=300.0_dp)
     495         1481 :       CALL section_add_keyword(section, keyword)
     496         1481 :       CALL keyword_release(keyword)
     497              : 
     498              :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
     499              :                           variants=["RELATIVE_CUTOFF"], &
     500              :                           description="Determines the grid at which a Gaussian is mapped.", &
     501              :                           usage="REL_CUTOFF 50", type_of_var=real_t, &
     502         2962 :                           default_r_val=50.0_dp)
     503         1481 :       CALL section_add_keyword(section, keyword)
     504         1481 :       CALL keyword_release(keyword)
     505              : 
     506              :       CALL keyword_create(keyword, __LOCATION__, name="STORE_WFN", &
     507              :                           variants=["STORE_WAVEFUNCTION"], &
     508              :                           description="Store wavefunction in real space representation for integration.", &
     509              :                           usage="STORE_WFN  T", type_of_var=logical_t, &
     510         2962 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     511         1481 :       CALL section_add_keyword(section, keyword)
     512         1481 :       CALL keyword_release(keyword)
     513              : 
     514              :       CALL keyword_create(keyword, __LOCATION__, name="GROUP_SIZE", &
     515              :                           description="Sets the size of a subgroup for ERI calculation, "// &
     516              :                           "each of which with a full set of work grids, arrays or orbitals "// &
     517              :                           "depending on the method of grids (work grids, arrays, orbitals). "// &
     518              :                           "Small numbers reduce communication but increase the memory demands. "// &
     519              :                           "A negative number indicates all processes (default).", &
     520              :                           usage="GROUP_SIZE 2", type_of_var=integer_t, &
     521         1481 :                           default_i_val=-1)
     522         1481 :       CALL section_add_keyword(section, keyword)
     523         1481 :       CALL keyword_release(keyword)
     524              : 
     525              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
     526              :                           variants=["IOLEVEL"], &
     527              :                           description="How much output is written by the individual groups.", &
     528              :                           usage="PRINT_LEVEL HIGH", &
     529              :                           default_i_val=silent_print_level, enum_c_vals= &
     530              :                           s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
     531              :                           enum_desc=s2a("Almost no output", &
     532              :                                         "Little output", "Quite some output", "Lots of output", &
     533              :                                         "Everything is written out, useful for debugging purposes only"), &
     534              :                           enum_i_vals=[silent_print_level, low_print_level, medium_print_level, &
     535         2962 :                                        high_print_level, debug_print_level])
     536         1481 :       CALL section_add_keyword(section, keyword)
     537         1481 :       CALL keyword_release(keyword)
     538              : 
     539         1481 :    END SUBROUTINE create_eri_gpw
     540              : 
     541              : END MODULE input_cp2k_as
        

Generated by: LCOV version 2.0-1