41#include "./base/base_uses.f90"
46 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
47 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_constraints'
66 cpassert(.NOT.
ASSOCIATED(section))
68 description=
"Section specifying information regarding how to impose constraints"// &
70 n_keywords=0, n_subsections=2, repeats=.false.)
72 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 default_r_val=1.0e-6_dp, unit_str=
"internal_cp2k")
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 default_r_val=1.0e-10_dp, unit_str=
"internal_cp2k")
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 default_l_val=.false., lone_keyword_l_val=.true.)
97 CALL keyword_create(keyword, __location__, name=
"PIMD_BEADWISE_CONSTRAINT", &
98 description=
"Apply beadwise constraints to PIMD.", &
99 usage=
"PIMD_BEADWISE_CONSTRAINT <LOGICAL>", &
100 default_l_val=.false., lone_keyword_l_val=.true.)
104 CALL create_hbonds_section(subsection)
105 CALL restraint_info_section(subsection)
109 CALL create_g3x3_section(subsection)
110 CALL restraint_info_section(subsection)
114 CALL create_g4x6_section(subsection)
115 CALL restraint_info_section(subsection)
119 CALL create_vsite_section(subsection)
120 CALL restraint_info_section(subsection)
124 CALL create_collective_section(subsection)
125 CALL restraint_info_section(subsection)
129 CALL create_fixed_atom_section(subsection)
130 CALL restraint_info_section(subsection)
134 CALL create_f_a_rest_section(subsection)
138 CALL create_clv_rest_section(subsection)
143 description=
"Prints information about iterative constraints solutions", &
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.", &
167 SUBROUTINE create_clv_rest_section(section)
172 cpassert(.NOT.
ASSOCIATED(section))
174 CALL section_create(section, __location__, name=
"COLVAR_RESTART", &
175 description=
"Specify restart position only for COLVAR restraints.", &
176 n_subsections=0, repeats=.false.)
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 usage=
"{Real}", type_of_var=
real_t, n_var=1)
186 END SUBROUTINE create_clv_rest_section
195 SUBROUTINE create_f_a_rest_section(section)
200 cpassert(.NOT.
ASSOCIATED(section))
202 CALL section_create(section, __location__, name=
"FIX_ATOM_RESTART", &
203 description=
"Specify restart position only for FIXED_ATOMS restraints.", &
204 n_subsections=0, repeats=.false.)
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 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
214 END SUBROUTINE create_f_a_rest_section
221 SUBROUTINE restraint_info_section(section)
227 cpassert(
ASSOCIATED(section))
228 NULLIFY (subsection, keyword)
230 description=
"Activate and specify information on restraint instead of constraint", &
231 n_subsections=0, repeats=.false.)
234 description=
"Specifies the force constant for the harmonic restraint. The functional "// &
235 "form for the restraint is: K*(X-TARGET)^2.", &
237 type_of_var=
real_t, default_r_val=0.0_dp, unit_str=
"internal_cp2k")
244 END SUBROUTINE restraint_info_section
251 SUBROUTINE create_collective_section(section)
256 cpassert(.NOT.
ASSOCIATED(section))
258 description=
"Used to constraint collective (general) degrees of freedom, "// &
259 "writing langrangian multipliers to file.", &
260 n_subsections=0, repeats=.true.)
264 description=
"Specifies the index (in input file order) of the type of colvar to constrain.", &
265 usage=
"COLVAR {int}", &
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 usage=
"MOLECULE {integer}", n_var=1, type_of_var=
integer_t)
279 variants=[
"SEGNAME"], &
280 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
281 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
285 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
286 description=
"Specify if the constraint/restraint is intermolecular.", &
287 usage=
"INTERMOLECULAR <LOGICAL>", &
288 default_l_val=.false., lone_keyword_l_val=.true.)
293 description=
"Specifies the target value of the constrained collective"// &
294 " variable (units depend on the colvar).", &
295 usage=
"TARGET {real}", &
296 type_of_var=
real_t, unit_str=
"internal_cp2k")
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 default_r_val=0.0_dp, unit_str=
"internal_cp2k")
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 unit_str=
"internal_cp2k")
319 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
320 usage=
"EXCLUDE_QM <LOGICAL>", &
321 default_l_val=.false., lone_keyword_l_val=.true.)
326 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
327 usage=
"EXCLUDE_MM <LOGICAL>", &
328 default_l_val=.false., lone_keyword_l_val=.true.)
332 END SUBROUTINE create_collective_section
339 SUBROUTINE create_fixed_atom_section(section)
344 cpassert(.NOT.
ASSOCIATED(section))
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 "FIX_ATOM_RESTART.", n_keywords=3, n_subsections=0, repeats=.true.)
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)", &
359 enum_c_vals=
s2a(
"x",
"y",
"z",
"xy",
"xz",
"yz",
"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."), &
376 description=
"Specifies a list of atoms to freeze.", &
377 usage=
"LIST {integer} {integer} .. {integer}", repeats=.true., &
383 variants=[
"SEGNAME"], &
384 description=
"Specifies the name of the molecule to fix", &
385 usage=
"MOLNAME WAT MEOH", repeats=.true., &
386 n_var=-1, type_of_var=
char_t)
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"), &
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)"), &
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)"), &
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 default_l_val=.false., lone_keyword_l_val=.true.)
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 default_l_val=.false., lone_keyword_l_val=.true.)
433 END SUBROUTINE create_fixed_atom_section
440 SUBROUTINE create_g3x3_section(section)
445 cpassert(.NOT.
ASSOCIATED(section))
447 description=
"This section is used to set 3x3 (3 atoms and 3 distances) constraints.", &
448 n_keywords=3, n_subsections=0, repeats=.true.)
455 description=
"Specifies the molecule kind number on which constraint will be applied."// &
456 " MOLECULE and MOLNAME keyword exclude themself mutually.", &
457 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
462 variants=[
"SEGNAME"], &
463 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
464 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
468 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
469 description=
"Specify if the constraint/restraint is intermolecular.", &
470 usage=
"INTERMOLECULAR <LOGICAL>", &
471 default_l_val=.false., lone_keyword_l_val=.true.)
476 description=
"Atoms' index on which apply the constraint", usage=
"ATOMS 1 3 6", &
483 description=
"The constrained distances' values.", &
484 usage=
"DISTANCES {real} {real} {real}", type_of_var=
real_t, &
485 unit_str=
"internal_cp2k", n_var=-1)
491 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
492 usage=
"EXCLUDE_QM <LOGICAL>", &
493 default_l_val=.false., lone_keyword_l_val=.true.)
498 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
499 usage=
"EXCLUDE_MM <LOGICAL>", &
500 default_l_val=.false., lone_keyword_l_val=.true.)
504 END SUBROUTINE create_g3x3_section
511 SUBROUTINE create_hbonds_section(section)
516 cpassert(.NOT.
ASSOCIATED(section))
518 description=
"This section is used to set bonds constraints involving Hydrogen atoms", &
519 n_keywords=3, n_subsections=0, repeats=.false.)
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 n_var=-1, type_of_var=
char_t)
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, &
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, &
549 description=
"Does not shake HBONDS in the QM region within a QM/MM calculation", &
550 usage=
"EXCLUDE_QM <LOGICAL>", &
551 default_l_val=.false., lone_keyword_l_val=.true.)
556 description=
"Does not shake HBONDS in the MM region within a QM/MM calculation", &
557 usage=
"EXCLUDE_MM <LOGICAL>", &
558 default_l_val=.false., lone_keyword_l_val=.true.)
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 unit_str=
"internal_cp2k")
570 END SUBROUTINE create_hbonds_section
577 SUBROUTINE create_g4x6_section(section)
582 cpassert(.NOT.
ASSOCIATED(section))
584 description=
"This section is used to set 4x6 (4 atoms and 6 distances) constraints.", &
585 n_keywords=3, n_subsections=0, repeats=.true.)
592 description=
"Specifies the molecule number on which constraint will be applied."// &
593 " MOLECULE and MOLNAME keyword exclude themself mutually.", &
594 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
599 variants=[
"SEGNAME"], &
600 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
601 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
605 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
606 description=
"Specify if the constraint/restraint is intermolecular.", &
607 usage=
"INTERMOLECULAR <LOGICAL>", &
608 default_l_val=.false., lone_keyword_l_val=.true.)
613 description=
"Atoms' index on which apply the constraint", usage=
"ATOMS 1 3 6 4", &
620 description=
"The constrained distances' values.", &
621 usage=
"DISTANCES {real} {real} {real} {real} {real} {real}", &
622 type_of_var=
real_t, n_var=6, unit_str=
"internal_cp2k")
628 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
629 usage=
"EXCLUDE_QM <LOGICAL>", &
630 default_l_val=.false., lone_keyword_l_val=.true.)
635 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
636 usage=
"EXCLUDE_MM <LOGICAL>", &
637 default_l_val=.false., lone_keyword_l_val=.true.)
641 END SUBROUTINE create_g4x6_section
648 SUBROUTINE create_vsite_section(section)
653 cpassert(.NOT.
ASSOCIATED(section))
655 description=
"This section is used to set a virtual interaction-site constraint.", &
656 n_keywords=3, n_subsections=0, repeats=.true.)
663 description=
"Specifies the molecule number on which constraint will be applied."// &
664 " MOLECULE and MOLNAME keyword exclude themself mutually.", &
665 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
670 variants=[
"SEGNAME"], &
671 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
672 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
676 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
677 description=
"Specify if the constraint/restraint is intermolecular.", &
678 usage=
"INTERMOLECULAR <LOGICAL>", &
679 default_l_val=.false., lone_keyword_l_val=.true.)
684 description=
"Atoms' index on which apply the constraint (v i j k), first is virtual site", &
685 usage=
"ATOMS 1 2 3 4", &
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 type_of_var=
real_t, n_var=2, unit_str=
"internal_cp2k")
701 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
702 usage=
"EXCLUDE_QM <LOGICAL>", &
703 default_l_val=.false., lone_keyword_l_val=.true.)
708 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
709 usage=
"EXCLUDE_MM <LOGICAL>", &
710 default_l_val=.false., lone_keyword_l_val=.true.)
714 END SUBROUTINE create_vsite_section
Handles all functions related to the CELL.
integer, parameter, public use_perd_xyz
integer, parameter, public use_perd_y
integer, parameter, public use_perd_xz
integer, parameter, public use_perd_x
integer, parameter, public use_perd_z
integer, parameter, public use_perd_yz
integer, parameter, public use_perd_xy
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public high_print_level
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.