9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-06 21:43:39 +01:00

added some documentation in the README.rst for dav_general_mat

This commit is contained in:
Emmanuel Giner 2021-07-02 18:12:37 +02:00
parent ff87f67cb7
commit 40bf8bd6dd
2 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,13 @@
======== ===============
test_dav dav_general_mat
======== ===============
This modules allows to use the Davidson Algorithm for general squared symmetric matrices
You have two options :
a) the routine "davidson_general" to whom you pass the matrix you want to diagonalize
b) the routine "davidson_general_ext_rout" to whom you pass the subroutine that realizes v = H u
See the routines in "test_dav.irp.f" for a clear example.

View File

@ -22,11 +22,14 @@ subroutine routine
sze = N_det sze = N_det
dim_in = sze dim_in = sze
dressing_state = 0 dressing_state = 0
!!!! MARK THAT u_in mut dimensioned with "N_st_diag_in" as a second dimension
allocate(u_in(dim_in,N_st_diag_in),H_jj(sze),h_mat(sze,sze),energies(N_st)) allocate(u_in(dim_in,N_st_diag_in),H_jj(sze),h_mat(sze,sze),energies(N_st))
u_in = 0.d0 u_in = 0.d0
do i = 1, N_st do i = 1, N_st
u_in(1,i) = 1.d0 u_in(1,i) = 1.d0
enddo enddo
!!! Matrix "h_mat" is the matrix we want to diagonalize with the first routine
!!! "davidson_general"
do i = 1, sze do i = 1, sze
do j = 1, sze do j = 1, sze
h_mat(j,i) = H_matrix_all_dets(j,i) h_mat(j,i) = H_matrix_all_dets(j,i)
@ -37,6 +40,8 @@ subroutine routine
provide nthreads_davidson provide nthreads_davidson
call davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,converged,h_mat) call davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,converged,h_mat)
print*,'energies = ',energies print*,'energies = ',energies
!!! hcalc_template is the routine that computes v = H u
!!! and you can use the routine "davidson_general_ext_rout"
call davidson_general_ext_rout(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,converged,hcalc_template) call davidson_general_ext_rout(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,converged,hcalc_template)
print*,'energies = ',energies print*,'energies = ',energies
end end