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 Make and 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 with integrating these tests with the build system, please notify the other developers.
It is also appreciated to have examples (under the directory examples). 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 can be formatted with the prettify tool by running make -j pretty.
Please make sure that you follow the following code conventions (based on CP2K conventions):
- Every
USEstatement should have anONLY:clause, which lists the imported symbols. - Every
OMP PARALLELregion should declaredefault(none). - Every static variable should be marked with the
SAVEattribute. - Every Fortran module should contain the line
IMPLICIT NONE. - Every conversion that might change value should be explicit.
- Each
.Ffile should contain either aPROGRAMor 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=*inWRITEorPRINTstatements. 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 Makefile.inc.
- 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.
Most important, please avoid to commit dead code and useless comments!