LCOV - code coverage report
Current view: top level - src - input_cp2k_constraints.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:21ef868) Lines: 100.0 % 238 238
Test Date: 2026-08-14 07:04:57 Functions: 100.0 % 10 10

            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              : !> \par History
      10              : !>      10.2005 split input_cp2k into smaller modules [fawzi]
      11              : !>      Teodoro Laino [tlaino] 12.2008 - Preparing for VIRTUAL SITE constraints
      12              : !>                                       (patch by Marcel Baer)
      13              : !> \author teo & fawzi
      14              : ! **************************************************************************************************
      15              : MODULE input_cp2k_constraints
      16              :    USE cell_types,                      ONLY: use_perd_x,&
      17              :                                               use_perd_xy,&
      18              :                                               use_perd_xyz,&
      19              :                                               use_perd_xz,&
      20              :                                               use_perd_y,&
      21              :                                               use_perd_yz,&
      22              :                                               use_perd_z
      23              :    USE cp_output_handling,              ONLY: cp_print_key_section_create,&
      24              :                                               high_print_level
      25              :    USE input_constants,                 ONLY: do_constr_atomic,&
      26              :                                               do_constr_molec,&
      27              :                                               do_constr_none
      28              :    USE input_keyword_types,             ONLY: keyword_create,&
      29              :                                               keyword_release,&
      30              :                                               keyword_type
      31              :    USE input_section_types,             ONLY: section_add_keyword,&
      32              :                                               section_add_subsection,&
      33              :                                               section_create,&
      34              :                                               section_release,&
      35              :                                               section_type
      36              :    USE input_val_types,                 ONLY: char_t,&
      37              :                                               integer_t,&
      38              :                                               real_t
      39              :    USE kinds,                           ONLY: dp
      40              :    USE string_utilities,                ONLY: s2a
      41              : #include "./base/base_uses.f90"
      42              : 
      43              :    IMPLICIT NONE
      44              :    PRIVATE
      45              : 
      46              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      47              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_constraints'
      48              : 
      49              :    PUBLIC :: create_constraint_section
      50              : 
      51              : !***
      52              : CONTAINS
      53              : 
      54              : ! **************************************************************************************************
      55              : !> \brief Create the constraint section. This section is useful to impose
      56              : !>      constraints
      57              : !> \param section the section to create
      58              : !> \author teo
      59              : ! **************************************************************************************************
      60        10624 :    SUBROUTINE create_constraint_section(section)
      61              :       TYPE(section_type), POINTER                        :: section
      62              : 
      63              :       TYPE(keyword_type), POINTER                        :: keyword
      64              :       TYPE(section_type), POINTER                        :: print_key, subsection
      65              : 
      66        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
      67              :       CALL section_create(section, __LOCATION__, name="constraint", &
      68              :                           description="Section specifying information regarding how to impose constraints"// &
      69              :                           " on the system.", &
      70        10624 :                           n_keywords=0, n_subsections=2, repeats=.FALSE.)
      71              : 
      72        10624 :       NULLIFY (subsection, keyword, print_key)
      73              :       CALL keyword_create(keyword, __LOCATION__, name="SHAKE_TOLERANCE", &
      74              :                           variants=s2a("SHAKE_TOL", "SHAKE"), &
      75              :                           description="Set the tolerance for the shake/rattle constraint algorithm.", &
      76              :                           usage="SHAKE_TOLERANCE <REAL>", &
      77        10624 :                           default_r_val=1.0E-6_dp, unit_str="internal_cp2k")
      78        10624 :       CALL section_add_keyword(section, keyword)
      79        10624 :       CALL keyword_release(keyword)
      80              : 
      81              :       CALL keyword_create(keyword, __LOCATION__, name="ROLL_TOLERANCE", &
      82              :                           variants=s2a("ROLL_TOL", "ROLL"), &
      83              :                           description="Set the tolerance for the roll constraint algorithm.", &
      84              :                           usage="ROLL_TOLERANCE <REAL>", &
      85        10624 :                           default_r_val=1.0E-10_dp, unit_str="internal_cp2k")
      86        10624 :       CALL section_add_keyword(section, keyword)
      87        10624 :       CALL keyword_release(keyword)
      88              : 
      89              :       CALL keyword_create(keyword, __LOCATION__, name="CONSTRAINT_INIT", &
      90              :                           description="Apply constraints to the initial position and velocities."// &
      91              :                           " Default is to apply constraints only after the first MD step.", &
      92              :                           usage="CONSTRAINT_INIT <LOGICAL>", &
      93        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      94        10624 :       CALL section_add_keyword(section, keyword)
      95        10624 :       CALL keyword_release(keyword)
      96              : 
      97              :       CALL keyword_create(keyword, __LOCATION__, name="PIMD_BEADWISE_CONSTRAINT", &
      98              :                           description="Apply beadwise constraints to PIMD.", &
      99              :                           usage="PIMD_BEADWISE_CONSTRAINT <LOGICAL>", &
     100        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     101        10624 :       CALL section_add_keyword(section, keyword)
     102        10624 :       CALL keyword_release(keyword)
     103              : 
     104        10624 :       CALL create_hbonds_section(subsection)
     105        10624 :       CALL restraint_info_section(subsection)
     106        10624 :       CALL section_add_subsection(section, subsection)
     107        10624 :       CALL section_release(subsection)
     108              : 
     109        10624 :       CALL create_g3x3_section(subsection)
     110        10624 :       CALL restraint_info_section(subsection)
     111        10624 :       CALL section_add_subsection(section, subsection)
     112        10624 :       CALL section_release(subsection)
     113              : 
     114        10624 :       CALL create_g4x6_section(subsection)
     115        10624 :       CALL restraint_info_section(subsection)
     116        10624 :       CALL section_add_subsection(section, subsection)
     117        10624 :       CALL section_release(subsection)
     118              : 
     119        10624 :       CALL create_vsite_section(subsection)
     120        10624 :       CALL restraint_info_section(subsection)
     121        10624 :       CALL section_add_subsection(section, subsection)
     122        10624 :       CALL section_release(subsection)
     123              : 
     124        10624 :       CALL create_collective_section(subsection)
     125        10624 :       CALL restraint_info_section(subsection)
     126        10624 :       CALL section_add_subsection(section, subsection)
     127        10624 :       CALL section_release(subsection)
     128              : 
     129        10624 :       CALL create_fixed_atom_section(subsection)
     130        10624 :       CALL restraint_info_section(subsection)
     131        10624 :       CALL section_add_subsection(section, subsection)
     132        10624 :       CALL section_release(subsection)
     133              : 
     134        10624 :       CALL create_f_a_rest_section(subsection)
     135        10624 :       CALL section_add_subsection(section, subsection)
     136        10624 :       CALL section_release(subsection)
     137              : 
     138        10624 :       CALL create_clv_rest_section(subsection)
     139        10624 :       CALL section_add_subsection(section, subsection)
     140        10624 :       CALL section_release(subsection)
     141              : 
     142              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "constraint_info", &
     143              :                                        description="Prints information about iterative constraints solutions", &
     144        10624 :                                        print_level=high_print_level, filename="__STD_OUT__")
     145        10624 :       CALL section_add_subsection(section, print_key)
     146        10624 :       CALL section_release(print_key)
     147              : 
     148              :       CALL cp_print_key_section_create( &
     149              :          print_key, __LOCATION__, "lagrange_multipliers", &
     150              :          description="Prints the raw SHAKE position-constraint and RATTLE velocity-constraint"// &
     151              :          " Lagrange multipliers during MD. Values use CP2K internal units and include all active"// &
     152              :          " constraints. The output does not include mass-metric corrections required for a general"// &
     153              :          " blue-moon free-energy estimator.", &
     154        10624 :          print_level=high_print_level, filename="")
     155        10624 :       CALL section_add_subsection(section, print_key)
     156        10624 :       CALL section_release(print_key)
     157              : 
     158        10624 :    END SUBROUTINE create_constraint_section
     159              : 
     160              : ! **************************************************************************************************
     161              : !> \brief Create the restart section for colvar restraints
     162              : !>      This section will be only used for restraint restarts.
     163              : !>      Constraints are handled automatically
     164              : !> \param section the section to create
     165              : !> \author Teodoro Laino 08.2006
     166              : ! **************************************************************************************************
     167        10624 :    SUBROUTINE create_clv_rest_section(section)
     168              :       TYPE(section_type), POINTER                        :: section
     169              : 
     170              :       TYPE(keyword_type), POINTER                        :: keyword
     171              : 
     172        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     173        10624 :       NULLIFY (keyword)
     174              :       CALL section_create(section, __LOCATION__, name="COLVAR_RESTART", &
     175              :                           description="Specify restart position only for COLVAR restraints.", &
     176        10624 :                           n_subsections=0, repeats=.FALSE.)
     177              : 
     178              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     179              :                           description="The restarting values for COLVAR restraints."// &
     180              :                           " The order is an internal order. So if you decide to modify these values by hand"// &
     181              :                           " first think what you're doing!", repeats=.TRUE., &
     182        10624 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     183        10624 :       CALL section_add_keyword(section, keyword)
     184        10624 :       CALL keyword_release(keyword)
     185              : 
     186        10624 :    END SUBROUTINE create_clv_rest_section
     187              : 
     188              : ! **************************************************************************************************
     189              : !> \brief Create the restart section for fixed atoms restraints
     190              : !>      This section will be only used for restraint restarts.
     191              : !>      Constraints are handled automatically
     192              : !> \param section the section to create
     193              : !> \author Teodoro Laino 08.2006
     194              : ! **************************************************************************************************
     195        10624 :    SUBROUTINE create_f_a_rest_section(section)
     196              :       TYPE(section_type), POINTER                        :: section
     197              : 
     198              :       TYPE(keyword_type), POINTER                        :: keyword
     199              : 
     200        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     201        10624 :       NULLIFY (keyword)
     202              :       CALL section_create(section, __LOCATION__, name="FIX_ATOM_RESTART", &
     203              :                           description="Specify restart position only for FIXED_ATOMS restraints.", &
     204        10624 :                           n_subsections=0, repeats=.FALSE.)
     205              : 
     206              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     207              :                           description="The restarting position of fixed atoms for restraints."// &
     208              :                           " The order is an internal order. So if you decide to modify these values by hand"// &
     209              :                           " first think what you're doing!", repeats=.TRUE., &
     210        10624 :                           usage="{Real} ...", type_of_var=real_t, n_var=-1)
     211        10624 :       CALL section_add_keyword(section, keyword)
     212        10624 :       CALL keyword_release(keyword)
     213              : 
     214        10624 :    END SUBROUTINE create_f_a_rest_section
     215              : 
     216              : ! **************************************************************************************************
     217              : !> \brief Create the restraint info section in the constraint section
     218              : !> \param section the section to create
     219              : !> \author Teodoro Laino 08.2006
     220              : ! **************************************************************************************************
     221        63744 :    SUBROUTINE restraint_info_section(section)
     222              :       TYPE(section_type), POINTER                        :: section
     223              : 
     224              :       TYPE(keyword_type), POINTER                        :: keyword
     225              :       TYPE(section_type), POINTER                        :: subsection
     226              : 
     227        63744 :       CPASSERT(ASSOCIATED(section))
     228        63744 :       NULLIFY (subsection, keyword)
     229              :       CALL section_create(subsection, __LOCATION__, name="RESTRAINT", &
     230              :                           description="Activate and specify information on restraint instead of constraint", &
     231        63744 :                           n_subsections=0, repeats=.FALSE.)
     232              : 
     233              :       CALL keyword_create(keyword, __LOCATION__, name="K", &
     234              :                           description="Specifies the force constant for the harmonic restraint. The functional "// &
     235              :                           "form for the restraint is: K*(X-TARGET)^2.", &
     236              :                           usage="K {real}", &
     237        63744 :                           type_of_var=real_t, default_r_val=0.0_dp, unit_str="internal_cp2k")
     238        63744 :       CALL section_add_keyword(subsection, keyword)
     239        63744 :       CALL keyword_release(keyword)
     240              : 
     241        63744 :       CALL section_add_subsection(section, subsection)
     242        63744 :       CALL section_release(subsection)
     243              : 
     244        63744 :    END SUBROUTINE restraint_info_section
     245              : 
     246              : ! **************************************************************************************************
     247              : !> \brief Create the constraint section for collective constraints
     248              : !> \param section the section to create
     249              : !> \author Joost VandeVondele [01.2006]
     250              : ! **************************************************************************************************
     251        10624 :    SUBROUTINE create_collective_section(section)
     252              :       TYPE(section_type), POINTER                        :: section
     253              : 
     254              :       TYPE(keyword_type), POINTER                        :: keyword
     255              : 
     256        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     257              :       CALL section_create(section, __LOCATION__, name="COLLECTIVE", &
     258              :                           description="Used to constraint collective (general) degrees of freedom, "// &
     259              :                           "writing langrangian multipliers to file.", &
     260        10624 :                           n_subsections=0, repeats=.TRUE.)
     261        10624 :       NULLIFY (keyword)
     262              : 
     263              :       CALL keyword_create(keyword, __LOCATION__, name="COLVAR", &
     264              :                           description="Specifies the index (in input file order) of the type of colvar to constrain.", &
     265              :                           usage="COLVAR {int}", &
     266        10624 :                           type_of_var=integer_t)
     267        10624 :       CALL section_add_keyword(section, keyword)
     268        10624 :       CALL keyword_release(keyword)
     269              : 
     270              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
     271              :                           description="Specifies the index of the molecule kind (in input file order)"// &
     272              :                           " on which the constraint will be applied."// &
     273              :                           " MOLECULE and MOLNAME keyword exclude themself mutually.", &
     274        10624 :                           usage="MOLECULE {integer}", n_var=1, type_of_var=integer_t)
     275        10624 :       CALL section_add_keyword(section, keyword)
     276        10624 :       CALL keyword_release(keyword)
     277              : 
     278              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     279              :                           variants=["SEGNAME"], &
     280              :                           description="Specifies the name of the molecule on which the constraint will be applied.", &
     281        21248 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     282        10624 :       CALL section_add_keyword(section, keyword)
     283        10624 :       CALL keyword_release(keyword)
     284              : 
     285              :       CALL keyword_create(keyword, __LOCATION__, name="INTERMOLECULAR", &
     286              :                           description="Specify if the constraint/restraint is intermolecular.", &
     287              :                           usage="INTERMOLECULAR <LOGICAL>", &
     288        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     289        10624 :       CALL section_add_keyword(section, keyword)
     290        10624 :       CALL keyword_release(keyword)
     291              : 
     292              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     293              :                           description="Specifies the target value of the constrained collective"// &
     294              :                           " variable (units depend on the colvar).", &
     295              :                           usage="TARGET {real}", &
     296        10624 :                           type_of_var=real_t, unit_str="internal_cp2k")
     297        10624 :       CALL section_add_keyword(section, keyword)
     298        10624 :       CALL keyword_release(keyword)
     299              : 
     300              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET_GROWTH", &
     301              :                           description="Specifies the rate at which the target value of the constrained collective"// &
     302              :                           " variable changes during MD. At every step, TARGET is incremented by"// &
     303              :                           " TARGET_GROWTH times the MD time step, optionally up to TARGET_LIMIT."// &
     304              :                           " This moves the constraint but does not integrate work or compute a free-energy profile.", &
     305              :                           usage="TARGET_GROWTH {real}", &
     306        10624 :                           default_r_val=0.0_dp, unit_str="internal_cp2k")
     307        10624 :       CALL section_add_keyword(section, keyword)
     308        10624 :       CALL keyword_release(keyword)
     309              : 
     310              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET_LIMIT", &
     311              :                           description="Specifies the limit of the growth of the target value of the constrained collective"// &
     312              :                           " variable. By default no limit at the colvar growth is set.", &
     313              :                           usage="TARGET_LIMIT {real}", type_of_var=real_t, &
     314        10624 :                           unit_str="internal_cp2k")
     315        10624 :       CALL section_add_keyword(section, keyword)
     316        10624 :       CALL keyword_release(keyword)
     317              : 
     318              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     319              :                           description="Does not apply the constraint to the QM region within a QM/MM calculation", &
     320              :                           usage="EXCLUDE_QM <LOGICAL>", &
     321        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     322        10624 :       CALL section_add_keyword(section, keyword)
     323        10624 :       CALL keyword_release(keyword)
     324              : 
     325              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     326              :                           description="Does not apply the constraint to the MM region within a QM/MM calculation", &
     327              :                           usage="EXCLUDE_MM <LOGICAL>", &
     328        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     329        10624 :       CALL section_add_keyword(section, keyword)
     330        10624 :       CALL keyword_release(keyword)
     331              : 
     332        10624 :    END SUBROUTINE create_collective_section
     333              : 
     334              : ! **************************************************************************************************
     335              : !> \brief Create the constraint section that fixes atoms
     336              : !> \param section the section to create
     337              : !> \author teo
     338              : ! **************************************************************************************************
     339        10624 :    SUBROUTINE create_fixed_atom_section(section)
     340              :       TYPE(section_type), POINTER                        :: section
     341              : 
     342              :       TYPE(keyword_type), POINTER                        :: keyword
     343              : 
     344        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     345              :       CALL section_create(section, __LOCATION__, name="fixed_atoms", &
     346              :                           description="This section is used to constraint the fractional atomic position (X,Y,Z). Note "// &
     347              :                           "that fractional coordinates are constrained, not real space coordinates. In case "// &
     348              :                           "a restraint is specified the value of the TARGET is considered to be the value of the "// &
     349              :                           "coordinates at the beginning of the run or alternatively the corresponding value in the section: "// &
     350        10624 :                           "FIX_ATOM_RESTART.", n_keywords=3, n_subsections=0, repeats=.TRUE.)
     351        10624 :       NULLIFY (keyword)
     352              : 
     353              :       ! Section Parameter
     354              :       CALL keyword_create(keyword, __LOCATION__, name="COMPONENTS_TO_FIX", &
     355              :                           description="Specify which fractional components (X,Y,Z or combinations) of the atoms specified "// &
     356              :                           "in the section will be constrained/restrained.", &
     357              :                           usage="COMPONENTS_TO_FIX (x|y|z|xy|xz|yz|xyz)", &
     358              :                           default_i_val=use_perd_xyz, &
     359              :                           enum_c_vals=s2a("x", "y", "z", "xy", "xz", "yz", "xyz"), &
     360              :                           enum_i_vals=[use_perd_x, use_perd_y, use_perd_z, &
     361              :                                        use_perd_xy, use_perd_xz, use_perd_yz, &
     362              :                                        use_perd_xyz], &
     363              :                           enum_desc=s2a("Fix only X component", &
     364              :                                         "Fix only Y component", &
     365              :                                         "Fix only Z component", &
     366              :                                         "Fix X-Y components", &
     367              :                                         "Fix X-Z components", &
     368              :                                         "Fix Y-Z components", &
     369              :                                         "Fix the full components of the atomic position."), &
     370        10624 :                           repeats=.FALSE.)
     371        10624 :       CALL section_add_keyword(section, keyword)
     372        10624 :       CALL keyword_release(keyword)
     373              : 
     374              :       ! Integer
     375              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
     376              :                           description="Specifies a list of atoms to freeze.", &
     377              :                           usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
     378        10624 :                           n_var=-1, type_of_var=integer_t)
     379        10624 :       CALL section_add_keyword(section, keyword)
     380        10624 :       CALL keyword_release(keyword)
     381              : 
     382              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     383              :                           variants=["SEGNAME"], &
     384              :                           description="Specifies the name of the molecule to fix", &
     385              :                           usage="MOLNAME WAT MEOH", repeats=.TRUE., &
     386        21248 :                           n_var=-1, type_of_var=char_t)
     387        10624 :       CALL section_add_keyword(section, keyword)
     388        10624 :       CALL keyword_release(keyword)
     389              : 
     390              :       CALL keyword_create( &
     391              :          keyword, __LOCATION__, name="MM_SUBSYS", &
     392              :          variants=["PROTEIN"], &
     393              :          description="In a QM/MM run all  MM atoms are fixed according to the argument.", &
     394              :          usage="MM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
     395              :          enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
     396              :          enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
     397              :          enum_desc=s2a("fix nothing", &
     398              :                        "only the MM atoms itself", &
     399              :                        "the full molecule/residue that contains a MM atom (i.e. some QM atoms might be fixed as well)"), &
     400        21248 :          default_i_val=do_constr_none, repeats=.FALSE.)
     401        10624 :       CALL section_add_keyword(section, keyword)
     402        10624 :       CALL keyword_release(keyword)
     403              : 
     404              :       CALL keyword_create( &
     405              :          keyword, __LOCATION__, name="QM_SUBSYS", &
     406              :          description="In a QM/MM run all QM atoms are fixed according to the argument.", &
     407              :          usage="QM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
     408              :          enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
     409              :          enum_desc=s2a("fix nothing", &
     410              :                        "only the QM atoms itself", &
     411              :                        "the full molecule/residue that contains a QM atom (i.e. some MM atoms might be fixed as well)"), &
     412              :          enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
     413        10624 :          default_i_val=do_constr_none, repeats=.FALSE.)
     414        10624 :       CALL section_add_keyword(section, keyword)
     415        10624 :       CALL keyword_release(keyword)
     416              : 
     417              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     418              :                           description="Does not apply the constraint to the QM region within a QM/MM calculation."// &
     419              :                           " This keyword is active only together with MOLNAME", &
     420              :                           usage="EXCLUDE_QM <LOGICAL>", &
     421        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     422        10624 :       CALL section_add_keyword(section, keyword)
     423        10624 :       CALL keyword_release(keyword)
     424              : 
     425              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     426              :                           description="Does not apply the constraint to the MM region within a QM/MM calculation."// &
     427              :                           " This keyword is active only together with MOLNAME", &
     428              :                           usage="EXCLUDE_MM <LOGICAL>", &
     429        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     430        10624 :       CALL section_add_keyword(section, keyword)
     431        10624 :       CALL keyword_release(keyword)
     432              : 
     433        10624 :    END SUBROUTINE create_fixed_atom_section
     434              : 
     435              : ! **************************************************************************************************
     436              : !> \brief Create the constraint section specialized on g3x3 constraints
     437              : !> \param section the section to create
     438              : !> \author teo
     439              : ! **************************************************************************************************
     440        10624 :    SUBROUTINE create_g3x3_section(section)
     441              :       TYPE(section_type), POINTER                        :: section
     442              : 
     443              :       TYPE(keyword_type), POINTER                        :: keyword
     444              : 
     445        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     446              :       CALL section_create(section, __LOCATION__, name="g3x3", &
     447              :                           description="This section is used to set 3x3 (3 atoms and 3 distances) constraints.", &
     448        10624 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     449              : 
     450        10624 :       NULLIFY (keyword)
     451              : 
     452              :       ! Integer
     453              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
     454              :                           variants=["MOL"], &
     455              :                           description="Specifies the molecule kind number on which constraint will be applied."// &
     456              :                           " MOLECULE and MOLNAME keyword exclude themself mutually.", &
     457        21248 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     458        10624 :       CALL section_add_keyword(section, keyword)
     459        10624 :       CALL keyword_release(keyword)
     460              : 
     461              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     462              :                           variants=["SEGNAME"], &
     463              :                           description="Specifies the name of the molecule on which the constraint will be applied.", &
     464        21248 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     465        10624 :       CALL section_add_keyword(section, keyword)
     466        10624 :       CALL keyword_release(keyword)
     467              : 
     468              :       CALL keyword_create(keyword, __LOCATION__, name="INTERMOLECULAR", &
     469              :                           description="Specify if the constraint/restraint is intermolecular.", &
     470              :                           usage="INTERMOLECULAR <LOGICAL>", &
     471        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     472        10624 :       CALL section_add_keyword(section, keyword)
     473        10624 :       CALL keyword_release(keyword)
     474              : 
     475              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     476              :                           description="Atoms' index on which apply the constraint", usage="ATOMS 1 3 6", &
     477        10624 :                           n_var=-1, type_of_var=integer_t)
     478        10624 :       CALL section_add_keyword(section, keyword)
     479        10624 :       CALL keyword_release(keyword)
     480              : 
     481              :       ! Real
     482              :       CALL keyword_create(keyword, __LOCATION__, name="DISTANCES", &
     483              :                           description="The constrained distances' values.", &
     484              :                           usage="DISTANCES {real} {real} {real}", type_of_var=real_t, &
     485        10624 :                           unit_str="internal_cp2k", n_var=-1)
     486        10624 :       CALL section_add_keyword(section, keyword)
     487        10624 :       CALL keyword_release(keyword)
     488              : 
     489              :       ! Logical
     490              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     491              :                           description="Does not apply the constraint to the QM region within a QM/MM calculation", &
     492              :                           usage="EXCLUDE_QM <LOGICAL>", &
     493        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     494        10624 :       CALL section_add_keyword(section, keyword)
     495        10624 :       CALL keyword_release(keyword)
     496              : 
     497              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     498              :                           description="Does not apply the constraint to the MM region within a QM/MM calculation", &
     499              :                           usage="EXCLUDE_MM <LOGICAL>", &
     500        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     501        10624 :       CALL section_add_keyword(section, keyword)
     502        10624 :       CALL keyword_release(keyword)
     503              : 
     504        10624 :    END SUBROUTINE create_g3x3_section
     505              : 
     506              : ! **************************************************************************************************
     507              : !> \brief Create the constraint section specialized on H BONDS constraints
     508              : !> \param section the section to create
     509              : !> \author teo
     510              : ! **************************************************************************************************
     511        10624 :    SUBROUTINE create_hbonds_section(section)
     512              :       TYPE(section_type), POINTER                        :: section
     513              : 
     514              :       TYPE(keyword_type), POINTER                        :: keyword
     515              : 
     516        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     517              :       CALL section_create(section, __LOCATION__, name="HBONDS", &
     518              :                           description="This section is used to set bonds constraints involving Hydrogen atoms", &
     519        10624 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     520              : 
     521        10624 :       NULLIFY (keyword)
     522              :       ! Character
     523              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_TYPE", &
     524              :                           description="Defines the atoms' type forming a bond with an hydrogen. If not specified"// &
     525              :                           " the default bond value of the first molecule is used as constraint target", &
     526              :                           usage="ATOM_TYPE <CHARACTER>", &
     527        10624 :                           n_var=-1, type_of_var=char_t)
     528        10624 :       CALL section_add_keyword(section, keyword)
     529        10624 :       CALL keyword_release(keyword)
     530              : 
     531              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
     532              :                           description="Specifies the indexes of the molecule kind (in input file order)"// &
     533              :                           " on which the constraint will be applied."// &
     534              :                           " MOLECULE and MOLNAME keyword exclude themself mutually.", &
     535              :                           usage="MOLECULE {integer} .. {integer} ", n_var=-1, &
     536        10624 :                           type_of_var=integer_t)
     537        10624 :       CALL section_add_keyword(section, keyword)
     538        10624 :       CALL keyword_release(keyword)
     539              : 
     540              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     541              :                           variants=["SEGNAME"], &
     542              :                           description="Specifies the names of the molecule on which the constraint will be applied.", &
     543              :                           usage="MOLNAME {character} .. {character} ", n_var=-1, &
     544        21248 :                           type_of_var=char_t)
     545        10624 :       CALL section_add_keyword(section, keyword)
     546        10624 :       CALL keyword_release(keyword)
     547              : 
     548              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     549              :                           description="Does not shake HBONDS in the QM region within a QM/MM calculation", &
     550              :                           usage="EXCLUDE_QM <LOGICAL>", &
     551        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     552        10624 :       CALL section_add_keyword(section, keyword)
     553        10624 :       CALL keyword_release(keyword)
     554              : 
     555              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     556              :                           description="Does not shake HBONDS in the MM region within a QM/MM calculation", &
     557              :                           usage="EXCLUDE_MM <LOGICAL>", &
     558        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     559        10624 :       CALL section_add_keyword(section, keyword)
     560        10624 :       CALL keyword_release(keyword)
     561              : 
     562              :       ! Real
     563              :       CALL keyword_create(keyword, __LOCATION__, name="TARGETS", &
     564              :                           description="The constrained distances' values  for the types defines in ATOM_TYPE.", &
     565              :                           usage="TARGETS {real} {real} {real}", type_of_var=real_t, n_var=-1, &
     566        10624 :                           unit_str="internal_cp2k")
     567        10624 :       CALL section_add_keyword(section, keyword)
     568        10624 :       CALL keyword_release(keyword)
     569              : 
     570        10624 :    END SUBROUTINE create_hbonds_section
     571              : 
     572              : ! **************************************************************************************************
     573              : !> \brief Create the constraint section specialized on g4x6 constraints
     574              : !> \param section the section to create
     575              : !> \author teo
     576              : ! **************************************************************************************************
     577        10624 :    SUBROUTINE create_g4x6_section(section)
     578              :       TYPE(section_type), POINTER                        :: section
     579              : 
     580              :       TYPE(keyword_type), POINTER                        :: keyword
     581              : 
     582        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     583              :       CALL section_create(section, __LOCATION__, name="g4x6", &
     584              :                           description="This section is used to set 4x6 (4 atoms and 6 distances) constraints.", &
     585        10624 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     586              : 
     587        10624 :       NULLIFY (keyword)
     588              : 
     589              :       ! Integer
     590              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
     591              :                           variants=["MOL"], &
     592              :                           description="Specifies the molecule number on which constraint will be applied."// &
     593              :                           " MOLECULE and MOLNAME keyword exclude themself mutually.", &
     594        21248 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     595        10624 :       CALL section_add_keyword(section, keyword)
     596        10624 :       CALL keyword_release(keyword)
     597              : 
     598              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     599              :                           variants=["SEGNAME"], &
     600              :                           description="Specifies the name of the molecule on which the constraint will be applied.", &
     601        21248 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     602        10624 :       CALL section_add_keyword(section, keyword)
     603        10624 :       CALL keyword_release(keyword)
     604              : 
     605              :       CALL keyword_create(keyword, __LOCATION__, name="INTERMOLECULAR", &
     606              :                           description="Specify if the constraint/restraint is intermolecular.", &
     607              :                           usage="INTERMOLECULAR <LOGICAL>", &
     608        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     609        10624 :       CALL section_add_keyword(section, keyword)
     610        10624 :       CALL keyword_release(keyword)
     611              : 
     612              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     613              :                           description="Atoms' index on which apply the constraint", usage="ATOMS 1 3 6 4", &
     614        10624 :                           n_var=4, type_of_var=integer_t)
     615        10624 :       CALL section_add_keyword(section, keyword)
     616        10624 :       CALL keyword_release(keyword)
     617              : 
     618              :       ! Real
     619              :       CALL keyword_create(keyword, __LOCATION__, name="DISTANCES", &
     620              :                           description="The constrained distances' values.", &
     621              :                           usage="DISTANCES {real} {real} {real} {real} {real} {real}", &
     622        10624 :                           type_of_var=real_t, n_var=6, unit_str="internal_cp2k")
     623        10624 :       CALL section_add_keyword(section, keyword)
     624        10624 :       CALL keyword_release(keyword)
     625              : 
     626              :       ! Logical
     627              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     628              :                           description="Does not apply the constraint to the QM region within a QM/MM calculation", &
     629              :                           usage="EXCLUDE_QM <LOGICAL>", &
     630        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     631        10624 :       CALL section_add_keyword(section, keyword)
     632        10624 :       CALL keyword_release(keyword)
     633              : 
     634              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     635              :                           description="Does not apply the constraint to the MM region within a QM/MM calculation", &
     636              :                           usage="EXCLUDE_MM <LOGICAL>", &
     637        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     638        10624 :       CALL section_add_keyword(section, keyword)
     639        10624 :       CALL keyword_release(keyword)
     640              : 
     641        10624 :    END SUBROUTINE create_g4x6_section
     642              : 
     643              : ! **************************************************************************************************
     644              : !> \brief Create the constraint section specialized on vsite constraints
     645              : !> \param section the section to create
     646              : !> \author marcel baer
     647              : ! **************************************************************************************************
     648        10624 :    SUBROUTINE create_vsite_section(section)
     649              :       TYPE(section_type), POINTER                        :: section
     650              : 
     651              :       TYPE(keyword_type), POINTER                        :: keyword
     652              : 
     653        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     654              :       CALL section_create(section, __LOCATION__, name="virtual_site", &
     655              :                           description="This section is used to set a virtual interaction-site constraint.", &
     656        10624 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     657              : 
     658        10624 :       NULLIFY (keyword)
     659              : 
     660              :       ! Integer
     661              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
     662              :                           variants=["MOL"], &
     663              :                           description="Specifies the molecule number on which constraint will be applied."// &
     664              :                           " MOLECULE and MOLNAME keyword exclude themself mutually.", &
     665        21248 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     666        10624 :       CALL section_add_keyword(section, keyword)
     667        10624 :       CALL keyword_release(keyword)
     668              : 
     669              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     670              :                           variants=["SEGNAME"], &
     671              :                           description="Specifies the name of the molecule on which the constraint will be applied.", &
     672        21248 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     673        10624 :       CALL section_add_keyword(section, keyword)
     674        10624 :       CALL keyword_release(keyword)
     675              : 
     676              :       CALL keyword_create(keyword, __LOCATION__, name="INTERMOLECULAR", &
     677              :                           description="Specify if the constraint/restraint is intermolecular.", &
     678              :                           usage="INTERMOLECULAR <LOGICAL>", &
     679        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     680        10624 :       CALL section_add_keyword(section, keyword)
     681        10624 :       CALL keyword_release(keyword)
     682              : 
     683              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     684              :                           description="Atoms' index on which apply the constraint (v i j k), first is virtual site", &
     685              :                           usage="ATOMS 1 2 3 4", &
     686        10624 :                           n_var=4, type_of_var=integer_t)
     687        10624 :       CALL section_add_keyword(section, keyword)
     688        10624 :       CALL keyword_release(keyword)
     689              : 
     690              :       ! Real
     691              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETERS", &
     692              :                           description="The constrained parameters' values to construct virtual site. "// &
     693              :                           "r_v=a*r_ij+b*r_kj", &
     694              :                           usage="PARAMETERS {real} {real}", &
     695        10624 :                           type_of_var=real_t, n_var=2, unit_str="internal_cp2k")
     696        10624 :       CALL section_add_keyword(section, keyword)
     697        10624 :       CALL keyword_release(keyword)
     698              : 
     699              :       ! Logical
     700              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_QM", &
     701              :                           description="Does not apply the constraint to the QM region within a QM/MM calculation", &
     702              :                           usage="EXCLUDE_QM <LOGICAL>", &
     703        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     704        10624 :       CALL section_add_keyword(section, keyword)
     705        10624 :       CALL keyword_release(keyword)
     706              : 
     707              :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_MM", &
     708              :                           description="Does not apply the constraint to the MM region within a QM/MM calculation", &
     709              :                           usage="EXCLUDE_MM <LOGICAL>", &
     710        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     711        10624 :       CALL section_add_keyword(section, keyword)
     712        10624 :       CALL keyword_release(keyword)
     713              : 
     714        10624 :    END SUBROUTINE create_vsite_section
     715              : END MODULE input_cp2k_constraints
        

Generated by: LCOV version 2.0-1