9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-10-30 10:18:07 +01:00

add normalize_dm

This commit is contained in:
Emmanuel Giner 2019-03-27 18:29:08 +01:00
parent 37bed49303
commit d616e9c566
2 changed files with 34 additions and 0 deletions

View File

@ -16,3 +16,10 @@ doc: Type of density
doc: if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero
interface: ezfio, provider, ocaml
default: full_density
[normalize_dm]
type: logical
doc: Type of density
doc: if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb
interface: ezfio, provider, ocaml
default: True

View File

@ -29,6 +29,20 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_s
one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0
enddo
enddo
if(normalize_dm)then
double precision :: elec_alpha_frozen_num, elec_alpha_valence(N_states)
elec_alpha_frozen_num = elec_alpha_num - n_core_orb
elec_alpha_valence = 0.d0
integer :: istate
do istate = 1, N_states
do i = 1, mo_num
elec_alpha_valence(istate) += one_e_dm_mo_alpha_for_dft(i,i,istate)
enddo
elec_alpha_valence(istate) = elec_alpha_frozen_num/elec_alpha_valence(istate)
one_e_dm_mo_alpha_for_dft(:,:,istate) = one_e_dm_mo_alpha_for_dft(:,:,istate) * elec_alpha_valence(istate)
enddo
endif
endif
END_PROVIDER
@ -64,6 +78,19 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_st
one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0
enddo
enddo
if(normalize_dm)then
double precision :: elec_beta_valence(N_states),elec_beta_frozen_num
elec_beta_frozen_num = elec_beta_num - n_core_orb
elec_beta_valence = 0.d0
integer :: istate
do istate = 1, N_states
do i = 1, mo_num
elec_beta_valence(istate) += one_e_dm_mo_beta_for_dft(i,i,istate)
enddo
elec_beta_valence(istate) = elec_beta_frozen_num/elec_beta_valence(istate)
one_e_dm_mo_beta_for_dft(:,:,istate) = one_e_dm_mo_beta_for_dft(:,:,istate) * elec_beta_valence(istate)
enddo
endif
endif
END_PROVIDER