macro definition in vasp6.2.0

Questions regarding the compilation of VASP on various platforms: hardware, compilers and libraries, etc.

Moderators: Global Moderator, Moderator

Post Reply
Message
Author
roger_amos1
Newbie
Newbie
Posts: 10
Joined: Wed Nov 20, 2019 10:24 pm

macro definition in vasp6.2.0

#1 Post by roger_amos1 » Tue Feb 23, 2021 10:35 pm

Hello, the file phonon.F has some neat macro definitions which generate code.
Unfortunately the code does not conform to Fortran Standard, though it compiles with the Intel compilers.
The problem is that it has lines longer than 255 characters. Intel compilers have an extension to allow 2048 line lengths.
Not all compilers allow this.
I can get round this, but the method is a bit inelegant and involves using sed on the .f90 file after preprocessing to insert newline commands.
Does any one have a neater solution?

merzuk.kaltak
Administrator
Administrator
Posts: 123
Joined: Mon Sep 24, 2018 9:39 am

Re: macro definition in vasp6.2.0

#2 Post by merzuk.kaltak » Wed Feb 24, 2021 8:31 am

Hello,
to the best of my knowlegde, ifc, gfortran, nvfortran/pgf90 do not have a problem with phonon.F.
These are the compilers used in our recommended toolchains found here.
Can you name a specific compiler that has this problem?

roger_amos1
Newbie
Newbie
Posts: 10
Joined: Wed Nov 20, 2019 10:24 pm

Re: macro definition in vasp6.2.0

#3 Post by roger_amos1 » Thu Feb 25, 2021 10:19 pm

Yes, the Fujitsu compiler, as used on the Fujitsu FX1000 series machines, which currently includes the machine at no. 1 on the top 500.

roger_amos1
Newbie
Newbie
Posts: 10
Joined: Wed Nov 20, 2019 10:24 pm

Re: macro definition in vasp6.2.0

#4 Post by roger_amos1 » Thu Feb 25, 2021 10:25 pm

And if you want a work-around you can try altering the macros like this:

Code: Select all

#define VASP_TEMPLATE_SETUP_ALLOC_ARR(M_SUFFIX,M_DIM,M_TYPE) \
 SUBROUTINE VASP_CONCAT3(SETUP_ALLOC_ARR,M_SUFFIX,M_DIM)(ARR, ALLOC_SIZE) ;\
 IMPLICIT NONE ;\
 M_TYPE, ALLOCATABLE, INTENT(INOUT)  :: VASP_CONCAT(VASP_ARR_,M_DIM) ;\
 INTEGER,             INTENT(IN)     :: VASP_CONCAT(VASP_ALLOC_SIZE_,M_DIM) _NL_ \
 IF (ALLOCATED(ARR)) THEN ;\
    IF (ANY(SHAPE(ARR) /= ALLOC_SIZE)) THEN ;\
       DEALLOCATE(ARR) ;\
       ALLOCATE(VASP_CONCAT(VASP_ALLOC_,M_DIM)) ;\
    ENDIF _NL_\
 ELSE ;\
    ALLOCATE(VASP_CONCAT(VASP_ALLOC_,M_DIM)) ;\
 ENDIF ;\
 END SUBROUTINE
! end of macro definition
Note the extra symbols _NL_ where you want a new line
Then you use an editor, to remove these symbols.
This can be automated in the makefile, but needs phonon.F as a special case

Code: Select all

phonon.o : phonon.F
        cpp -P -traditional -DMPI phonon.F > phonon.tmp
        sed s/_NL_/\\n/g phonon.tmp > phonon.f90
        $(FC) $(FREE) $(FFLAGS) $(INCS) -c phonon.f90

Post Reply