Merge branch 'develop' of https://gitlab.com/QEF/q-e into us_acc

This commit is contained in:
Paolo Giannozzi 2021-10-19 10:00:25 +02:00
commit 092bf5c2c5
67 changed files with 7517 additions and 7848 deletions

View File

@ -911,7 +911,7 @@ input_description -distribution {Quantum Espresso} -package CP -program cp.x {
var ortho_max -type INTEGER {
default { 20 }
default {300 }
info {
maximum number of iterations for orthonormalization
meaningful only if orthogonalization = 'ortho'

View File

@ -4,6 +4,7 @@ New in development version:
* projwfc.x can be used to compute the PDOS in a local basis (I. Timrov)
Fixed in development version:
* Possible out-of-bound error (gfortran only) could crash DFT+U
* incorrect exx factor multiplication in the gga term of polarized cx0
functional (v.6.8 only)
* Some build problems occurring under special circumstances

View File

@ -577,15 +577,17 @@ supported since v.5.0; IBM machines with AIX are no longer supported
since v.6.0; all architectures marked with a * are to be considered
obsolescent or obsolete.
Finally, \configure\ recognizes the following command-line options:\\
Finally, \configure\ recognizes the following command-line options.
Not all of them are implemented for all compilers, though. Default value
is between bracket:\\
\begin{tabular}{ll}
\texttt{--enable-parallel}& compile for parallel (MPI) execution if possible (default: yes)\\
\texttt{--enable-openmp}& compile for OpenMP execution if possible (default: no)\\
\texttt{--enable-shared}& use shared libraries if available (default: yes;\\
& "no" is implemented, untested, in only a few cases)\\
\texttt{--enable-debug}& compile with debug flags (only for some compilers; default: no)\\
\texttt{--enable-pedantic}& compile with pedantic flags (only for gfortran; default: no)\\
\texttt{--enable-signals}& enable signal trapping (default: disabled)\\
\texttt{--enable-parallel}& compile for parallel (MPI) execution if possible (yes)\\
\texttt{--enable-openmp}& compile for OpenMP execution if possible (no)\\
\texttt{--enable-static}& produce static executables, arger but more portable (no)\\
\texttt{--enable-shared}& produce objects that are suitable for shared libraries (no)\\
\texttt{--enable-debug}& compile with debug flags (no)\\
\texttt{--enable-pedantic}& compile with gfortran pedantic flags on (no)\\
\texttt{--enable-signals}& enable signal trapping (no)\\
\end{tabular}\\
\\
and the following optional packages:\\
@ -593,24 +595,22 @@ and the following optional packages:\\
\texttt{--with-scalapack}& (yes$|$no$|$intel) Use scalapack if available. \\
&Set to \texttt{intel} to use Intel MPI and BLACS (default: use OpenMPI)\\
\texttt{--with-elpa-include}& Specify full path of ELPA include and modules
headers (default: no)\\
\texttt{--with-elpa-lib}& Specify full path of the ELPA library
(default: no)\\
\texttt{--with-elpa-version}& Specify ELPA API version (2015 for ELPA releases 2015.x\\
headers (no)\\
\texttt{--with-elpa-lib}& Specify full path of the ELPA library (no)\\
\texttt{--with-elpa-version}& Specify ELPA API version: 2015 for ELPA releases 2015.x\\
& and 2016.05; 2016 for ELPA releases 2016.11, 2017.x and\\
& 2018.05; default 2018 for ELPA releases 2018.11 and beyond)\\
& 2018.05; 2018 for ELPA releases 2018.11 and beyond (2018)\\
\texttt{--with-hdf5}& (no $|$ yes $|$ \texttt{<path>}) \\
& Compile HDF5 support (default: no). If ``yes'', configure assumes a \\
& Compile HDF5 support (no). If ``yes'', configure assumes a \\
& valid v. $>=1.8.16$ HDF5 installation with h5cc and h5fc in the \\
& default executable search path. If \texttt{<path>} is specified, it must be the \\
& root folder of a standalone hdf5 installation. \\
\texttt{--with-hdf5-libs} & Specify the link options and libraries needed to link HDF5, if configure \\
& fails to detect them. These options are usually composed by many \\
& substrings and must be enclosed into quotes. (default: none specified) \\
& substrings and must be enclosed into quotes. \\
\texttt{--with-hdf5-include}& Specify full path the HDF5 include folder containing module and \\
& headers files. Use it if configure fails to find the include folder. \\
& (default: no)\\
\texttt{--with-libxc} & Enable support for the \libxc\ library (default:no) \\
\texttt{--with-libxc} & Enable support for the \libxc\ library (no) \\
\texttt{--with-libxc-prefix} & directory where \libxc\ is installed \\
\texttt{--with-libxc-include}& directory where \libxc\ Fortran headers reside\\
\end{tabular}\\
@ -865,13 +865,8 @@ A few \libxc\ functional routines provides the energy and some others the potent
%
\subsubsection{XC test}
\label{SubSec:XCtest}
A testing program, \texttt{xclib\_test.x}, for the \texttt{XClib} library of \qe\ is available. Three options:
\begin{itemize}
\item \texttt{dft-info}: infos on the input dft are provided. If the functionals are from \libxc\ the external parameters, when present, are listed with a brief description and their default value.
\item \texttt{exe-benchmark} (\texttt{gen-benchmark}): the program gets a data file generated previously as input (by running the same program with the \texttt{gen-benchmark} option) and compares the output data, namely energy and potential on a selected number of grid points. It also compares total energy and potential summed up on a large grid in order to better span the input domain. This option shoud be used to test modifications in the \texttt{XClib} library or to check the output matching among different parallelization schemes.
\item \texttt{dft-comparison}: comparison between two different dfts on a large grid of points. Max, min and average percentage difference between the two dft outputs (energy and potential) are provided and the points of the grid where the two output differ are shown. This option can be used, for example, to find differences between internal \qe\ functionals and the \libxc\ ones.
\end{itemize}
The testing program is available for LDA, GGA and MGGA functionals. It also tests the potential derivatives for LDA (\texttt{dmxc}) and GGA (\texttt{dgcxc}).
A testing program, \texttt{xclib\_test.x}, for the \texttt{XClib} library of \qe\ is available. The program is available for LDA, GGA and MGGA functionals (both QE and Libxc). It also tests the potential derivatives for LDA (\texttt{dmxc}) and GGA (\texttt{dgcxc}).\\
See XClib/README.TEST file for further details.
\subsection{Compilation}
\label{SubSec:Compilation}

View File

@ -54,7 +54,7 @@ easy_gw.o
QEMODS = $(BASEMODS)
PWOBJS = ../../PW/src/libpw.a ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a
PHOBJS = ../../PHonon/Gamma/libphcg.a
PHOBJS = ../../PHonon/Gamma/libphcg.a ../../LR_Modules/liblrmod.a
TLDEPS= phlibs
@ -62,7 +62,7 @@ all : tldeps pw4gww.x
pw4gww.x : pw4gww.o libpw4gww.a $(PW4GWWOBJS) $(PWOBJS) $(QEMODS)
$(LD) $(LDFLAGS) -o $@ \
pw4gww.o libpw4gww.a $(PWOBJS) $(PHOBJS) $(QEMODS) $(QELIBS)
pw4gww.o libpw4gww.a $(PHOBJS) $(PWOBJS) $(QEMODS) $(QELIBS)
- ( cd ../../bin ; ln -fs ../GWW/pw4gww/$@ . )
tldeps :

View File

@ -19,7 +19,6 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
USE util_param, ONLY : DP, eps16
USE mp, ONLY : mp_sum, mp_max, mp_bcast
USE mp_bands_util, ONLY : gstart, inter_bgrp_comm, intra_bgrp_comm, my_bgrp_id
USE device_fbuff_m, ONLY : buffer => dev_buf
USE device_memcpy_m, ONLY : dev_memcpy, dev_memset
!
IMPLICIT NONE
@ -27,9 +26,9 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
! ... I/O variables
!
INTEGER, INTENT(IN) :: npw, npwx, nbnd
! COMPLEX(DP), INTENT(INOUT) :: psi (npwx,nbnd)
! COMPLEX(DP), INTENT(INOUT) :: hpsi(npwx,nbnd)
! COMPLEX(DP), INTENT(INOUT) :: spsi(npwx,nbnd)
COMPLEX(DP), INTENT(INOUT) :: psi_d (npwx,nbnd)
COMPLEX(DP), INTENT(INOUT) :: hpsi_d(npwx,nbnd)
COMPLEX(DP), INTENT(INOUT) :: spsi_d(npwx,nbnd)
REAL(DP), INTENT(OUT) :: e(nbnd)
LOGICAL, INTENT(IN) :: uspp
LOGICAL, INTENT(IN) :: eigen
@ -51,17 +50,16 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
! ... device variables
!
INTEGER :: ii, buf_start, buf_end, buf_size, info
COMPLEX(DP) :: psi_d (npwx,nbnd)
COMPLEX(DP) :: hpsi_d(npwx,nbnd)
COMPLEX(DP) :: spsi_d(npwx,nbnd)
COMPLEX(DP), ALLOCATABLE :: phi_d(:,:), hphi_d(:,:), sphi_d(:,:)
COMPLEX(DP),ALLOCATABLE :: phi_d (:,:)
COMPLEX(DP),ALLOCATABLE :: hphi_d(:,:)
COMPLEX(DP),ALLOCATABLE :: sphi_d(:,:)
!
#if defined (__CUDA)
attributes(device) :: psi_d, hpsi_d, spsi_d
attributes(device) :: phi_d, hphi_d, sphi_d
#endif
!
COMPLEX(DP), POINTER :: sr_d(:), sr2_d(:,:)
COMPLEX(DP), ALLOCATABLE :: sr_d(:), sr2_d(:,:)
#if defined (__CUDA)
attributes(device) :: sr_d, sr2_d
#endif
@ -103,8 +101,9 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
IF ( uspp ) sphi_d = ZERO
!
!
! ... Set owers of blocks
! ... Set owners of blocks
!
ALLOCATE( owner_bgrp_id(nblock))
owner_bgrp_id = 0
!
DO iblock = 1, nblock
@ -121,8 +120,8 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
!
IF ( gstart == 2 ) THEN
!$cuf kernel do(1)
DO ii =1,1
psi_d(1,1:nbnd) = CMPLX( DBLE( psi_d(1,1:nbnd) ), 0._DP, kind=DP )
DO ii =1,nbnd
psi_d(1,ii) = CMPLX( DBLE( psi_d(1,ii) ), 0._DP, kind=DP )
END DO
END IF
!
@ -134,8 +133,8 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
!
IF ( gstart == 2 ) THEN
!$cuf kernel do(1)
DO ii =1,1
phi_d(1,1:nbnd) = CMPLX( DBLE( phi_d(1,1:nbnd) ), 0._DP, kind=DP )
DO ii =1,nbnd
phi_d(1,ii) = CMPLX( DBLE( phi_d(1,ii) ), 0._DP, kind=DP )
END DO
END IF
!
@ -147,8 +146,8 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
! NOTE: set Im[ H*phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN
!$cuf kernel do(1)
DO ii =1,1
hphi_d(1,1:nbnd) = CMPLX( DBLE( hphi_d(1,1:nbnd) ), 0._DP, kind=DP )
DO ii =1,nbnd
hphi_d(1,ii) = CMPLX( DBLE( hphi_d(1,ii) ), 0._DP, kind=DP )
END DO
END IF
!
@ -161,21 +160,18 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
! NOTE: set Im[ S*phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN
!$cuf kernel do(1)
DO ii =1,1
sphi_d(1,1:nbnd) = CMPLX( DBLE( sphi_d(1,1:nbnd) ), 0._DP, kind=DP )
DO ii =1,nbnd
sphi_d(1,ii) = CMPLX( DBLE( sphi_d(1,ii) ), 0._DP, kind=DP )
END DO
END IF
!
END IF
!
! ... Buffer lock
! ... Buffer allocation
!
buf_start = ( nblock - 1 ) * nbsize + 1
buf_end = nbnd
buf_size = buf_start - buf_end
!
CALL buffer%lock_buffer( sr_d, buf_size, info)
CALL buffer%lock_buffer( sr2_d, (/buf_size, buf_size/), info)
ALLOCATE( sr_d(nbsize))
ALLOCATE( sr2_d(nbsize, nbnd - nbsize))
!
! ... Blocking loop
!
@ -214,8 +210,7 @@ SUBROUTINE gram_schmidt_gamma_gpu( npwx, npw, nbnd, psi_d, hpsi_d, spsi_d, e, &
!
! ... Buffer Realese
!
CALL buffer%release_buffer(sr_d, info)
CALL buffer%release_buffer(sr2_d, info)
DEALLOCATE (sr_d, sr2_d)
!
!
! ... Copy psi <- phi
@ -263,7 +258,7 @@ CONTAINS
INTEGER :: ibnd
REAL(DP) :: norm
REAL(DP) :: psi_ibnd
REAL(DP), EXTERNAL :: gpu_DDOT
REAL(DP), EXTERNAL :: gpu_DDOT
!
DO ibnd = ibnd_start, ibnd_end
!
@ -306,8 +301,8 @@ CONTAINS
! NOTE: set Im[ phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN
!$cuf kernel do(1)
DO ii=1,1
phi_d(1,ibnd) = CMPLX( DBLE( phi_d(1,ibnd) ), 0._DP, kind=DP )
DO ii=1,1
phi_d(1,ibnd) = CMPLX( DBLE( phi_d(1,ibnd) ), 0._DP, kind=DP )
END DO
END IF
!
@ -440,20 +435,20 @@ CONTAINS
IF ( uspp ) THEN
!
CALL gpu_DGEMM( 'T', 'N', ibnd_size, jbnd_size, npw2, 2._DP, phi_d(1,ibnd_start), npwx2, &
spsi_d(1,jbnd_start), npwx2, 0._DP, sr2_d(1,1), ibnd_size )
spsi_d(1,jbnd_start), npwx2, 0._DP, sr2_d(1,1), nbsize )
!
IF ( gstart == 2 ) &
CALL gpu_DGER( ibnd_size, jbnd_size, -1._DP, psi_d(1,ibnd_start), npwx2, &
spsi_d(1,jbnd_start), npwx2, sr2_d(1,1), ibnd_size )
spsi_d(1,jbnd_start), npwx2, sr2_d(1,1), nbsize )
!
ELSE
!
CALL gpu_DGEMM( 'T', 'N', ibnd_size, jbnd_size, npw2, 2._DP, phi_d(1,ibnd_start), npwx2, &
psi_d(1,jbnd_start), npwx2, 0._DP, sr2_d(1,1), ibnd_size )
psi_d(1,jbnd_start), npwx2, 0._DP, sr2_d(1,1), nbsize )
!
IF ( gstart == 2 ) &
CALL gpu_DGER( ibnd_size, jbnd_size, -1._DP, psi_d(1,ibnd_start), npwx2, &
psi_d(1,jbnd_start), npwx2, sr2_d(1,1), ibnd_size )
psi_d(1,jbnd_start), npwx2, sr2_d(1,1), nbsize )
!
END IF
!
@ -462,7 +457,7 @@ CONTAINS
! ... phi_j = phi_j - phi_i * <phi_i| S |psi_j>
!
CALL gpu_DGEMM( 'N', 'N', npw2, jbnd_size, ibnd_size, -1._DP, phi_d(1,ibnd_start), npwx2, &
sr2_d(1,1), ibnd_size, 1._DP, phi_d(1,jbnd_start), npwx2 )
sr2_d(1,1), nbsize, 1._DP, phi_d(1,jbnd_start), npwx2 )
!
! NOTE: set Im[ phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN
@ -476,7 +471,7 @@ CONTAINS
IF ( eigen_ ) THEN
!
CALL gpu_DGEMM( 'N', 'N', npw2, jbnd_size, ibnd_size, -1._DP, hphi_d(1,ibnd_start), npwx2, &
sr2_d(1,1), ibnd_size, 1._DP, hphi_d(1,jbnd_start), npwx2 )
sr2_d(1,1), nbsize, 1._DP, hphi_d(1,jbnd_start), npwx2 )
!
! NOTE: set Im[ H*phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN
@ -492,7 +487,7 @@ CONTAINS
IF ( uspp ) THEN
!
CALL gpu_DGEMM( 'N', 'N', npw2, jbnd_size, ibnd_size, -1._DP, sphi_d(1,ibnd_start), npwx2, &
sr2_d(1,1), ibnd_size, 1._DP, sphi_d(1,jbnd_start), npwx2 )
sr2_d(1,1), nbsize, 1._DP, sphi_d(1,jbnd_start), npwx2 )
!
! NOTE: set Im[ S*phi(G=0) ] - needed for numerical stability
IF ( gstart == 2 ) THEN

View File

@ -59,7 +59,7 @@ SUBROUTINE gram_schmidt_k_gpu( npwx, npw, nbnd, npol, psi_d, hpsi_d, spsi_d, e,
attributes(device) :: phi_d, hphi_d, sphi_d
#endif
!
COMPLEX(DP), POINTER :: sc_d(:), sc2_d(:,:)
COMPLEX(DP), ALLOCATABLE :: sc_d(:), sc2_d(:,:)
#if defined (__CUDA)
attributes(device) :: sc_d, sc2_d
#endif
@ -151,14 +151,9 @@ SUBROUTINE gram_schmidt_k_gpu( npwx, npw, nbnd, npol, psi_d, hpsi_d, spsi_d, e,
CALL ZCOPY_gpu( kdmx * nbnd, spsi_d(1,1), 1, sphi_d(1,1), 1 )
!
!
! ... Buffer lock
! ... Allocate buffers
!
buf_start = ( nblock - 1 ) * nbsize + 1
buf_end = nbnd
buf_size = buf_start - buf_end
CALL buffer%lock_buffer( sc_d, buf_size, info)
!
CALL buffer%lock_buffer( sc2_d, (/buf_size, buf_size/), info)
ALLOCATE (sc_d(nbsize), sc2_d(nbsize, nbnd - nbsize))
!
!
! ... Blocking loop
@ -171,9 +166,7 @@ SUBROUTINE gram_schmidt_k_gpu( npwx, npw, nbnd, npol, psi_d, hpsi_d, spsi_d, e,
ibnd_end = MIN( iblock * nbsize, nbnd )
!
IF ( owner_bgrp_id(iblock) == my_bgrp_id ) &
!
!
CALL gram_schmidt_diag( ibnd_start, ibnd_end )
CALL gram_schmidt_diag( ibnd_start, ibnd_end )
!
!
! ... Bcast diagonal block
@ -204,8 +197,7 @@ SUBROUTINE gram_schmidt_k_gpu( npwx, npw, nbnd, npol, psi_d, hpsi_d, spsi_d, e,
!
! ... Buffer Realese
!
CALL buffer%release_buffer(sc_d, info)
CALL buffer%release_buffer(sc2_d, info)
DEALLOCATE (sc_d, sc2_d)
!
!
! ... Copy psi <- phi
@ -329,22 +321,22 @@ CONTAINS
INTEGER, INTENT(IN) :: jbnd_start, jbnd_end
!
INTEGER :: ibnd_size
INTEGER :: jbnd_size
INTEGER :: jbnd_size
!
ibnd_size = ibnd_end - ibnd_start + 1
jbnd_size = jbnd_end - jbnd_start + 1
jbnd_size = jbnd_end - jbnd_start + 1
!
! ... <phi_i| S |psi_j>
!
IF ( uspp ) THEN
!
CALL gpu_ZGEMM( 'C', 'N', ibnd_size, jbnd_size, kdim, ONE, phi_d(1,ibnd_start), kdmx, &
spsi_d(1,jbnd_start), kdmx, ZERO, sc2_d(1,1), ibnd_size )
spsi_d(1,jbnd_start), kdmx, ZERO, sc2_d(1,1), nbsize )
!
ELSE
!
CALL gpu_ZGEMM( 'C', 'N', ibnd_size, jbnd_size, kdim, ONE, phi_d(1,ibnd_start), kdmx, &
psi_d(1,jbnd_start), kdmx, ZERO, sc2_d(1,1), ibnd_size )
psi_d(1,jbnd_start), kdmx, ZERO, sc2_d(1,1), nbsize )
!
END IF
!
@ -353,15 +345,15 @@ CONTAINS
! ... phi_j = phi_j - phi_i * <phi_i| S |psi_j>
!
CALL gpu_ZGEMM( 'N', 'N', kdim, jbnd_size, ibnd_size, MONE, phi_d(1,ibnd_start), kdmx, &
sc2_d(1,1), ibnd_size, ONE, phi_d(1,jbnd_start), kdmx )
sc2_d(1,1), nbsize, ONE, phi_d(1,jbnd_start), kdmx )
!
IF ( eigen_ ) &
CALL gpu_ZGEMM( 'N', 'N', kdim, jbnd_size, ibnd_size, MONE, hphi_d(1,ibnd_start), kdmx, &
sc2_d(1,1), ibnd_size, ONE, hphi_d(1,jbnd_start), kdmx )
sc2_d(1,1), nbsize, ONE, hphi_d(1,jbnd_start), kdmx )
!
IF ( uspp ) &
CALL gpu_ZGEMM( 'N', 'N', kdim, jbnd_size, ibnd_size, MONE, sphi_d(1,ibnd_start), kdmx, &
sc2_d(1,1), ibnd_size, ONE, sphi_d(1,jbnd_start), kdmx )
sc2_d(1,1), nbsize, ONE, sphi_d(1,jbnd_start), kdmx )
!
RETURN
!

View File

@ -4,10 +4,11 @@ program test_diaghg
#endif
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
root, world_comm
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -35,7 +36,6 @@ program test_diaghg
!
SUBROUTINE real_1(test)
USE LAXlib
USE la_param, ONLY : DP
implicit none
!
TYPE(tester_t) :: test
@ -54,7 +54,7 @@ program test_diaghg
!
v = 0.d0
e = 0.d0
CALL diaghg( 2, 2, h, s, 2, e, v, .false. )
CALL diaghg( 2, 2, h, s, 2, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
CALL test%assert_close( e, [1.d0, 1.d0] )
CALL test%assert_close( RESHAPE(v, [4]), [1.d0, 0.d0, 0.d0, 1.d0] )
@ -63,7 +63,7 @@ program test_diaghg
!
v = 0.d0
e = 0.d0
CALL diaghg( 2, 2, h, s, 2, e, v, .true. )
CALL diaghg( 2, 2, h, s, 2, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
CALL test%assert_close( e, [1.d0, 1.d0] )
CALL test%assert_close( RESHAPE(v, [4]), [1.d0, 0.d0, 0.d0, 1.d0] )
@ -74,7 +74,6 @@ program test_diaghg
!
SUBROUTINE complex_1(test)
USE LAXlib
USE la_param, ONLY : DP
implicit none
!
TYPE(tester_t) :: test
@ -100,7 +99,7 @@ program test_diaghg
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( 2, 2, h, s, 2, e, v, .false. )
CALL diaghg( 2, 2, h, s, 2, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
! 0.1715728752538099, 5.82842712474619
CALL test%assert_close( e, [0.1715728752538099d0, 5.82842712474619d0] )
CALL test%assert_close( v(:,1), [( 0.d0, -0.9238795325112867d0), (-0.3826834323650898d0, 0.d0)] )
@ -110,7 +109,7 @@ program test_diaghg
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( 2, 2, h, s, 2, e, v, .true. )
CALL diaghg( 2, 2, h, s, 2, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
CALL test%assert_close( e, [0.1715728752538099d0, 5.82842712474619d0] )
CALL test%assert_close( v(:,1), [( 0.d0, -0.9238795325112867d0), (-0.3826834323650898d0, 0.d0)] )

View File

@ -4,16 +4,17 @@ program test_diaghg_2
#endif
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
root, world_comm
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
!
CALL test%init()
!
#if defined(__MPI)
world_group = MPI_COMM_WORLD
#endif
@ -33,7 +34,6 @@ program test_diaghg_2
!
SUBROUTINE complex_1(test)
USE LAXlib
USE la_param, ONLY : DP
implicit none
!
TYPE(tester_t) :: test
@ -43,10 +43,11 @@ program test_diaghg_2
complex(DP) :: h_save(m_size,m_size)
complex(DP) :: s(m_size,m_size)
complex(DP) :: s_save(m_size,m_size)
real(DP) :: e(m_size)
real(DP) :: e(m_size)
complex(DP) :: v(m_size,m_size)
real(DP) :: e_save(m_size)
real(DP) :: e_save(m_size)
complex(DP) :: v_save(m_size,m_size)
integer :: j
!
CALL hermitian(m_size, h)
CALL hermitian(m_size, s)
@ -56,35 +57,39 @@ program test_diaghg_2
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( m_size, m_size, h, s, m_size, e, v, .false. )
CALL diaghg( m_size, m_size, h, s, m_size, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
CALL test%assert_close( RESHAPE(h, [m_size*m_size]), RESHAPE(h_save, [m_size*m_size]))
CALL test%assert_close( RESHAPE(s, [m_size*m_size]), RESHAPE(s_save, [m_size*m_size]))
DO j = 1, m_size
CALL test%assert_close( h(1:m_size, j), h_save(1:m_size, j))
CALL test%assert_close( s(1:m_size, j), s_save(1:m_size, j))
END DO
!
e_save = e
v_save = v
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( m_size, m_size, h, s, m_size, e, v, .true. )
CALL diaghg( m_size, m_size, h, s, m_size, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
CALL test%assert_close( RESHAPE(h, [m_size*m_size]), RESHAPE(h_save, [m_size*m_size]))
CALL test%assert_close( RESHAPE(s, [m_size*m_size]), RESHAPE(s_save, [m_size*m_size]))
test%tolerance32=1.d-5
DO j = 1, m_size
CALL test%assert_close( h(1:m_size, j), h_save(1:m_size, j))
CALL test%assert_close( s(1:m_size, j), s_save(1:m_size, j))
END DO
test%tolerance32=1.e-5
test%tolerance64=1.d-14
CALL test%assert_close( e, e_save)
!
END SUBROUTINE complex_1
!
SUBROUTINE hermitian(mSize, M)
USE la_param, ONLY : DP
IMPLICIT NONE
integer, intent(in) :: msize
complex(dp), intent(out) :: M(:,:)
integer, intent(in) :: mSize
complex(dp), intent(out) :: M(mSize,mSize)
!
real(dp), allocatable :: rnd(:)
complex(dp), allocatable :: tmp(:,:)
INTEGER :: h, k, j
!
ALLOCATE(rnd(mSize*(mSize+1)))

View File

@ -4,10 +4,11 @@ program test_diaghg_3
#endif
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
root, world_comm
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -37,7 +38,6 @@ program test_diaghg_3
SUBROUTINE real_1(test)
USE mp_world, ONLY : mpime
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -54,7 +54,7 @@ program test_diaghg_3
real(DP), allocatable :: v_save(:,:)
!
character(len=20) :: inputs(2)
integer :: i, j, info
integer :: i, info
!
inputs = ["ZnOG1.bin", "ZnOG2.bin"]
!
@ -77,13 +77,8 @@ program test_diaghg_3
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .false. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
test%tolerance64=1.d-6 ! check this
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
test%tolerance64=1.d-8 ! check this
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
@ -91,11 +86,8 @@ program test_diaghg_3
s = s_save
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .true. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m))
DEALLOCATE(h,s,e,v,h_save,s_save,e_save,v_save)
END DO
@ -105,7 +97,6 @@ program test_diaghg_3
SUBROUTINE complex_1(test)
USE mp_world, ONLY : mpime
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -122,7 +113,7 @@ program test_diaghg_3
complex(DP), allocatable :: v_save(:,:)
!
character(len=20) :: inputs(4)
integer :: i, j, info
integer :: i, info
!
inputs = ["ZnOK1.bin ", &
"ZnOK2.bin ", &
@ -148,11 +139,8 @@ program test_diaghg_3
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .false. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
@ -160,11 +148,8 @@ program test_diaghg_3
s = s_save
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .true. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m))
DEALLOCATE(h,s,e,v,h_save,s_save,e_save,v_save)
END DO

View File

@ -17,10 +17,12 @@ program test_diaghg_4
#endif
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
root, world_comm
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
INCLUDE 'laxlib_param.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -50,14 +52,14 @@ program test_diaghg_4
SUBROUTINE parallel_real_1(test)
USE mp_world, ONLY : mpime
USE LAXlib
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE la_param, ONLY : DP
USE laxlib_descriptor, ONLY : la_descriptor, descla_init, laxlib_desc_to_intarray
USE test_io
implicit none
!
TYPE(tester_t) :: test
!
TYPE(la_descriptor) :: desc
INTEGER :: idesc(LAX_DESC_SIZE)
integer :: ldh, n, m
real(DP), allocatable :: h(:,:), hdst(:,:) !< full and distributed Hpsi
real(DP), allocatable :: h_save(:,:) !< full Hpsi, used to check consistence across calls
@ -115,21 +117,23 @@ program test_diaghg_4
END DO
END IF
!
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, desc, .false. )
CALL laxlib_desc_to_intarray( idesc, desc )
!
DO j = 1, m
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, idesc, .false. )
!
! DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
! END DO
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
v = (0.d0, 0.d0)
e = 0.d0
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, desc, .true. )
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, idesc, .true. )
!
DO j = 1, m
! DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
! END DO
CALL test%assert_close( e(1:m), e_save(1:m))
!
DEALLOCATE(h,s,e,v,h_save,s_save,e_save,v_save, hdst, sdst, vdst)
@ -139,9 +143,8 @@ program test_diaghg_4
!
SUBROUTINE parallel_complex_1(test)
USE mp_world, ONLY : mpime
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE laxlib_descriptor, ONLY : la_descriptor, descla_init, laxlib_desc_to_intarray
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -157,6 +160,7 @@ program test_diaghg_4
real(DP), allocatable :: e_save(:) !< full set of eigenvalues, used for checks
complex(DP), allocatable :: v_save(:,:) !< full set of eigenvectors, used for checks
TYPE(la_descriptor) :: desc
INTEGER :: idesc(LAX_DESC_SIZE)
!
character(len=20) :: inputs(4)
integer :: l, i, j, ii, jj, info, nrdst
@ -208,7 +212,9 @@ program test_diaghg_4
END DO
END IF
!
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, desc, .false. )
CALL laxlib_desc_to_intarray( idesc, desc )
!
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, idesc, .false. )
!
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
@ -218,7 +224,7 @@ program test_diaghg_4
!
v = (0.d0, 0.d0)
e = 0.d0
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, desc, .true. )
CALL pdiaghg( n, hdst, sdst, nrdst, e, vdst, idesc, .true. )
!
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
@ -233,10 +239,9 @@ program test_diaghg_4
SUBROUTINE init_parallel_diag(desc, n)
USE mp_world, ONLY : mpime, nproc, world_comm
USE mp_diag, ONLY : ortho_parent_comm
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE laxlib_processors_grid, ONLY : ortho_parent_comm
USE laxlib_descriptor, ONLY : la_descriptor, descla_init
USE LAXlib
USE la_param, ONLY : DP
implicit none
!
TYPE(la_descriptor) :: desc

View File

@ -9,6 +9,7 @@ program test_diaghg_gpu
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -36,7 +37,6 @@ program test_diaghg_gpu
!
SUBROUTINE real_1(test)
USE LAXlib
USE la_param, ONLY : DP
USE cudafor
implicit none
!
@ -64,7 +64,7 @@ program test_diaghg_gpu
!
v_d = 0.d0
e_d = 0.d0
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, .false. )
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
v_h = v_d
e_h = e_d
h_h = h_d
@ -77,7 +77,7 @@ program test_diaghg_gpu
!
v_d = 0.d0
e_d = 0.d0
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, .true. )
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
v_h = v_d
e_h = e_d
h_h = h_d
@ -92,7 +92,6 @@ program test_diaghg_gpu
!
SUBROUTINE complex_1(test)
USE LAXlib
USE la_param, ONLY : DP
USE cudafor
implicit none
!
@ -135,7 +134,7 @@ program test_diaghg_gpu
e_h = 0.d0
v_d = v_h; e_d = e_h
!
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, .false. )
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
v_h = v_d
e_h = e_d
h_h = h_d
@ -155,7 +154,7 @@ program test_diaghg_gpu
h_d = h_h
s_d = s_h
v_d = v_h; e_d = e_h
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, .true. )
CALL diaghg( 2, 2, h_d, s_d, 2, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
v_h = v_d
e_h = e_d
h_h = h_d

View File

@ -9,6 +9,7 @@ program test_diaghg_gpu_2
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -34,7 +35,6 @@ program test_diaghg_gpu_2
!
SUBROUTINE complex_1(test)
USE LAXlib
USE la_param, ONLY : DP
USE cudafor
implicit none
!
@ -54,6 +54,7 @@ program test_diaghg_gpu_2
complex(DP), DEVICE :: v_d(m_size,m_size)
real(DP) :: e_save(m_size)
complex(DP) :: v_save(m_size,m_size)
integer :: j
!
CALL hermitian(m_size, h)
CALL hermitian(m_size, s)
@ -69,17 +70,20 @@ program test_diaghg_gpu_2
e_d = 0.d0
!
! 1. Compare same algorithm starting from data on device ...
CALL diaghg( m_size, m_size-1, h_d, s_d, m_size, e_d, v_d )
CALL diaghg( m_size, m_size, h_d, s_d, m_size, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm )
e_save = e_d
v_save = v_d
! 2. ... and on the host, this will trigger the same subroutine used above
CALL diaghg( m_size, m_size-1, h, s, m_size, e, v, .true. )
CALL diaghg( m_size, m_size, h, s, m_size, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true.)
!
CALL test%assert_close( RESHAPE(h, [m_size*m_size]), RESHAPE(h_save, [m_size*m_size]))
CALL test%assert_close( RESHAPE(s, [m_size*m_size]), RESHAPE(s_save, [m_size*m_size]))
DO j = 1, m_size
CALL test%assert_close( h(1:m_size, j), h_save(1:m_size, j))
CALL test%assert_close( s(1:m_size, j), s_save(1:m_size, j))
END DO
test%tolerance32=1.d-5
test%tolerance64=1.d-10
DO i=1, m_size-1
DO i=1, m_size
CALL test%assert_close( v(1:m_size,i), v_save(1:m_size,i))
CALL test%assert_close( e(i), e_save(i) )
END DO
@ -94,7 +98,7 @@ program test_diaghg_gpu_2
! note that it uses a different algorithm and produces slightly
! different eigenvectors.
!
CALL diaghg( m_size, m_size-1, h, s, m_size, e, v )
CALL diaghg( m_size, m_size, h, s, m_size, e, v, me_bgrp, root_bgrp, intra_bgrp_comm )
h = h_save; s = s_save
!
! Solve-again, with the same algorithm used in the GPU version.
@ -103,7 +107,7 @@ program test_diaghg_gpu_2
!
test%tolerance32=1.d-5
test%tolerance64=1.d-10
DO i=1, m_size-1
DO i=1, m_size
! compare eigenvectors obtained in 1. with LAPACK zhegvd
CALL test%assert_close( v_save(1:m_size,i), h(1:m_size,i) )
! compare eigenvalues obtained with zhegvd, 1. and 3.
@ -114,7 +118,6 @@ program test_diaghg_gpu_2
END SUBROUTINE complex_1
!
SUBROUTINE hermitian(mSize, M)
USE la_param, ONLY : DP
IMPLICIT NONE
integer, intent(in) :: msize
complex(dp), intent(out) :: M(:,:)

View File

@ -9,6 +9,7 @@ program test_diaghg_gpu_3
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -38,7 +39,6 @@ program test_diaghg_gpu_3
SUBROUTINE real_1(test)
USE mp_world, ONLY : mpime
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -86,19 +86,14 @@ program test_diaghg_gpu_3
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .false. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
test%tolerance64=1.d-6 ! <- check this
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
test%tolerance64=1.d-8 ! <- check this
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .true. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
ALLOCATE(v_dc, SOURCE=h_save)
ALLOCATE(e_dc(n))
@ -106,9 +101,6 @@ program test_diaghg_gpu_3
CALL solve_with_dsygvd(n, v_dc, s, ldh, e_dc)
s = s_save
!
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_dc(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m))
!
! GPU data & subroutines
@ -120,13 +112,10 @@ program test_diaghg_gpu_3
ALLOCATE(e_d, SOURCE=e); ALLOCATE(v_d, SOURCE=v)
ALLOCATE(h_d, SOURCE=h); ALLOCATE(s_d, SOURCE=s)
!
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, .false. )
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
v(1:n, 1:m) = v_d(1:n, 1:m)
e(1:m) = e_d(1:m)
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_dc(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
@ -136,17 +125,11 @@ program test_diaghg_gpu_3
h_d = h_save
!
! Start from data on the GPU and diagonalize on the CPU
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, .true. )
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
v(1:n, 1:m) = v_d(1:n, 1:m)
e(1:m) = e_d(1:m)
!
test%tolerance64=1.d-6 ! <- check this
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
test%tolerance64=1.d-8 ! <- check this
!
CALL test%assert_close( e(1:m), e_save(1:m))
!
DEALLOCATE(h_d, s_d, e_d, v_d)
@ -158,7 +141,6 @@ program test_diaghg_gpu_3
SUBROUTINE complex_1(test)
USE mp_world, ONLY : mpime
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -214,26 +196,20 @@ program test_diaghg_gpu_3
!
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .false. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .false. )
!
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_save(1:n, j) )
END DO
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
h = h_save; s = s_save;
v = (0.d0, 0.d0)
e = 0.d0
CALL diaghg( n, m, h, s, ldh, e, v, .true. )
CALL diaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, .true. )
!
! N.B.: GPU eigensolver uses a different algorithm: zhegvd
s = s_save; e_dc = 0.d0
CALL solve_with_zhegvd(n, v_dc, s, ldh, e_dc)
!
DO j = 1, m
CALL test%assert_close( v(1:n, j), v_dc(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m))
!
! GPU data & subroutines
@ -245,13 +221,10 @@ program test_diaghg_gpu_3
ALLOCATE(e_d, SOURCE=e); ALLOCATE(v_d, SOURCE=v)
ALLOCATE(h_d, SOURCE=h); ALLOCATE(s_d, SOURCE=s)
!
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, .false. )
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm )
!
v(1:n, 1:m) = v_d(1:n, 1:m)
e(1:m) = e_d(1:m)
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m) )
!
!
@ -259,14 +232,11 @@ program test_diaghg_gpu_3
e_d = 0.d0
s_d = s_save
h_d = h_save
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, .true. )
CALL diaghg( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm )
!
v(1:n, 1:m) = v_d(1:n, 1:m)
e(1:m) = e_d(1:m)
!
DO j = 1, m
!CALL test%assert_close( v(1:n, j), v_save(1:n, j))
END DO
CALL test%assert_close( e(1:m), e_save(1:m))
!
DEALLOCATE(h_d, s_d, e_d, v_d)

View File

@ -21,6 +21,8 @@ program test_diaghg_gpu_4
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
INCLUDE 'laxlib_param.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0
@ -51,14 +53,14 @@ program test_diaghg_gpu_4
USE cudafor
USE mp_world, ONLY : mpime
USE LAXlib
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE la_param, ONLY : DP
USE laxlib_descriptor, ONLY : la_descriptor, descla_init, laxlib_desc_to_intarray
USE test_io
implicit none
!
TYPE(tester_t) :: test
!
TYPE(la_descriptor) :: desc
INTEGER :: idesc(LAX_DESC_SIZE)
integer :: ldh, n, m
real(DP), allocatable :: h(:,:), hdst(:,:) !< full and distributed Hpsi
real(DP), allocatable, device :: hdst_d(:,:) !< distributed Hpsi on device
@ -128,7 +130,9 @@ program test_diaghg_gpu_4
e(1:n) = 0.d0
e_d(1:n) = 0.d0
!
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, desc, .false. )
CALL laxlib_desc_to_intarray( idesc, desc )
!
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, idesc, .false. )
!
e(1:n) = e_d
!
@ -141,7 +145,7 @@ program test_diaghg_gpu_4
e(1:n) = 0.d0
e_d(1:n) = 0.d0
!
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, desc, .true. )
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, idesc, .true. )
!
e(1:n) = e_d
!
@ -159,9 +163,8 @@ program test_diaghg_gpu_4
SUBROUTINE parallel_complex_1(test)
USE cudafor
USE mp_world, ONLY : mpime
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE laxlib_descriptor, ONLY : la_descriptor, descla_init, laxlib_desc_to_intarray
USE LAXlib
USE la_param, ONLY : DP
USE test_io
implicit none
!
@ -181,6 +184,7 @@ program test_diaghg_gpu_4
real(DP), allocatable :: e_save(:) !< full set of eigenvalues, used for checks
complex(DP), allocatable :: v_save(:,:) !< full set of eigenvectors, used for checks
TYPE(la_descriptor) :: desc
INTEGER :: idesc(LAX_DESC_SIZE)
!
character(len=20) :: inputs(4)
integer :: l, i, j, ii, jj, info, nrdst
@ -238,8 +242,10 @@ program test_diaghg_gpu_4
ALLOCATE(sdst_d, SOURCE=sdst)
ALLOCATE(vdst_d( nrdst , nrdst ), e_d(n))
!
CALL laxlib_desc_to_intarray( idesc, desc )
!
e_d(1:n) = 0.d0
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, desc, .false. )
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, idesc, .false. )
e = e_d
!
DO j = 1, m
@ -249,7 +255,7 @@ program test_diaghg_gpu_4
!
!
e_d(1:n) = 0.d0
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, desc, .true. )
CALL pdiaghg( n, hdst_d, sdst_d, nrdst, e_d, vdst_d, idesc, .true. )
!
e = e_d
DO j = 1, m
@ -266,10 +272,9 @@ program test_diaghg_gpu_4
SUBROUTINE init_parallel_diag(desc, n)
USE mp_world, ONLY : mpime, nproc, world_comm
USE mp_diag, ONLY : ortho_parent_comm
USE descriptors, ONLY : la_descriptor, descla_init, descla_local_dims
USE laxlib_processors_grid, ONLY : ortho_parent_comm
USE laxlib_descriptor, ONLY : la_descriptor, descla_init
USE LAXlib
USE la_param, ONLY : DP
implicit none
!
TYPE(la_descriptor) :: desc

View File

@ -1,7 +1,7 @@
!
SUBROUTINE solve_with_zhegvd(n, v, s, ldh, e)
USE la_param, ONLY : DP
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
complex(DP) :: v(ldh,n)
complex(DP) :: s(ldh,n)
@ -10,8 +10,7 @@ SUBROUTINE solve_with_zhegvd(n, v, s, ldh, e)
!
INTEGER :: lwork, lrwork, liwork, info, ldh
!
REAL(DP) :: abstol
INTEGER, ALLOCATABLE :: iwork(:), ifail(:)
INTEGER, ALLOCATABLE :: iwork(:)
REAL(DP), ALLOCATABLE :: rwork(:)
COMPLEX(DP), ALLOCATABLE :: work(:)
! various work space
@ -38,8 +37,8 @@ SUBROUTINE solve_with_zhegvd(n, v, s, ldh, e)
END SUBROUTINE solve_with_zhegvd
!
SUBROUTINE solve_with_dsygvd(n, v, s, ldh, e)
USE la_param, ONLY : DP
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
REAL(DP) :: v(ldh,n)
REAL(DP) :: s(ldh,n)
@ -48,8 +47,7 @@ SUBROUTINE solve_with_dsygvd(n, v, s, ldh, e)
!
INTEGER :: lwork, liwork, info, ldh
!
REAL(DP) :: abstol
INTEGER, ALLOCATABLE :: iwork(:), ifail(:)
INTEGER, ALLOCATABLE :: iwork(:)
REAL(DP), ALLOCATABLE :: work(:)
! various work space

View File

@ -1,6 +1,7 @@
MODULE test_io
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
INTERFACE read_problem
MODULE PROCEDURE read_cmplx_problem, read_real_problem
@ -9,7 +10,6 @@ MODULE test_io
CONTAINS
!
SUBROUTINE read_cmplx_problem(fname, ldh, n, m, h, s, e, v, info)
USE la_param, ONLY : DP
IMPLICIT NONE
character(len=*), intent(in) :: fname
integer, intent(out) :: ldh, n, m
@ -19,8 +19,7 @@ MODULE test_io
complex(dp), allocatable, intent(inout) :: v(:,:)
integer, intent(out) :: info
!
real(dp) :: aux1, aux2
integer :: i, j, t
integer :: t
logical :: exist
!
character(len=20):: fname_
@ -56,7 +55,6 @@ MODULE test_io
END SUBROUTINE read_cmplx_problem
!
SUBROUTINE read_real_problem(fname, ldh, n, m, h, s, e, v, info)
USE la_param, ONLY : DP
IMPLICIT NONE
character(len=*), intent(in) :: fname
integer, intent(out) :: ldh, n, m
@ -66,8 +64,7 @@ MODULE test_io
real(dp), allocatable, intent(inout) :: v(:,:)
integer, intent(out) :: info
!
real(dp) :: aux1, aux2
integer :: i, j, t
integer :: t
logical :: exist
!
character(len=20):: fname_

View File

@ -725,7 +725,7 @@ contains
this% n_tests = this% n_tests + 1
if ( abs(r1-r2) > this% tolerance64 ) then
if ( abs(r1-r2) > this% tolerance64 * abs(r2) ) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
@ -797,15 +797,15 @@ contains
end subroutine assert_close_c32
!> Check if two complex numbers (64 bits) are close with respect a tolerance.
subroutine assert_close_c64(this, r1, c2, fail)
subroutine assert_close_c64(this, c1, c2, fail)
class(tester_t), intent(inout) :: this !< The tester.
complex(real64), intent(in) :: r1 !< Value to compare.
complex(real64), intent(in) :: c1 !< Value to compare.
complex(real64), intent(in) :: c2 !< Value to compare.
logical, intent(in), optional :: fail !< Fail flag.
this% n_tests = this% n_tests + 1
if ( abs(r1-c2) > this% tolerance64 ) then
if ( abs(c1-c2) > this% tolerance64 * abs(real(c2)) ) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
@ -853,7 +853,7 @@ contains
if ( maxval(abs(c1-c2)) > this% tolerance64 ) then
if (.not. present(fail) .or. (present(fail) .and. fail .eqv. .false.)) then
this% n_errors = this% n_errors + 1
end if
end if
end if
end if

View File

@ -27,6 +27,7 @@ adddvhubscf.o : ../PW/src/ldaU.o
adddvhubscf.o : ../PW/src/pwcom.o
adddvhubscf.o : ../UtilXlib/mp.o
adddvhubscf.o : lrcom.o
adddvscf.o : ../Modules/becmod.o
adddvscf.o : ../Modules/ions_base.o
adddvscf.o : ../Modules/kind.o
adddvscf.o : ../Modules/noncol.o

View File

@ -80,6 +80,7 @@ MODULE funct
! "x3lyp" = X3LYP
! "vwn-rpa" = VWN LDA using vwn1-rpa parametrization
! "gaupbe"= "sla+pw+gaup+pbc" = Gau-PBE (also "gaup")
!
! "vdw-df" ="sla+pw+revx+vdw1" = vdW-DF1
! "vdw-df2" ="sla+pw+rw86+vdw2" = vdW-DF2
! "vdw-df-c09" ="sla+pw+c09x+vdw1" = vdW-DF-C09

View File

@ -830,9 +830,9 @@ MODULE io_base
COMPLEX(kind=DP), ALLOCATABLE :: rho_aux(:)
LOGICAL :: ionode_in_group
INTEGER :: nproc_in_group
INTEGER, ALLOCATABLE :: mill_g(:,:)
INTEGER, ALLOCATABLE :: mill_g(:,:), grid(:,:,:)
CHARACTER(len=256) :: mesg
INTEGER :: ig, jg, minus_g_file(3), startjg, old_ig, new_startjg
INTEGER :: ig, jg, nr1b2,nr2b2,nr3b2
IF ( .NOT. PRESENT (this_run_is_gamma_only) ) RETURN
IF ( this_run_is_gamma_only) THEN
call infomsg('read_rhog','Conversion: K charge Gamma charge')
@ -870,59 +870,32 @@ MODULE io_base
IF ( ig .GE. ngm_g ) EXIT
END DO
ELSE ! this run uses full fft mesh
ig = 1
DO jg = 1, ngm_g
if ( mill_g (1,jg) == mill_g_file(1,ig) .and. &
mill_g (2,jg) == mill_g_file(2,ig) .and. &
mill_g (3,jg) == mill_g_file(3,ig) ) then
!
rho_g(jg) = rho_aux(ig)
ig = ig + 1
end if
if ( ig .GE. ngm_g_file ) EXIT
nr1b2 = MAX(MAXVAL(ABS(mill_g(1,:))),MAXVAL(ABS(mill_g_file(1,:))))
nr2b2 = MAX(MAXVAL(ABS(mill_g(2,:))),MAXVAL(ABS(mill_g_file(2,:))))
nr3b2 = MAX(MAXVAL(ABS(mill_g(3,:))),MAXVAL(ABS(mill_g_file(3,:))))
ALLOCATE(grid(-nr1b2-1:nr1b2+1,-nr2b2-1:nr2b2+1,-nr3b2-1:nr3b2+1))
grid = 10 * ngm_g_file
!$omp do
DO ig = 1, ngm_g_file
grid ( mill_g_file(1,ig), mill_g_file(2,ig),mill_g_file(3,ig)) = ig
grid(-mill_g_file(1,ig),-mill_g_file(2,ig),-mill_g_file(3,ig)) = -ig
END DO
WRITE (stdout, *) " Plus vectors done"
WRITE (stdout, *) " Search of minus vectors is going to take a while"
ig = 1
minus_g_file = minus_g(ig)
startjg = 1
new_startjg = 1
igloop: DO
old_ig = ig
DO jg = startjg, ngm_g
if ( mill_g (1,jg) == minus_g_file(1) .and. &
mill_g (2,jg) == minus_g_file(2) .and. &
mill_g (3,jg) == minus_g_file(3) ) then
!
rho_g(jg) = dconjg(rho_aux(ig))
ig = ig + 1
if ( ig .le. ngm_g_file) minus_g_file = minus_g(ig)
if (jg == new_startjg) new_startjg = new_startjg+1
end if
if ( ig .GT. ngm_g_file ) EXIT igloop
END DO
startjg = new_startjg
IF ( ig == old_ig) THEN
WRITE(mesg,*) "minus_g for ig = ", old_ig,":" , minus_g_file, "-->", mill_g_file(:,ig), " not found"
CALL infomsg("read_rhog:" , TRIM(mesg))
ig = ig +1
minus_g_file = minus_g(ig)
startjg = 1
!$omp do private(ig)
DO jg =1, ngm_g
ig = grid(mill_g(1,jg),mill_g(2,jg),mill_g(3,jg))
IF (ig .LE. ngm_g_file) THEN
IF (ig .GE. 0 ) THEN
rho_g(jg) = rho_aux(ig)
ELSE
rho_g(jg) = CONJG(rho_aux(-ig))
END IF
END IF
END DO igloop
END IF
ENDIF
deallocate(rho_aux,mill_g)
END DO
deallocate(grid)
END IF
END IF
deallocate(rho_aux,mill_g)
return
CONTAINS
function minus_g (imill) result ( minus_mill)
implicit none
integer :: minus_mill(3)
integer :: ipol, imill
minus_mill = - mill_g_file(:,imill)
end function minus_g
END SUBROUTINE charge_k_to_g
!

View File

@ -34,7 +34,7 @@ subroutine solve_e
USE klist, ONLY : ltetra, lgauss, xk, ngk, igk_k
USE gvecs, ONLY : doublegrid
USE fft_base, ONLY : dfftp, dffts
USE lsda_mod, ONLY : nspin
USE lsda_mod, ONLY : nspin, lsda, current_spin, isk
USE spin_orb, ONLY : domag
USE wvfct, ONLY : nbnd, npwx
USE check_stop, ONLY : check_stop_now
@ -154,6 +154,7 @@ subroutine solve_e
DO ipol = 1, 3
ikk = ikks(ik)
npw = ngk(ikk)
IF (lsda) current_spin = isk(ikk)
!
! reads unperturbed wavefunctions psi_k in G_space, for all bands
!

View File

@ -18,6 +18,9 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
! (only for metals with fermi spreading)
! iflag=3: calculates the integral of local dos from "emin" to "emax"
! (emin, emax in Ry)
! iflag=4: calculates |psi|^2 for all kpoints/bands that have
! energy between "emin" and "emax" (emin, emax in Ry)
! and spin = spin_component
!
! lsign: if true and k=gamma and iflag=0, write |psi|^2 * sign(psi)
! spin_component: for iflag=3 and LSDA calculations only
@ -113,7 +116,7 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
!
! calculate the correct weights
!
IF (iflag /= 0.and. iflag /=3 .and. .not.lgauss) CALL errore ('local_dos', &
IF (iflag /= 0.and. iflag /=3 .and. iflag/=4 .and. .not.lgauss) CALL errore ('local_dos', &
'gaussian broadening needed', 1)
IF (iflag == 2 .and. ngauss /= -99) CALL errore ('local_dos', &
' beware: not using Fermi-Dirac function ', - ngauss)
@ -127,7 +130,7 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
ELSEIF (iflag == 2) THEN
wg (ibnd, ik) = - wk (ik) * w1gauss ( (ef - et (ibnd, ik) ) &
/ degauss, ngauss)
ELSEIF (iflag == 3) THEN
ELSEIF (iflag==3 .OR. iflag==4) THEN
IF (et (ibnd, ik) <= emax .and. et (ibnd, ik) >= emin) THEN
wg (ibnd, ik) = wk (ik)
ELSE
@ -393,7 +396,7 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
is = 1
psic(dfftp%nl(:)) = rho%of_g (:, is)
ELSE
IF ( iflag==3 .and. (spin_component==1 .or. spin_component==2 ) ) THEN
IF ( (iflag==3 .or. iflag==4) .and. (spin_component==1 .or. spin_component==2) ) THEN
psic(dfftp%nl(:)) = rho%of_g (:, spin_component)
ELSE
isup = 1
@ -411,7 +414,7 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
DEALLOCATE(segno)
ENDIF
!
IF (iflag == 0 .or. gamma_only) RETURN
IF (iflag == 0 .or. iflag == 4 .or. gamma_only) RETURN
!
! symmetrization of the local dos
!

View File

@ -126,7 +126,7 @@ SUBROUTINE extract (plot_files,plot_num)
RETURN
ENDIF
!
IF (plot_num < 0 .or. (plot_num > 22 .and. &
IF (plot_num < 0 .or. (plot_num > 23 .and. &
plot_num /= 119 .and. plot_num /= 123)) CALL errore ('postproc', &
'Wrong plot_num', abs (plot_num) )
@ -145,7 +145,7 @@ SUBROUTINE extract (plot_files,plot_num)
! If needed, allocate and initialize wavefunction-related variables
!
needwf=(plot_num==3).or.(plot_num==4).or.(plot_num==5).or.(plot_num==7).or. &
(plot_num==8).or.(plot_num==10)
(plot_num==8).or.(plot_num==10).or.(plot_num==23)
CALL read_file_new ( needwf )
!
IF ( ( two_fermi_energies .or. i_cons /= 0) .and. &
@ -178,6 +178,7 @@ SUBROUTINE extract (plot_files,plot_num)
nplots = 1
IF (plot_num == 3) THEN
nplots=(emax-emin)/delta_e + 1
ELSEIF (plot_num == 7) THEN
IF (kpoint(2) == 0) kpoint(2) = kpoint(1)
plot_nkpt = kpoint(2) - kpoint(1) + 1
@ -187,6 +188,10 @@ SUBROUTINE extract (plot_files,plot_num)
plot_nspin = spin_component(2) - spin_component(1) + 1
nplots = plot_nbnd * plot_nkpt * plot_nspin
ELSEIF (plot_num == 23) THEN
IF (spin_component(1) == 3) nplots = 2
ENDIF
ALLOCATE( plot_files(nplots) )
plot_files(1) = filplot
@ -216,9 +221,29 @@ SUBROUTINE extract (plot_files,plot_num)
ENDDO
ENDDO
ENDDO
!
ELSEIF (plot_num == 23) THEN
!
IF (spin_component(1) == 3) THEN
!
ispin = 1
plot_files(1) = TRIM(filplot) // "_spin1"
CALL punch_plot ( TRIM(plot_files(1)), plot_num, sample_bias, z, dz, &
emin, emax, ikpt, ibnd, ispin, lsign )
!
ispin = 2
plot_files(2) = TRIM(filplot) // "_spin2"
CALL punch_plot ( TRIM(plot_files(2)), plot_num, sample_bias, z, dz, &
emin, emax, ikpt, ibnd, ispin, lsign )
!
ELSE
CALL punch_plot ( TRIM(plot_files(1)), plot_num, sample_bias, z, dz, &
emin, emax, ikpt, ibnd, spin_component, lsign )
!
ENDIF
!
ELSE
! Single call to punch_plot
! Single call to punch_plot
IF (plot_num == 3) THEN
CALL punch_plot (filplot, plot_num, sample_bias, z, dz, &
emin, degauss_ldos, kpoint, kband, spin_component, lsign)

View File

@ -288,6 +288,13 @@ SUBROUTINE punch_plot (filplot, plot_num, sample_bias, z, dz, &
raux(:) = rho%kin_r(:,1)
ENDIF
ELSEIF (plot_num == 23) THEN
!
! plot of the charge density of states between emin & emax
!
WRITE (title, '("Density for spins between",f8.4, " eV and ",f8.4," eV")') emin*rytoev, emax*rytoev
CALL local_dos (4, lsign, kpoint, kband, spin_component, emin, emax, raux)
ELSEIF (plot_num == 123) THEN
!
! Density Overlap Regions Indicator

View File

@ -6,6 +6,7 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!
#if defined(__CUDA)
!----------------------------------------------------------------------
SUBROUTINE force_hub_gpu( forceh )
!----------------------------------------------------------------------
@ -1952,3 +1953,7 @@ SUBROUTINE dprojdtau_gamma_gpu( spsi_d, alpha, ijkb0, ipol, ik, nb_s, nb_e, &
RETURN
!
END SUBROUTINE dprojdtau_gamma_gpu
#else
SUBROUTINE force_hub_gpu( )
END
#endif

View File

@ -33,20 +33,15 @@ SUBROUTINE gradcorr( rho, rhog, rho_core, rhog_core, etxc, vtxc, v )
!
REAL(DP), ALLOCATABLE :: grho(:,:,:), h(:,:,:), dh(:)
REAL(DP), ALLOCATABLE :: rhoaux(:,:), segni(:), vgg(:,:), vsave(:,:)
REAL(DP), ALLOCATABLE :: gmag(:,:,:)
COMPLEX(DP), ALLOCATABLE :: rhogaux(:,:)
!
REAL(DP), ALLOCATABLE :: grho2(:,:), grho_ud(:)
REAL(DP), ALLOCATABLE :: rh(:), zeta(:)
REAL(DP), ALLOCATABLE :: v1x(:,:), v2x(:,:)
REAL(DP), ALLOCATABLE :: v1c(:,:), v2c(:,:), v2c_ud(:)
REAL(DP) :: vnull
REAL(DP) :: sx(dfftp%nnr), sc(dfftp%nnr)
!
REAL(DP) :: sgn(2), etxcgc, vtxcgc, segno, fac, amag
REAL(DP) :: sgn(2), etxcgc, vtxcgc, fac, amag
!
REAL(DP) :: grup, grdw, seg, gr
REAL(DP) :: grup, grdw
!
REAL(DP), PARAMETER :: epsr = 1.D-6, epsg = 1.D-10
!
@ -64,7 +59,6 @@ SUBROUTINE gradcorr( rho, rhog, rho_core, rhog_core, etxc, vtxc, v )
!
ALLOCATE( h(3,dfftp%nnr,nspin0) )
ALLOCATE( grho(3,dfftp%nnr,nspin0) )
ALLOCATE( grho2(dfftp%nnr,nspin0) )
ALLOCATE( rhoaux(dfftp%nnr,nspin0) )
!
ALLOCATE( v1x(dfftp%nnr,nspin0), v2x(dfftp%nnr,nspin0) )
@ -122,7 +116,7 @@ SUBROUTINE gradcorr( rho, rhog, rho_core, rhog_core, etxc, vtxc, v )
DO k = 1, dfftp%nnr
!
! ... first term of the gradient correction : D(rho*Exc)/D(rho)
v(k,1) = v(k,1) + e2 * ( v1x(k,1) + v1c(k,1) ) ! * vnull
v(k,1) = v(k,1) + e2 * ( v1x(k,1) + v1c(k,1) )
!
! ... h contains: D(rho*Exc) / D(|grad rho|) * (grad rho) / |grad rho|
h(:,k,1) = e2 * ( v2x(k,1) + v2c(k,1) ) * grho(:,k,1)
@ -217,7 +211,6 @@ SUBROUTINE gradcorr( rho, rhog, rho_core, rhog_core, etxc, vtxc, v )
!
DEALLOCATE( dh )
DEALLOCATE( h )
DEALLOCATE( grho2 )
DEALLOCATE( rhoaux )
IF (nspin==4 .AND. domag) THEN
DEALLOCATE( vgg )

View File

@ -38,7 +38,7 @@ SUBROUTINE stres_gradcorr( rho, rhog, rho_core, rhog_core, kedtau, nspin, &
COMPLEX(DP), ALLOCATABLE :: rhogaux(:,:)
!
REAL(DP), ALLOCATABLE :: sx(:), sc(:)
REAL(DP), ALLOCATABLE :: v1x(:,:), v2x(:,:), v3x(:,:), rhos(:)
REAL(DP), ALLOCATABLE :: v1x(:,:), v2x(:,:), v3x(:,:)
REAL(DP), ALLOCATABLE :: v1c(:,:), v2c(:,:,:), v3c(:,:), v2c_ud(:)
!
REAL(DP), PARAMETER :: epsr = 1.0d-6, epsg = 1.0d-10, e2 = 2.d0

View File

@ -15,7 +15,7 @@ SUBROUTINE vhpsi( ldap, np, mps, psip, hpsi )
USE kinds, ONLY : DP
USE becmod, ONLY : bec_type, calbec, allocate_bec_type, &
deallocate_bec_type
USE ldaU, ONLY : Hubbard_lmax, Hubbard_l, is_Hubbard, &
USE ldaU, ONLY : Hubbard_l, is_Hubbard, &
nwfcU, wfcU, offsetU, lda_plus_u_kind, &
is_hubbard_back, Hubbard_l_back, offsetU_back, &
backall, offsetU_back1
@ -73,7 +73,7 @@ SUBROUTINE vhpsi_U ()
! This routine applies the Hubbard potential with U_I
! to the KS wave functions.
!
USE ldaU, ONLY : ldim_back, ldmx_b, Hubbard_l1_back
USE ldaU, ONLY : Hubbard_lmax, ldim_back, ldmx_b, Hubbard_l1_back
!
IMPLICIT NONE
INTEGER :: na, nt, ldim, ldim0
@ -92,6 +92,7 @@ SUBROUTINE vhpsi_U ()
ALLOCATE ( rtemp(ldim,mps) )
ELSE
ALLOCATE ( ctemp(ldim,mps) )
ALLOCATE ( vaux (ldim,ldim) )
ENDIF
!
DO na = 1, nat
@ -105,16 +106,11 @@ SUBROUTINE vhpsi_U ()
1.0_dp, hpsi, 2*ldap)
ELSE
!
ALLOCATE(vaux(ldim,ldim))
!
vaux = (0.0_dp,0.0_dp)
vaux(:,:) = v%ns(:,:,current_spin,na)
vaux(:,:) = v%ns(1:ldim,1:ldim,current_spin,na)
!
CALL ZGEMM ('n','n', ldim, mps, ldim, (1.0_dp,0.0_dp), &
vaux, ldim, proj%k(offsetU(na)+1,1), nwfcU, &
(0.0_dp,0.0_dp), ctemp, ldim)
!
DEALLOCATE(vaux)
vaux, ldim, &
proj%k(offsetU(na)+1,1),nwfcU,(0.0_dp,0.0_dp),ctemp,ldim)
!
CALL ZGEMM ('n','n', np, mps, ldim, (1.0_dp,0.0_dp), &
wfcU(1,offsetU(na)+1), ldap, ctemp, ldim, &
@ -127,6 +123,7 @@ SUBROUTINE vhpsi_U ()
IF (gamma_only) THEN
DEALLOCATE ( rtemp )
ELSE
DEALLOCATE(vaux)
DEALLOCATE ( ctemp )
ENDIF
!

View File

@ -9,9 +9,9 @@ Installation
============
This version requires the nvfortran (previously PGI) compiler from the
freely available NVidia HPC SDK. You are adviced to use a recent version
of NVidia software. Any version later than 17.4 should work, but many glitches
are known to exist in older versions.
freely available NVidia HPC SDK. You are advised to use the most recent
version of NVidia software you can find. While any version later than 17.4
should work, many glitches are known to exist in older versions.
The `configure` script checks for the presence of the nvfortran compiler and
of a few cuda libraries. For this reason the path pointing to the cuda toolkit
must be present in `LD_LIBRARY_PATH`.
@ -24,27 +24,21 @@ A template for the configure command is:
where `XX` is the location of the CUDA Toolkit (in HPC environments is
generally `$CUDA_HOME`), `YY` is the version of the cuda toolkit and `ZZ`
is the compute capability of the card.
If you have no idea what these numbers are you may give a try to the
automatic tool `get_device_props.py`. Go to directory `dev-tools/` and
run `python get_device_props.py`. An example using Slurm:
is the compute capability of the card. You can get those numbers from
command `nvaccelinfo`, if you have a properly configured HPC SDK:
```
$ module load cuda
$ cd dev-tools
$ salloc -n1 -t1
[...]
salloc: Granted job allocation xxxx
$ srun python get_device_props.py
[...]
Compute capabilities for dev 0: 6.0
Compute capabilities for dev 1: 6.0
Compute capabilities for dev 2: 6.0
Compute capabilities for dev 3: 6.0
If all compute capabilities match, configure QE with:
./configure --with-cuda=$CUDA_HOME --with-cuda-cc=60 --with-cuda-runtime=9.2
$ nvaccelinfo | grep -e 'Target' -e 'Driver'
CUDA Driver Version: 11000
Default Target: cc70
...
```
The version is returned as (1000 major + 10 minor). For example, CUDA 9.2
would be represented by 9020. For the above case, configure QE with:
```
./configure --with-cuda=$CUDA_HOME --with-cuda-cc=70 --with-cuda-runtime=11.0
```
Alternatively, you may use the (deprecated) tool `get_device_props.py` in
directory `dev-tools/`.
It is generally a good idea to disable Scalapack when running small test
cases since the serial GPU eigensolver outperforms the parallel CPU

View File

@ -1,6 +1,8 @@
set(sources_xclib
dft_mod.f90
dft_setting_routines.f90
dft_setting_params.f90
qe_constants.f90
qe_dft_list.f90
qe_drivers_d_gga.f90
qe_drivers_d_lda_lsda.f90
qe_drivers_gga.f90
@ -15,14 +17,13 @@ set(sources_xclib
xclib_error.f90
xclib_utils_and_para.f90
xc_beef_interface.f90
xc_input_params_mod.f90
xc_lib.f90
xc_wrapper_d_gga.f90
xc_wrapper_d_lda_lsda.f90
xc_wrapper_gga.f90
xc_wrapper_lda_lsda.f90
xc_wrapper_mgga.f90)
qe_add_library(qe_xclib ${sources_xclib})
target_link_libraries(qe_xclib
PRIVATE
@ -49,6 +50,24 @@ target_link_libraries(qe_libbeef
qe_install_targets(qe_libbeef)
###########################################################
# xc_infos.x
###########################################################
if(QE_ENABLE_TEST)
set(sources_xc_infos
qe_dft_refs.f90
xc_infos.f90)
qe_add_executable(qe_xc_infos ${sources_xc_infos})
set_target_properties(qe_xc_infos
PROPERTIES
OUTPUT_NAME qe_xc_infos.x
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
target_link_libraries(qe_xc_infos
PRIVATE
qe_external_libxc
qe_xclib)
endif(QE_ENABLE_TEST)
###########################################################
# xclib_test.x
###########################################################
@ -62,6 +81,7 @@ if(QE_ENABLE_TEST)
PRIVATE
qe_openmp_fortran
qe_mpi_fortran
qe_upflib
qe_external_libxc
qe_xclib)

View File

@ -2,13 +2,16 @@
include ../make.inc
MODFLAGS= $(MOD_FLAG)$(TOPDIR)/upflib
XCL = \
xclib_utils_and_para.o \
xclib_error.o \
qe_kind.o \
qe_constants.o \
xc_input_params_mod.o \
dft_mod.o \
dft_setting_params.o \
dft_setting_routines.o \
qe_dft_list.o \
qe_funct_corr_lda_lsda.o \
qe_funct_exch_lda_lsda.o \
qe_funct_corr_gga.o \
@ -31,18 +34,32 @@ BEEF = \
pbecor.o \
beefun.o
XCT = \
qe_kind.o \
qe_constants.o \
xclib_utils_and_para.o \
dft_setting_params.o \
dft_setting_routines.o \
qe_dft_list.o \
xc_lib.o
all: xc_lib.a
xc_lib.a: $(XCL) $(BEEF)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
xclib_test.x : xclib_test.o xc_lib.a
xc_infos.x : xc_infos.o qe_dft_refs.o qe_dft_list.o xc_lib.a
$(LD) $(LD_LIBS) $(LDFLAGS) $(DFLAGS) -o $@ \
xclib_test.o xc_lib.a $(BLAS_LIBS) $(LD_LIBS) $(LIBXC_LIBS)
xc_infos.o qe_dft_refs.o qe_dft_list.o xc_lib.a $(BLAS_LIBS) $(LD_LIBS) $(LIBXC_LIBS)
- ( cd ../bin ; ln -fs ../XClib/$@ . )
test : xclib_test.x
xclib_test.x : xclib_test.o $(XCT) xc_lib.a
$(LD) ../upflib/libupf.a $(LD_LIBS) $(LDFLAGS) $(DFLAGS) -o $@ \
xclib_test.o $(XCT) xc_lib.a ../upflib/libupf.a $(BLAS_LIBS) $(LD_LIBS) $(LIBXC_LIBS)
- ( cd ../bin ; ln -fs ../XClib/$@ . )
test : xclib_test.x xc_infos.x
clean :
- /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L *.x

View File

@ -1,67 +1,126 @@
xclib_test.x is a testing program for the XClib library.
------
This is still a prototype version. The next release will include a simpler
and more stable version.
------
--------------------------
- XClib TESTING PROGRAMS -
--------------------------
To compile the test program, once you have properly configured QE,
inside the directory XClib type:
To compile the following side programs, once you have properly
configured QE, just type:
make test
in the XClib directory. With CMake they will be compiled automati-
cally if 'QE_ENABLE_TEST' is set to true (default).
Then you can run tests using commands like:
./xclib_test.x < input_file > output_file [ serial ]
mpirun -np=2 xclib_test.x < input_file > output file [parallel]
---------------------- XC_INFO -----------------------------------
Four options available:
xc_info is a small serial program that provides infos on XC
functionals, both the ones from internal QE library and the ones
from Libxc. Just run the command:
* dft-info: infos on the input dft are provided. If the functionals
functionals are from libxc the external parameters, when
present, are listed with a brief description and their
default value.
Example of input_file content:
./xc_info.x
&INPUT_NAMELIST
test='dft-info'
dft1='mgga_x_scan mgga_c_scan'
/
* gen-benchmark: the program generates a set of data to compare the
XC output to.
Example of input file content:
&INPUT_NAMELIST
test='gen-benchmark'
family='GGA'
dft1='PBE'
nspin=2
DF_OK=.FALSE.
/
then type the functional name (or any allowed combination). It
will show a brief description, the list of the external parameters,
and all the available references. For Libxc functionals it will also
tell if they are currently usable in QE or not.
* exe-benchmark: the program takes as input the data file generated
previously with the 'gen-benchmark' option and
compares the output of the XC routines.
* dft-comparison: the program compares two different DFTs on a large
grid of points. Max, min and average percentage
difference between the two dft outputs (energy and
potential) are provided and the points of the grid
where the two output differ are shown. This option
can be used, for example, to find differences between
internal QE functionals and the libxc ones.
Example of input file content:
--------------------- XCLIB_TEST ---------------------------------
&INPUT_NAMELIST
test='dft-comparison',
nspin=2,
family='LDA',
DF_OK=.FALSE.,
dft1='sla pz',
dft2='lda_x lda_c_pz'
/
xclib_test is a testing program for the XClib library routines.
Due to the high number of available dfts (including those from
the external library Libxc) and the different parallelization
schemes available already or in experimental phase, this program
is intended to be a tool that helps developers to maintain and
develop XClib by keeping an overview on all the available options
(which cannot be covered by test-suite only).
The program generates an xml file with a set of XC-output data
produced according to the input options and use it for later
comparison with other differently generated sets of XC-output data.
It first calculates averages of the XC-output data over a large
arbitrary grid (the number of points can be modified by changing the
'npoints' parameter in the code) -this is a 'naive' way to compare
outputs over a large number of points without storing a large amount
of data, however more sophisticated estimates than the arithmetic
averages can be replaced in a second time with minimal effort (and
the grid itself too). Then the same program calculates the XC output
data over a selected number of grid points, including threshold
points, and perform the comparison between xml data and current ones.
The testing program is available for LDA, GGA and MGGA functionals. It
also tests the potential derivatives for LDA (dmxc) and GGA (dgcxc) when
the DF_OK variable is set to TRUE.
You can run the program by using commands like:
./xclib_test.x < input_file [ serial ]
mpirun -np XX xclib_test.x < input_file [parallel]
Different options are available and the program can be used for
different purposes.
An example of input file content is the following:
&INPUT_NAMELIST
test='generate'
filename_xml='xctest_data.xml'
dft='all_terms'
family=''
polarization='both'
xc_derivative=.FALSE.
/
This input generates an xml file 'xctest_data.xml' whith a set of XC
output data (both polarized and unpolarized) for each single dft term
in the QE internal library. If 'execute' was present instead of 'generate'
it would span all the dft terms and compare the outputs with the data in
the xml file.
Another example:
&INPUT_NAMELIST
test='execute'
filename_xml='xctest_data.xml'
dft='pbe'
family='GGA'
polarization='unpolarized'
xc_derivative=.FALSE.
show_time = .TRUE.
/
This input reads data from the xml file and compare the output for the pbe
functional only. It also shows an estimate of the XClib execution wall time.
In general, the following input options have to be set (capital or
lowercase is the same):
- test: The 'GENERATE' option generates the xml file with the benchmark set
of XClib output data. The 'EXECUTE' option calculates a set of
XClib output data and compares it with the one previously stored
in the xml file.
- filename_xml: the name of the xml file.
- dft: the input functional. Besides the specific functionals, three
other options are available:
- 'ALL_TERMS' spans all the available single term functionals
of QE (e.g. LDA exchange, LDA correlation, GGA exchange, ...);
- 'ALL_SHORT' spans all the full dfts (identified by the 'shortnames')
available in XClib, e.g. LDA, PBESOL, PW86PBE, etc.
- 'ALL_LIBXC' spans all the available Libxc functionals. Those
that are not usable in the current QE version will be skipped
with a notice.
- family: the dft family (needed in order to distinguish those few cases
where LDA terms have the same name of the GGA ones, e.g. B3LP).
If dft='ALL_...' then input family will be ignored.
- polarization: 'UNPOLARIZED', 'POLARIZED', 'BOTH'.
- xc_derivative: if .TRUE. calculates the derivative terms (needed,
for example, by linear response code) instead of
the ordinary energy&potential output.
- show_time: if .TRUE. stores WALL time spent by xc-routines during
'GENERATE' test and shows increment (in percentage) during
'EXECUTE' test.
Obviously the program can be used to compare QE and Libxc functionals,
to check differences from one version to another or to check differences
in the output by changing external parameters or other stuff.

View File

@ -6,7 +6,7 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!--------------------------------------------------------------------
MODULE dft_par_mod
MODULE dft_setting_params
!----------------------------------------------------------------
!! Parameters that define the XC functionals.
!
@ -17,6 +17,8 @@ MODULE dft_par_mod
!
IMPLICIT NONE
!
SAVE
!
CHARACTER(LEN=32) :: dft = 'not set'
!! Full name of the XC functional
INTEGER, PARAMETER :: notset = -1
@ -34,10 +36,17 @@ MODULE dft_par_mod
!! pointers to libxc functional structs
TYPE(xc_f03_func_info_t) :: xc_info(6)
!! pointers to libxc info structs
INTEGER :: n_ext_params(6) = 0
INTEGER :: libxc_flags(6,0:15) = notset
!! flags related to specific features of libxc functionals
!! (see Libxc doc)
INTEGER :: n_ext_params(6) = 0
!! number of external parameters for each functional
REAL(DP) :: par_list(6,50)
!! list of external parameters
LOGICAL :: xc_kind_error = .FALSE.
!! some Libxc dfts are currently not usable in QE (for example
!! kinetic dfts). If one of them is detected this variable is
!! set to TRUE.
#endif
!
LOGICAL :: exx_started = .FALSE.
@ -101,27 +110,4 @@ MODULE dft_par_mod
INTEGER :: beefvdw = 0
!! Index for vdw term of BEEF
!
INTEGER, PARAMETER :: nxc=8, ncc=12, ngcx=46, ngcc=13, nmeta=6
CHARACTER(LEN=4) :: exc, corr, gradx, gradc, meta
DIMENSION :: exc(0:nxc), corr(0:ncc), gradx(0:ngcx), gradc(0:ngcc), &
meta(0:nmeta)
!
DATA exc / 'NOX', 'SLA', 'SL1', 'RXC', 'OEP', 'HF', 'PB0X', 'B3LP', 'KZK' /
DATA corr / 'NOC', 'PZ', 'VWN', 'LYP', 'PW', 'WIG', 'HL', 'OBZ', &
'OBW', 'GL' , 'KZK', 'xxxx', 'B3LP' /
!
DATA gradx / 'NOGX', 'B88', 'GGX', 'PBX', 'REVX', 'HCTH', 'OPTX', &
'xxxx', 'PB0X', 'B3LP', 'PSX', 'WCX', 'HSE', 'RW86', 'PBE', &
'xxxx', 'C09X', 'SOX', 'xxxx', 'Q2DX', 'GAUP', 'PW86', 'B86B', &
'OBK8', 'OB86', 'EVX', 'B86R', 'CX13', 'X3LP', &
'CX0', 'R860', 'CX0P', 'AHCX', 'AHF2', &
'AHPB', 'AHPS', 'CX14', 'CX15', 'BR0', 'CX16', 'C090', &
'B86X', 'B88X', 'BEEX', 'HHNX', 'W31X', 'W32X' /
!
DATA gradc / 'NOGC', 'P86', 'GGC', 'BLYP', 'PBC', 'HCTH', 'NONE',&
'B3LP', 'PSC', 'PBE', 'xxxx', 'xxxx', 'Q2DC', 'BEEC' /
!
DATA meta / 'NONE', 'TPSS', 'M06L', 'TB09', 'META', 'SCAN', 'SCA0' /
!
!
END MODULE
END MODULE dft_setting_params

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,30 @@
dft_mod.o : qe_kind.o
dft_mod.o : xc_input_params_mod.o
dft_mod.o : xclib_utils_and_para.o
dft_setting_routines.o : qe_kind.o
dft_setting_routines.o : dft_setting_params.o
dft_setting_routines.o : xclib_utils_and_para.o
dft_setting_routines.o : qe_dft_list.o
qe_constants.o : qe_kind.o
qe_dft_list.o : dft_setting_params.o
qe_drivers_d_gga.o : qe_drivers_gga.o
qe_drivers_d_gga.o : qe_kind.o
qe_drivers_d_gga.o : xc_input_params_mod.o
qe_drivers_d_gga.o : dft_setting_params.o
qe_drivers_d_lda_lsda.o : qe_constants.o
qe_drivers_d_lda_lsda.o : qe_drivers_lda_lsda.o
qe_drivers_d_lda_lsda.o : qe_funct_corr_lda_lsda.o
qe_drivers_d_lda_lsda.o : qe_funct_exch_lda_lsda.o
qe_drivers_d_lda_lsda.o : qe_kind.o
qe_drivers_d_lda_lsda.o : xc_input_params_mod.o
qe_drivers_d_lda_lsda.o : dft_setting_params.o
qe_drivers_gga.o : qe_funct_corr_gga.o
qe_drivers_gga.o : qe_funct_exch_gga.o
qe_drivers_gga.o : qe_kind.o
qe_drivers_gga.o : xc_beef_interface.o
qe_drivers_gga.o : xc_input_params_mod.o
qe_drivers_gga.o : dft_setting_params.o
qe_drivers_lda_lsda.o : qe_funct_corr_lda_lsda.o
qe_drivers_lda_lsda.o : qe_funct_exch_lda_lsda.o
qe_drivers_lda_lsda.o : qe_kind.o
qe_drivers_lda_lsda.o : xc_input_params_mod.o
qe_drivers_lda_lsda.o : dft_setting_params.o
qe_drivers_mgga.o : qe_funct_mgga.o
qe_drivers_mgga.o : qe_kind.o
qe_drivers_mgga.o : xc_input_params_mod.o
qe_drivers_mgga.o : dft_setting_params.o
qe_funct_corr_gga.o : qe_funct_corr_lda_lsda.o
qe_funct_corr_gga.o : qe_kind.o
qe_funct_corr_lda_lsda.o : qe_kind.o
@ -35,31 +37,38 @@ qe_funct_mgga.o : qe_funct_corr_lda_lsda.o
qe_funct_mgga.o : qe_funct_exch_lda_lsda.o
qe_funct_mgga.o : qe_kind.o
xc_beef_interface.o : qe_kind.o
xc_input_params_mod.o : qe_kind.o
xc_lib.o : dft_mod.o
dft_setting_params.o : qe_kind.o
xc_lib.o : dft_setting_routines.o
xc_lib.o : qe_kind.o
xc_wrapper_d_gga.o : qe_constants.o
xc_wrapper_d_gga.o : qe_drivers_d_gga.o
xc_wrapper_d_gga.o : qe_kind.o
xc_wrapper_d_gga.o : xc_input_params_mod.o
xc_wrapper_d_gga.o : dft_setting_params.o
xc_wrapper_d_lda_lsda.o : qe_drivers_d_lda_lsda.o
xc_wrapper_d_lda_lsda.o : qe_kind.o
xc_wrapper_d_lda_lsda.o : xc_input_params_mod.o
xc_wrapper_d_lda_lsda.o : dft_setting_params.o
xc_wrapper_gga.o : qe_drivers_gga.o
xc_wrapper_gga.o : qe_kind.o
xc_wrapper_gga.o : xc_input_params_mod.o
xc_wrapper_gga.o : dft_setting_params.o
xc_wrapper_lda_lsda.o : qe_drivers_lda_lsda.o
xc_wrapper_lda_lsda.o : qe_kind.o
xc_wrapper_lda_lsda.o : xc_input_params_mod.o
xc_wrapper_mgga.o : dft_mod.o
xc_wrapper_lda_lsda.o : dft_setting_params.o
xc_wrapper_mgga.o : dft_setting_routines.o
xc_wrapper_mgga.o : qe_drivers_mgga.o
xc_wrapper_mgga.o : qe_kind.o
xc_wrapper_mgga.o : xc_input_params_mod.o
xc_wrapper_mgga.o : dft_setting_params.o
xclib_error.o : xclib_utils_and_para.o
xclib_test.o : qe_constants.o
xclib_test.o : qe_kind.o
xclib_test.o : xc_input_params_mod.o
xclib_test.o : dft_setting_params.o
xclib_test.o : xc_lib.o
xclib_test.o : xclib_utils_and_para.o
xclib_test.o : ../upflib/xmltools.o
xc_infos.o : qe_kind.o
xc_infos.o : dft_setting_params.o
xc_infos.o : xc_lib.o
xc_infos.o : qe_dft_list.o
xc_infos.o : qe_dft_refs.o
xc_infos.o : xclib_utils_and_para.o
beefun.o : beefleg.h
beefun.o : pbecor.h

285
XClib/qe_dft_list.f90 Normal file
View File

@ -0,0 +1,285 @@
!
! Copyright (C) 2021 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
!------------------------------------------------------------------------------------
MODULE qe_dft_list
!----------------------------------------------------------------------------------
!! Contains the list of functionals available in QE, both single terms (family+type)
!! and combinations.
!! Extra parameters of QE functionals are set in 'xclib_set_auxiliary_flag' and
!! subsequent routines
!
! NOTE: when a dft term slot is filled with 'xxxx' it usually means that the term
! is included in one of the full dft combinations available, but it cannot be
! called by itself.
!
! NOTE: The references and descriptions of each dft are stored in a different
! module in file 'qe_dft_refs.f90', which is used by the program 'xc_infos'.
! If you modify something here, please check consistency there too.
!
USE dft_setting_params, ONLY: notset
!
SAVE
!
INTEGER, PARAMETER :: nxc=10, ncc=14, ngcx=46, ngcc=14, nmeta=6
CHARACTER(LEN=4) :: dft_LDAx_name(0:nxc), dft_LDAc_name(0:ncc), &
dft_GGAx_name(0:ngcx), dft_GGAc_name(0:ngcc), &
dft_MGGA_name(0:nmeta)
!
TYPE dft_label
CHARACTER(LEN=10) :: name
CHARACTER(LEN=10) :: name2
INTEGER :: IDs(6)
END TYPE dft_label
!
INTEGER, PARAMETER :: n_dft=38
TYPE(dft_label) :: dft_full(n_dft)
!
!
!
! LDA exchange terms
DATA dft_LDAx_name / 'NOX', 'SLA', 'SL1', 'RXC', 'OEP', 'HF', 'PB0X', & ! 0 to 6
'B3LP', 'KZK', 'xxxx', 'xxxx' / ! 7 " 10
! LDA correlation terms
DATA dft_LDAc_name / 'NOC', 'PZ', 'VWN', 'LYP', 'PW', 'WIG', 'HL', & ! 0 to 6
'OBZ', 'OBW', 'GL', 'KZK', 'xxxx', 'B3LP','xxxx',& ! 7 " 13
'xxxx' / !14
! GGA exchange terms
DATA dft_GGAx_name / 'NOGX', 'B88', 'GGX', 'PBX', 'REVX', 'HCTH', & ! 0 to 5
'OPTX', 'xxxx', 'PB0X', 'B3LP', 'PSX', 'WCX', & ! 6 " 11
'HSE', 'RW86', 'PBE', 'xxxx', 'C09X', 'SOX', & !12 " 17
'xxxx', 'Q2DX', 'GAUP', 'PW86', 'B86B', 'OBK8', & !18 " 23
'OB86', 'EVX', 'B86R', 'CX13', 'X3LP', 'CX0', & !24 " 29
'R860', 'CX0P', 'AHCX', 'AHF2', 'AHPB', 'AHPS', & !30 " 35
'CX14', 'CX15', 'BR0', 'CX16', 'C090', 'B86X', & !36 " 41
'B88X', 'BEEX', 'HHNX', 'W31X', 'W32X' / !42 " 46
! GGA correlation terms
DATA dft_GGAc_name / 'NOGC', 'P86', 'GGC', 'BLYP', 'PBC', 'HCTH', & ! 0 to 5
'NONE', 'B3LP','PSC', 'PBE' , 'xxxx','xxxx', & ! 6 " 11
'Q2DC', 'xxxx','BEEC' / !12 " 14
! MGGA exchange+correlation terms
DATA dft_MGGA_name / 'NONE', 'TPSS', 'M06L', 'TB09', 'NONE', 'SCAN', & ! 0 to 5
'SCA0' / ! 6
!
!
! ---- Full DFTs ----
!
DATA dft_full(1)%name / 'PZ' /
DATA dft_full(1)%name2 / 'LDA' /
DATA dft_full(1)%IDs(1:6) / 1,1,0,0,0,0 / ! sla+pz
!
DATA dft_full(2)%name / 'PW' /
DATA dft_full(2)%name2 / 'none' /
DATA dft_full(2)%IDs(1:6) / 1,4,0,0,0,0 / ! sla+pw
!
DATA dft_full(3)%name / 'VWN-RPA' /
DATA dft_full(3)%name2 / 'none' /
DATA dft_full(3)%IDs(1:6) / 1,11,0,0,0,0 / ! sla+xxxx[vwn1_rpa]
!
DATA dft_full(4)%name / 'OEP' /
DATA dft_full(4)%name2 / 'none' /
DATA dft_full(4)%IDs(1:6) / 4,0,0,0,0,0 / ! oep
!
DATA dft_full(5)%name / 'KLI' /
DATA dft_full(5)%name2 / 'none' /
DATA dft_full(5)%IDs(1:6) / 10,0,0,0,0,0 / ! kli
!
DATA dft_full(6)%name / 'HF' /
DATA dft_full(6)%name2 / 'none' /
DATA dft_full(6)%IDs(1:6) / 5,0,0,0,0,0 / ! hf
!
DATA dft_full(7)%name / 'PBE' /
DATA dft_full(7)%name2 / 'none' /
DATA dft_full(7)%IDs(1:6) / 1,4,3,4,0,0 / ! sla+pw+pbx+pbc
!
DATA dft_full(8)%name / 'B88' /
DATA dft_full(8)%name2 / 'none' /
DATA dft_full(8)%IDs(1:6) / 1,1,1,0,0,0 / ! sla+pz+b88
!
DATA dft_full(9)%name / 'BP' /
DATA dft_full(9)%name2 / 'none' /
DATA dft_full(9)%IDs(1:6) / 1,1,1,1,0,0 / ! sla+pz+b88+p86
!----
DATA dft_full(10)%name / 'PW91' /
DATA dft_full(10)%name2 / 'none' /
DATA dft_full(10)%IDs(1:6) / 1,4,2,2,0,0 / ! sla+pw+ggx+ggc
!
DATA dft_full(11)%name / 'REVPBE' /
DATA dft_full(11)%name2 / 'none' /
DATA dft_full(11)%IDs(1:6) / 1,4,4,4,0,0 / ! sla+pw+revx+pbc
!
DATA dft_full(12)%name / 'PBESOL' /
DATA dft_full(12)%name2 / 'none' /
DATA dft_full(12)%IDs(1:6) / 1,4,10,8,0,0 / ! sla+pw+psx+psc
!
DATA dft_full(13)%name / 'BLYP' /
DATA dft_full(13)%name2 / 'none' /
DATA dft_full(13)%IDs(1:6) / 1,3,1,3,0,0 / ! sla+lyp+b88+blyp
!
DATA dft_full(14)%name / 'OPTBK88' /
DATA dft_full(14)%name2 / 'none' /
DATA dft_full(14)%IDs(1:6) / 1,4,23,1,0,0 / ! sla+pw+obk8+p86
!
DATA dft_full(15)%name / 'OPTB86B' /
DATA dft_full(15)%name2 / 'none' /
DATA dft_full(15)%IDs(1:6) / 1,4,24,1,0,0 / ! sla+pw+ob86+p86
!
DATA dft_full(16)%name / 'PBC' /
DATA dft_full(16)%name2 / 'none' /
DATA dft_full(16)%IDs(1:6) / 1,4,0,4,0,0 / ! sla+pw+pbc
!
DATA dft_full(17)%name / 'HCTH' /
DATA dft_full(17)%name2 / 'none' /
DATA dft_full(17)%IDs(1:6) / 0,0,5,5,0,0 / ! nox+noc+hcth+hcth
!
DATA dft_full(18)%name / 'OLYP' /
DATA dft_full(18)%name2 / 'none' /
DATA dft_full(18)%IDs(1:6) / 0,3,6,3,0,0 / ! nox+lyp+optx+blyp
!
DATA dft_full(19)%name / 'WC' /
DATA dft_full(19)%name2 / 'none' /
DATA dft_full(19)%IDs(1:6) / 1,4,11,4,0,0 / ! sla+pw+wcx+pbc
!
DATA dft_full(20)%name / 'PW86PBE' /
DATA dft_full(20)%name2 / 'none' /
DATA dft_full(20)%IDs(1:6) / 1,4,21,4,0,0 / ! sla+pw+pw86+pbc
!
DATA dft_full(21)%name / 'B86BPBE' /
DATA dft_full(21)%name2 / 'none' /
DATA dft_full(21)%IDs(1:6) / 1,4,22,4,0,0 / ! sla+pw+b86b+pbc
!
DATA dft_full(22)%name / 'PBEQ2D' /
DATA dft_full(22)%name2 / 'Q2D' /
DATA dft_full(22)%IDs(1:6) / 1,4,19,12,0,0 / ! sla+pw+q2dx+q2dc
!
DATA dft_full(23)%name / 'SOGGA' /
DATA dft_full(23)%name2 / 'none' /
DATA dft_full(23)%IDs(1:6) / 1,4,17,4,0,0 / ! sla+pw+sox+pbec
!
DATA dft_full(24)%name / 'EV93' /
DATA dft_full(24)%name2 / 'none' /
DATA dft_full(24)%IDs(1:6) / 1,4,25,0,0,0 / ! sla+pw+evx+nogc
!
DATA dft_full(25)%name / 'RPBE' /
DATA dft_full(25)%name2 / 'none' /
DATA dft_full(25)%IDs(1:6) / 1,4,44,4,0,0 / ! sla+pw+hhnx+pbc
!
DATA dft_full(26)%name / 'PBE0' /
DATA dft_full(26)%name2 / 'none' /
DATA dft_full(26)%IDs(1:6) / 6,4,8,4,0,0 / ! pb0x+pw+pb0x+pbc
!
DATA dft_full(27)%name / 'B86BPBEX' /
DATA dft_full(27)%name2 / 'none' /
DATA dft_full(27)%IDs(1:6) / 6,4,41,4,0,0 / ! sla+pw+b86x+pbc
!
DATA dft_full(28)%name / 'BHAHLYP' /
DATA dft_full(28)%name2 / 'BHANDHLYP' /
DATA dft_full(28)%IDs(1:6) / 6,4,42,3,0,0 / ! pb0x+pw+b88x+blyp
!
DATA dft_full(29)%name / 'HSE' /
DATA dft_full(29)%name2 / 'none' /
DATA dft_full(29)%IDs(1:6) / 1,4,12,4,0,0 / ! sla+pw+hse+pbc
! NOTE ABOUT HSE: there are two slight deviations with respect to the HSE06
! functional as it is in Gaussian code (that is considered as the reference
! in the chemistry community):
! - The range separation in Gaussian is precisely 0.11 bohr^-1,
! instead of 0.106 bohr^-1 in this implementation
! - The gradient scaling relation is a bit more complicated
! [ see: TM Henderson, AF Izmaylov, G Scalmani, and GE Scuseria,
! J. Chem. Phys. 131, 044108 (2009) ]
! These two modifications accounts only for a 1e-5 Ha difference for a
! single He atom. Info by Fabien Bruneval.
!----
DATA dft_full(30)%name / 'GAUP' /
DATA dft_full(30)%name2 / 'GAUPBE' /
DATA dft_full(30)%IDs(1:6) / 1,4,20,4,0,0 / ! sla+pw+gaup+pbc
!
DATA dft_full(31)%name / 'B3LYP' /
DATA dft_full(31)%name2 / 'none' /
DATA dft_full(31)%IDs(1:6) / 7,12,9,7,0,0 / ! b3lp+b3lp+b3lp+b3lp
!
DATA dft_full(32)%name / 'B3LYP-V1R' /
DATA dft_full(32)%name2 / 'none' /
DATA dft_full(32)%IDs(1:6) / 7,13,9,7,0,0 / ! b3lp+xxxx[b3lyp_v1r]+b3lp+b3lp
!
DATA dft_full(33)%name / 'X3LYP' /
DATA dft_full(33)%name2 / 'none' /
DATA dft_full(33)%IDs(1:6) / 9,14,28,13,0,0 / ! xxxx[x3lyp_ldax]+xxxx[x3lyp_ldac]+x3lp+x3lc
!
DATA dft_full(34)%name / 'TPSS' /
DATA dft_full(34)%name2 / 'none' /
DATA dft_full(34)%IDs(1:6) / 0,0,0,0,1,0 /
!
DATA dft_full(35)%name / 'M06L' /
DATA dft_full(35)%name2 / 'none' /
DATA dft_full(35)%IDs(1:6) / 0,0,0,0,2,0 /
!
DATA dft_full(36)%name / 'TB09' /
DATA dft_full(36)%name2 / 'none' /
DATA dft_full(36)%IDs(1:6) / 0,0,0,0,3,0 /
!
DATA dft_full(37)%name / 'SCAN' /
DATA dft_full(37)%name2 / 'none' /
DATA dft_full(37)%IDs(1:6) / 0,0,0,0,5,0 / ! scan[wrapper to Libxc SCAN]
!
DATA dft_full(38)%name / 'SCAN0' /
DATA dft_full(38)%name2 / 'none' /
DATA dft_full(38)%IDs(1:6) / 0,0,0,0,6,0 /
!
!
CONTAINS
!
!------------------------------------------------------------------
SUBROUTINE get_IDs_from_shortname( name, IDs )
!---------------------------------------------------------------
!! Get ID numbers of each family-kind term from the DFT shortname.
!
IMPLICIT NONE
!
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER, INTENT(INOUT) :: IDs(6)
INTEGER :: i
!
IDs = notset
DO i = 1, n_dft
IF (name==dft_full(i)%name .OR. name==dft_full(i)%name2) THEN
IDs(:) = dft_full(i)%IDs(:)
EXIT
ENDIF
ENDDO
!
RETURN
!
END SUBROUTINE
!
!------------------------------------------------------------------
SUBROUTINE get_shortname_from_IDs( IDs, name, id_full )
!---------------------------------------------------------------
!! Get the DFT shortname from ID numbers of each family-kind term.
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: IDs(6)
CHARACTER(LEN=*), INTENT(INOUT) :: name
INTEGER, INTENT(OUT), OPTIONAL :: id_full
INTEGER :: i
!
DO i = 1, n_dft
IF (ALL( IDs(:)==dft_full(i)%IDs(:) )) THEN
name = dft_full(i)%name
IF (PRESENT(id_full)) id_full = i
EXIT
ENDIF
ENDDO
!
RETURN
!
END SUBROUTINE
!
!
END MODULE

320
XClib/qe_dft_refs.f90 Normal file
View File

@ -0,0 +1,320 @@
!
! Copyright (C) 2021 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
!------------------------------------------------------------------------------------
MODULE qe_dft_refs
!----------------------------------------------------------------------------------
!! List of references and brief descriptions of available DFTs in QE internal library.
!
USE qe_dft_list, ONLY: nxc, ncc, ngcx, ngcc, nmeta, n_dft
!
SAVE
!
! -- single DFT terms (family-type)
CHARACTER(LEN=150) :: dft_LDAx_ref(0:nxc), dft_LDAc_ref(0:ncc), &
dft_GGAx_ref(0:ngcx), dft_GGAc_ref(0:ngcc), &
dft_MGGA_ref(0:nmeta)
! -- total DFTs
CHARACTER(LEN=100) :: dft_full_descr(n_dft)
!
! ---- LDA exchange ----
!
! NOX
DATA dft_LDAx_ref(0) / 'No LDA exchange.' /
! SLA
DATA dft_LDAx_ref(1) / '[Slater exchange - alpha=2/3]' /
! SL1
DATA dft_LDAx_ref(2) / '[Slater exchange - alpha=1.0]' /
! RXC
DATA dft_LDAx_ref(3) / '[Relativistic Slater]' /
! OEP
DATA dft_LDAx_ref(4) / '[Optimized Effective Potential]' /
! HF
DATA dft_LDAx_ref(5) / '[Hartree-Fock]' /
! PB0X (Slater*0.75+HF*0.25) for PBE0 and vdW-DF-cx0 and vdW-DF2-0 etc
DATA dft_LDAx_ref(6) / 'J.P.Perdew, M. Ernzerhof, K.Burke, JCP 105, 9982 (1996)' /
! B3LP (Slater*0.80+HF*0.20)
DATA dft_LDAx_ref(7) / 'P.J.Stephens, F.J.Devlin, C.F.Chabalowski, M.J.Frisch, &
&J.Phys.Chem 98, 11623 (1994)' /
! KZK Finite-size corrections
DATA dft_LDAx_ref(8) / 'H.Kwee, S. Zhang, H. Krakauer, PRL 100, 126404 (2008)' /
! xxxx [X3LYP_LDA]
DATA dft_GGAx_ref(9) / 'X. Xu, W.A Goddard III, PNAS 101, 2673 (2004)' /
! xxxx [KLI]
DATA dft_GGAx_ref(10) / 'KLI aproximation for exx - currently not implemented' /
!
!
! ---- LDA correlation ----
!
! NOC
DATA dft_LDAc_ref(0) / 'No LDA correlation.' /
! PZ
DATA dft_LDAc_ref(1) / 'J.P.Perdew and A.Zunger, PRB 23, 5048 (1981)' /
! VWN
DATA dft_LDAc_ref(2) / 'S.H.Vosko, L.Wilk, M.Nusair, Can.J.Phys. 58,1200(1980)' /
! LYP
DATA dft_LDAc_ref(3) / 'C.Lee, W.Yang, R.G.Parr, PRB 37, 785 (1988)' /
! PW
DATA dft_LDAc_ref(4) / 'J.P.Perdew and Y.Wang, PRB 45, 13244 (1992)' /
! WIG
DATA dft_LDAc_ref(5) / 'E.P.Wigner, Trans. Faraday Soc. 34, 67 (1938)' /
! HL
DATA dft_LDAc_ref(6) / 'L.Hedin and B.I.Lundqvist, J. Phys. C4, 2064 (1971)' /
! OBZ
DATA dft_LDAc_ref(7) / 'G.Ortiz and P.Ballone, PRB 50, 1391 (1994)' /
! OBW
DATA dft_LDAc_ref(8) / 'G.Ortiz and P.Ballone, PRB 50, 1391 (1994)' /
! GL
DATA dft_LDAc_ref(9) / 'O.Gunnarsson and B.I.Lundqvist, PRB 13, 4274 (1976)' /
! KZK
DATA dft_LDAc_ref(10) / 'H.Kwee, S. Zhang, H. Krakauer, PRL 100, 126404 (2008)' /
! xxxx [vwn1_rpa]
DATA dft_LDAc_ref(11) / 'vwn1_rpa' /
! B3LP
DATA dft_LDAc_ref(12) / 'P.J.Stephens, F.J.Devlin, C.F.Chabalowski, M.J.Frisch, &
&J.Phys.Chem 98, 11623 (1994)' /
! xxxx [B3LYP-V1R]
DATA dft_LDAc_ref(13) / 'B3LYP-V1R' /
! xxxx [X3LYP]
DATA dft_LDAc_ref(14) / 'X3LYP' /
!
!
! ---- GGA exchange ----
!
! NOGX
DATA dft_GGAx_ref(0) / 'No GGA exchange.' /
! B88
DATA dft_GGAx_ref(1) / 'A.D.Becke, PRA 38, 3098 (1988)' /
! GGX
DATA dft_GGAx_ref(2) / 'J.P.Perdew and Y. Wang, PRB 46, 6671 (1992)' /
! PBX
DATA dft_GGAx_ref(3) / 'J.P.Perdew, K.Burke, M.Ernzerhof, PRL 77, 3865 (1996)' /
! REVX
DATA dft_GGAx_ref(4) / 'Zhang and Yang, PRL 80, 890 (1998)' /
! HCTH
DATA dft_GGAx_ref(5) / 'Handy et al, JCP 109, 6264 (1998)' /
! OPTX
DATA dft_GGAx_ref(6) / 'Handy et al, JCP 116, 5411 (2002)' /
! void
DATA dft_GGAx_ref(7) / 'void' /
! PB0X
DATA dft_GGAx_ref(8) / 'J.P.Perdew, M. Ernzerhof, K.Burke, JCP 105, 9982 (1996)' /
! B3LP
DATA dft_GGAx_ref(9) / 'P.J. Stephens,F.J. Devlin,C.F. Chabalowski,M.J. Frisch, &
&J.Phys.Chem 98, 11623 (1994)' /
! PSX
DATA dft_GGAx_ref(10) / 'J.P. Perdew et al., PRL 100, 136406 (2008)' /
! WCX
DATA dft_GGAx_ref(11) / 'Z. Wu and R. E. Cohen, PRB 73, 235116 (2006)' /
! HSE
DATA dft_GGAx_ref(12) / 'Heyd, Scuseria, Ernzerhof, J. Chem. Phys. 118, 8207 (2003), &
&Heyd, Scuseria, Ernzerhof, J. Chem. Phys. 124, 219906 (2006)' /
! RW86
DATA dft_GGAx_ref(13) / 'Eamonn D. Murray et al, J. Chem. Theory Comput. 5, 2754 (2009)' /
! PBE
DATA dft_GGAx_ref(14) / 'J.P.Perdew, K.Burke, M.Ernzerhof, PRL 77, 3865 (1996)' /
! xxxx
DATA dft_GGAx_ref(15) / 'void' /
! C09X
DATA dft_GGAx_ref(16) / 'V. R. Cooper, Phys. Rev. B 81, 161104(R) (2010)' /
! SOX
DATA dft_GGAx_ref(17) / 'Y. Zhao and D. G. Truhlar, JCP 128, 184109 (2008)' /
! xxxx
DATA dft_GGAx_ref(18) / 'void' /
! Q2DX
DATA dft_GGAx_ref(19) / 'L. Chiodo et al., PRL 108, 126402 (2012)' /
! GAUP
DATA dft_GGAx_ref(20) / 'J.-W. Song, K. Yamashita, K. Hirao, JCP 135, 071103 (2011)' /
! PW86
DATA dft_GGAx_ref(21) / 'J.P.Perdew, PRB 33, 8800 (1986)' /
! B86B
DATA dft_GGAx_ref(22) / 'A.D.Becke, J.Chem.Phys. 85, 7184 (1986)' /
! OBK8
DATA dft_GGAx_ref(23) / 'Klimes et al, J. Phys. Cond. Matter, 22, 022201 (2010)' /
! OB86
DATA dft_GGAx_ref(24) / 'Klimes, Bowler, Michaelides, PRB 83, 195131 (2011)' /
! EVX
DATA dft_GGAx_ref(25) / 'Engel-Vosko, Phys. Rev. B 47, 13164 (1993)' /
! B86R
DATA dft_GGAx_ref(26) / 'I. Hamada, Phys. Rev. B 89, 121103(R) (2014)' /
! CX13
DATA dft_GGAx_ref(27) / 'K. Berland and P. Hyldgaard, PRB 89, 035412 (2014)' /
! X3LP
DATA dft_GGAx_ref(28) / 'X. Xu, W.A Goddard III, PNAS 101, 2673 (2004)' /
! CX0
DATA dft_GGAx_ref(29) / 'K. Berland, Y. Jiao, J.-H. Lee, T. Rangel, J. B. Neaton &
&and P. Hyldgaard, J. Chem. Phys. 146, 234106 (2017)' /
! R860
DATA dft_GGAx_ref(30) / 'rPW86+HF/4 (rw86-0) (for DF0) - no ref. available' /
! CX0P vdW-DF-cx+HF/5 (cx13-0p)
DATA dft_GGAx_ref(31) / 'Y. Jiao, E. Schröder and P. Hyldgaard, &
&J. Chem. Phys. 148, 194115 (2018)' /
! AHCX (reserved PH)
DATA dft_GGAx_ref(32) / 'vdW-DF-cx based not yet in use' /
! AHF2 (reserved PH)
DATA dft_GGAx_ref(33) / 'vdW-DF2 based not yet in use' /
! AHPB (reserved PH)
DATA dft_GGAx_ref(34) / 'PBE based not yet in use' /
! AHPS
DATA dft_GGAx_ref(35) / 'PBE-sol based not yet in use' /
! CX14 (reserved PH)
DATA dft_GGAx_ref(36) / 'no ref. available' /
! CX15 (reserved PH)
DATA dft_GGAx_ref(37) / 'no ref. available' /
! BR0
DATA dft_GGAx_ref(38) / 'vdW-DF2-b86r+HF/4 (b86r-0) - no ref. available' /
! CX16 (reserved PH)
DATA dft_GGAx_ref(39) / 'no ref. available' /
! C090
DATA dft_GGAx_ref(40) / 'vdW-DF-c09+HF/4 (c09-0) - no ref. available' /
! B86X
DATA dft_GGAx_ref(41) / '[B86B exchange * 0.75]' /
! B88X
DATA dft_GGAx_ref(42) / '[Becke88 exchange * 0.50]' /
! BEEX
DATA dft_GGAx_ref(43) / 'BEE exchange' /
! HHNX
DATA dft_GGAx_ref(44) / 'Hammer-Hansen-Norskov' /
! W31X vdW-DF3-opt1 exchange
DATA dft_GGAx_ref(45) / 'D. Chakraborty, K. Berland, and T. Thonhauser, JCTC 16, 5893 (2020)' /
! W32X vdW-DF3-opt2 exchange
DATA dft_GGAx_ref(46) / 'D. Chakraborty, K. Berland, and T. Thonhauser, JCTC 16, 5893 (2020)' /
!
!
! ---- GGA correlation ----
! NOGC
DATA dft_GGAc_ref(0) / 'No GGA correlation - default' /
! P86 Perdew86
DATA dft_GGAc_ref(1) / 'J.P.Perdew, PRB 33, 8822 (1986)' /
! GGC Perdew-Wang 91 corr.
DATA dft_GGAc_ref(2) / 'J.P.Perdew and Y. Wang, PRB 46, 6671 (1992)' /
! BLYP Lee-Yang-Parr
DATA dft_GGAc_ref(3) / 'C.Lee, W.Yang, R.G.Parr, PRB 37, 785 (1988)' /
! PBC Perdew-Burke-Ernzenhof corr.
DATA dft_GGAc_ref(4) / 'J.P.Perdew, K.Burke, M.Ernzerhof, PRL 77, 3865 (1996)' /
! HCTH Cambridge corr, Handy et al.
DATA dft_GGAc_ref(5) / 'Handy et al, JCP 109, 6264 (1998)' /
! xxxx
DATA dft_GGAc_ref(6) / 'void' /
! B3LP b3lyp (Lee-Yang-Parr*0.81)
DATA dft_GGAc_ref(7) / 'P.J. Stephens,F.J. Devlin,C.F. Chabalowski,M.J. Frisch, &
&J.Phys.Chem 98, 11623 (1994)' /
! PSC PBEsol corr
DATA dft_GGAc_ref(8) / 'J.P. Perdew et al., PRL 100, 136406 (2008)' /
! PBE same as PBX, back-compatibility
DATA dft_GGAc_ref(9) / 'J.P.Perdew, K.Burke, M.Ernzerhof, PRL 77, 3865 (1996)' /
! void
DATA dft_GGAc_ref(10) / 'void' /
! void
DATA dft_GGAc_ref(11) / 'void' /
! Q2DC correlation grad corr.
DATA dft_GGAc_ref(12) / 'L. Chiodo et al., PRL 108, 126402 (2012)' /
! X3LC (Lee-Yang-Parr*0.871)
DATA dft_GGAc_ref(13) / 'X. Xu, W.A Goddard III, PNAS 101, 2673 (2004)' /
! BEEC beef correlation
DATA dft_GGAc_ref(14) / 'BEEF correlation' /
!
!
! ---- MGGA (exchange+correlation) ----
!
! NONE
DATA dft_MGGA_ref(0) / 'No mGGA exchange.' /
! TPSS
DATA dft_MGGA_ref(1) / 'J.Tao, J.P.Perdew, V.N.Staroverov, G.E. Scuseria, PRL 91, 146401 (2003)' /
! M06L
DATA dft_MGGA_ref(2) / 'Y. Zhao and D. G. Truhlar, JCP 125, 194101 (2006)' /
! TB09
DATA dft_MGGA_ref(3) / 'F. Tran and P. Blaha, Phys.Rev.Lett. 102, 226401 (2009) - Libxc needed' /
! void
DATA dft_MGGA_ref(4) / 'void' /
! SCAN
DATA dft_MGGA_ref(5) / 'J Sun, A Ruzsinszky and J Perdew, PRL 115, 36402 (2015) - Libxc needed' /
! SCA0
DATA dft_MGGA_ref(6) / 'K Hui and J-D. Chai, JCP 144, 44114 (2016)' /
!
!
! ---- Full DFTs ----
!
! PZ / LDA
DATA dft_full_descr(1) / 'Perdew-Zunger LDA' /
! PW
DATA dft_full_descr(2) / 'LDA with PW correlation' /
! VWN-RPA
DATA dft_full_descr(3) / 'VWN LDA using vwn1-rpa parametrization' /
! OEP
DATA dft_full_descr(4) / 'Optimized Effective Potential. No GC part, no corr. by default' /
! KLI
DATA dft_full_descr(5) / 'KLI - currently not implemented' /
! HF
DATA dft_full_descr(6) / 'HF no GC part (nor LDA...) and no correlation by default' /
! PBE
DATA dft_full_descr(7) / 'Perdew-Burke-Ernzerhof GGA' /
! B88
DATA dft_full_descr(8) / 'Becke88 (beta=0.0042)' /
! BP
DATA dft_full_descr(9) / 'Becke-Perdew grad.corr.' /
! PW91
DATA dft_full_descr(10) / 'PW91 (aka GGA)' /
! REVPBE
DATA dft_full_descr(11) / 'revPBE (Zhang-Yang)' /
! PBESOL
DATA dft_full_descr(12) / 'PBEsol' /
! BLYP
DATA dft_full_descr(13) / 'Becke-Lee-Yang-Parr LDA+GGA' /
! OPTBK88
DATA dft_full_descr(14) / 'optB88' /
! OPTB86B
DATA dft_full_descr(15) / 'optB86' /
! PBC
DATA dft_full_descr(16) / 'PBC = PW + PBC' /
! HCTH
DATA dft_full_descr(17) / 'HCTH/120' /
! OLYP
DATA dft_full_descr(18) / 'OLYP = OPTX + LYP' /
! WC
DATA dft_full_descr(19) / 'Wu-Cohen' /
! PW86PBE
DATA dft_full_descr(20) / 'PW86 exchange + PBE correlation' /
! B86BPBE
DATA dft_full_descr(21) / 'B86b exchange + PBE correlation' /
! PBEQ2D
DATA dft_full_descr(22) / 'PBEQ2D' /
! SOGGA
DATA dft_full_descr(23) / 'SOGGA' /
! EV93
DATA dft_full_descr(24) / 'Engel-Vosko' /
! RPBE
DATA dft_full_descr(25) / 'RPBE' /
! PBE0
DATA dft_full_descr(26) / 'PBE0 in: Perdew, Ernzerhof, Burke, JCP 105, 9982 (1996)' /
! B86BPBEX
DATA dft_full_descr(27) / 'B86bPBE hybrid' /
! BHAHLYP
DATA dft_full_descr(28) / 'Becke half-and-half LYP' /
! HSE
DATA dft_full_descr(29) / 'Heyd-Scuseria-Ernzerhof (HSE 06, see references)' /
! GAUP / GAUPBE
DATA dft_full_descr(30) / 'Gau-PBE (also gaup)' /
! B3LYP
DATA dft_full_descr(31) / 'B3LYP' /
! B3LYP-V1R
DATA dft_full_descr(32) / 'B3LYP-VWN1-RPA' /
! X3LYP
DATA dft_full_descr(33) / 'X3LYP' /
! TPSS
DATA dft_full_descr(34) / 'TPSS Meta-GGA' /
! M06L
DATA dft_full_descr(35) / 'M06L Meta-GGA' /
! TB09
DATA dft_full_descr(36) / 'TB09 Meta-GGA - needs Libxc' /
! SCAN
DATA dft_full_descr(37) / 'SCAN Meta-GGA - needs Libxc.' /
! SCAN0
DATA dft_full_descr(38) / 'SCAN Meta-GGA - needs Libxc.' /
!
END MODULE qe_dft_refs

View File

@ -15,8 +15,8 @@ MODULE qe_drivers_d_gga
!! Module with QE driver routines that calculates the derivatives of XC
!! potential.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: igcx, igcc, is_libxc
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: igcx, igcc, is_libxc
!
IMPLICIT NONE
!

View File

@ -14,8 +14,8 @@ MODULE qe_drivers_d_lda_lsda
!-------------------------------------------------------------------------
!! Contains the routines to compute the derivative of the LDA XC potential.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: iexch, icorr, is_libxc
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: iexch, icorr, is_libxc
!
IMPLICIT NONE
!
@ -191,7 +191,7 @@ SUBROUTINE dmxc_lsda( length, rho_in, dmuxc )
!
!REAL(DP) :: dpz, dpz_polarized
!
INTEGER :: ir, is, iflg
INTEGER :: ir, iflg
INTEGER :: i1, i2, i3, i4
INTEGER :: f1, f2, f3, f4
INTEGER :: iexch_, icorr_
@ -223,19 +223,25 @@ SUBROUTINE dmxc_lsda( length, rho_in, dmuxc )
!
IF (rhotot(ir) < small) CYCLE
zeta_s = (rho_in(ir,1) - rho_in(ir,2)) / rhotot(ir)
IF (ABS(zeta_s) > 1.0_DP) CYCLE
IF (ABS(zeta_s) >= 1.0_DP) CYCLE
!
! ... exchange
!
rs = ( pi34 / (2.0_DP * rho_in(ir,1)) )**third
CALL slater( rs, ex_s, vx_s )
IF ( rho_in(ir,1)>small ) THEN
rs = ( pi34 / (2.0_DP * rho_in(ir,1)) )**third
CALL slater( rs, ex_s, vx_s )
dmuxc(ir,1,1) = vx_s / (3.0_DP * rho_in(ir,1))
ELSE
ex_s=0.d0 ; vx_s=0.d0
ENDIF
!
dmuxc(ir,1,1) = vx_s / (3.0_DP * rho_in(ir,1))
!
rs = ( pi34 / (2.0_DP * rho_in(ir,2)) )**third
CALL slater( rs, ex_s, vx_s )
!
dmuxc(ir,2,2) = vx_s / (3.0_DP * rho_in(ir,2))
IF ( rho_in(ir,2)>small ) THEN
rs = ( pi34 / (2.0_DP * rho_in(ir,2)) )**third
CALL slater( rs, ex_s, vx_s )
dmuxc(ir,2,2) = vx_s / (3.0_DP * rho_in(ir,2))
ELSE
ex_s=0.d0 ; vx_s=0.d0
ENDIF
!
! ... correlation
!
@ -267,7 +273,7 @@ SUBROUTINE dmxc_lsda( length, rho_in, dmuxc )
(zeta_s**2 - 1.0_DP) * cc
dmuxc(ir,1,2) = dmuxc(ir,2,1)
dmuxc(ir,2,2) = dmuxc(ir,2,2) + aa - (1.0_DP + zeta_s) * bb + &
(1.0_DP + zeta_s)**2 * cc
(1.0_DP + zeta_s)**2 * cc
ENDDO
!
ELSE
@ -289,8 +295,8 @@ SUBROUTINE dmxc_lsda( length, rho_in, dmuxc )
!
! ... THRESHOLD STUFF AND dr(:)
dr(:) = 0.0_DP
zeta(:) = 0.0_dp
zeta_eff(:) = 0.0_dp
zeta(:) = 0.0_DP
zeta_eff(:) = 0.0_DP
DO ir = 1, length
IF (rhotot(ir) > small) THEN
zeta_s = (rho_in(ir,1) - rho_in(ir,2)) / rhotot(ir)
@ -299,8 +305,8 @@ SUBROUTINE dmxc_lsda( length, rho_in, dmuxc )
! smaller zeta
zeta_eff(ir) = SIGN( MIN( ABS(zeta_s), (1.0_DP-2.0_DP*dz(ir)) ), zeta_s )
dr(ir) = MIN( 1.E-6_DP, 1.E-4_DP * rhotot(ir) )
IF (ABS(zeta_s) > 1.0_DP) THEN
rhotot(ir) = 0.d0 ; dr(ir) = 0.d0 ! e.g. vx=vc=0.0
IF (ABS(zeta_s) >= 1.0_DP) THEN
rhotot(ir) = 0._DP ; dr(ir) = 0._DP ! e.g. vx=vc=0.0
ENDIF
ENDIF
ENDDO

View File

@ -14,10 +14,11 @@ MODULE qe_drivers_gga
!----------------------------------------------------------------------
!! Contains the GGA drivers that calculate the XC energy and potential.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: igcx, igcc, rho_threshold_gga, grho_threshold_gga,&
exx_started, exx_fraction, screening_parameter, &
gau_parameter
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: igcx, igcc, rho_threshold_gga, &
grho_threshold_gga, exx_started, &
exx_fraction, screening_parameter, &
gau_parameter
!
IMPLICIT NONE
!
@ -40,7 +41,6 @@ SUBROUTINE gcxc( length, rho_in, grho_in, sx_out, sc_out, v1x_out, &
!
USE exch_gga
USE corr_gga
USE beef_interface, ONLY: beefx, beeflocalcorr
!
IMPLICIT NONE
!
@ -402,7 +402,6 @@ SUBROUTINE gcx_spin( length, rho_in, grho2_in, sx_tot, v1x_out, v2x_out )
!! Gradient corrections for exchange - Hartree a.u.
!
USE exch_gga
USE beef_interface, ONLY: beefx
!
IMPLICIT NONE
!
@ -421,7 +420,7 @@ SUBROUTINE gcx_spin( length, rho_in, grho2_in, sx_tot, v1x_out, v2x_out )
!
! ... local variables
!
INTEGER :: ir, is, iflag
INTEGER :: ir, iflag
REAL(DP) :: rho_up, rho_dw, grho2_up, grho2_dw
REAL(DP) :: v1x_up, v1x_dw, v2x_up, v2x_dw
REAL(DP) :: sx_up, sx_dw, rnull_up, rnull_dw
@ -821,7 +820,6 @@ SUBROUTINE gcx_spin( length, rho_in, grho2_in, sx_tot, v1x_out, v2x_out )
v2x_dw = (1.0_DP - exx_fraction) * v2x_dw
ENDIF
!
!
! case igcx == 5 (HCTH) and 6 (OPTX) not implemented
! case igcx == 7 (meta-GGA) must be treated in a separate call to another
! routine: needs kinetic energy density in addition to rho and grad rho
@ -860,7 +858,6 @@ SUBROUTINE gcc_spin( length, rho_in, zeta_io, grho_in, sc_out, v1c_out, v2c_out
!! Implemented: Perdew86, GGA (PW91), PBE
!
USE corr_gga
USE beef_interface, ONLY: beeflocalcorrspin
!
IMPLICIT NONE
!
@ -1183,12 +1180,10 @@ SUBROUTINE gcx_spin_beef( length, rho_in, grho2_in, sx_tot, v1x_out, v2x_out )
!
! ... local variables
!
INTEGER :: ir, is, iflag
INTEGER :: ir
REAL(DP) :: rho_up, rho_dw, grho2_up, grho2_dw
REAL(DP) :: v1x_up, v1x_dw, v2x_up, v2x_dw
REAL(DP) :: sx_up, sx_dw, rnull_up, rnull_dw
REAL(DP) :: sxsr_up, sxsr_dw
REAL(DP) :: v1xsr_up, v1xsr_dw, v2xsr_up, v2xsr_dw
!
REAL(DP), PARAMETER :: small=1.D-10
REAL(DP), PARAMETER :: rho_trash=0.5_DP, grho2_trash=0.2_DP

View File

@ -14,9 +14,9 @@ MODULE qe_drivers_lda_lsda
!-----------------------------------------------------------------------
!! Contains the LDA drivers of QE that calculate XC energy and potential.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: iexch, icorr, rho_threshold_lda, exx_started, &
exx_fraction, finite_size_cell_volume
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: iexch, icorr, rho_threshold_lda, exx_started, &
exx_fraction, finite_size_cell_volume
USE exch_lda
USE corr_lda
!

View File

@ -14,9 +14,9 @@ MODULE qe_drivers_mgga
!------------------------------------------------------------------------
!! Contains the mGGA drivers of QE that calculate XC energy and potential.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: imeta, imetac, rho_threshold_mgga, grho2_threshold_mgga,&
tau_threshold_mgga
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: imeta, imetac, rho_threshold_mgga, &
grho2_threshold_mgga, tau_threshold_mgga
USE metagga
!
IMPLICIT NONE
@ -79,6 +79,9 @@ SUBROUTINE tau_xc( length, rho, grho2, tau, ex, ec, v1x, v2x, v3x, v1c, v2c, v3c
IF ( (arho<=rho_threshold_mgga).OR.(grho2(k)<=grho2_threshold_mgga).OR. &
(ABS(tau(k))<=rho_threshold_mgga) ) CYCLE
!
! ...libxc-like threshold management
!grho2(k) = MIN( grho2(k), (8.d0*rho(k)*tau(k))**2 )
!
SELECT CASE( imeta )
CASE( 1 )
!
@ -140,21 +143,22 @@ SUBROUTINE tau_xc_spin( length, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1c, v2c,
!
! ... local variables
!
INTEGER :: k, ipol
INTEGER :: k
REAL(DP) :: rh, zeta, atau, grho2(2), ggrho2
REAL(DP) :: v2cup, v2cdw
!
ex=0.0_DP ; v1x=0.0_DP ; v2x=0.0_DP ; v3x=0.0_DP
ec=0.0_DP ; v1c=0.0_DP ; v2c=0.0_DP ; v3c=0.0_DP
!
! FIXME: for SCAN, this will be calculated later
!
DO k = 1, length
!
rh = rho(k,1) + rho(k,2)
atau = tau(k,1) + tau(k,2) ! KE-density in Hartree
grho2(1) = SUM( grho(:,k,1)**2 )
grho2(2) = SUM( grho(:,k,2)**2 )
! ...libxc-like threshold management
!grho2(1) = MIN( SUM(grho(:,k,1)**2), (8.d0*rho(k,1)*tau(k,1))**2 )
!grho2(2) = MIN( SUM(grho(:,k,2)**2), (8.d0*rho(k,2)*tau(k,2))**2 )
grho2(1) = SUM(grho(:,k,1)**2)
grho2(2) = SUM(grho(:,k,2)**2)
ggrho2 = ( grho2(1) + grho2(2) ) * 4.0_DP
!
IF ( (rh <= rho_threshold_mgga).OR.(ggrho2 <= grho2_threshold_mgga).OR.&

View File

@ -629,7 +629,7 @@ SUBROUTINE cpbe2d( rho, grho, sc, v1c, v2c )
REAL(DP), PARAMETER :: ex3=ex2+1.0_DP
REAL(DP) :: fac1, fac2, zeta, phi, gr, rs, drsdn, akf, aks, t, dtdn, dtdgr
REAL(DP) :: p, a, g, alpha1, beta1,beta2,beta3,beta4, dgdrs, epsc, depscdrs
REAL(DP) :: c, gamma1, beta, aa, cg, adddepsc, h, dhdaa, dhdt, dhdrs
REAL(DP) :: c, gamma1, beta, aa, cg, h, dhdaa, dhdt, dhdrs
REAL(DP) :: epscpbe, depscpbedrs, depscpbedt, a0,a1,a2, b0,b1,b2, c0,c1,c2
REAL(DP) :: e0,e1,e2, f0,f1,f2, g0,g1,g2, h0,h1,h2, d0,d1,d2, ff, dffdt
REAL(DP) :: rs3d, rs2d, drs2ddrs3d, eps2d, deps2ddrs2, depsGGAdrs, depsGGAdt

View File

@ -143,7 +143,7 @@ SUBROUTINE pbex( rho, grho, iflag, sx, v1x, v2x )
! exchange energy gradient part
! auxiliary variable for energy calculation
REAL(DP) :: dxunif, dfx, f1, f2, f3, dfx1
REAL(DP) :: p, amu, ab, c, dfxdp, dfxds, upbe, uge, s, ak, aa
REAL(DP) :: p, amu, ab, c, dfxdp, dfxds, s, ak
! numerical coefficients (NB: c2=(3 pi^2)^(1/3) )
REAL(DP), PARAMETER :: pi=3.14159265358979323846d0
REAL(DP), PARAMETER :: third=1._DP/3._DP, c1=0.75_DP/pi, &
@ -1241,7 +1241,7 @@ SUBROUTINE becke88_spin( rho_up, rho_dw, grho_up, grho_dw, sx_up, sx_dw, v1x_up,
!
! ... local variables
!
INTEGER :: is
!INTEGER :: is
REAL(DP), PARAMETER :: beta = 0.0042_DP, third = 1._DP/3._DP
REAL(DP) :: rho13, rho43, xs, xs2, sa2b8, shm1, dd, dd2, ee
!
@ -1322,7 +1322,6 @@ SUBROUTINE wpbe_analy_erfc_approx_grad( rho, s, omega, Fx_wpbe, d1rfx, d1sfx )
REAL(DP) DHsbw,DHsbw2,DHsbw3,DHsbw4,DHsbw5
REAL(DP) DHsbw12,DHsbw32,DHsbw52,DHsbw72,DHsbw92
REAL(DP) d1sHsbw,d1rHsbw
REAL(DP) d1sDHsbw,d1rDHsbw
REAL(DP) HsbwA94,HsbwA9412
REAL(DP) HsbwA942,HsbwA943,HsbwA945
REAL(DP) piexperf,expei
@ -1352,9 +1351,6 @@ SUBROUTINE wpbe_analy_erfc_approx_grad( rho, s, omega, Fx_wpbe, d1rfx, d1sfx )
!
REAL(DP) term1,term2,term3,term4,term5
!
REAL(DP) ax,um,uk,ul
REAL(DP) gc1,gc2
!
! REAL(DP) ei
!
REAL(DP) Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten

View File

@ -267,9 +267,7 @@ SUBROUTINE metac( rho, grho2, tau, ec, v1c, v2c, v3c ) !<GPU:
cf3 = cf3*rho
v2c = cf2*d2rev + cf3*2.0_DP/grho2
v3c = cf2*d3rev - cf3/tau
!
ec = rho*ec_rev*(1.0_DP+dd*ec_rev*z2*z) !-rho*ec_unif(1)
!v1c = v1c - vc_unif(1)
!
RETURN
!
@ -865,8 +863,8 @@ END SUBROUTINE metac_spin
!
! input: - rho
! - grho2=|\nabla rho|^2
! - tau = the kinetic energy density
! It is defined as summ_i( |nabla phi_i|**2 )
! - tau = the input kinetic energy density
! It is defined as 0.5summ_i( |nabla phi_i|**2 )
!
! definition: E_x = \int ex dr
!
@ -923,18 +921,20 @@ SUBROUTINE m06lxc( rho, grho2, tau, ex, ec, v1x, v2x, v3x, v1c, v2c, v3c )
!
taua = tau * two * 0.5_dp ! Taua, which is Tau_sigma is half Tau
taub = taua ! Tau is defined as summ_i( |nabla phi_i|**2 )
! in the M06L routine
! in the following M06L routines
!
CALL m06lx( rhoa, grho2a, taua, ex, v1x, v2x, v3x ) !<GPU:m06lx=>m06lx_d>
!
ex = two * ex ! Add the two components up + dw
!
v2x = 0.5_dp * v2x
!v3x = 2.0_dp * v3x !**mismatch with Libxc by a factor of 2
!
CALL m06lc( rhoa, rhob, grho2a, grho2b, taua, taub, ec, v1c, v2c, v3c, & !<GPU:m06lc=>m06lc_d>
v1cb, v2cb, v3cb )
!
v2c = 0.5_dp * v2c
!v3c = 2.0_dp * v3c !**
!
END SUBROUTINE m06lxc
!
@ -963,9 +963,13 @@ SUBROUTINE m06lxc_spin( rhoup, rhodw, grhoup2, grhodw2, tauup, taudw, &
CALL m06lx( rhodw, grhodw2, taub, exdw, v1xdw, v2xdw, v3xdw ) !<GPU:m06lx=>m06lx_d>
!
ex = exup + exdw
!v3xup = 2.0_dp * v3xup !**mismatch with Libxc by a factor of 2
!v3xdw = 2.0_dp * v3xdw !**
!
CALL m06lc( rhoup, rhodw, grhoup2, grhodw2, taua, taub, & !<GPU:m06lc=>m06lc_d>
ec, v1cup, v2cup, v3cup, v1cdw, v2cdw, v3cdw )
!v3cup = 2.0_dp * v3cup !**
!v3cdw = 2.0_dp * v3cdw !**
!
END SUBROUTINE m06lxc_spin
! !
@ -1018,7 +1022,7 @@ SUBROUTINE m06lx( rho, grho2, tau, ex, v1x, v2x, v3x ) !<GPU:DEVICE>
REAL(DP) :: xs, xs2, grho, rhom83, rho13, rho43, zs, gh
REAL(DP) :: hg, dhg_dxs2, dhg_dzs
REAL(DP) :: dxs2_drho, dxs2_dgrho2, dzs_drho, dzs_dtau
REAL(DP) :: ex_vs98, v1x_vs98, v2x_vs98, v3x_vs98, v2x_vs98_g
REAL(DP) :: ex_vs98, v1x_vs98, v2x_vs98, v3x_vs98
!
! GGA and MGGA variables
!
@ -1164,7 +1168,6 @@ SUBROUTINE pbex_m06l( rho, grho2, sx, v1x, v2x ) !<GPU:DEVICE>
!
! ... local variables
!
INTEGER :: iflag
REAL(DP) :: grho, rho43, xs, xs2, dxs2_drho, dxs2_dgrho2
REAL(DP) :: CX, denom, C1, C2, ex, Fx, dFx_dxs2, dex_drho
!
@ -1261,7 +1264,7 @@ SUBROUTINE m06lc( rhoa, rhob, grho2a, grho2b, taua, taub, ec, v1c_up, v2c_up, &
!
REAL(DP), DIMENSION(0:4):: cs, cab
!
REAL(DP) :: ds0, ds1, ds2, ds3, ds4, ds5, CF, alpha, Ds, &
REAL(DP) :: ds0, ds1, ds2, ds3, ds4, ds5, CF, &
dab0, dab1, dab2, dab3, dab4, dab5, gama_ab, gama_s, &
alpha_s, alpha_ab
!
@ -1269,7 +1272,7 @@ SUBROUTINE m06lc( rhoa, rhob, grho2a, grho2b, taua, taub, ec, v1c_up, v2c_up, &
!
REAL(DP) :: ec_pw_a, ec_pw_b, ec_pw_ab
!
REAL(DP) :: vv, vc_pw_a, vc_pw_b, vc_pw_ab, vc_pw_up, vc_pw_dw, Ecaa, Ecbb, Ecab, &
REAL(DP) :: vv, vc_pw_a, vc_pw_b, vc_pw_up, vc_pw_dw, Ecaa, Ecbb, Ecab, &
Ec_UEG_ab, Ec_UEG_aa, Ec_UEG_bb, decab_drhoa, decab_drhob, &
v1_ab_up, v1_ab_dw, v2_ab_up, v2_ab_dw, v3_ab_up, v3_ab_dw, &
v1_aa_up, v2_aa_up, v3_aa_up, v1_bb_dw, v2_bb_dw, v3_bb_dw
@ -1331,6 +1334,14 @@ SUBROUTINE m06lc( rhoa, rhob, grho2a, grho2b, taua, taub, ec, v1c_up, v2c_up, &
v1_aa_up = zero
v2_aa_up = zero
v3_aa_up = zero
ec_pw_a = zero
vc_pw_a = zero
xs2a = zero
zsa = zero
dxs2a_drhoa = zero
dxs2a_dgrhoa2 = zero
dzsa_drhoa = zero
dzsa_dtaua = zero
!
ELSE
!
@ -1380,12 +1391,20 @@ SUBROUTINE m06lc( rhoa, rhob, grho2a, grho2b, taua, taub, ec, v1c_up, v2c_up, &
!
! ... Ecbb
!
IF (rhob < small .AND. taub < small) THEN
IF (rhob < small .OR. taub < small) THEN
!
Ecbb = zero
v1_bb_dw = zero
v2_bb_dw = zero
v3_bb_dw = zero
ec_pw_b = zero
vc_pw_b = zero
xs2b = zero
zsb = zero
dxs2b_drhob = zero
dxs2b_dgrhob2 = zero
dzsb_drhob = zero
dzsb_dtaub = zero
!
ELSE
!

View File

@ -1,8 +0,0 @@
&INPUT_NAMELIST
test='dft-comparison',
nspin=2,
family='LDA',
DF_OK=.FALSE.,
dft1='sla pz',
dft2='lda_x lda_c_pz'
/

View File

@ -1,4 +0,0 @@
&INPUT_NAMELIST
test='dft-info'
dft1='mgga_x_scan mgga_c_scan'
/

View File

@ -0,0 +1,9 @@
&INPUT_NAMELIST
test='execute'
filename_xml='xctest_data.xml'
dft='all_terms'
family= ''
polarization='both'
xc_derivative=.FALSE.
show_time=.TRUE.
/

View File

@ -0,0 +1,8 @@
&INPUT_NAMELIST
test='generate'
filename_xml='xctest_data.xml'
dft='all_terms'
family= ''
polarization= 'both'
xc_derivative=.FALSE.
/

289
XClib/xc_infos.f90 Normal file
View File

@ -0,0 +1,289 @@
!
! Copyright (C) 2021 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
!============================================================================
!============================================================================
PROGRAM xc_infos
!==========================================================================
!! Provides infos on the input DFTs (both QE and Libxc).
!
! --- To be run on a single processor ---
!
USE kind_l, ONLY: DP
USE xc_lib, ONLY: xclib_set_dft_from_name, xclib_get_ID, &
xclib_dft_is_libxc, xclib_init_libxc, &
xclib_finalize_libxc, xclib_set_auxiliary_flags
USE qe_dft_list
USE qe_dft_refs
USE dft_setting_params, ONLY: ishybrid, exx_fraction, screening_parameter, &
gau_parameter
USE xclib_utils_and_para, ONLY: stdout, nowarning
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_setting_params, ONLY: xc_info, xc_kind_error, n_ext_params, &
par_list, libxc_flags
#endif
!
IMPLICIT NONE
!
CHARACTER(LEN=120) :: lxc_kind, lxc_family
CHARACTER(LEN=150) :: dft_r
CHARACTER(LEN=10) :: dft_n
INTEGER :: n_ext, id(6), idfull
INTEGER :: i, ii
#if defined(__LIBXC)
#if (XC_MAJOR_VERSION>5)
!workaround to keep compatibility with libxc develop version
INTEGER, PARAMETER :: XC_FAMILY_HYB_GGA = -10
INTEGER, PARAMETER :: XC_FAMILY_HYB_MGGA = -11
#endif
#endif
!
!-------- Input var -----------------------
CHARACTER(LEN=80) :: dft
!
!---------- DFT infos -------------------------
INTEGER :: iexch, icorr, igcx, igcc, imeta, imetac, idx
LOGICAL :: is_libxc(6)
CHARACTER(LEN=80) :: name_check
!
dft = 'none'
!
WRITE (*,'(/,1x,a)', ADVANCE='no') "Insert DFT name: "
READ(*,'(A)') dft
!
!==========================================================================
! PRINT DFT INFOS
!==========================================================================
!
nowarning = .TRUE.
!
CALL xclib_set_dft_from_name( dft )
!
#if defined(__LIBXC)
IF ( xc_kind_error ) WRITE(stdout,*) 'WARNING: This functional includes Libxc &
&terms that are currently not usable in &
&QE (kinetic) and they will be ignored.'
#endif
!
iexch = xclib_get_ID('LDA','EXCH')
is_libxc(1) = xclib_dft_is_libxc('LDA','EXCH')
icorr = xclib_get_ID('LDA','CORR')
is_libxc(2) = xclib_dft_is_libxc('LDA','CORR')
igcx = xclib_get_ID('GGA','EXCH')
is_libxc(3) = xclib_dft_is_libxc('GGA','EXCH')
igcc = xclib_get_ID('GGA','CORR')
is_libxc(4) = xclib_dft_is_libxc('GGA','CORR')
imeta = xclib_get_ID('MGGA','EXCH')
is_libxc(5) = xclib_dft_is_libxc('MGGA','EXCH')
imetac = xclib_get_ID('MGGA','CORR')
is_libxc(6) = xclib_dft_is_libxc('MGGA','CORR')
!
id(1) = iexch ; id(2) = icorr
id(3) = igcx ; id(4) = igcc
id(5) = imeta ; id(6) = imetac
!
name_check = 'noshortname'
CALL get_shortname_from_IDs( id, name_check, idfull )
!
WRITE(stdout,*) " "
WRITE(stdout,*) "=================================== "//CHAR(10)//" "
!
IF (TRIM(name_check)/='noshortname') THEN
WRITE(stdout,*) dft_full_descr(idfull)
WRITE(stdout,*) CHAR(10)
ENDIF
!
WRITE(stdout,*) "The selected XC functional is a composition of the &
&following terms:"
WRITE(stdout,*) CHAR(10)//"LDA"
WRITE(stdout,121) iexch, TRIM(xc_library(is_libxc(1),iexch)), &
icorr, TRIM(xc_library(is_libxc(2),icorr))
WRITE(stdout,*) CHAR(10)//"GGA"
WRITE(stdout,121) igcx, TRIM(xc_library(is_libxc(3),igcx)), &
igcc, TRIM(xc_library(is_libxc(4),igcc))
WRITE(stdout,*) CHAR(10)//"MGGA"
WRITE(stdout,121) imeta, TRIM(xc_library(is_libxc(5),imeta)), &
imetac,TRIM(xc_library(is_libxc(6),imetac))
WRITE(stdout,*) " "
WRITE(stdout,*) "============== "
!
#if defined(__LIBXC)
IF (xclib_dft_is_libxc('ANY')) CALL xclib_init_libxc( 1, .FALSE. )
#endif
!
CALL xclib_set_auxiliary_flags( .FALSE. )
!
DO i = 1, 6
idx = id(i)
!
IF (.NOT.is_libxc(i) .AND. idx/=0) THEN
!
SELECT CASE( i )
CASE( 1 )
WRITE(lxc_kind, '(a)') 'EXCHANGE'
WRITE(lxc_family,'(a)') "LDA"
dft_n = dft_LDAx_name(idx)
dft_r = dft_LDAx_ref(idx)
CASE( 2 )
WRITE(lxc_kind, '(a)') 'CORRELATION'
WRITE(lxc_family,'(a)') "LDA"
dft_n = dft_LDAc_name(idx)
dft_r = dft_LDAc_ref(idx)
CASE( 3 )
WRITE(lxc_kind, '(a)') 'EXCHANGE'
IF (ishybrid) WRITE(lxc_family,'(a)') "Hybrid GGA"
IF (.NOT. ishybrid) WRITE(lxc_family,'(a)') "GGA"
dft_n = dft_GGAx_name(idx)
dft_r = dft_GGAx_ref(idx)
CASE( 4 )
WRITE(lxc_kind, '(a)') 'CORRELATION'
IF (ishybrid) WRITE(lxc_family,'(a)') "Hybrid GGA"
IF (.NOT. ishybrid) WRITE(lxc_family,'(a)') "GGA"
dft_n = dft_GGAc_name(idx)
dft_r = dft_GGAc_ref(idx)
CASE( 5 )
WRITE(lxc_kind, '(a)') 'EXCHANGE+CORRELATION'
IF (ishybrid) WRITE(lxc_family,'(a)') "Hybrid MGGA"
IF (.NOT. ishybrid) WRITE(lxc_family,'(a)') "MGGA"
dft_n = dft_MGGA_name(idx)
dft_r = dft_MGGA_ref(idx)
END SELECT
!
WRITE(stdout,*) CHAR(10)
WRITE(*,'(i1,". Functional with ID:", i3 )') i, idx
WRITE(stdout, '(" - Name: ",a)') TRIM(dft_n)
WRITE(stdout, '(" - Family: ",a)') TRIM(lxc_family)
WRITE(stdout, '(" - Kind: ",a)') TRIM(lxc_kind)
n_ext = 0
IF ( ishybrid .OR. (i==3 .AND. idx==12) .OR. (i==3 .AND. idx==20) ) n_ext = 1
IF ( n_ext/=0 ) THEN
WRITE(stdout, '(" - External parameters:")')
IF ( ishybrid ) WRITE(stdout,*) ' exx_fraction (default)= ', exx_fraction
IF ( i==3 .AND. idx==12 ) WRITE(stdout,*) ' screening_parameter (default)= ',&
screening_parameter
IF ( i==3 .AND. idx==20 ) WRITE(stdout,*) ' gau_parameter (default)= ', &
gau_parameter
ELSE
WRITE(stdout, '(" - External parameters: NONE")')
ENDIF
WRITE(stdout, '(" - Reference(s):")')
WRITE(*,'(a,i1,2a)') ' [',1,'] ', TRIM(dft_r)
!
#if defined(__LIBXC)
!
ELSEIF (is_libxc(i)) THEN
!
SELECT CASE( xc_f03_func_info_get_kind(xc_info(i)) )
CASE( XC_EXCHANGE )
WRITE(lxc_kind, '(a)') 'EXCHANGE'
CASE( XC_CORRELATION )
WRITE(lxc_kind, '(a)') 'CORRELATION'
CASE( XC_EXCHANGE_CORRELATION )
WRITE(lxc_kind, '(a)') 'EXCHANGE+CORRELATION'
CASE( XC_KINETIC )
WRITE(lxc_kind, '(a)') 'KINETIC ENERGY FUNCTIONAL - currently not available&
&in QE.'
CASE DEFAULT
WRITE(lxc_kind, '(a)') 'UNKNOWN'
END SELECT
!
SELECT CASE( xc_f03_func_info_get_family(xc_info(i)) )
CASE( XC_FAMILY_LDA )
WRITE(lxc_family,'(a)') "LDA"
CASE( XC_FAMILY_GGA )
WRITE(lxc_family,'(a)') "GGA"
CASE( XC_FAMILY_HYB_GGA )
WRITE(lxc_family,'(a)') "Hybrid GGA"
CASE( XC_FAMILY_MGGA )
WRITE(lxc_family,'(a)') "MGGA"
CASE( XC_FAMILY_HYB_MGGA )
WRITE(lxc_family,'(a)') "Hybrid MGGA"
CASE DEFAULT
WRITE(lxc_family,'(a)') "UNKNOWN"
END SELECT
!
WRITE(stdout,*) CHAR(10)
WRITE(*,'(i1,". Functional with ID: ", i3 )') i, idx
WRITE(stdout, '(" - Name: ",a)') TRIM(xc_f03_func_info_get_name(xc_info(i)))
WRITE(stdout, '(" - Family: ",a)') TRIM(lxc_family)
WRITE(stdout, '(" - Kind: ",a)') TRIM(lxc_kind)
!
IF ( n_ext_params(i)/=0 ) THEN
WRITE(stdout, '(" - External parameters: ",i3)') n_ext_params(i)
DO ii = 0, n_ext_params(i)-1
WRITE(stdout, '(" ",i3,") ",a)') ii,&
TRIM(xc_f03_func_info_get_ext_params_description(xc_info(i), ii))
WRITE(stdout,*) ' Default value: ', par_list(i,ii+1)
ENDDO
ELSE
WRITE(stdout, '(" - External parameters: NONE")')
ENDIF
!
WRITE(stdout, '(" - Special warnings: ")')
IF ( libxc_flags(i,0) == 0 ) THEN
WRITE(stdout,'(4X,"[w00] libxc functional with ID ",I4," does not ",&
&/4X,"provide Exc.")' ) idx
ELSEIF ( libxc_flags(i,1) == 0 ) THEN
WRITE(stdout,'(4X,"[w01] libxc functional with ID ",I4," does not ",&
&/4X,"provide Vxc.")' ) idx
ELSEIF ( libxc_flags(i,2) == 0 ) THEN
WRITE(stdout,'(4X,"[w02] libxc functional with ID ",I4," does not ", &
&/4X,"provide Vxc derivative.")' ) idx
ELSEIF ( libxc_flags(i,15) == 1 ) THEN
WRITE(stdout,'(4X,"[w15] libxc functional with ID ",I4," depends on", &
&/4X," the laplacian of the density, which is currently set",&
&/4X," to zero.")' ) idx
ELSE
WRITE(stdout, '(4X,"NONE")')
ENDIF
!
WRITE(stdout, '(" - Reference(s):")')
ii = 0
DO WHILE( ii >= 0 )
WRITE(*,'(a,i1,2a)') ' [',ii+1,'] ',TRIM(xc_f03_func_reference_get_ref( &
xc_f03_func_info_get_references(xc_info(i), ii)))
ENDDO
#endif
!
ENDIF
ENDDO
!
#if defined(__LIBXC)
IF (xclib_dft_is_libxc('ANY')) CALL xclib_finalize_libxc()
#endif
!
WRITE(stdout,*) CHAR(10)//" "
!
121 FORMAT( 'Exchange ID: ', i3, ', Library: ', a, ' ; Correlation ID: ', i3, ', Library: ',a )
!
STOP
!
CONTAINS
!
CHARACTER(11) FUNCTION xc_library( islibxc, idxc )
!
LOGICAL, INTENT(IN) :: islibxc
INTEGER, INTENT(IN) :: idxc
!
xc_library = ''
IF (idxc /= 0) THEN
IF ( islibxc ) THEN
xc_library = 'Libxc'
ELSE
xc_library = 'QE_internal'
ENDIF
ELSE
xc_library = 'none'
ENDIF
!
RETURN
!
END FUNCTION
!
END PROGRAM xc_infos

View File

@ -10,7 +10,7 @@ MODULE xc_lib
!----------------------------------------------------
!! Interface module for \(\texttt{xc_lib}\) library.
!
USE dft_mod
USE dft_setting_routines
!
IMPLICIT NONE
!

View File

@ -15,15 +15,15 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!! Wrapper routine. Calls dgcx-driver routines from internal libraries
!! or from the external libxc, depending on the input choice.
!
USE constants_l, ONLY: e2
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: igcx, igcc, is_libxc, rho_threshold_gga, &
grho_threshold_gga
USE constants_l, ONLY: e2
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: igcx, igcc, is_libxc, rho_threshold_gga, &
grho_threshold_gga, rho_threshold_lda
USE qe_drivers_d_gga
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_par_mod, ONLY: xc_func, xc_info
USE dft_setting_params, ONLY: xc_func, xc_info
#endif
!
IMPLICIT NONE
@ -45,8 +45,8 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
REAL(DP), ALLOCATABLE :: vrrc(:,:), vsrc(:,:), vssc(:), vrzc(:,:)
!
#if defined(__LIBXC)
INTEGER :: fkind
REAL(DP), ALLOCATABLE :: rho_lbxc(:)
INTEGER :: fkind=-10
REAL(DP), ALLOCATABLE :: rho_lxc(:)
REAL(DP), ALLOCATABLE :: v2rho2_x(:), v2rhosigma_x(:), v2sigma2_x(:)
REAL(DP), ALLOCATABLE :: v2rho2_c(:), v2rhosigma_c(:), v2sigma2_c(:)
#if (XC_MAJOR_VERSION > 4)
@ -56,11 +56,12 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
#endif
#endif
!
INTEGER :: k, ir, length_lxc, length_dlxc
INTEGER :: k, length_dlxc
REAL(DP) :: rht, zeta
LOGICAL :: thr_dw_cond, thr_up_cond
REAL(DP), ALLOCATABLE :: sigma(:)
REAL(DP), PARAMETER :: small = 1.E-10_DP, rho_trash = 0.5_DP
REAL(DP), PARAMETER :: epsr=1.0d-6, epsg=1.0d-10
REAL(DP), PARAMETER :: epsr=1.0d-6, epsg=1.0d-6
!
IF ( ANY(.NOT.is_libxc(3:4)) ) THEN
rho_threshold_gga = small ; grho_threshold_gga = small
@ -72,26 +73,25 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
lengthxc = length
!
length_lxc = length*sp
length_dlxc = length
IF (sp == 2) length_dlxc = length*3
!
ALLOCATE( rho_lbxc(length_lxc), sigma(length_dlxc) )
ALLOCATE( rho_lxc(length*sp), sigma(length_dlxc) )
!
! ... set libxc input
SELECT CASE( sp )
CASE( 1 )
!
DO k = 1, length
rho_lbxc(k) = r_in(k,1)
rho_lxc(k) = r_in(k,1)
sigma(k) = g_in(k,1,1)**2 + g_in(k,2,1)**2 + g_in(k,3,1)**2
ENDDO
!
CASE( 2 )
!
DO k = 1, length
rho_lbxc(2*k-1) = r_in(k,1)
rho_lbxc(2*k) = r_in(k,2)
rho_lxc(2*k-1) = r_in(k,1)
rho_lxc(2*k) = r_in(k,2)
!
sigma(3*k-2) = g_in(k,1,1)**2 + g_in(k,2,1)**2 + g_in(k,3,1)**2
sigma(3*k-1) = g_in(k,1,1) * g_in(k,1,2) + g_in(k,2,1) * g_in(k,2,2) + &
@ -112,13 +112,15 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
ENDIF
!
!
IF ( is_libxc(3) ) THEN
ALLOCATE( v2rho2_x(length_dlxc), v2rhosigma_x(length_dlxc*sp), &
v2sigma2_x(length_dlxc*sp) )
! ... DERIVATIVE FOR EXCHANGE
v2rho2_x = 0._DP ; v2rhosigma_x = 0._DP ; v2sigma2_x = 0._DP
IF (igcx /= 0) THEN
CALL xc_f03_gga_fxc( xc_func(3), lengthxc, rho_lbxc(1), sigma(1), v2rho2_x(1), &
IF (igcx /= 0) THEN
CALL xc_f03_func_set_dens_threshold( xc_func(3), epsr )
CALL xc_f03_gga_fxc( xc_func(3), lengthxc, rho_lxc(1), sigma(1), v2rho2_x(1), &
v2rhosigma_x(1), v2sigma2_x(1) )
ENDIF
ENDIF
@ -130,18 +132,17 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
v2rho2_c = 0._DP ; v2rhosigma_c = 0._DP ; v2sigma2_c = 0._DP
IF (igcc /= 0) THEN
fkind = xc_f03_func_info_get_kind( xc_info(4) )
CALL xc_f03_gga_fxc( xc_func(4), lengthxc, rho_lbxc(1), sigma(1), v2rho2_c(1), &
CALL xc_f03_func_set_dens_threshold( xc_func(4), epsr )
CALL xc_f03_gga_fxc( xc_func(4), lengthxc, rho_lxc(1), sigma(1), v2rho2_c(1), &
v2rhosigma_c(1), v2sigma2_c(1) )
ENDIF
ENDIF
!
IF (ANY(is_libxc(3:4))) DEALLOCATE( rho_lbxc, sigma )
!
dvxc_rr = 0._DP
dvxc_sr = 0._DP
dvxc_ss = 0._DP
!
IF ( ((.NOT.is_libxc(3)) .OR. (.NOT.is_libxc(4))) &
IF ( ((.NOT.is_libxc(3).AND.igcx/=0) .OR. (.NOT.is_libxc(4).AND.igcc/=0)) &
.AND. fkind/=XC_EXCHANGE_CORRELATION ) THEN
!
ALLOCATE( vrrx(length,sp), vsrx(length,sp), vssx(length,sp) )
@ -149,14 +150,14 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
IF ( sp == 1 ) THEN
!
ALLOCATE( sigma(length) )
sigma(:) = g_in(:,1,1)**2 + g_in(:,2,1)**2 + g_in(:,3,1)**2
IF (.NOT. ALLOCATED(sigma)) THEN
ALLOCATE( sigma(length) )
sigma(:) = g_in(:,1,1)**2 + g_in(:,2,1)**2 + g_in(:,3,1)**2
ENDIF
!
CALL dgcxc_unpol( length, r_in(:,1), sigma, vrrx(:,1), vsrx(:,1), vssx(:,1), &
vrrc(:,1), vsrc(:,1), vssc )
!
DEALLOCATE( sigma )
!
ELSEIF ( sp == 2 ) THEN
!
ALLOCATE( vrzc(length,sp) )
@ -169,10 +170,13 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
IF ( sp == 1 ) THEN
!
IF ( ((.NOT.is_libxc(3)) .OR. (.NOT.is_libxc(4))) ) THEN
dvxc_rr(:,1,1) = e2 * (vrrx(:,1) + vrrc(:,1))
dvxc_sr(:,1,1) = e2 * (vsrx(:,1) + vsrc(:,1))
dvxc_ss(:,1,1) = e2 * (vssx(:,1) + vssc(:) )
IF ( ((.NOT.is_libxc(3).AND.igcx/=0) .OR. (.NOT.is_libxc(4).AND.igcc/=0)) &
.AND. fkind/=XC_EXCHANGE_CORRELATION ) THEN
DO k = 1, length
dvxc_rr(k,1,1) = e2 * (vrrx(k,1) + vrrc(k,1))
dvxc_sr(k,1,1) = e2 * (vsrx(k,1) + vsrc(k,1))
dvxc_ss(k,1,1) = e2 * (vssx(k,1) + vssc(k) )
ENDDO
!
DEALLOCATE( vrrx, vsrx, vssx )
DEALLOCATE( vrrc, vsrc, vssc )
@ -180,20 +184,30 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
ENDIF
!
IF ( is_libxc(3) ) THEN
dvxc_rr(:,1,1) = dvxc_rr(:,1,1) + e2 * v2rho2_x(:)
dvxc_sr(:,1,1) = dvxc_sr(:,1,1) + e2 * v2rhosigma_x(:)*2._DP
dvxc_ss(:,1,1) = dvxc_ss(:,1,1) + e2 * v2sigma2_x(:)*4._DP
DO k = 1, length
IF ( rho_lxc(k) > small .AND. SQRT(ABS(sigma(k))) > small ) CYCLE
IF ( rho_lxc(k)>rho_threshold_lda ) THEN
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_x(k)
dvxc_sr(k,1,1) = dvxc_sr(k,1,1) + e2 * v2rhosigma_x(k)*2._DP
ENDIF
dvxc_ss(k,1,1) = dvxc_ss(k,1,1) + e2 * v2sigma2_x(k)*4._DP
ENDDO
ENDIF
!
IF ( is_libxc(4) ) THEN
dvxc_rr(:,1,1) = dvxc_rr(:,1,1) + e2 * v2rho2_c(:)
dvxc_sr(:,1,1) = dvxc_sr(:,1,1) + e2 * v2rhosigma_c(:)*2._DP
dvxc_ss(:,1,1) = dvxc_ss(:,1,1) + e2 * v2sigma2_c(:)*4._DP
DO k = 1, length
IF ( rho_lxc(k) > small .AND. SQRT(ABS(sigma(k))) > small ) CYCLE
IF ( rho_lxc(k)>rho_threshold_lda ) THEN
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_c(k)
dvxc_sr(k,1,1) = dvxc_sr(k,1,1) + e2 * v2rhosigma_c(k)*2._DP
ENDIF
dvxc_ss(k,1,1) = dvxc_ss(k,1,1) + e2 * v2sigma2_c(k)*4._DP
ENDDO
ENDIF
!
ELSEIF ( sp == 2 ) THEN
!
IF ( ((.NOT.is_libxc(3)) .OR. (.NOT.is_libxc(4))) ) THEN
IF ( ((.NOT.is_libxc(3).AND.igcx/=0) .OR. (.NOT.is_libxc(4).AND.igcc/=0)) &
.AND. fkind/=XC_EXCHANGE_CORRELATION ) THEN
!
DO k = 1, length
rht = r_in(k,1) + r_in(k,2)
@ -226,35 +240,34 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
IF ( is_libxc(3) ) THEN
!
DO k = 1, length
rht = r_in(k,1) + r_in(k,2)
IF (rht > epsr) THEN
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_x(3*k-2)
dvxc_rr(k,1,2) = dvxc_rr(k,1,2) + e2 * v2rho2_x(3*k-1)
dvxc_rr(k,2,1) = dvxc_rr(k,2,1) + e2 * v2rho2_x(3*k-1)
dvxc_rr(k,2,2) = dvxc_rr(k,2,2) + e2 * v2rho2_x(3*k)
ENDIF
dvxc_sr(k,1,1) = dvxc_sr(k,1,1) + e2 * v2rhosigma_x(6*k-5)*2._DP
DO k = 1, length
thr_up_cond = r_in(k,1)>epsr .AND. SQRT(ABS(sigma(3*k-2)))>epsg
thr_dw_cond = r_in(k,2)>epsr .AND. SQRT(ABS(sigma(3*k)))>epsg
IF ( .NOT.thr_up_cond .OR. .NOT.thr_dw_cond ) CYCLE
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_x(3*k-2)
dvxc_ss(k,1,1) = dvxc_ss(k,1,1) + e2 * v2sigma2_x(6*k-5)*4._DP
dvxc_sr(k,2,2) = dvxc_sr(k,2,2) + e2 * v2rhosigma_x(6*k)*2._DP
dvxc_rr(k,2,2) = dvxc_rr(k,2,2) + e2 * v2rho2_x(3*k)
dvxc_ss(k,2,2) = dvxc_ss(k,2,2) + e2 * v2sigma2_x(6*k)*4._DP
ENDDO
!
DEALLOCATE( v2rho2_x, v2rhosigma_x, v2sigma2_x )
!
ENDIF
!
!
IF ( is_libxc(4) ) THEN
!
DO k = 1, length
rht = r_in(k,1) + r_in(k,2)
IF (rht > epsr) THEN
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_c(3*k-2)
dvxc_rr(k,1,2) = dvxc_rr(k,1,2) + e2 * v2rho2_c(3*k-1)
dvxc_rr(k,2,1) = dvxc_rr(k,2,1) + e2 * v2rho2_c(3*k-1)
dvxc_rr(k,2,2) = dvxc_rr(k,2,2) + e2 * v2rho2_c(3*k)
ENDIF
dvxc_rr(k,1,2) = dvxc_rr(k,1,2) + e2 * v2rho2_x(3*k-1)
dvxc_sr(k,1,1) = dvxc_sr(k,1,1) + e2 * v2rhosigma_x(6*k-5)*2._DP
dvxc_rr(k,2,1) = dvxc_rr(k,2,1) + e2 * v2rho2_x(3*k-1)
dvxc_sr(k,2,2) = dvxc_sr(k,2,2) + e2 * v2rhosigma_x(6*k)*2._DP
ENDDO
!
DEALLOCATE( v2rho2_x, v2rhosigma_x, v2sigma2_x )
!
ENDIF
!
IF ( is_libxc(4) ) THEN
!
DO k = 1, length
thr_up_cond = r_in(k,1)>epsr .AND. SQRT(ABS(sigma(3*k-2)))>epsg
thr_dw_cond = r_in(k,2)>epsr .AND. SQRT(ABS(sigma(3*k)))>epsg
IF ( .NOT.thr_up_cond .OR. .NOT.thr_dw_cond ) CYCLE
dvxc_rr(k,1,1) = dvxc_rr(k,1,1) + e2 * v2rho2_c(3*k-2)
dvxc_rr(k,1,2) = dvxc_rr(k,1,2) + e2 * v2rho2_c(3*k-1)
dvxc_rr(k,2,1) = dvxc_rr(k,2,1) + e2 * v2rho2_c(3*k-1)
dvxc_rr(k,2,2) = dvxc_rr(k,2,2) + e2 * v2rho2_c(3*k)
dvxc_sr(k,1,1) = dvxc_sr(k,1,1) + e2 * v2rhosigma_c(6*k-5)*2.d0
dvxc_ss(k,1,1) = dvxc_ss(k,1,1) + e2 * v2sigma2_c(6*k)*4.d0
dvxc_sr(k,1,2) = dvxc_sr(k,1,2) + e2 * v2rhosigma_c(6*k-4)
@ -267,9 +280,12 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
!
DEALLOCATE( v2rho2_c, v2rhosigma_c, v2sigma2_c )
!
ENDIF
ENDIF
!
IF (ANY(is_libxc(3:4))) DEALLOCATE( rho_lxc )
!
ENDIF
IF ( ALLOCATED(sigma) ) DEALLOCATE( sigma )
!
#else
!

View File

@ -11,14 +11,14 @@ SUBROUTINE dmxc( length, sr_d, rho_in, dmuxc )
!! Wrapper routine. Calls internal dmxc-driver routines or the external
!! ones from Libxc, depending on the input choice.
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: iexch, icorr, is_libxc, rho_threshold_lda
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: iexch, icorr, is_libxc, rho_threshold_lda
USE qe_drivers_d_lda_lsda
!
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_par_mod, ONLY: xc_func, xc_info
USE dft_setting_params, ONLY: xc_func, xc_info
#endif
!
IMPLICIT NONE
@ -94,7 +94,8 @@ SUBROUTINE dmxc( length, sr_d, rho_in, dmuxc )
ALLOCATE( dmex_lxc(length_dlxc) )
! ... DERIVATIVE FOR EXCHANGE
dmex_lxc(:) = 0.0_DP
IF (iexch /= 0) THEN
IF (iexch /= 0) THEN
CALL xc_f03_func_set_dens_threshold( xc_func(1), rho_threshold_lda )
CALL xc_f03_lda_fxc( xc_func(1), lengthxc, rho_lxc(1), dmex_lxc(1) )
ENDIF
ENDIF
@ -105,6 +106,7 @@ SUBROUTINE dmxc( length, sr_d, rho_in, dmuxc )
dmcr_lxc(:) = 0.0_DP
IF (icorr /= 0) THEN
fkind_x = xc_f03_func_info_get_kind( xc_info(2) )
CALL xc_f03_func_set_dens_threshold( xc_func(2), rho_threshold_lda )
CALL xc_f03_lda_fxc( xc_func(2), lengthxc, rho_lxc(1), dmcr_lxc(1) )
ENDIF
ENDIF
@ -127,13 +129,26 @@ SUBROUTINE dmxc( length, sr_d, rho_in, dmuxc )
SELECT CASE( sr_d )
CASE( 1 )
!
IF ( is_libxc(1) ) dmuxc(:,1,1) = dmuxc(:,1,1) + dmex_lxc(:)*2.0_DP
IF ( is_libxc(2) ) dmuxc(:,1,1) = dmuxc(:,1,1) + dmcr_lxc(:)*2.0_DP
IF ( is_libxc(1) ) THEN
DO ir = 1, length
IF (rho_in(ir,1)<=rho_threshold_lda ) CYCLE
dmuxc(ir,1,1) = dmuxc(ir,1,1) + dmex_lxc(ir)*2.0_DP
ENDDO
ENDIF
!
IF ( is_libxc(2) ) THEN
DO ir = 1, length
IF (rho_in(ir,1)<=rho_threshold_lda ) CYCLE
dmuxc(ir,1,1) = dmuxc(ir,1,1) + dmcr_lxc(ir)*2.0_DP
ENDDO
ENDIF
!
CASE( 2 )
!
IF ( is_libxc(1) ) THEN
DO ir = 1, length
IF (rho_in(ir,1)<=rho_threshold_lda .OR. &
rho_in(ir,2)<=rho_threshold_lda) CYCLE
dmuxc(ir,1,1) = dmuxc(ir,1,1) + dmex_lxc(3*ir-2)*2.0_DP
dmuxc(ir,1,2) = dmuxc(ir,1,2) + dmex_lxc(3*ir-1)*2.0_DP
dmuxc(ir,2,1) = dmuxc(ir,2,1) + dmex_lxc(3*ir-1)*2.0_DP
@ -143,7 +158,9 @@ SUBROUTINE dmxc( length, sr_d, rho_in, dmuxc )
ENDIF
!
IF ( is_libxc(2) ) THEN
DO ir = 1, length
DO ir = 1, length
IF (rho_in(ir,1)<=rho_threshold_lda .OR. &
rho_in(ir,2)<=rho_threshold_lda) CYCLE
dmuxc(ir,1,1) = dmuxc(ir,1,1) + dmcr_lxc(3*ir-2)*2.0_DP
dmuxc(ir,1,2) = dmuxc(ir,1,2) + dmcr_lxc(3*ir-1)*2.0_DP
dmuxc(ir,2,1) = dmuxc(ir,2,1) + dmcr_lxc(3*ir-1)*2.0_DP

View File

@ -17,12 +17,12 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_par_mod, ONLY: xc_func, xc_info
USE dft_setting_params, ONLY: xc_func, xc_info, libxc_flags
#endif
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: igcx, igcc, is_libxc, rho_threshold_gga, &
grho_threshold_gga
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: igcx, igcc, is_libxc, rho_threshold_gga, &
grho_threshold_gga, rho_threshold_lda
USE qe_drivers_gga
!
IMPLICIT NONE
@ -59,11 +59,10 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
REAL(DP), ALLOCATABLE :: vc_rho(:), vc_sigma(:)
!
INTEGER :: fkind_x, np
REAL(DP) :: rs, rtot, zet, vc_2(2)
REAL(DP), PARAMETER :: pi34 = 0.6203504908994_DP
!
LOGICAL :: POLARIZED
INTEGER :: ildax, ildac, pol_unpol
INTEGER :: pol_unpol
#if (XC_MAJOR_VERSION > 4)
INTEGER(8) :: lengthxc
#else
@ -76,6 +75,7 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
!
INTEGER :: k, is
REAL(DP) :: sgn(2)
REAL(DP) :: rho_up, rho_dw, grho_up, grho_dw
REAL(DP), PARAMETER :: small = 1.E-10_DP
!
!
@ -137,8 +137,9 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
!
CALL gcxc( length, ABS(rho(:,1)), sigma, ex, ec, v1x(:,1), v2x(:,1), v1c(:,1), v2c(:,1) )
!
IF ( igcx==43 .OR. igcc==14 ) CALL gcxc_beef( length, ABS(rho(:,1)), grho2(:,1), ex, ec, &
v1x(:,1), v2x(:,1), v1c(:,1), v2c(:,1) )
IF ( (igcx==43.AND..NOT.is_libxc(3)) .OR. (igcc==14.AND..NOT.is_libxc(4)) ) &
CALL gcxc_beef( length, ABS(rho(:,1)), sigma, ex, ec, v1x(:,1), v2x(:,1), &
v1c(:,1), v2c(:,1) )
!
DO k = 1, length
sgn(1) = SIGN(1._DP, rho(k,1))
@ -150,29 +151,42 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
!
! ---- GGA CORRELATION
!
IF (is_libxc(4)) fkind_x = xc_f03_func_info_get_kind( xc_info(4) )
!
IF ( is_libxc(4) ) THEN !lda part of LYP not present in libxc (still so? - check)
!
CALL xc_f03_func_set_dens_threshold( xc_func(4), rho_threshold_gga )
fkind_x = xc_f03_func_info_get_kind( xc_info(4) )
CALL xc_f03_gga_exc_vxc( xc_func(4), lengthxc, rho_lxc(1), sigma(1), ec_lxc(1), vc_rho(1), vc_sigma(1) )
CALL xc_f03_func_set_dens_threshold( xc_func(4), small )!rho_threshold_gga )
IF (libxc_flags(4,0)==1) THEN
CALL xc_f03_gga_exc_vxc( xc_func(4), lengthxc, rho_lxc(1), sigma(1), ec_lxc(1), vc_rho(1), vc_sigma(1) )
ELSE
CALL xc_f03_gga_vxc( xc_func(4), lengthxc, rho_lxc(1), sigma(1), vc_rho(1), vc_sigma(1) )
ec_lxc = 0.d0
ENDIF
!
IF (.NOT. POLARIZED) THEN
DO k = 1, length
IF ( rho_lxc(k) <= rho_threshold_lda ) CYCLE
ec(k) = ec_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1))
v1c(k,1) = vc_rho(k)
IF ( rho_lxc(k) <= rho_threshold_gga .OR. &
SQRT(ABS(sigma(k))) <= grho_threshold_gga) CYCLE
v2c(k,1) = vc_sigma(k)*2.d0
ENDDO
ELSE
DO k = 1, length
sgn(:) = 1.d0
IF (rho_lxc(2*k-1)<rho_threshold_gga .OR. SQRT(ABS(sigma(3*k-2)))<grho_threshold_gga) sgn(1)=0.d0
IF (rho_lxc(2*k) <rho_threshold_gga .OR. SQRT(ABS(sigma(3*k))) <grho_threshold_gga) sgn(2)=0.d0
ec(k) = ec_lxc(k) * (rho_lxc(2*k-1)*sgn(1)+rho_lxc(2*k)*sgn(2))
v1c(k,1) = vc_rho(2*k-1) * sgn(1)
v1c(k,2) = vc_rho(2*k) * sgn(2)
v2c(k,1) = vc_sigma(3*k-2)*2.d0 * sgn(1)
v2c_ud(k)= vc_sigma(3*k-1) * sgn(1)*sgn(2)
v2c(k,2) = vc_sigma(3*k)*2.d0 * sgn(2)
rho_up = rho_lxc(2*k-1)
rho_dw = rho_lxc(2*k)
grho_up = SQRT(ABS(sigma(3*k-2)))
grho_dw = SQRT(ABS(sigma(3*k)))
IF ( rho_up <= rho_threshold_lda .OR. rho_dw <= rho_threshold_lda ) CYCLE
ec(k) = ec_lxc(k) * (rho_up+rho_dw)
v1c(k,1) = vc_rho(2*k-1)
v1c(k,2) = vc_rho(2*k)
IF ( rho_up <= rho_threshold_gga .OR. rho_dw <= rho_threshold_gga .OR. &
grho_up<=grho_threshold_gga .OR. grho_dw<=grho_threshold_gga ) CYCLE
v2c(k,1) = vc_sigma(3*k-2)*2.d0
v2c_ud(k)= vc_sigma(3*k-1)
v2c(k,2) = vc_sigma(3*k)*2.d0
ENDDO
ENDIF
!
@ -220,7 +234,7 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
IF ( igcc/=14 ) CALL gcc_spin( length, rh, zeta, grho2(:,1), ec, v1c, v2c(:,1) )
IF ( igcc==14 ) CALL gcc_spin_beef( length, rh, zeta, grho2(:,1), ec, v1c, v2c(:,1) )
!
v2c(:,2) = v2c(:,1)
v2c(:,2) = v2c(:,1)
IF ( PRESENT(v2c_ud) ) v2c_ud(:) = v2c(:,1)
!
DEALLOCATE( rh, zeta )
@ -237,20 +251,35 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
!
IF ( is_libxc(3) ) THEN
!
CALL xc_f03_func_set_dens_threshold( xc_func(3), rho_threshold_gga )
CALL xc_f03_gga_exc_vxc( xc_func(3), lengthxc, rho_lxc(1), sigma(1), ex_lxc(1), vx_rho(1), vx_sigma(1) )
CALL xc_f03_func_set_dens_threshold( xc_func(3), grho_threshold_gga )
IF (libxc_flags(3,0)==1) THEN
CALL xc_f03_gga_exc_vxc( xc_func(3), lengthxc, rho_lxc(1), sigma(1), ex_lxc(1), vx_rho(1), vx_sigma(1) )
ELSE
CALL xc_f03_gga_vxc( xc_func(3), lengthxc, rho_lxc(1), sigma(1), vx_rho(1), vx_sigma(1) )
ex_lxc = 0.d0
ENDIF
!
IF (.NOT. POLARIZED) THEN
DO k = 1, length
IF ( rho_lxc(k) <= rho_threshold_lda ) CYCLE
ex(k) = ex_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1))
v1x(k,1) = vx_rho(k)
IF ( rho_lxc(k) <= rho_threshold_gga .OR. &
SQRT(ABS(sigma(k))) <= grho_threshold_gga) CYCLE
v2x(k,1) = vx_sigma(k)*2.d0
ENDDO
ELSE
DO k = 1, length
ex(k) = ex_lxc(k) * (rho_lxc(2*k-1)+rho_lxc(2*k))
rho_up = rho_lxc(2*k-1)
rho_dw = rho_lxc(2*k)
grho_up = SQRT(ABS(sigma(3*k-2)))
grho_dw = SQRT(ABS(sigma(3*k)))
IF ( rho_up <= rho_threshold_lda .OR. rho_dw <= rho_threshold_lda ) CYCLE
ex(k) = ex_lxc(k) * (rho_up+rho_dw)
v1x(k,1) = vx_rho(2*k-1)
v1x(k,2) = vx_rho(2*k)
IF ( rho_up <= rho_threshold_gga .OR. rho_dw <= rho_threshold_gga .OR. &
grho_up<=grho_threshold_gga .OR. grho_dw<=grho_threshold_gga ) CYCLE
v2x(k,1) = vx_sigma(3*k-2)*2.d0
v2x(k,2) = vx_sigma(3*k)*2.d0
ENDDO

View File

@ -14,12 +14,12 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_par_mod, ONLY: xc_func, xc_info
USE dft_setting_params, ONLY: xc_func, xc_info, libxc_flags
#endif
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: iexch, icorr, is_libxc, rho_threshold_lda, &
finite_size_cell_volume_set
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: iexch, icorr, is_libxc, rho_threshold_lda, &
finite_size_cell_volume_set
USE qe_drivers_lda_lsda
!
IMPLICIT NONE
@ -44,7 +44,7 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
! ... local variables
!
#if defined(__LIBXC)
INTEGER :: fkind_x
INTEGER :: fkind_x, eflag
REAL(DP) :: amag
REAL(DP), ALLOCATABLE :: rho_lxc(:)
REAL(DP), ALLOCATABLE :: vx_lxc(:), vc_lxc(:)
@ -104,15 +104,23 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
!
! ... EXCHANGE
IF ( is_libxc(1) ) THEN
CALL xc_f03_func_set_dens_threshold( xc_func(1), rho_threshold_lda )
CALL xc_f03_lda_exc_vxc( xc_func(1), lengthxc, rho_lxc(1), ex_out(1), vx_lxc(1) )
CALL xc_f03_func_set_dens_threshold( xc_func(1), rho_threshold_lda )
IF (libxc_flags(1,0)==1) THEN
CALL xc_f03_lda_exc_vxc( xc_func(1), lengthxc, rho_lxc(1), ex_out(1), vx_lxc(1) )
ELSE
CALL xc_f03_lda_vxc( xc_func(1), lengthxc, rho_lxc(1), vx_lxc(1) )
ENDIF
ENDIF
!
! ... CORRELATION
IF ( is_libxc(2) ) THEN
CALL xc_f03_func_set_dens_threshold( xc_func(2), rho_threshold_lda )
fkind_x = xc_f03_func_info_get_kind( xc_info(2) )
CALL xc_f03_lda_exc_vxc( xc_func(2), lengthxc, rho_lxc(1), ec_out(1), vc_lxc(1) )
IF (libxc_flags(2,0)==1) THEN
CALL xc_f03_lda_exc_vxc( xc_func(2), lengthxc, rho_lxc(1), ec_out(1), vc_lxc(1) )
ELSE
CALL xc_f03_lda_vxc( xc_func(2), lengthxc, rho_lxc(1), vc_lxc(1) )
ENDIF
ENDIF
!
IF ( ((.NOT.is_libxc(1)) .OR. (.NOT.is_libxc(2))) &
@ -121,7 +129,8 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
SELECT CASE( sr_d )
CASE( 1 )
!
IF (iexch==8 .OR. icorr==10) THEN
IF ((iexch==8 .AND. .NOT.is_libxc(1)) .OR. (icorr==10 .AND. &
.NOT. is_libxc(2))) THEN
IF (.NOT. finite_size_cell_volume_set) CALL xclib_error( 'XC',&
'finite size corrected exchange used w/o initialization', 1 )
ENDIF
@ -160,14 +169,14 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
ELSE
IF (is_libxc(1)) THEN
DO ir = 1, length
vx_out(ir,1) = vx_lxc(2*ir-1)
vx_out(ir,2) = vx_lxc(2*ir)
vx_out(ir,1) = vx_lxc(2*ir-1)
vx_out(ir,2) = vx_lxc(2*ir)
ENDDO
ENDIF
IF (is_libxc(2)) THEN
DO ir = 1, length
vc_out(ir,1) = vc_lxc(2*ir-1)
vc_out(ir,2) = vc_lxc(2*ir)
vc_out(ir,1) = vc_lxc(2*ir-1)
vc_out(ir,2) = vc_lxc(2*ir)
ENDDO
ENDIF
ENDIF
@ -182,7 +191,8 @@ SUBROUTINE xc( length, sr_d, sv_d, rho_in, ex_out, ec_out, vx_out, vc_out )
SELECT CASE( sr_d )
CASE( 1 )
!
IF (iexch==8 .OR. icorr==10) THEN
IF ((iexch==8 .AND. .NOT.is_libxc(1)) .OR. (icorr==10 .AND. &
.NOT. is_libxc(2))) THEN
IF (.NOT. finite_size_cell_volume_set) CALL xclib_error( 'XC',&
'finite size corrected exchange used w/o initialization', 1 )
ENDIF

View File

@ -14,14 +14,13 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
#if defined(__LIBXC)
#include "xc_version.h"
USE xc_f03_lib_m
USE dft_mod, ONLY: get_libxc_flags_exc
USE dft_par_mod, ONLY: xc_func, xc_info
USE dft_setting_params, ONLY: xc_func, libxc_flags
#endif
!
USE kind_l, ONLY: DP
USE dft_par_mod, ONLY: imeta, imetac, is_libxc, rho_threshold_mgga, &
grho2_threshold_mgga, tau_threshold_mgga, scan_exx, &
exx_started, exx_fraction
USE kind_l, ONLY: DP
USE dft_setting_params, ONLY: imetac, is_libxc, rho_threshold_mgga, &
grho2_threshold_mgga, tau_threshold_mgga, &
scan_exx, exx_started, exx_fraction
USE qe_drivers_mgga
!
IMPLICIT NONE
@ -59,16 +58,18 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
!
INTEGER :: is
REAL(DP), ALLOCATABLE :: grho2(:,:)
REAL(DP), PARAMETER :: small = 1.E-10_DP
!
#if defined(__LIBXC)
REAL(DP), ALLOCATABLE :: rho_lxc(:), sigma(:), tau_lxc(:)
REAL(DP), ALLOCATABLE :: ex_lxc(:), ec_lxc(:)
REAL(DP), ALLOCATABLE :: vx_rho(:), vx_sigma(:), vx_tau(:)
REAL(DP), ALLOCATABLE :: vc_rho(:), vc_sigma(:), vc_tau(:)
REAL(DP), ALLOCATABLE :: lapl_rho(:), vlapl_rho(:) ! not used in TPSS
REAL(DP), ALLOCATABLE :: lapl_rho(:), vlapl_rho(:) ! not used in QE
!
INTEGER :: k, ipol, pol_unpol, eflag
LOGICAL :: POLARIZED
INTEGER :: k, ipol, pol_unpol
LOGICAL :: POLARIZED
REAL(DP) :: rh, ggrho2, atau
#if (XC_MAJOR_VERSION > 4)
INTEGER(8) :: lengthxc
#else
@ -103,6 +104,7 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
sigma(k) = MAX( grho(1,k,1)**2 + grho(2,k,1)**2 + grho(3,k,1)**2, &
grho2_threshold_mgga )
tau_lxc(k) = MAX( tau(k,1), tau_threshold_mgga )
vlapl_rho(k) = 0._DP
ENDDO
!
ELSE
@ -110,16 +112,16 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
DO k = 1, length
rho_lxc(2*k-1) = ABS( rho(k,1) )
rho_lxc(2*k) = ABS( rho(k,2) )
!
sigma(3*k-2) = MAX( grho(1,k,1)**2 + grho(2,k,1)**2 + grho(3,k,1)**2, &
grho2_threshold_mgga )
sigma(3*k-1) = grho(1,k,1) * grho(1,k,2) + grho(2,k,1) * grho(2,k,2) + &
sigma(3*k-1) = grho(1,k,1) * grho(1,k,2) + grho(2,k,1) * grho(2,k,2) +&
grho(3,k,1) * grho(3,k,2)
sigma(3*k) = MAX( grho(1,k,2)**2 + grho(2,k,2)**2 + grho(3,k,2)**2, &
grho2_threshold_mgga )
!
tau_lxc(2*k-1) = MAX( tau(k,1), tau_threshold_mgga )
tau_lxc(2*k) = MAX( tau(k,2), tau_threshold_mgga )
tau_lxc(2*k-1) = MAX( tau(k,1), small )
tau_lxc(2*k) = MAX( tau(k,2), small )
vlapl_rho(2*k-1) = 0._DP
vlapl_rho(2*k) = 0._DP
ENDDO
!
ENDIF
@ -132,33 +134,34 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
grho2(:,is) = grho(1,:,is)**2 + grho(2,:,is)**2 + grho(3,:,is)**2
ENDDO
!
IF (ns == 1) THEN
CALL tau_xc( length, rho(:,1), grho2(:,1), tau(:,1), ex, ec, v1x(:,1), &
v2x(:,1), v3x(:,1), v1c(:,1), v2c(1,:,1), v3c(:,1) )
ELSEIF (ns == 2) THEN
CALL tau_xc_spin( length, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1c, &
v2c, v3c )
ENDIF
IF (ns == 1) CALL tau_xc( length, rho(:,1), grho2(:,1), tau(:,1), ex, ec, &
v1x(:,1), v2x(:,1), v3x(:,1), v1c(:,1), v2c(1,:,1),&
v3c(:,1) )
IF (ns == 2) CALL tau_xc_spin( length, rho, grho, tau, ex, ec, v1x, v2x, v3x,&
v1c, v2c, v3c )
!
DEALLOCATE( grho2 )
!
ENDIF
!
! META EXCHANGE
! ... META EXCHANGE
!
IF ( is_libxc(5) ) THEN
CALL xc_f03_func_set_dens_threshold( xc_func(5), rho_threshold_mgga )
CALL get_libxc_flags_exc( xc_info(5), eflag )
IF (eflag==1) THEN
IF (libxc_flags(5,0)==1) THEN
CALL xc_f03_mgga_exc_vxc( xc_func(5), lengthxc, rho_lxc(1), sigma(1), lapl_rho(1), tau_lxc(1), &
ex_lxc(1), vx_rho(1), vx_sigma(1), vlapl_rho(1), vx_tau(1) )
ELSE
CALL xc_f03_mgga_vxc( xc_func(5), lengthxc, rho_lxc(1), sigma(1), lapl_rho(1), tau_lxc(1), &
vx_rho(1), vx_sigma(1), vlapl_rho(1), vx_tau(1) )
ex_lxc = 0.d0
ENDIF
!
IF (.NOT. POLARIZED) THEN
DO k = 1, length
IF ( ABS(rho_lxc(k))<=rho_threshold_mgga .OR. &
sigma(k)<=grho2_threshold_mgga .OR. &
ABS(tau_lxc(k))<=rho_threshold_mgga ) CYCLE
ex(k) = ex_lxc(k) * rho_lxc(k)
v1x(k,1) = vx_rho(k)
v2x(k,1) = vx_sigma(k) * 2.0_DP
@ -166,13 +169,22 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
ENDDO
ELSE
DO k = 1, length
IF (rho_lxc(2*k-1)+rho_lxc(2*k) <= rho_threshold_mgga) CYCLE
ex(k) = ex_lxc(k) * (rho_lxc(2*k-1)+rho_lxc(2*k))
v1x(k,1) = vx_rho(2*k-1)
v1x(k,2) = vx_rho(2*k)
v2x(k,1) = vx_sigma(3*k-2)*2.d0
v2x(k,2) = vx_sigma(3*k)*2.d0
v3x(k,1) = vx_tau(2*k-1)
v3x(k,2) = vx_tau(2*k)
IF ( ABS(rho_lxc(2*k-1))>rho_threshold_mgga .AND. &
sigma(3*k-2)>grho2_threshold_mgga .AND. &
ABS(tau_lxc(2*k-1))>tau_threshold_mgga ) THEN
v1x(k,1) = vx_rho(2*k-1)
v2x(k,1) = vx_sigma(3*k-2)*2.d0
v3x(k,1) = vx_tau(2*k-1)
ENDIF
IF ( ABS(rho_lxc(2*k))>rho_threshold_mgga .AND. &
sigma(3*k)>grho2_threshold_mgga .AND. &
ABS(tau_lxc(2*k))>tau_threshold_mgga ) THEN
v1x(k,2) = vx_rho(2*k)
v2x(k,2) = vx_sigma(3*k)*2.d0
v3x(k,2) = vx_tau(2*k)
ENDIF
ENDDO
ENDIF
!
@ -188,23 +200,38 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
!
ENDIF
!
! META CORRELATION
! ... META CORRELATION
!
IF ( is_libxc(6) ) THEN
!
CALL xc_f03_func_set_dens_threshold( xc_func(6), rho_threshold_mgga )
CALL xc_f03_mgga_exc_vxc( xc_func(6), lengthxc, rho_lxc(1), sigma(1), lapl_rho(1), tau_lxc(1), &
ec_lxc(1), vc_rho(1), vc_sigma(1), vlapl_rho(1), vc_tau(1) )
IF (libxc_flags(6,0)==1) THEN
CALL xc_f03_mgga_exc_vxc( xc_func(6), lengthxc, rho_lxc(1), sigma(1), lapl_rho(1), tau_lxc(1), &
ec_lxc(1), vc_rho(1), vc_sigma(1), vlapl_rho(1), vc_tau(1) )
ELSE
CALL xc_f03_mgga_vxc( xc_func(6), lengthxc, rho_lxc(1), sigma(1), lapl_rho(1), tau_lxc(1), &
vc_rho(1), vc_sigma(1), vlapl_rho(1), vc_tau(1) )
ec_lxc = 0.d0
ENDIF
!
IF (.NOT. POLARIZED) THEN
DO k = 1, length
ec(k) = ec_lxc(k) * rho_lxc(k)
v1c(k,1) = vc_rho(k)
v2c(1,k,1) = vc_sigma(k) * 2.0_DP
v3c(k,1) = vc_tau(k)
IF ( ABS(rho_lxc(k))<=rho_threshold_mgga .OR. &
sigma(k)<=grho2_threshold_mgga .OR. &
ABS(tau_lxc(k))<=rho_threshold_mgga ) CYCLE
ec(k) = ec_lxc(k) * rho_lxc(k)
v1c(k,1) = vc_rho(k)
v2c(1,k,1) = vc_sigma(k) * 2.0_DP
v3c(k,1) = vc_tau(k)
ENDDO
ELSE
DO k = 1, length
rh = rho_lxc(2*k-1) + rho_lxc(2*k)
atau = ABS(tau_lxc(2*k-1) + tau_lxc(2*k))
ggrho2 = (sigma(3*k-2) + sigma(3*k))*4.0_DP
IF ( rh <= rho_threshold_mgga .OR. &
ggrho2 <= grho2_threshold_mgga .OR. &
atau <= tau_threshold_mgga ) CYCLE
ec(k) = ec_lxc(k) * (rho_lxc(2*k-1)+rho_lxc(2*k))
v1c(k,1) = vc_rho(2*k-1)
v1c(k,2) = vc_rho(2*k)

File diff suppressed because it is too large Load Diff

View File

@ -29,4 +29,7 @@ MODULE xclib_utils_and_para
! standard output unit
INTEGER, PARAMETER :: stdout = 6
!
! switch for warning messages
LOGICAL :: nowarning = .FALSE.
!
END MODULE xclib_utils_and_para

View File

@ -5,22 +5,15 @@ This directory contains several tools that may be useful for developers
- `mem_counter`. A script that tracks all calls to `allocate` and `deallocate`,
appending a call to subroutine `UtilXlib/mem_counter.f90`.
Calls python script `mem_counter.py`, written by Pietro Bonfà (CINECA)
and improved by Samuel Poncé.
and improved by Samuel Poncé.
`mem_counter -h` gives information on how to use it.
- `mem_analyse.py` is a python script, by Samuel Poncé, locating memory leaks. See the script header for directions on how to use it.
- `src-normal`. A script that "normalizes" the fortran syntax to QE style (see below).
Calls python script `src-normal.py`, written by Norbert Nemec.
BEWARE: you may still need to manually edit some files that do not compile.
- `mem_analyse.py` is a python script, by Samuel Poncé, locating memory leaks.
See the script header for directions on how to use it.
- `src-normal`. A script that "normalizes" the fortran syntax to QE style
(see below). Calls python script `src-normal.py`, written by Norbert Nemec.
Usage: `src-normal file1.f90 [file2.f90 ...]` or `src-normal`
- Utilities for GPUs (Pietro Bonfà):
* `get_device_props.py`
* `device_props.c`
- (Obsolete?) utilities:
* `calltree.pl`
A perl script, to be run from the root QE directory, producing in the
standard output the tree of called routines
* `callhtml.pl`
As above, producing a html page with the tree of called routines
- Utilities for PWgui:
* `check_gui` (called via `Makefile`)
* `diff_gui_help`
@ -35,6 +28,17 @@ This directory contains several tools that may be useful for developers
* `gen-emacs-mode`
* `gen-emacs-mode.tcl`
## Obsolescent utilities
- GPU utilities by Pietro Bonfà:
* `get_device_props.py`
* `device_props.c`
- Other utilities:
* `calltree.pl`
A perl script, to be run from the root QE directory, producing in the
standard output the tree of called routines
* `callhtml.pl`
As above, producing a html page with the tree of called routines
## Coding style
These are some basic rules for Fortran codes enforced by `src_normal`:
* Use spaces for indentation instead of tabs (tab width 8 characters).

26
install/configure vendored
View File

@ -768,6 +768,7 @@ enable_environment
enable_debug
enable_pedantic
enable_shared
enable_static
with_cuda
with_cuda_cc
with_cuda_runtime
@ -1429,7 +1430,9 @@ Optional Features:
--enable-environment compile solvent-related stuff (default: no)
--enable-debug compile Fortran with debug flags (default: no)
--enable-pedantic compile Fortran with pedantic flags (default: no)
--enable-shared use shared libraries if available (default: yes)
--enable-shared produce object files suitable for shared libraries
(default: no)
--enable-static build static executables if possible (default: no)
--enable-openacc Enable compilation with OPENACC [default=yes]
--enable-cuda-env-check The configure script will check CUDA installation
and report problems [default=no]
@ -3835,7 +3838,7 @@ else
fi
# shared library flags are implemented only for a few (untested) cases
# yet to be implemented
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared; if test "$enableval" = "yes" ; then
@ -3844,7 +3847,20 @@ if test "${enable_shared+set}" = set; then :
use_shared=0
fi
else
use_shared=1
use_shared=0
fi
# build static executables (implemented only for a few untested cases)
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; if test "$enableval" = "yes" ; then
use_static=1
else
use_static=0
fi
else
use_static=0
fi
@ -4011,7 +4027,7 @@ ppc64-bgq:*xlf* )
try_fflags="-fast"
try_fflags_openmp="-mp"
if test "$use_debug" -eq 1; then
try_f90flags="-g -C -Mcache_align -Mpreprocess -Mlarge_arrays"
try_f90flags="-g -C -Ktrap=fp -Mcache_align -Mpreprocess -Mlarge_arrays"
else
try_f90flags="-fast -Mcache_align -Mpreprocess -Mlarge_arrays"
fi
@ -4053,7 +4069,7 @@ ppc64-bgq:*xlf* )
esac
if test "$use_shared" -eq 0 ; then
if test "$use_static" -eq 1 ; then
try_ldflags="$try_ldflags $try_ldflags_static" ; fi
# Flags are repeated, need better way to handle this ...

View File

@ -24,16 +24,27 @@ AC_ARG_ENABLE(pedantic,
fi],
[use_pedantic=0])
# shared library flags are implemented only for a few (untested) cases
# yet to be implemented
AC_ARG_ENABLE(shared,
[AS_HELP_STRING([--enable-shared],
[use shared libraries if available (default: yes)])],
[produce object files suitable for shared libraries (default: no)])],
[if test "$enableval" = "yes" ; then
use_shared=1
else
use_shared=0
fi],
[use_shared=1])
[use_shared=0])
# build static executables (implemented only for a few untested cases)
AC_ARG_ENABLE(static,
[AS_HELP_STRING([--enable-static],
[build static executables if possible (default: no)])],
[if test "$enableval" = "yes" ; then
use_static=1
else
use_static=0
fi],
[use_static=0])
# check Fortran compiler flags
# have_cpp=0: use external C preprocessing for fortran code
@ -198,7 +209,7 @@ ppc64-bgq:*xlf* )
try_fflags="-fast"
try_fflags_openmp="-mp"
if test "$use_debug" -eq 1; then
try_f90flags="-g -C -Mcache_align -Mpreprocess -Mlarge_arrays"
try_f90flags="-g -C -Ktrap=fp -Mcache_align -Mpreprocess -Mlarge_arrays"
else
try_f90flags="-fast -Mcache_align -Mpreprocess -Mlarge_arrays"
fi
@ -240,7 +251,7 @@ ppc64-bgq:*xlf* )
esac
if test "$use_shared" -eq 0 ; then
if test "$use_static" -eq 1 ; then
try_ldflags="$try_ldflags $try_ldflags_static" ; fi
# Flags are repeated, need better way to handle this ...

View File

@ -1,5 +1,5 @@
Program PWSCF v.6.7GPU starts on 6Feb2021 at 3: 6:24
Program PWSCF v.6.8 starts on 17Oct2021 at 8:50:20
This program is part of the open-source Quantum ESPRESSO suite
for quantum simulation of materials; please cite
@ -14,6 +14,8 @@
MPI processes distributed on 1 nodes
R & G space division: proc/nbgrp/npool/nimage = 4
17707 MiB available memory on the printing compute node when the environment starts
Reading input from vc-relax-dos-2.in
Warning: card &CELL ignored
Warning: card CELL_DYNAMICS = 'DAMP-W' , ignored
@ -24,35 +26,32 @@ Warning: card / ignored
Current dimensions of program PWSCF are:
Max number of different atomic species (ntypx) = 10
Max number of k-points (npk) = 40000
Max angular momentum in pseudopotentials (lmaxx) = 3
Max angular momentum in pseudopotentials (lmaxx) = 4
Atomic positions and unit cell read from directory:
./pwscf.save/
Atomic positions from file used, from input discarded
File ./pwscf.update deleted, as requested
File ./pwscf.md deleted, as requested
Subspace diagonalization in iterative solution of the eigenvalue problem:
a serial algorithm will be used
one sub-group per band group will be used
scalapack distributed-memory algorithm (size of sub-group: 2* 2 procs)
Parallelization info
--------------------
sticks: dense smooth PW G-vecs: dense smooth PW
Min 150 150 45 2298 2298 393
Max 151 151 46 2299 2299 394
Sum 601 601 183 9195 9195 1575
Min 141 141 43 2121 2121 369
Max 142 142 44 2122 2122 370
Sum 567 567 175 8487 8487 1477
Using Slab Decomposition
bravais-lattice index = 14
lattice parameter (alat) = 7.0103 a.u.
unit-cell volume = 544.3989 (a.u.)^3
lattice parameter (alat) = 7.5589 a.u.
unit-cell volume = 502.4164 (a.u.)^3
number of atoms/cell = 2
number of atomic types = 1
number of electrons = 10.00
@ -66,18 +65,18 @@ Warning: card / ignored
celldm(4)= 0.495175 celldm(5)= 0.495175 celldm(6)= 0.495175
crystal axes: (cart. coord. in units of alat)
a(1) = ( 1.379631 -0.275300 -0.213189 )
a(2) = ( 0.502939 0.995537 -0.146972 )
a(3) = ( 0.488941 0.166449 0.952887 )
a(1) = ( 1.279816 -0.323915 -0.220597 )
a(2) = ( 0.384048 0.848423 -0.214501 )
a(3) = ( 0.371577 0.066379 0.872010 )
reciprocal axes: (cart. coord. in units 2 pi/alat)
b(1) = ( 0.615822 -0.348765 -0.255066 )
b(2) = ( 0.143558 0.897928 -0.230511 )
b(3) = ( 0.159920 0.060466 0.956823 )
b(1) = ( 0.648225 -0.356402 -0.249088 )
b(2) = ( 0.230222 1.029823 -0.176493 )
b(3) = ( 0.220616 0.163161 1.040348 )
PseudoPot. # 1 for As read from file:
/home/fdossantos/codes/gitlab_q-e_develop/test-suite/..//pseudo/As.pz-bhs.UPF
/home/giannozz/q-e-mio/test-suite/..//pseudo/As.pz-bhs.UPF
MD5 check sum: 2c53d8691f3db84e0fbdf898b12bc293
Pseudo is Norm-conserving, Zval = 5.0
Generated by new atomic code, or converted to UPF format
@ -95,53 +94,51 @@ Warning: card / ignored
Cartesian axes
site n. atom positions (alat units)
1 As tau( 1) = ( 0.3048620 0.3543859 0.2448382 )
2 As tau( 2) = ( -0.3048620 -0.3543859 -0.2448382 )
1 As tau( 1) = ( 0.1887495 0.2284193 0.1643292 )
2 As tau( 2) = ( -0.1887495 -0.2284193 -0.1643292 )
number of k points= 32 Methfessel-Paxton smearing, width (Ry)= 0.0050
cart. coord. in units 2pi/alat
k( 1) = ( 0.1149125 0.0762036 0.0589058), wk = 0.0625000
k( 2) = ( 0.1548924 0.0913201 0.2981115), wk = 0.0625000
k( 3) = ( 0.0349527 0.0459707 -0.4195057), wk = 0.0625000
k( 4) = ( 0.0749326 0.0610872 -0.1803000), wk = 0.0625000
k( 5) = ( 0.1508020 0.3006858 0.0012781), wk = 0.0625000
k( 6) = ( 0.1907819 0.3158022 0.2404838), wk = 0.0625000
k( 7) = ( 0.0708422 0.2704528 -0.4771334), wk = 0.0625000
k( 8) = ( 0.1108221 0.2855693 -0.2379277), wk = 0.0625000
k( 9) = ( 0.0431335 -0.3727606 0.1741612), wk = 0.0625000
k( 10) = ( 0.0831135 -0.3576441 0.4133669), wk = 0.0625000
k( 11) = ( -0.0368263 -0.4029935 -0.3042503), wk = 0.0625000
k( 12) = ( 0.0031536 -0.3878771 -0.0650446), wk = 0.0625000
k( 13) = ( 0.0790230 -0.1482785 0.1165335), wk = 0.0625000
k( 14) = ( 0.1190029 -0.1331620 0.3557392), wk = 0.0625000
k( 15) = ( -0.0009368 -0.1785114 -0.3618780), wk = 0.0625000
k( 16) = ( 0.0390431 -0.1633949 -0.1226723), wk = 0.0625000
k( 17) = ( 0.2688681 -0.0109876 -0.0048608), wk = 0.0625000
k( 18) = ( 0.3088481 0.0041288 0.2343450), wk = 0.0625000
k( 19) = ( 0.1889083 -0.0412206 -0.4832723), wk = 0.0625000
k( 20) = ( 0.2288882 -0.0261041 -0.2440665), wk = 0.0625000
k( 21) = ( 0.3047576 0.2134945 -0.0624885), wk = 0.0625000
k( 22) = ( 0.3447375 0.2286109 0.1767173), wk = 0.0625000
k( 23) = ( 0.2247978 0.1832615 -0.5409000), wk = 0.0625000
k( 24) = ( 0.2647777 0.1983780 -0.3016942), wk = 0.0625000
k( 25) = ( 0.1970891 -0.4599519 0.1103946), wk = 0.0625000
k( 26) = ( 0.2370691 -0.4448354 0.3496004), wk = 0.0625000
k( 27) = ( 0.1171293 -0.4901848 -0.3680169), wk = 0.0625000
k( 28) = ( 0.1571092 -0.4750684 -0.1288111), wk = 0.0625000
k( 29) = ( 0.2329786 -0.2354698 0.0527669), wk = 0.0625000
k( 30) = ( 0.2729586 -0.2203533 0.2919727), wk = 0.0625000
k( 31) = ( 0.1530188 -0.2657027 -0.4256446), wk = 0.0625000
k( 32) = ( 0.1929987 -0.2505862 -0.1864388), wk = 0.0625000
k( 1) = ( 0.1373827 0.1045728 0.0768458), wk = 0.0625000
k( 2) = ( 0.1925366 0.1453629 0.3369328), wk = 0.0625000
k( 3) = ( 0.0270750 0.0229925 -0.4433280), wk = 0.0625000
k( 4) = ( 0.0822289 0.0637827 -0.1832411), wk = 0.0625000
k( 5) = ( 0.1949382 0.3620287 0.0327227), wk = 0.0625000
k( 6) = ( 0.2500921 0.4028188 0.2928096), wk = 0.0625000
k( 7) = ( 0.0846305 0.2804484 -0.4874512), wk = 0.0625000
k( 8) = ( 0.1397843 0.3212385 -0.2273642), wk = 0.0625000
k( 9) = ( 0.0222718 -0.4103389 0.1650921), wk = 0.0625000
k( 10) = ( 0.0774257 -0.3695488 0.4251790), wk = 0.0625000
k( 11) = ( -0.0880359 -0.4919192 -0.3550817), wk = 0.0625000
k( 12) = ( -0.0328821 -0.4511291 -0.0949948), wk = 0.0625000
k( 13) = ( 0.0798273 -0.1528831 0.1209690), wk = 0.0625000
k( 14) = ( 0.1349812 -0.1120929 0.3810559), wk = 0.0625000
k( 15) = ( -0.0304805 -0.2344633 -0.3992049), wk = 0.0625000
k( 16) = ( 0.0246734 -0.1936732 -0.1391180), wk = 0.0625000
k( 17) = ( 0.2994389 0.0154724 0.0145737), wk = 0.0625000
k( 18) = ( 0.3545928 0.0562626 0.2746606), wk = 0.0625000
k( 19) = ( 0.1891311 -0.0661078 -0.5056001), wk = 0.0625000
k( 20) = ( 0.2442850 -0.0253177 -0.2455132), wk = 0.0625000
k( 21) = ( 0.3569944 0.2729283 -0.0295494), wk = 0.0625000
k( 22) = ( 0.4121482 0.3137184 0.2305375), wk = 0.0625000
k( 23) = ( 0.2466866 0.1913480 -0.5497233), wk = 0.0625000
k( 24) = ( 0.3018405 0.2321382 -0.2896364), wk = 0.0625000
k( 25) = ( 0.1843280 -0.4994393 0.1028200), wk = 0.0625000
k( 26) = ( 0.2394818 -0.4586492 0.3629069), wk = 0.0625000
k( 27) = ( 0.0740202 -0.5810196 -0.4173539), wk = 0.0625000
k( 28) = ( 0.1291741 -0.5402294 -0.1572669), wk = 0.0625000
k( 29) = ( 0.2418834 -0.2419834 0.0586969), wk = 0.0625000
k( 30) = ( 0.2970373 -0.2011933 0.3187838), wk = 0.0625000
k( 31) = ( 0.1315757 -0.3235637 -0.4614770), wk = 0.0625000
k( 32) = ( 0.1867296 -0.2827736 -0.2013901), wk = 0.0625000
Dense grid: 9195 G-vectors FFT dimensions: ( 32, 25, 25)
Dense grid: 8487 G-vectors FFT dimensions: ( 36, 24, 24)
Estimated max dynamical RAM per process > 1.02 MB
Estimated max dynamical RAM per process > 0.94 MB
Estimated total dynamical RAM > 4.07 MB
Estimated total dynamical RAM > 3.74 MB
Message from routine read_rhog:
Conversion: Gamma charge to K charge
Plus vectors done
Search of minus vectors is going to take a while
The potential is recalculated from file :
./pwscf.save/charge-density
@ -151,215 +148,215 @@ Warning: card / ignored
Band Structure Calculation
Davidson diagonalization with overlap
ethr = 1.00E-09, avg # of iterations = 40.6
ethr = 1.00E-09, avg # of iterations = 41.6
total cpu time spent up to now is 0.9 secs
total cpu time spent up to now is 1.7 secs
End of band structure calculation
k = 0.1149 0.0762 0.0589 ( 1146 PWs) bands (ev):
k = 0.1374 0.1046 0.0768 ( 1063 PWs) bands (ev):
-18.7607 -13.1933 -9.4244 -7.7290 -5.3847 -3.1199 -2.4939 -1.6424
5.3258
-10.4810 -4.9244 -1.0533 -0.4642 1.3292 4.0516 5.1510 5.2918
7.7192
k = 0.1549 0.0913 0.2981 ( 1151 PWs) bands (ev):
k = 0.1925 0.1454 0.3369 ( 1056 PWs) bands (ev):
-17.9275 -15.2976 -8.8878 -7.2072 -4.6853 -3.3799 -2.7273 -1.2463
4.5084
-9.3681 -7.1722 -0.5129 0.6403 1.7691 2.3334 3.7493 6.4806
6.5015
k = 0.0350 0.0460-0.4195 ( 1152 PWs) bands (ev):
k = 0.0271 0.0230-0.4433 ( 1055 PWs) bands (ev):
-17.6498 -15.8601 -9.1022 -5.4133 -4.4636 -3.8094 -3.1036 -1.9600
3.3348
-9.3193 -7.2632 -0.5160 0.4545 1.9382 2.4861 3.8178 6.2450
7.2424
k = 0.0749 0.0611-0.1803 ( 1145 PWs) bands (ev):
k = 0.0822 0.0638-0.1832 ( 1055 PWs) bands (ev):
-18.6586 -13.8575 -8.7166 -7.3671 -5.2976 -3.0574 -2.3548 -1.9253
2.8434
-10.4654 -5.0259 -0.8884 -0.5425 1.2260 4.0532 5.4883 5.5484
7.7901
k = 0.1508 0.3007 0.0013 ( 1148 PWs) bands (ev):
k = 0.1949 0.3620 0.0327 ( 1059 PWs) bands (ev):
-18.2696 -14.6284 -9.4219 -6.7426 -4.8992 -3.6462 -2.4617 -1.2455
4.7791
-9.3791 -7.1980 -0.4650 0.6300 1.8021 2.3110 3.8175 6.4659
6.5705
k = 0.1908 0.3158 0.2405 ( 1149 PWs) bands (ev):
k = 0.2501 0.4028 0.2928 ( 1058 PWs) bands (ev):
-17.5669 -15.4266 -10.2080 -7.9893 -4.4110 -2.8530 -1.3890 -0.0811
5.2881
-8.4465 -7.1046 -2.8219 -1.5583 1.3919 2.4185 7.6575 7.7154
7.8265
k = 0.0708 0.2705-0.4771 ( 1149 PWs) bands (ev):
k = 0.0846 0.2804-0.4875 ( 1061 PWs) bands (ev):
-17.0396 -16.2805 -10.2184 -7.0087 -3.9270 -3.5217 -1.7183 0.0056
3.9560
-8.3178 -7.3050 -2.7563 -1.5179 1.4903 2.1704 7.2953 7.9562
7.9878
k = 0.1108 0.2856-0.2379 ( 1143 PWs) bands (ev):
k = 0.1398 0.3212-0.2274 ( 1067 PWs) bands (ev):
-18.0982 -15.1397 -9.3294 -5.3589 -4.7086 -3.8714 -2.8066 -1.9660
3.4880
-9.3400 -7.2719 -0.4803 0.6517 1.9599 2.1655 3.8993 6.3112
6.5451
k = 0.0431-0.3728 0.1742 ( 1148 PWs) bands (ev):
k = 0.0223-0.4103 0.1651 ( 1060 PWs) bands (ev):
-18.0980 -15.1409 -9.3278 -5.3586 -4.7217 -3.8686 -2.7841 -1.9670
3.4797
-9.3305 -7.2885 -0.4684 0.4442 1.9709 2.4666 3.8842 6.3156
7.2265
k = 0.0831-0.3576 0.4134 ( 1150 PWs) bands (ev):
k = 0.0774-0.3695 0.4252 ( 1062 PWs) bands (ev):
-17.0410 -16.2787 -10.2193 -7.0081 -3.8924 -3.5563 -1.7184 0.0063
3.9605
-8.3179 -7.3052 -2.7562 -1.5178 1.4909 2.1727 7.2944 7.9549
7.9879
k =-0.0368-0.4030-0.3043 ( 1143 PWs) bands (ev):
k =-0.0880-0.4919-0.3551 ( 1057 PWs) bands (ev):
-17.5636 -15.4286 -10.2101 -7.9918 -4.4806 -2.8159 -1.3884 -0.0811
5.4454
-8.4294 -7.1124 -2.8345 -1.5703 1.0653 2.5551 7.8238 7.9834
8.2430
k = 0.0032-0.3879-0.0650 ( 1143 PWs) bands (ev):
k =-0.0329-0.4511-0.0950 ( 1064 PWs) bands (ev):
-18.2674 -14.6301 -9.4237 -6.7441 -4.9576 -3.6486 -2.4227 -1.2433
4.7901
-9.3628 -7.2134 -0.4839 0.2739 1.7964 2.5925 3.8235 6.5830
7.7495
k = 0.0790-0.1483 0.1165 ( 1143 PWs) bands (ev):
k = 0.0798-0.1529 0.1210 ( 1055 PWs) bands (ev):
-18.6587 -13.8571 -8.7172 -7.3663 -5.2954 -3.0568 -2.3554 -1.9246
2.8473
-10.4654 -5.0263 -0.8882 -0.5422 1.2266 4.0575 5.4884 5.5476
7.7898
k = 0.1190-0.1332 0.3557 ( 1153 PWs) bands (ev):
k = 0.1350-0.1121 0.3811 ( 1064 PWs) bands (ev):
-17.6515 -15.8575 -9.1049 -5.4129 -4.4300 -3.8112 -3.1447 -1.9588
3.3489
-9.3290 -7.2467 -0.5279 0.6626 1.9274 2.1890 3.8335 6.2408
6.5590
k =-0.0009-0.1785-0.3619 ( 1150 PWs) bands (ev):
k =-0.0305-0.2345-0.3992 ( 1062 PWs) bands (ev):
-17.9246 -15.3002 -8.8900 -7.2089 -4.7551 -3.3810 -2.6773 -1.2453
4.5097
-9.3517 -7.1875 -0.5320 0.2846 1.7633 2.6133 3.7549 6.5144
7.7622
k = 0.0390-0.1634-0.1227 ( 1147 PWs) bands (ev):
k = 0.0247-0.1937-0.1391 ( 1062 PWs) bands (ev):
-18.7589 -13.1959 -9.4272 -7.7270 -5.4322 -3.1214 -2.4931 -1.6110
5.3279
-10.4712 -4.9398 -1.0719 -0.6880 1.3410 4.2430 5.1813 6.0016
7.7033
k = 0.2689-0.0110-0.0049 ( 1147 PWs) bands (ev):
k = 0.2994 0.0155 0.0146 ( 1062 PWs) bands (ev):
-18.7569 -13.1936 -9.4242 -7.7315 -5.4828 -3.1226 -2.4957 -1.6398
5.3419
-10.4613 -4.9211 -1.0498 -0.8996 1.3197 4.0181 5.1643 6.9731
7.7073
k = 0.3088 0.0041 0.2343 ( 1153 PWs) bands (ev):
k = 0.3546 0.0563 0.2747 ( 1063 PWs) bands (ev):
-17.9251 -15.2963 -8.8885 -7.2080 -4.7436 -3.3825 -2.7529 -1.2457
4.5284
-9.3554 -7.1601 -0.4980 0.3532 1.7525 2.1385 3.7329 6.5109
7.4729
k = 0.1889-0.0412-0.4833 ( 1149 PWs) bands (ev):
k = 0.1891-0.0661-0.5056 ( 1069 PWs) bands (ev):
-17.6464 -15.8601 -9.1035 -5.4135 -4.5418 -3.8064 -3.1065 -1.9606
3.3375
-9.3006 -7.2600 -0.5285 0.0893 1.9595 2.4262 3.8202 6.2286
9.0052
k = 0.2289-0.0261-0.2441 ( 1146 PWs) bands (ev):
k = 0.2443-0.0253-0.2455 ( 1066 PWs) bands (ev):
-18.6544 -13.8588 -8.7172 -7.3681 -5.4045 -3.0582 -2.3585 -1.9066
2.8511
-10.4435 -5.0300 -1.0001 -0.8939 1.2221 4.1047 5.5119 7.7606
7.7667
k = 0.3048 0.2135-0.0625 ( 1149 PWs) bands (ev):
k = 0.3570 0.2729-0.0295 ( 1063 PWs) bands (ev):
-18.2671 -14.6268 -9.4222 -6.7438 -4.9606 -3.6476 -2.4896 -1.2451
4.7871
-9.3663 -7.1859 -0.4501 0.3419 1.7856 2.1139 3.8014 6.5795
7.4623
k = 0.3447 0.2286 0.1767 ( 1158 PWs) bands (ev):
k = 0.4121 0.3137 0.2305 ( 1056 PWs) bands (ev):
-17.5660 -15.4261 -10.2036 -7.9889 -4.4294 -2.8794 -1.3917 -0.0827
5.0380
-8.4431 -7.0882 -2.7956 -1.5713 1.3246 2.1618 6.9347 7.8050
7.8173
k = 0.2248 0.1833-0.5409 ( 1160 PWs) bands (ev):
k = 0.2467 0.1913-0.5497 ( 1055 PWs) bands (ev):
-17.0378 -16.2810 -10.2159 -7.0048 -3.9640 -3.5294 -1.7212 0.0042
3.9434
-8.2972 -7.3089 -2.7631 -1.4899 1.1147 2.2355 7.5096 7.9577
7.9849
k = 0.2648 0.1984-0.3017 ( 1141 PWs) bands (ev):
k = 0.3018 0.2321-0.2896 ( 1066 PWs) bands (ev):
-18.0953 -15.1389 -9.3303 -5.3630 -4.7780 -3.8693 -2.8186 -1.9681
3.4874
-9.3207 -7.2685 -0.4921 0.2453 1.9817 2.1100 3.9011 6.2986
8.1101
k = 0.1971-0.4600 0.1104 ( 1157 PWs) bands (ev):
k = 0.1843-0.4994 0.1028 ( 1075 PWs) bands (ev):
-18.0953 -15.1405 -9.3289 -5.3628 -4.7921 -3.8667 -2.7946 -1.9691
3.4788
-9.3117 -7.2853 -0.4809 0.0780 1.9919 2.4045 3.8863 6.2990
8.9961
k = 0.2371-0.4448 0.3496 ( 1159 PWs) bands (ev):
k = 0.2395-0.4586 0.3629 ( 1055 PWs) bands (ev):
-17.0395 -16.2791 -10.2169 -7.0043 -3.9323 -3.5608 -1.7212 0.0048
3.9475
-8.2973 -7.3090 -2.7630 -1.4898 1.1152 2.2380 7.5091 7.9566
7.9847
k = 0.1171-0.4902-0.3680 ( 1156 PWs) bands (ev):
k = 0.0740-0.5810-0.4174 ( 1058 PWs) bands (ev):
-17.5629 -15.4281 -10.2057 -7.9916 -4.4985 -2.8432 -1.3914 -0.0831
5.1705
-8.4263 -7.0958 -2.8083 -1.5828 1.0054 2.2819 7.2392 7.8161
8.3091
k = 0.1571-0.4751-0.1288 ( 1142 PWs) bands (ev):
k = 0.1292-0.5402-0.1573 ( 1060 PWs) bands (ev):
-18.2648 -14.6285 -9.4241 -6.7452 -5.0173 -3.6505 -2.4505 -1.2429
4.7955
-9.3497 -7.2011 -0.4691 0.0354 1.7776 2.3663 3.8084 6.5923
9.1881
k = 0.2330-0.2355 0.0528 ( 1150 PWs) bands (ev):
k = 0.2419-0.2420 0.0587 ( 1067 PWs) bands (ev):
-18.6546 -13.8587 -8.7177 -7.3675 -5.4028 -3.0579 -2.3590 -1.9061
2.8546
-10.4434 -5.0305 -0.9998 -0.8937 1.2225 4.1091 5.5121 7.7586
7.7664
k = 0.2730-0.2204 0.2920 ( 1145 PWs) bands (ev):
k = 0.2970-0.2012 0.3188 ( 1063 PWs) bands (ev):
-17.6479 -15.8574 -9.1061 -5.4130 -4.5089 -3.8079 -3.1481 -1.9596
3.3515
-9.3098 -7.2435 -0.5396 0.2570 1.9493 2.1353 3.8359 6.2281
8.1173
k = 0.1530-0.2657-0.4256 ( 1156 PWs) bands (ev):
k = 0.1316-0.3236-0.4615 ( 1065 PWs) bands (ev):
-17.9222 -15.2991 -8.8908 -7.2100 -4.8115 -3.3845 -2.7033 -1.2448
4.5259
-9.3389 -7.1755 -0.5171 0.0469 1.7445 2.3897 3.7396 6.5240
9.1835
k = 0.1930-0.2506-0.1864 ( 1152 PWs) bands (ev):
k = 0.1867-0.2828-0.2014 ( 1058 PWs) bands (ev):
-18.7553 -13.1963 -9.4270 -7.7293 -5.5285 -3.1244 -2.4951 -1.6080
5.3393
-10.4514 -4.9361 -1.0767 -1.0684 1.3310 4.2078 5.1647 7.6835
8.3909
the Fermi energy is -3.8936 ev
(compare with: 1.1251 eV, computed in scf)
the Fermi energy is 2.0449 ev
(compare with: 3.4465 eV, computed in scf)
Writing output data file ./pwscf.save/
Writing all to output data dir ./pwscf.save/
init_run : 0.03s CPU 0.03s WALL ( 1 calls)
electrons : 0.69s CPU 0.75s WALL ( 1 calls)
init_run : 0.01s CPU 0.05s WALL ( 1 calls)
electrons : 1.42s CPU 1.59s WALL ( 1 calls)
Called by init_run:
wfcinit : 0.00s CPU 0.00s WALL ( 1 calls)
potinit : 0.02s CPU 0.02s WALL ( 1 calls)
hinit0 : 0.01s CPU 0.01s WALL ( 1 calls)
potinit : 0.00s CPU 0.00s WALL ( 1 calls)
hinit0 : 0.01s CPU 0.04s WALL ( 1 calls)
Called by electrons:
c_bands : 0.69s CPU 0.75s WALL ( 1 calls)
c_bands : 1.42s CPU 1.59s WALL ( 1 calls)
v_of_rho : 0.00s CPU 0.00s WALL ( 1 calls)
Called by c_bands:
init_us_2 : 0.00s CPU 0.00s WALL ( 32 calls)
cegterg : 0.66s CPU 0.72s WALL ( 76 calls)
cegterg : 1.37s CPU 1.53s WALL ( 81 calls)
Called by *egterg:
cdiaghg : 0.11s CPU 0.12s WALL ( 1331 calls)
h_psi : 0.48s CPU 0.52s WALL ( 1407 calls)
g_psi : 0.01s CPU 0.01s WALL ( 1299 calls)
cdiaghg : 0.55s CPU 0.61s WALL ( 1363 calls)
h_psi : 0.61s CPU 0.69s WALL ( 1444 calls)
g_psi : 0.01s CPU 0.01s WALL ( 1331 calls)
Called by h_psi:
h_psi:calbec : 0.02s CPU 0.02s WALL ( 1407 calls)
vloc_psi : 0.44s CPU 0.49s WALL ( 1407 calls)
add_vuspsi : 0.01s CPU 0.01s WALL ( 1407 calls)
h_psi:calbec : 0.02s CPU 0.02s WALL ( 1444 calls)
vloc_psi : 0.58s CPU 0.65s WALL ( 1444 calls)
add_vuspsi : 0.01s CPU 0.01s WALL ( 1444 calls)
General routines
calbec : 0.01s CPU 0.01s WALL ( 1407 calls)
fft : 0.00s CPU 0.01s WALL ( 3 calls)
fftw : 0.38s CPU 0.42s WALL ( 16260 calls)
calbec : 0.02s CPU 0.02s WALL ( 1444 calls)
fft : 0.00s CPU 0.03s WALL ( 3 calls)
fftw : 0.52s CPU 0.58s WALL ( 16284 calls)
davcio : 0.00s CPU 0.00s WALL ( 64 calls)
Parallel routines
PWSCF : 0.80s CPU 0.88s WALL
PWSCF : 1.49s CPU 1.70s WALL
This run was terminated on: 3: 6:25 6Feb2021
This run was terminated on: 8:50:22 17Oct2021
=------------------------------------------------------------------------------=
JOB DONE.

View File

@ -1 +0,0 @@
Maximum number of iterations reached, stopping

View File

@ -4,9 +4,12 @@
/
&SYSTEM
ibrav = 14,
A = 3.70971016 ,
B = 3.70971016 ,
C = 3.70971016 ,
! A = 3.70971016 ,
! B = 3.70971016 ,
! C = 3.70971016 ,
A = 4.0 ,
B = 4.0 ,
C = 4.0 ,
cosAB = 0.49517470 ,
cosAC = 0.49517470 ,
cosBC = 0.49517470 ,
@ -25,9 +28,8 @@
! ion_positions = 'from_file'
/
&CELL
cell_dynamics = 'damp-w' ,
press = 0.00 ,
wmass = 0.00700000
cell_dynamics = 'bfgs' ,
press = 0.00
/
ATOMIC_SPECIES
As 74.90000 As.pz-bhs.UPF

View File

@ -12,7 +12,7 @@ tolerance = ( (8.0e-4, 1.0e-4, 'e1'),
(1.0e-2, 2.0e-2, 'ehl1'),
(2.0e-1, None, 'band'),
(1.0e-2, 1.0e-2, 'tf1'),
(5.0e-3, None, 'geom') )
(5.0e-2, None, 'geom') )
skip_program = grep
skip_args = 'not present in this version'

View File

@ -25,7 +25,7 @@ MODULE uspp_data
!
INTEGER :: nqxq
!! size of interpolation table
INTEGER :: nqx
INTEGER :: nqx
!! number of interpolation points
REAL(DP), PARAMETER:: dq = 0.01D0
!! space between points in the pseudopotential tab.
@ -45,7 +45,7 @@ MODULE uspp_data
REAL(DP), ALLOCATABLE :: tab_d(:,:,:)
REAL(DP), ALLOCATABLE :: tab_at_d(:,:,:)
REAL(DP), ALLOCATABLE :: tab_d2y_d(:,:,:)
!
!
#if defined(__CUDA)
attributes (DEVICE) :: qrad_d, tab_d, tab_at_d, tab_d2y_d
#endif
@ -88,7 +88,7 @@ contains
if( allocated( tab_d ) ) deallocate( tab_d )
if( allocated( tab_at_d ) ) deallocate( tab_at_d )
if( allocated( tab_d2y_d ) ) deallocate( tab_d2y_d )
end subroutine
end subroutine
!
subroutine scale_uspp_data( vol_ratio_m1 )
! vol_ratio_m1 = omega_old / omega
@ -99,9 +99,10 @@ contains
qrad(:,:,:,:) = qrad(:,:,:,:) * vol_ratio_m1
tab_at(:,:,:) = tab_at(:,:,:) * SQRT(vol_ratio_m1)
#if defined __CUDA
tab_d=tab
qrad_d=qrad
tab_at_d=tab_at
! CUDA Fortran safeguard
if(size(tab) > 0) tab_d = tab
if(size(qrad) > 0) qrad_d = qrad
if(size(tab_at) > 0) tab_at_d = tab_at
#endif
end subroutine scale_uspp_data
!