Commit 5c964d97 authored by Victor Yu's avatar Victor Yu

Update DM extrapolation

parent c4b4757e
......@@ -26,7 +26,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Deactivate the logger.
SUBROUTINE DeactivateLogger
IsActive = .TRUE.
IsActive = .FALSE.
END SUBROUTINE DeactivateLogger
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Call this subroutine when you enter into a section with verbose output
......
......@@ -398,13 +398,11 @@ subroutine elsi_update_dm_elpa_real(ph,bh,row_map,col_map,ovlp0,ovlp1,dm)
call elsi_get_time(t0)
if(ph%elpa_first) then
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
end if
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
call elsi_allocate(bh,tmp,bh%n_lrow,bh%n_lcol,"tmp",caller)
......@@ -750,13 +748,11 @@ subroutine elsi_update_dm_elpa_cmplx(ph,bh,row_map,col_map,ovlp0,ovlp1,dm)
call elsi_get_time(t0)
if(ph%elpa_first) then
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
end if
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
call elsi_allocate(bh,tmp,bh%n_lrow,bh%n_lcol,"tmp",caller)
......
......@@ -413,13 +413,11 @@ subroutine elsi_update_dm_elpa_real(ph,bh,row_map,col_map,ovlp0,ovlp1,dm)
call elsi_get_time(t0)
if(ph%elpa_first) then
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
end if
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
call elsi_allocate(bh,tmp,bh%n_lrow,bh%n_lcol,"tmp",caller)
......@@ -767,13 +765,11 @@ subroutine elsi_update_dm_elpa_cmplx(ph,bh,row_map,col_map,ovlp0,ovlp1,dm)
call elsi_get_time(t0)
if(ph%elpa_first) then
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1
call elsi_elpa_cholesky(ph,bh,ovlp1)
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
end if
! ovlp1 = U_1^(-1)
call elsi_elpa_invert(ph,bh,ovlp1)
call elsi_allocate(bh,tmp,bh%n_lrow,bh%n_lcol,"tmp",caller)
......
......@@ -118,6 +118,7 @@ subroutine elsi_solve_ntpoly(ph,bh,ham,ovlp,dm)
if(ph%nt_first) then
call elsi_get_time(t0)
call DestructPermutation(ph%nt_perm)
call ConstructRandomPermutation(ph%nt_perm,ovlp%logical_matrix_dimension)
ph%nt_options = SolverParameters_t(ph%nt_tol,ph%nt_filter,ph%nt_max_iter,&
......@@ -142,8 +143,6 @@ subroutine elsi_solve_ntpoly(ph,bh,ham,ovlp,dm)
call elsi_get_time(t0)
call ConstructEmptyMatrix(dm,ham)
ne = int(ph%n_electrons,kind=i4)
select case(ph%nt_method)
......@@ -195,7 +194,6 @@ subroutine elsi_compute_edm_ntpoly(ph,bh,ham,edm)
factor = 1.0_r8/ph%spin_degen
call ConstructEmptyMatrix(tmp,ham)
call CopyMatrix(edm,tmp)
call EnergyDensityMatrix(ham,tmp,edm,ph%nt_filter)
call DestructMatrix(tmp)
......
......@@ -977,9 +977,9 @@ subroutine elsi_write_mat_real_mp(rwh,f_name,mat)
integer(kind=i4) :: n_lcol0
integer(kind=i4) :: prev_nnz
integer(kind=i8) :: offset
real(kind=r8) :: dummy1(1,1)
real(kind=r8) :: dummy2(1)
real(kind=r8), allocatable :: dummy1(:,:)
real(kind=r8), allocatable :: dummy2(:)
real(kind=r8), allocatable :: mat_csc(:)
integer(kind=i4), allocatable :: row_ind(:)
integer(kind=i4), allocatable :: col_ptr(:)
......@@ -1001,21 +1001,15 @@ subroutine elsi_write_mat_real_mp(rwh,f_name,mat)
eh%bh%n_lcol_sp = rwh%n_basis-(rwh%bh%n_procs-1)*eh%bh%n_lcol_sp
end if
call elsi_allocate(rwh%bh,dummy1,1,1,"dummy1",caller)
call elsi_blacs_to_sips_hs_dim(eh%ph,eh%bh,mat,dummy1)
call elsi_allocate(rwh%bh,mat_csc,eh%bh%nnz_l_sp,"mat_csc",caller)
call elsi_allocate(rwh%bh,dummy2,1,"dummy2",caller)
call elsi_allocate(rwh%bh,row_ind,eh%bh%nnz_l_sp,"row_ind",caller)
call elsi_allocate(rwh%bh,col_ptr,eh%bh%n_lcol_sp+1,"col_ptr",caller)
call elsi_blacs_to_sips_hs(eh%ph,eh%bh,mat,dummy1,mat_csc,dummy2,row_ind,&
col_ptr)
call elsi_deallocate(rwh%bh,dummy1,"dummy1")
call elsi_deallocate(rwh%bh,dummy2,"dummy2")
! Open file
f_mode = mpi_mode_wronly+mpi_mode_create
......@@ -1109,9 +1103,9 @@ subroutine elsi_write_mat_complex_mp(rwh,f_name,mat)
integer(kind=i4) :: n_lcol0
integer(kind=i4) :: prev_nnz
integer(kind=i8) :: offset
complex(kind=r8) :: dummy1(1,1)
complex(kind=r8) :: dummy2(1)
complex(kind=r8), allocatable :: dummy1(:,:)
complex(kind=r8), allocatable :: dummy2(:)
complex(kind=r8), allocatable :: mat_csc(:)
integer(kind=i4), allocatable :: row_ind(:)
integer(kind=i4), allocatable :: col_ptr(:)
......@@ -1133,21 +1127,15 @@ subroutine elsi_write_mat_complex_mp(rwh,f_name,mat)
eh%bh%n_lcol_sp = rwh%n_basis-(rwh%bh%n_procs-1)*eh%bh%n_lcol_sp
end if
call elsi_allocate(rwh%bh,dummy1,1,1,"dummy1",caller)
call elsi_blacs_to_sips_hs_dim(eh%ph,eh%bh,mat,dummy1)
call elsi_allocate(rwh%bh,mat_csc,eh%bh%nnz_l_sp,"mat_csc",caller)
call elsi_allocate(rwh%bh,dummy2,1,"dummy2",caller)
call elsi_allocate(rwh%bh,row_ind,eh%bh%nnz_l_sp,"row_ind",caller)
call elsi_allocate(rwh%bh,col_ptr,eh%bh%n_lcol_sp+1,"col_ptr",caller)
call elsi_blacs_to_sips_hs(eh%ph,eh%bh,mat,dummy1,mat_csc,dummy2,row_ind,&
col_ptr)
call elsi_deallocate(rwh%bh,dummy1,"dummy1")
call elsi_deallocate(rwh%bh,dummy2,"dummy2")
! Open file
f_mode = mpi_mode_wronly+mpi_mode_create
......
......@@ -349,7 +349,6 @@ subroutine elsi_reinit(eh)
eh%ph%sips_first = .true.
eh%ph%nt_first = .true.
call elsi_cleanup_ntpoly(eh%ph)
call elsi_cleanup_pexsi(eh%ph)
call elsi_cleanup_sips(eh%ph)
......
......@@ -13,7 +13,7 @@ module ELSI_TOOLS
use ELSI_CONSTANTS, only: ELPA_SOLVER,OMM_SOLVER,SIPS_SOLVER
use ELSI_DATATYPE, only: elsi_handle
use ELSI_ELPA, only: elsi_update_dm_elpa
use ELSI_MALLOC, only: elsi_allocate,elsi_deallocate
use ELSI_MALLOC, only: elsi_allocate
use ELSI_NTPOLY, only: elsi_init_ntpoly,elsi_solve_ntpoly
use ELSI_OCC, only: elsi_mu_and_occ,elsi_entropy
use ELSI_PRECISION, only: i4,r8
......@@ -89,10 +89,9 @@ subroutine elsi_extrapolate_dm_real(eh,ovlp0,ovlp1,dm)
real(kind=r8), intent(inout) :: dm(eh%bh%n_lrow,eh%bh%n_lcol) !< Density matrix
integer(kind=i4) :: solver_save
real(kind=r8) :: dummy(1,1)
logical :: unit_ovlp_save
real(kind=r8), allocatable :: dummy(:,:)
character(len=*), parameter :: caller = "elsi_extrapolate_dm_real"
call elsi_check_init(eh%bh,eh%handle_init,caller)
......@@ -136,7 +135,6 @@ subroutine elsi_extrapolate_dm_real(eh,ovlp0,ovlp1,dm)
unit_ovlp_save = eh%ph%unit_ovlp
eh%ph%unit_ovlp = .true.
call elsi_allocate(eh%bh,dummy,1,1,"dummy",caller)
call elsi_blacs_to_ntpoly_hs(eh%ph,eh%bh,dm,dummy,eh%ph%nt_ham,&
eh%ph%nt_dm)
......@@ -144,7 +142,6 @@ subroutine elsi_extrapolate_dm_real(eh,ovlp0,ovlp1,dm)
call elsi_blacs_to_ntpoly_hs(eh%ph,eh%bh,ovlp1,dummy,eh%ph%nt_ovlp,&
eh%ph%nt_dm)
call elsi_deallocate(eh%bh,dummy,"dummy")
eh%ph%unit_ovlp = unit_ovlp_save
......@@ -169,10 +166,9 @@ subroutine elsi_extrapolate_dm_complex(eh,ovlp0,ovlp1,dm)
complex(kind=r8), intent(inout) :: dm(eh%bh%n_lrow,eh%bh%n_lcol) !< Density matrix
integer(kind=i4) :: solver_save
complex(kind=r8) :: dummy(1,1)
logical :: unit_ovlp_save
complex(kind=r8), allocatable :: dummy(:,:)
character(len=*), parameter :: caller = "elsi_extrapolate_dm_complex"
call elsi_check_init(eh%bh,eh%handle_init,caller)
......@@ -203,7 +199,6 @@ subroutine elsi_extrapolate_dm_complex(eh,ovlp0,ovlp1,dm)
unit_ovlp_save = eh%ph%unit_ovlp
eh%ph%unit_ovlp = .true.
call elsi_allocate(eh%bh,dummy,1,1,"dummy",caller)
call elsi_blacs_to_ntpoly_hs(eh%ph,eh%bh,dm,dummy,eh%ph%nt_ham,&
eh%ph%nt_dm)
......@@ -211,7 +206,6 @@ subroutine elsi_extrapolate_dm_complex(eh,ovlp0,ovlp1,dm)
call elsi_blacs_to_ntpoly_hs(eh%ph,eh%bh,ovlp1,dummy,eh%ph%nt_ovlp,&
eh%ph%nt_dm)
call elsi_deallocate(eh%bh,dummy,"dummy")
eh%ph%unit_ovlp = unit_ovlp_save
......
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