gfortran: -fimplicit-none не обходит ошибку - PullRequest
0 голосов
/ 27 апреля 2018

Я пытаюсь скомпилировать код на Фортране, где используется implicit none. Это код, который я пытаюсь скомпилировать

module qe_p_psi
!
! Get the <p_i|psi> or <beta_i|psi> from Quantum Espresso
! Get the mapping of the projectors index
!
use kinds,                ONLY : dp
use ions_base,            ONLY : nat, ityp, ntyp => nsp
use cell_base,            ONLY : at, tpiba2
use constants,            ONLY : rytoev
use gvect,                ONLY : g, ngm
use lsda_mod,             ONLY : nspin
#if defined __QE6
use klist,                ONLY : xk, nks, nkstot, ngk, igk_k
#elif defined __QE512 || __QE54
use klist,                ONLY : xk, nks, nkstot
#endif
use io_files,             ONLY : iunpun, nwordwfc, iunwfc
#if defined __QE6
use wvfct,                ONLY : nbnd, et, npw, npwx, g2kin
use gvecw,                ONLY : ecutwfc
#elif defined __QE54
use wvfct,                ONLY : nbnd, et, igk, npw, npwx, g2kin
use gvecw,                ONLY : ecutwfc
#elif defined __QE512
use wvfct,                ONLY : nbnd, et, ecutwfc, igk, npw, npwx, g2kin
#endif
use uspp,                 ONLY : nkb, vkb, qq
use uspp_param,           ONLY : upf, nh, nhm, nbetam
use noncollin_module,     ONLY : noncolin, npol
use wavefunctions_module, ONLY : evc
use io_global,            ONLY : ionode, ionode_id, stdout
use becmod,               ONLY : calbec, bec_type, allocate_bec_type, deallocate_bec_type

!   use mp,                   ONLY : mp_bcast
!   use mp_world,             ONLY : world_comm

implicit none
!   integer, allocatable, public :: p_index(:,:) ! QE projector index mapping back to atom and lm

    type(bec_type), public, allocatable :: becp(:)  ! <p|\psi>
    public                 :: p_psi ! Subroutine

private
contains

    subroutine p_psi()
    implicit none

        integer :: ik

        allocate( becp(1:nks) )

        do ik = 1, nks
            call allocate_bec_type(nkb, nbnd, becp(ik))
            !
            ! get the k+G vectors for the ik k-point
            !
#if defined __QE512 || __QE54
            call gk_sort (xk (1, ik), ngm, g, ecutwfc / tpiba2, npw, igk, g2kin)
#else
            npw = ngk(ik)
#endif

            !
            !   read eigenfunctions
            !
            call davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)

            !
            ! calculate becp = <psi|beta>
            !

#if defined __QE512 || __QE54
            call init_us_2 (npw, igk, xk (1, ik), vkb)
#else
            call init_us_2 (npw, igk_k(1,ik), xk(1,ik), vkb)
#endif
            call calbec ( npw, vkb, evc, becp(ik) )

!        IF (noncolin) &
!           CALL compute_sigma_avg(sigma_avg(1,1,ik),becp%nc,ik,lsigma)

        enddo

    !
    ! Mapping of indexes l and m for each type of atom nt -> nh(nt) in the following way:
    !
    !do it = 1, ntyp
    !   ih = 1
    !   do ib = 1, upf(it)%nbeta
    !      do im = 1, 2 * upf(it)%lll (ib) + 1
    !         ih = ih + 1
    !      enddo
    !enddo
    !enddo

    !
    ! Mapping of all atoms projectors index nh index into a jkb index continously and
    ! ordered by type of atom.
    ! Recalculating that here and storing it
    !

    !jkb = 7*nbetam
    !allocate( p_index( 1:nat, 1:jkb ) )

    !jkb = 0
    !do it=1, ntyp
    !   do ia=1, nat
    !      if ( ityp(ia) .eq. it ) then
    !         do ih = 1, nh (it)
    !            jkb = jkb + 1
    !            p_index(ia,ih) = jkb  ! Projectors
    !         enddo
    !     endif
    !  enddo
    !enddo

    end subroutine p_psi

end module qe_p_psi

и вот команда, которую я использую для компиляции

mpif90 -fdollar-ok -ffree-line-length-none -O3 -fopenmp -fPIC -cpp -u -ffixed-form -fimplicit-none -I../../../qe/6.0-mpi/Modules -I../../../qe/6.0-mpi/PW/src -I../src ../../../qe/6.0-mpi/PW/src/libpw.a ../../../qe/6.0-mpi/Modules/libqemod.a ../../../qe/6.0-mpi/FFTXlib/libqefft.a ../../../qe/6.0-mpi/LAXlib/libqela.a -Wall -c qe_p_psi.f90 -o qe_p_psi.o 

но я получаю следующее сообщение об ошибке qe_p_psi.f90: 79: 41:

          call allocate_bec_type(nkb, nbnd, becp(ik))
                                         1
Error: Symbol ‘nbnd’ at (1) has no IMPLICIT type
qe_p_psi.f90:76:26:

       allocate( becp(1:nks) )
                          1
Error: Symbol ‘nks’ at (1) has no IMPLICIT type
qe_p_psi.f90:86:12:

          npw = ngk(ik)
            1
Error: Symbol ‘npw’ at (1) has no IMPLICIT type
qe_p_psi.f90:86:15:

          npw = ngk(ik)
               1
Error: Function ‘ngk’ at (1) has no IMPLICIT type
Makefile.for-qe-6.0:82: recipe for target 'qe_p_psi.o' failed
make[1]: *** [qe_p_psi.o] Error 1
make[1]: Leaving directory '/media/anhvt89/seagateRepo/qe/6.0-mpi/kgec-v2.1/for-qe-6.0-mpi'
Makefile:66: recipe for target 'all' failed
make: *** [all] Error 1

Я пытаюсь обойти компилятор gfortran с флагом -fimplicit-none, но код все равно не работает. Я что-то пропустил?

$ mpif90 --version
GNU Fortran (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
...