mirror of https://gitlab.com/QEF/q-e.git
XClib - small changes in test and libxc threshold refinements
This commit is contained in:
parent
8a9d3751ff
commit
e5d3914db6
|
@ -13,7 +13,7 @@ cally if 'QE_ENABLE_TEST' is set to true (default).
|
|||
|
||||
---------------------- XC_INFO -----------------------------------
|
||||
|
||||
xc_info.x is a small serial program that provides infos on XC
|
||||
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:
|
||||
|
||||
|
@ -27,16 +27,26 @@ tell if they are currently usable in QE or not.
|
|||
|
||||
--------------------- XCLIB_TEST ---------------------------------
|
||||
|
||||
xclib_test.x is a testing program for the XClib library routines.
|
||||
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 the available options
|
||||
in order not to neglect any of them (which is hard to do
|
||||
by working with test-suite only).
|
||||
The program generates an xml file with a set of output data produced
|
||||
according to the test input options.
|
||||
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.
|
||||
|
||||
You can run the program by using commands like:
|
||||
|
||||
./xclib_test.x < input_file [ serial ]
|
||||
|
@ -47,45 +57,46 @@ different purposes.
|
|||
An example of input file content is the following:
|
||||
|
||||
&INPUT_NAMELIST
|
||||
test='gen-benchmark'
|
||||
test='generate'
|
||||
filename_xml='xctest_data.xml'
|
||||
dft='pbe'
|
||||
family='GGA'
|
||||
nspin=1
|
||||
polarization='unpolarized'
|
||||
xc_derivative=.FALSE.
|
||||
/
|
||||
|
||||
The following options have to be set:
|
||||
The following input options have to be set (capital or lowercase is the same):
|
||||
|
||||
- test: 'gen-benchmark' generates the xml file with the benchmark set
|
||||
of XClib output data. 'exe-benchmark' calculates a set of
|
||||
XClib output data and compares it with the one in the xml file.
|
||||
- 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
|
||||
- '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')
|
||||
- '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
|
||||
- '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.
|
||||
If dft='ALL_...' then input family will be ignored.
|
||||
|
||||
- polarization: 'unpolarized', 'polarized', 'both'.
|
||||
- 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.
|
||||
the ordinary energy&potential output.
|
||||
|
||||
- show_time: if .TRUE. stores WALL time spent by xc-routines during
|
||||
'gen-' test and shows increment (in percentage) during
|
||||
'exe-' test.
|
||||
'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
|
||||
|
|
|
@ -1107,7 +1107,7 @@ CONTAINS
|
|||
IF ( family==XC_FAMILY_HYB_GGA .OR. family==XC_FAMILY_HYB_MGGA ) THEN
|
||||
exx_fraction = xc_f03_hyb_exx_coef( xc_func(iid) )
|
||||
ishybrid = ( exx_fraction /= 0.d0 )
|
||||
ENDIF
|
||||
ENDIF
|
||||
!
|
||||
n_ext_params(iid) = xc_f03_func_info_get_n_ext_params( xc_info(iid) )
|
||||
#if (XC_MAJOR_VERSION<=5)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
&INPUT_NAMELIST
|
||||
test='exe-benchmark'
|
||||
filename_xml='xctest.xml'
|
||||
test='execute'
|
||||
filename_xml='xctest_data.xml'
|
||||
dft='all_terms'
|
||||
family= ''
|
||||
polarization='both'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
&INPUT_NAMELIST
|
||||
test='gen-benchmark'
|
||||
filename_xml='xctest.xml'
|
||||
test='generate'
|
||||
filename_xml='xctest_data.xml'
|
||||
dft='all_terms'
|
||||
family= ''
|
||||
polarization= 'both'
|
||||
|
|
|
@ -18,7 +18,7 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
|
|||
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
|
||||
grho_threshold_gga, rho_threshold_lda
|
||||
USE qe_drivers_d_gga
|
||||
#if defined(__LIBXC)
|
||||
#include "xc_version.h"
|
||||
|
@ -135,8 +135,6 @@ SUBROUTINE dgcxc( length, sp, r_in, g_in, dvxc_rr, dvxc_sr, dvxc_ss )
|
|||
ENDIF
|
||||
ENDIF
|
||||
!
|
||||
IF (ANY(is_libxc(3:4))) DEALLOCATE( rho_lbxc, sigma )
|
||||
!
|
||||
dvxc_rr = 0._DP
|
||||
dvxc_sr = 0._DP
|
||||
dvxc_ss = 0._DP
|
||||
|
@ -149,14 +147,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) )
|
||||
|
@ -180,17 +178,24 @@ 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
|
||||
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
|
||||
ENDIF
|
||||
DO k = 1, length
|
||||
IF ( rho_lbxc(k) > small .AND. SQRT(ABS(sigma(k))) > small ) THEN
|
||||
IF ( is_libxc(3) ) THEN
|
||||
IF ( rho_lbxc(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
|
||||
ENDIF
|
||||
IF ( is_libxc(4) ) THEN
|
||||
IF ( rho_lbxc(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
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDDO
|
||||
!
|
||||
ELSEIF ( sp == 2 ) THEN
|
||||
!
|
||||
|
@ -270,7 +275,10 @@ 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_lbxc )
|
||||
IF (ALLOCATED(sigma) ) DEALLOCATE( sigma )
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
|
|
|
@ -62,7 +62,7 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
|
|||
REAL(DP), PARAMETER :: pi34 = 0.6203504908994_DP
|
||||
!
|
||||
LOGICAL :: POLARIZED
|
||||
INTEGER :: pol_unpol, eflag
|
||||
INTEGER :: pol_unpol
|
||||
#if (XC_MAJOR_VERSION > 4)
|
||||
INTEGER(8) :: lengthxc
|
||||
#else
|
||||
|
@ -166,9 +166,12 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
|
|||
!
|
||||
IF (.NOT. POLARIZED) THEN
|
||||
DO k = 1, length
|
||||
ec(k) = ec_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1))
|
||||
v1c(k,1) = vc_rho(k)
|
||||
v2c(k,1) = vc_sigma(k)*2.d0
|
||||
IF ( rho_lxc(k) > rho_threshold_lda ) THEN
|
||||
ec(k) = ec_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1))
|
||||
v1c(k,1) = vc_rho(k)
|
||||
ENDIF
|
||||
IF ( rho_lxc(k)>small .AND. SQRT(ABS(sigma(k)))>small ) &
|
||||
v2c(k,1) = vc_sigma(k)*2.d0
|
||||
ENDDO
|
||||
ELSE
|
||||
DO k = 1, length
|
||||
|
@ -264,9 +267,12 @@ SUBROUTINE xc_gcx_( length, ns, rho, grho, ex, ec, v1x, v2x, v1c, v2c, v2c_ud )
|
|||
!
|
||||
IF (.NOT. POLARIZED) THEN
|
||||
DO k = 1, length
|
||||
ex(k) = ex_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1))
|
||||
v1x(k,1) = vx_rho(k)
|
||||
v2x(k,1) = vx_sigma(k)*2.d0
|
||||
xlda_up = 1.0_DP ; xgga_up = 1.0_DP
|
||||
IF ( rho_lxc(k) <= rho_threshold_lda ) xlda_up = 0.0_DP
|
||||
IF ( rho_lxc(k)<=small .OR. SQRT(ABS(sigma(k)))<=small ) xgga_up = 0.0_DP
|
||||
ex(k) = ex_lxc(k) * rho_lxc(k) * SIGN(1.0_DP, rho(k,1)) *xlda_up
|
||||
v1x(k,1) = vx_rho(k)*xlda_up
|
||||
v2x(k,1) = vx_sigma(k)*2.d0*xgga_up
|
||||
ENDDO
|
||||
ELSE
|
||||
DO k = 1, length
|
||||
|
|
|
@ -207,10 +207,10 @@ SUBROUTINE xc_metagcx( length, ns, np, rho, grho, tau, ex, ec, v1x, v2x, v3x, v1
|
|||
CALL xc_f03_func_set_dens_threshold( xc_func(6), rho_threshold_mgga )
|
||||
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) )
|
||||
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) )
|
||||
vc_rho(1), vc_sigma(1), vlapl_rho(1), vc_tau(1) )
|
||||
ec_lxc = 0.d0
|
||||
ENDIF
|
||||
!
|
||||
|
|
|
@ -11,9 +11,9 @@ PROGRAM xclib_test
|
|||
!==========================================================================
|
||||
!! Testing program for xc\_lib library in QE:
|
||||
!
|
||||
!! * gen-benchmark: stores a set of dft benchmark data on xml file;
|
||||
!! * exe-benchmark: runs XClib to calculate data and compare them
|
||||
!! to benchamrk data in xml file.
|
||||
!! * generate: stores a set of dft benchmark data on xml file;
|
||||
!! * execute: runs XClib to calculate data and compare them
|
||||
!! to benchamrk data in xml file.
|
||||
!
|
||||
!! Choices:
|
||||
!
|
||||
|
@ -46,9 +46,9 @@ PROGRAM xclib_test
|
|||
#if defined(__LIBXC)
|
||||
#include "xc_version.h"
|
||||
USE xc_f03_lib_m
|
||||
USE dft_setting_params, ONLY: xc_func, xc_info, xc_kind_error, libxc_flags
|
||||
USE dft_setting_params, ONLY: xc_info, xc_kind_error, libxc_flags
|
||||
#endif
|
||||
USE dft_setting_params, ONLY: is_libxc, exx_fraction
|
||||
USE dft_setting_params, ONLY: is_libxc
|
||||
USE dft_setting_routines, ONLY: capital
|
||||
!
|
||||
USE qe_dft_list, ONLY: nxc, ncc, ngcx, ngcc, nmeta, n_dft, &
|
||||
|
@ -66,7 +66,7 @@ PROGRAM xclib_test
|
|||
#endif
|
||||
!
|
||||
#if defined(__LIBXC)
|
||||
INTEGER :: major, minor, micro, fkind, n_ext
|
||||
INTEGER :: major, minor, micro, fkind
|
||||
#endif
|
||||
!
|
||||
INTEGER :: mype, npes, comm, ntgs, root
|
||||
|
@ -79,15 +79,15 @@ PROGRAM xclib_test
|
|||
!
|
||||
!-------- Grid dim vars --------------------
|
||||
INTEGER, PARAMETER :: npoints=90000
|
||||
INTEGER :: nr, nnr, nrpe, nnr_b, nnr_int, nnrbt
|
||||
INTEGER :: nnrit, nnrbit, nskip
|
||||
INTEGER :: nr, nnr, nrpe, nnr_b, nnrbt
|
||||
INTEGER :: is, is_min, is_max
|
||||
!
|
||||
!-------- Input vars -----------------------
|
||||
CHARACTER(LEN=30) :: test, family, fam_init, xc_kind
|
||||
CHARACTER(LEN=30) :: dft, dft_init, xmldft, xmlfamily
|
||||
CHARACTER(LEN=15) :: test, family, fam_init
|
||||
CHARACTER(LEN=30) :: dft, dft_init, xc_kind, xmldft, xmlfamily
|
||||
CHARACTER(LEN=30) :: polarization, xmlpolarization
|
||||
CHARACTER(LEN=15) :: input_err=''
|
||||
CHARACTER(LEN=15) :: input_err_where=''
|
||||
CHARACTER(LEN=40) :: input_err=''
|
||||
LOGICAL :: xc_derivative, xmlxc_derivative, show_time
|
||||
!
|
||||
!---------- DFT infos -------------------------
|
||||
|
@ -112,11 +112,10 @@ PROGRAM xclib_test
|
|||
REAL(DP) :: fact
|
||||
REAL(DP) :: aver_thresh = 10.E-8 !^^--- to optimize
|
||||
!
|
||||
!---------- Indexes ---------------------------
|
||||
INTEGER :: id, ii, ns, np, ipol, ithr, nthr, iip, iout, &
|
||||
iaverout, iavernull, l
|
||||
!---------- Loop indexes ---------------------------
|
||||
INTEGER :: id, ii, ns, np, nthr, iip, iout, iaverout, iavernull, l
|
||||
!
|
||||
!---------- XClib input vars ------------------
|
||||
!---------- XC-input vars ------------------
|
||||
REAL(DP), ALLOCATABLE :: rho(:,:), rho_tz(:,:)
|
||||
REAL(DP), ALLOCATABLE :: grho(:,:,:), grh(:,:,:)
|
||||
REAL(DP), ALLOCATABLE :: tau(:,:)
|
||||
|
@ -240,6 +239,9 @@ PROGRAM xclib_test
|
|||
!
|
||||
READ( stdin, input_namelist )
|
||||
!
|
||||
DO i = 1, LEN_TRIM(test)
|
||||
test(i:i) = capital( test(i:i) )
|
||||
ENDDO
|
||||
DO i = 1, LEN_TRIM(dft)
|
||||
dft(i:i) = capital( dft(i:i) )
|
||||
ENDDO
|
||||
|
@ -251,7 +253,7 @@ PROGRAM xclib_test
|
|||
ENDDO
|
||||
IF ( dft(1:4)=='ALL_' ) family = 'ALL'
|
||||
!
|
||||
IF ( test(1:4)=='gen-' ) THEN
|
||||
IF ( test=='GENERATE' ) THEN
|
||||
!
|
||||
iunpun = xml_open_file( "./"//TRIM(filename_xml) )
|
||||
IF ( iunpun == -1 ) RETURN
|
||||
|
@ -263,18 +265,18 @@ PROGRAM xclib_test
|
|||
CALL add_attr( "SPIN", polarization )
|
||||
CALL xmlw_writetag( "HEADER", "" )
|
||||
!
|
||||
ELSEIF ( test(1:4)=='exe-' ) THEN
|
||||
ELSEIF ( TRIM(test)=='EXECUTE' ) THEN
|
||||
!
|
||||
INQUIRE( FILE = filename_xml, exist=found )
|
||||
IF (.NOT. found ) THEN
|
||||
ierr=1
|
||||
CALL xclib_infomsg( 'xclib_test', 'xml data file not found' )
|
||||
CALL xclib_error( 'xclib_test', 'xml data file not found' )
|
||||
ENDIF
|
||||
!
|
||||
iun = xml_open_file( filename_xml )
|
||||
IF ( iun==-1 ) THEN
|
||||
ierr=2
|
||||
CALL xclib_infomsg( 'xclib_test', 'xml data file not readable' )
|
||||
CALL xclib_error( 'xclib_test', 'xml data file not readable' )
|
||||
ENDIF
|
||||
!
|
||||
CALL xmlr_opentag( "XCTEST-DATA-SET" )
|
||||
|
@ -285,20 +287,25 @@ PROGRAM xclib_test
|
|||
CALL get_attr( "VXC_DERIVATIVE", xmlxc_derivative )
|
||||
CALL get_attr( "SPIN", xmlpolarization )
|
||||
!
|
||||
IF ( dft(1:4)=='all_' .AND. TRIM(dft) /= TRIM(xmldft) ) input_err = 'dft'
|
||||
IF ( xmlxc_derivative .NEQV. xc_derivative ) input_err = 'xc_derivative'
|
||||
IF ( TRIM(xmlpolarization) /= 'BOTH'.AND.polarization /= xmlpolarization ) &
|
||||
input_err = 'polarization'
|
||||
IF ( TRIM(input_err) /= '' ) THEN
|
||||
WRITE(stdout,*) 'ERROR: input mismatch in: ', TRIM(input_err)
|
||||
STOP
|
||||
IF ( dft(1:4)=='ALL_' .AND. TRIM(dft)/=TRIM(xmldft) ) input_err_where = 'dft'
|
||||
IF ( TRIM(xmlpolarization)/='BOTH' .AND. polarization/=xmlpolarization ) &
|
||||
input_err_where = 'polarization'
|
||||
IF ( xmlxc_derivative .NEQV. xc_derivative ) input_err_where = 'xc_derivative'
|
||||
IF ( TRIM(input_err_where) /= '' ) THEN
|
||||
input_err = 'Input mismatch in: '
|
||||
WRITE(input_err(20:35), '(a)') input_err_where
|
||||
CALL xclib_error( 'xclib_test', input_err, 1 )
|
||||
ENDIF
|
||||
IF ( TRIM(family) /= TRIM(xmlfamily) ) THEN
|
||||
WRITE(stdout,*) 'WARNING: input mismatch in FAMILY. The one in the xml file&
|
||||
&will be considered only.'
|
||||
WRITE(stdout,*) 'WARNING: input mismatch in FAMILY. The one in the xml &
|
||||
&file will be considered only.'
|
||||
family = xmlfamily
|
||||
ENDIF
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
CALL xclib_error( 'xclib_test', 'Wrong input test.', 2 )
|
||||
!
|
||||
ENDIF
|
||||
ENDIF
|
||||
!
|
||||
|
@ -347,7 +354,7 @@ PROGRAM xclib_test
|
|||
proc2node(i) = ii
|
||||
ENDDO
|
||||
!
|
||||
IF ( mype == root .AND. test/='gen-benchmark' ) THEN
|
||||
IF ( mype == root .AND. test/='GENERATE' ) THEN
|
||||
WRITE(stdout,*) ; WRITE(stdout,*) ' --- XC_LIB TESTING PROGRAM --- '
|
||||
WRITE(stdout,*)
|
||||
WRITE(stdout,*) 'Node list:'
|
||||
|
@ -378,17 +385,16 @@ PROGRAM xclib_test
|
|||
ELSEIF (TRIM(polarization)=='BOTH' ) THEN
|
||||
is_min = 1 ; is_max = 2
|
||||
ELSE
|
||||
WRITE(stdout,*) 'ERROR: unrecognized input polarization.'
|
||||
STOP
|
||||
CALL xclib_error( 'xclib_test', 'Wrong input polarization.', 3 )
|
||||
ENDIF
|
||||
!
|
||||
fam_init = family
|
||||
dft_init = dft
|
||||
!
|
||||
n_qe_func = 1
|
||||
IF (dft=='ALL_TERMS') n_qe_func = nxc+ncc+ngcx+ngcc+nmeta+5
|
||||
IF (dft=='ALL_SHORT') n_qe_func = n_dft
|
||||
IF (dft=='ALL_LIBXC') n_qe_func = 999
|
||||
IF (TRIM(dft)=='ALL_TERMS') n_qe_func = nxc+ncc+ngcx+ngcc+nmeta+5
|
||||
IF (TRIM(dft)=='ALL_SHORT') n_qe_func = n_dft
|
||||
IF (TRIM(dft)=='ALL_LIBXC') n_qe_func = 999
|
||||
!
|
||||
! ... check QE and Libxc versions used for storing and the current ones
|
||||
!
|
||||
|
@ -400,17 +406,14 @@ PROGRAM xclib_test
|
|||
WRITE(libxc_version(3:3), '(i1)') minor
|
||||
WRITE(libxc_version(5:5), '(i1)') micro
|
||||
#else
|
||||
IF (dft=='ALL_LIBXC') THEN
|
||||
WRITE(stdout,*) 'ERROR: Libxc library not linked.'
|
||||
STOP
|
||||
ENDIF
|
||||
IF (dft=='ALL_LIBXC') CALL xclib_error( 'xclib_test','Libxc library not linked.',4 )
|
||||
#endif
|
||||
IF ( test=='gen-benchmark' ) THEN
|
||||
IF ( TRIM(test)=='GENERATE' ) THEN
|
||||
CALL xmlw_opentag( "QE_Libxc_VERSION_TEST" )
|
||||
CALL xmlw_writetag( "QE_version", version_number )
|
||||
CALL xmlw_writetag( "Libxc_version", libxc_version )
|
||||
CALL xmlw_closetag()
|
||||
ELSEIF ( test=='exe-benchmark' ) THEN
|
||||
ELSEIF ( TRIM(test)=='EXECUTE' ) THEN
|
||||
CALL xmlr_opentag( "QE_Libxc_VERSION_TEST" )
|
||||
CALL xmlr_readtag( "QE_version", gen_version )
|
||||
CALL xmlr_readtag( "Libxc_version", libxc_gen_version )
|
||||
|
@ -428,7 +431,7 @@ PROGRAM xclib_test
|
|||
! ... main loop over functionals to test
|
||||
!
|
||||
DO id = 1, n_qe_func
|
||||
DO is = is_min, is_max
|
||||
DO is = is_min, is_max
|
||||
!
|
||||
time = 0.d0
|
||||
ns = is
|
||||
|
@ -473,12 +476,14 @@ PROGRAM xclib_test
|
|||
!
|
||||
! ... skipped cases (some need further checks)
|
||||
!
|
||||
IF ( TRIM(dft)=='xxxx' .OR. &
|
||||
TRIM(dft)=='NONE' .OR. &
|
||||
TRIM(dft)=='META' .OR. &
|
||||
IF ( TRIM(dft)=='xxxx' .OR. TRIM(dft)=='NONE' ) THEN
|
||||
IF (mype==root) CALL print_test_status( skipped )
|
||||
CYCLE
|
||||
ENDIF
|
||||
IF ( TRIM(dft)=='META' .OR. &
|
||||
TRIM(dft)=='PZ+META' .OR. &
|
||||
TRIM(dft)=='PBE+META' ) THEN
|
||||
IF (mype==root) CALL print_test_status( skipped )
|
||||
IF (mype==root .AND. .NOT.xc_derivative) CALL print_test_status( skipped )
|
||||
CYCLE
|
||||
ENDIF
|
||||
#if !defined(__LIBXC)
|
||||
|
@ -500,7 +505,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
CALL xclib_set_dft_from_name( dft )
|
||||
!
|
||||
LDA = .FALSE. ; GGA = .FALSE. ; MGGA= .FALSE.
|
||||
LDA = .FALSE. ; GGA = .FALSE. ; MGGA = .FALSE.
|
||||
!
|
||||
iexch1 = xclib_get_ID('LDA','EXCH')
|
||||
icorr1 = xclib_get_ID('LDA','CORR')
|
||||
|
@ -524,6 +529,11 @@ PROGRAM xclib_test
|
|||
CALL xclib_finalize_libxc()
|
||||
CYCLE
|
||||
ENDIF
|
||||
IF ( xc_derivative .AND. ANY(libxc_flags(:,2)==0) ) THEN
|
||||
CALL print_test_status( skipped )
|
||||
CALL xclib_finalize_libxc()
|
||||
CYCLE
|
||||
ENDIF
|
||||
!
|
||||
IF (dft_init=='ALL_LIBXC') THEN
|
||||
fkind=-10
|
||||
|
@ -540,7 +550,7 @@ PROGRAM xclib_test
|
|||
ENDIF
|
||||
ENDIF
|
||||
#else
|
||||
IF (xclib_dft_is_libxc('ANY')) THEN
|
||||
IF (xclib_dft_is_libxc( 'ANY' )) THEN
|
||||
CALL print_test_status( skipped3 )
|
||||
CYCLE
|
||||
ENDIF
|
||||
|
@ -618,13 +628,14 @@ PROGRAM xclib_test
|
|||
np = 1
|
||||
IF (ns==2) np = 3
|
||||
!
|
||||
! ... number of averages to calculate
|
||||
IF (.NOT.xc_derivative) THEN
|
||||
IF ( LDA ) naver = ns+1
|
||||
IF ( LDA .AND. TRIM(xc_kind)=='XC') naver = 2*ns+2
|
||||
IF ( GGA .AND. TRIM(xc_kind)=='X') naver = 2*ns+1
|
||||
IF ( GGA .AND. TRIM(xc_kind)=='C') naver = 3*ns+np
|
||||
IF ( GGA .AND. TRIM(xc_kind)=='X' ) naver = 2*ns+1
|
||||
IF ( GGA .AND. TRIM(xc_kind)=='C' ) naver = 3*ns+np
|
||||
IF ( GGA .AND. TRIM(xc_kind)=='XC') naver = 4*ns+np
|
||||
IF ( MGGA ) naver = 8
|
||||
IF ( MGGA ) naver = 6*ns+2
|
||||
ELSE
|
||||
IF ( LDA ) naver = np
|
||||
IF ( GGA ) naver = 3*np
|
||||
|
@ -670,7 +681,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
! ... dft2 output / benchmark data arrays
|
||||
!
|
||||
IF ( test == 'exe-benchmark' ) THEN
|
||||
IF ( TRIM(test)=='EXECUTE' ) THEN
|
||||
IF (.NOT. xc_derivative) ALLOCATE( ex2(nnrbt), ec2(nnrbt) )
|
||||
!
|
||||
IF ( LDA .OR. GGA ) THEN
|
||||
|
@ -703,7 +714,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
nlen1 = LEN(TRIM(dft))
|
||||
nlen2 = LEN(TRIM(family))
|
||||
IF ( dft_init=='ALL_TERMS' .OR. dft_init(1:4)/='ALL_') THEN
|
||||
IF ( dft_init=='ALL_TERMS' .OR. dft_init(1:4)/='ALL_' ) THEN
|
||||
WRITE(xc_data(9:8+nlen1),'(a)') dft(1:nlen1)
|
||||
WRITE(xc_data(14:13+nlen2),'(a)') family(1:nlen2)
|
||||
IF (is==1) WRITE(xc_data(18:30),'(a)') 'UNP'
|
||||
|
@ -716,7 +727,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
! ... read data set from xml file
|
||||
!
|
||||
IF (test=='exe-benchmark' .AND. mype==root) THEN
|
||||
IF (test=='EXECUTE' .AND. mype==root) THEN
|
||||
CALL xmlr_opentag( TRIM(xc_data), tag_err )
|
||||
IF (tag_err==0) THEN
|
||||
CALL xmlr_readtag( "time_tot", time_tot2 )
|
||||
|
@ -888,7 +899,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
! --- THRESHOLD POINTS ---
|
||||
!
|
||||
IF (mype==root .AND. test(5:13)=='benchmark') THEN
|
||||
IF (mype==root) THEN
|
||||
rho(nnr_b+1,1) = thresh_lda/3.0_DP
|
||||
IF (.NOT. POLARIZED) rho_tz(nnr_b+1,1) = rho(nnr_b+1,1)
|
||||
IF ( POLARIZED ) THEN
|
||||
|
@ -1028,7 +1039,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
! ... store data set in xml file
|
||||
!
|
||||
IF (test=='gen-benchmark' .AND. mype==root) THEN
|
||||
IF (TRIM(test)=='GENERATE' .AND. mype==root) THEN
|
||||
CALL xmlw_opentag( TRIM(xc_data) )
|
||||
CALL xmlw_writetag( "time_tot", time_tot1 )
|
||||
IF (.NOT. xc_derivative) THEN
|
||||
|
@ -1284,7 +1295,7 @@ PROGRAM xclib_test
|
|||
ENDDO
|
||||
ENDIF
|
||||
!
|
||||
IF ( test(1:4)=='exe-' ) THEN
|
||||
IF ( TRIM(test)=='EXECUTE' ) THEN
|
||||
IF (iout+iaverout/=0) CALL print_test_status( failed )
|
||||
IF (iout+iaverout==0) THEN
|
||||
IF (iavernull/=naver) CALL print_test_status( passed )
|
||||
|
@ -1336,7 +1347,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
! ... set2 output / benchmark data arrays
|
||||
!
|
||||
IF ( test == 'exe-benchmark' ) THEN
|
||||
IF ( TRIM(test)=='EXECUTE' ) THEN
|
||||
IF (.NOT. xc_derivative) DEALLOCATE( ex2, ec2 )
|
||||
!
|
||||
IF ( LDA .OR. GGA ) THEN
|
||||
|
@ -1365,8 +1376,8 @@ PROGRAM xclib_test
|
|||
ENDDO ! end of main loop over dfts
|
||||
!
|
||||
IF (mype==root) THEN
|
||||
IF (test(1:4)=='exe-') CALL xmlr_closetag()
|
||||
IF (test(1:4)=='gen-') CALL xmlw_closetag()
|
||||
IF (TRIM(test)=='EXECUTE' ) CALL xmlr_closetag()
|
||||
IF (TRIM(test)=='GENERATE') CALL xmlw_closetag()
|
||||
!
|
||||
CALL xml_closefile( )
|
||||
ENDIF
|
||||
|
@ -1375,15 +1386,12 @@ PROGRAM xclib_test
|
|||
402 FORMAT('rho(up,down): ',F17.14,4x,F17.14)
|
||||
!
|
||||
501 FORMAT('grho2: ',F17.14)
|
||||
502 FORMAT('grho2(uu,dd): ',F17.14,4x,F17.14)
|
||||
503 FORMAT('grho2(uu,ud,dd): ',F17.14,4x,F17.14,4x,F17.14)
|
||||
!
|
||||
601 FORMAT('tau: ',F17.14)
|
||||
602 FORMAT('tau(up,down): ',F17.14,4x,F17.14)
|
||||
!
|
||||
909 FORMAT('grid-point: ',I5,' of ',I5)
|
||||
910 FORMAT('threshold-point: ',I4,' of ',I4)
|
||||
911 FORMAT(' TOTAL VALUES OVER ',I5,' POINTS')
|
||||
!
|
||||
DEALLOCATE( proc_name )
|
||||
DEALLOCATE( node_name )
|
||||
|
@ -1513,10 +1521,10 @@ PROGRAM xclib_test
|
|||
!-------------------------------------------------------------------------
|
||||
SUBROUTINE evxc_stats( what, xc_1, aver )
|
||||
!------------------------------------------------------------------------
|
||||
!! If test=exe-benchmark calculates difference between total energy
|
||||
!! If test=execute calculates difference between total energy
|
||||
!! and potential calculated over npoints k-points and values taken from
|
||||
!! benchmark data file.
|
||||
!! If test=gen-benchmark calculates the total energy and potential
|
||||
!! If test=generate calculates the total energy and potential
|
||||
!! over npoints k-points.
|
||||
!
|
||||
IMPLICIT NONE
|
||||
|
@ -1541,7 +1549,7 @@ PROGRAM xclib_test
|
|||
IF (what(1:1)=='V') thr = diff_thr_vmgga
|
||||
ENDIF
|
||||
!
|
||||
!IF (mype==root .AND. TRIM(test)=='exe-benchmark') THEN
|
||||
!IF (mype==root .AND. TRIM(test)=='EXECUTE') THEN
|
||||
! WRITE(stdout,*) " "
|
||||
! IF ( POLARIZED .AND. what(1:1)/='E' ) WRITE(stdout,*) TRIM(what)
|
||||
!ENDIF
|
||||
|
@ -1558,7 +1566,7 @@ PROGRAM xclib_test
|
|||
#endif
|
||||
!
|
||||
IF ( .NOT. POLARIZED .OR. what(1:1)=='E' ) THEN
|
||||
IF (mype==root .AND. test(1:4)=='exe-') CALL print_aver( what, xc_aver(:,1), aver(1) )
|
||||
IF (mype==root .AND. TRIM(test)=='EXECUTE') CALL print_aver( what, xc_aver(:,1), aver(1) )
|
||||
ELSE
|
||||
xc_aver(1,2) = SUM(xc_1(1:nnr,2))/npoints
|
||||
!
|
||||
|
@ -1579,18 +1587,18 @@ PROGRAM xclib_test
|
|||
v2c_ud1_aver(1) = aver_recu
|
||||
#endif
|
||||
!
|
||||
IF (mype==root .AND. test(1:4)=='exe-') CALL print_aver( what, &
|
||||
IF (mype==root .AND. TRIM(test)=='EXECUTE') CALL print_aver( what, &
|
||||
v2c_ud1_aver, v2c_aver(1,3), 'cross' )
|
||||
ENDIF
|
||||
!
|
||||
IF (mype==root .AND. test(1:4)=='exe-') THEN
|
||||
IF (mype==root .AND. TRIM(test)=='EXECUTE') THEN
|
||||
CALL print_aver( what, xc_aver(:,1), aver(1), 'up' )
|
||||
CALL print_aver( what, xc_aver(:,2), aver(2), 'down' )
|
||||
ENDIF
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
IF (test=='gen-benchmark') THEN
|
||||
IF (TRIM(test)=='GENERATE') THEN
|
||||
aver = xc_aver(1,:)
|
||||
IF (TRIM(what)=='V2c'.AND.GGA.AND.ns==2) v2c_aver(1,3)=v2c_ud1_aver(1)
|
||||
ENDIF
|
||||
|
@ -1630,8 +1638,8 @@ PROGRAM xclib_test
|
|||
#endif
|
||||
!
|
||||
IF ( .NOT. POLARIZED ) THEN
|
||||
IF (mype==root .AND. test(1:4)=='exe-') CALL print_aver( what, &
|
||||
dxc_aver(1:nnr_b,1), aver(1) )
|
||||
IF (mype==root .AND. TRIM(test)=='EXECUTE') CALL print_aver( what, &
|
||||
dxc_aver(1:nnr_b,1), aver(1) )
|
||||
ELSE
|
||||
dxc_aver(1,2) = SUM(dxc_qe(1:nnr,1,2))/DBLE(npoints)
|
||||
!
|
||||
|
@ -1650,7 +1658,7 @@ PROGRAM xclib_test
|
|||
dxc_aver(1:1,3) = aver_rec
|
||||
#endif
|
||||
!
|
||||
IF (mype==root .AND. test(1:4)=='exe-') THEN
|
||||
IF (mype==root .AND. TRIM(test)=='EXECUTE') THEN
|
||||
CALL print_aver( what, dxc_aver(:,1), aver(1), 'up-up' )
|
||||
CALL print_aver( what, dxc_aver(:,2), aver(2), 'up-down' )
|
||||
CALL print_aver( what, dxc_aver(:,3), aver(3), 'down-down' )
|
||||
|
@ -1658,7 +1666,7 @@ PROGRAM xclib_test
|
|||
!
|
||||
ENDIF
|
||||
!
|
||||
IF (test=='gen-benchmark') aver(1:np) = dxc_aver(1,:)
|
||||
IF (TRIM(test)=='GENERATE') aver(1:np) = dxc_aver(1,:)
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
|
@ -1735,7 +1743,7 @@ PROGRAM xclib_test
|
|||
CHARACTER(LEN=115) :: test_output_exe
|
||||
INTEGER :: j, id_term
|
||||
!
|
||||
IF (test=='gen-benchmark') THEN
|
||||
IF (TRIM(test)=='GENERATE') THEN
|
||||
test_output_gen = ''
|
||||
IF (dft_init=='ALL_TERMS') THEN
|
||||
DO j = 1, 6
|
||||
|
@ -1752,7 +1760,7 @@ PROGRAM xclib_test
|
|||
WRITE(test_output_gen(19:54), '(a)') TRIM(dft)
|
||||
WRITE(test_output_gen(56:),'(a)') TRIM(status)
|
||||
WRITE(stdout,*) test_output_gen
|
||||
ELSEIF (test=='exe-benchmark') THEN
|
||||
ELSEIF (TRIM(test)=='EXECUTE') THEN
|
||||
test_output_exe = ''
|
||||
IF (dft_init=='ALL_TERMS') THEN
|
||||
DO j = 1, 6
|
||||
|
|
Loading…
Reference in New Issue