Commit 1c4d1fd0 authored by Victor Yu's avatar Victor Yu

Add GENERIC_COO into tests

parent 205d21a8
......@@ -2,15 +2,19 @@
LIST(APPEND ftest_src
Fortran/elsi_test.f90
Fortran/test_dm_cmplx_den.f90
Fortran/test_dm_cmplx_coo.f90
Fortran/test_dm_cmplx_csc1.f90
Fortran/test_dm_cmplx_csc2.f90
Fortran/test_dm_real_den.f90
Fortran/test_dm_real_coo.f90
Fortran/test_dm_real_csc1.f90
Fortran/test_dm_real_csc2.f90
Fortran/test_ev_cmplx_den.f90
Fortran/test_ev_cmplx_coo.f90
Fortran/test_ev_cmplx_csc1.f90
Fortran/test_ev_cmplx_csc2.f90
Fortran/test_ev_real_den.f90
Fortran/test_ev_real_coo.f90
Fortran/test_ev_real_csc1.f90
Fortran/test_ev_real_csc2.f90)
......@@ -110,54 +114,66 @@ test_fortran(03_elpa e 1 r 1 ${h_real} ${s_real})
test_fortran(04_elpa e 1 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(05_elpa e 2 r 1 ${h_real} ${s_real})
test_fortran(06_elpa e 2 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(07_elpa e 3 r 1 ${h_real} ${s_real})
test_fortran(08_elpa e 3 c 1 ${h_cmplx} ${s_cmplx})
### Parallel Fortran tests: dm + ELPA ###
test_fortran(07_elpa d 0 r 1 ${h_real} ${s_real})
test_fortran(08_elpa d 0 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(09_elpa d 1 r 1 ${h_real} ${s_real})
test_fortran(10_elpa d 1 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(11_elpa d 2 r 1 ${h_real} ${s_real})
test_fortran(12_elpa d 2 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(09_elpa d 0 r 1 ${h_real} ${s_real})
test_fortran(10_elpa d 0 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(11_elpa d 1 r 1 ${h_real} ${s_real})
test_fortran(12_elpa d 1 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(13_elpa d 2 r 1 ${h_real} ${s_real})
test_fortran(14_elpa d 2 c 1 ${h_cmplx} ${s_cmplx})
test_fortran(15_elpa d 3 r 1 ${h_real} ${s_real})
test_fortran(16_elpa d 3 c 1 ${h_cmplx} ${s_cmplx})
### Parallel Fortran tests: dm + libOMM ###
test_fortran(13_omm d 0 r 2 ${h_real} ${s_real})
test_fortran(14_omm d 0 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(15_omm d 1 r 2 ${h_real} ${s_real})
test_fortran(16_omm d 1 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(17_omm d 2 r 2 ${h_real} ${s_real})
test_fortran(18_omm d 2 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(17_omm d 0 r 2 ${h_real} ${s_real})
test_fortran(18_omm d 0 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(19_omm d 1 r 2 ${h_real} ${s_real})
test_fortran(20_omm d 1 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(21_omm d 2 r 2 ${h_real} ${s_real})
test_fortran(22_omm d 2 c 2 ${h_cmplx} ${s_cmplx})
test_fortran(23_omm d 3 r 2 ${h_real} ${s_real})
test_fortran(24_omm d 3 c 2 ${h_cmplx} ${s_cmplx})
### Parallel Fortran tests: dm + PEXSI ###
IF(ENABLE_PEXSI)
test_fortran(19_pexsi d 0 r 3 ${h_real} ${s_real})
test_fortran(20_pexsi d 0 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(21_pexsi d 1 r 3 ${h_real} ${s_real})
test_fortran(22_pexsi d 1 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(23_pexsi d 2 r 3 ${h_real} ${s_real})
test_fortran(24_pexsi d 2 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(25_pexsi d 0 r 3 ${h_real} ${s_real})
test_fortran(26_pexsi d 0 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(27_pexsi d 1 r 3 ${h_real} ${s_real})
test_fortran(28_pexsi d 1 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(29_pexsi d 2 r 3 ${h_real} ${s_real})
test_fortran(30_pexsi d 2 c 3 ${h_cmplx} ${s_cmplx})
test_fortran(31_pexsi d 3 r 3 ${h_real} ${s_real})
test_fortran(32_pexsi d 3 c 3 ${h_cmplx} ${s_cmplx})
ENDIF()
### Parallel Fortran tests: ev + SLEPc-SIPs ###
IF(ENABLE_SIPS)
test_fortran(25_sips e 0 r 5 ${h_real} ${s_real})
test_fortran(26_sips e 1 r 5 ${h_real} ${s_real})
test_fortran(27_sips e 2 r 5 ${h_real} ${s_real})
test_fortran(33_sips e 0 r 5 ${h_real} ${s_real})
test_fortran(34_sips e 1 r 5 ${h_real} ${s_real})
test_fortran(35_sips e 2 r 5 ${h_real} ${s_real})
test_fortran(36_sips e 3 r 5 ${h_real} ${s_real})
ENDIF()
### Parallel Fortran tests: dm + SLEPc-SIPs ###
IF(ENABLE_SIPS)
test_fortran(28_sips d 0 r 5 ${h_real} ${s_real})
test_fortran(29_sips d 1 r 5 ${h_real} ${s_real})
test_fortran(30_sips d 2 r 5 ${h_real} ${s_real})
test_fortran(37_sips d 0 r 5 ${h_real} ${s_real})
test_fortran(38_sips d 1 r 5 ${h_real} ${s_real})
test_fortran(39_sips d 2 r 5 ${h_real} ${s_real})
test_fortran(40_sips d 3 r 5 ${h_real} ${s_real})
ENDIF()
### Parallel Fortran tests: dm + NTPoly ###
test_fortran(31_ntpoly d 0 r 6 ${h_real} ${s_real})
test_fortran(32_ntpoly d 0 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(33_ntpoly d 1 r 6 ${h_real} ${s_real})
test_fortran(34_ntpoly d 1 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(35_ntpoly d 2 r 6 ${h_real} ${s_real})
test_fortran(36_ntpoly d 2 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(41_ntpoly d 0 r 6 ${h_real} ${s_real})
test_fortran(42_ntpoly d 0 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(43_ntpoly d 1 r 6 ${h_real} ${s_real})
test_fortran(44_ntpoly d 1 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(45_ntpoly d 2 r 6 ${h_real} ${s_real})
test_fortran(46_ntpoly d 2 c 6 ${h_cmplx} ${s_cmplx})
test_fortran(47_ntpoly d 3 r 6 ${h_real} ${s_real})
test_fortran(48_ntpoly d 3 c 6 ${h_cmplx} ${s_cmplx})
### Serial Fortran tests: ev + ELPA (LAPACK) ###
ADD_TEST(test_serial_01_lapack
......
......@@ -72,6 +72,15 @@ program elsi_test
case default
call test_die()
end select
case("3") ! GENERIC_COO
select case(arg3(1:1))
case("r") ! real
call test_ev_real_coo(MPI_COMM_WORLD,solver,arg5,arg6)
case("c") ! complex
call test_ev_cmplx_coo(MPI_COMM_WORLD,solver,arg5,arg6)
case default
call test_die()
end select
case default
call test_die()
end select
......@@ -104,6 +113,15 @@ program elsi_test
case default
call test_die()
end select
case("3") ! GENERIC_COO
select case(arg3(1:1))
case("r") ! real
call test_dm_real_coo(MPI_COMM_WORLD,solver,arg5,arg6)
case("c") ! complex
call test_dm_cmplx_coo(MPI_COMM_WORLD,solver,arg5,arg6)
case default
call test_die()
end select
case default
call test_die()
end select
......@@ -128,6 +146,7 @@ subroutine test_die()
write(*,"(A)") " ## Arg #2: 0 = BLACS_DENSE ##"
write(*,"(A)") " ## 1 = PEXSI_CSC ##"
write(*,"(A)") " ## 2 = SIESTA_CSC ##"
write(*,"(A)") " ## 3 = GENERIC_COO ##"
write(*,"(A)") " ## Arg #3: 'real' or 'complex' ##"
write(*,"(A)") " ## Arg #4: 1 = ELPA ##"
write(*,"(A)") " ## 2 = libOMM ##"
......
! Copyright (c) 2015-2018, the ELSI team.
! All rights reserved.
!
! This file is part of ELSI and is distributed under the BSD 3-clause license,
! which may be found in the LICENSE file in the ELSI root directory.
!>
!! This subroutine tests complex density matrix solver, GENERIC_COO format.
!!
subroutine test_dm_cmplx_coo(mpi_comm,solver,h_file,s_file)
use ELSI_PRECISION, only: r8,i4
use ELSI
implicit none
include "mpif.h"
integer(kind=i4), intent(in) :: mpi_comm
integer(kind=i4), intent(in) :: solver
character(len=*), intent(in) :: h_file
character(len=*), intent(in) :: s_file
integer(kind=i4) :: n_proc
integer(kind=i4) :: myid
integer(kind=i4) :: ierr
integer(kind=i4) :: n_states
integer(kind=i4) :: n_basis
integer(kind=i4) :: nnz_g
integer(kind=i4) :: nnz_l
integer(kind=i4) :: n_l_cols
integer(kind=i4) :: i
integer(kind=i4) :: j
integer(kind=i4) :: header(8) = 0
real(kind=r8) :: n_electrons
real(kind=r8) :: n_test
real(kind=r8) :: tmp
real(kind=r8) :: e_test = 0.0_r8
real(kind=r8) :: e_ref = 0.0_r8
real(kind=r8) :: tol = 0.0_r8
real(kind=r8) :: t1
real(kind=r8) :: t2
complex(kind=r8), allocatable :: ham(:)
complex(kind=r8), allocatable :: ovlp(:)
complex(kind=r8), allocatable :: dm(:)
complex(kind=r8), allocatable :: edm(:)
integer(kind=i4), allocatable :: row_ind(:)
integer(kind=i4), allocatable :: col_ind(:)
integer(kind=i4), allocatable :: col_ptr(:)
complex(kind=r8), external :: zdotc
type(elsi_handle) :: eh
type(elsi_rw_handle) :: rwh
! Reference values
real(kind=r8), parameter :: e_elpa = -2622.88214509316_r8
real(kind=r8), parameter :: e_omm = -2622.88214509316_r8
real(kind=r8), parameter :: e_pexsi = -2622.88194292325_r8
real(kind=r8), parameter :: e_ntpoly = -2622.88214509311_r8
call MPI_Comm_size(mpi_comm,n_proc,ierr)
call MPI_Comm_rank(mpi_comm,myid,ierr)
if(myid == 0) then
tol = 1.0e-8_r8
write(*,"(2X,A)") "################################"
write(*,"(2X,A)") "## ELSI TEST PROGRAMS ##"
write(*,"(2X,A)") "################################"
write(*,*)
if(solver == 1) then
write(*,"(2X,A)") "Now start testing elsi_dm_complex_sparse + ELPA"
e_ref = e_elpa
else if(solver == 2) then
write(*,"(2X,A)") "Now start testing elsi_dm_complex_sparse + libOMM"
e_ref = e_omm
else if(solver == 3) then
write(*,"(2X,A)") "Now start testing elsi_dm_complex_sparse + PEXSI"
e_ref = e_pexsi
tol = 1.0e-3_r8
else if(solver == 6) then
write(*,"(2X,A)") "Now start testing elsi_dm_complex_sparse + NTPoly"
e_ref = e_ntpoly
tol = 1.0e-7_r8
end if
write(*,*)
end if
! Read H and S matrices
call elsi_init_rw(rwh,0,1,0,0.0_r8)
call elsi_set_rw_mpi(rwh,mpi_comm)
call elsi_read_mat_dim_sparse(rwh,h_file,n_electrons,n_basis,nnz_g,nnz_l,&
n_l_cols)
call elsi_get_rw_header(rwh,header)
allocate(ham(nnz_l))
allocate(ovlp(nnz_l))
allocate(dm(nnz_l))
allocate(edm(nnz_l))
allocate(row_ind(nnz_l))
allocate(col_ind(nnz_l))
allocate(col_ptr(n_l_cols+1))
t1 = MPI_Wtime()
call elsi_read_mat_complex_sparse(rwh,h_file,row_ind,col_ptr,ham)
call elsi_read_mat_complex_sparse(rwh,s_file,row_ind,col_ptr,ovlp)
call elsi_finalize_rw(rwh)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished reading H and S matrices"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
! Convert CSC to COO
j = 0
do i = 1,nnz_l
do while(i == col_ptr(j+1) .and. j /= n_l_cols)
j = j+1
end do
col_ind(i) = j+myid*(n_basis/n_proc)
end do
! Initialize ELSI
n_states = int(n_electrons,kind=i4)
call elsi_init(eh,solver,1,3,n_basis,n_electrons,n_states)
call elsi_set_mpi(eh,mpi_comm)
call elsi_set_coo(eh,nnz_g,nnz_l,row_ind,col_ind)
! Customize ELSI
call elsi_set_output(eh,2)
call elsi_set_output_log(eh,1)
call elsi_set_illcond_check(eh,0)
call elsi_set_mu_broaden_width(eh,1.0e-6_r8)
call elsi_set_omm_n_elpa(eh,1)
call elsi_set_pexsi_delta_e(eh,80.0_r8)
call elsi_set_pexsi_np_per_pole(eh,2)
t1 = MPI_Wtime()
! Solve
call elsi_dm_complex_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #1"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_complex_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #2"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_complex_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #3"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
! Reinit for a new geometry
call elsi_reinit(eh)
call elsi_set_coo(eh,nnz_g,nnz_l,row_ind,col_ind)
call elsi_set_elpa_solver(eh,1)
call elsi_set_omm_flavor(eh,2)
call elsi_set_ntpoly_method(eh,1)
t1 = MPI_Wtime()
! Solve again
call elsi_dm_complex_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #4"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_complex_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
! Compute energy density matrix
call elsi_get_edm_complex_sparse(eh,edm)
! Compute electron count
tmp = real(zdotc(nnz_l,ovlp,1,dm,1),kind=r8)
call MPI_Reduce(tmp,n_test,1,mpi_real8,mpi_sum,0,mpi_comm,ierr)
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #5"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
write(*,"(2X,A)") "Finished test program"
write(*,*)
if(header(8) == 1111) then
write(*,"(2X,A)") "Band energy"
write(*,"(2X,A,F15.8)") "| This test :",e_test
write(*,"(2X,A,F15.8)") "| Reference :",e_ref
write(*,*)
write(*,"(2X,A)") "Electron count"
write(*,"(2X,A,F15.8)") "| This test :",n_test
write(*,"(2X,A,F15.8)") "| Reference :",n_electrons
write(*,*)
if(abs(e_test-e_ref) < tol .and. abs(n_test-n_electrons) < tol) then
write(*,"(2X,A)") "Passed."
else
write(*,"(2X,A)") "Failed."
end if
end if
write(*,*)
end if
! Finalize ELSI
call elsi_finalize(eh)
deallocate(ham)
deallocate(ovlp)
deallocate(dm)
deallocate(edm)
deallocate(row_ind)
deallocate(col_ind)
deallocate(col_ptr)
end subroutine
! Copyright (c) 2015-2018, the ELSI team.
! All rights reserved.
!
! This file is part of ELSI and is distributed under the BSD 3-clause license,
! which may be found in the LICENSE file in the ELSI root directory.
!>
!! This subroutine tests real density matrix solver, GENERIC_COO format.
!!
subroutine test_dm_real_coo(mpi_comm,solver,h_file,s_file)
use ELSI_PRECISION, only: r8,i4
use ELSI
implicit none
include "mpif.h"
integer(kind=i4), intent(in) :: mpi_comm
integer(kind=i4), intent(in) :: solver
character(len=*), intent(in) :: h_file
character(len=*), intent(in) :: s_file
integer(kind=i4) :: n_proc
integer(kind=i4) :: myid
integer(kind=i4) :: ierr
integer(kind=i4) :: n_states
integer(kind=i4) :: n_basis
integer(kind=i4) :: nnz_g
integer(kind=i4) :: nnz_l
integer(kind=i4) :: n_l_cols
integer(kind=i4) :: i
integer(kind=i4) :: j
integer(kind=i4) :: header(8) = 0
real(kind=r8) :: n_electrons
real(kind=r8) :: n_test
real(kind=r8) :: tmp
real(kind=r8) :: e_test = 0.0_r8
real(kind=r8) :: e_ref = 0.0_r8
real(kind=r8) :: tol = 0.0_r8
real(kind=r8) :: t1
real(kind=r8) :: t2
real(kind=r8), allocatable :: ham(:)
real(kind=r8), allocatable :: ovlp(:)
real(kind=r8), allocatable :: dm(:)
real(kind=r8), allocatable :: edm(:)
integer(kind=i4), allocatable :: row_ind(:)
integer(kind=i4), allocatable :: col_ind(:)
integer(kind=i4), allocatable :: col_ptr(:)
real(kind=r8), external :: ddot
type(elsi_handle) :: eh
type(elsi_rw_handle) :: rwh
! Reference values
real(kind=r8), parameter :: e_elpa = -2622.88214509316_r8
real(kind=r8), parameter :: e_omm = -2622.88214509316_r8
real(kind=r8), parameter :: e_pexsi = -2622.88194292325_r8
real(kind=r8), parameter :: e_sips = -2622.88214509316_r8
real(kind=r8), parameter :: e_ntpoly = -2622.88214509311_r8
call MPI_Comm_size(mpi_comm,n_proc,ierr)
call MPI_Comm_rank(mpi_comm,myid,ierr)
if(myid == 0) then
tol = 1.0e-8_r8
write(*,"(2X,A)") "################################"
write(*,"(2X,A)") "## ELSI TEST PROGRAMS ##"
write(*,"(2X,A)") "################################"
write(*,*)
if(solver == 1) then
write(*,"(2X,A)") "Now start testing elsi_dm_real_sparse + ELPA"
e_ref = e_elpa
else if(solver == 2) then
write(*,"(2X,A)") "Now start testing elsi_dm_real_sparse + libOMM"
e_ref = e_omm
else if(solver == 3) then
write(*,"(2X,A)") "Now start testing elsi_dm_real_sparse + PEXSI"
e_ref = e_pexsi
tol = 1.0e-3_r8
else if(solver == 5) then
write(*,"(2X,A)") "Now start testing elsi_dm_real_sparse + SLEPc-SIPs"
e_ref = e_sips
else if(solver == 6) then
write(*,"(2X,A)") "Now start testing elsi_dm_real_sparse + NTPoly"
e_ref = e_ntpoly
tol = 1.0e-7_r8
end if
write(*,*)
end if
! Read H and S matrices
call elsi_init_rw(rwh,0,1,0,0.0_r8)
call elsi_set_rw_mpi(rwh,mpi_comm)
call elsi_read_mat_dim_sparse(rwh,h_file,n_electrons,n_basis,nnz_g,nnz_l,&
n_l_cols)
call elsi_get_rw_header(rwh,header)
allocate(ham(nnz_l))
allocate(ovlp(nnz_l))
allocate(dm(nnz_l))
allocate(edm(nnz_l))
allocate(row_ind(nnz_l))
allocate(col_ind(nnz_l))
allocate(col_ptr(n_l_cols+1))
t1 = MPI_Wtime()
call elsi_read_mat_real_sparse(rwh,h_file,row_ind,col_ptr,ham)
call elsi_read_mat_real_sparse(rwh,s_file,row_ind,col_ptr,ovlp)
call elsi_finalize_rw(rwh)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished reading H and S matrices"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
! Convert CSC to COO
j = 0
do i = 1,nnz_l
do while(i == col_ptr(j+1) .and. j /= n_l_cols)
j = j+1
end do
col_ind(i) = j+myid*(n_basis/n_proc)
end do
! Initialize ELSI
n_states = int(n_electrons,kind=i4)
call elsi_init(eh,solver,1,3,n_basis,n_electrons,n_states)
call elsi_set_mpi(eh,mpi_comm)
call elsi_set_coo(eh,nnz_g,nnz_l,row_ind,col_ind)
! Customize ELSI
call elsi_set_output(eh,2)
call elsi_set_output_log(eh,1)
call elsi_set_illcond_check(eh,0)
call elsi_set_mu_broaden_width(eh,1.0e-6_r8)
call elsi_set_omm_n_elpa(eh,1)
call elsi_set_pexsi_delta_e(eh,80.0_r8)
call elsi_set_pexsi_np_per_pole(eh,2)
call elsi_set_sips_n_elpa(eh,1)
t1 = MPI_Wtime()
! Solve
call elsi_dm_real_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #1"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_real_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #2"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_real_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #3"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
! Reinit for a new geometry
call elsi_reinit(eh)
call elsi_set_coo(eh,nnz_g,nnz_l,row_ind,col_ind)
call elsi_set_elpa_solver(eh,1)
call elsi_set_omm_flavor(eh,2)
call elsi_set_ntpoly_method(eh,1)
t1 = MPI_Wtime()
! Solve again
call elsi_dm_real_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #4"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
end if
t1 = MPI_Wtime()
! Solve again
call elsi_dm_real_sparse(eh,ham,ovlp,dm,e_test)
t2 = MPI_Wtime()
! Compute energy density matrix
call elsi_get_edm_real_sparse(eh,edm)
! Compute electron count
tmp = ddot(nnz_l,ovlp,1,dm,1)
call MPI_Reduce(tmp,n_test,1,mpi_real8,mpi_sum,0,mpi_comm,ierr)
if(myid == 0) then
write(*,"(2X,A)") "Finished SCF #5"
write(*,"(2X,A,F10.3,A)") "| Time :",t2-t1,"s"
write(*,*)
write(*,"(2X,A)") "Finished test program"
write(