LCOV - code coverage report
Current view: top level - src - input_cp2k_resp.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 156 156 100.0 %
Date: 2024-11-21 06:45:46 Functions: 6 6 100.0 %

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

Generated by: LCOV version 1.15