mirror of
https://github.com/pfloos/quack
synced 2024-12-22 04:14:26 +01:00
working on test
This commit is contained in:
parent
e67faaf935
commit
38998f07fb
@ -1,5 +1,5 @@
|
||||
# RHF UHF GHF ROHF
|
||||
T F F F
|
||||
T F F T
|
||||
# MP2 MP3
|
||||
F F
|
||||
# CCD pCCD DCD CCSD CCSD(T)
|
||||
|
@ -66,7 +66,7 @@ program QuAcK
|
||||
logical :: dophBSE,dophBSE2,doppBSE,dBSE,dTDA
|
||||
logical :: doACFDT,exchange_kernel,doXBS
|
||||
|
||||
logical :: doRtest,doUtest,doGtest
|
||||
logical :: dotest,doRtest,doUtest,doGtest
|
||||
|
||||
!-------------!
|
||||
! Hello World !
|
||||
@ -183,6 +183,14 @@ program QuAcK
|
||||
doGQuAcK = .false.
|
||||
if(doGHF) doGQuAcK = .true.
|
||||
|
||||
!-----------------!
|
||||
! Initialize Test !
|
||||
!-----------------!
|
||||
|
||||
dotest = doRtest .or. doUtest .or. doGtest
|
||||
|
||||
if(dotest) call init_test(doRtest,doUtest,doGtest)
|
||||
|
||||
!-------------------------!
|
||||
! Restricted QuAcK branch !
|
||||
!-------------------------!
|
||||
@ -226,6 +234,18 @@ program QuAcK
|
||||
maxSCF_GW,max_diis_GW,thresh_GW,TDA_W,lin_GW,reg_GW,eta_GW, &
|
||||
dophBSE,dophBSE2,doppBSE,dBSE,dTDA,doACFDT,exchange_kernel,doXBS)
|
||||
|
||||
!-----------!
|
||||
! Stop Test !
|
||||
!-----------!
|
||||
|
||||
if(dotest) call stop_test(doRtest,doUtest,doGtest)
|
||||
|
||||
!--------------!
|
||||
! Running Test !
|
||||
!--------------!
|
||||
|
||||
if(dotest) call run_test(doRtest,doUtest,doGtest)
|
||||
|
||||
!--------------!
|
||||
! End of QuAcK !
|
||||
!--------------!
|
||||
|
@ -1,19 +0,0 @@
|
||||
subroutine Gtest()
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
write(*,*) '*****************************************'
|
||||
write(*,*) '* Testing Generalized Branch of QuAcK...*'
|
||||
write(*,*) '*****************************************'
|
||||
|
||||
write(*,*) '***************************'
|
||||
write(*,*) '* End of Generalized Test *'
|
||||
write(*,*) '***************************'
|
||||
|
||||
end subroutine
|
@ -1,19 +0,0 @@
|
||||
subroutine Rtest()
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
write(*,*) '****************************************'
|
||||
write(*,*) '* Testing Restricted Branch of QuAcK...*'
|
||||
write(*,*) '****************************************'
|
||||
|
||||
write(*,*) '**************************'
|
||||
write(*,*) '* End of Restricted Test *'
|
||||
write(*,*) '**************************'
|
||||
|
||||
end subroutine
|
@ -1,19 +0,0 @@
|
||||
subroutine Utest()
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
write(*,*) '******************************************'
|
||||
write(*,*) '* Testing Unrestricted Branch of QuAcK...*'
|
||||
write(*,*) '******************************************'
|
||||
|
||||
write(*,*) '****************************'
|
||||
write(*,*) '* End of Unrestricted Test *'
|
||||
write(*,*) '****************************'
|
||||
|
||||
end subroutine
|
65
src/test/check_test_value.f90
Executable file
65
src/test/check_test_value.f90
Executable file
@ -0,0 +1,65 @@
|
||||
subroutine check_test_value(branch)
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
character(len=1),intent(in) :: branch
|
||||
|
||||
! Local variables
|
||||
|
||||
character(len=30) :: description
|
||||
double precision :: value
|
||||
double precision :: reference
|
||||
character(len=15) :: answer
|
||||
|
||||
double precision,parameter :: cutoff = 1d-10
|
||||
|
||||
! Output variables
|
||||
|
||||
if(branch == 'R') then
|
||||
|
||||
open(unit=11,file='test/Rtest.dat')
|
||||
open(unit=12,file='test/Rtest_ref.dat')
|
||||
|
||||
elseif(branch == 'U') then
|
||||
|
||||
open(unit=11,file='test/Utest.dat')
|
||||
open(unit=12,file='test/Utest_ref.dat')
|
||||
|
||||
elseif(branch == 'G') then
|
||||
|
||||
open(unit=11,file='test/Gtest.dat')
|
||||
open(unit=12,file='test/Gtest_ref.dat')
|
||||
|
||||
else
|
||||
|
||||
write(*,*) 'Wrong branch name in check_test_value'
|
||||
|
||||
end if
|
||||
|
||||
write(*,*) '----------------------------------------------------------------------------------------------------'
|
||||
do
|
||||
|
||||
read(11,*,end=11) description
|
||||
read(11,'(F20.15)',end=11) value
|
||||
|
||||
read(12,*,end=12)
|
||||
read(12,'(F20.15)',end=12) reference
|
||||
|
||||
if(abs(value-reference) < cutoff) then
|
||||
answer = '..... [SUCCESS]'
|
||||
else
|
||||
answer = '..... [FAILED] '
|
||||
end if
|
||||
write(*,'(1X,A1,1X,A30,1X,A1,1X,3F15.10,1X,A1,1X,A15,1X,A1)') &
|
||||
'|',description,'|',value,reference,abs(value-reference),'|',answer,'|'
|
||||
|
||||
enddo
|
||||
|
||||
11 close(unit=11)
|
||||
12 close(unit=12)
|
||||
|
||||
write(*,*) '----------------------------------------------------------------------------------------------------'
|
||||
|
||||
end subroutine
|
@ -14,18 +14,24 @@ subroutine dump_test_value(branch,description,value)
|
||||
! Output variables
|
||||
|
||||
if(branch == 'R') then
|
||||
open(unit=11,file='test/Rtest.dat')
|
||||
|
||||
write(11,*) trim(description)
|
||||
write(11,'(F20.15)') value
|
||||
|
||||
elseif(branch == 'U') then
|
||||
open(unit=11,file='test/Utest.dat')
|
||||
|
||||
write(12,*) trim(description)
|
||||
write(12,'(F20.15)') value
|
||||
|
||||
elseif(branch == 'G') then
|
||||
open(unit=11,file='test/Gtest.dat')
|
||||
|
||||
write(13,*) trim(description)
|
||||
write(13,'(F20.15)') value
|
||||
|
||||
else
|
||||
|
||||
write(*,*) 'Wrong branch name in dump_test_value'
|
||||
|
||||
end if
|
||||
|
||||
write(11,*) '# ',trim(description)
|
||||
write(11,'(F20.15)') value
|
||||
|
||||
close(unit=11)
|
||||
|
||||
end subroutine
|
||||
|
21
src/test/init_test.f90
Executable file
21
src/test/init_test.f90
Executable file
@ -0,0 +1,21 @@
|
||||
subroutine init_test(doRtest,doUtest,doGtest)
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
logical,intent(in) :: doRtest
|
||||
logical,intent(in) :: doUtest
|
||||
logical,intent(in) :: doGtest
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
if(doRtest) open(unit=11,file='test/Rtest.dat')
|
||||
|
||||
if(doUtest) open(unit=12,file='test/Utest.dat')
|
||||
|
||||
if(doGtest) open(unit=13,file='test/Gtest.dat')
|
||||
|
||||
end subroutine
|
66
src/test/run_test.f90
Executable file
66
src/test/run_test.f90
Executable file
@ -0,0 +1,66 @@
|
||||
subroutine run_test(doRtest,doUtest,doGtest)
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
logical,intent(in) :: doRtest
|
||||
logical,intent(in) :: doUtest
|
||||
logical,intent(in) :: doGtest
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
if(doRtest) then
|
||||
|
||||
write(*,*) '****************************************'
|
||||
write(*,*) '* Testing Restricted Branch of QuAcK...*'
|
||||
write(*,*) '****************************************'
|
||||
write(*,*)
|
||||
|
||||
call check_test_value('R')
|
||||
|
||||
write(*,*)
|
||||
write(*,*) '**************************'
|
||||
write(*,*) '* End of Restricted Test *'
|
||||
write(*,*) '**************************'
|
||||
write(*,*)
|
||||
|
||||
end if
|
||||
|
||||
if(doUtest) then
|
||||
|
||||
write(*,*) '******************************************'
|
||||
write(*,*) '* Testing Unrestricted Branch of QuAcK...*'
|
||||
write(*,*) '******************************************'
|
||||
write(*,*)
|
||||
|
||||
call check_test_value('U')
|
||||
|
||||
write(*,*)
|
||||
write(*,*) '****************************'
|
||||
write(*,*) '* End of Unrestricted Test *'
|
||||
write(*,*) '****************************'
|
||||
write(*,*)
|
||||
|
||||
end if
|
||||
|
||||
if(doGtest) then
|
||||
|
||||
write(*,*) '*****************************************'
|
||||
write(*,*) '* Testing Generalized Branch of QuAcK...*'
|
||||
write(*,*) '*****************************************'
|
||||
write(*,*)
|
||||
|
||||
call check_test_value('G')
|
||||
|
||||
write(*,*)
|
||||
write(*,*) '***************************'
|
||||
write(*,*) '* End of Generalized Test *'
|
||||
write(*,*) '***************************'
|
||||
write(*,*)
|
||||
|
||||
end if
|
||||
|
||||
end subroutine
|
21
src/test/stop_test.f90
Executable file
21
src/test/stop_test.f90
Executable file
@ -0,0 +1,21 @@
|
||||
subroutine stop_test(doRtest,doUtest,doGtest)
|
||||
|
||||
implicit none
|
||||
|
||||
! Input variables
|
||||
|
||||
logical,intent(in) :: doRtest
|
||||
logical,intent(in) :: doUtest
|
||||
logical,intent(in) :: doGtest
|
||||
|
||||
! Local variables
|
||||
|
||||
! Output variables
|
||||
|
||||
if(doRtest) close(unit=11)
|
||||
|
||||
if(doUtest) close(unit=12)
|
||||
|
||||
if(doGtest) close(unit=13)
|
||||
|
||||
end subroutine
|
2
test/Gtest_ref.dat
Normal file
2
test/Gtest_ref.dat
Normal file
@ -0,0 +1,2 @@
|
||||
# GHF energy
|
||||
-85.160473883160876
|
4
test/Rtest_ref.dat
Normal file
4
test/Rtest_ref.dat
Normal file
@ -0,0 +1,4 @@
|
||||
RHF energy
|
||||
-85.160473883160876
|
||||
ROHF energy
|
||||
-85.160473714509976
|
2
test/Utest_ref.dat
Normal file
2
test/Utest_ref.dat
Normal file
@ -0,0 +1,2 @@
|
||||
# UHF energy
|
||||
-85.160473883160819
|
Loading…
Reference in New Issue
Block a user