Page 1 of 1

Error: Array specification required in ALLOCATE statement

Posted: Thu Mar 24, 2022 7:16 pm
by leocristobal_ambolode
Hi,

I am trying to install vasp 6.3.0 on Ubuntu 16.04 LTS and I encountered the following errors upon compiling:

=========================================
if [ ! -d build/std ] ; then mkdir -p build/std ; fi
cp src/makefile src/.objects src/makedeps.awk makefile.include build/std
make -C build/std VERSION=std check
make[1]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
exit 0
make[1]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
make -C build/std VERSION=std cleandependencies -j1
make[1]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
rm -f .depend
make[1]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
make -C build/std VERSION=std all
make[1]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
rsync -ru ../../src/lib .
cp makefile.include lib
make -C lib -j1
make[2]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/lib'
make libdmy.a
make[3]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/lib'
make[3]: 'libdmy.a' is up to date.
make[3]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/lib'
make[2]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/lib'
rsync -ru ../../src/parser .
cp makefile.include parser
make -C parser -j1
make[2]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/parser'
make libparser.a
make[3]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/parser'
make[3]: 'libparser.a' is up to date.
make[3]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/parser'
make[2]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std/parser'
rsync -u ../../src/*.F ../../src/*.inc .
rm -f vasp ; make vasp ; cp vasp ../../bin/vasp_std
make[2]: Entering directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
mpif90.openmpi -ffree-form -ffree-line-length-none -w -ffpe-summary=invalid,zero,overflow -march=native -O2 -mtune=native -m64 -I/usr/include -I/usr/lib/openmpi/include -c tet.f90
tet.F:523:15:

allocate(energies, int_dos, mold=calculator%grid%energies)
1
Error: Array specification required in ALLOCATE statement at (1)
tet.F:523:25:

allocate(energies, int_dos, mold=calculator%grid%energies)
1
Error: Array specification required in ALLOCATE statement at (1)
tet.F:344:15:

allocate(energies, mold=calculator%grid%energies)
1
Error: Array specification required in ALLOCATE statement at (1)
tet.F:174:18:

allocate(new_grid%energies, new_grid%weights, mold=grid_points)
1
Error: Array specification required in ALLOCATE statement at (1)
tet.F:174:37:

allocate(new_grid%energies, new_grid%weights, mold=grid_points)
1
Error: Array specification required in ALLOCATE statement at (1)
makefile:166: recipe for target 'tet.o' failed
make[2]: *** [tet.o] Error 1
make[2]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
cp: cannot stat 'vasp': No such file or directory
makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
makefile:13: recipe for target 'std' failed
make: *** [std] Error 2

=========================================

Any advice? makefile.include is also attached. Thank you.

Re: Error: Array specification required in ALLOCATE statement

Posted: Fri Mar 25, 2022 7:57 am
by andreas.singraber
Hello!

This might be an issue with the compiler. The MOLD= keyword of the allocate statement was introduced in the Fortran 2008 standard. Most likely the gfortran compiler from Ubuntu 16.04 is too old to support this feature. Could you please check which version it actually is with

Code: Select all

gfortran --version
Can you check whether a newer version is available via your package manager? Another option would be to install the Intel oneAPI compiler on your system because it is pretty much standalone and gives a good performance.

All the best,

Andreas Singraber

Re: Error: Array specification required in ALLOCATE statement

Posted: Thu Mar 31, 2022 9:31 am
by leocristobal_ambolode
Hi!

Thank you for your reply. It took us a while to update Ubuntu. We now have Ubuntu 18.04.6 LTS.
I tried to follow the instructions found in wiki/index.php/A_Ubuntu_based_installation_of_VASP and encountered the following error:

=================
/usr/bin/ld: lib/libdmy.a(linpack_double.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parser/libparser.a(locproj.tab.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parser/libparser.a(sites.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parser/libparser.a(functions.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parser/libparser.a(basis.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parser/libparser.a(lex.yy.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
makefile:132: recipe for target 'vasp' failed
make[2]: *** [vasp] Error 1
make[2]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
cp: cannot stat 'vasp': No such file or directory
makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/njpjacosalem/soft/VASP/src/vasp.6.3.0/build/std'
makefile:13: recipe for target 'std' failed
make: *** [std] Error 2
================

Please help. Thank you!

gfortran version:
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Best regards,
Naomi

Re: Error: Array specification required in ALLOCATE statement

Posted: Thu Mar 31, 2022 2:41 pm
by andreas.singraber
Hello!

Ok, so GCC 7.5.0 should be sufficiently new to compile VASP without problems. I installed Ubuntu 18.04 on a virtual machine and was able to build VASP 6.3.0 successfully. However, I did not follow the instructions from the Wiki page you mentioned but rather used an edited makefile.include taken from the arch directory. I suspect that the error you observed comes from an outdated form of the makefile.include file provided on the Wiki page. I am very sorry for this inconvenience, we will update this page soon. In the meantime I summarized the steps I have taken to compile VASP on a fresh install of Ubuntu 18.04.
  1. Install compiler and necessary system libraries:

    Code: Select all

    sudo apt install make build-essential g++ gfortran libopenblas-dev liblapack-dev libopenmpi-dev libscalapack-mpi-dev libfftw3-dev
    Note that I replaced libblas-dev with libopenblas-dev which should be a bit faster.
  2. Unpack VASP and change into VASP base directory. There, copy the GNU makefile.include from the arch directory:

    Code: Select all

    cp arch/makefile.include.gnu_omp makefile.include
    If you prefer to compile without OpenMP parallelization support, then use arch/makefile.include.gnu instead.
  3. Now search for the section in arch/makefile.include where library paths are defined. It starts with a comment "## Customize as of this point!". Go through the following blocks and replace them with this content:

    Code: Select all

    # For gcc-10 and higher (comment out for older versions)
    #FFLAGS     += -fallow-argument-mismatch
    
    # BLAS and LAPACK (mandatory)
    #OPENBLAS_ROOT ?= /path/to/your/openblas/installation
    #BLASPACK    = -L$(OPENBLAS_ROOT)/lib -lopenblas
    BLASPACK    = -lopenblas
    
    # scaLAPACK (mandatory)
    #SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
    #SCALAPACK   = -L$(SCALAPACK_ROOT)/lib -lscalapack
    SCALAPACK   = -lscalapack-openmpi
    
    LLIBS      += $(SCALAPACK) $(BLASPACK)
    
    # FFTW (mandatory)
    #FFTW_ROOT  ?= /path/to/your/fftw/installation
    #LLIBS      += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
    LLIBS      += -lfftw3 -lfftw3_omp
    #INCS       += -I$(FFTW_ROOT)/include
    INCS       += -I/usr/include
    Leave the remaining parts of makefile.include untouched. If you compile without OpenMP support remove -lfftw3_omp from the line starting with LLIBS.
  4. Finally, compile VASP but do not forget to clean up any previous build attempts:

    Code: Select all

    make veryclean
    make DEPS=1 -j
    
These instructions should work also for newer Ubuntu versions and some other Linux distributions based on Ubuntu (e.g. Linux Mint). Hope this works for you too!

All the best,

Andreas Singraber

Re: Error: Array specification required in ALLOCATE statement

Posted: Mon Apr 04, 2022 1:52 am
by leocristobal_ambolode
Hi.

Good day!
Your step by step instructions solved the problem. It is greatly appreciated.

Thank you very much.
-Naomi

Re: Error: Array specification required in ALLOCATE statement

Posted: Fri Apr 29, 2022 2:40 pm
by andreas.singraber
For everyone who stumbles across this thread: we updated the Wiki section regarding OS-specific installation, it can be found here:

wiki/index.php/Personal_computer_installation