Extending minimax approximations of 1/x to more than 15 terms in order to enable higher accuracy for larger ranges of x. Minimax module now covered by regtest. Small changes to original minimax module (function for minimax error, partial replacement of ierr variable by asserts).

svn-origin-rev: 16583
This commit is contained in:
Patrick Seewald 2016-02-04 18:18:54 +00:00
parent b780b4a751
commit 3dccb97eb5
10 changed files with 26747 additions and 8756 deletions

View file

@ -33,8 +33,7 @@ MODULE eri_mme_methods_low
pi,&
twopi
USE message_passing, ONLY: mp_sum
USE minimax, ONLY: check_range,&
get_minimax_coeff
USE minimax, ONLY: get_minimax_coeff
USE orbital_pointers, ONLY: coset
#include "./base/base_uses.f90"
@ -1336,8 +1335,7 @@ CONTAINS
CHARACTER(LEN=*), PARAMETER :: routineN = 'get_minimax_coeff_v_gspace', &
routineP = moduleN//':'//routineN
INTEGER :: i_aw, ierr, iG, nG
REAL(KIND=dp) :: dG, G, G_max, minimax_Rc, V_mm
REAL(KIND=dp) :: dG, G_max, minimax_Rc
dG = 1.0E-3 ! Resolution in G to determine error of minimax approximation
min_cutoff = .FALSE.
@ -1358,29 +1356,10 @@ CONTAINS
G_max = SQRT(3.0_dp*2.0_dp*cutoff)
CPASSERT(G_max .GT. G_min)
CALL check_range(n_minimax, minimax_Rc, ierr)
CPASSERT(ierr == 0)
CALL get_minimax_coeff(n_minimax, minimax_Rc, minimax_aw, ierr)
CPASSERT(ierr == 0)
CALL get_minimax_coeff(n_minimax, minimax_Rc, minimax_aw, err_minimax)
minimax_aw = minimax_aw/G_min**2
CPASSERT(ALL(minimax_aw(:) .GT. 0))
! 2) sample minimax error
IF (PRESENT(err_minimax)) THEN
err_minimax = 0.0_dp
nG = CEILING((G_max - G_min)/dG)
G = G_min
DO iG = 1, nG
G = MIN(G, G_max)
V_mm = 0.0_dp
DO i_aw = 1, n_minimax
V_mm = V_mm + minimax_aw(n_minimax + i_aw)*EXP(-minimax_aw(i_aw)*G**2)
ENDDO
err_minimax = MAX(err_minimax, ABS(V_mm - 1.0_dp/G**2))
G = G + dG
ENDDO
ENDIF
IF(PRESENT(err_minimax)) err_minimax = err_minimax/G_min**2
END SUBROUTINE get_minimax_coeff_v_gspace

View file

@ -76,6 +76,7 @@ MODULE library_tests
mp_sum,&
mp_sync,&
mpi_perf_test
USE minimax, ONLY: minimax_validate
USE parallel_rng_types, ONLY: GAUSSIAN,&
UNIFORM,&
check_rng,&
@ -176,6 +177,8 @@ CONTAINS
!
IF ( runtest ( 9 ) /= 0 ) CALL rng_test( para_env, iw)
!
IF ( runtest ( 10 ) /= 0 ) CALL minimax_validate(runtest(10), iw)
!
rs_pw_transfer_section => section_vals_get_subs_vals(root_section,"TEST%RS_PW_TRANSFER")
CALL section_vals_get(rs_pw_transfer_section,explicit=explicit)
IF (explicit) THEN
@ -266,6 +269,7 @@ CONTAINS
CALL section_vals_val_get(test_section,'CLEBSCH_GORDON',i_val=runtest(6))
CALL section_vals_val_get(test_section,'MPI',i_val=runtest (8))
CALL section_vals_val_get(test_section,'RNG',i_val=runtest(9))
CALL section_vals_val_get(test_section,'MINIMAX',i_val=runtest(10))
CALL mp_sync(para_env%group)
END SUBROUTINE test_input

File diff suppressed because it is too large Load diff

8803
src/minimax_k15.F Normal file

File diff suppressed because it is too large Load diff

17615
src/minimax_k53.F Normal file

File diff suppressed because it is too large Load diff

View file

@ -87,8 +87,8 @@ MODULE mp2_laplace
CHARACTER(LEN=*), PARAMETER :: routineN = 'laplace_minimax_approx', &
routineP = moduleN//':'//routineN
INTEGER :: avirt, handle, i_global, ierr, iiB, iocc, j_global, jjB, &
jquad, my_num_dgemm_call, ncol_local, nrow_local, number_of_rec, &
INTEGER :: avirt, handle, i_global, iiB, iocc, j_global, jjB, jquad, &
my_num_dgemm_call, ncol_local, nrow_local, number_of_rec, &
number_of_rec_beta, number_of_send, number_of_send_beta
INTEGER, ALLOCATABLE, DIMENSION(:) :: map_rec_size, &
map_rec_size_beta, &
@ -135,8 +135,7 @@ MODULE mp2_laplace
E_Range=Emax/Emin
IF(E_Range<2.0_dp) E_Range=2.0_dp
ierr=0
CALL get_minimax_coeff(num_integ_points,E_Range,awj,ierr)
CALL get_minimax_coeff(num_integ_points,E_Range,awj)
ALLOCATE(aj(num_integ_points))
aj=0.0_dp

View file

@ -2024,7 +2024,7 @@ MODULE rpa_ri_gpw
ALLOCATE(x_tw(2*num_integ_points))
x_tw=0.0_dp
CALL get_minimax_coeff(num_integ_points,E_Range,x_tw,ierr)
CALL get_minimax_coeff(num_integ_points,E_Range,x_tw)
DO jquad=1, num_integ_points
tau_tj(jquad)=x_tw(jquad)/2.0_dp

View file

@ -230,6 +230,15 @@ CONTAINS
CALL section_add_keyword(section,keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, name="MINIMAX",&
description="Tests validity of minimax coefficients for approximating 1/x "//&
"as a sum of exponentials. "//&
"Checks numerical error against tabulated error, testing "//&
"the given number of different Rc values.",&
usage="MINIMAX 1000",default_i_val=0)
CALL section_add_keyword(section,keyword)
CALL keyword_release(keyword)
CALL cp_print_key_section_create(print_key,"GRID_INFORMATION",&
description="Controls the printing of information regarding the PW and RS grid structures"//&
" (ONLY for TEST run).",&

View file

@ -28,4 +28,5 @@ dbcsr_io_1.inp 0
dbcsr_order_N.inp 58 1.0E-14 1910924.8949438382
test_eri_mme_accuracy.inp 0
test_eri_mme_performance.inp 0
test_minimax.inp 0
#EOF

View file

@ -0,0 +1,9 @@
&GLOBAL
PROJECT test_minimax
PRINT_LEVEL MEDIUM
PROGRAM_NAME TEST
RUN_TYPE NONE
&END GLOBAL
&TEST
MINIMAX 1000
&END TEST