The core of DBCSR is written in Fortran. All other languages must be supported through bindings.
There is a single API file for DBCSR, which is provided for external usage only. Do not use the API for any internal DBCSR development! Packages build on top of DBCSR, for example DBCSR Tensors, must only use the DBCSR API. Note that any change in the APIs will require a major release of the library.
We support CMake for compilation, please keep the build system updated when adding/removing files. When adding new functions, it is extremely important to provide simple test programs, aka "unit tests", to check whether these functions are performing as they should. The directory test serves as infrastructure for that. If you do not feel comfortable integrating these tests with the build system, please notify the other developers.
Having examples (under the directory examples) is also appreciated. They must be independent of the DBCSR compilation and only use the DBCSR APIs.
DBCSR developers can find additional information on the Development wiki page.
The code is automatically formatted (via pre-commit hooks) by the prettify tool.
Please make sure that you follow the following code conventions (based on CP2K conventions):
- Every
USE
statement should have anONLY:
clause, which lists the imported symbols. - Every
OMP PARALLEL
region should declaredefault(none)
. - Every static variable should be marked with the
SAVE
attribute. - Every Fortran module should contain the line
IMPLICIT NONE
. - Every conversion that might change value should be explicit.
- Each
.F
file should contain either aPROGRAM
or a singleMODULE
, whose name must start with thedbcsr_
suffix and matches the filename. Then, it should start with the DBCSR header. Note that the name of the modules must be unique, even across different directories! - Use the routines from MPI wrappers instead of calling MPI directly.
- Don't use
UNIT=*
inWRITE
orPRINT
statements. Instead, request a unit from the logger:iw=dbcsr_logger_get_default_unit_nr()
and write only if you actually received a unit:IF(iw>0) WRITE (UNIT=iw, ,,,)
. - Avoid to use
STOP
. Prefer the DBCSR error handlers:DBCSR_WARN
,DBCSR_ABORT
,DBCSR_ASSERT
. - Each preprocessor flag should start with two underscores and be documented in the documentation.
- All routines in the API must start with the
dbcsr_
namespace. For submodules API (e.g. DBCSR Tensors), each function has to start with thedbcsr_<unique ID of the submodule>_
namespace. - If you are including files (i.e. macro
#include
), note that the base directory issrc
, please use relative path to it (e.g.#include "base/dbcsr_base_uses.f90"
instead of#include "../base/dbcsr_base_uses.f90"
). - All Fortran keywords (
FUNCTION
,SUBROUTINE
, data types...) must be in capital letters.
Most important, please avoid committing dead code and useless comments!