Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief function that build the dft section of the input
10 : !> \par History
11 : !> 10.2005 moved out of input_cp2k [fawzi]
12 : !> \author fawzi
13 : ! **************************************************************************************************
14 : MODULE input_cp2k_voronoi
15 : USE bibliography, ONLY: Brehm2018,&
16 : Brehm2020,&
17 : Brehm2021,&
18 : Rycroft2009,&
19 : Thomas2015
20 : USE cp_output_handling, ONLY: cp_print_key_section_create,&
21 : debug_print_level
22 : USE input_constants, ONLY: voro_radii_cov,&
23 : voro_radii_unity,&
24 : voro_radii_user,&
25 : voro_radii_vdw
26 : USE input_keyword_types, ONLY: keyword_create,&
27 : keyword_release,&
28 : keyword_type
29 : USE input_section_types, ONLY: section_add_keyword,&
30 : section_type
31 : USE input_val_types, ONLY: integer_t,&
32 : lchar_t,&
33 : real_t
34 : USE kinds, ONLY: dp
35 : USE physcon, ONLY: bohr
36 : USE string_utilities, ONLY: s2a
37 : #include "./base/base_uses.f90"
38 :
39 : IMPLICIT NONE
40 : PRIVATE
41 :
42 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_voronoi'
43 :
44 : PUBLIC :: create_print_voronoi_section
45 :
46 : CONTAINS
47 :
48 : ! **************************************************************************************************
49 : !> \brief Create the print voronoi section
50 : !> \param print_key ...
51 : !> \author Martin Brehm
52 : ! **************************************************************************************************
53 18380 : SUBROUTINE create_print_voronoi_section(print_key)
54 : TYPE(section_type), POINTER :: print_key
55 :
56 : TYPE(keyword_type), POINTER :: keyword
57 :
58 18380 : CPASSERT(.NOT. ASSOCIATED(print_key))
59 :
60 : ! Voronoi Integration via LibVori
61 : CALL cp_print_key_section_create(print_key, __LOCATION__, name="VORONOI", &
62 : description="Controls the Voronoi integration of the total electron density"// &
63 : " for the computation of electromagnetic moments, see [Thomas2015],"// &
64 : " [Brehm2020], and [Brehm2021]"// &
65 : " (via LibVori see <https://brehm-research.de/voronoi>).", &
66 : print_level=debug_print_level + 1, filename="", &
67 110280 : citations=(/Rycroft2009, Thomas2015, Brehm2018, Brehm2020, Brehm2021/))
68 :
69 18380 : NULLIFY (keyword)
70 : CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
71 : description="Appends frames to already existing .voronoi file.", &
72 18380 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
73 18380 : CALL section_add_keyword(print_key, keyword)
74 18380 : CALL keyword_release(keyword)
75 :
76 : CALL keyword_create(keyword, __LOCATION__, name="SANITY_CHECK", &
77 : description="Performs a sanity check before each Voronoi integration, i.e.,"// &
78 : " checks if every grid point is located in exactly one Voronoi cell.", &
79 18380 : usage="SANITY_CHECK T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
80 18380 : CALL section_add_keyword(print_key, keyword)
81 18380 : CALL keyword_release(keyword)
82 :
83 : CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE", &
84 : description="Specify this keyword to overwrite any existing ""properties.emp"" file if"// &
85 : " it already exists. By default, the data is appended to an existing .emp file.", &
86 18380 : usage="OVERWRITE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
87 18380 : CALL section_add_keyword(print_key, keyword)
88 18380 : CALL keyword_release(keyword)
89 :
90 : CALL keyword_create(keyword, __LOCATION__, name="SKIP_FIRST", &
91 : description="Skips the first step of a MD run (avoids duplicate step if restarted).", &
92 18380 : usage="SKIP_FIRST T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
93 18380 : CALL section_add_keyword(print_key, keyword)
94 18380 : CALL keyword_release(keyword)
95 :
96 : CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", &
97 : description="Switches on verbose screen output of the Voronoi integration.", &
98 18380 : usage="VERBOSE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
99 18380 : CALL section_add_keyword(print_key, keyword)
100 18380 : CALL keyword_release(keyword)
101 :
102 : CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_EMP", &
103 : description="Writes the resulting electromagnetic moments to a binary file ""properties.emp""."// &
104 : " The file name cannot be changed.", &
105 18380 : usage="OUTPUT_EMP T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
106 18380 : CALL section_add_keyword(print_key, keyword)
107 18380 : CALL keyword_release(keyword)
108 :
109 : CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_TEXT", &
110 : description="Writes the resulting electromagnetic moments to text files (*.voronoi)."// &
111 : " The file name is specified via FILENAME.", &
112 18380 : usage="OUTPUT_TEXT T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
113 18380 : CALL section_add_keyword(print_key, keyword)
114 18380 : CALL keyword_release(keyword)
115 :
116 : CALL keyword_create(keyword, __LOCATION__, name="REFINEMENT_FACTOR", &
117 : description="Sets the refinement factor for the Voronoi integration.", &
118 18380 : usage="REFINEMENT 2", n_var=1, default_i_val=1, type_of_var=integer_t)
119 18380 : CALL section_add_keyword(print_key, keyword)
120 18380 : CALL keyword_release(keyword)
121 :
122 : CALL keyword_create(keyword, __LOCATION__, name="VORONOI_RADII", &
123 : description="Which atomic radii to use for the radical Voronoi tessellation.", &
124 : usage="VORONOI_RADII {UNITY,VDW,COVALENT,USER}", repeats=.FALSE., n_var=1, &
125 : default_i_val=voro_radii_vdw, &
126 : enum_c_vals=s2a("UNITY", "VDW", "COVALENT", "USER"), &
127 : enum_desc=s2a("Use unity radii (non-radical Voronoi tessellation)", "Use VdW atom radii", &
128 : "Use covalent atom radii", "Use user-specified atom radii"), &
129 18380 : enum_i_vals=(/voro_radii_unity, voro_radii_vdw, voro_radii_cov, voro_radii_user/))
130 18380 : CALL section_add_keyword(print_key, keyword)
131 18380 : CALL keyword_release(keyword)
132 :
133 : CALL keyword_create(keyword, __LOCATION__, name="USER_RADII", &
134 : description="Defines user atom radii for the radical Voronoi tessellation (one per atom).", &
135 : usage="USER_RADII {real} {real} {real}", repeats=.FALSE., &
136 : unit_str="angstrom", &
137 18380 : type_of_var=real_t, n_var=-1)
138 18380 : CALL section_add_keyword(print_key, keyword)
139 18380 : CALL keyword_release(keyword)
140 :
141 : CALL keyword_create(keyword, __LOCATION__, name="MOLECULAR_PROPERTIES", &
142 : description="Calculation of molecular properties from Voronoi integration.", &
143 18380 : usage="MOLECULAR_PROPERTIES T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
144 18380 : CALL section_add_keyword(print_key, keyword)
145 18380 : CALL keyword_release(keyword)
146 :
147 : CALL keyword_create(keyword, __LOCATION__, name="MOLPROP_FILE_NAME", &
148 : description="Root of the file name where to print molecular properties."// &
149 : " filename.molprop is used.", &
150 : usage="MOLPROP_FILE_NAME <FILENAME>", &
151 18380 : default_lc_val="__STD_OUT__", type_of_var=lchar_t)
152 18380 : CALL section_add_keyword(print_key, keyword)
153 18380 : CALL keyword_release(keyword)
154 :
155 : CALL keyword_create(keyword, __LOCATION__, name="JITTER", &
156 : description="The Voronoi tessellation can have issues with highly symmetric structures."// &
157 : " This keyword displaces all atoms pseudo-randomly by a tiny amount (see JITTER_AMPLITUDE)"// &
158 : " to break symmetry. The displacement is constant over time, so that no temporal noise is"// &
159 : " introduced. The displacement is not visible to other CP2k routines (FORCE_EVAL, output)."// &
160 : " It is only applied internally in the library for the Voronoi tessellation.", &
161 18380 : usage="JITTER T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
162 18380 : CALL section_add_keyword(print_key, keyword)
163 18380 : CALL keyword_release(keyword)
164 :
165 : CALL keyword_create(keyword, __LOCATION__, name="JITTER_SEED", &
166 : description="Sets the random seed for the jitter. The pseudo-random number generator"// &
167 : " is re-initialized for each Voronoi tessellation so that the jitter is constant over"// &
168 : " simulation time (no temporal noise).", &
169 18380 : usage="JITTER_SEED 1234", n_var=1, default_i_val=0, type_of_var=integer_t)
170 18380 : CALL section_add_keyword(print_key, keyword)
171 18380 : CALL keyword_release(keyword)
172 :
173 : CALL keyword_create(keyword, __LOCATION__, name="JITTER_AMPLITUDE", &
174 : description="Sets the maximum displacement amplitude for the jitter.", &
175 : usage="JITTER_AMPLITUDE 0.01", unit_str="angstrom", n_var=1, default_r_val=1.e-3_dp*bohr, &
176 18380 : type_of_var=real_t)
177 18380 : CALL section_add_keyword(print_key, keyword)
178 18380 : CALL keyword_release(keyword)
179 :
180 18380 : END SUBROUTINE create_print_voronoi_section
181 :
182 : END MODULE input_cp2k_voronoi
|