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

            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 poisson section of the input
      10              : !> \par History
      11              : !>      03.2006 fusing of poisson_dft and poisson_mm
      12              : !> \author fawzi
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_poisson
      15              :    USE bibliography,                    ONLY: &
      16              :         Aguado2003, BaniHashemian2016, Blochl1995, Darden1993, Essmann1995, Ewald1921, &
      17              :         Genovese2006, Genovese2007, Laino2008, Martyna1999, Toukmaji1996
      18              :    USE cell_types,                      ONLY: use_perd_none,&
      19              :                                               use_perd_x,&
      20              :                                               use_perd_xy,&
      21              :                                               use_perd_xyz,&
      22              :                                               use_perd_xz,&
      23              :                                               use_perd_y,&
      24              :                                               use_perd_yz,&
      25              :                                               use_perd_z
      26              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      27              :                                               cp_print_key_section_create,&
      28              :                                               low_print_level,&
      29              :                                               medium_print_level
      30              :    USE cp_units,                        ONLY: cp_unit_to_cp2k
      31              :    USE dct,                             ONLY: neumannX,&
      32              :                                               neumannXY,&
      33              :                                               neumannXYZ,&
      34              :                                               neumannXZ,&
      35              :                                               neumannY,&
      36              :                                               neumannYZ,&
      37              :                                               neumannZ
      38              :    USE dielectric_types,                ONLY: &
      39              :         derivative_cd3, derivative_cd5, derivative_cd7, derivative_fft, derivative_fft_use_deps, &
      40              :         derivative_fft_use_drho, rho_dependent, spatially_dependent, spatially_rho_dependent
      41              :    USE dirichlet_bc_types,              ONLY: CIRCUMSCRIBED,&
      42              :                                               INSCRIBED,&
      43              :                                               x_axis,&
      44              :                                               xy_plane,&
      45              :                                               xz_plane,&
      46              :                                               y_axis,&
      47              :                                               yz_plane,&
      48              :                                               z_axis
      49              :    USE input_constants,                 ONLY: do_fist_pol_cg,&
      50              :                                               do_fist_pol_none,&
      51              :                                               do_fist_pol_sc
      52              :    USE input_cp2k_rsgrid,               ONLY: create_rsgrid_section
      53              :    USE input_keyword_types,             ONLY: keyword_create,&
      54              :                                               keyword_release,&
      55              :                                               keyword_type
      56              :    USE input_section_types,             ONLY: section_add_keyword,&
      57              :                                               section_add_subsection,&
      58              :                                               section_create,&
      59              :                                               section_release,&
      60              :                                               section_type
      61              :    USE input_val_types,                 ONLY: enum_t,&
      62              :                                               integer_t,&
      63              :                                               real_t
      64              :    USE kinds,                           ONLY: dp
      65              :    USE multipole_types,                 ONLY: do_multipole_charge,&
      66              :                                               do_multipole_dipole,&
      67              :                                               do_multipole_none,&
      68              :                                               do_multipole_quadrupole
      69              :    USE ps_implicit_types,               ONLY: MIXED_BC,&
      70              :                                               MIXED_PERIODIC_BC,&
      71              :                                               NEUMANN_BC,&
      72              :                                               PERIODIC_BC
      73              :    USE pw_poisson_types,                ONLY: &
      74              :         do_ewald_ewald, do_ewald_none, do_ewald_pme, do_ewald_spme, pw_poisson_analytic, &
      75              :         pw_poisson_implicit, pw_poisson_mt, pw_poisson_multipole, pw_poisson_periodic, &
      76              :         pw_poisson_wavelet
      77              :    USE pw_spline_utils,                 ONLY: no_precond,&
      78              :                                               precond_spl3_1,&
      79              :                                               precond_spl3_2,&
      80              :                                               precond_spl3_3,&
      81              :                                               precond_spl3_aint,&
      82              :                                               precond_spl3_aint2
      83              :    USE string_utilities,                ONLY: s2a
      84              : #include "./base/base_uses.f90"
      85              : 
      86              :    IMPLICIT NONE
      87              :    PRIVATE
      88              : 
      89              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      90              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_poisson'
      91              : 
      92              :    PUBLIC :: create_poisson_section, &
      93              :              create_gspace_interp_section, &
      94              :              create_ewald_section
      95              : !***
      96              : CONTAINS
      97              : 
      98              : ! **************************************************************************************************
      99              : !> \brief Creates the Poisson section
     100              : !> \param section the section to create
     101              : !> \author teo
     102              : ! **************************************************************************************************
     103        29485 :    SUBROUTINE create_poisson_section(section)
     104              :       TYPE(section_type), POINTER                        :: section
     105              : 
     106              :       TYPE(keyword_type), POINTER                        :: keyword
     107              :       TYPE(section_type), POINTER                        :: subsection
     108              : 
     109        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     110              :       CALL section_create(section, __LOCATION__, name="poisson", &
     111              :                           description="Controls the Poisson solver and electrostatic boundary conditions used by DFT.", &
     112        29485 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     113              : 
     114        29485 :       NULLIFY (keyword, subsection)
     115              :       CALL keyword_create(keyword, __LOCATION__, name="POISSON_SOLVER", &
     116              :                           variants=["POISSON", "PSOLVER"], &
     117              :                           description="Specify which kind of solver to use to solve the Poisson equation.", &
     118              :                           usage="POISSON_SOLVER char", &
     119              :                           enum_c_vals=s2a("PERIODIC", "ANALYTIC", "MT", "MULTIPOLE", "WAVELET", "IMPLICIT"), &
     120              :                           enum_i_vals=[pw_poisson_periodic, pw_poisson_analytic, pw_poisson_mt, pw_poisson_multipole, &
     121              :                                        pw_poisson_wavelet, pw_poisson_implicit], &
     122              :                           enum_desc=s2a("PERIODIC is only available for fully (3D) periodic systems.", &
     123              :                                         "ANALYTIC is available for 0D, 1D and 2D periodic solutions using analytical green "// &
     124              :                                         "functions in the g space (slow convergence).", &
     125              :                                         "MT (Martyna Tuckermann) decoupling that interacts only with the nearest "// &
     126              :                                         "neighbor. Beware results are completely wrong if the cell is smaller than twice the "// &
     127              :                                         "cluster size (with electronic density). Available for 0D and 2D systems.", &
     128              :                                         "MULTIPOLE uses a scheme that fits the total charge with one gaussian per atom. "// &
     129              :                                         "Available only for cluster (0D) systems.", &
     130              :                                         "WAVELET allows for 0D, 2D and 3D systems. For 2D systems all PERIODIC XY, XZ "// &
     131              :                                         "and YZ combinations are accepted. It does not "// &
     132              :                                         "require very large unit cells, only that the density goes to zero on the faces of "// &
     133              :                                         "the cell. The use of PREFERRED_FFT_LIBRARY FFTSG is required.", &
     134              :                                         "IMPLICIT allows for 0D, 1D, 2D and 3D systems."), &
     135              :                           citations=[Blochl1995, Martyna1999, Genovese2006, Genovese2007], &
     136       206395 :                           default_i_val=pw_poisson_periodic)
     137        29485 :       CALL section_add_keyword(section, keyword)
     138        29485 :       CALL keyword_release(keyword)
     139              : 
     140              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
     141              :                           description="Specifies the directions in which periodic boundary conditions apply to electrostatics. "// &
     142              :                           "See the CELL section for the periodicity used by geometry and pair lists; "// &
     143              :                           "the settings are usually the same.", &
     144              :                           usage="PERIODIC (x|y|z|xy|xz|yz|xyz|none)", &
     145              :                           enum_c_vals=s2a("x", "y", "z", "xy", "xz", "yz", "xyz", "none"), &
     146              :                           enum_i_vals=[use_perd_x, use_perd_y, use_perd_z, &
     147              :                                        use_perd_xy, use_perd_xz, use_perd_yz, &
     148              :                                        use_perd_xyz, use_perd_none], &
     149        29485 :                           default_i_val=use_perd_xyz)
     150        29485 :       CALL section_add_keyword(section, keyword)
     151        29485 :       CALL keyword_release(keyword)
     152              : 
     153        29485 :       CALL create_mt_section(subsection)
     154        29485 :       CALL section_add_subsection(section, subsection)
     155        29485 :       CALL section_release(subsection)
     156              : 
     157        29485 :       CALL create_wavelet_section(subsection)
     158        29485 :       CALL section_add_subsection(section, subsection)
     159        29485 :       CALL section_release(subsection)
     160              : 
     161        29485 :       CALL create_multipole_section(subsection)
     162        29485 :       CALL section_add_subsection(section, subsection)
     163        29485 :       CALL section_release(subsection)
     164              : 
     165        29485 :       CALL create_ewald_section(subsection)
     166        29485 :       CALL section_add_subsection(section, subsection)
     167        29485 :       CALL section_release(subsection)
     168              : 
     169        29485 :       CALL create_implicit_ps_section(subsection)
     170        29485 :       CALL section_add_subsection(section, subsection)
     171        29485 :       CALL section_release(subsection)
     172        29485 :    END SUBROUTINE create_poisson_section
     173              : 
     174              : ! **************************************************************************************************
     175              : !> \brief Section to set-up parameters for decoupling using the Bloechl scheme
     176              : !> \param section the section to create
     177              : !> \author teo
     178              : ! **************************************************************************************************
     179        29485 :    SUBROUTINE create_multipole_section(section)
     180              :       TYPE(section_type), POINTER                        :: section
     181              : 
     182              :       TYPE(keyword_type), POINTER                        :: keyword
     183              :       TYPE(section_type), POINTER                        :: subsection
     184              : 
     185        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     186              : 
     187              :       CALL section_create(section, __LOCATION__, name="MULTIPOLE", &
     188              :                           description="This section is used to set up the decoupling of QM periodic images with "// &
     189              :                           "the use of density derived atomic point charges.", &
     190        29485 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     191              : 
     192        29485 :       NULLIFY (keyword, subsection)
     193              :       CALL keyword_create(keyword, __LOCATION__, name="RCUT", &
     194              :                           description="Real space cutoff for the Ewald sum.", &
     195              :                           usage="RCUT {real}", n_var=1, type_of_var=real_t, &
     196        29485 :                           unit_str="angstrom")
     197        29485 :       CALL section_add_keyword(section, keyword)
     198        29485 :       CALL keyword_release(keyword)
     199              : 
     200              :       CALL keyword_create(keyword, __LOCATION__, name="EWALD_PRECISION", &
     201              :                           description="Precision achieved in the Ewald sum.", &
     202              :                           usage="EWALD_PRECISION {real}", n_var=1, type_of_var=real_t, &
     203        29485 :                           unit_str="hartree", default_r_val=1.0E-6_dp)
     204        29485 :       CALL section_add_keyword(section, keyword)
     205        29485 :       CALL keyword_release(keyword)
     206              : 
     207              :       CALL keyword_create(keyword, __LOCATION__, name="ANALYTICAL_GTERM", &
     208              :                           description="Evaluates the Gterm in the Ewald Scheme analytically instead of using Splines.", &
     209              :                           usage="ANALYTICAL_GTERM <LOGICAL>", &
     210        29485 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     211        29485 :       CALL section_add_keyword(section, keyword)
     212        29485 :       CALL keyword_release(keyword)
     213              : 
     214              :       CALL keyword_create(keyword, __LOCATION__, name="NGRIDS", &
     215              :                           description="Specifies the number of grid points used for the Interpolation of the G-space term", &
     216        29485 :                           usage="NGRIDS <integer> <integer> <integer> ", n_var=3, default_i_vals=[50, 50, 50])
     217        29485 :       CALL section_add_keyword(section, keyword)
     218        29485 :       CALL keyword_release(keyword)
     219              : 
     220        29485 :       CALL create_gspace_interp_section(subsection)
     221        29485 :       CALL section_add_subsection(section, subsection)
     222        29485 :       CALL section_release(subsection)
     223              : 
     224              :       CALL cp_print_key_section_create(subsection, __LOCATION__, "check_spline", &
     225              :                                        description="Controls the checking of the G-space term Spline Interpolation.", &
     226        29485 :                                        print_level=medium_print_level, filename="GSpace-SplInterp")
     227        29485 :       CALL section_add_subsection(section, subsection)
     228        29485 :       CALL section_release(subsection)
     229              : 
     230              :       CALL cp_print_key_section_create(subsection, __LOCATION__, "program_run_info", &
     231              :                                        description="Controls the printing of basic information during the run", &
     232        29485 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     233        29485 :       CALL section_add_subsection(section, subsection)
     234        29485 :       CALL section_release(subsection)
     235              : 
     236        29485 :    END SUBROUTINE create_multipole_section
     237              : 
     238              : ! **************************************************************************************************
     239              : !> \brief Creates the Martyna-Tuckerman section
     240              : !> \param section the section to create
     241              : !> \author teo
     242              : ! **************************************************************************************************
     243        29485 :    SUBROUTINE create_mt_section(section)
     244              :       TYPE(section_type), POINTER                        :: section
     245              : 
     246              :       TYPE(keyword_type), POINTER                        :: keyword
     247              : 
     248        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     249              :       CALL section_create(section, __LOCATION__, name="mt", &
     250              :                           description="Sets up parameters of  Martyna-Tuckerman poisson solver. "// &
     251              :                           "Note that exact results are only guaranteed if the unit cell is "// &
     252              :                           "twice as large as charge density (and serious artefacts can result "// &
     253              :                           "if the cell is much smaller).", &
     254              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
     255        58970 :                           citations=[Martyna1999])
     256              : 
     257        29485 :       NULLIFY (keyword)
     258              : 
     259              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     260              :                           description="Convergence parameter ALPHA*RMIN. Default value 7.0", &
     261              :                           usage="ALPHA real", &
     262        29485 :                           n_var=1, default_r_val=7.0_dp)
     263        29485 :       CALL section_add_keyword(section, keyword)
     264        29485 :       CALL keyword_release(keyword)
     265              : 
     266              :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
     267              :                           description="Specify the multiplicative factor for the CUTOFF keyword in MULTI_GRID"// &
     268              :                           " section. The result gives the cutoff at which the 1/r non-periodic FFT3D is evaluated."// &
     269              :                           " Default is 2.0", &
     270              :                           usage="REL_CUTOFF real", &
     271        29485 :                           n_var=1, default_r_val=2.0_dp)
     272        29485 :       CALL section_add_keyword(section, keyword)
     273        29485 :       CALL keyword_release(keyword)
     274              : 
     275        29485 :    END SUBROUTINE create_mt_section
     276              : 
     277              : ! **************************************************************************************************
     278              : !> \brief ...
     279              : !> \param section will contain the ewald section
     280              : !> \author fawzi
     281              : ! **************************************************************************************************
     282        31393 :    SUBROUTINE create_ewald_section(section)
     283              :       TYPE(section_type), POINTER                        :: section
     284              : 
     285              :       TYPE(keyword_type), POINTER                        :: keyword
     286              :       TYPE(section_type), POINTER                        :: print_key, subsection
     287              : 
     288        31393 :       CPASSERT(.NOT. ASSOCIATED(section))
     289              :       CALL section_create(section, __LOCATION__, name="ewald", &
     290              :                           description="Ewald parameters controlling electrostatic only for CLASSICAL MM.", &
     291              :                           n_keywords=7, n_subsections=0, repeats=.FALSE., &
     292       188358 :                           citations=[Ewald1921, Darden1993, Essmann1995, Toukmaji1996, Laino2008])
     293              : 
     294        31393 :       NULLIFY (keyword, print_key, subsection)
     295              :       CALL keyword_create( &
     296              :          keyword, __LOCATION__, name="EWALD_TYPE", &
     297              :          description="The type of ewald you want to perform.", &
     298              :          citations=[Ewald1921, Essmann1995, Darden1993], &
     299              :          usage="EWALD_TYPE (NONE|EWALD|PME|SPME)", &
     300              :          default_i_val=do_ewald_ewald, &
     301              :          enum_c_vals=["none     ", &
     302              :                       "ewald    ", &
     303              :                       "pme      ", &
     304              :                       "spme     "], &
     305              :          enum_i_vals=[do_ewald_none, &
     306              :                       do_ewald_ewald, &
     307              :                       do_ewald_pme, &
     308              :                       do_ewald_spme], &
     309              :          enum_desc=s2a("NONE standard real-space coulomb potential is computed together with the non-bonded contributions", &
     310              :                        "EWALD is the standard non-fft based ewald", &
     311              :                        "PME is the particle mesh using fft interpolation", &
     312       251144 :                        "SPME is the smooth particle mesh using beta-Euler splines (recommended)"))
     313        31393 :       CALL section_add_keyword(section, keyword)
     314        31393 :       CALL keyword_release(keyword)
     315              : 
     316              :       CALL keyword_create(keyword, __LOCATION__, name="EWALD_ACCURACY", &
     317              :                           description="Expected accuracy in the Ewald sum. This number affects only the calculation of "// &
     318              :                           "the cutoff for the real-space term of the ewald summation (EWALD|PME|SPME) as well as the "// &
     319              :                           "construction of the neighbor lists (if the cutoff for non-bonded terms is smaller than the "// &
     320              :                           "value employed to compute the EWALD real-space term). This keyword has no "// &
     321              :                           "effect on the reciprocal space term (which can be tuned independently).", &
     322              :                           usage="EWALD_ACCURACY {real}", n_var=1, type_of_var=real_t, &
     323        31393 :                           unit_str="hartree", default_r_val=1.0E-6_dp)
     324        31393 :       CALL section_add_keyword(section, keyword)
     325        31393 :       CALL keyword_release(keyword)
     326              : 
     327              :       CALL keyword_create(keyword, __LOCATION__, name="RCUT", &
     328              :                           description="Explicitly provide the real-space cutoff of the ewald summation (EWALD|PME|SPME). "// &
     329              :                           "This value is ignored in Tight-binding applications (rcut from basis overlap is used). "// &
     330              :                           "If present, overwrites the estimate of EWALD_ACCURACY and may affect the "// &
     331              :                           "construction of the neighbor lists for non-bonded terms (in FIST), if the value "// &
     332              :                           "specified is larger than the cutoff for non-bonded interactions.", &
     333        31393 :                           usage="RCUT 5.0", n_var=1, type_of_var=real_t, unit_str="angstrom")
     334        31393 :       CALL section_add_keyword(section, keyword)
     335        31393 :       CALL keyword_release(keyword)
     336              : 
     337              :       CALL keyword_create(keyword, __LOCATION__, name="alpha", &
     338              :                           description="alpha parameter associated with Ewald (EWALD|PME|SPME). "// &
     339              :                           "Recommended for small systems is alpha = 3.5 / r_cut. "// &
     340              :                           "Tuning alpha, r_cut and gmax is needed to obtain O(N**1.5) scaling for ewald.", &
     341              :                           usage="alpha .30", &
     342              :                           default_r_val=cp_unit_to_cp2k(value=0.35_dp, unit_str="angstrom^-1"), &
     343        31393 :                           unit_str='angstrom^-1')
     344        31393 :       CALL section_add_keyword(section, keyword)
     345        31393 :       CALL keyword_release(keyword)
     346              : 
     347              :       CALL keyword_create(keyword, __LOCATION__, name="gmax", &
     348              :                           description="number of grid points (SPME and EWALD). If a single number is specified, "// &
     349              :                           "the same number of points is used for all three directions on the grid. "// &
     350              :                           "If three numbers are given, each direction can have a different number of points. "// &
     351              :                           "The number of points needs to be FFTable (which depends on the library used) and odd for EWALD. "// &
     352              :                           "The optimal number depends e.g. on alpha and the size of the cell. 1 point per Angstrom is common.", &
     353        31393 :                           usage="gmax 25 25 25", n_var=-1, type_of_var=integer_t)
     354        31393 :       CALL section_add_keyword(section, keyword)
     355        31393 :       CALL keyword_release(keyword)
     356              : 
     357              :       CALL keyword_create(keyword, __LOCATION__, name="ns_max", &
     358              :                           description="number of grid points on small mesh (PME only), should be odd.", &
     359        31393 :                           usage="ns_max 11", default_i_val=11)
     360        31393 :       CALL section_add_keyword(section, keyword)
     361        31393 :       CALL keyword_release(keyword)
     362              : 
     363              :       CALL keyword_create(keyword, __LOCATION__, name="o_spline", &
     364              :                           description="order of the beta-Euler spline (SPME only)", &
     365        31393 :                           usage="o_spline 6", default_i_val=6)
     366        31393 :       CALL section_add_keyword(section, keyword)
     367        31393 :       CALL keyword_release(keyword)
     368              : 
     369              :       CALL keyword_create(keyword, __LOCATION__, name="epsilon", &
     370              :                           description="tolerance of gaussians for fft interpolation (PME only)", &
     371        31393 :                           usage="epsilon 1e-6", default_r_val=1.e-6_dp)
     372        31393 :       CALL section_add_keyword(section, keyword)
     373        31393 :       CALL keyword_release(keyword)
     374              : 
     375        31393 :       NULLIFY (subsection)
     376        31393 :       CALL create_rsgrid_section(subsection)
     377        31393 :       CALL section_add_subsection(section, subsection)
     378        31393 :       CALL section_release(subsection)
     379              : 
     380        31393 :       NULLIFY (subsection)
     381              :       CALL section_create(subsection, __LOCATION__, name="MULTIPOLES", &
     382              :                           description="Enables the use of multipoles in the treatment of the electrostatics.", &
     383              :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
     384        94179 :                           citations=[Aguado2003, Laino2008])
     385              : 
     386              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     387              :                           description="Controls the activation of the Multipoles", &
     388        31393 :                           usage="&MULTIPOLES T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     389        31393 :       CALL section_add_keyword(subsection, keyword)
     390        31393 :       CALL keyword_release(keyword)
     391              : 
     392              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_MULTIPOLE_EXPANSION", &
     393              :                           description="Specify the maximum level of multipoles expansion used "// &
     394              :                           "for the electrostatics.", &
     395              :                           usage="MAX_MULTIPOLE_EXPANSION DIPOLE", &
     396              :                           enum_c_vals=s2a("NONE", "CHARGE", "DIPOLE", "QUADRUPOLE"), &
     397              :                           enum_desc=s2a("No multipolar terms! Check the codes providing a zero contribution.", &
     398              :                                         "Use up to the Charge term", &
     399              :                                         "Use up to the Dipole term", &
     400              :                                         "Use up to the Quadrupole term"), &
     401              :                           enum_i_vals=[do_multipole_none, do_multipole_charge, do_multipole_dipole, &
     402        31393 :                                        do_multipole_quadrupole], type_of_var=enum_t)
     403        31393 :       CALL section_add_keyword(subsection, keyword)
     404        31393 :       CALL keyword_release(keyword)
     405              : 
     406              :       CALL keyword_create(keyword, __LOCATION__, name="POL_SCF", &
     407              :                           description="Specify the method to obtain self consistent induced "// &
     408              :                           "multipole moments.", &
     409              :                           usage="POL_SCF CONJUGATE_GRADIENT", &
     410              :                           enum_c_vals=s2a("NONE", "SELF_CONSISTENT", "CONJUGATE_GRADIENT"), &
     411              :                           enum_desc=s2a("No inducible multipoles.", &
     412              :                                         "Conventional self-consistent iteration.", &
     413              :                                         "Linear conjugate-gradient optimization of the sum "// &
     414              :                                         "of the electrostatic and induction energy. This "// &
     415              :                                         "method does not support non-linear polarization "// &
     416              :                                         "but is sometimes faster."), &
     417              :                           enum_i_vals=[do_fist_pol_none, do_fist_pol_sc, do_fist_pol_cg], &
     418        31393 :                           type_of_var=enum_t, default_i_val=do_fist_pol_none)
     419        31393 :       CALL section_add_keyword(subsection, keyword)
     420        31393 :       CALL keyword_release(keyword)
     421              : 
     422              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_IPOL_ITER", &
     423              :                           description="Specify the maximum number of iterations for induced "// &
     424              :                           "dipoles", &
     425              :                           usage="MAX_IPOL_ITER {int}", type_of_var=integer_t, &
     426        31393 :                           n_var=1, default_i_val=0)
     427        31393 :       CALL section_add_keyword(subsection, keyword)
     428        31393 :       CALL keyword_release(keyword)
     429              : 
     430              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_POL", &
     431              :                           description="Specify the rmsd threshold for the derivatives "// &
     432              :                           "of the energy towards the Cartesian dipoles components", &
     433              :                           usage="EPS_POL {real}", type_of_var=real_t, &
     434        31393 :                           n_var=1, default_r_val=0.5e-07_dp)
     435        31393 :       CALL section_add_keyword(subsection, keyword)
     436        31393 :       CALL keyword_release(keyword)
     437              : 
     438        31393 :       CALL section_add_subsection(section, subsection)
     439        31393 :       CALL section_release(subsection)
     440              : 
     441        31393 :       NULLIFY (subsection)
     442              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
     443              :                           description="Controls printing of Ewald properties", &
     444        31393 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     445        31393 :       NULLIFY (print_key)
     446              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     447              :                                        description="controls the printing of ewald setup", &
     448        31393 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     449        31393 :       CALL section_add_subsection(subsection, print_key)
     450        31393 :       CALL section_release(print_key)
     451        31393 :       CALL section_add_subsection(section, subsection)
     452        31393 :       CALL section_release(subsection)
     453              : 
     454        31393 :    END SUBROUTINE create_ewald_section
     455              : 
     456              : ! **************************************************************************************************
     457              : !> \brief creates the interpolation section for the periodic QM/MM
     458              : !> \param section ...
     459              : !> \author tlaino
     460              : ! **************************************************************************************************
     461        49131 :    SUBROUTINE create_gspace_interp_section(section)
     462              :       TYPE(section_type), POINTER                        :: section
     463              : 
     464              :       TYPE(keyword_type), POINTER                        :: keyword
     465              :       TYPE(section_type), POINTER                        :: print_key
     466              : 
     467        49131 :       CPASSERT(.NOT. ASSOCIATED(section))
     468              :       CALL section_create(section, __LOCATION__, name="interpolator", &
     469              :                           description="controls the interpolation for the G-space term", &
     470        49131 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     471              : 
     472        49131 :       NULLIFY (keyword, print_key)
     473              : 
     474              :       CALL keyword_create(keyword, __LOCATION__, name="aint_precond", &
     475              :                           description="the approximate inverse to use to get the starting point"// &
     476              :                           " for the linear solver of the spline3 methods", &
     477              :                           usage="aint_precond copy", &
     478              :                           default_i_val=precond_spl3_aint, &
     479              :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
     480              :                                           "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
     481              :                           enum_i_vals=[no_precond, precond_spl3_aint, precond_spl3_1, &
     482        49131 :                                        precond_spl3_aint2, precond_spl3_2, precond_spl3_3])
     483        49131 :       CALL section_add_keyword(section, keyword)
     484        49131 :       CALL keyword_release(keyword)
     485              : 
     486              :       CALL keyword_create(keyword, __LOCATION__, name="precond", &
     487              :                           description="The preconditioner used"// &
     488              :                           " for the linear solver of the spline3 methods", &
     489              :                           usage="precond copy", &
     490              :                           default_i_val=precond_spl3_3, &
     491              :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
     492              :                                           "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
     493              :                           enum_i_vals=[no_precond, precond_spl3_aint, precond_spl3_1, &
     494        49131 :                                        precond_spl3_aint2, precond_spl3_2, precond_spl3_3])
     495        49131 :       CALL section_add_keyword(section, keyword)
     496        49131 :       CALL keyword_release(keyword)
     497              : 
     498              :       CALL keyword_create(keyword, __LOCATION__, name="eps_x", &
     499              :                           description="accuracy on the solution for spline3 the interpolators", &
     500        49131 :                           usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
     501        49131 :       CALL section_add_keyword(section, keyword)
     502        49131 :       CALL keyword_release(keyword)
     503              : 
     504              :       CALL keyword_create(keyword, __LOCATION__, name="eps_r", &
     505              :                           description="accuracy on the residual for spline3 the interpolators", &
     506        49131 :                           usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
     507        49131 :       CALL section_add_keyword(section, keyword)
     508        49131 :       CALL keyword_release(keyword)
     509              : 
     510              :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
     511              :                           variants=['maxiter'], &
     512              :                           description="the maximum number of iterations", &
     513        98262 :                           usage="max_iter 200", default_i_val=100)
     514        49131 :       CALL section_add_keyword(section, keyword)
     515        49131 :       CALL keyword_release(keyword)
     516              : 
     517        49131 :       NULLIFY (print_key)
     518              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "conv_info", &
     519              :                                        description="if convergence information about the linear solver"// &
     520              :                                        " of the spline methods should be printed", &
     521              :                                        print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
     522              :                                        each_iter_values=[10], filename="__STD_OUT__", &
     523        49131 :                                        add_last=add_last_numeric)
     524        49131 :       CALL section_add_subsection(section, print_key)
     525        49131 :       CALL section_release(print_key)
     526              : 
     527        49131 :    END SUBROUTINE create_gspace_interp_section
     528              : 
     529              : ! **************************************************************************************************
     530              : !> \brief Creates the wavelet section
     531              : !> \param section the section to create
     532              : !> \author fschiff
     533              : !> \note
     534              : !>      this approach is based on the development of T. Deutsch and S. Goedecker
     535              : ! **************************************************************************************************
     536        29485 :    SUBROUTINE create_wavelet_section(section)
     537              :       TYPE(section_type), POINTER                        :: section
     538              : 
     539              :       TYPE(keyword_type), POINTER                        :: keyword
     540              : 
     541        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     542              :       CALL section_create( &
     543              :          section, __LOCATION__, name="wavelet", &
     544              :          description="Sets up parameters of wavelet based poisson solver.", &
     545              :          n_keywords=1, n_subsections=0, repeats=.FALSE., &
     546        88455 :          citations=[Genovese2006, Genovese2007])
     547              : 
     548        29485 :       NULLIFY (keyword)
     549              : 
     550              :       CALL keyword_create( &
     551              :          keyword, __LOCATION__, name="SCF_TYPE", &
     552              :          description="Type of scaling function used in the wavelet approach, the total energy depends on this choice, "// &
     553              :          "and the convergence with respect to cutoff depends on the selected scaling functions. "// &
     554              :          "Possible values are 8,14,16,20,24,30,40,50,60,100", &
     555              :          usage="SCF_TYPE integer", &
     556        29485 :          n_var=1, default_i_val=40)
     557        29485 :       CALL section_add_keyword(section, keyword)
     558        29485 :       CALL keyword_release(keyword)
     559              : 
     560        29485 :    END SUBROUTINE create_wavelet_section
     561              : 
     562              : ! **************************************************************************************************
     563              : !> \brief Creates the section for the implicit (generalized) poisson solver
     564              : !> \param section the section to be created
     565              : !> \author Mohammad Hossein Bani-Hashemian
     566              : ! **************************************************************************************************
     567        29485 :    SUBROUTINE create_implicit_ps_section(section)
     568              :       TYPE(section_type), POINTER                        :: section
     569              : 
     570              :       TYPE(keyword_type), POINTER                        :: keyword
     571              :       TYPE(section_type), POINTER                        :: subsection
     572              : 
     573        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     574              :       CALL section_create(section, __LOCATION__, name="IMPLICIT", &
     575              :                           description="Parameters for the implicit (generalized) Poisson solver.", &
     576              :                           citations=[BaniHashemian2016], &
     577        58970 :                           n_keywords=6, n_subsections=2, repeats=.FALSE.)
     578              : 
     579        29485 :       NULLIFY (subsection, keyword)
     580              : 
     581        29485 :       CALL create_dielectric_section(subsection)
     582        29485 :       CALL section_add_subsection(section, subsection)
     583        29485 :       CALL section_release(subsection)
     584              : 
     585        29485 :       CALL create_dbc_section(subsection)
     586        29485 :       CALL section_add_subsection(section, subsection)
     587        29485 :       CALL section_release(subsection)
     588              : 
     589              :       CALL keyword_create( &
     590              :          keyword, __LOCATION__, name="BOUNDARY_CONDITIONS", &
     591              :          enum_c_vals=s2a('PERIODIC', 'MIXED', 'MIXED_PERIODIC', 'NEUMANN'), &
     592              :          enum_desc=s2a('periodic boundary conditions', 'Dirichlet + homogeneous Neumann boundary conditions', &
     593              :                        'Dirichlet + periodic boundary conditions', 'homogeneous Neumann BC (zero-average solution)'), &
     594              :          enum_i_vals=[PERIODIC_BC, MIXED_BC, MIXED_PERIODIC_BC, NEUMANN_BC], &
     595              :          description="Specifies the type of boundary conditions. Dirichlet=fixed value, Neumann=zero normal deriv. "// &
     596              :          "Mixed and Neumann boundaries essentially requires FFTW3 so that all grid sizes are FFT-able.", &
     597        29485 :          usage="BOUNDARY_CONDITIONS <bc_type>", default_i_val=PERIODIC_BC)
     598        29485 :       CALL section_add_keyword(section, keyword)
     599        29485 :       CALL keyword_release(keyword)
     600              : 
     601              :       CALL keyword_create(keyword, __LOCATION__, name="ZERO_INITIAL_GUESS", &
     602              :                           description="Whether or not to use zero potential as initial guess.", &
     603        29485 :                           usage="ZERO_INITIAL_GUESS <logical>", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     604        29485 :       CALL section_add_keyword(section, keyword)
     605        29485 :       CALL keyword_release(keyword)
     606              : 
     607              :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
     608              :                           description="Maximum number of iterations.", &
     609        29485 :                           usage="max_iter <integer>", default_i_val=30)
     610        29485 :       CALL section_add_keyword(section, keyword)
     611        29485 :       CALL keyword_release(keyword)
     612              : 
     613              :       CALL keyword_create(keyword, __LOCATION__, name="tol", &
     614              :                           description="Stopping tolerance.", &
     615        29485 :                           usage="tol <real>", default_r_val=1.0E-8_dp)
     616        29485 :       CALL section_add_keyword(section, keyword)
     617        29485 :       CALL keyword_release(keyword)
     618              : 
     619              :       CALL keyword_create(keyword, __LOCATION__, name="OR_PARAMETER", variants=s2a('omega'), &
     620              :                           description="Over-relaxation parameter (large epsilon requires smaller omega ~0.1).", &
     621        29485 :                           usage="OR_PARAMETER <real>", default_r_val=1.0_dp)
     622        29485 :       CALL section_add_keyword(section, keyword)
     623        29485 :       CALL keyword_release(keyword)
     624              : 
     625              :       CALL keyword_create( &
     626              :          keyword, __LOCATION__, name="NEUMANN_DIRECTIONS", &
     627              :          enum_c_vals=s2a('XYZ', 'XY', 'XZ', 'YZ', 'X', 'Y', 'Z'), &
     628              :          enum_i_vals=[neumannXYZ, neumannXY, neumannXZ, neumannYZ, neumannX, neumannY, neumannZ], &
     629              :          description="Directions in which homogeneous Neumann conditions are imposed. In the remaining directions "// &
     630              :          "periodic conditions will be enforced. Having specified MIXED or NEUMANN as BOUNDARY_CONDITIONS, "// &
     631              :          "the keyword is meant to be used to combine periodic and homogeneous Neumann conditions at the "// &
     632              :          "boundaries of the simulation cell.", &
     633        29485 :          usage="NEUMANN_DIRECTIONS <direction>", default_i_val=neumannXYZ)
     634        29485 :       CALL section_add_keyword(section, keyword)
     635        29485 :       CALL keyword_release(keyword)
     636              : 
     637        29485 :    END SUBROUTINE create_implicit_ps_section
     638              : 
     639              : ! **************************************************************************************************
     640              : !> \brief Creates the dielectric constant section.
     641              : !>  The dielectric constant is defined as a function of electronic density.
     642              : !>  [see O. Andreussi, I. Dabo, and N. Marzari, J. Chem. Phys., 136, 064102(2012)]
     643              : !> \param section the section to be created
     644              : !> \author Mohammad Hossein Bani-Hashemian
     645              : ! **************************************************************************************************
     646        29485 :    SUBROUTINE create_dielectric_section(section)
     647              :       TYPE(section_type), POINTER                        :: section
     648              : 
     649              :       TYPE(keyword_type), POINTER                        :: keyword
     650              :       TYPE(section_type), POINTER                        :: subsection
     651              : 
     652        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     653              :       CALL section_create(section, __LOCATION__, name="DIELECTRIC", &
     654              :                           description="Parameters for the dielectric constant function.", &
     655        29485 :                           n_keywords=6, n_subsections=2, repeats=.FALSE.)
     656              : 
     657        29485 :       NULLIFY (keyword, subsection)
     658              : 
     659              :       CALL keyword_create(keyword, __LOCATION__, name="DIELECTRIC_CORE_CORRECTION", &
     660              :                           description="Avoid spurious values of the dielectric constant at the ionic core for pseudopotentials "// &
     661              :                           "where the electron density goes to zero at the core (e.g. GTH). "// &
     662              :                           "The correction is based on rho_core.", &
     663        29485 :                           usage="DIELECTRIC_CORE_CORRECTION <logical>", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     664        29485 :       CALL section_add_keyword(section, keyword)
     665        29485 :       CALL keyword_release(keyword)
     666              : 
     667              :       CALL keyword_create( &
     668              :          keyword, __LOCATION__, name="DIELECTRIC_FUNCTION_TYPE", &
     669              :          enum_c_vals=s2a('density_dependent', 'spatially_dependent', 'spatially_rho_dependent'), &
     670              :          enum_i_vals=[rho_dependent, spatially_dependent, spatially_rho_dependent], &
     671              :          enum_desc=s2a("Dielectric constant as a function of the electron density "// &
     672              :                        "as e.g. proposed within the SCCS model.", &
     673              :                        "Various regions with different dielectric constants.", &
     674              :                        "Various regions with different dielectric constants. The dielectric constant decays to 1.0, "// &
     675              :                        "wherever the electron density is present."), &
     676              :          description="Preferred type for the dielectric constant function.", &
     677        29485 :          usage="DIELECTRIC_FUNCTION_TYPE  <method>", default_i_val=rho_dependent)
     678        29485 :       CALL section_add_keyword(section, keyword)
     679        29485 :       CALL keyword_release(keyword)
     680              : 
     681              :       CALL keyword_create(keyword, __LOCATION__, name="dielectric_constant", variants=s2a('epsilon'), &
     682              :                           description="Dielectric constant in the bulk of the solvent.", &
     683        29485 :                           usage="dielectric_constant <real>", default_r_val=80.0_dp)
     684        29485 :       CALL section_add_keyword(section, keyword)
     685        29485 :       CALL keyword_release(keyword)
     686              : 
     687              :       CALL keyword_create(keyword, __LOCATION__, name="rho_min", &
     688              :                           description="Lower density threshold.", &
     689        29485 :                           usage="rho_min <real>", default_r_val=1.0E-4_dp)
     690        29485 :       CALL section_add_keyword(section, keyword)
     691        29485 :       CALL keyword_release(keyword)
     692              : 
     693              :       CALL keyword_create(keyword, __LOCATION__, name="rho_max", &
     694              :                           description="Upper density threshold.", &
     695        29485 :                           usage="rho_max <real>", default_r_val=1.0E-3_dp)
     696        29485 :       CALL section_add_keyword(section, keyword)
     697        29485 :       CALL keyword_release(keyword)
     698              : 
     699              :       CALL keyword_create( &
     700              :          keyword, __LOCATION__, name="DERIVATIVE_METHOD", &
     701              :          enum_c_vals=s2a('fft', 'fft_use_deps', 'fft_use_drho', 'cd3', 'cd5', 'cd7'), &
     702              :          enum_i_vals=[derivative_fft, derivative_fft_use_deps, derivative_fft_use_drho, &
     703              :                       derivative_cd3, derivative_cd5, derivative_cd7], &
     704              :          enum_desc=s2a("FFT based deriv of epsilon, without correction (high cutoff needed).", &
     705              :                        "FFT based deriv of epsilon, with correction using gradient of epsilon (high cutoff needed).", &
     706              :                        "FFT based deriv of epsilon, with correction using gradient of rho (high cutoff needed).", &
     707              :                        "3-point central difference derivative.", &
     708              :                        "5-point central difference derivative.", &
     709              :                        "7-point central difference derivative (recommended)."), &
     710              :          description="Preferred method for evaluating the gradient of ln(eps).", &
     711        29485 :          usage="DERIVATIVE_METHOD  <method>", default_i_val=derivative_cd7)
     712        29485 :       CALL section_add_keyword(section, keyword)
     713        29485 :       CALL keyword_release(keyword)
     714              : 
     715        29485 :       CALL create_dielec_aa_cuboidal_section(subsection)
     716        29485 :       CALL section_add_subsection(section, subsection)
     717        29485 :       CALL section_release(subsection)
     718              : 
     719        29485 :       CALL create_dielec_xaa_annular_section(subsection)
     720        29485 :       CALL section_add_subsection(section, subsection)
     721        29485 :       CALL section_release(subsection)
     722              : 
     723        29485 :    END SUBROUTINE create_dielectric_section
     724              : 
     725              : ! **************************************************************************************************
     726              : !> \brief Creates the section for creating axis-aligned cuboidal dielectric region.
     727              : !> \param section the section to be created
     728              : !> \author Mohammad Hossein Bani-Hashemian
     729              : ! **************************************************************************************************
     730        29485 :    SUBROUTINE create_dielec_aa_cuboidal_section(section)
     731              :       TYPE(section_type), POINTER                        :: section
     732              : 
     733              :       TYPE(keyword_type), POINTER                        :: keyword
     734              : 
     735        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     736              :       CALL section_create(section, __LOCATION__, name="DIELEC_AA_CUBOIDAL", &
     737              :                           description="Parameters for creating axis-aligned cuboidal dielectric region. "// &
     738              :                           "Note that once such a region is defined, the 'background' dielectric constant "// &
     739              :                           "would be the default (80.0), unless a different value is specified using the "// &
     740              :                           "keyword IMPLICIT%DIELECTRIC%DIELECTRIC_CONSTANT.", &
     741        29485 :                           n_keywords=5, n_subsections=0, repeats=.TRUE.)
     742              : 
     743        29485 :       NULLIFY (keyword)
     744              : 
     745              :       CALL keyword_create(keyword, __LOCATION__, name="dielectric_constant", variants=s2a('epsilon'), &
     746              :                           description="value of the dielectric constant inside the region.", &
     747        29485 :                           usage="dielectric_constant <real>", default_r_val=80.0_dp)
     748        29485 :       CALL section_add_keyword(section, keyword)
     749        29485 :       CALL keyword_release(keyword)
     750              : 
     751              :       CALL keyword_create(keyword, __LOCATION__, name="X_xtnt", &
     752              :                           description="The X extents of the cuboid.", &
     753              :                           usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
     754        29485 :                           n_var=2, type_of_var=real_t)
     755        29485 :       CALL section_add_keyword(section, keyword)
     756        29485 :       CALL keyword_release(keyword)
     757              : 
     758              :       CALL keyword_create(keyword, __LOCATION__, name="Y_xtnt", &
     759              :                           description="The Y extents of the cuboid.", &
     760              :                           usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
     761        29485 :                           n_var=2, type_of_var=real_t)
     762        29485 :       CALL section_add_keyword(section, keyword)
     763        29485 :       CALL keyword_release(keyword)
     764              : 
     765              :       CALL keyword_create(keyword, __LOCATION__, name="Z_xtnt", &
     766              :                           description="The Z extents of the cuboid.", &
     767              :                           usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
     768        29485 :                           n_var=2, type_of_var=real_t)
     769        29485 :       CALL section_add_keyword(section, keyword)
     770        29485 :       CALL keyword_release(keyword)
     771              : 
     772              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING_WIDTH", variants=s2a('zeta'), &
     773              :                           description="The width of the standard mollifier.", &
     774              :                           usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
     775        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
     776        29485 :       CALL section_add_keyword(section, keyword)
     777        29485 :       CALL keyword_release(keyword)
     778              : 
     779        29485 :    END SUBROUTINE create_dielec_aa_cuboidal_section
     780              : 
     781              : ! **************************************************************************************************
     782              : !> \brief Creates the section for creating x-axis-aligned annular dielectric region.
     783              : !> \param section the section to be created
     784              : !> \author Mohammad Hossein Bani-Hashemian
     785              : ! **************************************************************************************************
     786        29485 :    SUBROUTINE create_dielec_xaa_annular_section(section)
     787              :       TYPE(section_type), POINTER                        :: section
     788              : 
     789              :       TYPE(keyword_type), POINTER                        :: keyword
     790              : 
     791        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     792              :       CALL section_create(section, __LOCATION__, name="DIELEC_XAA_ANNULAR", &
     793              :                           description="Parameters for creating x-axis-aligned annular dielectric region. "// &
     794              :                           "Note that once such a region is defined, the 'background' dielectric constant "// &
     795              :                           "would be the default (80.0), unless a different value is specified using the "// &
     796              :                           "keyword IMPLICIT%DIELECTRIC%DIELECTRIC_CONSTANT.", &
     797        29485 :                           n_keywords=5, n_subsections=0, repeats=.TRUE.)
     798              : 
     799        29485 :       NULLIFY (keyword)
     800              : 
     801              :       CALL keyword_create(keyword, __LOCATION__, name="dielectric_constant", variants=s2a('epsilon'), &
     802              :                           description="value of the dielectric constant inside the region.", &
     803        29485 :                           usage="dielectric_constant <real>", default_r_val=80.0_dp)
     804        29485 :       CALL section_add_keyword(section, keyword)
     805        29485 :       CALL keyword_release(keyword)
     806              : 
     807              :       CALL keyword_create(keyword, __LOCATION__, name="X_xtnt", &
     808              :                           description="The X extents of the annulus.", &
     809              :                           usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
     810        29485 :                           n_var=2, type_of_var=real_t)
     811        29485 :       CALL section_add_keyword(section, keyword)
     812        29485 :       CALL keyword_release(keyword)
     813              : 
     814              :       CALL keyword_create(keyword, __LOCATION__, name="base_center", &
     815              :                           description="The y and z coordinates of the annulus' base center.", &
     816              :                           usage="base_center <y(real)> <z(real)>", unit_str="angstrom", &
     817        29485 :                           n_var=2, type_of_var=real_t)
     818        29485 :       CALL section_add_keyword(section, keyword)
     819        29485 :       CALL keyword_release(keyword)
     820              : 
     821              :       CALL keyword_create(keyword, __LOCATION__, name="base_radii", &
     822              :                           description="The base radius of the annulus.", &
     823              :                           usage="base_radii <r1(real)> <r2(real)>", unit_str="angstrom", &
     824        29485 :                           n_var=2, type_of_var=real_t)
     825        29485 :       CALL section_add_keyword(section, keyword)
     826        29485 :       CALL keyword_release(keyword)
     827              : 
     828              :       CALL keyword_create(keyword, __LOCATION__, name="smoothing_width", variants=s2a('zeta'), &
     829              :                           description="The width of the standard mollifier.", &
     830              :                           usage="smoothing_width <real>", unit_str="angstrom", &
     831        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
     832        29485 :       CALL section_add_keyword(section, keyword)
     833        29485 :       CALL keyword_release(keyword)
     834              : 
     835        29485 :    END SUBROUTINE create_dielec_xaa_annular_section
     836              : 
     837              : ! **************************************************************************************************
     838              : !> \brief Creates the section for Dirichlet boundary conditions
     839              : !> \param section the section to be created
     840              : !> \author Mohammad Hossein Bani-Hashemian
     841              : ! **************************************************************************************************
     842        29485 :    SUBROUTINE create_dbc_section(section)
     843              :       TYPE(section_type), POINTER                        :: section
     844              : 
     845              :       TYPE(keyword_type), POINTER                        :: keyword
     846              :       TYPE(section_type), POINTER                        :: subsection
     847              : 
     848        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     849              :       CALL section_create(section, __LOCATION__, name="DIRICHLET_BC", &
     850              :                           description="Parameters for creating Dirichlet type boundary conditions.", &
     851        29485 :                           n_keywords=1, n_subsections=4, repeats=.FALSE.)
     852              : 
     853        29485 :       NULLIFY (keyword)
     854              : 
     855              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE_OUTPUT", &
     856              :                           description="Print out the coordinates of the vertices defining Dirichlet regions and their "// &
     857              :                           "tessellations (in Angstrom), the values of the electrostatic potential at the regions (in a.u.), "// &
     858              :                           "and their corresponding evaluated Lagrange multipliers.", &
     859        29485 :                           usage="VERBOSE_OUTPUT <logical>", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     860        29485 :       CALL section_add_keyword(section, keyword)
     861        29485 :       CALL keyword_release(keyword)
     862              : 
     863        29485 :       NULLIFY (subsection)
     864              : 
     865        29485 :       CALL create_aa_planar_section(subsection)
     866        29485 :       CALL section_add_subsection(section, subsection)
     867        29485 :       CALL section_release(subsection)
     868              : 
     869        29485 :       CALL create_planar_section(subsection)
     870        29485 :       CALL section_add_subsection(section, subsection)
     871        29485 :       CALL section_release(subsection)
     872              : 
     873        29485 :       CALL create_aa_cylindrical_section(subsection)
     874        29485 :       CALL section_add_subsection(section, subsection)
     875        29485 :       CALL section_release(subsection)
     876              : 
     877        29485 :       CALL create_aa_cuboidal_section(subsection)
     878        29485 :       CALL section_add_subsection(section, subsection)
     879        29485 :       CALL section_release(subsection)
     880              : 
     881        29485 :    END SUBROUTINE create_dbc_section
     882              : 
     883              : ! **************************************************************************************************
     884              : !> \brief Creates the section for creating axis-aligned planar Dirichlet BC.
     885              : !> \param section the section to be created
     886              : !> \author Mohammad Hossein Bani-Hashemian
     887              : ! **************************************************************************************************
     888        29485 :    SUBROUTINE create_aa_planar_section(section)
     889              :       TYPE(section_type), POINTER                        :: section
     890              : 
     891              :       TYPE(keyword_type), POINTER                        :: keyword
     892              : 
     893        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
     894              :       CALL section_create(section, __LOCATION__, name="AA_PLANAR", &
     895              :                           description="Parameters for creating axis-aligned planar (rectangular) Dirichlet boundary regions.", &
     896        29485 :                           n_keywords=10, n_subsections=0, repeats=.TRUE.)
     897              : 
     898        29485 :       NULLIFY (keyword)
     899              : 
     900              :       CALL keyword_create(keyword, __LOCATION__, name="v_D", &
     901              :                           description="The value of the fixed potential to be imposed at the axis-aligned Dirichlet boundary.", &
     902        29485 :                           usage="v_D <real>", unit_str="volt", type_of_var=real_t)
     903        29485 :       CALL section_add_keyword(section, keyword)
     904        29485 :       CALL keyword_release(keyword)
     905              : 
     906              :       CALL keyword_create(keyword, __LOCATION__, name="OSCILLATING_FRACTION", &
     907              :                           description="A fraction of the field can be set to oscilate over time.", &
     908        29485 :                           usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
     909        29485 :       CALL section_add_keyword(section, keyword)
     910        29485 :       CALL keyword_release(keyword)
     911              : 
     912              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
     913              :                           description="The frequency with which the oscillating fraction oscillates.", &
     914        29485 :                           usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
     915        29485 :       CALL section_add_keyword(section, keyword)
     916        29485 :       CALL keyword_release(keyword)
     917              : 
     918              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
     919              :                           description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
     920        29485 :                           usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
     921        29485 :       CALL section_add_keyword(section, keyword)
     922        29485 :       CALL keyword_release(keyword)
     923              : 
     924              :       CALL keyword_create(keyword, __LOCATION__, name="PARALLEL_PLANE", &
     925              :                           enum_c_vals=s2a('XY', 'YZ', 'XZ'), &
     926              :                           enum_i_vals=[xy_plane, yz_plane, xz_plane], &
     927              :                           description="The coordinate plane that the region is parallel to.", &
     928              :                           usage="PARALLEL_PLANE <plane>", &
     929        29485 :                           type_of_var=enum_t)
     930        29485 :       CALL section_add_keyword(section, keyword)
     931        29485 :       CALL keyword_release(keyword)
     932              : 
     933              :       CALL keyword_create(keyword, __LOCATION__, name="INTERCEPT", &
     934              :                           description="The intercept of the rectangle's plane.", &
     935              :                           usage="INTERCEPT <real>", unit_str="angstrom", &
     936        29485 :                           type_of_var=real_t)
     937        29485 :       CALL section_add_keyword(section, keyword)
     938        29485 :       CALL keyword_release(keyword)
     939              : 
     940              :       CALL keyword_create(keyword, __LOCATION__, name="X_xtnt", &
     941              :                           description="The X extents of the rectangle.", &
     942              :                           usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
     943        29485 :                           n_var=2, type_of_var=real_t)
     944        29485 :       CALL section_add_keyword(section, keyword)
     945        29485 :       CALL keyword_release(keyword)
     946              : 
     947              :       CALL keyword_create(keyword, __LOCATION__, name="Y_xtnt", &
     948              :                           description="The Y extents of the rectangle.", &
     949              :                           usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
     950        29485 :                           n_var=2, type_of_var=real_t)
     951        29485 :       CALL section_add_keyword(section, keyword)
     952        29485 :       CALL keyword_release(keyword)
     953              : 
     954              :       CALL keyword_create(keyword, __LOCATION__, name="Z_xtnt", &
     955              :                           description="The Z extents of the rectangle.", &
     956              :                           usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
     957        29485 :                           n_var=2, type_of_var=real_t)
     958        29485 :       CALL section_add_keyword(section, keyword)
     959        29485 :       CALL keyword_release(keyword)
     960              : 
     961              :       CALL keyword_create(keyword, __LOCATION__, name="N_PRTN", &
     962              :                           description="The number of partitions in the directions of the unit vectors generating the "// &
     963              :                           "corresponding PARALLEL_PLANE (e1, e2 or e3) for tiling the rectangluar region.", &
     964              :                           usage="N_PRTN <integer> <integer>", &
     965        29485 :                           n_var=2, default_i_vals=[1, 1])
     966        29485 :       CALL section_add_keyword(section, keyword)
     967        29485 :       CALL keyword_release(keyword)
     968              : 
     969              :       CALL keyword_create(keyword, __LOCATION__, name="THICKNESS", &
     970              :                           description="The thickness of the planar Dirichlet region.", &
     971              :                           usage="THICKNESS <real>", unit_str="angstrom", &
     972        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
     973        29485 :       CALL section_add_keyword(section, keyword)
     974        29485 :       CALL keyword_release(keyword)
     975              : 
     976              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
     977              :                           description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
     978              :                           usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
     979        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
     980        29485 :       CALL section_add_keyword(section, keyword)
     981        29485 :       CALL keyword_release(keyword)
     982              : 
     983              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_REGION", &
     984              :                           description="Whether or not to take into consideration the effects of the periodicity of the "// &
     985              :                           "simulation cell (MIXED_PERIODIC bc) for regions defined sufficiently close to the boundaries.", &
     986        29485 :                           usage="PERIODIC_REGION <logical>", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     987        29485 :       CALL section_add_keyword(section, keyword)
     988        29485 :       CALL keyword_release(keyword)
     989              : 
     990        29485 :    END SUBROUTINE create_aa_planar_section
     991              : 
     992              : ! **************************************************************************************************
     993              : !> \brief Creates the section for creating axis-aligned planar Dirichlet BC.
     994              : !> \param section the section to be created
     995              : !> \author Mohammad Hossein Bani-Hashemian
     996              : ! **************************************************************************************************
     997        29485 :    SUBROUTINE create_planar_section(section)
     998              :       TYPE(section_type), POINTER                        :: section
     999              : 
    1000              :       TYPE(keyword_type), POINTER                        :: keyword
    1001              : 
    1002        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
    1003              :       CALL section_create( &
    1004              :          section, __LOCATION__, name="PLANAR", &
    1005              :          description="Parameters for creating planar (rectangular) Dirichlet boundary regions with given vertices.", &
    1006        29485 :          n_keywords=7, n_subsections=0, repeats=.TRUE.)
    1007              : 
    1008        29485 :       NULLIFY (keyword)
    1009              : 
    1010              :       CALL keyword_create(keyword, __LOCATION__, name="v_D", &
    1011              :                           description="The value of the fixed potential to be imposed at the planar Dirichlet boundary.", &
    1012        29485 :                           usage="v_D <real>", unit_str="volt", type_of_var=real_t)
    1013        29485 :       CALL section_add_keyword(section, keyword)
    1014        29485 :       CALL keyword_release(keyword)
    1015              : 
    1016              :       CALL keyword_create(keyword, __LOCATION__, name="OSCILLATING_FRACTION", &
    1017              :                           description="A fraction of the field can be set to oscilate over time.", &
    1018        29485 :                           usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1019        29485 :       CALL section_add_keyword(section, keyword)
    1020        29485 :       CALL keyword_release(keyword)
    1021              : 
    1022              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
    1023              :                           description="The frequency with which the oscillating fraction oscillates.", &
    1024        29485 :                           usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
    1025        29485 :       CALL section_add_keyword(section, keyword)
    1026        29485 :       CALL keyword_release(keyword)
    1027              : 
    1028              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
    1029              :                           description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
    1030        29485 :                           usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1031        29485 :       CALL section_add_keyword(section, keyword)
    1032        29485 :       CALL keyword_release(keyword)
    1033              : 
    1034              :       CALL keyword_create(keyword, __LOCATION__, name="A", &
    1035              :                           description="Coordinates of the vertex A.", &
    1036              :                           usage="A <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
    1037        29485 :                           n_var=3, type_of_var=real_t)
    1038        29485 :       CALL section_add_keyword(section, keyword)
    1039        29485 :       CALL keyword_release(keyword)
    1040              : 
    1041              :       CALL keyword_create(keyword, __LOCATION__, name="B", &
    1042              :                           description="Coordinates of the vertex B.", &
    1043              :                           usage="B <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
    1044        29485 :                           n_var=3, type_of_var=real_t)
    1045        29485 :       CALL section_add_keyword(section, keyword)
    1046        29485 :       CALL keyword_release(keyword)
    1047              : 
    1048              :       CALL keyword_create(keyword, __LOCATION__, name="C", &
    1049              :                           description="Coordinates of the vertex C.", &
    1050              :                           usage="C <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
    1051        29485 :                           n_var=3, type_of_var=real_t)
    1052        29485 :       CALL section_add_keyword(section, keyword)
    1053        29485 :       CALL keyword_release(keyword)
    1054              : 
    1055              :       CALL keyword_create( &
    1056              :          keyword, __LOCATION__, name="N_PRTN", &
    1057              :          description="The number of partitions along the edges for tiling the rectangular region. If the edges "// &
    1058              :          "have different lengths, from the two given values, the larger one will be assigned to the longer edge.", &
    1059              :          usage="N_PRTN <integer> <integer>", &
    1060        29485 :          n_var=2, default_i_vals=[1, 1])
    1061        29485 :       CALL section_add_keyword(section, keyword)
    1062        29485 :       CALL keyword_release(keyword)
    1063              : 
    1064              :       CALL keyword_create(keyword, __LOCATION__, name="THICKNESS", &
    1065              :                           description="The thickness of the planar Dirichlet region.", &
    1066              :                           usage="THICKNESS <real>", unit_str="angstrom", &
    1067        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
    1068        29485 :       CALL section_add_keyword(section, keyword)
    1069        29485 :       CALL keyword_release(keyword)
    1070              : 
    1071              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
    1072              :                           description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
    1073              :                           usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
    1074        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
    1075        29485 :       CALL section_add_keyword(section, keyword)
    1076        29485 :       CALL keyword_release(keyword)
    1077              : 
    1078        29485 :    END SUBROUTINE create_planar_section
    1079              : 
    1080              : ! **************************************************************************************************
    1081              : !> \brief Creates the section for creating x-axis-aligned cylindrical Dirichlet BC.
    1082              : !> \param section the section to be created
    1083              : !> \author Mohammad Hossein Bani-Hashemian
    1084              : ! **************************************************************************************************
    1085        29485 :    SUBROUTINE create_aa_cylindrical_section(section)
    1086              :       TYPE(section_type), POINTER                        :: section
    1087              : 
    1088              :       TYPE(keyword_type), POINTER                        :: keyword
    1089              : 
    1090        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
    1091              :       CALL section_create(section, __LOCATION__, name="AA_CYLINDRICAL", &
    1092              :                           description="Parameters for creating axis-aligned cylindrical Dirichlet boundary regions.", &
    1093        29485 :                           n_keywords=11, n_subsections=0, repeats=.TRUE.)
    1094              : 
    1095        29485 :       NULLIFY (keyword)
    1096              : 
    1097              :       CALL keyword_create(keyword, __LOCATION__, name="v_D", &
    1098              :                           description="The value of the fixed potential to be imposed at the cylindrical Dirichlet boundary.", &
    1099        29485 :                           usage="v_D <real>", unit_str="volt", type_of_var=real_t)
    1100        29485 :       CALL section_add_keyword(section, keyword)
    1101        29485 :       CALL keyword_release(keyword)
    1102              : 
    1103              :       CALL keyword_create(keyword, __LOCATION__, name="OSCILLATING_FRACTION", &
    1104              :                           description="A fraction of the field can be set to oscilate over time.", &
    1105        29485 :                           usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1106        29485 :       CALL section_add_keyword(section, keyword)
    1107        29485 :       CALL keyword_release(keyword)
    1108              : 
    1109              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
    1110              :                           description="The frequency with which the oscillating fraction oscillates.", &
    1111        29485 :                           usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
    1112        29485 :       CALL section_add_keyword(section, keyword)
    1113        29485 :       CALL keyword_release(keyword)
    1114              : 
    1115              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
    1116              :                           description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
    1117        29485 :                           usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1118        29485 :       CALL section_add_keyword(section, keyword)
    1119        29485 :       CALL keyword_release(keyword)
    1120              : 
    1121              :       CALL keyword_create(keyword, __LOCATION__, name="PARALLEL_AXIS", &
    1122              :                           enum_c_vals=s2a('X', 'Y', 'Z'), &
    1123              :                           enum_i_vals=[x_axis, y_axis, z_axis], &
    1124              :                           description="The coordinate axis that the cylindrical region extends along.", &
    1125              :                           usage="PARALLEL_AXIS <axis>", &
    1126        29485 :                           type_of_var=enum_t)
    1127        29485 :       CALL section_add_keyword(section, keyword)
    1128        29485 :       CALL keyword_release(keyword)
    1129              : 
    1130              :       CALL keyword_create(keyword, __LOCATION__, name="xtnt", &
    1131              :                           description="The extents of the cylinder along its central axis.", &
    1132              :                           usage="xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
    1133        29485 :                           n_var=2, type_of_var=real_t)
    1134        29485 :       CALL section_add_keyword(section, keyword)
    1135        29485 :       CALL keyword_release(keyword)
    1136              : 
    1137              :       CALL keyword_create(keyword, __LOCATION__, name="BASE_CENTER", &
    1138              :                           description="The y and z coordinates (x and z or x and y coordinates, "// &
    1139              :                           "depending on the choice of the parallel axis) of the cylinder's base center.", &
    1140              :                           usage="BASE_CENTER <y(real)> <z(real)>", unit_str="angstrom", &
    1141        29485 :                           n_var=2, type_of_var=real_t)
    1142        29485 :       CALL section_add_keyword(section, keyword)
    1143        29485 :       CALL keyword_release(keyword)
    1144              : 
    1145              :       CALL keyword_create(keyword, __LOCATION__, name="BASE_RADIUS", &
    1146              :                           description="The base radius of the cylinder.", &
    1147              :                           usage="BASE_RADIUS <real>", unit_str="angstrom", &
    1148        29485 :                           default_r_val=cp_unit_to_cp2k(value=1.0_dp, unit_str="angstrom"))
    1149        29485 :       CALL section_add_keyword(section, keyword)
    1150        29485 :       CALL keyword_release(keyword)
    1151              : 
    1152              :       CALL keyword_create(keyword, __LOCATION__, name="N_SIDES", &
    1153              :                           description="The number of sides (faces) of the n-gonal prism approximating the cylinder.", &
    1154        29485 :                           usage="N_SIDES <integer>", default_i_val=5)
    1155        29485 :       CALL section_add_keyword(section, keyword)
    1156        29485 :       CALL keyword_release(keyword)
    1157              : 
    1158              :       CALL keyword_create(keyword, __LOCATION__, name="APX_TYPE", &
    1159              :                           enum_c_vals=s2a('CIRCUMSCRIBED', 'INSCRIBED'), &
    1160              :                           enum_i_vals=[CIRCUMSCRIBED, INSCRIBED], &
    1161              :                           description="Specifies the type of the n-gonal prism approximating the cylinder.", &
    1162        29485 :                           usage="APX_TYPE <apx_type>", default_i_val=CIRCUMSCRIBED)
    1163        29485 :       CALL section_add_keyword(section, keyword)
    1164        29485 :       CALL keyword_release(keyword)
    1165              : 
    1166              :       CALL keyword_create( &
    1167              :          keyword, __LOCATION__, name="N_PRTN", &
    1168              :          description="The number of partitions along the face edges of the prism for tiling. If the edges "// &
    1169              :          "have different lengths, from the two given values, the larger one will be assigned to the longer edge.", &
    1170              :          usage="N_PRTN <integer> <integer>", &
    1171        29485 :          n_var=2, default_i_vals=[1, 1])
    1172        29485 :       CALL section_add_keyword(section, keyword)
    1173        29485 :       CALL keyword_release(keyword)
    1174              : 
    1175              :       CALL keyword_create(keyword, __LOCATION__, name="THICKNESS", &
    1176              :                           description="The thickness of the cylinder.", &
    1177              :                           usage="THICKNESS <real>", unit_str="angstrom", &
    1178        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
    1179        29485 :       CALL section_add_keyword(section, keyword)
    1180        29485 :       CALL keyword_release(keyword)
    1181              : 
    1182              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
    1183              :                           description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
    1184              :                           usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
    1185        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
    1186        29485 :       CALL section_add_keyword(section, keyword)
    1187        29485 :       CALL keyword_release(keyword)
    1188              : 
    1189              :       CALL keyword_create( &
    1190              :          keyword, __LOCATION__, name="delta_alpha", &
    1191              :          description="A central angle specifying the gap between the faces of the n-gonal prism. To avoide overlap "// &
    1192              :          "between the cuboids (of the given thickness) built on top of the faces, a larger value is required if the"// &
    1193              :          " number of faces (N_SIDES) is quite few and/or the base radius is fairly small.", &
    1194        29485 :          usage="delta_alpha <real>", default_r_val=0.05_dp, unit_str="rad")
    1195        29485 :       CALL section_add_keyword(section, keyword)
    1196        29485 :       CALL keyword_release(keyword)
    1197              : 
    1198        29485 :    END SUBROUTINE create_aa_cylindrical_section
    1199              : 
    1200              : ! **************************************************************************************************
    1201              : !> \brief Creates the section for creating axis-aligned cuboidal Dirichlet region.
    1202              : !> \param section the section to be created
    1203              : !> \author Mohammad Hossein Bani-Hashemian
    1204              : ! **************************************************************************************************
    1205        29485 :    SUBROUTINE create_aa_cuboidal_section(section)
    1206              :       TYPE(section_type), POINTER                        :: section
    1207              : 
    1208              :       TYPE(keyword_type), POINTER                        :: keyword
    1209              : 
    1210        29485 :       CPASSERT(.NOT. ASSOCIATED(section))
    1211              :       CALL section_create(section, __LOCATION__, name="AA_CUBOIDAL", &
    1212              :                           description="Parameters for creating axis-aligned cuboidal Dirichlet regions.", &
    1213        29485 :                           n_keywords=7, n_subsections=0, repeats=.TRUE.)
    1214              : 
    1215        29485 :       NULLIFY (keyword)
    1216              : 
    1217              :       CALL keyword_create(keyword, __LOCATION__, name="v_D", &
    1218              :                           description="The value of the fixed potential to be imposed at the region.", &
    1219        29485 :                           usage="v_D <real>", unit_str="volt", type_of_var=real_t)
    1220        29485 :       CALL section_add_keyword(section, keyword)
    1221        29485 :       CALL keyword_release(keyword)
    1222              : 
    1223              :       CALL keyword_create(keyword, __LOCATION__, name="OSCILLATING_FRACTION", &
    1224              :                           description="A fraction of the field can be set to oscilate over time.", &
    1225        29485 :                           usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1226        29485 :       CALL section_add_keyword(section, keyword)
    1227        29485 :       CALL keyword_release(keyword)
    1228              : 
    1229              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
    1230              :                           description="The frequency with which the oscillating fraction oscillates.", &
    1231        29485 :                           usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
    1232        29485 :       CALL section_add_keyword(section, keyword)
    1233        29485 :       CALL keyword_release(keyword)
    1234              : 
    1235              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
    1236              :                           description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
    1237        29485 :                           usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
    1238        29485 :       CALL section_add_keyword(section, keyword)
    1239        29485 :       CALL keyword_release(keyword)
    1240              : 
    1241              :       CALL keyword_create(keyword, __LOCATION__, name="X_xtnt", &
    1242              :                           description="The X extents of the cuboid.", &
    1243              :                           usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
    1244        29485 :                           n_var=2, type_of_var=real_t)
    1245        29485 :       CALL section_add_keyword(section, keyword)
    1246        29485 :       CALL keyword_release(keyword)
    1247              : 
    1248              :       CALL keyword_create(keyword, __LOCATION__, name="Y_xtnt", &
    1249              :                           description="The Y extents of the cuboid.", &
    1250              :                           usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
    1251        29485 :                           n_var=2, type_of_var=real_t)
    1252        29485 :       CALL section_add_keyword(section, keyword)
    1253        29485 :       CALL keyword_release(keyword)
    1254              : 
    1255              :       CALL keyword_create(keyword, __LOCATION__, name="Z_xtnt", &
    1256              :                           description="The Z extents of the cuboid.", &
    1257              :                           usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
    1258        29485 :                           n_var=2, type_of_var=real_t)
    1259        29485 :       CALL section_add_keyword(section, keyword)
    1260        29485 :       CALL keyword_release(keyword)
    1261              : 
    1262              :       CALL keyword_create(keyword, __LOCATION__, name="N_PRTN", &
    1263              :                           description="The number of partitions in the x, y and z directions for partitioning the cuboid.", &
    1264              :                           usage="N_PRTN <integer> <integer> <integer>", &
    1265        29485 :                           n_var=3, default_i_vals=[1, 1, 1])
    1266        29485 :       CALL section_add_keyword(section, keyword)
    1267        29485 :       CALL keyword_release(keyword)
    1268              : 
    1269              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
    1270              :                           description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
    1271              :                           usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
    1272        29485 :                           default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
    1273        29485 :       CALL section_add_keyword(section, keyword)
    1274        29485 :       CALL keyword_release(keyword)
    1275              : 
    1276              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_REGION", &
    1277              :                           description="Whether or not to take into consideration the effects of the periodicity of the "// &
    1278              :                           "simulation cell (MIXED_PERIODIC bc) for regions defined sufficiently close to the boundaries.", &
    1279        29485 :                           usage="PERIODIC_REGION <logical>", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1280        29485 :       CALL section_add_keyword(section, keyword)
    1281        29485 :       CALL keyword_release(keyword)
    1282              : 
    1283        29485 :    END SUBROUTINE create_aa_cuboidal_section
    1284              : 
    1285              : END MODULE input_cp2k_poisson
        

Generated by: LCOV version 2.0-1