This is an old revision of the document!
USE-statement should have an
ONLY:-clause, which lists the imported symbols [-Wuse-without-only].
OMP PARALLEL-region should declare
DEALLOCATE, the Fortran runtime takes care.
RANDOM_NUMBER(), it's not consistent across different compilers.
There are two measure of defense against spaghetti code:
PRIVATEand only few public symbols.
Always prefer built-in (intrinsic) functions instead of hand-coded routines since they usually include extra numerical checks to avoid intermediate under- or overflow while still performing optimally. Example:
SQRT(x(1)**2 + x(2)**2 + x(3)**2)
For many common operations there exist wrappers in CP2K to prevent usage errors and to allow for central redirections, i.e. avoid to use direct calls to external libraries in CP2K
cp_files.Finstead of calling
fm-package instead of calling BLAS or Scalapack directly.
message_passing.Finstead of calling MPI directly.
fft_lib.Finstead of calling FFT (any library) directly.
machine.Fto access architecture depended things like e.g. the working directory.
iw=cp_logger_get_default_unit_nr()and write only if you actually received a unit:
IF(iw>0) WRITE (UNIT=iw, ,,,).
IF(debug_this_module)-block, with a parameter set to
.FALSE.. This way the code will stay up-to-date and easily callable.
.Ffile should contain either a
PROGRAMor a single
MODULE, whose name matches the filename.
INSTALL-file and added to the cp2k_flags function (cp2k_info.F).
make -j pretty.
SUBROUTINEshould be preceded by a valid doxygen block.
\param(for each parameter),
make doxifyto format your doxygen comments, or generate templates where none exist