mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-23 04:43:45 +01:00
Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev
This commit is contained in:
commit
12cbde2289
@ -88,7 +88,7 @@
|
|||||||
- Using Intel IPP for sorting when using Intel compiler
|
- Using Intel IPP for sorting when using Intel compiler
|
||||||
- Removed parallelism in sorting
|
- Removed parallelism in sorting
|
||||||
- Compute banned_excitations from exchange integrals to accelerate with local MOs
|
- Compute banned_excitations from exchange integrals to accelerate with local MOs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ Usage:
|
|||||||
qp_plugins download <url> [-n <name>]
|
qp_plugins download <url> [-n <name>]
|
||||||
qp_plugins install <name>...
|
qp_plugins install <name>...
|
||||||
qp_plugins uninstall <name>
|
qp_plugins uninstall <name>
|
||||||
|
qp_plugins remove <name>
|
||||||
qp_plugins update [-r <repo>]
|
qp_plugins update [-r <repo>]
|
||||||
qp_plugins create -n <name> [-r <repo>] [<needed_modules>...]
|
qp_plugins create -n <name> [-r <repo>] [<needed_modules>...]
|
||||||
|
|
||||||
@ -24,6 +25,8 @@ Options:
|
|||||||
|
|
||||||
uninstall Uninstall a plugin
|
uninstall Uninstall a plugin
|
||||||
|
|
||||||
|
remove Uninstall a plugin
|
||||||
|
|
||||||
update Update the repository
|
update Update the repository
|
||||||
|
|
||||||
create
|
create
|
||||||
@ -274,7 +277,7 @@ def main(arguments):
|
|||||||
subprocess.check_call(["qp_create_ninja", "update"])
|
subprocess.check_call(["qp_create_ninja", "update"])
|
||||||
print("[ OK ]")
|
print("[ OK ]")
|
||||||
|
|
||||||
elif arguments["uninstall"]:
|
elif arguments["uninstall"] or arguments["remove"]:
|
||||||
|
|
||||||
m_instance = ModuleHandler([QP_SRC])
|
m_instance = ModuleHandler([QP_SRC])
|
||||||
d_descendant = m_instance.dict_descendant
|
d_descendant = m_instance.dict_descendant
|
||||||
|
3
configure
vendored
3
configure
vendored
@ -66,7 +66,6 @@ function execute () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PACKAGES=""
|
PACKAGES=""
|
||||||
echo $@
|
|
||||||
|
|
||||||
|
|
||||||
while getopts "d:c:i:h" c ; do
|
while getopts "d:c:i:h" c ; do
|
||||||
@ -90,7 +89,7 @@ while getopts "d:c:i:h" c ; do
|
|||||||
help
|
help
|
||||||
exit 0;;
|
exit 0;;
|
||||||
*)
|
*)
|
||||||
error $(basename $0)": unknown option $c, try --help"
|
error $(basename $0)": unknown option $c, try -h for help"
|
||||||
exit 2;;
|
exit 2;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -204,6 +204,9 @@ _qp_Complete()
|
|||||||
uninstall)
|
uninstall)
|
||||||
COMPREPLY=( $(compgen -W "$(qp_plugins list -i)" -- $cur ) )
|
COMPREPLY=( $(compgen -W "$(qp_plugins list -i)" -- $cur ) )
|
||||||
return 0;;
|
return 0;;
|
||||||
|
remove)
|
||||||
|
COMPREPLY=( $(compgen -W "$(qp_plugins list -i)" -- $cur ) )
|
||||||
|
return 0;;
|
||||||
create)
|
create)
|
||||||
COMPREPLY=( $(compgen -W "-n " -- $cur ) )
|
COMPREPLY=( $(compgen -W "-n " -- $cur ) )
|
||||||
return 0;;
|
return 0;;
|
||||||
|
@ -116,6 +116,7 @@ def get_l_module_descendant(d_child, l_module):
|
|||||||
print("Error: ", file=sys.stderr)
|
print("Error: ", file=sys.stderr)
|
||||||
print("`{0}` is not a submodule".format(module), file=sys.stderr)
|
print("`{0}` is not a submodule".format(module), file=sys.stderr)
|
||||||
print("Check the typo (spelling, case, '/', etc.) ", file=sys.stderr)
|
print("Check the typo (spelling, case, '/', etc.) ", file=sys.stderr)
|
||||||
|
# pass
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return list(set(l))
|
return list(set(l))
|
||||||
|
@ -58,3 +58,17 @@ END_PROVIDER
|
|||||||
enddo
|
enddo
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [double precision, final_grid_points_transp, (n_points_final_grid,3)]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Transposed final_grid_points
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
integer :: i,j
|
||||||
|
do j=1,3
|
||||||
|
do i=1,n_points_final_grid
|
||||||
|
final_grid_points_transp(i,j) = final_grid_points(j,i)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
END_PROVIDER
|
||||||
|
@ -38,6 +38,8 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_cfg_out)
|
|||||||
|
|
||||||
integer s, bfIcfg
|
integer s, bfIcfg
|
||||||
integer countcsf
|
integer countcsf
|
||||||
|
integer MS
|
||||||
|
MS = elec_alpha_num-elec_beta_num
|
||||||
countcsf = 0
|
countcsf = 0
|
||||||
phasedet = 1.0d0
|
phasedet = 1.0d0
|
||||||
do i = 1,N_configuration
|
do i = 1,N_configuration
|
||||||
@ -56,12 +58,17 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_cfg_out)
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
s = 0
|
s = 0 ! s == total number of SOMOs
|
||||||
do k=1,N_int
|
do k=1,N_int
|
||||||
if (psi_configuration(k,1,i) == 0_bit_kind) cycle
|
if (psi_configuration(k,1,i) == 0_bit_kind) cycle
|
||||||
s = s + popcnt(psi_configuration(k,1,i))
|
s = s + popcnt(psi_configuration(k,1,i))
|
||||||
enddo
|
enddo
|
||||||
bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1))))
|
|
||||||
|
if(iand(s,1) .EQ. 0) then
|
||||||
|
bfIcfg = max(1,nint((binom(s,s/2)-binom(s,(s/2)+1))))
|
||||||
|
else
|
||||||
|
bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1))))
|
||||||
|
endif
|
||||||
|
|
||||||
! perhaps blocking with CFGs of same seniority
|
! perhaps blocking with CFGs of same seniority
|
||||||
! can be more efficient
|
! can be more efficient
|
||||||
|
@ -65,23 +65,9 @@
|
|||||||
dimcsfpercfg = 2
|
dimcsfpercfg = 2
|
||||||
else
|
else
|
||||||
if(iand(MS,1) .EQ. 0) then
|
if(iand(MS,1) .EQ. 0) then
|
||||||
!dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1))))
|
dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1))))
|
||||||
binom1 = dexp(logabsgamma(1.0d0*(i+1)) &
|
|
||||||
- logabsgamma(1.0d0*((i/2)+1)) &
|
|
||||||
- logabsgamma(1.0d0*(i-((i/2))+1)));
|
|
||||||
binom2 = dexp(logabsgamma(1.0d0*(i+1)) &
|
|
||||||
- logabsgamma(1.0d0*(((i/2)+1)+1)) &
|
|
||||||
- logabsgamma(1.0d0*(i-((i/2)+1)+1)));
|
|
||||||
dimcsfpercfg = max(1,nint(binom1 - binom2))
|
|
||||||
else
|
else
|
||||||
!dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2))))
|
dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2))))
|
||||||
binom1 = dexp(logabsgamma(1.0d0*(i+1)) &
|
|
||||||
- logabsgamma(1.0d0*(((i+1)/2)+1)) &
|
|
||||||
- logabsgamma(1.0d0*(i-(((i+1)/2))+1)));
|
|
||||||
binom2 = dexp(logabsgamma(1.0d0*(i+1)) &
|
|
||||||
- logabsgamma(1.0d0*((((i+3)/2)+1)+1)) &
|
|
||||||
- logabsgamma(1.0d0*(i-(((i+3)/2)+1)+1)));
|
|
||||||
dimcsfpercfg = max(1,nint(binom1 - binom2))
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
n_CSF += ncfg * dimcsfpercfg
|
n_CSF += ncfg * dimcsfpercfg
|
||||||
|
@ -299,7 +299,7 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
|
|||||||
shift = N_st_diag*(iter-1)
|
shift = N_st_diag*(iter-1)
|
||||||
shift2 = N_st_diag*iter
|
shift2 = N_st_diag*iter
|
||||||
|
|
||||||
if ((iter > 1).or.(itertot == 1)) then
|
! if ((iter > 1).or.(itertot == 1)) then
|
||||||
! Compute |W_k> = \sum_i |i><i|H|u_k>
|
! Compute |W_k> = \sum_i |i><i|H|u_k>
|
||||||
! -----------------------------------
|
! -----------------------------------
|
||||||
|
|
||||||
@ -309,10 +309,10 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
|
|||||||
else
|
else
|
||||||
call H_u_0_nstates_openmp(W,U,N_st_diag,sze)
|
call H_u_0_nstates_openmp(W,U,N_st_diag,sze)
|
||||||
endif
|
endif
|
||||||
else
|
! else
|
||||||
! Already computed in update below
|
! ! Already computed in update below
|
||||||
continue
|
! continue
|
||||||
endif
|
! endif
|
||||||
|
|
||||||
if (dressing_state > 0) then
|
if (dressing_state > 0) then
|
||||||
|
|
||||||
@ -508,17 +508,8 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
|
|||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
! Re-contract U and update W
|
! Re-contract U
|
||||||
! --------------------------------
|
! -------------
|
||||||
|
|
||||||
call dgemm('N','N', sze_csf, N_st_diag, shift2, 1.d0, &
|
|
||||||
W_csf, size(W_csf,1), y, size(y,1), 0.d0, u_in, size(u_in,1))
|
|
||||||
do k=1,N_st_diag
|
|
||||||
do i=1,sze_csf
|
|
||||||
W_csf(i,k) = u_in(i,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
call convertWFfromCSFtoDET(N_st_diag,W_csf,W)
|
|
||||||
|
|
||||||
call dgemm('N','N', sze_csf, N_st_diag, shift2, 1.d0, &
|
call dgemm('N','N', sze_csf, N_st_diag, shift2, 1.d0, &
|
||||||
U_csf, size(U_csf,1), y, size(y,1), 0.d0, u_in, size(u_in,1))
|
U_csf, size(U_csf,1), y, size(y,1), 0.d0, u_in, size(u_in,1))
|
||||||
|
@ -349,7 +349,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
|||||||
shift = N_st_diag*(iter-1)
|
shift = N_st_diag*(iter-1)
|
||||||
shift2 = N_st_diag*iter
|
shift2 = N_st_diag*iter
|
||||||
|
|
||||||
if ((iter > 1).or.(itertot == 1)) then
|
! if ((iter > 1).or.(itertot == 1)) then
|
||||||
! Compute |W_k> = \sum_i |i><i|H|u_k>
|
! Compute |W_k> = \sum_i |i><i|H|u_k>
|
||||||
! -----------------------------------
|
! -----------------------------------
|
||||||
|
|
||||||
@ -359,10 +359,10 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
|||||||
call H_S2_u_0_nstates_openmp(W(1,shift+1),S_d,U(1,shift+1),N_st_diag,sze)
|
call H_S2_u_0_nstates_openmp(W(1,shift+1),S_d,U(1,shift+1),N_st_diag,sze)
|
||||||
endif
|
endif
|
||||||
S(1:sze,shift+1:shift+N_st_diag) = real(S_d(1:sze,1:N_st_diag))
|
S(1:sze,shift+1:shift+N_st_diag) = real(S_d(1:sze,1:N_st_diag))
|
||||||
else
|
! else
|
||||||
! Already computed in update below
|
! ! Already computed in update below
|
||||||
continue
|
! continue
|
||||||
endif
|
! endif
|
||||||
|
|
||||||
if (dressing_state > 0) then
|
if (dressing_state > 0) then
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, CI_energy, (N_states_diag) ]
|
BEGIN_PROVIDER [ double precision, CI_energy, (N_states_diag) ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! :c:data:`n_states` lowest eigenvalues of the |CI| matrix
|
! :c:data:`n_states` lowest eigenvalues of the |CI| matrix
|
||||||
END_DOC
|
END_DOC
|
||||||
|
PROVIDE distributed_davidson
|
||||||
|
|
||||||
integer :: j
|
integer :: j
|
||||||
character*(8) :: st
|
character*(8) :: st
|
||||||
@ -247,6 +247,7 @@ subroutine diagonalize_CI
|
|||||||
! eigenstates of the |CI| matrix.
|
! eigenstates of the |CI| matrix.
|
||||||
END_DOC
|
END_DOC
|
||||||
integer :: i,j
|
integer :: i,j
|
||||||
|
PROVIDE distributed_davidson
|
||||||
do j=1,N_states
|
do j=1,N_states
|
||||||
do i=1,N_det
|
do i=1,N_det
|
||||||
psi_coef(i,j) = CI_eigenvectors(i,j)
|
psi_coef(i,j) = CI_eigenvectors(i,j)
|
||||||
|
@ -21,133 +21,201 @@ END_PROVIDER
|
|||||||
BEGIN_PROVIDER [ double precision, CI_electronic_energy_dressed, (N_states_diag) ]
|
BEGIN_PROVIDER [ double precision, CI_electronic_energy_dressed, (N_states_diag) ]
|
||||||
&BEGIN_PROVIDER [ double precision, CI_eigenvectors_dressed, (N_det,N_states_diag) ]
|
&BEGIN_PROVIDER [ double precision, CI_eigenvectors_dressed, (N_det,N_states_diag) ]
|
||||||
&BEGIN_PROVIDER [ double precision, CI_eigenvectors_s2_dressed, (N_states_diag) ]
|
&BEGIN_PROVIDER [ double precision, CI_eigenvectors_s2_dressed, (N_states_diag) ]
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Eigenvectors/values of the CI matrix
|
! Eigenvectors/values of the CI matrix
|
||||||
END_DOC
|
END_DOC
|
||||||
implicit none
|
implicit none
|
||||||
double precision :: ovrlp,u_dot_v
|
double precision :: ovrlp,u_dot_v
|
||||||
integer :: i_good_state
|
integer :: i_good_state
|
||||||
integer, allocatable :: index_good_state_array(:)
|
integer, allocatable :: index_good_state_array(:)
|
||||||
logical, allocatable :: good_state_array(:)
|
logical, allocatable :: good_state_array(:)
|
||||||
double precision, allocatable :: s2_values_tmp(:)
|
double precision, allocatable :: s2_values_tmp(:)
|
||||||
integer :: i_other_state
|
integer :: i_other_state
|
||||||
double precision, allocatable :: eigenvectors(:,:), eigenvectors_s2(:,:), eigenvalues(:)
|
double precision, allocatable :: eigenvectors(:,:), eigenvectors_s2(:,:), eigenvalues(:)
|
||||||
integer :: i_state
|
integer :: i_state
|
||||||
double precision :: e_0
|
double precision :: e_0
|
||||||
integer :: i,j,k,mrcc_state
|
integer :: i,j,k,mrcc_state
|
||||||
double precision, allocatable :: s2_eigvalues(:)
|
double precision, allocatable :: s2_eigvalues(:)
|
||||||
double precision, allocatable :: e_array(:)
|
double precision, allocatable :: e_array(:)
|
||||||
integer, allocatable :: iorder(:)
|
integer, allocatable :: iorder(:)
|
||||||
|
logical :: converged
|
||||||
PROVIDE threshold_davidson nthreads_davidson
|
logical :: do_csf
|
||||||
! Guess values for the "N_states" states of the CI_eigenvectors_dressed
|
|
||||||
do j=1,min(N_states,N_det)
|
PROVIDE threshold_davidson nthreads_davidson
|
||||||
do i=1,N_det
|
! Guess values for the "N_states" states of the CI_eigenvectors_dressed
|
||||||
CI_eigenvectors_dressed(i,j) = psi_coef(i,j)
|
do j=1,min(N_states,N_det)
|
||||||
enddo
|
do i=1,N_det
|
||||||
enddo
|
CI_eigenvectors_dressed(i,j) = psi_coef(i,j)
|
||||||
|
enddo
|
||||||
do j=min(N_states,N_det)+1,N_states_diag
|
enddo
|
||||||
do i=1,N_det
|
|
||||||
CI_eigenvectors_dressed(i,j) = 0.d0
|
do j=min(N_states,N_det)+1,N_states_diag
|
||||||
enddo
|
do i=1,N_det
|
||||||
enddo
|
CI_eigenvectors_dressed(i,j) = 0.d0
|
||||||
|
enddo
|
||||||
if (diag_algorithm == "Davidson") then
|
enddo
|
||||||
|
|
||||||
do j=1,min(N_states,N_det)
|
do_csf = s2_eig .and. only_expected_s2 .and. csf_based
|
||||||
do i=1,N_det
|
|
||||||
CI_eigenvectors_dressed(i,j) = psi_coef(i,j)
|
if (diag_algorithm == "Davidson") then
|
||||||
enddo
|
|
||||||
enddo
|
do j=1,min(N_states,N_det)
|
||||||
logical :: converged
|
do i=1,N_det
|
||||||
converged = .False.
|
CI_eigenvectors_dressed(i,j) = psi_coef(i,j)
|
||||||
call davidson_diag_HS2(psi_det,CI_eigenvectors_dressed, CI_eigenvectors_s2_dressed,&
|
|
||||||
size(CI_eigenvectors_dressed,1), CI_electronic_energy_dressed,&
|
|
||||||
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
|
||||||
|
|
||||||
else if (diag_algorithm == "Lapack") then
|
|
||||||
|
|
||||||
allocate (eigenvectors(size(H_matrix_dressed,1),N_det))
|
|
||||||
allocate (eigenvalues(N_det))
|
|
||||||
|
|
||||||
call lapack_diag(eigenvalues,eigenvectors, &
|
|
||||||
H_matrix_dressed,size(H_matrix_dressed,1),N_det)
|
|
||||||
CI_electronic_energy_dressed(:) = 0.d0
|
|
||||||
if (s2_eig) then
|
|
||||||
i_state = 0
|
|
||||||
allocate (s2_eigvalues(N_det))
|
|
||||||
allocate(index_good_state_array(N_det),good_state_array(N_det))
|
|
||||||
good_state_array = .False.
|
|
||||||
|
|
||||||
call u_0_S2_u_0(s2_eigvalues,eigenvectors,N_det,psi_det,N_int,&
|
|
||||||
N_det,size(eigenvectors,1))
|
|
||||||
do j=1,N_det
|
|
||||||
! Select at least n_states states with S^2 values closed to "expected_s2"
|
|
||||||
if(dabs(s2_eigvalues(j)-expected_s2).le.0.5d0)then
|
|
||||||
i_state +=1
|
|
||||||
index_good_state_array(i_state) = j
|
|
||||||
good_state_array(j) = .True.
|
|
||||||
endif
|
|
||||||
if(i_state.eq.N_states) then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
enddo
|
||||||
if(i_state .ne.0)then
|
enddo
|
||||||
! Fill the first "i_state" states that have a correct S^2 value
|
converged = .False.
|
||||||
do j = 1, i_state
|
if (do_csf) then
|
||||||
do i=1,N_det
|
call davidson_diag_H_csf(psi_det,CI_eigenvectors_dressed, &
|
||||||
CI_eigenvectors_dressed(i,j) = eigenvectors(i,index_good_state_array(j))
|
size(CI_eigenvectors_dressed,1),CI_electronic_energy_dressed, &
|
||||||
enddo
|
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||||
CI_electronic_energy_dressed(j) = eigenvalues(index_good_state_array(j))
|
|
||||||
CI_eigenvectors_s2_dressed(j) = s2_eigvalues(index_good_state_array(j))
|
|
||||||
enddo
|
|
||||||
i_other_state = 0
|
|
||||||
do j = 1, N_det
|
|
||||||
if(good_state_array(j))cycle
|
|
||||||
i_other_state +=1
|
|
||||||
if(i_state+i_other_state.gt.n_states_diag)then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
do i=1,N_det
|
|
||||||
CI_eigenvectors_dressed(i,i_state+i_other_state) = eigenvectors(i,j)
|
|
||||||
enddo
|
|
||||||
CI_electronic_energy_dressed(i_state+i_other_state) = eigenvalues(j)
|
|
||||||
CI_eigenvectors_s2_dressed(i_state+i_other_state) = s2_eigvalues(i_state+i_other_state)
|
|
||||||
enddo
|
|
||||||
else
|
|
||||||
print*,''
|
|
||||||
print*,'!!!!!!!! WARNING !!!!!!!!!'
|
|
||||||
print*,' Within the ',N_det,'determinants selected'
|
|
||||||
print*,' and the ',N_states_diag,'states requested'
|
|
||||||
print*,' We did not find any state with S^2 values close to ',expected_s2
|
|
||||||
print*,' We will then set the first N_states eigenvectors of the H matrix'
|
|
||||||
print*,' as the CI_eigenvectors_dressed'
|
|
||||||
print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space'
|
|
||||||
print*,''
|
|
||||||
do j=1,min(N_states_diag,N_det)
|
|
||||||
do i=1,N_det
|
|
||||||
CI_eigenvectors_dressed(i,j) = eigenvectors(i,j)
|
|
||||||
enddo
|
|
||||||
CI_electronic_energy_dressed(j) = eigenvalues(j)
|
|
||||||
CI_eigenvectors_s2_dressed(j) = s2_eigvalues(j)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
deallocate(index_good_state_array,good_state_array)
|
|
||||||
deallocate(s2_eigvalues)
|
|
||||||
else
|
else
|
||||||
call u_0_S2_u_0(CI_eigenvectors_s2_dressed,eigenvectors,N_det,psi_det,N_int,&
|
call davidson_diag_HS2(psi_det,CI_eigenvectors_dressed, CI_eigenvectors_s2_dressed,&
|
||||||
min(N_det,N_states_diag),size(eigenvectors,1))
|
size(CI_eigenvectors_dressed,1), CI_electronic_energy_dressed,&
|
||||||
! Select the "N_states_diag" states of lowest energy
|
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||||
do j=1,min(N_det,N_states_diag)
|
|
||||||
do i=1,N_det
|
|
||||||
CI_eigenvectors_dressed(i,j) = eigenvectors(i,j)
|
|
||||||
enddo
|
|
||||||
CI_electronic_energy_dressed(j) = eigenvalues(j)
|
|
||||||
enddo
|
|
||||||
endif
|
endif
|
||||||
deallocate(eigenvectors,eigenvalues)
|
|
||||||
endif
|
integer :: N_states_diag_save
|
||||||
|
N_states_diag_save = N_states_diag
|
||||||
|
do while (.not.converged)
|
||||||
|
double precision, allocatable :: CI_electronic_energy_tmp (:)
|
||||||
|
double precision, allocatable :: CI_eigenvectors_tmp (:,:)
|
||||||
|
double precision, allocatable :: CI_s2_tmp (:)
|
||||||
|
|
||||||
|
N_states_diag *= 2
|
||||||
|
TOUCH N_states_diag
|
||||||
|
|
||||||
|
if (do_csf) then
|
||||||
|
|
||||||
|
allocate (CI_electronic_energy_tmp (N_states_diag) )
|
||||||
|
allocate (CI_eigenvectors_tmp (N_det,N_states_diag) )
|
||||||
|
|
||||||
|
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy_dressed(1:N_states_diag_save)
|
||||||
|
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save)
|
||||||
|
|
||||||
|
call davidson_diag_H_csf(psi_det,CI_eigenvectors_tmp, &
|
||||||
|
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
|
||||||
|
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||||
|
|
||||||
|
CI_electronic_energy_dressed(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
|
||||||
|
CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
|
||||||
|
|
||||||
|
deallocate (CI_electronic_energy_tmp)
|
||||||
|
deallocate (CI_eigenvectors_tmp)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
allocate (CI_electronic_energy_tmp (N_states_diag) )
|
||||||
|
allocate (CI_eigenvectors_tmp (N_det,N_states_diag) )
|
||||||
|
allocate (CI_s2_tmp (N_states_diag) )
|
||||||
|
|
||||||
|
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy_dressed(1:N_states_diag_save)
|
||||||
|
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save)
|
||||||
|
CI_s2_tmp(1:N_states_diag_save) = CI_eigenvectors_s2_dressed(1:N_states_diag_save)
|
||||||
|
|
||||||
|
call davidson_diag_HS2(psi_det,CI_eigenvectors_tmp, CI_s2_tmp, &
|
||||||
|
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
|
||||||
|
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||||
|
|
||||||
|
CI_electronic_energy_dressed(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
|
||||||
|
CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
|
||||||
|
CI_eigenvectors_s2_dressed(1:N_states_diag_save) = CI_s2_tmp(1:N_states_diag_save)
|
||||||
|
|
||||||
|
deallocate (CI_electronic_energy_tmp)
|
||||||
|
deallocate (CI_eigenvectors_tmp)
|
||||||
|
deallocate (CI_s2_tmp)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
enddo
|
||||||
|
if (N_states_diag > N_states_diag_save) then
|
||||||
|
N_states_diag = N_states_diag_save
|
||||||
|
TOUCH N_states_diag
|
||||||
|
endif
|
||||||
|
|
||||||
|
else if (diag_algorithm == "Lapack") then
|
||||||
|
|
||||||
|
print *, 'Diagonalization of H using Lapack'
|
||||||
|
allocate (eigenvectors(size(H_matrix_dressed,1),N_det))
|
||||||
|
allocate (eigenvalues(N_det))
|
||||||
|
|
||||||
|
call lapack_diag(eigenvalues,eigenvectors, &
|
||||||
|
H_matrix_dressed,size(H_matrix_dressed,1),N_det)
|
||||||
|
CI_electronic_energy_dressed(:) = 0.d0
|
||||||
|
if (s2_eig) then
|
||||||
|
i_state = 0
|
||||||
|
allocate (s2_eigvalues(N_det))
|
||||||
|
allocate(index_good_state_array(N_det),good_state_array(N_det))
|
||||||
|
good_state_array = .False.
|
||||||
|
|
||||||
|
call u_0_S2_u_0(s2_eigvalues,eigenvectors,N_det,psi_det,N_int,&
|
||||||
|
N_det,size(eigenvectors,1))
|
||||||
|
do j=1,N_det
|
||||||
|
! Select at least n_states states with S^2 values closed to "expected_s2"
|
||||||
|
if(dabs(s2_eigvalues(j)-expected_s2).le.0.5d0)then
|
||||||
|
i_state +=1
|
||||||
|
index_good_state_array(i_state) = j
|
||||||
|
good_state_array(j) = .True.
|
||||||
|
endif
|
||||||
|
if(i_state.eq.N_states) then
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
if(i_state .ne.0)then
|
||||||
|
! Fill the first "i_state" states that have a correct S^2 value
|
||||||
|
do j = 1, i_state
|
||||||
|
do i=1,N_det
|
||||||
|
CI_eigenvectors_dressed(i,j) = eigenvectors(i,index_good_state_array(j))
|
||||||
|
enddo
|
||||||
|
CI_electronic_energy_dressed(j) = eigenvalues(index_good_state_array(j))
|
||||||
|
CI_eigenvectors_s2_dressed(j) = s2_eigvalues(index_good_state_array(j))
|
||||||
|
enddo
|
||||||
|
i_other_state = 0
|
||||||
|
do j = 1, N_det
|
||||||
|
if(good_state_array(j))cycle
|
||||||
|
i_other_state +=1
|
||||||
|
if(i_state+i_other_state.gt.n_states_diag)then
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
do i=1,N_det
|
||||||
|
CI_eigenvectors_dressed(i,i_state+i_other_state) = eigenvectors(i,j)
|
||||||
|
enddo
|
||||||
|
CI_electronic_energy_dressed(i_state+i_other_state) = eigenvalues(j)
|
||||||
|
CI_eigenvectors_s2_dressed(i_state+i_other_state) = s2_eigvalues(i_state+i_other_state)
|
||||||
|
enddo
|
||||||
|
else
|
||||||
|
print*,''
|
||||||
|
print*,'!!!!!!!! WARNING !!!!!!!!!'
|
||||||
|
print*,' Within the ',N_det,'determinants selected'
|
||||||
|
print*,' and the ',N_states_diag,'states requested'
|
||||||
|
print*,' We did not find any state with S^2 values close to ',expected_s2
|
||||||
|
print*,' We will then set the first N_states eigenvectors of the H matrix'
|
||||||
|
print*,' as the CI_eigenvectors_dressed'
|
||||||
|
print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space'
|
||||||
|
print*,''
|
||||||
|
do j=1,min(N_states_diag,N_det)
|
||||||
|
do i=1,N_det
|
||||||
|
CI_eigenvectors_dressed(i,j) = eigenvectors(i,j)
|
||||||
|
enddo
|
||||||
|
CI_electronic_energy_dressed(j) = eigenvalues(j)
|
||||||
|
CI_eigenvectors_s2_dressed(j) = s2_eigvalues(j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
deallocate(index_good_state_array,good_state_array)
|
||||||
|
deallocate(s2_eigvalues)
|
||||||
|
else
|
||||||
|
call u_0_S2_u_0(CI_eigenvectors_s2_dressed,eigenvectors,N_det,psi_det,N_int,&
|
||||||
|
min(N_det,N_states_diag),size(eigenvectors,1))
|
||||||
|
! Select the "N_states_diag" states of lowest energy
|
||||||
|
do j=1,min(N_det,N_states_diag)
|
||||||
|
do i=1,N_det
|
||||||
|
CI_eigenvectors_dressed(i,j) = eigenvectors(i,j)
|
||||||
|
enddo
|
||||||
|
CI_electronic_energy_dressed(j) = eigenvalues(j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
deallocate(eigenvectors,eigenvalues)
|
||||||
|
endif
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ END_PROVIDER
|
|||||||
enddo
|
enddo
|
||||||
!$OMP ENDDO
|
!$OMP ENDDO
|
||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
call i8radix_sort(to_sort, psi_bilinear_matrix_transp_order, N_det,-1)
|
call i8sort(to_sort, psi_bilinear_matrix_transp_order, N_det)
|
||||||
call iset_order(psi_bilinear_matrix_transp_rows,psi_bilinear_matrix_transp_order,N_det)
|
call iset_order(psi_bilinear_matrix_transp_rows,psi_bilinear_matrix_transp_order,N_det)
|
||||||
call iset_order(psi_bilinear_matrix_transp_columns,psi_bilinear_matrix_transp_order,N_det)
|
call iset_order(psi_bilinear_matrix_transp_columns,psi_bilinear_matrix_transp_order,N_det)
|
||||||
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(l)
|
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(l)
|
||||||
|
@ -8,7 +8,7 @@ subroutine set_multiple_levels_omp(activate)
|
|||||||
logical, intent(in) :: activate
|
logical, intent(in) :: activate
|
||||||
|
|
||||||
if (activate) then
|
if (activate) then
|
||||||
call omp_set_max_active_levels(5)
|
call omp_set_max_active_levels(3)
|
||||||
|
|
||||||
IRP_IF SET_NESTED
|
IRP_IF SET_NESTED
|
||||||
call omp_set_nested(.True.)
|
call omp_set_nested(.True.)
|
||||||
|
@ -356,7 +356,8 @@ BEGIN_TEMPLATE
|
|||||||
if ( isize < 32) then
|
if ( isize < 32) then
|
||||||
call insertion_$Xsort(x,iorder,isize)
|
call insertion_$Xsort(x,iorder,isize)
|
||||||
else
|
else
|
||||||
call $Xradix_sort(x,iorder,isize,-1)
|
! call $Xradix_sort(x,iorder,isize,-1)
|
||||||
|
call quick_$Xsort(x,iorder,isize)
|
||||||
endif
|
endif
|
||||||
end subroutine $Xsort
|
end subroutine $Xsort
|
||||||
|
|
||||||
@ -450,7 +451,8 @@ BEGIN_TEMPLATE
|
|||||||
if ( isize < 32) then
|
if ( isize < 32) then
|
||||||
call insertion_$Xsort(x,iorder,isize)
|
call insertion_$Xsort(x,iorder,isize)
|
||||||
else
|
else
|
||||||
call $Xradix_sort(x,iorder,isize,-1)
|
! call $Xradix_sort(x,iorder,isize,-1)
|
||||||
|
call quick_$Xsort(x,iorder,isize)
|
||||||
endif
|
endif
|
||||||
end subroutine $Xsort
|
end subroutine $Xsort
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user