LCOV - code coverage report
Current view: top level - src - input_cp2k_resp.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:cccd2f3) Lines: 100.0 % 156 156
Test Date: 2026-05-06 07:07:47 Functions: 100.0 % 6 6

            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 builds the resp section of the input
      10              : !> \par History
      11              : !>      02.2007 created
      12              : !> \author Joost VandeVondele
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_resp
      15              :    USE bibliography,                    ONLY: Campana2009,&
      16              :                                               Golze2015,&
      17              :                                               Rappe1992
      18              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      19              :                                               cp_print_key_section_create,&
      20              :                                               high_print_level,&
      21              :                                               low_print_level
      22              :    USE cp_units,                        ONLY: cp_unit_to_cp2k
      23              :    USE input_constants,                 ONLY: &
      24              :         do_resp_minus_x_dir, do_resp_minus_y_dir, do_resp_minus_z_dir, do_resp_x_dir, &
      25              :         do_resp_y_dir, do_resp_z_dir, gaussian, use_cambridge_vdw_radii, use_uff_vdw_radii
      26              :    USE input_keyword_types,             ONLY: keyword_create,&
      27              :                                               keyword_release,&
      28              :                                               keyword_type
      29              :    USE input_section_types,             ONLY: section_add_keyword,&
      30              :                                               section_add_subsection,&
      31              :                                               section_create,&
      32              :                                               section_release,&
      33              :                                               section_type
      34              :    USE input_val_types,                 ONLY: char_t,&
      35              :                                               integer_t,&
      36              :                                               real_t
      37              :    USE kinds,                           ONLY: dp
      38              :    USE string_utilities,                ONLY: s2a
      39              : #include "./base/base_uses.f90"
      40              : 
      41              :    IMPLICIT NONE
      42              :    PRIVATE
      43              : 
      44              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      45              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_resp'
      46              : 
      47              :    PUBLIC :: create_resp_section
      48              : 
      49              : CONTAINS
      50              : 
      51              : ! **************************************************************************************************
      52              : !> \brief Creates the RESP section
      53              : !> \param section the section to create
      54              : !> \author Joost VandeVondele
      55              : ! **************************************************************************************************
      56         9823 :    SUBROUTINE create_resp_section(section)
      57              :       TYPE(section_type), POINTER                        :: section
      58              : 
      59              :       TYPE(keyword_type), POINTER                        :: keyword
      60              :       TYPE(section_type), POINTER                        :: subsection
      61              : 
      62         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
      63              :       CALL section_create(section, __LOCATION__, name="RESP", &
      64              :                           description="Requests a restrained electrostatic potential (RESP) fit of atomic charges. "// &
      65              :                           "When using a periodic "// &
      66              :                           "Poisson solver and a periodic cell, the periodic RESP routines are "// &
      67              :                           "used. If the Hartree potential matches with the one of an isolated "// &
      68              :                           "system (i.e. isolated Poisson solver and big, nonperiodic cells), "// &
      69              :                           "the nonperiodic RESP routines are automatically used. All restraints "// &
      70              :                           "are harmonic!", &
      71        19646 :                           n_keywords=2, n_subsections=2, repeats=.FALSE., citations=[Golze2015])
      72              : 
      73         9823 :       NULLIFY (keyword, subsection)
      74              : 
      75              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
      76              :                           description="The stride (X,Y,Z) used to write the cube file "// &
      77              :                           "(larger values result in smaller cube files). You can provide "// &
      78              :                           "3 numbers (for X,Y,Z) or 1 number valid for all components.", &
      79         9823 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
      80         9823 :       CALL section_add_keyword(section, keyword)
      81         9823 :       CALL keyword_release(keyword)
      82              : 
      83              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGER_TOTAL_CHARGE", &
      84              :                           description="Forces the total charge to be integer", &
      85              :                           usage="INTEGER_TOTAL_CHARGE TRUE", &
      86         9823 :                           default_l_val=.TRUE.)
      87         9823 :       CALL section_add_keyword(section, keyword)
      88         9823 :       CALL keyword_release(keyword)
      89              : 
      90              :       CALL keyword_create(keyword, __LOCATION__, name="RESTRAIN_HEAVIES_TO_ZERO", &
      91              :                           description="Restrain non-hydrogen atoms to zero.", &
      92              :                           usage="RESTRAIN_HEAVIES_TO_ZERO FALSE", &
      93         9823 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
      94         9823 :       CALL section_add_keyword(section, keyword)
      95         9823 :       CALL keyword_release(keyword)
      96              : 
      97              :       CALL keyword_create(keyword, __LOCATION__, name="RESTRAIN_HEAVIES_STRENGTH", &
      98              :                           description="If defined, enforce the restraint of non-hydrogen "// &
      99              :                           "atoms to zero. Its value is the strength of the restraint on "// &
     100              :                           "the heavy atoms.", &
     101              :                           usage="RESTRAIN_HEAVIES_STRENGTH 0.0001 ", &
     102         9823 :                           default_r_val=1.0E-6_dp)
     103         9823 :       CALL section_add_keyword(section, keyword)
     104         9823 :       CALL keyword_release(keyword)
     105              : 
     106              :       CALL keyword_create(keyword, __LOCATION__, name="WIDTH", &
     107              :                           description="Specifies the value of the width of the Gaussian "// &
     108              :                           "charge distribution carried by each atom. Needs only "// &
     109              :                           "to be specified when using a periodic Poisson solver.", &
     110              :                           usage="WIDTH <real> ", n_var=1, type_of_var=real_t, &
     111              :                           default_r_val=cp_unit_to_cp2k(value=11.249_dp, unit_str="angstrom^-2"), &
     112         9823 :                           unit_str="angstrom^-2")
     113         9823 :       CALL section_add_keyword(section, keyword)
     114         9823 :       CALL keyword_release(keyword)
     115              : 
     116              :       CALL keyword_create(keyword, __LOCATION__, name="USE_REPEAT_METHOD", &
     117              :                           description="Fits the variance of the potential, i.e. the deviation "// &
     118              :                           "from the mean value of the potential within the selected "// &
     119              :                           "range. The evaluation of the potentials is still treated "// &
     120              :                           "within the GPW approach as described in [Golze2015]. "// &
     121              :                           "When used in conjunction with INTEGER_TOTAL_CHARGE = T "// &
     122              :                           "and SPHERE_SAMPLING, the results will be very similar to "// &
     123              :                           "the REPEAT charges given in [Campana2009]. In most "// &
     124              :                           "cases switching on this option gives reasonable "// &
     125              :                           "atomic charges without the need to define any "// &
     126              :                           "restraints. Note that by switching on this option, "// &
     127              :                           "RESTRAIN_HEAVIES_TO_ZERO will be switched off. ", &
     128              :                           usage="USE_REPEAT_METHOD", &
     129              :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
     130        19646 :                           citations=[Campana2009])
     131         9823 :       CALL section_add_keyword(section, keyword)
     132         9823 :       CALL keyword_release(keyword)
     133              : 
     134         9823 :       CALL create_constraint_section(subsection)
     135         9823 :       CALL section_add_subsection(section, subsection)
     136         9823 :       CALL section_release(subsection)
     137              : 
     138         9823 :       CALL create_restraint_section(subsection)
     139         9823 :       CALL section_add_subsection(section, subsection)
     140         9823 :       CALL section_release(subsection)
     141              : 
     142         9823 :       CALL create_sphere_sampling_section(subsection)
     143         9823 :       CALL section_add_subsection(section, subsection)
     144         9823 :       CALL section_release(subsection)
     145              : 
     146         9823 :       CALL create_slab_sampling_section(subsection)
     147         9823 :       CALL section_add_subsection(section, subsection)
     148         9823 :       CALL section_release(subsection)
     149              : 
     150         9823 :       CALL create_print_resp_section(subsection)
     151         9823 :       CALL section_add_subsection(section, subsection)
     152         9823 :       CALL section_release(subsection)
     153              : 
     154         9823 :    END SUBROUTINE create_resp_section
     155              : 
     156              : ! **************************************************************************************************
     157              : !> \brief specifies constraints to be satisfied in a resp fit
     158              : !> \param section the section to create
     159              : !> \author Joost VandeVondele
     160              : ! **************************************************************************************************
     161         9823 :    SUBROUTINE create_constraint_section(section)
     162              :       TYPE(section_type), POINTER                        :: section
     163              : 
     164              :       TYPE(keyword_type), POINTER                        :: keyword
     165              : 
     166         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
     167              :       CALL section_create(section, __LOCATION__, name="CONSTRAINT", &
     168              :                           description="specifies a linear constraint on the fitted charges. "// &
     169              :                           "This can be used to give equal values to equivalent atoms. "// &
     170              :                           "sum over atom_list c_i * q_i = t", &
     171         9823 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
     172              : 
     173         9823 :       NULLIFY (keyword)
     174              : 
     175              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     176              :                           description="the target value for the constraint", &
     177              :                           usage="TARGET 0.0", &
     178         9823 :                           n_var=1, default_r_val=0.0_dp)
     179         9823 :       CALL section_add_keyword(section, keyword)
     180         9823 :       CALL keyword_release(keyword)
     181              : 
     182              :       CALL keyword_create(keyword, __LOCATION__, name="EQUAL_CHARGES", &
     183              :                           description="All atoms in ATOM_LIST are constrained to have the "// &
     184              :                           "same charges. When using this keyword, TARGET and ATOM_COEF do "// &
     185              :                           "not need to be set and will be ignored. Instead of using this "// &
     186              :                           "keyword, the constraint section could be repeated.", &
     187              :                           usage="EQUAL_CHARGES", &
     188         9823 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     189         9823 :       CALL section_add_keyword(section, keyword)
     190         9823 :       CALL keyword_release(keyword)
     191              : 
     192              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     193              :                           description="Defines the list of atoms involved in this constraint", &
     194              :                           usage="ATOM_LIST 3 4", &
     195         9823 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
     196         9823 :       CALL section_add_keyword(section, keyword)
     197         9823 :       CALL keyword_release(keyword)
     198              : 
     199              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_COEF", &
     200              :                           description="Defines the coefficient of the atom in this "// &
     201              :                           "linear constraint", &
     202              :                           usage="ATOM_COEF 1.0 -1.0", &
     203         9823 :                           type_of_var=real_t, n_var=-1)
     204         9823 :       CALL section_add_keyword(section, keyword)
     205         9823 :       CALL keyword_release(keyword)
     206              : 
     207         9823 :    END SUBROUTINE create_constraint_section
     208              : 
     209              : ! **************************************************************************************************
     210              : !> \brief specifies restraints to be added to a resp fit
     211              : !> \param section the section to create
     212              : !> \author Joost VandeVondele
     213              : ! **************************************************************************************************
     214         9823 :    SUBROUTINE create_restraint_section(section)
     215              :       TYPE(section_type), POINTER                        :: section
     216              : 
     217              :       TYPE(keyword_type), POINTER                        :: keyword
     218              : 
     219         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
     220              :       CALL section_create(section, __LOCATION__, name="RESTRAINT", &
     221              :                           description="specifies a restraint on the fitted charges. "// &
     222              :                           "This can be used to restrain values to zero. "// &
     223              :                           "s*(sum over atom_list q_i - t)**2", &
     224         9823 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
     225              : 
     226         9823 :       NULLIFY (keyword)
     227              : 
     228              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     229              :                           description="the target value for the restraint", &
     230              :                           usage="TARGET 0.0", &
     231         9823 :                           n_var=1, default_r_val=0.0_dp)
     232         9823 :       CALL section_add_keyword(section, keyword)
     233         9823 :       CALL keyword_release(keyword)
     234              : 
     235              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
     236              :                           description="the target value for the constraint", &
     237              :                           usage="STRENGTH 0.001", &
     238         9823 :                           n_var=1, default_r_val=0.001_dp)
     239         9823 :       CALL section_add_keyword(section, keyword)
     240         9823 :       CALL keyword_release(keyword)
     241              : 
     242              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     243              :                           description="Defines the list of atoms involved in this restraint", &
     244              :                           usage="ATOM_LIST 3 4", &
     245         9823 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
     246         9823 :       CALL section_add_keyword(section, keyword)
     247         9823 :       CALL keyword_release(keyword)
     248              : 
     249              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_COEF", &
     250              :                           description="Defines the coefficient of the atom in this "// &
     251              :                           "linear restraint. If given, the restraint will be: "// &
     252              :                           "s*(sum over atom_list c_i * q_i - t)**2 ", &
     253              :                           usage="ATOM_COEF 1.0 -1.0", &
     254         9823 :                           type_of_var=real_t, n_var=-1)
     255         9823 :       CALL section_add_keyword(section, keyword)
     256         9823 :       CALL keyword_release(keyword)
     257              : 
     258         9823 :    END SUBROUTINE create_restraint_section
     259              : 
     260              : ! **************************************************************************************************
     261              : !> \brief specifies the parameter for sampling the resp fitting points for
     262              : !>        molecular structures; sampling in spheres around the atoms
     263              : !> \param section the section to create
     264              : !> \author Dorothea Golze
     265              : ! **************************************************************************************************
     266         9823 :    SUBROUTINE create_sphere_sampling_section(section)
     267              :       TYPE(section_type), POINTER                        :: section
     268              : 
     269              :       TYPE(keyword_type), POINTER                        :: keyword
     270              : 
     271         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
     272              :       CALL section_create(section, __LOCATION__, name="SPHERE_SAMPLING", &
     273              :                           description="Specifies the parameter for sampling the RESP fitting points "// &
     274              :                           "for molecular structures, i.e. systems that do not involve "// &
     275              :                           "surfaces. Fitting points are sampled in spheres around the "// &
     276              :                           "atom. All grid points in the shell defined by rmin and rmax "// &
     277              :                           "are accepted for fitting. Default is that rmin is the vdW "// &
     278              :                           "radius and rmax=100.0*vdW_radius, which can be overwritten "// &
     279              :                           "by the keywords below.", &
     280         9823 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     281              : 
     282         9823 :       NULLIFY (keyword)
     283              : 
     284              :       CALL keyword_create(keyword, __LOCATION__, name="X_LOW", &
     285              :                           description="Specifies the lower boundary of the box along X used to "// &
     286              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     287         9823 :                           usage="X_LOW  -15.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     288         9823 :       CALL section_add_keyword(section, keyword)
     289         9823 :       CALL keyword_release(keyword)
     290              : 
     291              :       CALL keyword_create(keyword, __LOCATION__, name="X_HI", &
     292              :                           description="Specifies the upper boundary of the box along X used to "// &
     293              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     294         9823 :                           usage="X_HI  5.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     295         9823 :       CALL section_add_keyword(section, keyword)
     296         9823 :       CALL keyword_release(keyword)
     297              : 
     298              :       CALL keyword_create(keyword, __LOCATION__, name="Y_LOW", &
     299              :                           description="Specifies the lower boundary of the box along Y used to "// &
     300              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     301         9823 :                           usage="Y_LOW  -15.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     302         9823 :       CALL section_add_keyword(section, keyword)
     303         9823 :       CALL keyword_release(keyword)
     304              : 
     305              :       CALL keyword_create(keyword, __LOCATION__, name="Y_HI", &
     306              :                           description="Specifies the upper boundary of the box along Y used to "// &
     307              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     308         9823 :                           usage="Y_HI  5.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     309         9823 :       CALL section_add_keyword(section, keyword)
     310         9823 :       CALL keyword_release(keyword)
     311              : 
     312              :       CALL keyword_create(keyword, __LOCATION__, name="Z_LOW", &
     313              :                           description="Specifies the lower boundary of the box along Z used to "// &
     314              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     315         9823 :                           usage="Z_LOW  -15.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     316         9823 :       CALL section_add_keyword(section, keyword)
     317         9823 :       CALL keyword_release(keyword)
     318              : 
     319              :       CALL keyword_create(keyword, __LOCATION__, name="Z_HI", &
     320              :                           description="Specifies the upper boundary of the box along Z used to "// &
     321              :                           "sample the potential. Only valid for nonperiodic RESP fitting.", &
     322         9823 :                           usage="Z_HI  5.", type_of_var=real_t, n_var=1, unit_str='angstrom')
     323         9823 :       CALL section_add_keyword(section, keyword)
     324         9823 :       CALL keyword_release(keyword)
     325              : 
     326              :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_VDW_RADII_TABLE", &
     327              :                           description="Select which vdW radii table to use for automatic "// &
     328              :                           "determination of RMIN_KIND and RMAX_KIND if those "// &
     329              :                           "are not declared explicitly", &
     330              :                           usage="AUTO_VDW_RADII_TABLE UFF", &
     331              :                           default_i_val=use_cambridge_vdw_radii, &
     332              :                           enum_c_vals=s2a("CAMBRIDGE", &
     333              :                                           "UFF"), &
     334              :                           enum_desc=s2a("Cambridge Structural Database", &
     335              :                                         "Universal Force Field: "// &
     336              :                                         "Rappe et al. J. Am. Chem. Soc. 114, 10024 (1992)"), &
     337              :                           enum_i_vals=[use_cambridge_vdw_radii, &
     338              :                                        use_uff_vdw_radii], &
     339        19646 :                           citations=[Rappe1992])
     340         9823 :       CALL section_add_keyword(section, keyword)
     341         9823 :       CALL keyword_release(keyword)
     342              : 
     343              :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_RMAX_SCALE", &
     344              :                           description="IF RMAX or RMAX_KIND keywords are not present, defines the "// &
     345              :                           "maximumn distance a fit point is away from an atom based on "// &
     346              :                           "the formula: rmax(kind) = AUTO_RMAX_SCALE * vdW_radius(kind). "// &
     347              :                           "The van der Waals radiii of the elements are based on data from "// &
     348              :                           "table chosen by AUTO_VDW_RADII_TABLE.", &
     349              :                           usage="AUTO_RMAX_SCALE 60.0", &
     350         9823 :                           default_r_val=100.0_dp)
     351         9823 :       CALL section_add_keyword(section, keyword)
     352         9823 :       CALL keyword_release(keyword)
     353              : 
     354              :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_RMIN_SCALE", &
     355              :                           description="IF RMIN or RMIN_KIND keywords are not present, defines the "// &
     356              :                           "minimum distance a fit point is away from an atom based on "// &
     357              :                           "the formula: rmin(kind) = AUTO_RMIN_SCALE * vdW_radius(kind). "// &
     358              :                           "The van der Waals radii of the elements are based on data from "// &
     359              :                           "table chosen by AUTO_VDW_RADII_TABLE.", &
     360              :                           usage="AUTO_RMIN_SCALE 1.5", &
     361         9823 :                           default_r_val=1.0_dp)
     362         9823 :       CALL section_add_keyword(section, keyword)
     363         9823 :       CALL keyword_release(keyword)
     364              : 
     365              :       CALL keyword_create(keyword, __LOCATION__, name="RMAX", &
     366              :                           description="Specifies the maximum distance a fit point is away from an atom. "// &
     367              :                           "Valid for all atomic kinds for which no RMAX_KIND are specified.", &
     368              :                           usage="RMAX 2.5", &
     369              :                           default_r_val=cp_unit_to_cp2k(value=2.5_dp, unit_str="angstrom"), &
     370         9823 :                           unit_str='angstrom')
     371         9823 :       CALL section_add_keyword(section, keyword)
     372         9823 :       CALL keyword_release(keyword)
     373              : 
     374              :       CALL keyword_create(keyword, __LOCATION__, name="RMIN", &
     375              :                           description="Specifies the minimum distance a fit point is away from an atom. "// &
     376              :                           "Valid for all atomic kinds for which no RMIN_KIND are specified.", &
     377              :                           usage="RMIN 2.1", &
     378              :                           default_r_val=cp_unit_to_cp2k(value=2.1_dp, unit_str="angstrom"), &
     379         9823 :                           unit_str='angstrom')
     380         9823 :       CALL section_add_keyword(section, keyword)
     381         9823 :       CALL keyword_release(keyword)
     382              : 
     383              :       CALL keyword_create(keyword, __LOCATION__, name="RMAX_KIND", &
     384              :                           description="Specifies the maximum distance a fit point is away from an atom "// &
     385              :                           "of a given kind", &
     386              :                           usage="RMAX_KIND 2.5 Br", repeats=.TRUE., &
     387         9823 :                           n_var=-1, type_of_var=char_t)
     388         9823 :       CALL section_add_keyword(section, keyword)
     389         9823 :       CALL keyword_release(keyword)
     390              : 
     391              :       CALL keyword_create(keyword, __LOCATION__, name="RMIN_KIND", &
     392              :                           description="Specifies the minimum distance a fit point is away from an atom "// &
     393              :                           "of a given kind", &
     394              :                           usage="RMIN_KIND 2.1 Br", repeats=.TRUE., &
     395         9823 :                           n_var=-1, type_of_var=char_t)
     396         9823 :       CALL section_add_keyword(section, keyword)
     397         9823 :       CALL keyword_release(keyword)
     398              : 
     399         9823 :    END SUBROUTINE create_sphere_sampling_section
     400              : 
     401              : ! **************************************************************************************************
     402              : !> \brief specifies the parameter for sampling the resp fitting points for
     403              : !>        slab-like periodic systems, i.e. systems that involve surfaces
     404              : !> \param section the section to create
     405              : !> \author Dorothea Golze
     406              : ! **************************************************************************************************
     407         9823 :    SUBROUTINE create_slab_sampling_section(section)
     408              :       TYPE(section_type), POINTER                        :: section
     409              : 
     410              :       TYPE(keyword_type), POINTER                        :: keyword
     411              : 
     412         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
     413              :       CALL section_create(section, __LOCATION__, name="SLAB_SAMPLING", &
     414              :                           description="Specifies the parameter for sampling the RESP fitting "// &
     415              :                           "points for slab-like periodic systems, i.e. systems that "// &
     416              :                           "involve surfaces. This section can only be used with periodic  "// &
     417              :                           "Poisson solver and cell. To see, which grid points were "// &
     418              :                           "used, switch on COORD_FIT_POINTS in the PRINT section.", &
     419         9823 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
     420              : 
     421         9823 :       NULLIFY (keyword)
     422              : 
     423              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     424              :                           description="Specifies the list of indexes of atoms used to define "// &
     425              :                           "the region for the RESP fitting. The list should "// &
     426              :                           "contain indexes of atoms of the first surface layer.", &
     427              :                           usage="ATOM_LIST 1 2 3 or 1..3", &
     428         9823 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
     429         9823 :       CALL section_add_keyword(section, keyword)
     430         9823 :       CALL keyword_release(keyword)
     431              : 
     432              :       CALL keyword_create(keyword, __LOCATION__, name="RANGE", &
     433              :                           description="Range where the fitting points are sampled. A range of "// &
     434              :                           "3 to 5 Angstroms means that the fitting points are sampled in the region "// &
     435              :                           "of 3 to 5 Angstroms above the surface which is defined by atom indexes given "// &
     436              :                           "in ATOM_LIST.", &
     437         9823 :                           usage="RANGE <real> <real>", unit_str="angstrom", n_var=2, type_of_var=real_t)
     438         9823 :       CALL section_add_keyword(section, keyword)
     439         9823 :       CALL keyword_release(keyword)
     440              : 
     441              :       CALL keyword_create(keyword, __LOCATION__, name="LENGTH", &
     442              :                           description="Length of the sampling box, i.e. a box of this length and "// &
     443              :                           "the height specified by RANGE is defined above each surface atom given "// &
     444              :                           "in ATOM_LIST. The grid points in the boxes are accepted as fitting point. "// &
     445              :                           "Should be in the range of the nearest neighbour distance (a bit larger to be "// &
     446              :                           "on the safe side). Allows for a refined sampling of grid points in case of "// &
     447              :                           "corrugated surfaces.", &
     448              :                           usage="LENGTH <real> ", unit_str="angstrom", n_var=1, type_of_var=real_t, &
     449         9823 :                           default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"))
     450         9823 :       CALL section_add_keyword(section, keyword)
     451         9823 :       CALL keyword_release(keyword)
     452              : 
     453              :       CALL keyword_create(keyword, __LOCATION__, name="SURF_DIRECTION", &
     454              :                           description="Specifies what above the surface means. Defines the direction.", &
     455              :                           usage="SURF_DIRECTION Z", &
     456              :                           enum_c_vals=s2a("X", "Y", "Z", "-X", "-Y", "-Z"), &
     457              :                           enum_i_vals=[do_resp_x_dir, do_resp_y_dir, do_resp_z_dir, &
     458              :                                        do_resp_minus_x_dir, do_resp_minus_y_dir, do_resp_minus_z_dir], &
     459              :                           enum_desc=s2a("surface layers are piled up in x-direction", &
     460              :                                         "surface layers are piled up in y-direction", &
     461              :                                         "surface layers are piled up in z-direction", &
     462              :                                         "surface layers are piled up in -x-direction", &
     463              :                                         "surface layers are piled up in -y-direction", &
     464              :                                         "surface layers are piled up in -z-direction"), &
     465         9823 :                           default_i_val=do_resp_z_dir)
     466         9823 :       CALL section_add_keyword(section, keyword)
     467         9823 :       CALL keyword_release(keyword)
     468              : 
     469         9823 :    END SUBROUTINE create_slab_sampling_section
     470              : 
     471              : ! **************************************************************************************************
     472              : !> \brief create the resp print section
     473              : !> \param section the section to create
     474              : !> \author Dorothea Golze
     475              : ! **************************************************************************************************
     476         9823 :    SUBROUTINE create_print_resp_section(section)
     477              :       TYPE(section_type), POINTER                        :: section
     478              : 
     479              :       TYPE(keyword_type), POINTER                        :: keyword
     480              :       TYPE(section_type), POINTER                        :: print_key
     481              : 
     482         9823 :       CPASSERT(.NOT. ASSOCIATED(section))
     483         9823 :       NULLIFY (print_key, keyword)
     484              :       CALL section_create(section, __LOCATION__, name="print", &
     485              :                           description="Section of possible print options specific for the RESP code.", &
     486         9823 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     487              : 
     488              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     489              :                                        description="Controls the printing of information regarding the run.", &
     490         9823 :                                        print_level=low_print_level, filename="__STD_OUT__")
     491         9823 :       CALL section_add_subsection(section, print_key)
     492         9823 :       CALL section_release(print_key)
     493              : 
     494              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COORD_FIT_POINTS", &
     495              :                                        description="Controls the printing of the coordinates of the "// &
     496              :                                        "grid points used for periodic RESP fitting. This section "// &
     497              :                                        "is intended to be only used for testing (you can get large files).", &
     498              :                                        print_level=high_print_level, add_last=add_last_numeric, &
     499              :                                        filename="RESP_FIT_POINTS", &
     500         9823 :                                        common_iter_levels=3)
     501         9823 :       CALL section_add_subsection(section, print_key)
     502         9823 :       CALL section_release(print_key)
     503              : 
     504              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESP_CHARGES_TO_FILE", &
     505              :                                        description="Controls the printing of the RESP charges "// &
     506              :                                        "to a file.", &
     507              :                                        print_level=high_print_level, add_last=add_last_numeric, &
     508              :                                        filename="RESP_CHARGES", &
     509         9823 :                                        common_iter_levels=3)
     510         9823 :       CALL section_add_subsection(section, print_key)
     511         9823 :       CALL section_release(print_key)
     512              : 
     513              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "V_RESP_CUBE", &
     514              :                                        description="Controls the printing of the potential generated "// &
     515              :                                        "by the RESP CHARGES to a cube file. Prints the relative "// &
     516              :                                        "root-mean-square (RRMS) and root-mean-square (RMS) errors.", &
     517              :                                        print_level=high_print_level, add_last=add_last_numeric, &
     518              :                                        filename="RESP_POTENTIAL", &
     519         9823 :                                        common_iter_levels=3)
     520              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     521              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     522              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     523              :                           " 1 number valid for all components.", &
     524         9823 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     525         9823 :       CALL section_add_keyword(print_key, keyword)
     526         9823 :       CALL keyword_release(keyword)
     527              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
     528              :                           description="append the cube files when they already exist", &
     529         9823 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     530         9823 :       CALL section_add_keyword(print_key, keyword)
     531         9823 :       CALL keyword_release(keyword)
     532         9823 :       CALL section_add_subsection(section, print_key)
     533         9823 :       CALL section_release(print_key)
     534         9823 :    END SUBROUTINE create_print_resp_section
     535              : 
     536              : END MODULE input_cp2k_resp
        

Generated by: LCOV version 2.0-1