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