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 out the lagrange multipliers of the specified constraints during an MD.", &
164 SUBROUTINE create_clv_rest_section(section)
169 cpassert(.NOT.
ASSOCIATED(section))
171 CALL section_create(section, __location__, name=
"COLVAR_RESTART", &
172 description=
"Specify restart position only for COLVAR restraints.", &
173 n_subsections=0, repeats=.false.)
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 usage=
"{Real}", type_of_var=
real_t, n_var=1)
183 END SUBROUTINE create_clv_rest_section
192 SUBROUTINE create_f_a_rest_section(section)
197 cpassert(.NOT.
ASSOCIATED(section))
199 CALL section_create(section, __location__, name=
"FIX_ATOM_RESTART", &
200 description=
"Specify restart position only for FIXED_ATOMS restraints.", &
201 n_subsections=0, repeats=.false.)
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 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
211 END SUBROUTINE create_f_a_rest_section
218 SUBROUTINE restraint_info_section(section)
224 cpassert(
ASSOCIATED(section))
225 NULLIFY (subsection, keyword)
227 description=
"Activate and specify information on restraint instead of constraint", &
228 n_subsections=0, repeats=.false.)
231 description=
"Specifies the force constant for the harmonic restraint. The functional "// &
232 "form for the restraint is: K*(X-TARGET)^2.", &
234 type_of_var=
real_t, default_r_val=0.0_dp, unit_str=
"internal_cp2k")
241 END SUBROUTINE restraint_info_section
248 SUBROUTINE create_collective_section(section)
253 cpassert(.NOT.
ASSOCIATED(section))
255 description=
"Used to constraint collective (general) degrees of freedom, "// &
256 "writing langrangian multipliers to file.", &
257 n_subsections=0, repeats=.true.)
261 description=
"Specifies the index (in input file order) of the type of colvar to constrain.", &
262 usage=
"COLVAR {int}", &
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 usage=
"MOLECULE {integer}", n_var=1, type_of_var=
integer_t)
276 variants=(/
"SEGNAME"/), &
277 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
278 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
282 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
283 description=
"Specify if the constraint/restraint is intermolecular.", &
284 usage=
"INTERMOLECULAR <LOGICAL>", &
285 default_l_val=.false., lone_keyword_l_val=.true.)
290 description=
"Specifies the target value of the constrained collective"// &
291 " variable (units depend on the colvar).", &
292 usage=
"TARGET {real}", &
293 type_of_var=
real_t, unit_str=
"internal_cp2k")
297 CALL keyword_create(keyword, __location__, name=
"TARGET_GROWTH", &
298 description=
"Specifies the growth speed of the target value of the constrained collective"// &
300 usage=
"TARGET_GROWTH {real}", &
301 default_r_val=0.0_dp, unit_str=
"internal_cp2k")
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 unit_str=
"internal_cp2k")
314 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
315 usage=
"EXCLUDE_QM <LOGICAL>", &
316 default_l_val=.false., lone_keyword_l_val=.true.)
321 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
322 usage=
"EXCLUDE_MM <LOGICAL>", &
323 default_l_val=.false., lone_keyword_l_val=.true.)
327 END SUBROUTINE create_collective_section
334 SUBROUTINE create_fixed_atom_section(section)
339 cpassert(.NOT.
ASSOCIATED(section))
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 "FIX_ATOM_RESTART.", n_keywords=3, n_subsections=0, repeats=.true.)
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)", &
354 enum_c_vals=
s2a(
"x",
"y",
"z",
"xy",
"xz",
"yz",
"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."), &
371 description=
"Specifies a list of atoms to freeze.", &
372 usage=
"LIST {integer} {integer} .. {integer}", repeats=.true., &
378 variants=(/
"SEGNAME"/), &
379 description=
"Specifies the name of the molecule to fix", &
380 usage=
"MOLNAME WAT MEOH", repeats=.true., &
381 n_var=-1, type_of_var=
char_t)
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"), &
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)"), &
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)"), &
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 default_l_val=.false., lone_keyword_l_val=.true.)
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 default_l_val=.false., lone_keyword_l_val=.true.)
428 END SUBROUTINE create_fixed_atom_section
435 SUBROUTINE create_g3x3_section(section)
440 cpassert(.NOT.
ASSOCIATED(section))
442 description=
"This section is used to set 3x3 (3 atoms and 3 distances) constraints.", &
443 n_keywords=3, n_subsections=0, repeats=.true.)
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 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
457 variants=(/
"SEGNAME"/), &
458 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
459 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
463 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
464 description=
"Specify if the constraint/restraint is intermolecular.", &
465 usage=
"INTERMOLECULAR <LOGICAL>", &
466 default_l_val=.false., lone_keyword_l_val=.true.)
471 description=
"Atoms' index on which apply the constraint", usage=
"ATOMS 1 3 6", &
478 description=
"The constrained distances' values.", &
479 usage=
"DISTANCES {real} {real} {real}", type_of_var=
real_t, &
480 unit_str=
"internal_cp2k", n_var=-1)
486 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
487 usage=
"EXCLUDE_QM <LOGICAL>", &
488 default_l_val=.false., lone_keyword_l_val=.true.)
493 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
494 usage=
"EXCLUDE_MM <LOGICAL>", &
495 default_l_val=.false., lone_keyword_l_val=.true.)
499 END SUBROUTINE create_g3x3_section
506 SUBROUTINE create_hbonds_section(section)
511 cpassert(.NOT.
ASSOCIATED(section))
513 description=
"This section is used to set bonds constraints involving Hydrogen atoms", &
514 n_keywords=3, n_subsections=0, repeats=.false.)
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 n_var=-1, type_of_var=
char_t)
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, &
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, &
544 description=
"Does not shake HBONDS in the QM region within a QM/MM calculation", &
545 usage=
"EXCLUDE_QM <LOGICAL>", &
546 default_l_val=.false., lone_keyword_l_val=.true.)
551 description=
"Does not shake HBONDS in the MM region within a QM/MM calculation", &
552 usage=
"EXCLUDE_MM <LOGICAL>", &
553 default_l_val=.false., lone_keyword_l_val=.true.)
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 unit_str=
"internal_cp2k")
565 END SUBROUTINE create_hbonds_section
572 SUBROUTINE create_g4x6_section(section)
577 cpassert(.NOT.
ASSOCIATED(section))
579 description=
"This section is used to set 4x6 (4 atoms and 6 distances) constraints.", &
580 n_keywords=3, n_subsections=0, repeats=.true.)
586 variants=(/
"MOL"/), &
587 description=
"Specifies the molecule number on which constraint will be applied."// &
588 " MOLECULE and MOLNAME keyword exclude themself mutually.", &
589 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
594 variants=(/
"SEGNAME"/), &
595 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
596 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
600 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
601 description=
"Specify if the constraint/restraint is intermolecular.", &
602 usage=
"INTERMOLECULAR <LOGICAL>", &
603 default_l_val=.false., lone_keyword_l_val=.true.)
608 description=
"Atoms' index on which apply the constraint", usage=
"ATOMS 1 3 6 4", &
615 description=
"The constrained distances' values.", &
616 usage=
"DISTANCES {real} {real} {real} {real} {real} {real}", &
617 type_of_var=
real_t, n_var=6, unit_str=
"internal_cp2k")
623 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
624 usage=
"EXCLUDE_QM <LOGICAL>", &
625 default_l_val=.false., lone_keyword_l_val=.true.)
630 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
631 usage=
"EXCLUDE_MM <LOGICAL>", &
632 default_l_val=.false., lone_keyword_l_val=.true.)
636 END SUBROUTINE create_g4x6_section
643 SUBROUTINE create_vsite_section(section)
648 cpassert(.NOT.
ASSOCIATED(section))
650 description=
"This section is used to set a virtual interaction-site constraint.", &
651 n_keywords=3, n_subsections=0, repeats=.true.)
657 variants=(/
"MOL"/), &
658 description=
"Specifies the molecule number on which constraint will be applied."// &
659 " MOLECULE and MOLNAME keyword exclude themself mutually.", &
660 usage=
"MOL {integer}", n_var=1, type_of_var=
integer_t)
665 variants=(/
"SEGNAME"/), &
666 description=
"Specifies the name of the molecule on which the constraint will be applied.", &
667 usage=
"MOLNAME {character}", n_var=1, type_of_var=
char_t)
671 CALL keyword_create(keyword, __location__, name=
"INTERMOLECULAR", &
672 description=
"Specify if the constraint/restraint is intermolecular.", &
673 usage=
"INTERMOLECULAR <LOGICAL>", &
674 default_l_val=.false., lone_keyword_l_val=.true.)
679 description=
"Atoms' index on which apply the constraint (v i j k), first is virtual site", &
680 usage=
"ATOMS 1 2 3 4", &
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 type_of_var=
real_t, n_var=2, unit_str=
"internal_cp2k")
696 description=
"Does not apply the constraint to the QM region within a QM/MM calculation", &
697 usage=
"EXCLUDE_QM <LOGICAL>", &
698 default_l_val=.false., lone_keyword_l_val=.true.)
703 description=
"Does not apply the constraint to the MM region within a QM/MM calculation", &
704 usage=
"EXCLUDE_MM <LOGICAL>", &
705 default_l_val=.false., lone_keyword_l_val=.true.)
709 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.