-
Notifications
You must be signed in to change notification settings - Fork 485
Expand file tree
/
Copy pathinput_cp2k_motion.F
More file actions
3000 lines (2615 loc) · 162 KB
/
Copy pathinput_cp2k_motion.F
File metadata and controls
3000 lines (2615 loc) · 162 KB
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-2026 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]
!> 01.2020 add keywords related to Space Groups [pcazade]
!> \author teo & fawzi
! **************************************************************************************************
MODULE input_cp2k_motion
USE bibliography, ONLY: Brieuc2016, &
Byrd1995, &
Ceriotti2010, &
Ceriotti2012, &
Ceriotti2014, &
Henkelman1999, &
Henkelman2014, &
Kapil2016, &
Lindh1995
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: &
debug_lbfgs, default_bfgs_method_id, default_cg_method_id, default_dimer_method_id, &
default_lbfgs_method_id, default_minimization_method_id, default_ts_method_id, &
dimer_init_molden, dimer_init_random, &
do_mc_gemc_npt, do_mc_gemc_nvt, do_mc_traditional, do_mc_virial, fix_none, fix_x, fix_xy, &
fix_xz, fix_y, fix_yz, fix_z, fmt_id_pdb, fmt_id_xyz, gaussian, helium_cell_shape_cube, &
helium_cell_shape_octahedron, helium_forces_average, helium_forces_last, &
helium_mdist_exponential, helium_mdist_gaussian, helium_mdist_linear, &
helium_mdist_quadratic, helium_mdist_singlev, helium_mdist_uniform, &
helium_sampling_ceperley, helium_sampling_worm, helium_solute_intpot_mwater, helium_solute_intpot_nnp, &
helium_solute_intpot_none, high_lbfgs, integrate_exact, integrate_numeric, low_lbfgs, ls_2pnt, ls_3pnt, ls_fit, &
ls_gold, ls_none, matrix_init_cholesky, matrix_init_diagonal, medium_lbfgs, numerical, perm_cycle, &
perm_plain, propagator_pimd, propagator_rpmd, propagator_cmd, propagator_bcmd, silent_lbfgs, &
transformation_normal, transformation_stage
USE input_cp2k_constraints, ONLY: create_constraint_section
USE input_cp2k_free_energy, ONLY: create_fe_section
USE input_cp2k_md, ONLY: create_md_section
USE input_cp2k_motion_print, ONLY: add_format_keyword, &
create_motion_print_section
USE input_cp2k_neb, ONLY: create_band_section
USE input_cp2k_subsys, ONLY: create_rng_section
USE input_cp2k_thermostats, ONLY: create_coord_section, &
create_gle_section, &
create_velocity_section
USE input_cp2k_tmc, ONLY: create_TMC_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, &
logical_t, &
real_t, &
char_t
USE kinds, ONLY: dp
USE string_utilities, ONLY: newline, &
s2a
#include "../base/base_uses.f90"
IMPLICIT NONE
PRIVATE
LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_motion'
PUBLIC :: create_motion_section
CONTAINS
! **************************************************************************************************
!> \brief creates the motion section
!> \param section the section to be created
!> \author teo
! **************************************************************************************************
SUBROUTINE create_motion_section(section)
TYPE(section_type), POINTER :: section
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="motion", &
description="This section defines a set of tool connected with the motion of the nuclei.", &
n_keywords=1, n_subsections=1, repeats=.FALSE.)
NULLIFY (subsection)
CALL create_geoopt_section(subsection, __LOCATION__, label="GEO_OPT", &
description="This section sets the environment of the geometry optimizer.", &
just_optimizers=.FALSE., &
use_model_hessian=.TRUE.)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_cell_opt_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_shellcore_opt_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_md_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_driver_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_fe_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_constraint_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_fp_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_mc_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_TMC_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_pint_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_band_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_motion_print_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_motion_section
! **************************************************************************************************
!> \brief creates the Monte Carlo section
!> \param section the section to be created
!> \author matt
! **************************************************************************************************
SUBROUTINE create_mc_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="mc", &
description="This section sets parameters to set up a MonteCarlo calculation.", &
n_keywords=10, n_subsections=2, repeats=.FALSE.)
NULLIFY (keyword, subsection)
CALL keyword_create(keyword, __LOCATION__, name="NSTEP", &
description="Specifies the number of MC cycles.", &
usage="NSTEP {integer}", &
default_i_val=100)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="IPRINT", &
description="Prints coordinate/cell/etc information every IPRINT steps.", &
usage="IPRINT {integer}", &
default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NMOVES", &
description="Specifies the number of classical moves between energy evaluations. ", &
usage="NMOVES {integer}", &
default_i_val=4)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NSWAPMOVES", &
description="How many insertions to try per swap move.", &
usage="NSWAPMOVES {integer}", &
default_i_val=16)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LBIAS", &
description="Dictates if we presample moves with a different potential.", &
usage="LBIAS {logical}", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LSTOP", &
description="Makes nstep in terms of steps, instead of cycles.", &
usage="LSTOP {logical}", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LDISCRETE", &
description="Changes the volume of the box in discrete steps, one side at a time.", &
usage="LDISCRETE {logical}", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RCLUS", &
description="The cluster cut off radius in angstroms.", &
usage="RCLUS {real}", &
default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
description="Read initial configuration from restart file.", &
usage="RESTART {logical}", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="NVIRIAL", &
description="Use this many random orientations to compute the second virial coefficient (ENSEMBLE=VIRIAL)", &
usage="NVIRIAL {integer}", &
default_i_val=1000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ENSEMBLE", &
description="Specify the type of simulation", &
usage="ENSEMBLE (TRADITIONAL|GEMC_NVT|GEMC_NPT|VIRIAL)", &
enum_c_vals=s2a("TRADITIONAL", "GEMC_NVT", "GEMC_NPT", "VIRIAL"), &
enum_i_vals=[do_mc_traditional, do_mc_gemc_nvt, do_mc_gemc_npt, do_mc_virial], &
default_i_val=do_mc_traditional)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RESTART_FILE_NAME", &
description="Name of the restart file for MC information.", &
usage="RESTART_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MOVES_FILE_NAME", &
description="The file to print the move statistics to.", &
usage="MOVES_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MOLECULES_FILE_NAME", &
description="The file to print the number of molecules to.", &
usage="MOLECULES_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="COORDINATE_FILE_NAME", &
description="The file to print the current coordinates to.", &
usage="COORDINATE_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ENERGY_FILE_NAME", &
description="The file to print current energies to.", &
usage="ENERGY_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="DATA_FILE_NAME", &
description="The file to print current configurational info to.", &
usage="DATA_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
description="The file to print current cell length info to.", &
usage="CELL_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_DISP_FILE_NAME", &
description="The file to print current maximum displacement info to.", &
usage="MAX_DISP_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BOX2_FILE_NAME", &
description="For GEMC, the name of the input file for the other box.", &
usage="BOX2_FILE_NAME {filename}", &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PRESSURE", &
description="The pressure for NpT simulations, in bar.", &
usage="PRESSURE {real}", &
type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
description="The temperature of the simulation, in Kelvin.", &
usage="TEMPERATURE {real}", &
type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="VIRIAL_TEMPS", &
description="The temperatures you wish to compute the virial coefficient for. Only used if ensemble=VIRIAL.", &
usage="VIRIAL_TEMPS {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="DISCRETE_STEP", &
description="The size of the discrete volume move step, in angstroms.", &
usage="DISCRETE_STEP {real}", &
default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ETA", &
description="The free energy bias (in Kelvin) for swapping a molecule of each type into this box.", &
usage="ETA {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RANDOMTOSKIP", &
description="Number of random numbers from the acceptance/rejection stream to skip", &
usage="RANDOMTOSKIP {integer}", &
default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_avbmc_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_move_prob_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_update_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_max_disp_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_mc_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the AVBMC parameters for MC
!> \author matt
! **************************************************************************************************
SUBROUTINE create_avbmc_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="avbmc", &
description="Parameters for Aggregation Volume Bias Monte Carlo (AVBMC) "// &
"which explores cluster formation and destruction. "// &
"Chen and Siepmann, J. Phys. Chem. B 105, 11275-11282 (2001).", &
n_keywords=5, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="PBIAS", &
description="The probability of swapping to an inner region in an AVBMC swap move for each molecule type.", &
usage="PBIAS {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="AVBMC_ATOM", &
description="The target atom for an AVBMC swap move for each molecule type.", &
usage="AVBMC_ATOM {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="AVBMC_RMIN", &
description="The inner radius for an AVBMC swap move, in angstroms for every molecule type.", &
usage="AVBMC_RMIN {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="AVBMC_RMAX", &
description="The outer radius for an AVBMC swap move, in angstroms, for every molecule type.", &
usage="AVBMC_RMAX {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_avbmc_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the probabilities for attempting each move
!> type in Monte Carlo
!> \author matt
! **************************************************************************************************
SUBROUTINE create_move_prob_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="move_probabilities", &
description="Parameters for fraction of moves performed for each move type.", &
n_keywords=5, n_subsections=2, repeats=.FALSE.)
NULLIFY (keyword, subsection)
CALL keyword_create(keyword, __LOCATION__, name="PMHMC", &
description="The probability of attempting a hybrid MC move.", &
usage="PMHMC {real}", &
type_of_var=real_t, default_r_val=0.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMTRANS", &
description="The probability of attempting a molecule translation.", &
usage="PMTRANS {real}", &
type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMCLTRANS", &
description="The probability of attempting a cluster translation.", &
usage="PMCLTRANS {real}", &
type_of_var=real_t, default_r_val=0.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMAVBMC", &
description="The probability of attempting an AVBMC swap move.", &
usage="PMAVBMC {real}", &
default_r_val=0.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMTRAION", &
description="The probability of attempting a conformational change.", &
usage="PMTRAION {real}", &
type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMSWAP", &
description="The probability of attempting a swap move.", &
usage="PMSWAP {real}", &
type_of_var=real_t, default_r_val=0.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMVOLUME", &
description="The probability of attempting a volume move.", &
usage="PMVOLUME {real}", &
type_of_var=real_t, default_r_val=0.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_mol_prob_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_box_prob_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_move_prob_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the probabilities for attempting various moves
!> on the various molecule types present in the system
!> \author matt
! **************************************************************************************************
SUBROUTINE create_mol_prob_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="mol_probabilities", &
description="Probabilities of attempting various moves types on "// &
"the various molecular types present in the simulation.", &
n_keywords=5, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMAVBMC_MOL", &
description="The probability of attempting an AVBMC swap move on each molecule type.", &
usage="PMAVBMC_MOL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMSWAP_MOL", &
description="The probability of attempting a molecule swap of a given molecule type.", &
usage="PMSWAP_MOL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMROT_MOL", &
description="The probability of attempting a molecule rotation of a given molecule type.", &
usage="PMROT_MOL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMTRAION_MOL", &
description="The probability of attempting a conformational change of a given molecule type.", &
usage="PMTRAION_MOL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMTRANS_MOL", &
description="The probability of attempting a molecule translation of a given molecule type.", &
usage="PMTRANS_MOL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_mol_prob_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the probabilities for attempting various moves
!> on the box where the variable is present
!> \author matt
! **************************************************************************************************
SUBROUTINE create_box_prob_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="BOX_PROBABILITIES", &
description="Probabilities of attempting various moves types on "// &
"the box.", &
n_keywords=2, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMHMC_BOX", &
description="The probability of attempting a HMC move on this box.", &
usage="PMHMC_BOX {real}", &
type_of_var=real_t, default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMVOL_BOX", &
description="The probability of attempting a volume move on this box (GEMC_NpT).", &
usage="PMVOL_BOX {real}", &
type_of_var=real_t, default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PMCLUS_BOX", &
description="The probability of attempting a cluster move in this box", &
usage="PMCLUS_BOX {real}", &
type_of_var=real_t, default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_box_prob_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the frequency for updating maximum
!> displacements for various moves
!> \author matt
! **************************************************************************************************
SUBROUTINE create_update_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="MOVE_UPDATES", &
description="Frequency for updating move maximum displacements.", &
n_keywords=2, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="IUPVOLUME", &
description="Every iupvolume steps update maximum volume displacement.", &
usage="IUPVOLUME {integer}", &
default_i_val=10000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="IUPTRANS", &
description="Every iuptrans steps update maximum "// &
"translation/rotation/configurational changes.", &
usage="IUPTRANS {integer}", &
default_i_val=10000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="IUPCLTRANS", &
description="Every iupcltrans steps update maximum cluster translation.", &
usage="IUPCLTRANS {integer}", &
default_i_val=10000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_update_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the maximum displacements for various moves
!> \author matt
! **************************************************************************************************
SUBROUTINE create_max_disp_section(section)
TYPE(section_type), POINTER :: section
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="max_displacements", &
description="The maximum displacements for all attempted moves.", &
n_keywords=1, n_subsections=2, repeats=.FALSE.)
NULLIFY (subsection)
CALL create_mol_disp_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_box_disp_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_max_disp_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the maximum displacements for all moves which
!> require a value for each molecule type
!> \author matt
! **************************************************************************************************
SUBROUTINE create_mol_disp_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="mol_displacements", &
description="Maximum displacements for every move type that requires "// &
"a value for each molecular type in the simulation.", &
n_keywords=5, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMBOND", &
description="Maximum bond length displacement, in angstroms, for each molecule type.", &
usage="RMBOND {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMANGLE", &
description="Maximum bond angle displacement, in degrees, for each molecule type.", &
usage="RMANGLE {real} {real} ...", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMDIHEDRAL", &
description="Maximum dihedral angle distplacement, in degrees, for each molecule type.", &
usage="RMDIHEDRAL {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMROT", &
description="Maximum rotational displacement, in degrees, for each molecule type.", &
usage="RMROT {real} {real} ... ", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMTRANS", &
description="Maximum translational displacement, in angstroms, for each molecule type.", &
usage="RMTRANS {real} {real} ...", &
n_var=-1, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_mol_disp_section
! **************************************************************************************************
!> \brief ...
!> \param section will contain the maximum displacements for any move that
!> is done on each simulation box
!> \author matt
! **************************************************************************************************
SUBROUTINE create_box_disp_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="BOX_DISPLACEMENTS", &
description="Maximum displacements for any move that is performed on each"// &
" simulation box.", &
n_keywords=1, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMVOLUME", &
description="Maximum volume displacement, in angstrom**3.", &
usage="RMVOLUME {real}", &
type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMCLTRANS", &
description="Maximum translational displacement, in angstroms, for each cluster.", &
usage="RMCLTRANS {real}", &
default_r_val=1.0E0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_box_disp_section
! **************************************************************************************************
!> \brief creates the geometry optimization section
!> \param section the section to be created
!> \param location ...
!> \param label ...
!> \param description ...
!> \param just_optimizers ...
!> \param use_model_hessian ...
!> \par History
!> 01.2020 keywords related to Space Group Symmetry added [pcazade]
!> \author teo
! **************************************************************************************************
RECURSIVE SUBROUTINE create_geoopt_section(section, location, label, description, just_optimizers, use_model_hessian)
TYPE(section_type), POINTER :: section
CHARACTER(LEN=*), INTENT(IN) :: location, label, description
LOGICAL, INTENT(IN) :: just_optimizers, use_model_hessian
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: print_key, subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, location=location, name=label, description=description, &
n_keywords=1, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword)
IF (.NOT. just_optimizers) THEN
CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
description="Specify which kind of geometry optimization to perform", &
usage="TYPE (MINIMIZATION|TRANSITION_STATE)", &
enum_c_vals=s2a("MINIMIZATION", "TRANSITION_STATE"), &
enum_desc=s2a("Performs a geometry minimization.", &
"Performs a transition state optimization."), &
enum_i_vals=[default_minimization_method_id, default_ts_method_id], &
default_i_val=default_minimization_method_id)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END IF
CALL keyword_create( &
keyword, __LOCATION__, name="OPTIMIZER", &
variants=["MINIMIZER"], &
citations=[Byrd1995], &
description="Specify which method to use to perform a geometry optimization.", &
usage="OPTIMIZER {BFGS|LBFGS|CG}", &
enum_c_vals=s2a("BFGS", "LBFGS", "CG"), &
enum_desc=s2a("Most efficient minimizer, but only for 'small' systems, "// &
"as it relies on diagonalization of a full Hessian matrix", &
"Limited-memory variant of BFGS suitable for large systems. "// &
"Not as well fine-tuned but can be more robust.", &
"conjugate gradients, robust minimizer (depending on the line search) also OK for large systems"), &
enum_i_vals=[default_bfgs_method_id, default_lbfgs_method_id, default_cg_method_id], &
default_i_val=default_bfgs_method_id)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
description="Specifies the maximum number of geometry optimization steps. "// &
"One step might imply several force evaluations for the CG and LBFGS optimizers.", &
usage="MAX_ITER {integer}", &
default_i_val=200)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_DR", &
description="Convergence criterion for the maximum geometry change "// &
"between the current and the last optimizer iteration.", &
usage="MAX_DR {real}", &
default_r_val=0.0030_dp, unit_str="bohr")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_FORCE", &
description="Convergence criterion for the maximum force component of the current configuration.", &
usage="MAX_FORCE {real}", &
default_r_val=0.00045_dp, unit_str="hartree/bohr")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMS_DR", &
description="Convergence criterion for the root mean square (RMS) geometry"// &
" change between the current and the last optimizer iteration.", &
usage="RMS_DR {real}", unit_str="bohr", &
default_r_val=0.0015_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="RMS_FORCE", &
description="Convergence criterion for the root mean square (RMS) force of the current configuration.", &
usage="RMS_FORCE {real}", unit_str="hartree/bohr", &
default_r_val=0.00030_dp)
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 "//TRIM(label)//" module.", &
usage="step_start_val <integer>", default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! collects keywords related to Space Group Symmetry
CALL keyword_create( &
keyword, __LOCATION__, name="KEEP_SPACE_GROUP", &
description="Detect space group of the system and preserve it during optimization. "// &
"The space group symmetry is applied to coordinates, forces, and the stress tensor. "// &
"It works for supercell. It does not affect/reduce computational cost. "// &
"Use EPS_SYMMETRY to adjust the detection threshold.", &
usage="KEEP_SPACE_GROUP .TRUE.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! collects keywords related to Space Group Symmetry analysis
CALL keyword_create( &
keyword, __LOCATION__, name="SHOW_SPACE_GROUP", &
description="Detect and show space group of the system after optimization. "// &
"It works for supercell. It does not affect/reduce computational cost. "// &
"Use EPS_SYMMETRY to adjust the detection threshold.", &
usage="SHOW_SPACE_GROUP .TRUE.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! collects keywords related to precision for finding the space group
CALL keyword_create( &
keyword, __LOCATION__, name="EPS_SYMMETRY", &
description="Accuracy for space group determination. EPS_SYMMETRY is dimensionless. "// &
"Roughly speaking, two scaled (fractional) atomic positions v1, v2 are considered identical if |v1 - v2| < EPS_SYMMETRY. ", &
usage="EPS_SYMMETRY {REAL}", &
default_r_val=1.e-4_dp, repeats=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! collects keywords related to reduction of symmetry due to an external field
CALL keyword_create( &
keyword, __LOCATION__, name="SYMM_REDUCTION", &
description="Direction of the external static electric field. "// &
"Some symmetry operations are not compatible with the direction of an electric field. "// &
"These operations are used when enforcing the space group.", &
usage="SYMM_REDUCTION 0.0 0.0 0.0", &
repeats=.FALSE., n_var=3, &
type_of_var=real_t, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! collects keywords related to ranges of atoms to symmetrize
CALL keyword_create( &
keyword, __LOCATION__, name="SYMM_EXCLUDE_RANGE", &
description="Range of atoms to exclude from space group symmetry. "// &
"These atoms are excluded from both identification and enforcement. "// &
"This keyword can be repeated.", &
repeats=.TRUE., usage="SYMM_EXCLUDE_RANGE {Int} {Int}", type_of_var=integer_t, n_var=2)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="SPGR_PRINT_ATOMS", &
description="Print equivalent atoms list for each space group symmetry operation.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL create_lbfgs_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_cg_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_bfgs_section(subsection, use_model_hessian)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
IF (.NOT. just_optimizers) THEN
! Transition states section
CALL create_ts_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
! Create the PRINT subsection
NULLIFY (subsection)
CALL section_create(subsection, __LOCATION__, name="PRINT", &
description="Controls the printing properties during a geometry optimization run", &
n_keywords=0, n_subsections=1, repeats=.TRUE.)
NULLIFY (print_key)
CALL cp_print_key_section_create( &
print_key, __LOCATION__, "program_run_info", &
description="Controls the printing of basic information during the Geometry Optimization", &
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END IF
END SUBROUTINE create_geoopt_section
! **************************************************************************************************
!> \brief creates the section for the shell-core optimization
!> \param section the section to be created
!> \author Caino
! **************************************************************************************************
SUBROUTINE create_shellcore_opt_section(section)
TYPE(section_type), POINTER :: section
TYPE(section_type), POINTER :: print_key, subsection
CALL create_geoopt_section( &
section, __LOCATION__, label="SHELL_OPT", &
description="This section sets the environment for the optimization of the shell-core distances"// &
" that might turn to be necessary along a MD run using a shell-model potential."// &
" The optimization procedure is activated when at least one of the shell-core"// &
" pairs becomes too elongated, i.e. when the assumption of point dipole is not longer valid.", &
just_optimizers=.TRUE., &
use_model_hessian=.FALSE.)
NULLIFY (print_key, subsection)
! Create the PRINT subsection
NULLIFY (subsection)
CALL section_create(subsection, __LOCATION__, name="PRINT", &
description="Controls the printing properties during a shell-core optimization procedure", &
n_keywords=0, n_subsections=1, repeats=.TRUE.)
NULLIFY (print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
description="Controls the printing of basic information during the Optimization", &
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")