remark for developers - bertdupe/Matjes GitHub Wiki
General remarks for developpers
To ease the development of the code and to simplify the merging procedure between the different groups, some simple rules should be followed. Here is a small summary of these rules:
-
The developers should compile the code with the make file
make.debug-serial
. This make file uses gfortran to compile the code. It will check everything that can be checked (unused variables, subroutine and function call - type and number of variable). It compiles with backtrace and full debugging options: FFLAGS= -O0 -g -fbacktrace -ffpe-trap=invalid,overflow,zero,underflow,denormal -ffree-form -fimplicit-none -ffree-line-length-none With this makefile, all warnings are considered as errors and will stop the compilation. -
The file names should not contain any _. Use - instead if it is necessary.
-
The default extension if .f90.
-
all function and subroutine should have the implicit none statement. The modules should contain public and private statements.
-
All modules should start with m_. The module names should have the same name as the file names. In that case, the - sign should be replaced by _. Example: The module contained in
init-spin.f90
should be calledm_init_spin
. -
try as much as possible to code interfaces containing module procedures. The compiler will then check the type and the size of variables that are passed as arguments to choose the good subroutines. On top of that, it will make sure that there are no memory corruption or memory loss
-
If you code in MPI or Cuda, write the parallel commands into single subroutines. The reason is to try to avoid as much as possible the CPP pre-compiler options mixed with the serial subroutine. Adding precompiler options decrease the readability of the code.
-
All the routine that requires the motif (table of neighbors, table of distances...) should be incorporated into the setup-sims.f90 file. The setup is done at the beginning because it takes time and then the table of neighbors is destroyed.