Commit aadef3cc authored by spigafi's avatar spigafi

ifdef preprocessor macro refactoring (Modules)


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12981 c92efa57-630b-4861-b058-cf58834340f0
parent 8371c8e9
......@@ -154,7 +154,7 @@ MODULE basic_algebra_routines
!
REAL(DP), INTENT(IN) :: vec1(:), vec2(:)
REAL(DP) :: matrix(SIZE( vec1 ),SIZE( vec2 ))
#ifdef __GFORTRAN
#if defined(__GFORTRAN)
! gfortran hack - explicit preprocessing is used because this hack
! costs an additional matrix allocation, which may not be a good idea
REAL(DP) :: aux(SIZE( vec1 ),SIZE( vec2 ))
......@@ -164,7 +164,7 @@ MODULE basic_algebra_routines
dim1 = SIZE( vec1 )
dim2 = SIZE( vec2 )
!
#ifdef __GFORTRAN
#if defined(__GFORTRAN)
!
aux = 0.0_DP
CALL DGER( dim1, dim2, 1.0_DP, vec1, 1, vec2, 1, aux, dim1 )
......
......@@ -52,7 +52,7 @@ CONTAINS
! ... One may use "ulimit -s unlimited" but it doesn't always work
! ... The following call does the same and always works
!
#ifdef __INTEL_COMPILER
#if defined(__INTEL_COMPILER)
CALL remove_stack_limit ( )
#endif
! ... use ".FALSE." to disable all clocks except the total cpu time clock
......@@ -67,7 +67,7 @@ CONTAINS
! ... for compatibility with PWSCF
#ifdef __MPI
#if defined(__MPI)
nd_nmbr = TRIM ( int_to_char( me_image+1 ))
#else
nd_nmbr = ' '
......@@ -110,10 +110,10 @@ CONTAINS
END IF
!
CALL opening_message( code_version )
#ifdef __HAVE_CONFIG_INFO
#if defined(__HAVE_CONFIG_INFO)
CALL compilation_info ( )
#endif
#ifdef __MPI
#if defined(__MPI)
CALL parallel_info ( )
#else
CALL serial_info()
......
......@@ -72,8 +72,8 @@ SUBROUTINE errore( calling_routine, message, ierr )
!
FLUSH( stdout )
!
#ifdef __PTRACE
#ifdef __INTEL_COMPILER
#if defined(__PTRACE)
#if defined(__INTEL_COMPILER)
call tracebackqq(user_exit_code=-1)
#elif __GFORTRAN
#if (__GNUC__>4) || ((__GNUC__==4) && (__GNUC_MINOR__>=8))
......
......@@ -204,7 +204,7 @@ CONTAINS
INTEGER, ALLOCATABLE :: igsrt(:)
!
#ifdef __MPI
#if defined(__MPI)
INTEGER :: m1, m2, mc
!
#endif
......@@ -280,7 +280,7 @@ CONTAINS
j = mill_g(2, ng)
k = mill_g(3, ng)
#ifdef __MPI
#if defined(__MPI)
m1 = MOD (i, fc%dfftt%nr1) + 1
IF (m1 < 1) m1 = m1 + fc%dfftt%nr1
m2 = MOD (j, fc%dfftt%nr2) + 1
......@@ -490,7 +490,7 @@ CONTAINS
COMPLEX(kind=DP), ALLOCATABLE :: pw1_tmp(:),pw2_tmp(:), pw_global(:)
#ifdef __MPI
#if defined(__MPI)
gid=comm
......
......@@ -12,14 +12,14 @@ subroutine slater (rs, ex, vx)
! Slater exchange with alpha=2/3
!
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
implicit none
real(dp), intent(in) :: rs
real(dp), intent(out):: ex, vx
#ifdef __LIBXC
#if defined(__LIBXC)
real(dp):: rho
real(dp), parameter :: pi34 = 0.6203504908994d0 ! pi34=(3/4pi)^(1/3)
integer :: func_id = 1 ! Slater Exchange
......@@ -146,7 +146,7 @@ subroutine pz (rs, iflag, ec, vc)
! iflag=2: G. Ortiz and P. Ballone, PRB 50, 1391 (1994)
!
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
......@@ -154,7 +154,7 @@ subroutine pz (rs, iflag, ec, vc)
real(dp), intent(in) :: rs
real(dp), intent(out):: ec, vc
integer, intent(in) :: iflag
#ifdef __LIBXC
#if defined(__LIBXC)
real(dp):: rho
real(dp), parameter :: pi34 = 0.6203504908994d0 ! pi34=(3/4pi)^(1/3)
integer :: func_id = 9 ! Perdew & Zunger
......@@ -382,7 +382,7 @@ subroutine pw (rs, iflag, ec, vc)
! iflag=2: G. Ortiz and P. Ballone, PRB 50, 1391 (1994)
!
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
......@@ -390,7 +390,7 @@ subroutine pw (rs, iflag, ec, vc)
real(dp), intent(in) :: rs
real(dp), intent(out):: ec, vc
integer, intent(in) :: iflag
#ifdef __LIBXC
#if defined(__LIBXC)
real(dp):: rho
real(dp), parameter :: pi34 = 0.6203504908994d0 ! pi34=(3/4pi)^(1/3)
integer :: func_id = 12 ! Perdew & Zunger
......@@ -1015,7 +1015,7 @@ subroutine pbex (rho, grho, iflag, sx, v1x, v2x)
!
USE kinds, ONLY : DP
USE constants, ONLY : pi
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
......@@ -1025,7 +1025,7 @@ subroutine pbex (rho, grho, iflag, sx, v1x, v2x)
real(dp), intent(out):: sx, v1x, v2x
! output: energy, potential
integer, intent(in) :: iflag
#ifdef __LIBXC
#if defined(__LIBXC)
! local variables
integer :: func_id = -1 ! not set
integer :: size = 1
......@@ -1230,7 +1230,7 @@ subroutine pbec (rho, grho, iflag, sc, v1c, v2c)
! iflag=3: L. Chiodo et al, PRL 108, 126402 (2012) (PBEQ2D)
!
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
......@@ -1238,7 +1238,7 @@ subroutine pbec (rho, grho, iflag, sc, v1c, v2c)
integer, intent(in) :: iflag
real(DP), intent(in) :: rho, grho
real(DP), intent(out):: sc, v1c, v2c
#ifdef __LIBXC
#if defined(__LIBXC)
! local variables
integer :: func_id = -1 ! not set
integer :: size = 1
......
......@@ -4,7 +4,7 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
#ifdef __HDF5
#if defined(__HDF5)
module hdf5_qe
!
USE HDF5
......
......@@ -133,7 +133,7 @@ MODULE io_base
END IF
!
IF ( ionode_in_group ) &
#ifdef __HDF5
#if defined(__HDF5)
CALL write_evc(evc_hdf5_write,j, wtmp(1:npol*igwx), ik)
#else
CALL iotk_write_dat &
......
......@@ -33,7 +33,7 @@ MODULE io_files
CHARACTER(len=256) :: qexml_version = ' ' ! the format of the current qexml datafile
LOGICAL :: qexml_version_init = .FALSE. ! whether the fmt has been read or not
!
#ifdef __XSD
#if defined(__XSD)
CHARACTER(LEN=256) :: qexsd_fmt = ' ', qexsd_version = ' '
LOGICAL :: qexsd_init = .FALSE.
#endif
......@@ -45,7 +45,7 @@ MODULE io_files
!
CHARACTER (LEN=13), PARAMETER :: xmlpun = 'data-file.xml'
!
#ifdef __XSD
#if defined(__XSD)
CHARACTER (LEN=20), PARAMETER :: xmlpun_schema = 'data-file-schema.xml'
#endif
!
......
......@@ -36,14 +36,14 @@ subroutine tpsscxc( rho, grho, tau, sx, sc, v1x, v2x, v3x, v1c, v2c, v3c )
! v3x= D(E_x)/D(tau)
!
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
implicit none
real(DP), intent(in) :: rho, grho, tau
real(dp), intent(out):: sx, sc, v1x, v2x, v3x, v1c, v2c, v3c
#ifdef __LIBXC
#if defined(__LIBXC)
TYPE(xc_f90_pointer_t) :: xc_func
TYPE(xc_f90_pointer_t) :: xc_info
integer :: size = 1
......@@ -1392,14 +1392,14 @@ end subroutine gvt4
subroutine tb09cxc(rho, grho, tau, sx, sc, v1x, v2x,v3x,v1c, v2c,v3c)
USE kinds, ONLY : DP
#ifdef __LIBXC
#if defined(__LIBXC)
use xc_f90_types_m
use xc_f90_lib_m
#endif
implicit none
real(DP), intent(in) :: rho, grho, tau
real(dp), intent(out):: sx, sc, v1x, v2x, v3x, v1c, v2c, v3c
#ifdef __LIBXC
#if defined(__LIBXC)
TYPE(xc_f90_pointer_t) :: xc_func
TYPE(xc_f90_pointer_t) :: xc_info
integer :: size = 1
......
......@@ -163,7 +163,7 @@
IMPLICIT NONE
INTEGER :: ierr
INTEGER, INTENT(IN):: errorcode, gid
#ifdef __MPI
#if defined(__MPI)
CALL mpi_abort(gid, errorcode, ierr)
#endif
END SUBROUTINE mp_abort
......
......@@ -518,7 +518,7 @@ SUBROUTINE redistwf( c_dist_pw, c_dist_st, npw_p, nst_p, comm, idir )
INTEGER, ALLOCATABLE :: sendcount(:), sdispls(:)
COMPLEX(DP), ALLOCATABLE :: ctmp( : )
#ifdef __MPI
#if defined(__MPI)
CALL mpi_comm_rank( comm, mpime, ierr )
IF( ierr /= 0 ) CALL errore( ' wf_redist ', ' mpi_comm_rank ', ierr )
CALL mpi_comm_size( comm, nproc, ierr )
......@@ -632,7 +632,7 @@ SUBROUTINE redistwfr( c_dist_pw, c_dist_st, npw_p, nst_p, comm, idir )
INTEGER, ALLOCATABLE :: sendcount(:), sdispls(:)
REAL(DP), ALLOCATABLE :: ctmp( : )
#ifdef __MPI
#if defined(__MPI)
CALL mpi_comm_rank( comm, mpime, ierr )
IF( ierr /= 0 ) CALL errore( ' wf_redist ', ' mpi_comm_rank ', ierr )
CALL mpi_comm_size( comm, nproc, ierr )
......
......@@ -31,7 +31,7 @@ SUBROUTINE pw_dot(sum_over_nodes,n,m,a,lda,b,ldb,c)
c(i) = 2.d0*ddot(2*n,a(1,i),1,b(1,i),1)
IF (gstart==2) c(i) = c(i) - dble(a(1,i))*dble(b(1,i))
ENDDO
#ifdef __MPI
#if defined(__MPI)
IF (sum_over_nodes=='y'.or.sum_over_nodes=='Y') CALL mp_sum( c, intra_pool_comm )
#endif
RETURN
......
......@@ -4,7 +4,7 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
#ifdef __XSD
#if defined(__XSD)
!----------------------------------------------------------------------------
MODULE qexsd_module
!----------------------------------------------------------------------------
......
......@@ -5,7 +5,7 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
#ifdef __XSD
#if defined(__XSD)
!---------------------------------------------------------
MODULE qexsd_input
!--------------------------------------------------------
......
......@@ -11,7 +11,7 @@
! This module should be, in the future, replaced by a script generated library.
!
! Written by Pietro Delugas -- May-June 2016.
#ifdef __XSD
#if defined(__XSD)
!--------------------------------------------------------------------------------------
MODULE qexsd_reader_module
!--------------------------------------------------------------------------------------
......
......@@ -40,7 +40,7 @@ END INTERFACE
CONTAINS
#ifdef __TRAP_SIGUSR1
#if defined(__TRAP_SIGUSR1)
SUBROUTINE set_signal_USR1(routine)
USE iso_c_binding
TYPE(C_FUNPTR),TARGET::ptr
......@@ -61,7 +61,7 @@ SUBROUTINE set_signal_USR1(routine)
END SUBROUTINE set_signal_USR1
#endif
#ifdef __TERMINATE_GRACEFULLY
#if defined(__TERMINATE_GRACEFULLY)
SUBROUTINE set_TERMINATE_GRACEFULLY(routine)
USE iso_c_binding
TYPE(C_FUNPTR),TARGET::ptr
......@@ -106,7 +106,7 @@ END SUBROUTINE set_signal_action
! Only the master will use the signal, though
SUBROUTINE custom_handler(signum) BIND(c)
USE iso_c_binding
#ifdef __MPI
#if defined(__MPI)
USE mp_world, ONLY : world_comm
USE mp, ONLY : mp_abort
#endif
......@@ -116,7 +116,7 @@ SUBROUTINE custom_handler(signum) BIND(c)
! send SIGTERM to every process when SIGINT (aka CTRL-C) is received
IF(signal_trapped.and.signum==SIGINT) THEN
WRITE(stdout, '(/,5x,a)') "**** SIGNAL ALREADY TRAPPED: terminating immediately!!", signum
#ifdef __MPI
#if defined(__MPI)
CALL mp_abort(signum, world_comm)
#else
STOP 1
......@@ -137,11 +137,11 @@ END SUBROUTINE custom_handler
! use the result (required since the default action for SIGUSR1 is exit)
SUBROUTINE signal_trap_init
USE iso_c_binding
#ifdef __TRAP_SIGUSR1
#if defined(__TRAP_SIGUSR1)
WRITE(stdout, FMT='(5x,a)') "signal trapping enabled: kill the code with -SIGUSR1 to stop cleanly the simulation "
CALL set_signal_USR1(custom_handler)
#endif
#ifdef __TERMINATE_GRACEFULLY
#if defined(__TERMINATE_GRACEFULLY)
WRITE(stdout, FMT='(/,5x,a)') "Signal trapping enabled: code will terminate cleanly with SIGINT, SIGTERM, SIGUSR1, SIGUSR2, SIGXCPU"
WRITE(stdout, FMT='(5x,a)') "Type CTRL-C twice to terminate immediately (no restart possible!)"
CALL set_TERMINATE_GRACEFULLY(custom_handler)
......
......@@ -988,7 +988,7 @@ PRIVATE :: GetVdWParam
ALLOCATE(rhotot(nr1*nr2*nr3)); rhotot=0.0_DP
nspin = SIZE(rhor,2)
IF ( nspin < 1 .OR. nspin > 2 ) CALL errore ('tsvdw','invalid nspin',1)
#ifdef __MPI
#if defined(__MPI)
!
! Initialization of rhor_tmp temporary buffers...
!
......
......@@ -1750,7 +1750,7 @@ CONTAINS
end do
#ifdef __MPI
#if defined(__MPI)
call mp_sum( sigma, intra_bgrp_comm )
#endif
......@@ -1835,7 +1835,7 @@ CONTAINS
enddo
#ifdef __MPI
#if defined(__MPI)
call mp_sum( sigma, intra_bgrp_comm )
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment