next up previous contents
Next: 3.9 Performance profile of Up: 3 The installation of Previous: 3.7 Performance optimization of

3.8 Style guide for VASP.4

  In VASP.4 one must use the module prec in all subroutines, and

      USE prec
must be the first statement in 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 statements (some compiler allow IMPLICIT 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 unimportant arrays). The dynamic arrays are allocated from the stack and this can degrade performance by up to 20 In addition it can 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 much saver.

All file must conform the F90 free format. A small utility called convert can be found in the package to convert F77 style 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 parallelization. The following rules should be obeyed:


next up previous contents
Next: 3.9 Performance profile of Up: 3 The installation of Previous: 3.7 Performance optimization of

MASTER USER VASP
Mon Mar 29 10:38:29 MEST 1999