(git:27c966b)
Loading...
Searching...
No Matches
input_cp2k_free_energy.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> 10.2005 split input_cp2k into smaller modules [fawzi]
11!> \author teo & fawzi
12! **************************************************************************************************
14 USE bibliography, ONLY: barducbus2008, &
20 USE cp_units, ONLY: cp_unit_to_cp2k
21 USE input_constants, ONLY: &
32 USE input_val_types, ONLY: char_t, &
33 integer_t, &
34 lchar_t, &
35 real_t
36 USE kinds, ONLY: dp
37 USE string_utilities, ONLY: s2a
38#include "./base/base_uses.f90"
39
40 IMPLICIT NONE
41 PRIVATE
42
43 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .true.
44 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_free_energy'
45
46 PUBLIC :: create_metavar_section, &
48
49!***
50CONTAINS
51
52! **************************************************************************************************
53!> \brief creates the free energy section
54!> \param section the section to be created
55!> \author teo
56! **************************************************************************************************
57 SUBROUTINE create_fe_section(section)
58 TYPE(section_type), POINTER :: section
59
60 TYPE(keyword_type), POINTER :: keyword
61 TYPE(section_type), POINTER :: print_key, subsection
62
63 NULLIFY (subsection, keyword, print_key)
64 cpassert(.NOT. ASSOCIATED(section))
65 CALL section_create(section, __location__, name="free_energy", &
66 description="Controls the calculation of free energy and free energy derivatives"// &
67 " with different possible methods", &
68 n_keywords=0, n_subsections=1, repeats=.false.)
69
70 CALL keyword_create(keyword, __location__, name="METHOD", &
71 description="Defines the method to use to compute free energy.", &
72 usage="METHOD (METADYN|UI|AC)", &
73 enum_c_vals=s2a("METADYN", "UI", "AC"), &
74 enum_i_vals=[do_fe_meta, do_fe_ui, do_fe_ac], &
75 enum_desc=s2a("Metadynamics", &
76 "Umbrella Integration", &
77 "Alchemical Change"), &
78 default_i_val=do_fe_meta, repeats=.false.)
79 CALL section_add_keyword(section, keyword)
80 CALL keyword_release(keyword)
81
82 CALL create_metadyn_section(subsection)
83 CALL section_add_subsection(section, subsection)
84 CALL section_release(subsection)
85
86 CALL create_ui_section(subsection)
87 CALL section_add_subsection(section, subsection)
88 CALL section_release(subsection)
89
90 CALL create_ac_section(subsection)
91 CALL section_add_subsection(section, subsection)
92 CALL section_release(subsection)
93
94 CALL cp_print_key_section_create(print_key, __location__, "free_energy_info", &
95 description="Controls the printing of basic and summary information during the"// &
96 " Free Energy calculation", &
97 print_level=low_print_level, each_iter_names=s2a("MD"), &
98 each_iter_values=[1], add_last=add_last_numeric, filename="__STD_OUT__")
99 CALL section_add_subsection(section, print_key)
100 CALL section_release(print_key)
101
102 END SUBROUTINE create_fe_section
103
104! **************************************************************************************************
105!> \brief creates the metadynamics section
106!> \param section the section to be created
107!> \author teo
108! **************************************************************************************************
109 SUBROUTINE create_metadyn_section(section)
110 TYPE(section_type), POINTER :: section
111
112 TYPE(keyword_type), POINTER :: keyword
113 TYPE(section_type), POINTER :: print_key, subsection
114
115 cpassert(.NOT. ASSOCIATED(section))
116 CALL section_create(section, __location__, name="metadyn", &
117 description="This section sets parameters to set up a calculation of metadynamics.", &
118 n_keywords=1, n_subsections=1, repeats=.false., &
119 citations=[vandencic2006])
120
121 NULLIFY (subsection, keyword, print_key)
122
123 CALL keyword_create(keyword, __location__, name="USE_PLUMED", &
124 description="Specify whether to use plumed as an external metadynamics driver.", &
125 usage="USE_PLUMED .FALSE./.TRUE.", &
126 default_l_val=.false., lone_keyword_l_val=.true.)
127 CALL section_add_keyword(section, keyword)
128 CALL keyword_release(keyword)
129
130 CALL keyword_create(keyword, __location__, name="PLUMED_INPUT_FILE", &
131 description="Specify the file name of the external plumed input file", &
132 usage="PLUMED_INPUT_FILE ./FILENAME", &
133 default_c_val="./plumed.dat")
134 CALL section_add_keyword(section, keyword)
135 CALL keyword_release(keyword)
136
137 CALL keyword_create(keyword, __location__, name="MIN_NT_HILLS", &
138 description="Specify the minimum MD step interval between spawning "// &
139 "two hills. If specified, it must be >= than NT_HILLS. In case MIN_DISP "// &
140 "is used, if MIN_DISP is satisfied before MIN_NT_HILLS MD steps have been "// &
141 "performed, the MD will continue without any spawning until MIN_NT_HILLS is "// &
142 "reached. The default value has the net effect of skipping this check.", &
143 usage="MIN_NT_HILLS {integer}", default_i_val=1)
144 CALL section_add_keyword(section, keyword)
145 CALL keyword_release(keyword)
146
147 CALL keyword_create(keyword, __location__, name="NT_HILLS", &
148 description="Specify the maximum MD step interval between spawning "// &
149 "two hills. When negative, no new hills are spawned and only "// &
150 "the hills read from SPAWNED_HILLS_* are in effect. The latter "// &
151 "is useful when one wants to add a custom constant bias potential.", &
152 usage="NT_HILLS {integer}", default_i_val=30)
153 CALL section_add_keyword(section, keyword)
154 CALL keyword_release(keyword)
155
156 CALL keyword_create(keyword, __location__, name="TEMPERATURE", &
157 description="If a Lagrangian scheme is used the temperature for the collective "// &
158 "variables is specified. ", usage="TEMPERATURE <REAL>", &
159 default_r_val=0.0_dp, unit_str='K')
160 CALL section_add_keyword(section, keyword)
161 CALL keyword_release(keyword)
162
163 !RG Adaptive hills
164 CALL keyword_create(keyword, __location__, name="MIN_DISP", &
165 description="Minimum displacement between hills before placing a new hill.", &
166 usage="MIN_DISP <REAL>", &
167 default_r_val=-1.0_dp)
168 CALL section_add_keyword(section, keyword)
169 CALL keyword_release(keyword)
170
171 CALL keyword_create(keyword, __location__, name="OLD_HILL_NUMBER", &
172 description="Index of the last hill spawned for this walker.Needed to calculate MIN_DISP", &
173 usage="OLD_HILL_NUMBER <INT>", &
174 default_i_val=0)
175 CALL section_add_keyword(section, keyword)
176 CALL keyword_release(keyword)
177 CALL keyword_create(keyword, __location__, name="OLD_HILL_STEP", &
178 description="Timestep of the last hill spawned for this walker.Needed to calculate MIN_DISP", &
179 usage="OLD_HILL_STEP <INT>", &
180 default_i_val=0)
181 CALL section_add_keyword(section, keyword)
182 CALL keyword_release(keyword)
183 !RG Adaptive hills
184
185 !Hills tail damping
186 CALL keyword_create(keyword, __location__, name="HILL_TAIL_CUTOFF", &
187 description="By setting this variable larger than 0 the tail of the Gaussian hill "// &
188 "is damped to zero faster. Let $X_0$ be the location of the Gaussian and $\mathrm{SCALE}$ "// &
189 "be the width of the Gaussian (for more than one METAVAR, $X_0$ and $\mathrm{SCALE}$ are "// &
190 "METAVAR-dependent), and denote $S=\mathrm{HILL\_TAIL\_CUTOFF} \cdot \mathrm{SCALE}$. "// &
191 "The Gaussian function is multiplied by a cutoff function that becomes active at "// &
192 "$|x-X_0| \gt S$, namely $\dfrac{1-(|x-X_0|/S)^{P}}{1-(|x-X_0|/S)^{Q}}$", &
193 usage="HILL_TAIL_CUTOFF <REAL>", &
194 default_r_val=-1.0_dp)
195 CALL section_add_keyword(section, keyword)
196 CALL keyword_release(keyword)
197 CALL keyword_create(keyword, __location__, name="P_EXPONENT", &
198 description="Exponent $P$ at the numerator of the cutoff function "// &
199 "to damp the tail of the Gaussian.", &
200 usage="P_EXPONENT <INT>", &
201 default_i_val=8)
202 CALL section_add_keyword(section, keyword)
203 CALL keyword_release(keyword)
204 CALL keyword_create(keyword, __location__, name="Q_EXPONENT", &
205 description="Exponent $Q$ at the denominator of the cutoff function "// &
206 "to damp the tail of the Gaussian.", &
207 usage="Q_EXPONENT <INT>", &
208 default_i_val=20)
209 CALL section_add_keyword(section, keyword)
210 CALL keyword_release(keyword)
211
212 CALL keyword_create(keyword, __location__, name="SLOW_GROWTH", &
213 description="Let the last hill grow slowly over NT_HILLS. ", &
214 usage="SLOW_GROWTH {logical}", &
215 default_l_val=.false., lone_keyword_l_val=.true.)
216 CALL section_add_keyword(section, keyword)
217 CALL keyword_release(keyword)
218
219 CALL keyword_create(keyword, __location__, name="TEMP_TOL", &
220 description="If a Lagrangian scheme is used the temperature tolerance for the collective "// &
221 "variables is specified.", usage="TEMP_TOL <REAL>", &
222 unit_str='K', default_r_val=0.0_dp)
223 CALL section_add_keyword(section, keyword)
224 CALL keyword_release(keyword)
225
226 CALL keyword_create(keyword, __location__, name="LANGEVIN", &
227 description="If a Lagrangian scheme is used the eq. motion of the COLVARS are integrated "// &
228 "with a LANGEVIN scheme.", &
229 usage="LANGEVIN {logical}", &
230 citations=[vandencic2006], &
231 default_l_val=.false., lone_keyword_l_val=.true.)
232 CALL section_add_keyword(section, keyword)
233 CALL keyword_release(keyword)
234
235 CALL keyword_create(keyword, __location__, name="WW", &
236 description="Specifies the height of the gaussian to spawn. Default 0.1 .", &
237 usage="WW <REAL>", unit_str='hartree', default_r_val=0.1_dp)
238 CALL section_add_keyword(section, keyword)
239 CALL keyword_release(keyword)
240
241 CALL keyword_create(keyword, __location__, name="DO_HILLS", &
242 description="This keyword enables the spawning of the hills. Default .FALSE.", &
243 usage="DO_HILLS", default_l_val=.false., lone_keyword_l_val=.true.)
244 CALL section_add_keyword(section, keyword)
245 CALL keyword_release(keyword)
246
247 CALL keyword_create(keyword, __location__, name="WELL_TEMPERED", &
248 description="This keyword enables Well-tempered metadynamics. Default .FALSE.", &
249 usage="WELL_TEMPERED", citations=[barducbus2008], &
250 default_l_val=.false., lone_keyword_l_val=.true.)
251 CALL section_add_keyword(section, keyword)
252 CALL keyword_release(keyword)
253
254 CALL keyword_create(keyword, __location__, name="DELTA_T", &
255 description="If Well-tempered metaD is used, the temperature parameter "// &
256 "must be specified.", usage="DELTA_T <REAL>", &
257 unit_str='K', default_r_val=0.0_dp)
258 CALL section_add_keyword(section, keyword)
259 CALL keyword_release(keyword)
260
261 CALL keyword_create(keyword, __location__, name="WTGAMMA", &
262 description="If Well-tempered metaD is used, the gamma parameter "// &
263 "must be specified if not DELTA_T.", usage="WTGAMMA <REAL>", &
264 default_r_val=0.0_dp)
265 CALL section_add_keyword(section, keyword)
266 CALL keyword_release(keyword)
267
268 CALL keyword_create(keyword, __location__, name="LAGRANGE", &
269 description="Specifies whether an extended-lagrangian should be used. Default .FALSE.", &
270 usage="LAGRANGE", default_l_val=.false., lone_keyword_l_val=.true.)
271 CALL section_add_keyword(section, keyword)
272 CALL keyword_release(keyword)
273
274 CALL keyword_create(keyword, __location__, name="step_start_val", &
275 description="The starting step value for metadynamics", &
276 usage="step_start_val <integer>", default_i_val=0)
277 CALL section_add_keyword(section, keyword)
278 CALL keyword_release(keyword)
279
280 CALL keyword_create(keyword, __location__, name="nhills_start_val", &
281 description="The starting value of previously spawned hills", &
282 usage="nhills_start_val <integer>", default_i_val=0)
283 CALL section_add_keyword(section, keyword)
284 CALL keyword_release(keyword)
285
286 CALL keyword_create(keyword, __location__, name="COLVAR_AVG_TEMPERATURE_RESTART", &
287 description="COLVAR average temperature. Only for restarting purposes.", &
288 usage="COLVAR_AVG_TEMPERATURE_RESTART 0.0", default_r_val=0.0_dp)
289 CALL section_add_keyword(section, keyword)
290 CALL keyword_release(keyword)
291
292 CALL keyword_create(keyword, __location__, name="TAMCSteps", &
293 description="Number of sampling points for z", &
294 usage="TAMCSteps <integer>", default_i_val=1)
295 CALL section_add_keyword(section, keyword)
296 CALL keyword_release(keyword)
297
298 CALL keyword_create(keyword, __location__, name="timestep", &
299 description="The length of an integration step for colvars (TAMC only)", &
300 usage="timestep <real>", default_r_val=cp_unit_to_cp2k(value=0.5_dp, unit_str="fs"), &
301 unit_str="fs")
302
303 CALL section_add_keyword(section, keyword)
304 CALL keyword_release(keyword)
305
306 CALL create_metavar_section(subsection)
307 CALL section_add_subsection(section, subsection)
308 CALL section_release(subsection)
309
310 CALL create_multiple_walkers_section(subsection)
311 CALL section_add_subsection(section, subsection)
312 CALL section_release(subsection)
313
314 CALL section_create(subsection, __location__, name="print", &
315 description="Controls the printing properties during an metadynamics run", &
316 n_keywords=0, n_subsections=1, repeats=.true.)
317 NULLIFY (print_key)
318
319 CALL cp_print_key_section_create(print_key, __location__, "program_run_info", &
320 description="Controls the printing of basic and summary information during"// &
321 " metadynamics.", &
322 print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
323 each_iter_values=[1, 1], add_last=add_last_numeric, filename="__STD_OUT__")
324 CALL section_add_subsection(subsection, print_key)
325 CALL section_release(print_key)
326
327 CALL cp_print_key_section_create(print_key, __location__, "temperature_colvar", &
328 description="Controls the printing of the temperature of COLVARS in an "// &
329 "extended lagrangian scheme.", &
330 print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
331 each_iter_values=[1, 1], add_last=add_last_numeric, filename="__STD_OUT__")
332 CALL section_add_subsection(subsection, print_key)
333 CALL section_release(print_key)
334
335 CALL cp_print_key_section_create(print_key, __location__, "COLVAR", &
336 description="Controls the printing of COLVAR summary information during"// &
337 " metadynamics. When an extended Lagrangian use used, the files"// &
338 " contain (in order): colvar value of the extended Lagrangian,"// &
339 " instantaneous colvar value, force due to the harmonic term of the extended"// &
340 " Lagrangian and the force due to the previously spawned hills,"// &
341 " the force due to the walls, the velocities in the extended"// &
342 " Lagrangian, the potential of the harmonic term of the"// &
343 " Lagrangian, the potential energy of the hills, the potential"// &
344 " energy of the walls and the temperature of the extended"// &
345 " Lagrangian. When the extended Lagrangian is not used, all"// &
346 " related fields are omitted.", &
347 print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
348 each_iter_values=[1, 1], add_last=add_last_numeric, filename="COLVAR")
349 CALL section_add_subsection(subsection, print_key)
350 CALL section_release(print_key)
351
352 CALL cp_print_key_section_create(print_key, __location__, "HILLS", &
353 description="Controls the printing of HILLS summary information during"// &
354 " metadynamics. The file contains: instantaneous colvar value, width of"// &
355 " the spawned gaussian and height of the gaussian. According the value of"// &
356 " the EACH keyword this file may not be synchronized with the COLVAR file.", &
357 print_level=high_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
358 each_iter_values=[1, 1], add_last=add_last_numeric, filename="HILLS")
359 CALL section_add_subsection(subsection, print_key)
360 CALL section_release(print_key)
361
362 CALL section_add_subsection(section, subsection)
363 CALL section_release(subsection)
364
365 CALL create_metadyn_history(subsection, section)
366 END SUBROUTINE create_metadyn_section
367
368! **************************************************************************************************
369!> \brief creates the multiple walker section
370!> \param section the section to be created
371!> \author teodoro laino [tlaino] 10.2008
372! **************************************************************************************************
373 SUBROUTINE create_multiple_walkers_section(section)
374 TYPE(section_type), POINTER :: section
375
376 TYPE(keyword_type), POINTER :: keyword
377 TYPE(section_type), POINTER :: subsection
378
379 cpassert(.NOT. ASSOCIATED(section))
380 CALL section_create(section, __location__, name="MULTIPLE_WALKERS", &
381 description="Enables and configures the metadynamics using multiple walkers.", &
382 n_keywords=0, n_subsections=0, repeats=.false.)
383
384 NULLIFY (subsection, keyword)
385 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
386 description="Controls the usage of the multiple walkers in a metadynamics run.", &
387 usage="&MULTIPLE_WALKERS T", default_l_val=.false., lone_keyword_l_val=.true.)
388 CALL section_add_keyword(section, keyword)
389 CALL keyword_release(keyword)
390
391 CALL keyword_create(keyword, __location__, name="WALKER_ID", &
392 description="Sets the walker ID for the local metadynamics run.", &
393 usage="WALKER_ID <INTEGER>", type_of_var=integer_t)
394 CALL section_add_keyword(section, keyword)
395 CALL keyword_release(keyword)
396
397 CALL keyword_create(keyword, __location__, name="NUMBER_OF_WALKERS", &
398 description="Sets the total number of walkers in the metadynamic run.", &
399 usage="NUMBER_OF_WALKERS <INTEGER>", type_of_var=integer_t)
400 CALL section_add_keyword(section, keyword)
401 CALL keyword_release(keyword)
402
403 CALL keyword_create(keyword, __location__, name="WALKER_COMM_FREQUENCY", &
404 description="Sets the frequency (in unit of spawned hills) for the "// &
405 "communication between the several walkers, in order to update the "// &
406 "local list of hills with the ones coming from the other walkers", &
407 usage="WALKER_COMM_FREQUENCY <INTEGER>", default_i_val=1)
408 CALL section_add_keyword(section, keyword)
409 CALL keyword_release(keyword)
410
411 CALL keyword_create(keyword, __location__, name="WALKERS_STATUS", &
412 description="Stores the status of the several walkers in the local run.", &
413 usage="WALKERS_STATUS <INTEGER> .. <INTEGER>", type_of_var=integer_t, n_var=-1)
414 CALL section_add_keyword(section, keyword)
415 CALL keyword_release(keyword)
416
417 CALL section_create(subsection, __location__, name="WALKERS_FILE_NAME", &
418 description="Specify the basename for the NUMBER_OF_WALKERS files used to "// &
419 "communicate between the walkers. Absolute path can be input as well "// &
420 "together with the filename. One file will be created for each spawned hill.", &
421 n_keywords=1, n_subsections=0, repeats=.false.)
422 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
423 description="Specified the communication filename for each walker.", repeats=.true., &
424 usage="{String}", type_of_var=lchar_t, n_var=1)
425 CALL section_add_keyword(subsection, keyword)
426 CALL keyword_release(keyword)
427 CALL section_add_subsection(section, subsection)
428 CALL section_release(subsection)
429 END SUBROUTINE create_multiple_walkers_section
430
431! **************************************************************************************************
432!> \brief creates the alchemical section for free energy evaluation
433!> \param section the section to be created
434!> \author teodoro laino [tlaino] 04.2007
435! **************************************************************************************************
436 SUBROUTINE create_ac_section(section)
437 TYPE(section_type), POINTER :: section
438
439 TYPE(keyword_type), POINTER :: keyword
440
441 NULLIFY (keyword)
442 cpassert(.NOT. ASSOCIATED(section))
443 CALL section_create(section, __location__, name="ALCHEMICAL_CHANGE", &
444 description="Controls the calculation of delta free energies with the "// &
445 "alchemical change method. This requires setting up a generic mixed "// &
446 "force env with the FORCE_EVAL/MIXED/MIXING_TYPE keyword set as GENMIX "// &
447 "and the coupling function defined in the FORCE_EVAL/MIXED/GENERIC section.", &
448 n_keywords=0, n_subsections=0, repeats=.false.)
449
450 CALL keyword_create(keyword, __location__, name="PARAMETER", &
451 description="Defines the symbol for the perturbing parameter of the "// &
452 "alchemical change transformation. This must be one of the symbols "// &
453 "for the corresponding FORCE_EVAL/MIXED/GENERIC/PARAMETERS keyword.", &
454 usage="PARAMETER k", type_of_var=char_t, &
455 n_var=1)
456 CALL section_add_keyword(section, keyword)
457 CALL keyword_release(keyword)
458
459 CALL keyword_create(keyword, __location__, name="WEIGHTING_FUNCTION", &
460 description="Specifies the weighting function (umbrella potential, "// &
461 "part of the mixing function) using the identical symbols for the "// &
462 "parameters and variables in FORCE_EVAL/MIXED/GENERIC.", &
463 usage="WEIGHTING_FUNCTION (E1+E2-LOG(E1/E2))", type_of_var=lchar_t, &
464 n_var=1, default_lc_val="0")
465 CALL section_add_keyword(section, keyword)
466 CALL keyword_release(keyword)
467
468 CALL keyword_create(keyword, __location__, name="EPS_CONV", &
469 description="Set the relative tolerance for the convergence of the free energy derivative", &
470 usage="EPS_CONV <REAL>", &
471 default_r_val=1.0e-2_dp)
472 CALL section_add_keyword(section, keyword)
473 CALL keyword_release(keyword)
474
475 CALL keyword_create(keyword, __location__, name="NEQUIL_STEPS", &
476 description="Set the number of equilibration steps, skipped to compute averages", &
477 usage="NEQUIL_STEPS <INTEGER>", &
478 default_i_val=0)
479 CALL section_add_keyword(section, keyword)
480 CALL keyword_release(keyword)
481
482 END SUBROUTINE create_ac_section
483
484! **************************************************************************************************
485!> \brief creates the umbrella integration section
486!> \param section the section to be created
487!> \author teodoro laino [tlaino] 01.2007
488! **************************************************************************************************
489 SUBROUTINE create_ui_section(section)
490 TYPE(section_type), POINTER :: section
491
492 TYPE(section_type), POINTER :: subsection
493
494 cpassert(.NOT. ASSOCIATED(section))
495 CALL section_create(section, __location__, name="umbrella_integration", &
496 description="Controls the calculation of free energy derivatives"// &
497 " with the umbrella integration method.", &
498 n_keywords=0, n_subsections=0, repeats=.false.)
499
500 NULLIFY (subsection)
501 CALL create_uvar_conv_section(subsection)
502 CALL section_add_subsection(section, subsection)
503 CALL section_release(subsection)
504
505 CALL create_uvar_section(subsection)
506 CALL section_add_subsection(section, subsection)
507 CALL section_release(subsection)
508
509 END SUBROUTINE create_ui_section
510
511! **************************************************************************************************
512!> \brief Creates the velocity section
513!> \param section the section to create
514!> \param metadyn_section ...
515!> \author teo
516! **************************************************************************************************
517 SUBROUTINE create_metadyn_history(section, metadyn_section)
518 TYPE(section_type), POINTER :: section, metadyn_section
519
520 TYPE(keyword_type), POINTER :: keyword
521
522 cpassert(.NOT. ASSOCIATED(section))
523 CALL section_create(section, __location__, name="SPAWNED_HILLS_POS", &
524 description="The position of the spawned hills during metadynamics. "// &
525 "Used for RESTART.", &
526 n_keywords=1, n_subsections=0, repeats=.false.)
527 NULLIFY (keyword)
528 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
529 description="Specify the spawned hills", repeats=.true., &
530 usage="{Real} ...", type_of_var=real_t, n_var=-1)
531 CALL section_add_keyword(section, keyword)
532 CALL keyword_release(keyword)
533 CALL section_add_subsection(metadyn_section, section)
534 CALL section_release(section)
535
536 CALL section_create(section, __location__, name="SPAWNED_HILLS_SCALE", &
537 description="The scales of the spawned hills during metadynamics. "// &
538 "Used for RESTART. When a scale is zero in one or more "// &
539 "directions, the Gaussian hill is assumed to be infinitely wide "// &
540 "in those directions. The latter can be used to combine spawned "// &
541 "hills from multiple 1D metadynamics runs in one multidimensional "// &
542 "metadynamics run.", &
543 n_keywords=1, n_subsections=0, repeats=.false.)
544 NULLIFY (keyword)
545 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
546 description="Specify the spawned hills", repeats=.true., &
547 usage="{Real} ...", type_of_var=real_t, n_var=-1)
548 CALL section_add_keyword(section, keyword)
549 CALL keyword_release(keyword)
550 CALL section_add_subsection(metadyn_section, section)
551 CALL section_release(section)
552
553 CALL section_create(section, __location__, name="SPAWNED_HILLS_HEIGHT", &
554 description="The height of the spawned hills during metadynamics. "// &
555 "Used for RESTART.", &
556 n_keywords=1, n_subsections=0, repeats=.false.)
557 NULLIFY (keyword)
558 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
559 description="Specify the spawned hills", repeats=.true., &
560 usage="{Real}", type_of_var=real_t, n_var=1)
561 CALL section_add_keyword(section, keyword)
562 CALL keyword_release(keyword)
563 CALL section_add_subsection(metadyn_section, section)
564 CALL section_release(section)
565
566 CALL section_create(section, __location__, name="SPAWNED_HILLS_INVDT", &
567 description="The inverse of the DELTA_T parameter used for Well-Tempered metadynamics. "// &
568 "Used for RESTART.", &
569 n_keywords=1, n_subsections=0, repeats=.false.)
570 NULLIFY (keyword)
571 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
572 description="Specify the spawned hills", repeats=.true., &
573 usage="{Real}", type_of_var=real_t, n_var=1)
574 CALL section_add_keyword(section, keyword)
575 CALL keyword_release(keyword)
576 CALL section_add_subsection(metadyn_section, section)
577 CALL section_release(section)
578 !
579 ! Extended Lagrangian
580 !
581 CALL section_create(section, __location__, name="EXT_LAGRANGE_SS0", &
582 description="Colvar position within an extended Lagrangian formalism. "// &
583 "Used for RESTART.", &
584 n_keywords=1, n_subsections=0, repeats=.false.)
585 NULLIFY (keyword)
586 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
587 description="Specified the positions", repeats=.true., &
588 usage="{Real}", type_of_var=real_t, n_var=1)
589 CALL section_add_keyword(section, keyword)
590 CALL keyword_release(keyword)
591 CALL section_add_subsection(metadyn_section, section)
592 CALL section_release(section)
593
594 CALL section_create(section, __location__, name="EXT_LAGRANGE_VVP", &
595 description="Colvar velocities within an extended Lagrangian formalism. "// &
596 "Used for RESTART.", &
597 n_keywords=1, n_subsections=0, repeats=.false.)
598 NULLIFY (keyword)
599 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
600 description="Specified the velocities", repeats=.true., &
601 usage="{Real}", type_of_var=real_t, n_var=1)
602 CALL section_add_keyword(section, keyword)
603 CALL keyword_release(keyword)
604 CALL section_add_subsection(metadyn_section, section)
605 CALL section_release(section)
606
607 CALL section_create(section, __location__, name="EXT_LAGRANGE_SS", &
608 description="Colvar Theta within an extended Lagrangian formalism. "// &
609 "Used for RESTART.", &
610 n_keywords=1, n_subsections=0, repeats=.false.)
611 NULLIFY (keyword)
612 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
613 description="Specified the theta", repeats=.true., &
614 usage="{Real}", type_of_var=real_t, n_var=1)
615 CALL section_add_keyword(section, keyword)
616 CALL keyword_release(keyword)
617 CALL section_add_subsection(metadyn_section, section)
618 CALL section_release(section)
619
620 CALL section_create(section, __location__, name="EXT_LAGRANGE_FS", &
621 description="Colvar force within an extended Lagrangian formalism. "// &
622 "Used for RESTART.", &
623 n_keywords=1, n_subsections=0, repeats=.false.)
624 NULLIFY (keyword)
625 CALL keyword_create(keyword, __location__, name="_DEFAULT_KEYWORD_", &
626 description="Specified the theta", repeats=.true., &
627 usage="{Real}", type_of_var=real_t, n_var=1)
628 CALL section_add_keyword(section, keyword)
629 CALL keyword_release(keyword)
630 CALL section_add_subsection(metadyn_section, section)
631 CALL section_release(section)
632
633 END SUBROUTINE create_metadyn_history
634
635! **************************************************************************************************
636!> \brief creates the metavar section
637!> \param section the section to be created
638!> \author teo
639! **************************************************************************************************
640 SUBROUTINE create_metavar_section(section)
641 TYPE(section_type), POINTER :: section
642
643 TYPE(keyword_type), POINTER :: keyword
644 TYPE(section_type), POINTER :: subsection, wall_section
645
646 cpassert(.NOT. ASSOCIATED(section))
647 CALL section_create(section, __location__, name="METAVAR", &
648 description="This section specify the nature of the collective variables.", &
649 n_keywords=1, n_subsections=1, repeats=.true.)
650
651 NULLIFY (keyword)
652 CALL keyword_create(keyword, __location__, name="LAMBDA", &
653 description="Specifies the lambda parameter for the coupling of the collective variable with the system coordinates in the"// &
654 " extended lagrangian scheme.", &
655 usage="LAMBDA <REAL>", unit_str='internal_cp2k', type_of_var=real_t)
656 CALL section_add_keyword(section, keyword)
657 CALL keyword_release(keyword)
658
659 CALL keyword_create(keyword, __location__, name="MASS", &
660 description="Specifies the mass parameter of the collective variable in the"// &
661 " extended lagrangian scheme.", usage="MASS <REAL>", unit_str='amu', type_of_var=real_t)
662 CALL section_add_keyword(section, keyword)
663 CALL keyword_release(keyword)
664
665 CALL keyword_create(keyword, __location__, name="GAMMA", &
666 description="Specifies the friction term in Langevin integration of the collective variable in the"// &
667 " extended lagrangian scheme.", &
668 citations=[vandencic2006], &
669 usage="GAMMA {real}", type_of_var=real_t, unit_str="fs^-1")
670 CALL section_add_keyword(section, keyword)
671 CALL keyword_release(keyword)
672
673 CALL keyword_create(keyword, __location__, name="SCALE", &
674 variants=["WIDTH"], &
675 description="Specifies the scale factor for the following collective variable. The history "// &
676 "dependent term has the expression: $\mathrm{WW} \sum_{j=1}^{n_{hills}} \prod_{k=1}^{n_{colvar}} "// &
677 "\exp{[-0.5(\frac{\mathrm{ss}-\mathrm{ss0}(k,j)}{\mathrm{SCALE}(k)})^2]}$, "// &
678 "where $n_{colvar}$ is the number of defined METAVAR and $n_{hills}$ is the number of spawned hills. ", &
679 usage="SCALE <REAL>", type_of_var=real_t, unit_str='internal_cp2k')
680 CALL section_add_keyword(section, keyword)
681 CALL keyword_release(keyword)
682
683 CALL keyword_create(keyword, __location__, name="COLVAR", &
684 description="Specifies the colvar on which to apply metadynamics.", &
685 usage="COLVAR {integer}", type_of_var=integer_t)
686 CALL section_add_keyword(section, keyword)
687 CALL keyword_release(keyword)
688
689 ! Wall section
690 NULLIFY (wall_section, subsection)
691 CALL section_create(wall_section, __location__, name="WALL", &
692 description="Controls the activation of walls on COLVAR during a metadynamic run.", &
693 n_keywords=0, n_subsections=1, repeats=.true.)
694
695 CALL keyword_create( &
696 keyword, __location__, name="TYPE", &
697 description="Specify the type of wall", &
698 usage="TYPE (REFLECTIVE|QUADRATIC|QUARTIC|GAUSSIAN|NONE)", &
699 enum_c_vals=s2a("REFLECTIVE", "QUADRATIC", "QUARTIC", "GAUSSIAN", "NONE"), &
700 enum_desc=s2a("Reflective wall. Colvar velocity is inverted when the colvar is beyond the wall position.", &
701 "Applies a quadratic potential at the wall position.", &
702 "Applies a quartic potential at the wall position.", &
703 "Applies a gaussian potential at the wall position.", &
704 "No walls are applied."), &
706 default_i_val=do_wall_none)
707 CALL section_add_keyword(wall_section, keyword)
708 CALL keyword_release(keyword)
709
710 CALL keyword_create(keyword, __location__, name="POSITION", &
711 description="Specify the value of the colvar for the wall position", &
712 usage="POSITION <REAL>", unit_str='internal_cp2k', &
713 type_of_var=real_t)
714 CALL section_add_keyword(wall_section, keyword)
715 CALL keyword_release(keyword)
716
717 ! Reflective wall
718 CALL section_create(subsection, __location__, name="REFLECTIVE", &
719 description="Parameters controlling the reflective wall", &
720 n_keywords=0, n_subsections=1, repeats=.false.)
721
722 CALL keyword_create(keyword, __location__, name="DIRECTION", &
723 description="Specify the direction of the wall.", &
724 usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
725 enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
726 enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
727 "Wall extends from the position towards smaller values of COLVAR"), &
728 enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
729 CALL section_add_keyword(subsection, keyword)
730 CALL keyword_release(keyword)
731 CALL section_add_subsection(wall_section, subsection)
732 CALL section_release(subsection)
733
734 ! Quadratic wall
735 CALL section_create(subsection, __location__, name="QUADRATIC", &
736 description="Parameters controlling the quadratic wall "// &
737 "$K (\mathrm{CV}-\mathrm{POS})^2$", &
738 n_keywords=0, n_subsections=1, repeats=.false.)
739
740 CALL keyword_create(keyword, __location__, name="DIRECTION", &
741 description="Specify the direction of the wall.", &
742 usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
743 enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
744 enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
745 "Wall extends from the position towards smaller values of COLVAR"), &
746 enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
747 CALL section_add_keyword(subsection, keyword)
748 CALL keyword_release(keyword)
749
750 CALL keyword_create(keyword, __location__, name="K", &
751 description="Specify the value of the quadratic potential constant $K$.", &
752 usage="K <REAL>", unit_str='hartree', type_of_var=real_t)
753 CALL section_add_keyword(subsection, keyword)
754 CALL keyword_release(keyword)
755
756 CALL section_add_subsection(wall_section, subsection)
757 CALL section_release(subsection)
758
759 ! Quartic wall
760 CALL section_create(subsection, __location__, name="QUARTIC", &
761 description="Parameters controlling the quartic wall "// &
762 "$K (\mathrm{CV}-(\mathrm{POS}\pm\frac{0.05}{K^{1/4}}))^4$", &
763 n_keywords=0, n_subsections=1, repeats=.false.)
764
765 CALL keyword_create(keyword, __location__, name="DIRECTION", &
766 description="Specify the direction of the wall.", &
767 usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
768 enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
769 enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
770 "Wall extends from the position towards smaller values of COLVAR"), &
771 enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
772 CALL section_add_keyword(subsection, keyword)
773 CALL keyword_release(keyword)
774
775 CALL keyword_create(keyword, __location__, name="K", &
776 description="Specify the value of the quartic potential constant $K$.", &
777 usage="K <REAL>", unit_str='hartree', &
778 type_of_var=real_t)
779 CALL section_add_keyword(subsection, keyword)
780 CALL keyword_release(keyword)
781
782 CALL section_add_subsection(wall_section, subsection)
783 CALL section_release(subsection)
784
785 ! Gaussian wall
786 CALL section_create(subsection, __location__, name="GAUSSIAN", &
787 description="Parameters controlling the gaussian wall "// &
788 "$\mathrm{WW} \exp{(-(\frac{\mathrm{CV}-\mathrm{POS}}{\sigma})^2)}$.", &
789 n_keywords=0, n_subsections=1, repeats=.false.)
790
791 CALL keyword_create(keyword, __location__, name="WW", &
792 description="Specify the height $\mathrm{WW}$ of the gaussian.", &
793 usage="WW <REAL>", unit_str='hartree', &
794 type_of_var=real_t)
795 CALL section_add_keyword(subsection, keyword)
796 CALL keyword_release(keyword)
797
798 CALL keyword_create(keyword, __location__, name="SIGMA", &
799 description="Specify the width $\sigma$ of the gaussian.", &
800 usage="SIGMA <REAL>", unit_str='internal_cp2k', &
801 type_of_var=real_t)
802 CALL section_add_keyword(subsection, keyword)
803 CALL keyword_release(keyword)
804
805 CALL section_add_subsection(wall_section, subsection)
806 CALL section_release(subsection)
807
808 CALL section_add_subsection(section, wall_section)
809 CALL section_release(wall_section)
810
811 END SUBROUTINE create_metavar_section
812
813! **************************************************************************************************
814!> \brief creates the uvar section
815!> \param section the section to be created
816!> \author teo
817! **************************************************************************************************
818 SUBROUTINE create_uvar_section(section)
819 TYPE(section_type), POINTER :: section
820
821 TYPE(keyword_type), POINTER :: keyword
822
823 cpassert(.NOT. ASSOCIATED(section))
824 CALL section_create(section, __location__, name="UVAR", &
825 description="This section specify the nature of the collective variables"// &
826 " used in computing the free energy.", &
827 n_keywords=1, n_subsections=1, repeats=.true.)
828
829 NULLIFY (keyword)
830
831 CALL keyword_create(keyword, __location__, name="COLVAR", &
832 description="Specifies the colvar used to compute free energy", &
833 usage="COLVAR {integer}", type_of_var=integer_t)
834 CALL section_add_keyword(section, keyword)
835 CALL keyword_release(keyword)
836 END SUBROUTINE create_uvar_section
837
838! **************************************************************************************************
839!> \brief creates the section specifying parameters to control the convergence
840!> of the free energy
841!> \param section the section to be created
842!> \author teodoro laino [tlaino] 01.2007
843! **************************************************************************************************
844 SUBROUTINE create_uvar_conv_section(section)
845 TYPE(section_type), POINTER :: section
846
847 TYPE(keyword_type), POINTER :: keyword
848
849 cpassert(.NOT. ASSOCIATED(section))
850 CALL section_create(section, __location__, name="CONVERGENCE_CONTROL", &
851 description="This section specify parameters controlling the convergence"// &
852 " of the free energy.", &
853 n_keywords=1, n_subsections=1, repeats=.true.)
854
855 NULLIFY (keyword)
856 CALL keyword_create(keyword, __location__, name="COARSE_GRAINED_WIDTH", &
857 variants=["CG_WIDTH"], &
858 description="Width of segments in MD steps to generate the set of"// &
859 " coarse grained data, providing a correlation independent data set.", &
860 usage="COARSE_GRAINED_WIDTH <INTEGER>", default_i_val=50)
861 CALL section_add_keyword(section, keyword)
862 CALL keyword_release(keyword)
863
864 CALL keyword_create(keyword, __location__, name="MAX_COARSE_GRAINED_WIDTH", &
865 variants=["MAX_CG_WIDTH"], &
866 description="Max Width of segments in MD steps to generate the set of"// &
867 " coarse grained data.", &
868 usage="MAX_COARSE_GRAINED_WIDTH <INTEGER>", default_i_val=200)
869 CALL section_add_keyword(section, keyword)
870 CALL keyword_release(keyword)
871
872 CALL keyword_create(keyword, __location__, name="COARSE_GRAINED_POINTS", &
873 variants=["CG_POINTS"], &
874 description="Set the minimum amount of coarse grained points to collect"// &
875 " before starting the statistical analysis", &
876 usage="COARSE_GRAINED_POINTS <INTEGER>", default_i_val=30)
877 CALL section_add_keyword(section, keyword)
878 CALL keyword_release(keyword)
879
880 CALL keyword_create(keyword, __location__, name="EPS_CONV", &
881 description="Set the relative tolerance for the convergence of the collective"// &
882 " variable averages used to compute the free energy.", &
883 usage="EPS_CONV <REAL>", &
884 default_r_val=1.0e-2_dp)
885 CALL section_add_keyword(section, keyword)
886 CALL keyword_release(keyword)
887
888 CALL keyword_create(keyword, __location__, name="K_CONFIDENCE_LIMIT", &
889 description="Set the confidence limit for the Mann-Kendall trend test.", &
890 usage="K_CONFIDENCE_LIMIT <REAL>", &
891 default_r_val=0.90_dp)
892 CALL section_add_keyword(section, keyword)
893 CALL keyword_release(keyword)
894
895 CALL keyword_create(keyword, __location__, name="SW_CONFIDENCE_LIMIT", &
896 description="Set the confidence limit for the Shapiro-Wilks normality test.", &
897 usage="SW_CONFIDENCE_LIMIT <REAL>", &
898 default_r_val=0.90_dp)
899 CALL section_add_keyword(section, keyword)
900 CALL keyword_release(keyword)
901
902 CALL keyword_create(keyword, __location__, name="VN_CONFIDENCE_LIMIT", &
903 description="Set the confidence limit for the Von Neumann serial correlation test.", &
904 usage="VN_CONFIDENCE_LIMIT <REAL>", &
905 default_r_val=0.90_dp)
906 CALL section_add_keyword(section, keyword)
907 CALL keyword_release(keyword)
908 END SUBROUTINE create_uvar_conv_section
909
910END MODULE input_cp2k_free_energy
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public barducbus2008
integer, save, public vandencic2006
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
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, do_backup)
creates a print_key section
integer, parameter, public low_print_level
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Definition cp_units.F:1282
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_wall_p
integer, parameter, public do_wall_m
integer, parameter, public do_fe_ac
integer, parameter, public do_wall_none
integer, parameter, public do_wall_gaussian
integer, parameter, public do_fe_ui
integer, parameter, public do_wall_quartic
integer, parameter, public do_wall_reflective
integer, parameter, public do_wall_quadratic
integer, parameter, public do_fe_meta
integer, parameter, public gaussian
subroutine, public create_metavar_section(section)
creates the metavar section
subroutine, public create_fe_section(section)
creates the free energy section
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, deprecation_notice)
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 lchar_t
integer, parameter, public char_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