next up previous contents
Next: FAQ Up: vasp Previous: Some guidelines to create   Contents


Important hints for programmers

In VASP.4.X, the module prec must be included in all subroutines, and

      USE prec
at the beginning of all subroutines. All real and complex variables must be defined as REAL(q) and COMPLEX(q) (NEVER: REAL or COMPLEX). The use of IMPLICIT NONE is strongly recommended, but currently not used in all subroutines. If you do not use IMPLICIT NONE, you must use

      IMPLICIT REAL(q) (A-H,O-Z)
to guarantee that all real variables have the correct type. The IMPLICIT statement must be the first statement after the USE statement (some compiler allow IMPLICIT statements somewhere else, but not all F90 compiler do so). For instance:

      SUBROUTINE RHOATO(LFOUR,LPAR,GRIDC,T_INFO,B,P,CSTRF,CHTOT,CHDER)
      USE prec
      USE mgrid
      USE pseudo
      USE constant

      IMPLICIT REAL(q) (A-B,D-H,O-Z)

      TYPE (type_info)   T_INFO
      TYPE (potcar)      P(T_INFO%NTYP)
      TYPE (grid_3d)     GRIDC
      COMPLEX(q)   CHTOT(GRIDC%RC%NP),CHDER(GRIDC%RC%NP)
      COMPLEX(q)   CSTRF(GRIDC%MPLWV,T_INFO%NTYP)
      REAL(q)      B(3,3)
      LOGICAL LFOUR,LPAR
Work arrays SHOULD be allocated on the fly with ALLOCATE and DEALLOCATE. DO NOT USE DYNAMIC F90 arrays (except for small performance insensitive arrays). The dynamic arrays are allocated from the stack and this can degrade performance by up to 20 In addition, it might happen that one runs out of stack memory if large arrays are allocated from the stack, unpredictable crashes are possible (at least on IBM workstations). ALLOCATE and DEALLOCATE uses the heap and not the stack and is therefore often saver.

All file must conform to the F90 free format. A small utility called convert can be found in the package to convert F77 style programs to F90 free format.

All subroutines should be placed in a MODULE so that dummy-parameters can be checked during compilation.

Input/Output (IO) should be done with extreme care, to allow later parallelisation. The following rules must be obeyed:


next up previous contents
Next: FAQ Up: vasp Previous: Some guidelines to create   Contents
Georg Kresse
2009-04-23