LCOV - code coverage report
Current view: top level - src - input_cp2k_constraints.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:744416f) Lines: 100.0 % 238 238
Test Date: 2026-09-20 02:09:09 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         1380 :    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         1380 :       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         1380 :                           n_keywords=0, n_subsections=2, repeats=.FALSE.)
      71              : 
      72         1380 :       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         1380 :                           default_r_val=1.0E-6_dp, unit_str="internal_cp2k")
      78         1380 :       CALL section_add_keyword(section, keyword)
      79         1380 :       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         1380 :                           default_r_val=1.0E-10_dp, unit_str="internal_cp2k")
      86         1380 :       CALL section_add_keyword(section, keyword)
      87         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      94         1380 :       CALL section_add_keyword(section, keyword)
      95         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     101         1380 :       CALL section_add_keyword(section, keyword)
     102         1380 :       CALL keyword_release(keyword)
     103              : 
     104         1380 :       CALL create_hbonds_section(subsection)
     105         1380 :       CALL restraint_info_section(subsection)
     106         1380 :       CALL section_add_subsection(section, subsection)
     107         1380 :       CALL section_release(subsection)
     108              : 
     109         1380 :       CALL create_g3x3_section(subsection)
     110         1380 :       CALL restraint_info_section(subsection)
     111         1380 :       CALL section_add_subsection(section, subsection)
     112         1380 :       CALL section_release(subsection)
     113              : 
     114         1380 :       CALL create_g4x6_section(subsection)
     115         1380 :       CALL restraint_info_section(subsection)
     116         1380 :       CALL section_add_subsection(section, subsection)
     117         1380 :       CALL section_release(subsection)
     118              : 
     119         1380 :       CALL create_vsite_section(subsection)
     120         1380 :       CALL restraint_info_section(subsection)
     121         1380 :       CALL section_add_subsection(section, subsection)
     122         1380 :       CALL section_release(subsection)
     123              : 
     124         1380 :       CALL create_collective_section(subsection)
     125         1380 :       CALL restraint_info_section(subsection)
     126         1380 :       CALL section_add_subsection(section, subsection)
     127         1380 :       CALL section_release(subsection)
     128              : 
     129         1380 :       CALL create_fixed_atom_section(subsection)
     130         1380 :       CALL restraint_info_section(subsection)
     131         1380 :       CALL section_add_subsection(section, subsection)
     132         1380 :       CALL section_release(subsection)
     133              : 
     134         1380 :       CALL create_f_a_rest_section(subsection)
     135         1380 :       CALL section_add_subsection(section, subsection)
     136         1380 :       CALL section_release(subsection)
     137              : 
     138         1380 :       CALL create_clv_rest_section(subsection)
     139         1380 :       CALL section_add_subsection(section, subsection)
     140         1380 :       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         1380 :                                        print_level=high_print_level, filename="__STD_OUT__")
     145         1380 :       CALL section_add_subsection(section, print_key)
     146         1380 :       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         1380 :          print_level=high_print_level, filename="")
     155         1380 :       CALL section_add_subsection(section, print_key)
     156         1380 :       CALL section_release(print_key)
     157              : 
     158         1380 :    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         1380 :    SUBROUTINE create_clv_rest_section(section)
     168              :       TYPE(section_type), POINTER                        :: section
     169              : 
     170              :       TYPE(keyword_type), POINTER                        :: keyword
     171              : 
     172         1380 :       CPASSERT(.NOT. ASSOCIATED(section))
     173         1380 :       NULLIFY (keyword)
     174              :       CALL section_create(section, __LOCATION__, name="COLVAR_RESTART", &
     175              :                           description="Specify restart position only for COLVAR restraints.", &
     176         1380 :                           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         1380 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     183         1380 :       CALL section_add_keyword(section, keyword)
     184         1380 :       CALL keyword_release(keyword)
     185              : 
     186         1380 :    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         1380 :    SUBROUTINE create_f_a_rest_section(section)
     196              :       TYPE(section_type), POINTER                        :: section
     197              : 
     198              :       TYPE(keyword_type), POINTER                        :: keyword
     199              : 
     200         1380 :       CPASSERT(.NOT. ASSOCIATED(section))
     201         1380 :       NULLIFY (keyword)
     202              :       CALL section_create(section, __LOCATION__, name="FIX_ATOM_RESTART", &
     203              :                           description="Specify restart position only for FIXED_ATOMS restraints.", &
     204         1380 :                           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         1380 :                           usage="{Real} ...", type_of_var=real_t, n_var=-1)
     211         1380 :       CALL section_add_keyword(section, keyword)
     212         1380 :       CALL keyword_release(keyword)
     213              : 
     214         1380 :    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         8280 :    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         8280 :       CPASSERT(ASSOCIATED(section))
     228         8280 :       NULLIFY (subsection, keyword)
     229              :       CALL section_create(subsection, __LOCATION__, name="RESTRAINT", &
     230              :                           description="Activate and specify information on restraint instead of constraint", &
     231         8280 :                           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         8280 :                           type_of_var=real_t, default_r_val=0.0_dp, unit_str="internal_cp2k")
     238         8280 :       CALL section_add_keyword(subsection, keyword)
     239         8280 :       CALL keyword_release(keyword)
     240              : 
     241         8280 :       CALL section_add_subsection(section, subsection)
     242         8280 :       CALL section_release(subsection)
     243              : 
     244         8280 :    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         1380 :    SUBROUTINE create_collective_section(section)
     252              :       TYPE(section_type), POINTER                        :: section
     253              : 
     254              :       TYPE(keyword_type), POINTER                        :: keyword
     255              : 
     256         1380 :       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         1380 :                           n_subsections=0, repeats=.TRUE.)
     261         1380 :       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         1380 :                           type_of_var=integer_t)
     267         1380 :       CALL section_add_keyword(section, keyword)
     268         1380 :       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         1380 :                           usage="MOLECULE {integer}", n_var=1, type_of_var=integer_t)
     275         1380 :       CALL section_add_keyword(section, keyword)
     276         1380 :       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         2760 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     282         1380 :       CALL section_add_keyword(section, keyword)
     283         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     289         1380 :       CALL section_add_keyword(section, keyword)
     290         1380 :       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         1380 :                           type_of_var=real_t, unit_str="internal_cp2k")
     297         1380 :       CALL section_add_keyword(section, keyword)
     298         1380 :       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         1380 :                           default_r_val=0.0_dp, unit_str="internal_cp2k")
     307         1380 :       CALL section_add_keyword(section, keyword)
     308         1380 :       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         1380 :                           unit_str="internal_cp2k")
     315         1380 :       CALL section_add_keyword(section, keyword)
     316         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     322         1380 :       CALL section_add_keyword(section, keyword)
     323         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     329         1380 :       CALL section_add_keyword(section, keyword)
     330         1380 :       CALL keyword_release(keyword)
     331              : 
     332         1380 :    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         1380 :    SUBROUTINE create_fixed_atom_section(section)
     340              :       TYPE(section_type), POINTER                        :: section
     341              : 
     342              :       TYPE(keyword_type), POINTER                        :: keyword
     343              : 
     344         1380 :       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         1380 :                           "FIX_ATOM_RESTART.", n_keywords=3, n_subsections=0, repeats=.TRUE.)
     351         1380 :       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         1380 :                           repeats=.FALSE.)
     371         1380 :       CALL section_add_keyword(section, keyword)
     372         1380 :       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         1380 :                           n_var=-1, type_of_var=integer_t)
     379         1380 :       CALL section_add_keyword(section, keyword)
     380         1380 :       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         2760 :                           n_var=-1, type_of_var=char_t)
     387         1380 :       CALL section_add_keyword(section, keyword)
     388         1380 :       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         2760 :          default_i_val=do_constr_none, repeats=.FALSE.)
     401         1380 :       CALL section_add_keyword(section, keyword)
     402         1380 :       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         1380 :          default_i_val=do_constr_none, repeats=.FALSE.)
     414         1380 :       CALL section_add_keyword(section, keyword)
     415         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     422         1380 :       CALL section_add_keyword(section, keyword)
     423         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     430         1380 :       CALL section_add_keyword(section, keyword)
     431         1380 :       CALL keyword_release(keyword)
     432              : 
     433         1380 :    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         1380 :    SUBROUTINE create_g3x3_section(section)
     441              :       TYPE(section_type), POINTER                        :: section
     442              : 
     443              :       TYPE(keyword_type), POINTER                        :: keyword
     444              : 
     445         1380 :       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         1380 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     449              : 
     450         1380 :       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         2760 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     458         1380 :       CALL section_add_keyword(section, keyword)
     459         1380 :       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         2760 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     465         1380 :       CALL section_add_keyword(section, keyword)
     466         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     472         1380 :       CALL section_add_keyword(section, keyword)
     473         1380 :       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         1380 :                           n_var=-1, type_of_var=integer_t)
     478         1380 :       CALL section_add_keyword(section, keyword)
     479         1380 :       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         1380 :                           unit_str="internal_cp2k", n_var=-1)
     486         1380 :       CALL section_add_keyword(section, keyword)
     487         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     494         1380 :       CALL section_add_keyword(section, keyword)
     495         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     501         1380 :       CALL section_add_keyword(section, keyword)
     502         1380 :       CALL keyword_release(keyword)
     503              : 
     504         1380 :    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         1380 :    SUBROUTINE create_hbonds_section(section)
     512              :       TYPE(section_type), POINTER                        :: section
     513              : 
     514              :       TYPE(keyword_type), POINTER                        :: keyword
     515              : 
     516         1380 :       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         1380 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     520              : 
     521         1380 :       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         1380 :                           n_var=-1, type_of_var=char_t)
     528         1380 :       CALL section_add_keyword(section, keyword)
     529         1380 :       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         1380 :                           type_of_var=integer_t)
     537         1380 :       CALL section_add_keyword(section, keyword)
     538         1380 :       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         2760 :                           type_of_var=char_t)
     545         1380 :       CALL section_add_keyword(section, keyword)
     546         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     552         1380 :       CALL section_add_keyword(section, keyword)
     553         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     559         1380 :       CALL section_add_keyword(section, keyword)
     560         1380 :       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         1380 :                           unit_str="internal_cp2k")
     567         1380 :       CALL section_add_keyword(section, keyword)
     568         1380 :       CALL keyword_release(keyword)
     569              : 
     570         1380 :    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         1380 :    SUBROUTINE create_g4x6_section(section)
     578              :       TYPE(section_type), POINTER                        :: section
     579              : 
     580              :       TYPE(keyword_type), POINTER                        :: keyword
     581              : 
     582         1380 :       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         1380 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     586              : 
     587         1380 :       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         2760 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     595         1380 :       CALL section_add_keyword(section, keyword)
     596         1380 :       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         2760 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     602         1380 :       CALL section_add_keyword(section, keyword)
     603         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     609         1380 :       CALL section_add_keyword(section, keyword)
     610         1380 :       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         1380 :                           n_var=4, type_of_var=integer_t)
     615         1380 :       CALL section_add_keyword(section, keyword)
     616         1380 :       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         1380 :                           type_of_var=real_t, n_var=6, unit_str="internal_cp2k")
     623         1380 :       CALL section_add_keyword(section, keyword)
     624         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     631         1380 :       CALL section_add_keyword(section, keyword)
     632         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     638         1380 :       CALL section_add_keyword(section, keyword)
     639         1380 :       CALL keyword_release(keyword)
     640              : 
     641         1380 :    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         1380 :    SUBROUTINE create_vsite_section(section)
     649              :       TYPE(section_type), POINTER                        :: section
     650              : 
     651              :       TYPE(keyword_type), POINTER                        :: keyword
     652              : 
     653         1380 :       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         1380 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     657              : 
     658         1380 :       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         2760 :                           usage="MOL {integer}", n_var=1, type_of_var=integer_t)
     666         1380 :       CALL section_add_keyword(section, keyword)
     667         1380 :       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         2760 :                           usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
     673         1380 :       CALL section_add_keyword(section, keyword)
     674         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     680         1380 :       CALL section_add_keyword(section, keyword)
     681         1380 :       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         1380 :                           n_var=4, type_of_var=integer_t)
     687         1380 :       CALL section_add_keyword(section, keyword)
     688         1380 :       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         1380 :                           type_of_var=real_t, n_var=2, unit_str="internal_cp2k")
     696         1380 :       CALL section_add_keyword(section, keyword)
     697         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     704         1380 :       CALL section_add_keyword(section, keyword)
     705         1380 :       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         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     711         1380 :       CALL section_add_keyword(section, keyword)
     712         1380 :       CALL keyword_release(keyword)
     713              : 
     714         1380 :    END SUBROUTINE create_vsite_section
     715              : END MODULE input_cp2k_constraints
        

Generated by: LCOV version 2.0-1