diff --git a/input/methods b/input/methods index f20b2ff..580bc02 100644 --- a/input/methods +++ b/input/methods @@ -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) diff --git a/src/QuAcK/QuAcK.f90 b/src/QuAcK/QuAcK.f90 index f2fec95..8fb8048 100644 --- a/src/QuAcK/QuAcK.f90 +++ b/src/QuAcK/QuAcK.f90 @@ -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 ! !--------------! diff --git a/src/test/Gtest.f90 b/src/test/Gtest.f90 deleted file mode 100755 index 008794c..0000000 --- a/src/test/Gtest.f90 +++ /dev/null @@ -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 diff --git a/src/test/Rtest.f90 b/src/test/Rtest.f90 deleted file mode 100755 index 6d69324..0000000 --- a/src/test/Rtest.f90 +++ /dev/null @@ -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 diff --git a/src/test/Utest.f90 b/src/test/Utest.f90 deleted file mode 100755 index e96450c..0000000 --- a/src/test/Utest.f90 +++ /dev/null @@ -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 diff --git a/src/test/check_test_value.f90 b/src/test/check_test_value.f90 new file mode 100755 index 0000000..4e9e6b3 --- /dev/null +++ b/src/test/check_test_value.f90 @@ -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 diff --git a/src/test/dump_test_value.f90 b/src/test/dump_test_value.f90 index 8afc5b5..ea00afe 100755 --- a/src/test/dump_test_value.f90 +++ b/src/test/dump_test_value.f90 @@ -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 diff --git a/src/test/init_test.f90 b/src/test/init_test.f90 new file mode 100755 index 0000000..602ba54 --- /dev/null +++ b/src/test/init_test.f90 @@ -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 diff --git a/src/test/run_test.f90 b/src/test/run_test.f90 new file mode 100755 index 0000000..6bd6b0a --- /dev/null +++ b/src/test/run_test.f90 @@ -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 diff --git a/src/test/stop_test.f90 b/src/test/stop_test.f90 new file mode 100755 index 0000000..d41e2b0 --- /dev/null +++ b/src/test/stop_test.f90 @@ -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 diff --git a/test/Gtest_ref.dat b/test/Gtest_ref.dat new file mode 100644 index 0000000..94106f6 --- /dev/null +++ b/test/Gtest_ref.dat @@ -0,0 +1,2 @@ + # GHF energy + -85.160473883160876 diff --git a/test/Rtest_ref.dat b/test/Rtest_ref.dat new file mode 100644 index 0000000..370de7d --- /dev/null +++ b/test/Rtest_ref.dat @@ -0,0 +1,4 @@ + RHF energy + -85.160473883160876 + ROHF energy + -85.160473714509976 diff --git a/test/Utest_ref.dat b/test/Utest_ref.dat new file mode 100644 index 0000000..38f3b77 --- /dev/null +++ b/test/Utest_ref.dat @@ -0,0 +1,2 @@ + # UHF energy + -85.160473883160819