(git:e5fdd81)
swarm_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 swarm framework
10 !> \author Ole Schuett
11 ! **************************************************************************************************
20  keyword_type
25  section_type
26  USE input_val_types, ONLY: integer_t
27  USE string_utilities, ONLY: s2a
28 #include "../base/base_uses.f90"
29 
30  IMPLICIT NONE
31  PRIVATE
32 
33  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'swarm_input'
34 
35  PUBLIC :: create_swarm_section
36 
37 CONTAINS
38 
39 ! **************************************************************************************************
40 !> \brief Declares the SWARM input section
41 !> \param swarm_section ...
42 !> \author Ole Schuett
43 ! **************************************************************************************************
44  SUBROUTINE create_swarm_section(swarm_section)
45  TYPE(section_type), POINTER :: swarm_section
46 
47  TYPE(keyword_type), POINTER :: keyword
48  TYPE(section_type), POINTER :: print_section, printkey
49 
50  NULLIFY (swarm_section, print_section, printkey, keyword)
51 
52  CALL section_create(swarm_section, __location__, name="SWARM", &
53  description="Section to control swarm runs. "// &
54  "The swarm framework provides a common ground for master/worker algorithms.", &
55  repeats=.false.)
56 
57  CALL keyword_create(keyword, __location__, name="BEHAVIOR", &
58  description="Which behaviour should control the swarm.", &
59  usage="BEHAVIOR <STRING>", &
60  default_i_val=swarm_do_glbopt, &
61  enum_c_vals=s2a("GLOBAL_OPT"), &
62  enum_desc=s2a("Runs global geometry optimisation"), &
63  enum_i_vals=(/swarm_do_glbopt/))
64  CALL section_add_keyword(swarm_section, keyword)
65  CALL keyword_release(keyword)
66 
67  CALL keyword_create(keyword, __location__, name="NUMBER_OF_WORKERS", &
68  description="Number of workers used for swarm. "// &
69  "Of the total number of processors one is used for the master, "// &
70  "the remaining processors should be divisible by the number of workers.", &
71  type_of_var=integer_t)
72  CALL section_add_keyword(swarm_section, keyword)
73  CALL keyword_release(keyword)
74 
75  CALL keyword_create(keyword, __location__, name="REPLAY_COMMUNICATION_LOG", &
76  description="Filename of communication log of previous run. Use this to restart a swarm.", &
77  repeats=.false., &
78  usage="REPLAY_COMMUNICATION_LOG <CHARACTER>", default_lc_val="swarm_translog_replay.xyz")
79  CALL section_add_keyword(swarm_section, keyword)
80  CALL keyword_release(keyword)
81 
82  CALL keyword_create(keyword, __location__, name="MAX_ITER", &
83  description="The maximum number iterations the master should perform", &
84  type_of_var=integer_t, default_i_val=huge(1))
85  CALL section_add_keyword(swarm_section, keyword)
86  CALL keyword_release(keyword)
87 
88  CALL section_create(print_section, __location__, name="PRINT", &
89  description="Controls the printing properties during a global optimization run", &
90  n_keywords=0, n_subsections=1, repeats=.true.)
91 
93  printkey, __location__, "WORKER_RUN_INFO", &
94  description="Controls the printing of the worker's basic information during the global optimization", &
95  print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
96  CALL section_add_subsection(print_section, printkey)
97  CALL section_release(printkey)
98 
100  printkey, __location__, "MASTER_RUN_INFO", &
101  description="Controls the printing of the masters's basic information during the global optimization", &
102  print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
103  CALL section_add_subsection(print_section, printkey)
104  CALL section_release(printkey)
105 
106  CALL cp_print_key_section_create(printkey, __location__, "COMMUNICATION_LOG", &
107  description="Log all the communication between workers and master. Needed for restart.", &
108  print_level=low_print_level, common_iter_levels=1, &
109  filename="", unit_str="angstrom")
110  CALL section_add_subsection(print_section, printkey)
111  CALL section_release(printkey)
112 
113  CALL section_add_subsection(swarm_section, print_section)
114  CALL section_release(print_section)
115 
116  CALL glbopt_declare_input(swarm_section)
117 
118  END SUBROUTINE create_swarm_section
119 
120 END MODULE swarm_input
121 
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
integer, parameter, public add_last_numeric
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.
Definition: glbopt_input.F:12
subroutine, public glbopt_declare_input(swarm_section)
Declares the SWARMGLOBAL_OPT input section.
Definition: glbopt_input.F:47
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public swarm_do_glbopt
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 integer_t
Utilities for string manipulations.
Declares the input for swarm framework.
Definition: swarm_input.F:12
subroutine, public create_swarm_section(swarm_section)
Declares the SWARM input section.
Definition: swarm_input.F:45