(git:374b731)
Loading...
Searching...
No Matches
glbopt_input.F
Go to the documentation of this file.
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 Declares the input for global optimization
10!> \author Ole Schuett
11! **************************************************************************************************
26 USE input_val_types, ONLY: integer_t,&
27 real_t
28 USE kinds, ONLY: dp
29 USE string_utilities, ONLY: s2a
30#include "../base/base_uses.f90"
31
32 IMPLICIT NONE
33 PRIVATE
34
35 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'glbopt_input'
36
37 PUBLIC :: glbopt_declare_input
38
39CONTAINS
40
41! **************************************************************************************************
42!> \brief Declares the SWARM%GLOBAL_OPT input section
43!> \param swarm_section ...
44!> \author Ole Schuett
45! **************************************************************************************************
46 SUBROUTINE glbopt_declare_input(swarm_section)
47 TYPE(section_type), POINTER :: swarm_section
48
49 TYPE(keyword_type), POINTER :: keyword
50 TYPE(section_type), POINTER :: glbopt_section, printkey
51
52 NULLIFY (glbopt_section, keyword, printkey)
53
54 CALL section_create(glbopt_section, __location__, name="GLOBAL_OPT", &
55 description="Section to control global geometry optimizations.", &
56 repeats=.false.)
57
58 CALL keyword_create(keyword, __location__, name="METHOD", &
59 description="Methods to use for optimization.", &
60 default_i_val=glbopt_do_minhop, &
61 enum_c_vals=s2a("MINIMA_HOPPING", "MINIMA_CRAWLING"), &
62 enum_desc=s2a("Runs Minima-Hopping algorithm.", &
63 "Runs Minima-Crawling algorithm."), &
64 enum_i_vals=(/glbopt_do_minhop, glbopt_do_mincrawl/))
65 CALL section_add_keyword(glbopt_section, keyword)
66 CALL keyword_release(keyword)
67
68 CALL keyword_create(keyword, __location__, name="E_TARGET", &
69 description="Target Energy, the optimization will quit once a lower potential energy is reached.", &
70 default_r_val=-1*huge(1.0_dp), type_of_var=real_t, unit_str="hartree")
71 CALL section_add_keyword(glbopt_section, keyword)
72 CALL keyword_release(keyword)
73
74 CALL keyword_create(keyword, __location__, name="MD_BUMPS_MAX", &
75 description="Number of bumps in potential energy after which MD runs ends.", &
76 type_of_var=integer_t, default_i_val=3)
77 CALL section_add_keyword(glbopt_section, keyword)
78 CALL keyword_release(keyword)
79
80 CALL keyword_create(keyword, __location__, name="BUMP_STEPS_UPWARDS", &
81 description="Number of MD steps with potential energy increases required for a bump.", &
82 type_of_var=integer_t, default_i_val=2)
83 CALL section_add_keyword(glbopt_section, keyword)
84 CALL keyword_release(keyword)
85
86 CALL keyword_create(keyword, __location__, name="BUMP_STEPS_DOWNWARDS", &
87 description="Number of MD steps with potential energy decreases required for a bump.", &
88 type_of_var=integer_t, default_i_val=2)
89 CALL section_add_keyword(glbopt_section, keyword)
90 CALL keyword_release(keyword)
91
92 CALL keyword_create(keyword, __location__, name="FRAGMENTATION_THRESHOLD", &
93 description="Threshold for atom distance used for detecting fragmentation of clusters.", &
94 default_r_val=2.0_dp, unit_str="angstrom", type_of_var=real_t)
95 CALL section_add_keyword(glbopt_section, keyword)
96 CALL keyword_release(keyword)
97
98 !CALL keyword_create(keyword, __LOCATION__, name="MD_ADAPTIVE_TIMESTEP",&
99 ! description="Make MD timesteps longer for lower temperatures.", &
100 ! default_r_val=0.0_dp, type_of_var=real_t)
101 !CALL section_add_keyword(glbopt_section, keyword)
102 !CALL keyword_release(keyword)
103
105 printkey, __location__, "PROGRESS_TRAJECTORY", &
106 description="Printkey to control the writting of the progress trajectory. "// &
107 "This trajectory contains the minima, which are lower in energy than the by then lowerest.", &
108 print_level=low_print_level, common_iter_levels=1, &
109 filename="", unit_str="angstrom")
110 CALL section_add_subsection(glbopt_section, printkey)
111 CALL section_release(printkey)
112
113 CALL history_declare_input(glbopt_section)
114 CALL minhop_declare_input(glbopt_section)
115 CALL mincrawl_declare_input(glbopt_section)
116
117 CALL section_add_subsection(swarm_section, glbopt_section)
118 CALL section_release(glbopt_section)
119 END SUBROUTINE glbopt_declare_input
120
121! **************************************************************************************************
122!> \brief Declares the SWARM%GLOBAL_OPT%HISTORY input section
123!> \param glbopt_section ...
124!> \author Ole Schuett
125! **************************************************************************************************
126 SUBROUTINE history_declare_input(glbopt_section)
127 TYPE(section_type), POINTER :: glbopt_section
128
129 TYPE(keyword_type), POINTER :: keyword
130 TYPE(section_type), POINTER :: history_section
131
132 NULLIFY (history_section, keyword)
133
134 CALL section_create(history_section, __location__, name="HISTORY", &
135 description="Section controlling the history of visited minima and "// &
136 "how minima are recognized at a later point.", &
137 repeats=.false.)
138
139 CALL keyword_create(keyword, __location__, name="ENERGY_PRECISION", &
140 description="If the difference of two energies is below this threshold "// &
141 "they are considert equal.", &
142 default_r_val=1.0e-5_dp, type_of_var=real_t)
143 CALL section_add_keyword(history_section, keyword)
144 CALL keyword_release(keyword)
145
146 CALL keyword_create(keyword, __location__, name="FINGERPRINT_PRECISION", &
147 description="If the euclidean distance of two fingerprints is below "// &
148 "this threshold, they are considert equal.", &
149 default_r_val=1.0e-2_dp, type_of_var=real_t)
150 CALL section_add_keyword(history_section, keyword)
151 CALL keyword_release(keyword)
152
153 CALL section_add_subsection(glbopt_section, history_section)
154 CALL section_release(history_section)
155 END SUBROUTINE history_declare_input
156
157! **************************************************************************************************
158!> \brief Declares the SWARM%GLOBAL_OPT%MINIMA_HOPPING input section
159!> \param glbopt_section ...
160!> \author Ole Schuett
161! **************************************************************************************************
162 SUBROUTINE minhop_declare_input(glbopt_section)
163 TYPE(section_type), POINTER :: glbopt_section
164
165 TYPE(keyword_type), POINTER :: keyword
166 TYPE(section_type), POINTER :: minhop_section
167
168 NULLIFY (minhop_section, keyword)
169
170 CALL section_create(minhop_section, __location__, name="MINIMA_HOPPING", &
171 description="Section controlling the Minima Hopping method.", &
172 citations=(/goedecker2004/), &
173 repeats=.false.)
174
175 CALL keyword_create(keyword, __location__, name="BETA_1", &
176 description="Factor used to increase temperature when escape failed, "// &
177 "should be larger than 1.", &
178 default_r_val=1.1_dp, type_of_var=real_t)
179 CALL section_add_keyword(minhop_section, keyword)
180 CALL keyword_release(keyword)
181
182 CALL keyword_create(keyword, __location__, name="BETA_2", &
183 description="Factor used to increase temperature when escape found "// &
184 "known minima, should be larger than 1.", &
185 default_r_val=1.1_dp, type_of_var=real_t)
186 CALL section_add_keyword(minhop_section, keyword)
187 CALL keyword_release(keyword)
188
189 CALL keyword_create(keyword, __location__, name="BETA_3", &
190 description="Factor used to decrease temperature when escape succeeded, "// &
191 "should be smaller than 1.", &
192 default_r_val=1.0/1.1_dp, type_of_var=real_t)
193 CALL section_add_keyword(minhop_section, keyword)
194 CALL keyword_release(keyword)
195
196 CALL keyword_create(keyword, __location__, name="ALPHA_1", &
197 description="Factor used to decrease acceptance energy, when minima was accepted, "// &
198 "should be smaller than 1.", &
199 default_r_val=0.98_dp, type_of_var=real_t)
200 CALL section_add_keyword(minhop_section, keyword)
201 CALL keyword_release(keyword)
202
203 CALL keyword_create(keyword, __location__, name="ALPHA_2", &
204 description="Factor used to increase acceptance energy, when minima was rejected, "// &
205 "should be larger than 1.", &
206 default_r_val=1.0/0.98_dp, type_of_var=real_t)
207 CALL section_add_keyword(minhop_section, keyword)
208 CALL keyword_release(keyword)
209
210 CALL keyword_create(keyword, __location__, name="E_ACCEPT_INIT", &
211 description="Initial value of acceptance energy", &
212 default_r_val=0.005_dp, type_of_var=real_t, unit_str="hartree")
213 CALL section_add_keyword(minhop_section, keyword)
214 CALL keyword_release(keyword)
215
216 CALL keyword_create(keyword, __location__, name="TEMPERATURE_INIT", &
217 description="Initially temperature in Kelvin", &
218 default_r_val=100.0_dp, type_of_var=real_t)
219 CALL section_add_keyword(minhop_section, keyword)
220 CALL keyword_release(keyword)
221
222 CALL keyword_create(keyword, __location__, name="SHARE_HISTORY", &
223 description="If set all worker will use a single share history of visited minima.", &
224 default_l_val=.false., lone_keyword_l_val=.true.)
225 CALL section_add_keyword(minhop_section, keyword)
226 CALL keyword_release(keyword)
227
228 CALL section_add_subsection(glbopt_section, minhop_section)
229 CALL section_release(minhop_section)
230 END SUBROUTINE minhop_declare_input
231
232! **************************************************************************************************
233!> \brief Declares the SWARM%GLOBAL_OPT%MINIMA_CRAWLING input section
234!> \param glbopt_section ...
235!> \author Ole Schuett
236! **************************************************************************************************
237 SUBROUTINE mincrawl_declare_input(glbopt_section)
238 TYPE(section_type), POINTER :: glbopt_section
239
240 TYPE(keyword_type), POINTER :: keyword
241 TYPE(section_type), POINTER :: mincrawl_section, printkey
242
243 NULLIFY (mincrawl_section, keyword, printkey)
244
245 CALL section_create(mincrawl_section, __location__, name="MINIMA_CRAWLING", &
246 description="Section controls Minima Crawling run.", &
247 repeats=.false.)
248
249 CALL keyword_create(keyword, __location__, name="TEMPSTEP_BASE", &
250 description="Base used to calculate temperature steps base**n", &
251 default_r_val=1.1_dp, type_of_var=real_t)
252 CALL section_add_keyword(mincrawl_section, keyword)
253 CALL keyword_release(keyword)
254
255 CALL keyword_create(keyword, __location__, name="TEMPSTEP_MAX", &
256 description="Maximum number of temperature steps.", &
257 default_i_val=100, type_of_var=integer_t)
258 CALL section_add_keyword(mincrawl_section, keyword)
259 CALL keyword_release(keyword)
260
261 CALL keyword_create(keyword, __location__, name="TEMPDIST_UPDATE_WIDTH", &
262 description="Width of gaussian used to update temperature distribution.", &
263 default_r_val=2.0_dp, type_of_var=real_t)
264 CALL section_add_keyword(mincrawl_section, keyword)
265 CALL keyword_release(keyword)
266
267 CALL keyword_create(keyword, __location__, name="TEMPDIST_UPDATE_HEIGHT", &
268 description="Height of gaussian used to update temperature distribution.", &
269 default_r_val=0.1_dp, type_of_var=real_t)
270 CALL section_add_keyword(mincrawl_section, keyword)
271 CALL keyword_release(keyword)
272
273 CALL keyword_create(keyword, __location__, name="TEMPERATURE_INIT", &
274 description="Initial temperature in Kelvin", &
275 default_r_val=100.0_dp, type_of_var=real_t)
276 CALL section_add_keyword(mincrawl_section, keyword)
277 CALL keyword_release(keyword)
278
279 CALL keyword_create(keyword, __location__, name="TEMPDIST_INIT_WIDTH", &
280 description="Initial width of temperature distribution.", &
281 default_r_val=5.0_dp, type_of_var=real_t)
282 CALL section_add_keyword(mincrawl_section, keyword)
283 CALL keyword_release(keyword)
284
285 CALL keyword_create(keyword, __location__, name="WORKER_PER_MINIMA", &
286 description="Maximum number of active workers per Minima.", &
287 default_i_val=3, type_of_var=integer_t)
288 CALL section_add_keyword(mincrawl_section, keyword)
289 CALL keyword_release(keyword)
290
291 CALL keyword_create(keyword, __location__, name="ESCAPE_HISTORY_LENGTH", &
292 description="Number of escapes averaged for scoring of minima.", &
293 default_i_val=10, type_of_var=integer_t)
294 CALL section_add_keyword(mincrawl_section, keyword)
295 CALL keyword_release(keyword)
296
297 CALL cp_print_key_section_create(printkey, __location__, "MINIMA_TRAJECTORY", &
298 description="Printkey to control the writting of the minima trajectory. "// &
299 "This trajectory contains all encountered local minima.", &
300 print_level=low_print_level, common_iter_levels=1, &
301 filename="", unit_str="angstrom")
302 CALL section_add_subsection(mincrawl_section, printkey)
303 CALL section_release(printkey)
304
305 CALL section_add_subsection(glbopt_section, mincrawl_section)
306 CALL section_release(mincrawl_section)
307 END SUBROUTINE mincrawl_declare_input
308
309END MODULE glbopt_input
310
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public goedecker2004
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public low_print_level
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
Declares the input for global optimization.
subroutine, public glbopt_declare_input(swarm_section)
Declares the SWARMGLOBAL_OPT input section.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public glbopt_do_minhop
integer, parameter, public glbopt_do_mincrawl
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
a wrapper for basic fortran types.
integer, parameter, public real_t
integer, parameter, public integer_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file