9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-30 15:15:38 +01:00

added some stuffs for foboscf

This commit is contained in:
Emmanuel Giner 2021-04-08 20:37:17 +02:00
parent 1935cc845e
commit 4a6f7a3a92
6 changed files with 118 additions and 11 deletions

View File

@ -143,10 +143,10 @@ subroutine print_generators_bitmasks_holes
key_tmp(j,1) = generators_bitmask(j,1,i) key_tmp(j,1) = generators_bitmask(j,1,i)
key_tmp(j,2) = generators_bitmask(j,2,i) key_tmp(j,2) = generators_bitmask(j,2,i)
enddo enddo
print*,'' ! print*,''
print*,'index hole = ',i ! print*,'index hole = ',i
call print_det(key_tmp,N_int) ! call print_det(key_tmp,N_int)
print*,'' ! print*,''
enddo enddo
deallocate(key_tmp) deallocate(key_tmp)

View File

@ -5,37 +5,39 @@ subroutine write_on_top_in_real_space
! This routines is a simple example of how to plot the on-top pair density on a simple 1D grid ! This routines is a simple example of how to plot the on-top pair density on a simple 1D grid
END_DOC END_DOC
double precision :: zmax,dz,r(3),on_top_in_r,total_density,zcenter,dist double precision :: zmax,dz,r(3),on_top_in_r,total_density,zcenter,dist
double precision :: core_dens, inact_dens,act_dens(2,1)
integer :: nz,i,istate integer :: nz,i,istate
character*(128) :: output character*(128) :: output
integer :: i_unit_output,getUnitAndOpen integer :: i_unit_output,getUnitAndOpen
PROVIDE ezfio_filename PROVIDE ezfio_filename
output=trim(ezfio_filename)//'.on_top' output=trim(ezfio_filename)//'.on_top'
print*,'output = ',trim(output) print*,'output = ',trim(output)
i_unit_output = getUnitAndOpen(output,'w') i_unit_output = getUnitAndOpen(output,'w')
zmax = 2.0d0 zmax = 5.0d0
print*,'nucl_coord(1,3) = ',nucl_coord(1,3) print*,'nucl_coord(1,3) = ',nucl_coord(1,3)
print*,'nucl_coord(2,3) = ',nucl_coord(2,3) print*,'nucl_coord(2,3) = ',nucl_coord(2,3)
dist = dabs(nucl_coord(1,3) - nucl_coord(2,3)) dist = dabs(nucl_coord(1,3) - nucl_coord(2,3))
zmax += dist zmax += dist
zcenter = (nucl_coord(1,3) + nucl_coord(2,3))*0.5d0 zcenter = (nucl_coord(1,3) + nucl_coord(2,3))*0.5d0
print*,'zcenter = ',zcenter print*,'zcenter = ',zcenter
print*,'zmax = ',zmax print*,'zmax = ',zmax
nz = 1000 nz = 1000
dz = zmax / dble(nz) dz = zmax / dble(nz)
r(:) = 0.d0 r(:) = 0.d0
r(3) = zcenter -zmax * 0.5d0 r(3) = zcenter -zmax * 0.5d0
print*,'r(3) = ',r(3) print*,'r(3) = ',r(3)
istate = 1 istate = 1
write(i_unit_output,*)" z, on-top(z), n(z) "
do i = 1, nz do i = 1, nz
call give_on_top_in_r_one_state(r,istate,on_top_in_r) call give_on_top_in_r_one_state(r,istate,on_top_in_r)
call give_cas_density_in_r(r,total_density) call give_cas_density_in_r(core_dens,inact_dens,act_dens,total_density,r)
write(i_unit_output,*)r(3),on_top_in_r,total_density write(i_unit_output,*)r(3),on_top_in_r,total_density
r(3) += dz r(3) += dz
enddo enddo
end end

View File

@ -110,6 +110,62 @@ end
grad_dm_b *= 2.d0 grad_dm_b *= 2.d0
end end
subroutine density_and_grad_alpha_beta(r,dm_a,dm_b, grad_dm_a, grad_dm_b)
implicit none
BEGIN_DOC
! input:
!
! * r(1) ==> r(1) = x, r(2) = y, r(3) = z
!
! output:
!
! * dm_a = alpha density evaluated at r
! * dm_b = beta density evaluated at r
! * grad_dm_a(1) = X gradient of the alpha density evaluated in r
! * grad_dm_a(1) = X gradient of the beta density evaluated in r
!
END_DOC
double precision, intent(in) :: r(3)
double precision, intent(out) :: dm_a(N_states),dm_b(N_states)
double precision, intent(out) :: grad_dm_a(3,N_states),grad_dm_b(3,N_states)
double precision :: grad_aos_array(3,ao_num)
integer :: i,j,istate
double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v
double precision :: aos_grad_array(ao_num,3), aos_grad_array_bis(ao_num,3)
call give_all_aos_and_grad_at_r(r,aos_array,grad_aos_array)
do i = 1, ao_num
do j = 1, 3
aos_grad_array(i,j) = grad_aos_array(j,i)
enddo
enddo
do istate = 1, N_states
! alpha density
! aos_array_bis = \rho_ao * aos_array
call dsymv('U',ao_num,1.d0,one_e_dm_alpha_ao_for_dft(1,1,istate),size(one_e_dm_alpha_ao_for_dft,1),aos_array,1,0.d0,aos_array_bis,1)
dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i)
grad_dm_a(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num)
grad_dm_a(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num)
grad_dm_a(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num)
! aos_grad_array_bis = \rho_ao * aos_grad_array
! beta density
call dsymv('U',ao_num,1.d0,one_e_dm_beta_ao_for_dft(1,1,istate),size(one_e_dm_beta_ao_for_dft,1),aos_array,1,0.d0,aos_array_bis,1)
dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i)
grad_dm_b(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num)
grad_dm_b(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num)
grad_dm_b(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num)
! aos_grad_array_bis = \rho_ao * aos_grad_array
enddo
grad_dm_a *= 2.d0
grad_dm_b *= 2.d0
end
subroutine density_and_grad_lapl_alpha_beta_and_all_aos_and_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, lapl_dm_a, lapl_dm_b, aos_array, grad_aos_array, lapl_aos_array) subroutine density_and_grad_lapl_alpha_beta_and_all_aos_and_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, lapl_dm_a, lapl_dm_b, aos_array, grad_aos_array, lapl_aos_array)

View File

@ -51,3 +51,10 @@ doc: If true, leave untouched all the orbitals defined as core and optimize all
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: False default: False
[no_oa_or_av_opt]
type: logical
doc: If true, you set to zero all Fock elements between the orbital set to active and all the other orbitals
interface: ezfio,provider,ocaml
default: False

View File

@ -31,6 +31,27 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
enddo enddo
enddo enddo
endif endif
if(no_oa_or_av_opt)then
do i = 1, n_act_orb
iorb = list_act(i)
do j = 1, n_inact_orb
jorb = list_inact(j)
F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0
enddo
do j = 1, n_virt_orb
jorb = list_virt(j)
F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0
enddo
do j = 1, n_core_orb
jorb = list_core(j)
F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0
enddo
enddo
endif
! Insert level shift here ! Insert level shift here
do i = elec_beta_num+1, elec_alpha_num do i = elec_beta_num+1, elec_alpha_num

View File

@ -92,6 +92,27 @@
enddo enddo
endif endif
if(no_oa_or_av_opt)then
do i = 1, n_act_orb
iorb = list_act(i)
do j = 1, n_inact_orb
jorb = list_inact(j)
Fock_matrix_mo(iorb,jorb) = 0.d0
Fock_matrix_mo(jorb,iorb) = 0.d0
enddo
do j = 1, n_virt_orb
jorb = list_virt(j)
Fock_matrix_mo(iorb,jorb) = 0.d0
Fock_matrix_mo(jorb,iorb) = 0.d0
enddo
do j = 1, n_core_orb
jorb = list_core(j)
Fock_matrix_mo(iorb,jorb) = 0.d0
Fock_matrix_mo(jorb,iorb) = 0.d0
enddo
enddo
endif
END_PROVIDER END_PROVIDER