forked from cp2k/cp2k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput_cp2k_md.F
1400 lines (1184 loc) · 77.4 KB
/
input_cp2k_md.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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \par History
!> - taken out of input_cp2k_motion
!> \author Ole Schuett
! **************************************************************************************************
MODULE input_cp2k_md
USE bibliography, ONLY: &
Evans1983, Guidon2008, Kantorovich2008, Kantorovich2008a, Kuhne2007, Minary2003, &
Rengaraj2020, Ricci2003, Tuckerman1992, VandeVondele2002, West2006
USE cp_output_handling, ONLY: add_last_numeric,&
cp_print_key_section_create,&
debug_print_level,&
high_print_level,&
low_print_level,&
medium_print_level
USE cp_units, ONLY: cp_unit_to_cp2k
USE input_constants, ONLY: &
isokin_ensemble, langevin_ensemble, md_init_default, md_init_vib, npe_f_ensemble, &
npe_i_ensemble, nph_ensemble, nph_uniaxial_damped_ensemble, nph_uniaxial_ensemble, &
npt_f_ensemble, npt_i_ensemble, npt_ia_ensemble, nve_ensemble, nvt_adiabatic_ensemble, &
nvt_ensemble, reftraj_ensemble
USE input_cp2k_barostats, ONLY: create_barostat_section
USE input_cp2k_thermostats, ONLY: create_region_section,&
create_thermo_fast_section,&
create_thermo_slow_section,&
create_thermostat_section
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: integer_t,&
lchar_t,&
real_t
USE kinds, ONLY: dp
USE reftraj_types, ONLY: REFTRAJ_EVAL_ENERGY,&
REFTRAJ_EVAL_ENERGY_FORCES,&
REFTRAJ_EVAL_NONE
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_md'
PUBLIC :: create_md_section
CONTAINS
! **************************************************************************************************
!> \brief ...
!> \param section will contain the md section
!> \author fawzi
! **************************************************************************************************
SUBROUTINE create_md_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="MD", &
description="This section defines the whole set of parameters needed perform an MD run.", &
n_keywords=13, n_subsections=6, repeats=.FALSE.)
NULLIFY (keyword, subsection)
CALL keyword_create(keyword, __LOCATION__, name="ensemble", &
description="The ensemble/integrator that you want to use for MD propagation", &
usage="ensemble nve", &
default_i_val=nve_ensemble, &
enum_c_vals=s2a("NVE", "NVT", "NPT_I", "NPT_F", "MSST", "MSST_DAMPED", &
"HYDROSTATICSHOCK", "ISOKIN", "REFTRAJ", "LANGEVIN", "NPE_F", &
"NPE_I", "NVT_ADIABATIC", "NPT_IA"), &
enum_desc=s2a("constant energy (microcanonical)", &
"constant temperature and volume (canonical)", &
"constant temperature and pressure using an isotropic cell", &
"constant temperature and pressure using a flexible cell", &
"simulate steady shock (uniaxial)", &
"simulate steady shock (uniaxial) with extra viscosity", &
"simulate steady shock with hydrostatic pressure", &
"constant kinetic energy", &
"reading frames from a file called reftraj.xyz (e.g. for property calculation)", &
"langevin dynamics (constant temperature)", &
"constant pressure ensemble (no thermostat)", &
"constant pressure ensemble using an isotropic cell (no thermostat)", &
"adiabatic dynamics in constant temperature and volume ensemble (CAFES)", &
"NPT_I ensemble with frozen atoms in absolute coordinate"), &
citations=(/Evans1983, VandeVondele2002, Minary2003/), &
enum_i_vals=(/nve_ensemble, nvt_ensemble, npt_i_ensemble, npt_f_ensemble, &
nph_uniaxial_ensemble, nph_uniaxial_damped_ensemble, nph_ensemble, isokin_ensemble, &
reftraj_ensemble, langevin_ensemble, npe_f_ensemble, npe_i_ensemble, &
nvt_adiabatic_ensemble, npt_ia_ensemble/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="steps", &
description="The number of MD steps to perform, counting from step_start_val. ", &
usage="steps 100", default_i_val=3)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="max_steps", &
description="The number of MD steps to perform, counting from step 1", &
usage="max_steps 100", default_i_val=1000000000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="timestep", &
description="The length of an integration step (in case RESPA the large TIMESTEP)", &
usage="timestep 1.0", default_r_val=cp_unit_to_cp2k(value=0.5_dp, unit_str="fs"), &
unit_str="fs")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="step_start_val", &
description="The starting step value for the MD", usage="step_start_val <integer>", &
default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="time_start_val", &
description="The starting timer value for the MD", &
usage="time_start_val <real>", default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="fs"), &
unit_str="fs")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="econs_start_val", &
description="The starting value of the conserved quantity", &
usage="econs_start_val <real>", default_r_val=0.0_dp, &
unit_str="hartree")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temperature", &
description="The temperature in K used to initialize "// &
"the velocities with init and pos restart, and in the NPT/NVT simulations", &
usage="temperature 325.0", default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
unit_str="K")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_tol", &
variants=s2a("temp_to", "temperature_tolerance"), &
description="The maximum accepted deviation of the (global) temperature "// &
"from the desired target temperature before a rescaling of the velocites "// &
"is performed. If it is 0 no rescaling is performed. NOTE: This keyword is "// &
"obsolescent; Using a CSVR thermostat with a short timeconstant is "// &
"recommended as a better alternative.", &
usage="temp_tol 0.0", default_r_val=0.0_dp, unit_str='K')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_kind", &
description="Compute the temperature per each kind separately", &
usage="temp_kind 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="scale_temp_kind", &
description="When necessary rescale the temperature per each kind separately", &
usage="scale_temp_kind 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="comvel_tol", &
description="The maximum accepted velocity of the center of mass. "// &
"With Shell-Model, comvel may drift if MD%THERMOSTAT%REGION /= GLOBAL ", &
usage="comvel_tol 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="angvel_tol", &
description="The maximum accepted angular velocity. This option is ignored "// &
"when the system is periodic. Removes the components of the velocities that "// &
"project on the external rotational degrees of freedom.", &
usage="angvel_tol 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="angvel_zero", &
description="Set the initial angular velocity to zero. This option is ignored "// &
"when the system is periodic or when initial velocities are defined. Technically, "// &
"the part of the random initial velocities that projects on the external "// &
"rotational degrees of freedom is subtracted.", &
usage="angvel_zero 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="ANNEALING", &
description="Specifies the rescaling factor for annealing velocities. "// &
"Automatically enables the annealing procedure. This scheme works only for ensembles "// &
"that do not have thermostats on particles.", &
usage="annealing <REAL>", default_r_val=1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ANNEALING_CELL", &
description="Specifies the rescaling factor for annealing velocities of the CELL "// &
"Automatically enables the annealing procedure for the CELL. This scheme works only "// &
"for ensambles that do not have thermostat on CELLS velocities.", &
usage="ANNEALING_CELL <REAL>", default_r_val=1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE_ANNEALING", &
description="Specifies the rescaling factor for the external temperature. "// &
"This scheme works only for the Langevin ensemble.", &
usage="TEMPERATURE_ANNEALING <REAL>", default_r_val=1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="DISPLACEMENT_TOL", &
description="This keyword sets a maximum atomic displacement "// &
"in each Cartesian direction. "// &
"The maximum velocity is evaluated and if it is too large to remain "// &
"within the assigned limit, the time step is rescaled accordingly, "// &
"and the first half step of the velocity verlet is repeated.", &
usage="DISPLACEMENT_TOL <REAL>", default_r_val=100.0_dp, &
unit_str='angstrom')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="INITIALIZATION_METHOD", &
description="This keyword selects which method to use to initialize MD. "// &
"If velecities are not set explicitly, DEFAULT optioin will assign "// &
"random velocities and then scale according to TEMPERATURE; VIBRATIONAL "// &
"option will then use previously calculated vibrational modes to "// &
"initialise both the atomic positions and velocities so that the "// &
"starting point for MD is as close to canonical ensemble as possible, "// &
"without the need for lengthy equilibration steps. See PRL 96, 115504 "// &
"(2006). The user input atomic positions in this case are expected to "// &
"be already geometry optimised. Further options for VIBRATIONAL mode "// &
"is can be set in INITIAL_VIBRATION subsection. If unspecified, then "// &
"the DEFAULT mode will be used.", &
usage="INITIALIZATION_METHOD DEFAULT", &
default_i_val=md_init_default, &
enum_c_vals=s2a("DEFAULT", "VIBRATIONAL"), &
enum_desc=s2a("Assign random velocities and then scale according to "// &
"TEMPERATURE", &
"Initialise positions and velocities to give canonical ensemble "// &
"with TEMPERATURE, using the method described in PRL 96, 115504 (2006)"), &
enum_i_vals=(/md_init_default, md_init_vib/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_langevin_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_msst_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_barostat_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_thermostat_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_respa_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_shell_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_adiabatic_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_softening_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_reftraj_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_avgs_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_thermal_region_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_md_print_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_cascade_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_vib_init_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_md_section
! **************************************************************************************************
!> \brief Defines LANGEVIN section
!> \param section ...
!> \author teo
! **************************************************************************************************
SUBROUTINE create_langevin_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="Langevin", &
description="Controls the set of parameters to run a Langevin MD. "// &
"The integrator used follows that given in the article by Ricci et al. "// &
"The user can define regions in the system where the atoms inside "// &
"undergoes Langevin MD, while those outside the regions undergoes "// &
"NVE Born Oppenheimer MD. To define the regions, the user should "// &
"use THERMAL_REGION subsection of MOTION%MD. ", &
citations=(/Ricci2003, Kuhne2007, Rengaraj2020/), &
n_keywords=0, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="gamma", &
description="Gamma parameter for the Langevin dynamics (LD)", &
usage="gamma 0.001", &
default_r_val=0.0_dp, unit_str='fs^-1')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="Noisy_Gamma", &
variants=(/"NoisyGamma"/), &
description="Imaginary Langevin Friction term for LD with noisy forces.", &
citations=(/Kuhne2007/), &
usage="Noisy_Gamma 4.0E-5", default_r_val=0.0_dp, unit_str='fs^-1')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="Shadow_Gamma", &
variants=(/"ShadowGamma"/), &
description="Shadow Langevin Friction term for LD with noisy forces in order to adjust Noisy_Gamma.", &
citations=(/Rengaraj2020/), &
usage="Shadow_Gamma 0.001", default_r_val=0.0_dp, unit_str='fs^-1')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_langevin_section
! **************************************************************************************************
!> \brief Defines print section for MD
!> \param section ...
!> \author teo
! **************************************************************************************************
SUBROUTINE create_md_print_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: print_key
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="print", &
description="Controls the printing properties during an MD run", &
n_keywords=0, n_subsections=1, repeats=.FALSE.)
NULLIFY (print_key, keyword)
CALL keyword_create(keyword, __LOCATION__, name="FORCE_LAST", &
description="Print the output and restart file if walltime is reached or "// &
"if an external EXIT command is given. It still requires the keyword LAST "// &
"to be present for the specific print key (in case the last step should not "// &
"match with the print_key iteration number).", &
usage="FORCE_LAST LOGICAL", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
description="Controls the output the ener file", &
print_level=low_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "SHELL_ENERGY", &
description="Controls the output of the shell-energy file (only if shell-model)", &
print_level=medium_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_KIND", &
description="Controls the output of the temperature"// &
" computed separately for each kind", &
print_level=high_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_SHELL_KIND", &
description="Controls the output of the temperature of the"// &
" shell-core motion computed separately for each kind", &
print_level=high_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTER_OF_MASS", &
description="Controls the printing of COM velocity during an MD", &
print_level=medium_print_level, common_iter_levels=1, &
filename="__STD_OUT__")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "COEFFICIENTS", &
description="Controls the printing of coefficients during an MD run.", &
print_level=medium_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "ROTATIONAL_INFO", &
description="Controls the printing basic info during the calculation of the "// &
"translational/rotational degrees of freedom.", print_level=low_print_level, &
add_last=add_last_numeric, filename="__STD_OUT__")
CALL keyword_create(keyword, __LOCATION__, name="COORDINATES", &
description="Prints atomic coordinates in the standard orientation. "// &
"Coordinates are not affected during the calculation.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
description="Controls the printing of basic and summary information during the"// &
" Molecular Dynamics", &
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(section, print_key)
CALL section_release(print_key)
END SUBROUTINE create_md_print_section
! **************************************************************************************************
!> \brief Defines parameters for RESPA integration scheme
!> \param section will contain the coeff section
!> \author teo
! **************************************************************************************************
SUBROUTINE create_respa_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="RESPA", &
description="Multiple timestep integration based on RESPA (implemented for NVE only)."// &
" RESPA exploits multiple force_eval."// &
" In this case the order of the force_eval maps"// &
" the order of the respa shells from the slowest to the fastest force evaluation."// &
" If force_evals share the same subsys, it's enough then to specify the"// &
" subsys in the force_eval corresponding at the first index in the multiple_force_eval list."// &
" Can be used to speedup classical and ab initio MD simulations.", &
n_keywords=1, n_subsections=0, repeats=.FALSE., &
citations=(/Tuckerman1992, Guidon2008/))
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
description="The number of reference MD steps between two RESPA corrections.", &
usage="FREQUENCY <INTEGER>", default_i_val=5)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_respa_section
! **************************************************************************************************
!> \brief Defines parameters for REFTRAJ analysis
!> \param section will contain the coeff section
!> \author teo
! **************************************************************************************************
SUBROUTINE create_reftraj_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="REFTRAJ", &
description="Loads an external trajectory file and performs analysis on the"// &
" loaded snapshots.", &
n_keywords=1, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword, print_key, subsection)
CALL keyword_create(keyword, __LOCATION__, name="TRAJ_FILE_NAME", &
description="Specify the filename where the trajectory is stored. "// &
"If you built your own trajectory file make sure it has the trajectory format. "// &
'In particular, each structure has to be enumerated using " i = ..."', &
repeats=.FALSE., &
usage="TRAJ_FILE_NAME <CHARACTER>", default_lc_val="reftraj.xyz")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
description="Specify the filename where the cell is stored "// &
"(for trajectories generated within variable cell ensembles).", repeats=.FALSE., &
usage="CELL_FILE_NAME <CHARACTER>", default_lc_val="reftraj.cell")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="VARIABLE_VOLUME", &
description="Enables the possibility to read a CELL file with information on the CELL size during the MD.", &
repeats=.FALSE., 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="FIRST_SNAPSHOT", &
description="Index of the snapshot stored in the trajectory file "// &
"from which to start a REFTRAJ run", &
repeats=.FALSE., usage="FIRST_SNAPSHOT <INTEGER>", default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LAST_SNAPSHOT", &
description="Index of the last snapshot stored in the trajectory file "// &
"that is read along a REFTRAJ run. Must be specified as default is 0. "// &
"Must be specified exactly as LAST_SNAPSHOT = FIRST_SNAPSHOT + STRIDE*(number of strides) "// &
"to avoid an error 'Unexpected EOF'. Note that STRIDE*(number of strides) "// &
"is simply the number of steps between the first to last snapshot.", &
repeats=.FALSE., usage="LAST_SNAPSHOT", default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
description=" Stride in number of snapshot for the reftraj analysis", &
repeats=.FALSE., usage="STRIDE", default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EVAL", &
description="Selects the properties to evaluate for each retrieved snapshot during a REFTRAJ run", &
default_i_val=REFTRAJ_EVAL_NONE, &
enum_i_vals=(/REFTRAJ_EVAL_NONE, REFTRAJ_EVAL_ENERGY, REFTRAJ_EVAL_ENERGY_FORCES/), &
enum_c_vals=s2a("NONE", "ENERGY", "ENERGY_FORCES"), &
enum_desc=s2a("Evaluate nothing", "Evaluate only the energy", "Evaluate energy and forces"))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="eval_energy_forces", &
description="Evaluate energy and forces for each retrieved snapshot during a REFTRAJ run", &
repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
deprecation_notice="Please use MOTION / MD / REFTRAJ / EVAL instead.")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="eval_forces", &
description="Evaluate the forces for each retrieved snapshot during a REFTRAJ run", &
repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
deprecation_notice="Please use MOTION / MD / REFTRAJ / EVAL instead.")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_msd_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL section_create(subsection, __LOCATION__, name="print", &
description="The section that controls the output of a reftraj run", &
n_keywords=1, n_subsections=0, repeats=.FALSE.)
NULLIFY (print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_kind", &
description="Controls the output of msd per kind", &
print_level=low_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_molecule", &
description="Controls the output of msd per molecule kind", &
print_level=low_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "displaced_atom", &
description="Controls the output of index and dislacement of "// &
"atoms that moved away from the initial position of more than a "// &
"given distance (see msd%disp_tol)", &
print_level=low_print_level, common_iter_levels=1, &
filename="")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_reftraj_section
! **************************************************************************************************
!> \brief Defines parameters for MSD calculation along a REFTRAJ analysis
!> \param section will contain the coeff section
!> \author MI
! **************************************************************************************************
SUBROUTINE create_msd_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="MSD", &
description="Loads an external trajectory file and performs analysis on the"// &
" loaded snapshots.", &
n_keywords=3, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword, subsection)
CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="controls the activation of core-level spectroscopy simulations", &
usage="&MSD T", &
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="REF0_FILENAME", &
description="Specify the filename where the initial reference configuration is stored.", &
repeats=.FALSE., usage="REF0_FILENAME <CHARACTER>", default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_KIND", &
description="Set up the calculation of the MSD for each atomic kind", &
usage="MSD_PER_KIND <LOGICAL>", repeats=.FALSE., &
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="MSD_PER_MOLKIND", &
description="Set up the calculation of the MSD for each molecule kind. "// &
"The position of the center of mass of the molecule is considered.", &
usage="MSD_PER_MOLKIND <LOGICAL>", repeats=.FALSE., &
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="MSD_PER_REGION", &
description="Set up the calculation of the MSD for each defined region.", &
usage="MSD_PER_REGION <LOGICAL>", repeats=.FALSE., &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_region_section(subsection, "MSD calculation")
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL keyword_create(keyword, __LOCATION__, name="DISPLACED_ATOM", &
description="Identify the atoms that moved from their initial "// &
"position of a distance larger than a given tolerance (see msd%displacement_tol).", &
usage="DISPLACED_ATOM <LOGICAL>", repeats=.FALSE., &
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="displacement_tol", &
description="Lower limit to define displaced atoms", &
usage="DISPLACEMENT_TOL real", &
default_r_val=0._dp, n_var=1, unit_str='bohr')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_msd_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the coeff section
!> \author teo
! **************************************************************************************************
SUBROUTINE create_msst_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="msst", &
description="Parameters for Multi-Scale Shock Technique (MSST) "// &
"which simulate the effect of a steady planar shock on a unit cell. "// &
"Reed et. al. Physical Review Letters 90, 235503 (2003).", &
n_keywords=1, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="PRESSURE", &
description="Initial pressure", &
usage="PRESSURE real", &
default_r_val=0._dp, n_var=1, unit_str='bar')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
description="Initial energy", &
usage="ENERGY real", &
default_r_val=0._dp, n_var=1, unit_str='hartree')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="VOLUME", &
description="Initial volume", &
usage="VOLUME real", &
default_r_val=0._dp, n_var=1, unit_str='angstrom^3')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="CMASS", &
description="Effective cell mass", &
usage="CMASS real", &
default_r_val=0._dp, n_var=1, unit_str='au_m')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="VSHOCK", variants=(/"V_SHOCK"/), &
description="Velocity shock", &
usage="VSHOCK real", &
default_r_val=0._dp, n_var=1, unit_str='m/s')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
description="Damping coefficient for cell volume", &
usage="GAMMA real", &
unit_str='fs^-1', &
default_r_val=0.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_msst_section
! **************************************************************************************************
!> \brief section will contain some parameters for the shells dynamics
!> \param section ...
! **************************************************************************************************
SUBROUTINE create_shell_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: thermo_section
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="shell", &
description="Parameters of shell model in adiabatic dynamics.", &
n_keywords=4, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword, thermo_section)
CALL keyword_create(keyword, __LOCATION__, name="temperature", &
description="Temperature in K used to control "// &
"the internal velocities of the core-shell motion ", &
usage="temperature 5.0", &
default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
unit_str="K")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_tol", &
description="Maximum accepted temperature deviation"// &
" from the expected value, for the internal core-shell motion."// &
" If 0, no rescaling is performed", &
usage="temp_tol 0.0", default_r_val=0.0_dp, unit_str='K')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="nose_particle", &
description="If nvt or npt, the core and shell velocities are controlled "// &
"by the same thermostat used for the particle. This might favour heat exchange "// &
"and additional rescaling of the internal core-shell velocity is needed (TEMP_TOL)", &
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="DISPLACEMENT_SHELL_TOL", &
description="This keyword sets a maximum variation of the shell"// &
" core distance in each Cartesian direction."// &
" The maximum internal core-shell velocity is evaluated and"// &
" if it is too large to remain"// &
" within the assigned limit, the time step is rescaled accordingly,"// &
" and the first half step of the velocity verlet is repeated.", &
usage="DISPLACEMENT_SHELL_TOL <REAL>", default_r_val=100.0_dp, &
unit_str='angstrom')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_thermostat_section(thermo_section)
CALL section_add_subsection(section, thermo_section)
CALL section_release(thermo_section)
END SUBROUTINE create_shell_section
! **************************************************************************************************
!> \brief section will contain some parameters for the adiabatic dynamics
!> \param section ...
! **************************************************************************************************
SUBROUTINE create_adiabatic_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: thermo_fast_section, thermo_slow_section
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="ADIABATIC_DYNAMICS", &
description="Parameters used in canonical adiabatic free energy sampling (CAFES).", &
n_keywords=5, n_subsections=2, repeats=.FALSE., &
citations=(/VandeVondele2002/))
NULLIFY (keyword, thermo_fast_section, thermo_slow_section)
CALL keyword_create(keyword, __LOCATION__, name="temp_fast", &
description="Temperature in K used to control "// &
"the fast degrees of freedom ", &
usage="temp_fast 5.0", &
default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
unit_str="K")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_slow", &
description="Temperature in K used to control "// &
"the slow degrees of freedom ", &
usage="temp_slow 5.0", &
default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
unit_str="K")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_tol_fast", &
description="Maximum accepted temperature deviation"// &
" from the expected value, for the fast motion."// &
" If 0, no rescaling is performed", &
usage="temp_tol_fast 0.0", default_r_val=0.0_dp, unit_str='K')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_tol_slow", &
description="Maximum accepted temperature deviation"// &
" from the expected value, for the slow motion."// &
" If 0, no rescaling is performed", &
usage="temp_tol_slow 0.0", default_r_val=0.0_dp, unit_str='K')
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="n_resp_fast", &
description="number of respa steps for fast degrees of freedom", &
repeats=.FALSE., default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_thermo_fast_section(thermo_fast_section)
CALL section_add_subsection(section, thermo_fast_section)
CALL section_release(thermo_fast_section)
CALL create_thermo_slow_section(thermo_slow_section)
CALL section_add_subsection(section, thermo_slow_section)
CALL section_release(thermo_slow_section)
END SUBROUTINE create_adiabatic_section
! **************************************************************************************************
!> \brief section will contain parameters for the velocity softening
!> \param section ...
!> \author Ole Schuett
! **************************************************************************************************
SUBROUTINE create_softening_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CALL section_create(section, __LOCATION__, name="VELOCITY_SOFTENING", &
description="A method to initialize the velocities along low-curvature " &
//"directions in order to favors MD trajectories to cross rapidly over " &
//"small energy barriers into neighboring basins. " &
//"In each iteration the forces are calculated at a point y, which " &
//"is slightly displaced from the current positions x in the direction " &
//"of the original velocities v. The velocities are then updated with " &
//"the force component F_t, which is perpendicular to N. " &
//"N = v / |v|; y = x + delta * N; F_t = F(y) - ⟨ F(y) | N ⟩ * N; " &
//"v' = v + alpha * F_t")
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="STEPS", &
description="Number of softening iterations performed. " &
//"Typical values are around 40 steps.", &
default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="DELTA", &
description="Displacement used to obtain y.", &
default_r_val=0.1_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
description="Mixing factor used for updating velocities.", &
default_r_val=0.15_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_softening_section
! **************************************************************************************************
!> \brief input section used to define regions with different temperature
!> initialization and control
!> \param section ...
!> \par History
!> - Added input for langevin regions in thermal regions section
!> (2014/02/04, LT)
! **************************************************************************************************
SUBROUTINE create_thermal_region_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: print_key, region_section, subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="thermal_region", &
description="Define regions where different initialization and control "// &
"of the temperature is used. When MOTION%MD%ENSEMBLE is set to LANGEVIN, "// &
"this section controls if the atoms defined inside and outside the "// &
"thermal regions should undergo Langevin MD or NVE Born-Oppenheimer MD. "// &
"The theory behind Langevin MD using different regions can be found in "// &
"articles by Kantorovitch et al. listed below.", &
citations=(/Kantorovich2008, Kantorovich2008a/), &
n_keywords=0, n_subsections=1, repeats=.FALSE.)
NULLIFY (region_section)
NULLIFY (keyword, subsection)
CALL keyword_create(keyword, __LOCATION__, name="force_rescaling", &
description="Control the rescaling ot the velocities in all the regions, "// &
"according to the temperature assigned to each reagion, when "// &
"RESTART_VELOCITY in EXT_RESTART is active.", &
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="do_langevin_default", &
description="If ENSEMBLE is set to LANGEVIN, controls whether the "// &
"atoms NOT defined in the thermal regions to undergo langevin MD "// &
"or not. If not, then the atoms will undergo NVE Born-Oppenheimer MD.", &
usage="do_langevin_default .FALSE.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL section_create(region_section, __LOCATION__, name="DEFINE_REGION", &
description="This section provides the possibility to define arbitrary region ", &
n_keywords=3, n_subsections=0, repeats=.TRUE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="LIST", &
description="Specifies a list of atoms belonging to the region.", &
usage="LIST {integer} {integer} .. {integer}", &
repeats=.TRUE., n_var=-1, type_of_var=integer_t)
CALL section_add_keyword(region_section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temperature", &
description="The temperature in K used to initialize the velocities "// &
"of the atoms in this region ", &
usage="temperature 5.0", &
default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
unit_str="K")
CALL section_add_keyword(region_section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="temp_tol", &
description="Maximum accepted temperature deviation from the expected "// &
"value for this region. If temp_tol=0 no rescaling is performed", &