mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 19:43:32 +01:00
Merge pull request #210 from QuantumPackage/cleaning_dft
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Cleaning dft
This commit is contained in:
commit
447807623f
57
src/basis_correction/pbe_ueg_self_contained.irp.f
Normal file
57
src/basis_correction/pbe_ueg_self_contained.irp.f
Normal file
@ -0,0 +1,57 @@
|
||||
double precision function ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
implicit none
|
||||
! dens = total density
|
||||
! spin_pol = spin_polarization (n_a - n_b)/dens
|
||||
! e_PBE = PBE correlation (mu=0) energy evaluated at dens,spin_pol (and grad_rho)
|
||||
! e_PBE = epsilon_PBE * dens which means that it is not the energy density but the energy density X the density
|
||||
double precision, intent(in) :: dens,spin_pol,mu,e_PBE
|
||||
double precision :: rho_a,rho_b,pi,g0_UEG_func,denom,beta
|
||||
pi = dacos(-1.d0)
|
||||
rho_a = (dens * spin_pol + dens)*0.5d0
|
||||
rho_b = (dens - dens * spin_pol)*0.5d0
|
||||
if(mu == 0.d0) then
|
||||
ecmd_pbe_ueg_self_cont = e_PBE
|
||||
else
|
||||
! note: the on-top pair density is (1-zeta^2) rhoc^2 g0 = 4 rhoa * rhob * g0
|
||||
denom = (-2.d0+sqrt(2d0))*sqrt(2.d0*pi) * 4.d0*rho_a*rho_b*g0_UEG_func(rho_a,rho_b)
|
||||
if (dabs(denom) > 1.d-12) then
|
||||
beta = (3.d0*e_PBE)/denom
|
||||
ecmd_pbe_ueg_self_cont=e_PBE/(1.d0+beta*mu**3)
|
||||
else
|
||||
ecmd_pbe_ueg_self_cont=0.d0
|
||||
endif
|
||||
endif
|
||||
end
|
||||
|
||||
double precision function g0_UEG_func(rho_a,rho_b)
|
||||
! Pair distribution function g0(n_alpha,n_beta) of the Colombic UEG
|
||||
!
|
||||
! Taken from Eq. (46) P. Gori-Giorgi and A. Savin, Phys. Rev. A 73, 032506 (2006).
|
||||
implicit none
|
||||
double precision, intent(in) :: rho_a,rho_b
|
||||
double precision :: rho,pi,x
|
||||
double precision :: B, C, D, E, d2, rs, ahd
|
||||
rho = rho_a+rho_b
|
||||
pi = 4d0 * datan(1d0)
|
||||
ahd = -0.36583d0
|
||||
d2 = 0.7524d0
|
||||
B = -2d0 * ahd - d2
|
||||
C = 0.08193d0
|
||||
D = -0.01277d0
|
||||
E = 0.001859d0
|
||||
x = -d2*rs
|
||||
if (dabs(rho) > 1.d-20) then
|
||||
rs = (3d0 / (4d0*pi*rho))**(1d0/3d0)
|
||||
x = -d2*rs
|
||||
if(dabs(x).lt.50.d0)then
|
||||
g0_UEG_func= 0.5d0 * (1d0+ rs* (-B + rs*(C + rs*(D + rs*E))))*dexp(x)
|
||||
else
|
||||
g0_UEG_func= 0.d0
|
||||
endif
|
||||
else
|
||||
g0_UEG_func= 0.d0
|
||||
endif
|
||||
g0_UEG_func = max(g0_UEG_func,1.d-14)
|
||||
|
||||
end
|
||||
|
@ -80,3 +80,64 @@ subroutine print_basis_correction
|
||||
end
|
||||
|
||||
|
||||
|
||||
subroutine print_all_basis_correction
|
||||
implicit none
|
||||
integer :: istate
|
||||
provide mu_average_prov
|
||||
provide ecmd_lda_mu_of_r ecmd_pbe_ueg_mu_of_r
|
||||
provide ecmd_pbe_on_top_mu_of_r ecmd_pbe_on_top_su_mu_of_r
|
||||
|
||||
print*, ''
|
||||
print*, ''
|
||||
print*, '****************************************'
|
||||
print*, '****************************************'
|
||||
print*, 'Basis set correction for WFT using DFT Ecmd functionals'
|
||||
print*, 'These functionals are accurate for short-range correlation'
|
||||
print*, ''
|
||||
print*, 'For more details look at Journal of Chemical Physics 149, 194301 1-15 (2018) '
|
||||
print*, ' Journal of Physical Chemistry Letters 10, 2931-2937 (2019) '
|
||||
print*, ' ???REF SC?'
|
||||
print*, '****************************************'
|
||||
print*, '****************************************'
|
||||
print*, 'mu_of_r_potential = ',mu_of_r_potential
|
||||
print*, ''
|
||||
print*,'Using a CAS-like two-body density to define mu(r)'
|
||||
print*,'This assumes that the CAS is a qualitative representation of the wave function '
|
||||
print*,'********************************************'
|
||||
print*,'Functionals more suited for weak correlation'
|
||||
print*,'********************************************'
|
||||
print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) '
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate)
|
||||
enddo
|
||||
print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
print*,'********************************************'
|
||||
print*,'********************************************'
|
||||
print*,'+) PBE-on-top Ecmd functional : (??????? REF-SCF ??????????)'
|
||||
print*,'PBE at mu=0, extrapolated ontop pair density at large mu, usual spin-polarization'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
print*,'********************************************'
|
||||
print*,'+) PBE-on-top no spin polarization Ecmd functional : (??????? REF-SCF ??????????)'
|
||||
print*,'PBE at mu=0, extrapolated ontop pair density at large mu, and ZERO SPIN POLARIZATION'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
|
||||
print*,''
|
||||
print*,'**************'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) , state ',istate,' = ',mu_average_prov(istate)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -20,9 +20,10 @@ subroutine print_su_pbe_ot
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate)
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ecmd_pbe_ueg_test , state ',istate,' = ',ecmd_pbe_ueg_test(istate)
|
||||
enddo
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
enddo
|
||||
! do istate = 1, N_states
|
||||
! write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
! enddo
|
||||
|
||||
end
|
||||
|
84
src/basis_correction/test_ueg_self_contained.irp.f
Normal file
84
src/basis_correction/test_ueg_self_contained.irp.f
Normal file
@ -0,0 +1,84 @@
|
||||
program test_sc
|
||||
implicit none
|
||||
integer :: m
|
||||
double precision :: r(3),f_hf,on_top,mu,sqpi
|
||||
double precision :: rho_a,rho_b,w_hf,dens,delta_rho,e_pbe
|
||||
double precision :: grad_rho_a(3),grad_rho_b(3),grad_rho_a_2(3),grad_rho_b_2(3),grad_rho_a_b(3)
|
||||
double precision :: sigmacc,sigmaco,sigmaoo,spin_pol
|
||||
double precision :: eps_c_md_PBE , ecmd_pbe_ueg_self_cont
|
||||
r = 0.D0
|
||||
r(3) = 1.D0
|
||||
call f_HF_valence_ab(r,r,f_hf,on_top)
|
||||
sqpi = dsqrt(dacos(-1.d0))
|
||||
if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then
|
||||
w_hf = 1.d+10
|
||||
else
|
||||
w_hf = f_hf / on_top
|
||||
endif
|
||||
mu = sqpi * 0.5d0 * w_hf
|
||||
call density_and_grad_alpha_beta(r,rho_a,rho_b, grad_rho_a, grad_rho_b)
|
||||
dens = rho_a + rho_b
|
||||
delta_rho = rho_a - rho_b
|
||||
spin_pol = delta_rho/(max(1.d-10,dens))
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
|
||||
! call the PBE energy
|
||||
print*,'f_hf,on_top = ',f_hf,on_top
|
||||
print*,'mu = ',mu
|
||||
print*,'dens,spin_pol',dens,spin_pol
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
print*,'e_PBE = ',e_PBE
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
print*,'eps_c_md_PBE = ',eps_c_md_PBE
|
||||
|
||||
print*,''
|
||||
print*,''
|
||||
print*,''
|
||||
print*,'energy_c' ,energy_c
|
||||
|
||||
integer::ipoint
|
||||
double precision :: weight , accu
|
||||
accu = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
call f_HF_valence_ab(r,r,f_hf,on_top)
|
||||
sqpi = dsqrt(dacos(-1.d0))
|
||||
if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then
|
||||
w_hf = 1.d+10
|
||||
else
|
||||
w_hf = f_hf / on_top
|
||||
endif
|
||||
mu = sqpi * 0.5d0 * w_hf
|
||||
call density_and_grad_alpha_beta(r,rho_a,rho_b, grad_rho_a, grad_rho_b)
|
||||
dens = rho_a + rho_b
|
||||
delta_rho = rho_a - rho_b
|
||||
spin_pol = delta_rho/(max(1.d-10,dens))
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
! call the PBE energy
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
write(33,'(100(F16.10,X))')r(:), weight, w_hf, on_top, mu, dens, spin_pol, e_PBE, eps_c_md_PBE
|
||||
accu += weight * eps_c_md_PBE
|
||||
enddo
|
||||
print*,'accu = ',accu
|
||||
write(*, *) ' ECMD PBE-UEG ',ecmd_pbe_ueg_mu_of_r(1)
|
||||
write(*, *) ' ecmd_pbe_ueg_test ',ecmd_pbe_ueg_test(1)
|
||||
|
||||
end
|
@ -81,3 +81,54 @@ BEGIN_PROVIDER [double precision, ecmd_pbe_ueg_mu_of_r, (N_states)]
|
||||
print*,'Time for the ecmd_pbe_ueg_mu_of_r:',wall1-wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, ecmd_pbe_ueg_test, (N_states)]
|
||||
BEGIN_DOC
|
||||
! test of the routines contained in pbe_ueg_self_contained.irp.f
|
||||
END_DOC
|
||||
implicit none
|
||||
double precision :: weight
|
||||
integer :: ipoint,istate,m
|
||||
double precision :: mu,rho_a,rho_b
|
||||
double precision :: dens,spin_pol,grad_rho,e_PBE,delta_rho
|
||||
double precision :: ecmd_pbe_ueg_self_cont,eps_c_md_PBE
|
||||
ecmd_pbe_ueg_test = 0.d0
|
||||
|
||||
do istate = 1, N_states
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight=final_weight_at_r_vector(ipoint)
|
||||
|
||||
! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018)
|
||||
mu = mu_of_r_prov(ipoint,istate)
|
||||
|
||||
! conversion from rho_a,rho_b --> dens,spin_pol
|
||||
rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate)
|
||||
rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate)
|
||||
dens = rho_a + rho_b
|
||||
spin_pol = (rho_a - rho_b)/(max(dens,1.d-12))
|
||||
delta_rho = rho_a - rho_b
|
||||
|
||||
! conversion from grad_rho_a ... to sigma
|
||||
double precision :: grad_rho_a(3),grad_rho_b(3),grad_rho_a_2(3),grad_rho_b_2(3),grad_rho_a_b(3)
|
||||
double precision :: sigmacc,sigmaco,sigmaoo
|
||||
grad_rho_b(1:3) = one_e_dm_and_grad_beta_in_r(1:3,ipoint,istate)
|
||||
grad_rho_a(1:3) = one_e_dm_and_grad_alpha_in_r(1:3,ipoint,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
|
||||
! call the PBE energy
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
|
||||
ecmd_pbe_ueg_test(istate) += eps_c_md_PBE * weight
|
||||
enddo
|
||||
enddo
|
||||
!
|
||||
END_PROVIDER
|
||||
|
@ -64,7 +64,8 @@ END_PROVIDER
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_angular,n_points_radial_grid,nucl_num)]
|
||||
BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_angular,n_points_radial_grid,nucl_num)]
|
||||
&BEGIN_PROVIDER [double precision, radial_points_per_atom, (n_points_radial_grid,nucl_num)]
|
||||
BEGIN_DOC
|
||||
! x,y,z coordinates of grid points used for integration in 3d space
|
||||
END_DOC
|
||||
@ -72,6 +73,7 @@ BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_
|
||||
integer :: i,j,k
|
||||
double precision :: dr,x_ref,y_ref,z_ref
|
||||
double precision :: knowles_function
|
||||
radial_points_per_atom = 0.D0
|
||||
do i = 1, nucl_num
|
||||
x_ref = nucl_coord(i,1)
|
||||
y_ref = nucl_coord(i,2)
|
||||
@ -83,7 +85,7 @@ BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_
|
||||
|
||||
! value of the radial coordinate for the integration
|
||||
r = knowles_function(alpha_knowles(grid_atomic_number(i)),m_knowles,x)
|
||||
|
||||
radial_points_per_atom(j,i) = r
|
||||
! explicit values of the grid points centered around each atom
|
||||
do k = 1, n_points_integration_angular
|
||||
grid_points_per_atom(1,k,j,i) = &
|
||||
|
618
src/dav_general_mat/dav_ext_rout_nonsym_B1space.irp.f
Normal file
618
src/dav_general_mat/dav_ext_rout_nonsym_B1space.irp.f
Normal file
@ -0,0 +1,618 @@
|
||||
|
||||
! ---
|
||||
|
||||
subroutine davidson_general_ext_rout_nonsym_b1space(u_in, H_jj, energies, sze, N_st, N_st_diag_in, converged, hcalc)
|
||||
|
||||
use mmap_module
|
||||
|
||||
BEGIN_DOC
|
||||
! Generic modified-Davidson diagonalization
|
||||
!
|
||||
! H_jj : specific diagonal H matrix elements to diagonalize de Davidson
|
||||
!
|
||||
! u_in : guess coefficients on the various states. Overwritten on exit by right eigenvectors
|
||||
!
|
||||
! sze : Number of determinants
|
||||
!
|
||||
! N_st : Number of eigenstates
|
||||
!
|
||||
! N_st_diag_in : Number of states in which H is diagonalized. Assumed > N_st
|
||||
!
|
||||
! Initial guess vectors are not necessarily orthonormal
|
||||
!
|
||||
! hcalc subroutine to compute W = H U (see routine hcalc_template for template of input/output)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: sze, N_st, N_st_diag_in
|
||||
double precision, intent(in) :: H_jj(sze)
|
||||
logical, intent(inout) :: converged
|
||||
double precision, intent(inout) :: u_in(sze,N_st_diag_in)
|
||||
double precision, intent(out) :: energies(N_st)
|
||||
external hcalc
|
||||
|
||||
character*(16384) :: write_buffer
|
||||
integer :: iter, N_st_diag
|
||||
integer :: i, j, k, m
|
||||
integer :: iter2, itertot
|
||||
logical :: disk_based
|
||||
integer :: shift, shift2, itermax
|
||||
integer :: nproc_target
|
||||
integer :: order(N_st_diag_in)
|
||||
double precision :: to_print(2,N_st)
|
||||
double precision :: r1, r2, alpha
|
||||
double precision :: cpu, wall
|
||||
double precision :: cmax
|
||||
double precision :: energy_shift(N_st_diag_in*davidson_sze_max)
|
||||
double precision, allocatable :: U(:,:)
|
||||
double precision, allocatable :: y(:,:), h(:,:), lambda(:)
|
||||
double precision, allocatable :: residual_norm(:)
|
||||
|
||||
integer :: i_omax
|
||||
double precision :: lambda_tmp
|
||||
double precision, allocatable :: U_tmp(:), overlap(:)
|
||||
|
||||
double precision, allocatable :: W(:,:)
|
||||
!double precision, pointer :: W(:,:)
|
||||
double precision, external :: u_dot_v, u_dot_u
|
||||
|
||||
|
||||
include 'constants.include.F'
|
||||
|
||||
N_st_diag = N_st_diag_in
|
||||
! print*,'trial vector'
|
||||
do i = 1, sze
|
||||
if(isnan(u_in(i,1)))then
|
||||
print*,'pb in input vector of davidson_general_ext_rout_nonsym_b1space'
|
||||
print*,i,u_in(i,1)
|
||||
stop
|
||||
else if (dabs(u_in(i,1)).lt.1.d-16)then
|
||||
u_in(i,1) = 0.d0
|
||||
endif
|
||||
enddo
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: U, W, y, h, lambda
|
||||
if(N_st_diag*3 > sze) then
|
||||
print *, 'error in Davidson :'
|
||||
print *, 'Increase n_det_max_full to ', N_st_diag*3
|
||||
stop -1
|
||||
endif
|
||||
|
||||
itermax = max(2, min(davidson_sze_max, sze/N_st_diag)) + 1
|
||||
|
||||
provide threshold_nonsym_davidson
|
||||
call write_time(6)
|
||||
write(6,'(A)') ''
|
||||
write(6,'(A)') 'Davidson Diagonalization'
|
||||
write(6,'(A)') '------------------------'
|
||||
write(6,'(A)') ''
|
||||
|
||||
|
||||
! Find max number of cores to fit in memory
|
||||
! -----------------------------------------
|
||||
|
||||
nproc_target = nproc
|
||||
double precision :: rss
|
||||
integer :: maxab
|
||||
maxab = sze
|
||||
|
||||
m=1
|
||||
disk_based = .False.
|
||||
call resident_memory(rss)
|
||||
do
|
||||
r1 = 8.d0 * &! bytes
|
||||
( dble(sze)*(N_st_diag*itermax) &! U
|
||||
+ 1.d0*dble(sze*m)*(N_st_diag*itermax) &! W
|
||||
+ 2.d0*(N_st_diag*itermax)**2 &! h,y
|
||||
+ 2.d0*(N_st_diag*itermax) &! s2,lambda
|
||||
+ 1.d0*(N_st_diag) &! residual_norm
|
||||
! In H_S2_u_0_nstates_zmq
|
||||
+ 3.d0*(N_st_diag*N_det) &! u_t, v_t, s_t on collector
|
||||
+ 3.d0*(N_st_diag*N_det) &! u_t, v_t, s_t on slave
|
||||
+ 0.5d0*maxab &! idx0 in H_S2_u_0_nstates_openmp_work_*
|
||||
+ nproc_target * &! In OMP section
|
||||
( 1.d0*(N_int*maxab) &! buffer
|
||||
+ 3.5d0*(maxab) ) &! singles_a, singles_b, doubles, idx
|
||||
) / 1024.d0**3
|
||||
|
||||
if(nproc_target == 0) then
|
||||
call check_mem(r1, irp_here)
|
||||
nproc_target = 1
|
||||
exit
|
||||
endif
|
||||
|
||||
if(r1+rss < qp_max_mem) then
|
||||
exit
|
||||
endif
|
||||
|
||||
if(itermax > 4) then
|
||||
itermax = itermax - 1
|
||||
else if (m==1.and.disk_based_davidson) then
|
||||
m = 0
|
||||
disk_based = .True.
|
||||
itermax = 6
|
||||
else
|
||||
nproc_target = nproc_target - 1
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
nthreads_davidson = nproc_target
|
||||
TOUCH nthreads_davidson
|
||||
|
||||
call write_int(6, N_st, 'Number of states')
|
||||
call write_int(6, N_st_diag, 'Number of states in diagonalization')
|
||||
call write_int(6, sze, 'Number of basis functions')
|
||||
call write_int(6, nproc_target, 'Number of threads for diagonalization')
|
||||
call write_double(6, r1, 'Memory(Gb)')
|
||||
if(disk_based) then
|
||||
print *, 'Using swap space to reduce RAM'
|
||||
endif
|
||||
|
||||
!---------------
|
||||
|
||||
write(6,'(A)') ''
|
||||
write_buffer = '====='
|
||||
do i=1,N_st
|
||||
write_buffer = trim(write_buffer)//' ================ ==========='
|
||||
enddo
|
||||
write(6,'(A)') write_buffer(1:6+41*N_st)
|
||||
write_buffer = 'Iter'
|
||||
do i=1,N_st
|
||||
write_buffer = trim(write_buffer)//' Energy Residual '
|
||||
enddo
|
||||
write(6,'(A)') write_buffer(1:6+41*N_st)
|
||||
write_buffer = '====='
|
||||
do i=1,N_st
|
||||
write_buffer = trim(write_buffer)//' ================ ==========='
|
||||
enddo
|
||||
write(6,'(A)') write_buffer(1:6+41*N_st)
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
allocate( W(sze,N_st_diag*itermax) )
|
||||
|
||||
allocate( &
|
||||
! Large
|
||||
U(sze,N_st_diag*itermax), &
|
||||
! Small
|
||||
h(N_st_diag*itermax,N_st_diag*itermax), &
|
||||
y(N_st_diag*itermax,N_st_diag*itermax), &
|
||||
lambda(N_st_diag*itermax), &
|
||||
residual_norm(N_st_diag) &
|
||||
)
|
||||
|
||||
U = 0.d0
|
||||
h = 0.d0
|
||||
y = 0.d0
|
||||
lambda = 0.d0
|
||||
residual_norm = 0.d0
|
||||
|
||||
|
||||
ASSERT (N_st > 0)
|
||||
ASSERT (N_st_diag >= N_st)
|
||||
ASSERT (sze > 0)
|
||||
|
||||
! Davidson iterations
|
||||
! ===================
|
||||
|
||||
converged = .False.
|
||||
|
||||
! Initialize from N_st to N_st_diag with gaussian random numbers
|
||||
! to be sure to have overlap with any eigenvectors
|
||||
do k = N_st+1, N_st_diag
|
||||
u_in(k,k) = 10.d0
|
||||
do i = 1, sze
|
||||
call random_number(r1)
|
||||
call random_number(r2)
|
||||
r1 = dsqrt(-2.d0*dlog(r1))
|
||||
r2 = dtwo_pi*r2
|
||||
u_in(i,k) = r1*dcos(r2)
|
||||
enddo
|
||||
enddo
|
||||
! Normalize all states
|
||||
do k = 1, N_st_diag
|
||||
call normalize(u_in(1,k), sze)
|
||||
enddo
|
||||
|
||||
! Copy from the guess input "u_in" to the working vectors "U"
|
||||
do k = 1, N_st_diag
|
||||
do i = 1, sze
|
||||
U(i,k) = u_in(i,k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
itertot = 0
|
||||
|
||||
do while (.not.converged)
|
||||
|
||||
itertot = itertot + 1
|
||||
if(itertot == 8) then
|
||||
exit
|
||||
endif
|
||||
|
||||
do iter = 1, itermax-1
|
||||
|
||||
shift = N_st_diag * (iter-1)
|
||||
shift2 = N_st_diag * iter
|
||||
|
||||
if( (iter > 1) .or. (itertot == 1) ) then
|
||||
|
||||
! Gram-Schmidt to orthogonalize all new guess with the previous vectors
|
||||
call ortho_qr(U, size(U, 1), sze, shift2)
|
||||
call ortho_qr(U, size(U, 1), sze, shift2)
|
||||
|
||||
! W = H U
|
||||
call hcalc(W(1,shift+1), U(1,shift+1), N_st_diag, sze)
|
||||
|
||||
else
|
||||
|
||||
! Already computed in update below
|
||||
continue
|
||||
endif
|
||||
|
||||
! Compute h_kl = <u_k | W_l> = <u_k| H |u_l>
|
||||
! -------------------------------------------
|
||||
call dgemm( 'T', 'N', shift2, shift2, sze, 1.d0 &
|
||||
, U, size(U, 1), W, size(W, 1) &
|
||||
, 0.d0, h, size(h, 1) )
|
||||
|
||||
|
||||
! Diagonalize h y = lambda y
|
||||
! ---------------------------
|
||||
call diag_nonsym_right(shift2, h(1,1), size(h, 1), y(1,1), size(y, 1), lambda(1), size(lambda, 1))
|
||||
|
||||
|
||||
! Express eigenvectors of h in the determinant basis:
|
||||
! ---------------------------------------------------
|
||||
|
||||
! y(:,k) = rk
|
||||
! U(:,k) = Bk
|
||||
! U(:,shift2+k) = Rk = Bk x rk
|
||||
call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 &
|
||||
, U, size(U, 1), y, size(y, 1) &
|
||||
, 0.d0, U(1,shift2+1), size(U, 1) )
|
||||
|
||||
do k = 1, N_st_diag
|
||||
call normalize(U(1,shift2+k), sze)
|
||||
enddo
|
||||
|
||||
! ---
|
||||
! select the max overlap
|
||||
|
||||
!
|
||||
! start test ------------------------------------------------------------------------
|
||||
!
|
||||
!double precision, allocatable :: Utest(:,:), Otest(:)
|
||||
!allocate( Utest(sze,shift2), Otest(shift2) )
|
||||
|
||||
!call dgemm( 'N', 'N', sze, shift2, shift2, 1.d0 &
|
||||
! , U, size(U, 1), y, size(y, 1), 0.d0, Utest(1,1), size(Utest, 1) )
|
||||
!do k = 1, shift2
|
||||
! call normalize(Utest(1,k), sze)
|
||||
!enddo
|
||||
!do j = 1, sze
|
||||
! write(455, '(100(1X, F16.10))') (Utest(j,k), k=1,shift2)
|
||||
!enddo
|
||||
|
||||
!do k = 1, shift2
|
||||
! Otest(k) = 0.d0
|
||||
! do i = 1, sze
|
||||
! Otest(k) += Utest(i,k) * u_in(i,1)
|
||||
! enddo
|
||||
! Otest(k) = dabs(Otest(k))
|
||||
! print *, ' Otest =', k, Otest(k), lambda(k)
|
||||
!enddo
|
||||
|
||||
!deallocate(Utest, Otest)
|
||||
!
|
||||
! end test ------------------------------------------------------------------------
|
||||
!
|
||||
|
||||
|
||||
allocate( overlap(N_st_diag) )
|
||||
|
||||
do k = 1, N_st_diag
|
||||
overlap(k) = 0.d0
|
||||
do i = 1, sze
|
||||
overlap(k) = overlap(k) + U(i,shift2+k) * u_in(i,1)
|
||||
enddo
|
||||
overlap(k) = dabs(overlap(k))
|
||||
!print *, ' overlap =', k, overlap(k)
|
||||
enddo
|
||||
|
||||
lambda_tmp = 0.d0
|
||||
do k = 1, N_st_diag
|
||||
if(overlap(k) .gt. lambda_tmp) then
|
||||
i_omax = k
|
||||
lambda_tmp = overlap(k)
|
||||
endif
|
||||
enddo
|
||||
deallocate(overlap)
|
||||
if( lambda_tmp .lt. 0.5d0) then
|
||||
print *, ' very small overlap..'
|
||||
print*, ' max overlap = ', lambda_tmp, i_omax
|
||||
stop
|
||||
endif
|
||||
|
||||
! lambda_tmp = lambda(1)
|
||||
! lambda(1) = lambda(i_omax)
|
||||
! lambda(i_omax) = lambda_tmp
|
||||
!
|
||||
! allocate( U_tmp(sze) )
|
||||
! do i = 1, sze
|
||||
! U_tmp(i) = U(i,shift2+1)
|
||||
! U(i,shift2+1) = U(i,shift2+i_omax)
|
||||
! U(i,shift2+i_omax) = U_tmp(i)
|
||||
! enddo
|
||||
! deallocate(U_tmp)
|
||||
!
|
||||
! allocate( U_tmp(N_st_diag*itermax) )
|
||||
! do i = 1, shift2
|
||||
! U_tmp(i) = y(i,1)
|
||||
! y(i,1) = y(i,i_omax)
|
||||
! y(i,i_omax) = U_tmp(i)
|
||||
! enddo
|
||||
! deallocate(U_tmp)
|
||||
|
||||
! ---
|
||||
|
||||
!do k = 1, N_st_diag
|
||||
! call normalize(U(1,shift2+k), sze)
|
||||
!enddo
|
||||
|
||||
! ---
|
||||
|
||||
! y(:,k) = rk
|
||||
! W(:,k) = H x Bk
|
||||
! W(:,shift2+k) = H x Bk x rk
|
||||
! = Wk
|
||||
call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 &
|
||||
, W, size(W, 1), y, size(y, 1) &
|
||||
, 0.d0, W(1,shift2+1), size(W, 1) )
|
||||
|
||||
! ---
|
||||
|
||||
! Compute residual vector and davidson step
|
||||
! -----------------------------------------
|
||||
|
||||
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k)
|
||||
do k = 1, N_st_diag
|
||||
do i = 1, sze
|
||||
U(i,shift2+k) = (lambda(k) * U(i,shift2+k) - W(i,shift2+k)) / max(H_jj(i)-lambda(k), 1.d-2)
|
||||
enddo
|
||||
!if(k <= N_st) then
|
||||
! residual_norm(k) = u_dot_u(U(1,shift2+k), sze)
|
||||
! to_print(1,k) = lambda(k)
|
||||
! to_print(2,k) = residual_norm(k)
|
||||
!endif
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
residual_norm(1) = u_dot_u(U(1,shift2+i_omax), sze)
|
||||
to_print(1,1) = lambda(i_omax)
|
||||
to_print(2,1) = residual_norm(1)
|
||||
|
||||
|
||||
if( (itertot > 1) .and. (iter == 1) ) then
|
||||
!don't print
|
||||
continue
|
||||
else
|
||||
write(*, '(1X, I3, 1X, 100(1X, F16.10, 1X, F16.10, 1X, F16.10))') iter-1, to_print(1:2,1:N_st)
|
||||
endif
|
||||
|
||||
! Check convergence
|
||||
if(iter > 1) then
|
||||
converged = dabs(maxval(residual_norm(1:N_st))) < threshold_nonsym_davidson
|
||||
endif
|
||||
|
||||
do k = 1, N_st
|
||||
if(residual_norm(k) > 1.e8) then
|
||||
print *, 'Davidson failed'
|
||||
stop -1
|
||||
endif
|
||||
enddo
|
||||
if(converged) then
|
||||
exit
|
||||
endif
|
||||
|
||||
logical, external :: qp_stop
|
||||
if(qp_stop()) then
|
||||
converged = .True.
|
||||
exit
|
||||
endif
|
||||
|
||||
enddo ! loop over iter
|
||||
|
||||
|
||||
! Re-contract U and update W
|
||||
! --------------------------------
|
||||
|
||||
call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 &
|
||||
, W, size(W, 1), y, size(y, 1) &
|
||||
, 0.d0, u_in, size(u_in, 1) )
|
||||
do k = 1, N_st_diag
|
||||
do i = 1, sze
|
||||
W(i,k) = u_in(i,k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 &
|
||||
, U, size(U, 1), y, size(y, 1) &
|
||||
, 0.d0, u_in, size(u_in, 1) )
|
||||
do k = 1, N_st_diag
|
||||
do i = 1, sze
|
||||
U(i,k) = u_in(i,k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call ortho_qr(U, size(U, 1), sze, N_st_diag)
|
||||
call ortho_qr(U, size(U, 1), sze, N_st_diag)
|
||||
do j = 1, N_st_diag
|
||||
k = 1
|
||||
do while( (k < sze) .and. (U(k,j) == 0.d0) )
|
||||
k = k+1
|
||||
enddo
|
||||
if(U(k,j) * u_in(k,j) < 0.d0) then
|
||||
do i = 1, sze
|
||||
W(i,j) = -W(i,j)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
|
||||
enddo ! loop over while
|
||||
|
||||
! ---
|
||||
|
||||
do k = 1, N_st
|
||||
energies(k) = lambda(k)
|
||||
enddo
|
||||
write_buffer = '====='
|
||||
do i = 1, N_st
|
||||
write_buffer = trim(write_buffer)//' ================ ==========='
|
||||
enddo
|
||||
write(6,'(A)') trim(write_buffer)
|
||||
write(6,'(A)') ''
|
||||
call write_time(6)
|
||||
|
||||
deallocate(W)
|
||||
deallocate(U, h, y, lambda, residual_norm)
|
||||
|
||||
FREE nthreads_davidson
|
||||
|
||||
end subroutine davidson_general_ext_rout_nonsym_b1space
|
||||
|
||||
! ---
|
||||
|
||||
subroutine diag_nonsym_right(n, A, A_ldim, V, V_ldim, energy, E_ldim)
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: n, A_ldim, V_ldim, E_ldim
|
||||
double precision, intent(in) :: A(A_ldim,n)
|
||||
double precision, intent(out) :: energy(E_ldim), V(V_ldim,n)
|
||||
|
||||
character*1 :: JOBVL, JOBVR, BALANC, SENSE
|
||||
integer :: i, j
|
||||
integer :: ILO, IHI, lda, ldvl, ldvr, LWORK, INFO
|
||||
double precision :: ABNRM
|
||||
integer, allocatable :: iorder(:), IWORK(:)
|
||||
double precision, allocatable :: WORK(:), SCALE_array(:), RCONDE(:), RCONDV(:)
|
||||
double precision, allocatable :: Atmp(:,:), WR(:), WI(:), VL(:,:), VR(:,:), Vtmp(:)
|
||||
double precision, allocatable :: energy_loc(:), V_loc(:,:)
|
||||
|
||||
allocate( Atmp(n,n), WR(n), WI(n), VL(1,1), VR(n,n) )
|
||||
do i = 1, n
|
||||
do j = 1, n
|
||||
Atmp(j,i) = A(j,i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
JOBVL = "N" ! computes the left eigenvectors
|
||||
JOBVR = "V" ! computes the right eigenvectors
|
||||
BALANC = "B" ! Diagonal scaling and Permutation for optimization
|
||||
SENSE = "V" ! Determines which reciprocal condition numbers are computed
|
||||
lda = n
|
||||
ldvr = n
|
||||
ldvl = 1
|
||||
|
||||
allocate( WORK(1), SCALE_array(n), RCONDE(n), RCONDV(n), IWORK(2*n-2) )
|
||||
|
||||
LWORK = -1 ! to ask for the optimal size of WORK
|
||||
call dgeevx( BALANC, JOBVL, JOBVR, SENSE & ! CHARACTERS
|
||||
, n, Atmp, lda & ! MATRIX TO DIAGONALIZE
|
||||
, WR, WI & ! REAL AND IMAGINARY PART OF EIGENVALUES
|
||||
, VL, ldvl, VR, ldvr & ! LEFT AND RIGHT EIGENVECTORS
|
||||
, ILO, IHI, SCALE_array, ABNRM, RCONDE, RCONDV & ! OUTPUTS OF OPTIMIZATION
|
||||
, WORK, LWORK, IWORK, INFO )
|
||||
|
||||
if(INFO .ne. 0) then
|
||||
print*, 'first dgeevx failed !!', INFO
|
||||
stop
|
||||
endif
|
||||
|
||||
LWORK = max(int(work(1)), 1) ! this is the optimal size of WORK
|
||||
deallocate(WORK)
|
||||
allocate(WORK(LWORK))
|
||||
call dgeevx( BALANC, JOBVL, JOBVR, SENSE &
|
||||
, n, Atmp, lda &
|
||||
, WR, WI &
|
||||
, VL, ldvl, VR, ldvr &
|
||||
, ILO, IHI, SCALE_array, ABNRM, RCONDE, RCONDV &
|
||||
, WORK, LWORK, IWORK, INFO )
|
||||
if(INFO .ne. 0) then
|
||||
print*, 'second dgeevx failed !!', INFO
|
||||
stop
|
||||
endif
|
||||
|
||||
deallocate( WORK, SCALE_array, RCONDE, RCONDV, IWORK )
|
||||
deallocate( VL, Atmp )
|
||||
|
||||
|
||||
allocate( energy_loc(n), V_loc(n,n) )
|
||||
energy_loc = 0.d0
|
||||
V_loc = 0.d0
|
||||
|
||||
i = 1
|
||||
do while(i .le. n)
|
||||
|
||||
! print*, i, WR(i), WI(i)
|
||||
|
||||
if( dabs(WI(i)) .gt. 1e-7 ) then
|
||||
|
||||
print*, ' Found an imaginary component to eigenvalue'
|
||||
print*, ' Re(i) + Im(i)', i, WR(i), WI(i)
|
||||
|
||||
energy_loc(i) = WR(i)
|
||||
do j = 1, n
|
||||
V_loc(j,i) = WR(i) * VR(j,i) - WI(i) * VR(j,i+1)
|
||||
enddo
|
||||
energy_loc(i+1) = WI(i)
|
||||
do j = 1, n
|
||||
V_loc(j,i+1) = WR(i) * VR(j,i+1) + WI(i) * VR(j,i)
|
||||
enddo
|
||||
i = i + 2
|
||||
|
||||
else
|
||||
|
||||
energy_loc(i) = WR(i)
|
||||
do j = 1, n
|
||||
V_loc(j,i) = VR(j,i)
|
||||
enddo
|
||||
i = i + 1
|
||||
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
deallocate(WR, WI, VR)
|
||||
|
||||
|
||||
! ordering
|
||||
! do j = 1, n
|
||||
! write(444, '(100(1X, F16.10))') (V_loc(j,i), i=1,5)
|
||||
! enddo
|
||||
allocate( iorder(n) )
|
||||
do i = 1, n
|
||||
iorder(i) = i
|
||||
enddo
|
||||
call dsort(energy_loc, iorder, n)
|
||||
do i = 1, n
|
||||
energy(i) = energy_loc(i)
|
||||
do j = 1, n
|
||||
V(j,i) = V_loc(j,iorder(i))
|
||||
enddo
|
||||
enddo
|
||||
deallocate(iorder)
|
||||
! do j = 1, n
|
||||
! write(445, '(100(1X, F16.10))') (V_loc(j,i), i=1,5)
|
||||
! enddo
|
||||
deallocate(V_loc, energy_loc)
|
||||
|
||||
end subroutine diag_nonsym_right
|
||||
|
||||
! ---
|
||||
|
@ -63,3 +63,10 @@ type: logical
|
||||
doc: If |true|, don't use denominator
|
||||
default: False
|
||||
interface: ezfio,provider,ocaml
|
||||
|
||||
[threshold_nonsym_davidson]
|
||||
type: Threshold
|
||||
doc: Thresholds of non-symetric Davidson's algorithm
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-12
|
||||
|
||||
|
@ -590,6 +590,71 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
|
||||
end
|
||||
|
||||
|
||||
subroutine save_wavefunction_general_unormalized(ndet,nstates,psidet,dim_psicoef,psicoef)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Save the wave function into the |EZFIO| file
|
||||
END_DOC
|
||||
use bitmasks
|
||||
include 'constants.include.F'
|
||||
integer, intent(in) :: ndet,nstates,dim_psicoef
|
||||
integer(bit_kind), intent(in) :: psidet(N_int,2,ndet)
|
||||
double precision, intent(in) :: psicoef(dim_psicoef,nstates)
|
||||
integer*8, allocatable :: psi_det_save(:,:,:)
|
||||
double precision, allocatable :: psi_coef_save(:,:)
|
||||
|
||||
double precision :: accu_norm
|
||||
integer :: i,j,k, ndet_qp_edit
|
||||
|
||||
if (mpi_master) then
|
||||
ndet_qp_edit = min(ndet,N_det_qp_edit)
|
||||
|
||||
call ezfio_set_determinants_N_int(N_int)
|
||||
call ezfio_set_determinants_bit_kind(bit_kind)
|
||||
call ezfio_set_determinants_N_det(ndet)
|
||||
call ezfio_set_determinants_N_det_qp_edit(ndet_qp_edit)
|
||||
call ezfio_set_determinants_n_states(nstates)
|
||||
call ezfio_set_determinants_mo_label(mo_label)
|
||||
|
||||
allocate (psi_det_save(N_int,2,ndet))
|
||||
do i=1,ndet
|
||||
do j=1,2
|
||||
do k=1,N_int
|
||||
psi_det_save(k,j,i) = transfer(psidet(k,j,i),1_8)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call ezfio_set_determinants_psi_det(psi_det_save)
|
||||
call ezfio_set_determinants_psi_det_qp_edit(psi_det_save)
|
||||
deallocate (psi_det_save)
|
||||
|
||||
allocate (psi_coef_save(ndet,nstates))
|
||||
do k=1,nstates
|
||||
do i=1,ndet
|
||||
psi_coef_save(i,k) = psicoef(i,k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call ezfio_set_determinants_psi_coef(psi_coef_save)
|
||||
deallocate (psi_coef_save)
|
||||
|
||||
allocate (psi_coef_save(ndet_qp_edit,nstates))
|
||||
do k=1,nstates
|
||||
do i=1,ndet_qp_edit
|
||||
psi_coef_save(i,k) = psicoef(i,k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call ezfio_set_determinants_psi_coef_qp_edit(psi_coef_save)
|
||||
deallocate (psi_coef_save)
|
||||
|
||||
call write_int(6,ndet,'Saved determinants')
|
||||
endif
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine save_wavefunction_specified(ndet,nstates,psidet,psicoef,ndetsave,index_det_save)
|
||||
implicit none
|
||||
|
@ -57,4 +57,4 @@ subroutine ec_md_pbe_on_top_general(mu,rho_a,rho_b,grad_rho_a,grad_rho_b,on_top,
|
||||
endif
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
@ -3,11 +3,13 @@ BEGIN_PROVIDER [double precision, SCF_density_matrix_ao_alpha, (ao_num,ao_num) ]
|
||||
BEGIN_DOC
|
||||
! $C.C^t$ over $\alpha$ MOs
|
||||
END_DOC
|
||||
|
||||
call dgemm('N','T',ao_num,ao_num,elec_alpha_num,1.d0, &
|
||||
mo_coef, size(mo_coef,1), &
|
||||
mo_coef, size(mo_coef,1), 0.d0, &
|
||||
SCF_density_matrix_ao_alpha, size(SCF_density_matrix_ao_alpha,1))
|
||||
SCF_density_matrix_ao_alpha = 0.d0
|
||||
if(elec_alpha_num.gt.0)then
|
||||
call dgemm('N','T',ao_num,ao_num,elec_alpha_num,1.d0, &
|
||||
mo_coef, size(mo_coef,1), &
|
||||
mo_coef, size(mo_coef,1), 0.d0, &
|
||||
SCF_density_matrix_ao_alpha, size(SCF_density_matrix_ao_alpha,1))
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
@ -16,11 +18,13 @@ BEGIN_PROVIDER [ double precision, SCF_density_matrix_ao_beta, (ao_num,ao_num)
|
||||
BEGIN_DOC
|
||||
! $C.C^t$ over $\beta$ MOs
|
||||
END_DOC
|
||||
|
||||
SCF_density_matrix_ao_beta = 0.d0
|
||||
if(elec_beta_num.gt.0)then
|
||||
call dgemm('N','T',ao_num,ao_num,elec_beta_num,1.d0, &
|
||||
mo_coef, size(mo_coef,1), &
|
||||
mo_coef, size(mo_coef,1), 0.d0, &
|
||||
SCF_density_matrix_ao_beta, size(SCF_density_matrix_ao_beta,1))
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user