Commit 205d21a8 authored by Victor Yu's avatar Victor Yu

Add GENERIC_COO format to solver APIs

parent e19f6fb1
......@@ -10,17 +10,18 @@
module ELSI_MUTATOR
use ELSI_CONSTANTS, only: ELPA_SOLVER,OMM_SOLVER,PEXSI_SOLVER,SIPS_SOLVER,&
NTPOLY_SOLVER,PEXSI_CSC,SIESTA_CSC
NTPOLY_SOLVER,PEXSI_CSC,SIESTA_CSC,GENERIC_COO
use ELSI_DATATYPE, only: elsi_handle
use ELSI_MPI, only: elsi_stop
use ELSI_NTPOLY, only: elsi_compute_edm_ntpoly
use ELSI_OMM, only: elsi_compute_edm_omm
use ELSI_PEXSI, only: elsi_compute_edm_pexsi
use ELSI_PRECISION, only: r8,i4
use ELSI_REDIST, only: elsi_blacs_to_siesta_dm,elsi_blacs_to_sips_dm,&
elsi_ntpoly_to_blacs_dm,elsi_ntpoly_to_siesta_dm,elsi_ntpoly_to_sips_dm,&
elsi_pexsi_to_blacs_dm,elsi_pexsi_to_siesta_dm,elsi_sips_to_blacs_dm,&
elsi_sips_to_siesta_dm
use ELSI_REDIST, only: elsi_blacs_to_generic_dm,elsi_blacs_to_siesta_dm,&
elsi_blacs_to_sips_dm,elsi_ntpoly_to_blacs_dm,elsi_ntpoly_to_generic_dm,&
elsi_ntpoly_to_siesta_dm,elsi_ntpoly_to_sips_dm,elsi_pexsi_to_blacs_dm,&
elsi_pexsi_to_generic_dm,elsi_pexsi_to_siesta_dm,elsi_sips_to_blacs_dm,&
elsi_sips_to_generic_dm,elsi_sips_to_siesta_dm
use ELSI_SIPS, only: elsi_build_edm_sips
use ELSI_UTILS, only: elsi_check_init,elsi_build_edm
......@@ -1458,6 +1459,9 @@ subroutine elsi_get_edm_real_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_blacs_to_siesta_dm(eh%bh,eh%dm_real_den,edm,&
eh%row_ind_sp2,eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_blacs_to_generic_dm(eh%ph,eh%bh,eh%dm_real_den,&
eh%map_den,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1471,6 +1475,9 @@ subroutine elsi_get_edm_real_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_blacs_to_siesta_dm(eh%bh,eh%dm_real_den,edm,&
eh%row_ind_sp2,eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_blacs_to_generic_dm(eh%ph,eh%bh,eh%dm_real_den,&
eh%map_den,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1484,6 +1491,11 @@ subroutine elsi_get_edm_real_sparse(eh,edm)
call elsi_pexsi_to_siesta_dm(eh%ph,eh%bh,eh%dm_real_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,edm,eh%row_ind_sp2,&
eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_compute_edm_pexsi(eh%ph,eh%bh,eh%pexsi_ne_vec,&
eh%dm_real_sp)
call elsi_pexsi_to_generic_dm(eh%ph,eh%bh,eh%dm_real_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,eh%map_sp1,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1498,6 +1510,11 @@ subroutine elsi_get_edm_real_sparse(eh,edm)
call elsi_sips_to_siesta_dm(eh%ph,eh%bh,eh%dm_real_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,edm,eh%row_ind_sp2,&
eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_build_edm_sips(eh%ph,eh%bh,eh%row_ind_sp1,eh%col_ptr_sp1,&
eh%occ(:,eh%ph%i_spin,eh%ph%i_kpt),eh%dm_real_sp)
call elsi_sips_to_generic_dm(eh%ph,eh%bh,eh%dm_real_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,eh%map_sp1,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1511,6 +1528,9 @@ subroutine elsi_get_edm_real_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_ntpoly_to_siesta_dm(eh%bh,eh%ph%nt_dm,edm,eh%row_ind_sp2,&
eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_ntpoly_to_generic_dm(eh%ph,eh%bh,eh%ph%nt_dm,&
eh%ph%nt_map,edm,eh%perm_sp3)
end select
case default
call elsi_stop(eh%bh,"Unsupported density matrix solver.",caller)
......@@ -1615,6 +1635,9 @@ subroutine elsi_get_edm_complex_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_blacs_to_siesta_dm(eh%bh,eh%dm_cmplx_den,edm,&
eh%row_ind_sp2,eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_blacs_to_generic_dm(eh%ph,eh%bh,eh%dm_cmplx_den,&
eh%map_den,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1628,6 +1651,9 @@ subroutine elsi_get_edm_complex_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_blacs_to_siesta_dm(eh%bh,eh%dm_cmplx_den,edm,&
eh%row_ind_sp2,eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_blacs_to_generic_dm(eh%ph,eh%bh,eh%dm_cmplx_den,&
eh%map_den,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1641,6 +1667,11 @@ subroutine elsi_get_edm_complex_sparse(eh,edm)
call elsi_pexsi_to_siesta_dm(eh%ph,eh%bh,eh%dm_cmplx_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,edm,eh%row_ind_sp2,&
eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_compute_edm_pexsi(eh%ph,eh%bh,eh%pexsi_ne_vec,&
eh%dm_cmplx_sp)
call elsi_pexsi_to_generic_dm(eh%ph,eh%bh,eh%dm_cmplx_sp,&
eh%row_ind_sp1,eh%col_ptr_sp1,eh%map_sp1,edm,eh%perm_sp3)
case default
call elsi_stop(eh%bh,"Unsupported matrix format.",caller)
end select
......@@ -1654,6 +1685,9 @@ subroutine elsi_get_edm_complex_sparse(eh,edm)
case(SIESTA_CSC)
call elsi_ntpoly_to_siesta_dm(eh%bh,eh%ph%nt_dm,edm,eh%row_ind_sp2,&
eh%col_ptr_sp2)
case(GENERIC_COO)
call elsi_ntpoly_to_generic_dm(eh%ph,eh%bh,eh%ph%nt_dm,&
eh%ph%nt_map,edm,eh%perm_sp3)
end select
case default
call elsi_stop(eh%bh,"Unsupported density matrix solver.",caller)
......
This diff is collapsed.
......@@ -572,7 +572,7 @@ subroutine elsi_trace_mat_cmplx(ph,bh,row_map,col_map,mat,trace)
character(len=*), parameter :: caller = "elsi_trace_mat_cmplx"
l_trace = 0.0_r8
l_trace = (0.0_r8,0.0_r8)
do i = 1,ph%n_basis
if(row_map(i) > 0 .and. col_map(i) > 0) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment