(git:d3d49ac)
Loading...
Searching...
No Matches
input_cp2k_constraints.F
Go to the documentation of this file.
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! **************************************************************************************************
16 USE cell_types, ONLY: use_perd_x,&
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
50
51!***
52CONTAINS
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 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 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 n_keywords=0, n_subsections=2, repeats=.false.)
71
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")
78 CALL section_add_keyword(section, keyword)
79 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 default_r_val=1.0e-10_dp, unit_str="internal_cp2k")
86 CALL section_add_keyword(section, keyword)
87 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 default_l_val=.false., lone_keyword_l_val=.true.)
94 CALL section_add_keyword(section, keyword)
95 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 default_l_val=.false., lone_keyword_l_val=.true.)
101 CALL section_add_keyword(section, keyword)
102 CALL keyword_release(keyword)
103
104 CALL create_hbonds_section(subsection)
105 CALL restraint_info_section(subsection)
106 CALL section_add_subsection(section, subsection)
107 CALL section_release(subsection)
108
109 CALL create_g3x3_section(subsection)
110 CALL restraint_info_section(subsection)
111 CALL section_add_subsection(section, subsection)
112 CALL section_release(subsection)
113
114 CALL create_g4x6_section(subsection)
115 CALL restraint_info_section(subsection)
116 CALL section_add_subsection(section, subsection)
117 CALL section_release(subsection)
118
119 CALL create_vsite_section(subsection)
120 CALL restraint_info_section(subsection)
121 CALL section_add_subsection(section, subsection)
122 CALL section_release(subsection)
123
124 CALL create_collective_section(subsection)
125 CALL restraint_info_section(subsection)
126 CALL section_add_subsection(section, subsection)
127 CALL section_release(subsection)
128
129 CALL create_fixed_atom_section(subsection)
130 CALL restraint_info_section(subsection)
131 CALL section_add_subsection(section, subsection)
132 CALL section_release(subsection)
133
134 CALL create_f_a_rest_section(subsection)
135 CALL section_add_subsection(section, subsection)
136 CALL section_release(subsection)
137
138 CALL create_clv_rest_section(subsection)
139 CALL section_add_subsection(section, subsection)
140 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 print_level=high_print_level, filename="__STD_OUT__")
145 CALL section_add_subsection(section, print_key)
146 CALL section_release(print_key)
147
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 print_level=high_print_level, filename="")
155 CALL section_add_subsection(section, print_key)
156 CALL section_release(print_key)
157
158 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 SUBROUTINE create_clv_rest_section(section)
168 TYPE(section_type), POINTER :: section
169
170 TYPE(keyword_type), POINTER :: keyword
171
172 cpassert(.NOT. ASSOCIATED(section))
173 NULLIFY (keyword)
174 CALL section_create(section, __location__, name="COLVAR_RESTART", &
175 description="Specify restart position only for COLVAR restraints.", &
176 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 usage="{Real}", type_of_var=real_t, n_var=1)
183 CALL section_add_keyword(section, keyword)
184 CALL keyword_release(keyword)
185
186 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 SUBROUTINE create_f_a_rest_section(section)
196 TYPE(section_type), POINTER :: section
197
198 TYPE(keyword_type), POINTER :: keyword
199
200 cpassert(.NOT. ASSOCIATED(section))
201 NULLIFY (keyword)
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.)
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 usage="{Real} ...", type_of_var=real_t, n_var=-1)
211 CALL section_add_keyword(section, keyword)
212 CALL keyword_release(keyword)
213
214 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 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 cpassert(ASSOCIATED(section))
228 NULLIFY (subsection, keyword)
229 CALL section_create(subsection, __location__, name="RESTRAINT", &
230 description="Activate and specify information on restraint instead of constraint", &
231 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 type_of_var=real_t, default_r_val=0.0_dp, unit_str="internal_cp2k")
238 CALL section_add_keyword(subsection, keyword)
239 CALL keyword_release(keyword)
240
241 CALL section_add_subsection(section, subsection)
242 CALL section_release(subsection)
243
244 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 SUBROUTINE create_collective_section(section)
252 TYPE(section_type), POINTER :: section
253
254 TYPE(keyword_type), POINTER :: keyword
255
256 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 n_subsections=0, repeats=.true.)
261 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 type_of_var=integer_t)
267 CALL section_add_keyword(section, keyword)
268 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 usage="MOLECULE {integer}", n_var=1, type_of_var=integer_t)
275 CALL section_add_keyword(section, keyword)
276 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 usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
282 CALL section_add_keyword(section, keyword)
283 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 default_l_val=.false., lone_keyword_l_val=.true.)
289 CALL section_add_keyword(section, keyword)
290 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 type_of_var=real_t, unit_str="internal_cp2k")
297 CALL section_add_keyword(section, keyword)
298 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 default_r_val=0.0_dp, unit_str="internal_cp2k")
307 CALL section_add_keyword(section, keyword)
308 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 unit_str="internal_cp2k")
315 CALL section_add_keyword(section, keyword)
316 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 default_l_val=.false., lone_keyword_l_val=.true.)
322 CALL section_add_keyword(section, keyword)
323 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 default_l_val=.false., lone_keyword_l_val=.true.)
329 CALL section_add_keyword(section, keyword)
330 CALL keyword_release(keyword)
331
332 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 SUBROUTINE create_fixed_atom_section(section)
340 TYPE(section_type), POINTER :: section
341
342 TYPE(keyword_type), POINTER :: keyword
343
344 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 "FIX_ATOM_RESTART.", n_keywords=3, n_subsections=0, repeats=.true.)
351 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, &
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 repeats=.false.)
371 CALL section_add_keyword(section, keyword)
372 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 n_var=-1, type_of_var=integer_t)
379 CALL section_add_keyword(section, keyword)
380 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 n_var=-1, type_of_var=char_t)
387 CALL section_add_keyword(section, keyword)
388 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"), &
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 default_i_val=do_constr_none, repeats=.false.)
401 CALL section_add_keyword(section, keyword)
402 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)"), &
413 default_i_val=do_constr_none, repeats=.false.)
414 CALL section_add_keyword(section, keyword)
415 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 default_l_val=.false., lone_keyword_l_val=.true.)
422 CALL section_add_keyword(section, keyword)
423 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 default_l_val=.false., lone_keyword_l_val=.true.)
430 CALL section_add_keyword(section, keyword)
431 CALL keyword_release(keyword)
432
433 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 SUBROUTINE create_g3x3_section(section)
441 TYPE(section_type), POINTER :: section
442
443 TYPE(keyword_type), POINTER :: keyword
444
445 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 n_keywords=3, n_subsections=0, repeats=.true.)
449
450 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 usage="MOL {integer}", n_var=1, type_of_var=integer_t)
458 CALL section_add_keyword(section, keyword)
459 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 usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
465 CALL section_add_keyword(section, keyword)
466 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 default_l_val=.false., lone_keyword_l_val=.true.)
472 CALL section_add_keyword(section, keyword)
473 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 n_var=-1, type_of_var=integer_t)
478 CALL section_add_keyword(section, keyword)
479 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 unit_str="internal_cp2k", n_var=-1)
486 CALL section_add_keyword(section, keyword)
487 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 default_l_val=.false., lone_keyword_l_val=.true.)
494 CALL section_add_keyword(section, keyword)
495 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 default_l_val=.false., lone_keyword_l_val=.true.)
501 CALL section_add_keyword(section, keyword)
502 CALL keyword_release(keyword)
503
504 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 SUBROUTINE create_hbonds_section(section)
512 TYPE(section_type), POINTER :: section
513
514 TYPE(keyword_type), POINTER :: keyword
515
516 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 n_keywords=3, n_subsections=0, repeats=.false.)
520
521 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 n_var=-1, type_of_var=char_t)
528 CALL section_add_keyword(section, keyword)
529 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 type_of_var=integer_t)
537 CALL section_add_keyword(section, keyword)
538 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 type_of_var=char_t)
545 CALL section_add_keyword(section, keyword)
546 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 default_l_val=.false., lone_keyword_l_val=.true.)
552 CALL section_add_keyword(section, keyword)
553 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 default_l_val=.false., lone_keyword_l_val=.true.)
559 CALL section_add_keyword(section, keyword)
560 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 unit_str="internal_cp2k")
567 CALL section_add_keyword(section, keyword)
568 CALL keyword_release(keyword)
569
570 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 SUBROUTINE create_g4x6_section(section)
578 TYPE(section_type), POINTER :: section
579
580 TYPE(keyword_type), POINTER :: keyword
581
582 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 n_keywords=3, n_subsections=0, repeats=.true.)
586
587 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 usage="MOL {integer}", n_var=1, type_of_var=integer_t)
595 CALL section_add_keyword(section, keyword)
596 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 usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
602 CALL section_add_keyword(section, keyword)
603 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 default_l_val=.false., lone_keyword_l_val=.true.)
609 CALL section_add_keyword(section, keyword)
610 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 n_var=4, type_of_var=integer_t)
615 CALL section_add_keyword(section, keyword)
616 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 type_of_var=real_t, n_var=6, unit_str="internal_cp2k")
623 CALL section_add_keyword(section, keyword)
624 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 default_l_val=.false., lone_keyword_l_val=.true.)
631 CALL section_add_keyword(section, keyword)
632 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 default_l_val=.false., lone_keyword_l_val=.true.)
638 CALL section_add_keyword(section, keyword)
639 CALL keyword_release(keyword)
640
641 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 SUBROUTINE create_vsite_section(section)
649 TYPE(section_type), POINTER :: section
650
651 TYPE(keyword_type), POINTER :: keyword
652
653 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 n_keywords=3, n_subsections=0, repeats=.true.)
657
658 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 usage="MOL {integer}", n_var=1, type_of_var=integer_t)
666 CALL section_add_keyword(section, keyword)
667 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 usage="MOLNAME {character}", n_var=1, type_of_var=char_t)
673 CALL section_add_keyword(section, keyword)
674 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 default_l_val=.false., lone_keyword_l_val=.true.)
680 CALL section_add_keyword(section, keyword)
681 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 n_var=4, type_of_var=integer_t)
687 CALL section_add_keyword(section, keyword)
688 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 type_of_var=real_t, n_var=2, unit_str="internal_cp2k")
696 CALL section_add_keyword(section, keyword)
697 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 default_l_val=.false., lone_keyword_l_val=.true.)
704 CALL section_add_keyword(section, keyword)
705 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 default_l_val=.false., lone_keyword_l_val=.true.)
711 CALL section_add_keyword(section, keyword)
712 CALL keyword_release(keyword)
713
714 END SUBROUTINE create_vsite_section
715END MODULE input_cp2k_constraints
Handles all functions related to the CELL.
Definition cell_types.F:15
integer, parameter, public use_perd_xyz
Definition cell_types.F:42
integer, parameter, public use_perd_y
Definition cell_types.F:42
integer, parameter, public use_perd_xz
Definition cell_types.F:42
integer, parameter, public use_perd_x
Definition cell_types.F:42
integer, parameter, public use_perd_z
Definition cell_types.F:42
integer, parameter, public use_perd_yz
Definition cell_types.F:42
integer, parameter, public use_perd_xy
Definition cell_types.F:42
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
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_constr_atomic
integer, parameter, public do_constr_molec
integer, parameter, public do_constr_none
subroutine, public create_constraint_section(section)
Create the constraint section. This section is useful to impose constraints.
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations, deprecation_notice)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
a wrapper for basic fortran types.
integer, parameter, public real_t
integer, parameter, public char_t
integer, parameter, public integer_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file