9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-26 21:33:30 +01:00
qp2/src/density_for_dft/density_for_dft.irp.f

223 lines
8.0 KiB
Fortran
Raw Normal View History

2019-01-25 11:39:31 +01:00
BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for alpha electrons in the MO basis used for all DFT calculations based on the density
END_DOC
double precision :: delta_alpha(mo_num,mo_num,N_states)
if(density_for_dft .EQ. "damping_rs_dft")then
delta_alpha = one_e_dm_mo_alpha - data_one_e_dm_alpha_mo
one_e_dm_mo_alpha_for_dft = data_one_e_dm_alpha_mo + damping_for_rs_dft * delta_alpha
else if (density_for_dft .EQ. "input_density")then
one_e_dm_mo_alpha_for_dft = data_one_e_dm_alpha_mo
else if (density_for_dft .EQ. "input_density_ao")then
call ao_to_mo(data_one_e_dm_alpha_mo,size(data_one_e_dm_alpha_mo,1),one_e_dm_mo_alpha_for_dft,size(one_e_dm_mo_alpha_for_dft,1))
2019-01-25 11:39:31 +01:00
else if (density_for_dft .EQ. "WFT")then
provide mo_coef
one_e_dm_mo_alpha_for_dft = one_e_dm_mo_alpha
else if (density_for_dft .EQ. "KS")then
provide mo_coef
one_e_dm_mo_alpha_for_dft = one_body_dm_mo_alpha_one_det
Develop (#15) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * Add print_ci_vector in tools (#11) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Merge develop-toto and manus (#12) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop toto (#13) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop manus (#14) * modified printing for rpt2 * Comment * Fixed plugins * Scripting for functionals * Documentation * Develop (#10) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * some modifs * modified gfortran_debug.cfg * fixed automatization of functionals * modified e_xc_general.irp.f * minor modifs in ref_bitmask.irp.f * modifying functionals * rs_ks_scf and ks_scf compiles with the automatic handling of functionals * removed prints * fixed configure * fixed the new functionals * Merge toto * modified automatic functionals * Changed python into python2 * from_xyz suppressed * Cleaning repo * Update README.md * Update README.md * Contributors * Update GITHUB.md * bibtex
2019-03-07 16:29:06 +01:00
else if (density_for_dft .EQ. "state_average_dens")then
one_e_dm_mo_alpha_for_dft = 0.d0
one_e_dm_mo_alpha_for_dft(:,:,1) = one_e_dm_mo_alpha_average(:,:)
endif
if(no_core_density .EQ. "no_core_dm")then
2019-03-19 17:09:36 +01:00
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
Develop (#15) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * Add print_ci_vector in tools (#11) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Merge develop-toto and manus (#12) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop toto (#13) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop manus (#14) * modified printing for rpt2 * Comment * Fixed plugins * Scripting for functionals * Documentation * Develop (#10) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * some modifs * modified gfortran_debug.cfg * fixed automatization of functionals * modified e_xc_general.irp.f * minor modifs in ref_bitmask.irp.f * modifying functionals * rs_ks_scf and ks_scf compiles with the automatic handling of functionals * removed prints * fixed configure * fixed the new functionals * Merge toto * modified automatic functionals * Changed python into python2 * from_xyz suppressed * Cleaning repo * Update README.md * Update README.md * Contributors * Update GITHUB.md * bibtex
2019-03-07 16:29:06 +01:00
do j = 1, mo_num
one_e_dm_mo_alpha_for_dft(j,i,:) = 0.d0
one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0
enddo
enddo
2019-03-27 18:29:08 +01:00
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
2019-01-25 11:39:31 +01:00
endif
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for beta electrons in the MO basis used for all DFT calculations based on the density
END_DOC
double precision :: delta_beta(mo_num,mo_num,N_states)
if(density_for_dft .EQ. "damping_rs_dft")then
delta_beta = one_e_dm_mo_beta - data_one_e_dm_beta_mo
one_e_dm_mo_beta_for_dft = data_one_e_dm_beta_mo + damping_for_rs_dft * delta_beta
else if (density_for_dft .EQ. "input_density")then
one_e_dm_mo_beta_for_dft = data_one_e_dm_beta_mo
else if (density_for_dft .EQ. "input_density_ao")then
call ao_to_mo(data_one_e_dm_beta_mo,size(data_one_e_dm_beta_mo,1),one_e_dm_mo_beta_for_dft,size(one_e_dm_mo_beta_for_dft,1))
2019-01-25 11:39:31 +01:00
else if (density_for_dft .EQ. "WFT")then
provide mo_coef
one_e_dm_mo_beta_for_dft = one_e_dm_mo_beta
else if (density_for_dft .EQ. "KS")then
provide mo_coef
one_e_dm_mo_beta_for_dft = one_body_dm_mo_beta_one_det
Develop (#15) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * Add print_ci_vector in tools (#11) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Merge develop-toto and manus (#12) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop toto (#13) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop manus (#14) * modified printing for rpt2 * Comment * Fixed plugins * Scripting for functionals * Documentation * Develop (#10) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * some modifs * modified gfortran_debug.cfg * fixed automatization of functionals * modified e_xc_general.irp.f * minor modifs in ref_bitmask.irp.f * modifying functionals * rs_ks_scf and ks_scf compiles with the automatic handling of functionals * removed prints * fixed configure * fixed the new functionals * Merge toto * modified automatic functionals * Changed python into python2 * from_xyz suppressed * Cleaning repo * Update README.md * Update README.md * Contributors * Update GITHUB.md * bibtex
2019-03-07 16:29:06 +01:00
else if (density_for_dft .EQ. "state_average_dens")then
one_e_dm_mo_beta_for_dft = 0.d0
one_e_dm_mo_beta_for_dft(:,:,1) = one_e_dm_mo_beta_average(:,:)
endif
if(no_core_density .EQ. "no_core_dm")then
2019-03-19 17:09:36 +01:00
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
Develop (#15) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * Add print_ci_vector in tools (#11) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Merge develop-toto and manus (#12) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop toto (#13) * Fixed energies of non-expected s2 * Moved diag_algorithm in Davdison * Fixed travis * Added print_ci_vector * Documentation * Cleaned qp_set_mo_class.ml * Removed Core in taskserver * Frozen core for heavy atoms * Improved molden module * In sync with manus * Fixed some of the documentation errors * Develop manus (#14) * modified printing for rpt2 * Comment * Fixed plugins * Scripting for functionals * Documentation * Develop (#10) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * some modifs * modified gfortran_debug.cfg * fixed automatization of functionals * modified e_xc_general.irp.f * minor modifs in ref_bitmask.irp.f * modifying functionals * rs_ks_scf and ks_scf compiles with the automatic handling of functionals * removed prints * fixed configure * fixed the new functionals * Merge toto * modified automatic functionals * Changed python into python2 * from_xyz suppressed * Cleaning repo * Update README.md * Update README.md * Contributors * Update GITHUB.md * bibtex
2019-03-07 16:29:06 +01:00
do j = 1, mo_num
one_e_dm_mo_beta_for_dft(j,i,:) = 0.d0
one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0
enddo
enddo
2019-03-27 18:29:08 +01:00
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
2019-01-25 11:39:31 +01:00
endif
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_mo_for_dft, (mo_num,mo_num, N_states)]
implicit none
one_e_dm_mo_for_dft = one_e_dm_mo_beta_for_dft + one_e_dm_mo_alpha_for_dft
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_average_mo_for_dft, (mo_num,mo_num)]
implicit none
integer :: i
one_e_dm_average_mo_for_dft = 0.d0
do i = 1, N_states
one_e_dm_average_mo_for_dft(:,:) += one_e_dm_mo_for_dft(:,:,i) * state_average_weight(i)
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, one_e_dm_alpha_ao_for_dft, (ao_num,ao_num,N_states) ]
&BEGIN_PROVIDER [ double precision, one_e_dm_beta_ao_for_dft, (ao_num,ao_num,N_states) ]
BEGIN_DOC
! one body density matrix on the AO basis based on one_e_dm_mo_alpha_for_dft
END_DOC
implicit none
integer :: istate
double precision :: mo_alpha,mo_beta
one_e_dm_alpha_ao_for_dft = 0.d0
one_e_dm_beta_ao_for_dft = 0.d0
if (density_for_dft .EQ. "input_density_ao")then
one_e_dm_alpha_ao_for_dft = data_one_e_dm_alpha_ao
one_e_dm_beta_ao_for_dft = data_one_e_dm_beta_ao
else
do istate = 1, N_states
call mo_to_ao_no_overlap( one_e_dm_mo_alpha_for_dft(1,1,istate), &
size(one_e_dm_mo_alpha_for_dft,1), &
one_e_dm_alpha_ao_for_dft(1,1,istate), &
size(one_e_dm_alpha_ao_for_dft,1) )
call mo_to_ao_no_overlap( one_e_dm_mo_beta_for_dft(1,1,istate), &
size(one_e_dm_mo_beta_for_dft,1), &
one_e_dm_beta_ao_for_dft(1,1,istate), &
size(one_e_dm_beta_ao_for_dft,1) )
enddo
endif
2019-01-25 11:39:31 +01:00
END_PROVIDER
BEGIN_PROVIDER [double precision, one_body_dm_mo_alpha_one_det, (mo_num,mo_num, N_states)]
&BEGIN_PROVIDER [double precision, one_body_dm_mo_beta_one_det, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! One body density matrix on the |MO| basis for a single determinant
END_DOC
integer :: i
one_body_dm_mo_alpha_one_det = 0.d0
one_body_dm_mo_beta_one_det = 0.d0
do i =1, elec_alpha_num
one_body_dm_mo_alpha_one_det(i,i, 1:N_states) = 1.d0
enddo
do i =1, elec_beta_num
one_body_dm_mo_beta_one_det(i,i, 1:N_states) = 1.d0
enddo
END_PROVIDER
2019-03-19 17:09:36 +01:00
BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft_no_core, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for alpha electrons in the MO basis without the core orbitals
END_DOC
one_e_dm_mo_alpha_for_dft_no_core = one_e_dm_mo_alpha_for_dft
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_alpha_for_dft_no_core(j,i,:) = 0.d0
one_e_dm_mo_alpha_for_dft_no_core(i,j,:) = 0.d0
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft_no_core, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for beta electrons in the MO basis without the core orbitals
END_DOC
one_e_dm_mo_beta_for_dft_no_core = one_e_dm_mo_beta_for_dft
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_beta_for_dft_no_core(j,i,:) = 0.d0
one_e_dm_mo_beta_for_dft_no_core(i,j,:) = 0.d0
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, one_e_dm_alpha_ao_for_dft_no_core, (ao_num,ao_num,N_states) ]
&BEGIN_PROVIDER [ double precision, one_e_dm_beta_ao_for_dft_no_core, (ao_num,ao_num,N_states) ]
BEGIN_DOC
! one body density matrix on the AO basis based on one_e_dm_mo_alpha_for_dft_no_core
END_DOC
implicit none
integer :: istate
double precision :: mo_alpha,mo_beta
one_e_dm_alpha_ao_for_dft_no_core = 0.d0
one_e_dm_beta_ao_for_dft_no_core = 0.d0
do istate = 1, N_states
call mo_to_ao_no_overlap( one_e_dm_mo_alpha_for_dft_no_core(1,1,istate), &
size(one_e_dm_mo_alpha_for_dft_no_core,1), &
one_e_dm_alpha_ao_for_dft_no_core(1,1,istate), &
size(one_e_dm_alpha_ao_for_dft_no_core,1) )
call mo_to_ao_no_overlap( one_e_dm_mo_beta_for_dft_no_core(1,1,istate), &
size(one_e_dm_mo_beta_for_dft_no_core,1), &
one_e_dm_beta_ao_for_dft_no_core(1,1,istate), &
size(one_e_dm_beta_ao_for_dft_no_core,1) )
enddo
END_PROVIDER