LCOV - code coverage report
Current view: top level - src - input_cp2k_constraints.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 100.0 % 238 238
Test Date: 2025-12-04 06:27:48 Functions: 100.0 % 10 10

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

Generated by: LCOV version 2.0-1