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?
macro definition in vasp6.2.0
Moderators: Global Moderator, Moderator
-
- Administrator
- Posts: 282
- Joined: Mon Sep 24, 2018 9:39 am
Re: macro definition in vasp6.2.0
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?
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?
-
- Newbie
- Posts: 10
- Joined: Wed Nov 20, 2019 10:24 pm
Re: macro definition in vasp6.2.0
Yes, the Fujitsu compiler, as used on the Fujitsu FX1000 series machines, which currently includes the machine at no. 1 on the top 500.
-
- Newbie
- Posts: 10
- Joined: Wed Nov 20, 2019 10:24 pm
Re: macro definition in vasp6.2.0
And if you want a work-around you can try altering the macros like this:
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
#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
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