VASP was widely rewritten to use the power and flexibility of Fortran 90. On passing one must note that performance was not a high priority during the restructuring (although performance of VASP.4.x is usually better than of VASP.3.2). The main aim was to improve the maintainability of the code. Subroutine calls in VASP.3.2 used to have calling sequences of several lines:
CALL EDDIAG(IFLAG,NBANDS,NKPTS,NPLWV,MPLWV,NRPLWV, & NINDPW,NPLWKP,WTKPT,SV,CPTWFP,NTYP,NITYP, & NBLK,CBLOCK,A,B,ANORM,BNORM,CELEN,NGPTAR, & LOVERL,LREAL,CPROJ,CDIJ, & CQIJ,IRMAX,NLI,NLIMAX,QPROJ,CQFAK,RPROJ,CRREXP,CREXP, & DATAKE,CPRTMP,CWORK3,CWORK4,CWORK5, & FERWE,NIOND,NIONS,LMDIM,LMMAX, & NPLINI,CHAM,COVL,CWORK2,R,DWORK1,NWRK1,CPROTM,NWORK1,mcpu)This was an outcome of not using any COMMON blocks in VASP.3.2. Due to the introduction of derived types (or structures) the same CALL consists now of only 2 lines:
CALL EDDIAG(GRID,LATT_CUR,NONLR_S,NONL_S,WUP,WDES, & LMDIM,CDIJ,CQIJ, IFLAG,INFO%LOVERL,INFO%LREAL,NBLK,SV)This adds considerably to the readability and structuring of the code. It is now much easier to introduce and support new features in VASP. We estimate that the introduction of F90 reduced the time required for the parallelization of VASP from approximately 4 to 2 months.
In VASP.3.2 work arrays were allocated statically and several EQUIVALENCE statements existed to save memory. The introduction of new subroutines requiring work arrays was always extremely tedious. In VASP.4.x all work space is allocated on the fly using ALLOCATE and DEALLOCATE. This results in a smaller code, and makes the program significantly safer.
Finally VASP.4.x uses MODULES wherever possible. Therefore dummy parameters are checked during compilation time, making further code development easier and safer.