Commit 58993d35 authored by Yingzhou Li's avatar Yingzhou Li

Added the first version of PPCG

parent 05750e15
......@@ -7,7 +7,8 @@ LIST(APPEND elsi_rci_src
src/elsi_rci_setup.f90
src/Davidson/elsi_rci_davidson.f90
src/OMM/elsi_rci_omm.f90
src/OMM/rci_omm_quartic.f90)
src/OMM/rci_omm_quartic.f90
src/PPCG/elsi_rci_ppcg.f90)
ADD_LIBRARY(elsi_rci ${elsi_rci_src})
......
This diff is collapsed.
......@@ -18,6 +18,7 @@ module ELSI_RCI_CONSTANTS
integer(i4), parameter :: RCI_SOLVER = -1
integer(i4), parameter :: RCI_SOLVER_DAVIDSON = 1
integer(i4), parameter :: RCI_SOLVER_OMM = 2
integer(i4), parameter :: RCI_SOLVER_PPCG = 3
! Constant of ijob
integer(i4), parameter :: RCI_INIT_IJOB = -1
......@@ -43,6 +44,9 @@ module ELSI_RCI_CONSTANTS
integer(i4), parameter :: RCI_HEGV = 17
integer(i4), parameter :: RCI_COL_NORM = 18
integer(i4), parameter :: RCI_SUBCOL = 19
integer(i4), parameter :: RCI_SUBROW = 20
integer(i4), parameter :: RCI_POTRF = 21
integer(i4), parameter :: RCI_TRSM = 22
!&>
end module ELSI_RCI_CONSTANTS
......@@ -6,9 +6,7 @@
!>
!! This module contains variables accessible in ELSI RCI and related modules.
!!
module ELSI_RCI_DATATYPE
module ELSI_RCI_DATATYPE
use, intrinsic :: ISO_C_BINDING
use ELSI_RCI_PRECISION
use ELSI_RCI_CONSTANTS
......@@ -19,7 +17,9 @@ module ELSI_RCI_DATATYPE
! H: Hamiltonian; S: Overlapping matrix; P: Preconditioner
! A, B, C: General matrices
type, public :: rci_instr
character :: jobz, uplo ! job char; and upper or lower
character :: side ! left or right side
character :: trH, trS, trP, trA, trB ! Operation for H, S, P, A, B
integer :: m, n ! size of the output matrix
......@@ -61,6 +61,11 @@ module ELSI_RCI_DATATYPE
! Davidson
integer(i4) :: davidson_max_n
! PPCG
integer(i4) :: ppcg_sbsize
integer(i4) :: ppcg_rrstep
real(r8) :: ppcg_tol_lock
end type
end module ELSI_RCI_DATATYPE
......@@ -76,6 +76,16 @@ contains
! B = A(:,logical(resvec))
! - rci_op_subcol(iS,task,m,n,Aidx,Bidx)
! B = A(logical(resvec),:)
! - rci_op_subrow(iS,task,m,n,Aidx,Bidx)
! Choleskey factorization of A
! - rci_op_potrf(iS,task,uplo,m,Aidx,lda)
! B is the solution of op(A)*X = alpha*B or X*op(A) = alpha*B
! - rci_op_trsm(iS,task,side,uplo,trA,m,n,alpha,Aidx,lda,Bidx,ldb)
subroutine rci_op_null(task)
!**** FUNCTION ********************************!
......@@ -556,4 +566,92 @@ contains
end subroutine rci_op_subcol
subroutine rci_op_subrow(iS, task, m, n, Aidx, Bidx)
!**** FUNCTION ********************************!
! B = A(logical(resvec),:)
implicit none
!**** INPUT ***********************************!
integer, intent(in) :: m ! height of B
integer, intent(in) :: n ! width of B
integer, intent(in) :: Aidx, Bidx ! indices for matrix A and B
!**** OUTPUT ***********************************!
type(rci_instr), intent(out) :: iS
integer(kind=i4), intent(out) :: task
task = RCI_SUBROW
iS%m = m
iS%n = n
iS%Aidx = Aidx
iS%Bidx = Bidx
end subroutine rci_op_subrow
subroutine rci_op_potrf(iS, task, uplo, m, Aidx, lda)
!**** FUNCTION ********************************!
! Cholesky factorization of A
! uplo denote lower or upper resulting factor
implicit none
!**** INPUT ***********************************!
character, intent(in) :: uplo ! upper or lower
integer, intent(in) :: m ! size of A
integer, intent(in) :: Aidx ! idx for mat A
integer, intent(in) :: lda ! lda for mat A
!**** OUTPUT ***********************************!
type(rci_instr), intent(out) :: iS
integer(i4), intent(out) :: task
task = RCI_POTRF
iS%uplo = uplo
iS%m = m
iS%n = m
iS%Aidx = Aidx
iS%lda = lda
end subroutine rci_op_potrf
subroutine rci_op_trsm(iS, task, side, uplo, trA, m, n, &
alpha, Aidx, lda, Bidx, ldb)
!**** FUNCTION ********************************!
! Triangular matrix solve
! op(A)*X = alpha*B or X*op(A) = alpha*B
! B is over written by X
implicit none
!**** INPUT ***********************************!
character, intent(in) :: side ! side
character, intent(in) :: uplo ! upper or lower
character, intent(in) :: trA ! transpose of A
integer, intent(in) :: m, n ! size of B
real(r8), intent(in) :: alpha
integer, intent(in) :: Aidx, Bidx ! idx for mat A, B
integer, intent(in) :: lda, ldb ! lda for mat A, B
!**** OUTPUT ***********************************!
type(rci_instr), intent(out) :: iS
integer(i4), intent(out) :: task
task = RCI_TRSM
iS%side = side
iS%uplo = uplo
iS%trA = trA
iS%m = m
iS%n = n
iS%alpha = alpha
iS%Aidx = Aidx
iS%lda = lda
iS%Bidx = Bidx
iS%ldb = ldb
end subroutine rci_op_trsm
end module ELSI_RCI_OPS
......@@ -48,6 +48,11 @@ contains
! Davidson default
r_h%davidson_max_n = min(2*n_state,n_basis)
! PPCG default
r_h%ppcg_tol_lock = tol_iter
r_h%ppcg_sbsize = min(32,n_state)
r_h%ppcg_rrstep = min(5,max_iter)
end subroutine
end module ELSI_RCI_SETUP
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