Commit 5449420d authored by Victor Yu's avatar Victor Yu

Merge branch 'geometry_optimization' into 'master'

Update DM extrapolation

See merge request elsi-devel/elsi-interface!86
parents 76d6c6d7 972ac0b4
......@@ -7,7 +7,7 @@ SET(elsi_URL "http://elsi-interchange.org")
SET(elsi_EMAIL "elsi-team@duke.edu")
SET(elsi_LICENSE "BSD 3")
SET(elsi_DESCRIPTION "Electronic Structure Infrastructure")
SET(elsi_DATESTAMP "20181119")
SET(elsi_DATESTAMP "20181120")
### CMake modules ###
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
......
No preview for this file type
......@@ -291,7 +291,7 @@ ELSI is a National Science Foundation Software Infrastructure for Sustained Inno
\chapter{Installation of ELSI}
\section{Overview}
\label{sec:install}
The ELSI package contains the ELSI Interface software as well as redistributed source code for the solver libraries ELPA (version 2016.11.001), libOMM, PEXSI (version 1.0.3), and NTPoly (version 2.0). We highly encourage all users to request access to our \href{http://git.elsi-interchange.org/elsi-devel}{GitLab server}GitLab server, where we regularly update ELSI between releases while preserving stability.\\
The ELSI package contains the ELSI Interface software as well as redistributed source code for the solver libraries ELPA (version 2016.11.001), libOMM, PEXSI (version 1.0.3), and NTPoly (version 2.1). We highly encourage all users to request access to our \href{http://git.elsi-interchange.org/elsi-devel}{GitLab server}GitLab server, where we regularly update ELSI between releases while preserving stability.\\
Starting from the May 2018 (version 2.0.0) release, the installation of ELSI makes use of the \href{http://cmake.org}{CMake} software.\\
......@@ -2199,6 +2199,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
\bigskip
\noindent\rule{18cm}{0.4pt}
The source code of ELPA 2016.11.001 (LGPL3), libOMM (BSD2), NTPoly 2.0 (MIT), PEXSI 1.0.3 (BSD3), PT-SCOTCH 6.0.0 (CeCILL-C), and SuperLU\_DIST 5.3.0 (BSD3) are redistributed through this version of ELSI. Individual license of each library can be found in the corresponding subfolder.\\
The source code of ELPA 2016.11.001 (LGPL3), libOMM (BSD2), NTPoly 2.1 (MIT), PEXSI 1.0.3 (BSD3), PT-SCOTCH 6.0.0 (CeCILL-C), and SuperLU\_DIST 5.3.0 (BSD3) are redistributed through this version of ELSI. Individual license of each library can be found in the corresponding subfolder.\\
\end{document}
......@@ -112,6 +112,9 @@ void c_elsi_set_output(elsi_handle handle_c,
void c_elsi_set_output_log(elsi_handle handle_c,
int output_log);
void c_elsi_set_save_ovlp(elsi_handle handle_c,
int save_ovlp);
void c_elsi_set_unit_ovlp(elsi_handle handle_c,
int unit_ovlp);
......
......@@ -535,6 +535,22 @@ subroutine elsi_set_output_log_c_wrapper(h_c,output_log)&
end subroutine
subroutine elsi_set_save_ovlp_c_wrapper(h_c,save_ovlp)&
bind(C,name="c_elsi_set_save_ovlp")
implicit none
type(c_ptr), value, intent(in) :: h_c
integer(kind=c_int), value, intent(in) :: save_ovlp
type(elsi_handle), pointer :: h_f
call c_f_pointer(h_c,h_f)
call elsi_set_save_ovlp(h_f,save_ovlp)
end subroutine
subroutine elsi_set_unit_ovlp_c_wrapper(h_c,unit_ovlp)&
bind(C,name="c_elsi_set_unit_ovlp")
......
......@@ -533,8 +533,8 @@ subroutine elsi_set_omm_n_elpa(eh,n_elpa)
call elsi_check_init(eh%bh,eh%handle_init,caller)
if(n_elpa < 0) then
eh%ph%omm_n_elpa = 0
if(n_elpa < 1) then
eh%ph%omm_n_elpa = 1
else
eh%ph%omm_n_elpa = n_elpa
end if
......
......@@ -17,13 +17,12 @@ module ELSI_NTPOLY
use ELSI_MPI, only: elsi_check_mpi,mpi_logical
use ELSI_PRECISION, only: r8,i4
use NTPOLY, only: PM,TRS2,TRS4,HPCP,EnergyDensityMatrix,LowdinExtrapolate,&
PurificationExtrapolate,Matrix_ps,ConstructEmptyMatrix,DestructMatrix,&
CopyMatrix,ScaleMatrix,FillMatrixFromTripletList,GetMatrixTripletList,&
ProcessGrid_t,ConstructNewProcessGrid,DestructProcessGrid,&
ConstructRandomPermutation,DestructPermutation,InverseSquareRoot,&
SolverParameters_t,Triplet_r,Triplet_c,TripletList_r,TripletList_c,&
ConstructTripletList,AppendToTripletList,DestructTripletList,&
ActivateLogger,DeactivateLogger
Matrix_ps,ConstructEmptyMatrix,DestructMatrix,CopyMatrix,ScaleMatrix,&
FillMatrixFromTripletList,GetMatrixTripletList,ProcessGrid_t,&
ConstructNewProcessGrid,DestructProcessGrid,ConstructRandomPermutation,&
DestructPermutation,InverseSquareRoot,SolverParameters_t,Triplet_r,&
Triplet_c,TripletList_r,TripletList_c,ConstructTripletList,&
AppendToTripletList,DestructTripletList,ActivateLogger,DeactivateLogger
implicit none
......@@ -240,11 +239,15 @@ subroutine elsi_update_dm_ntpoly(ph,bh,ovlp0,ovlp1,dm0,dm1)
ne = int(ph%n_electrons,kind=i4)
if(ph%solver /= NTPOLY_SOLVER) then
call PurificationExtrapolate(dm0,ovlp1,ne,dm1,ph%nt_options)
else
call LowdinExtrapolate(dm0,ovlp0,ovlp1,dm1,ph%nt_options)
call DestructPermutation(ph%nt_perm)
call ConstructRandomPermutation(ph%nt_perm,ovlp0%logical_matrix_dimension)
ph%nt_options = SolverParameters_t(ph%nt_tol,ph%nt_filter,ph%nt_max_iter,&
ph%nt_output,ph%nt_perm)
end if
call LowdinExtrapolate(dm0,ovlp0,ovlp1,dm1,ph%nt_options)
call elsi_get_time(t1)
write(msg,"(2X,A)") "Finished density matrix extrapolation"
......
......@@ -130,7 +130,7 @@ subroutine elsi_solve_omm_real(ph,bh,ham,ovlp,coeff,dm)
call elsi_say(bh,msg)
end if
if(ph%omm_first .and. ph%omm_n_elpa > 0) then
if(ph%omm_first) then
call elsi_elpa_invert(ph,bh,ovlp)
end if
end if
......@@ -282,7 +282,7 @@ subroutine elsi_solve_omm_cmplx(ph,bh,ham,ovlp,coeff,dm)
call elsi_say(bh,msg)
end if
if(ph%omm_first .and. ph%omm_n_elpa > 0) then
if(ph%omm_first) then
call elsi_elpa_invert(ph,bh,ovlp)
end if
end if
......
......@@ -180,7 +180,9 @@ subroutine elsi_ev_real(eh,ham,ovlp,eval,evec)
if(eh%ph%solver == SIPS_SOLVER .and. eh%ph%n_calls <= eh%ph%sips_n_elpa) then
solver = ELPA_SOLVER
end if
if(eh%ph%solver /= solver) then
! Save overlap
if(.not. allocated(eh%ovlp_real_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_real_copy,eh%bh%n_lrow,eh%bh%n_lcol,&
......@@ -508,7 +510,13 @@ subroutine elsi_dm_real(eh,ham,ovlp,dm,ebs)
if(eh%ph%solver == SIPS_SOLVER .and. eh%ph%n_calls <= eh%ph%sips_n_elpa) then
solver = ELPA_SOLVER
end if
if(eh%ph%solver == OMM_SOLVER .and. eh%ph%n_calls <= eh%ph%omm_n_elpa) then
solver = ELPA_SOLVER
end if
if(eh%ph%solver /= solver) then
! Save overlap
if(.not. allocated(eh%ovlp_real_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_real_copy,eh%bh%n_lrow,eh%bh%n_lcol,&
......@@ -518,20 +526,6 @@ subroutine elsi_dm_real(eh,ham,ovlp,dm,ebs)
end if
end if
if(eh%ph%solver == OMM_SOLVER .and. eh%ph%n_calls <= eh%ph%omm_n_elpa) then
solver = ELPA_SOLVER
if(eh%ph%omm_flavor == 0) then
! Save overlap
if(.not. allocated(eh%ovlp_real_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_real_copy,eh%bh%n_lrow,&
eh%bh%n_lcol,"ovlp_real_copy",caller)
eh%ovlp_real_copy = ovlp
end if
end if
end if
select case(solver)
case(ELPA_SOLVER)
call elsi_init_elpa(eh%ph,eh%bh)
......@@ -561,8 +555,10 @@ subroutine elsi_dm_real(eh,ham,ovlp,dm,ebs)
call elsi_init_omm(eh%ph,eh%bh)
if(allocated(eh%ovlp_real_copy)) then
! Restore overlap
ovlp = eh%ovlp_real_copy
if(eh%ph%omm_flavor == 0) then
! Restore overlap
ovlp = eh%ovlp_real_copy
end if
call elsi_deallocate(eh%bh,eh%ovlp_real_copy,"ovlp_real_copy")
end if
......@@ -572,23 +568,21 @@ subroutine elsi_dm_real(eh,ham,ovlp,dm,ebs)
"omm_c_real",caller)
! Initialize coefficient matrix with ELPA eigenvectors
if(eh%ph%omm_n_elpa > 0) then
call pdtran(eh%ph%n_basis,eh%ph%n_basis,1.0_r8,eh%evec_real,1,1,&
eh%bh%desc,0.0_r8,dm,1,1,eh%bh%desc)
call pdtran(eh%ph%n_basis,eh%ph%n_basis,1.0_r8,eh%evec_real,1,1,&
eh%bh%desc,0.0_r8,dm,1,1,eh%bh%desc)
eh%omm_c_real(1:eh%ph%omm_n_lrow,:) = dm(1:eh%ph%omm_n_lrow,:)
eh%omm_c_real(1:eh%ph%omm_n_lrow,:) = dm(1:eh%ph%omm_n_lrow,:)
if(allocated(eh%evec_real)) then
call elsi_deallocate(eh%bh,eh%evec_real,"evec_real")
end if
if(allocated(eh%evec_real)) then
call elsi_deallocate(eh%bh,eh%evec_real,"evec_real")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
end if
......@@ -710,7 +704,7 @@ subroutine elsi_dm_real(eh,ham,ovlp,dm,ebs)
eh%ph%edm_ready_real = .true.
! Save information for density matrix extrapolation
if(eh%ph%save_ovlp .and. eh%ph%n_calls == 1) then
if(eh%ph%save_ovlp) then
if(eh%ph%solver == ELPA_SOLVER) then
if(.not. allocated(eh%ovlp_real_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_real_copy,eh%bh%n_lrow,&
......@@ -775,15 +769,15 @@ subroutine elsi_dm_complex(eh,ham,ovlp,dm,ebs)
if(eh%ph%solver == OMM_SOLVER .and. eh%ph%n_calls <= eh%ph%omm_n_elpa) then
solver = ELPA_SOLVER
end if
if(eh%ph%omm_flavor == 0) then
! Save overlap
if(.not. allocated(eh%ovlp_cmplx_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_cmplx_copy,eh%bh%n_lrow,&
eh%bh%n_lcol,"ovlp_cmplx_copy",caller)
if(eh%ph%solver /= solver) then
! Save overlap
if(.not. allocated(eh%ovlp_cmplx_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_cmplx_copy,eh%bh%n_lrow,eh%bh%n_lcol,&
"ovlp_cmplx_copy",caller)
eh%ovlp_cmplx_copy = ovlp
end if
eh%ovlp_cmplx_copy = ovlp
end if
end if
......@@ -816,8 +810,10 @@ subroutine elsi_dm_complex(eh,ham,ovlp,dm,ebs)
call elsi_init_omm(eh%ph,eh%bh)
if(allocated(eh%ovlp_cmplx_copy)) then
! Restore overlap
ovlp = eh%ovlp_cmplx_copy
if(eh%ph%omm_flavor == 0) then
! Restore overlap
ovlp = eh%ovlp_cmplx_copy
end if
call elsi_deallocate(eh%bh,eh%ovlp_cmplx_copy,"ovlp_cmplx_copy")
end if
......@@ -827,23 +823,21 @@ subroutine elsi_dm_complex(eh,ham,ovlp,dm,ebs)
"omm_c_cmplx",caller)
! Initialize coefficient matrix with ELPA eigenvectors
if(eh%ph%omm_n_elpa > 0) then
call pztranc(eh%ph%n_basis,eh%ph%n_basis,(1.0_r8,0.0_r8),&
eh%evec_cmplx,1,1,eh%bh%desc,(0.0_r8,0.0_r8),dm,1,1,eh%bh%desc)
call pztranc(eh%ph%n_basis,eh%ph%n_basis,(1.0_r8,0.0_r8),&
eh%evec_cmplx,1,1,eh%bh%desc,(0.0_r8,0.0_r8),dm,1,1,eh%bh%desc)
eh%omm_c_cmplx(1:eh%ph%omm_n_lrow,:) = dm(1:eh%ph%omm_n_lrow,:)
eh%omm_c_cmplx(1:eh%ph%omm_n_lrow,:) = dm(1:eh%ph%omm_n_lrow,:)
if(allocated(eh%evec_cmplx)) then
call elsi_deallocate(eh%bh,eh%evec_cmplx,"evec_cmplx")
end if
if(allocated(eh%evec_cmplx)) then
call elsi_deallocate(eh%bh,eh%evec_cmplx,"evec_cmplx")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
end if
......@@ -905,7 +899,7 @@ subroutine elsi_dm_complex(eh,ham,ovlp,dm,ebs)
eh%ph%edm_ready_cmplx = .true.
! Save information for density matrix extrapolation
if(eh%ph%save_ovlp .and. eh%ph%n_calls == 1) then
if(eh%ph%save_ovlp) then
if(eh%ph%solver == ELPA_SOLVER) then
if(.not. allocated(eh%ovlp_cmplx_copy)) then
call elsi_allocate(eh%bh,eh%ovlp_cmplx_copy,eh%bh%n_lrow,&
......@@ -1083,24 +1077,22 @@ subroutine elsi_dm_real_sparse(eh,ham,ovlp,dm,ebs)
"omm_c_real",caller)
! Initialize coefficient matrix with ELPA eigenvectors
if(eh%ph%omm_n_elpa > 0) then
call pdtran(eh%ph%n_basis,eh%ph%n_basis,1.0_r8,eh%evec_real,1,1,&
eh%bh%desc,0.0_r8,eh%dm_real_den,1,1,eh%bh%desc)
call pdtran(eh%ph%n_basis,eh%ph%n_basis,1.0_r8,eh%evec_real,1,1,&
eh%bh%desc,0.0_r8,eh%dm_real_den,1,1,eh%bh%desc)
eh%omm_c_real(1:eh%ph%omm_n_lrow,:)&
= eh%dm_real_den(1:eh%ph%omm_n_lrow,:)
eh%omm_c_real(1:eh%ph%omm_n_lrow,:)&
= eh%dm_real_den(1:eh%ph%omm_n_lrow,:)
if(allocated(eh%evec_real)) then
call elsi_deallocate(eh%bh,eh%evec_real,"evec_real")
end if
if(allocated(eh%evec_real)) then
call elsi_deallocate(eh%bh,eh%evec_real,"evec_real")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
end if
......@@ -1447,25 +1439,23 @@ subroutine elsi_dm_complex_sparse(eh,ham,ovlp,dm,ebs)
"omm_c_cmplx",caller)
! Initialize coefficient matrix with ELPA eigenvectors
if(eh%ph%omm_n_elpa > 0) then
call pztranc(eh%ph%n_basis,eh%ph%n_basis,(1.0_r8,0.0_r8),&
eh%evec_cmplx,1,1,eh%bh%desc,(0.0_r8,0.0_r8),eh%dm_cmplx_den,&
1,1,eh%bh%desc)
call pztranc(eh%ph%n_basis,eh%ph%n_basis,(1.0_r8,0.0_r8),&
eh%evec_cmplx,1,1,eh%bh%desc,(0.0_r8,0.0_r8),eh%dm_cmplx_den,&
1,1,eh%bh%desc)
eh%omm_c_cmplx(1:eh%ph%omm_n_lrow,:)&
= eh%dm_cmplx_den(1:eh%ph%omm_n_lrow,:)
eh%omm_c_cmplx(1:eh%ph%omm_n_lrow,:)&
= eh%dm_cmplx_den(1:eh%ph%omm_n_lrow,:)
if(allocated(eh%evec_cmplx)) then
call elsi_deallocate(eh%bh,eh%evec_cmplx,"evec_cmplx")
end if
if(allocated(eh%evec_cmplx)) then
call elsi_deallocate(eh%bh,eh%evec_cmplx,"evec_cmplx")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%eval)) then
call elsi_deallocate(eh%bh,eh%eval,"eval")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
if(allocated(eh%occ)) then
call elsi_deallocate(eh%bh,eh%occ,"occ")
end if
end if
......
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