Appendix C Debug Manager - a centralized debugging facility for developers
FHI-aims features a centralized utility for controlling debug output. This utility keeps track of all registered modules (in a physical sense, e.g. the DFPT features are a module in this context) and can enable their debug output selectively via the control.in file.
The main idea behind this utility is to provide a simple tool to generate debug-flags that can be set in the control.in without having to register them manually in the input parsing routines. Furthermore, it also provides a central debug interface to the user, instead of having to use different flags, flags that can only be toggled in the sourcecode or even no toggles at all.
You can enable debugging for any registered module in the input file by adding a debug_module my_module. The list of currently supported modules can be found in the file init_debug.f90.
To register your module, you only need to add a single line to the init_debug.f90:
register_debugmodule("your_tag")
Afterwards, you can conveniently activate debugging in the control.in by using the flag:
debug_module your_tag
This tells the code to enable debugging for your code. Just call
debugprint(message, your_tag)
in your code to only print the message if debugging for your module is enabled. For more complicated debug functionality, there also is
module_is_debugged(your_tag)
This function returns a logical value and thus can be used as condition in an enclosing if-block. Both functions are located inside the debugmanager module, which you can import like any other module with a use-statement.