10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-12 17:13:54 +01:00

save wavefunction general merged

This commit is contained in:
Anthony Scemama 2014-07-09 14:52:42 +02:00
parent 964a245737
commit 17c157a1f3
6 changed files with 60 additions and 67 deletions

View File

@ -17,6 +17,12 @@ Documentation
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
`cis <http://github.com/LCPQ/quantum_package/tree/master/src/CIS/super_ci.irp.f#L1>`_
Undocumented
`super_ci <http://github.com/LCPQ/quantum_package/tree/master/src/CIS/super_ci.irp.f#L9>`_
Undocumented
Needed Modules

View File

@ -38,6 +38,7 @@ subroutine super_CI
else
save_char = ' '
endif
E_min = min(E,E_min)
write(output_hartree_fock,'(I4,X,F16.10, X, F16.10, X, A8 )'),&
k, E, delta_E, save_char
if ( (delta_E < 0.d0).and.(dabs(delta_E) < thresh_scf) ) then

View File

@ -348,49 +348,7 @@ subroutine save_wavefunction
BEGIN_DOC
! Save the wave function into the EZFIO file
END_DOC
integer*8, allocatable :: psi_det_save(:,:,:)
double precision, allocatable :: psi_coef_save(:,:)
integer*8 :: det_8(100)
integer(bit_kind) :: det_bk((100*8)/bit_kind)
integer :: N_int2
equivalence (det_8, det_bk)
integer :: i,k
call ezfio_set_determinants_N_int(N_int)
call ezfio_set_determinants_bit_kind(bit_kind)
call ezfio_set_determinants_N_det(N_det)
call ezfio_set_determinants_N_states(N_states)
call ezfio_set_determinants_mo_label(mo_label)
N_int2 = (N_int*bit_kind)/8
allocate (psi_det_save(N_int2,2,N_det))
do i=1,N_det
do k=1,N_int
det_bk(k) = psi_det_sorted(k,1,i)
enddo
do k=1,N_int2
psi_det_save(k,1,i) = det_8(k)
enddo
do k=1,N_int
det_bk(k) = psi_det_sorted(k,2,i)
enddo
do k=1,N_int2
psi_det_save(k,2,i) = det_8(k)
enddo
enddo
call ezfio_set_determinants_psi_det(psi_det_save)
deallocate (psi_det_save)
allocate (psi_coef_save(N_det,N_states))
do k=1,N_states
do i=1,N_det
psi_coef_save(i,k) = psi_coef_sorted(i,k)
enddo
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save)
call write_int(output_dets,N_det,'Saved determinants')
deallocate (psi_coef_save)
call save_wavefunction_general(N_det,N_states,psi_det_sorted,psi_coef_sorted)
end
subroutine save_wavefunction_general(ndet,nstates,psidet,psicoef)

View File

@ -87,6 +87,25 @@ END_PROVIDER
! Alpha Fock matrix in AO basis set
END_DOC
integer :: i,j
do j=1,ao_num
!DIR$ VECTOR ALIGNED
do i=1,ao_num
Fock_matrix_alpha_ao(i,j) = ao_mono_elec_integral(i,j) + ao_bi_elec_integral_alpha(i,j)
Fock_matrix_beta_ao (i,j) = ao_mono_elec_integral(i,j) + ao_bi_elec_integral_beta (i,j)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_bi_elec_integral_alpha, (ao_num_align, ao_num) ]
&BEGIN_PROVIDER [ double precision, ao_bi_elec_integral_beta , (ao_num_align, ao_num) ]
implicit none
BEGIN_DOC
! Alpha Fock matrix in AO basis set
END_DOC
integer :: i,j,k,l,k1,kmax
double precision, allocatable :: ao_ints_val(:)
integer, allocatable :: ao_ints_idx(:)
@ -98,30 +117,30 @@ END_PROVIDER
PROVIDE HF_density_matrix_ao_alpha HF_density_matrix_ao_beta
!$OMP PARALLEL DEFAULT(NONE) &
!$OMP PRIVATE(i,j,l,k1,k,integral) &
!$OMP SHARED(ao_num,Fock_matrix_alpha_ao,ao_mono_elec_integral,&
!$OMP ao_num_align,Fock_matrix_beta_ao,HF_density_matrix_ao_alpha, &
!$OMP SHARED(ao_num,ao_bi_elec_integral_alpha,ao_mono_elec_integral,&
!$OMP ao_num_align,ao_bi_elec_integral_beta,HF_density_matrix_ao_alpha, &
!$OMP HF_density_matrix_ao_beta)
!$OMP DO SCHEDULE(GUIDED)
do j=1,ao_num
do i=1,j
Fock_matrix_alpha_ao(i,j) = ao_mono_elec_integral(i,j)
Fock_matrix_beta_ao (i,j) = ao_mono_elec_integral(i,j)
ao_bi_elec_integral_alpha(i,j) = 0.d0
ao_bi_elec_integral_beta (i,j) = 0.d0
do l=1,ao_num
do k=1,ao_num
if ((abs(HF_density_matrix_ao_alpha(k,l)) > 1.d-9).or. &
(abs(HF_density_matrix_ao_beta (k,l)) > 1.d-9)) then
integral = (HF_density_matrix_ao_alpha(k,l)+HF_density_matrix_ao_beta (k,l)) * ao_bielec_integral(k,l,i,j)
Fock_matrix_alpha_ao(i,j) += integral
Fock_matrix_beta_ao (i,j) += integral
ao_bi_elec_integral_alpha(i,j) += integral
ao_bi_elec_integral_beta (i,j) += integral
integral = ao_bielec_integral(k,j,i,l)
Fock_matrix_alpha_ao(i,j) -= HF_density_matrix_ao_alpha(k,l)*integral
Fock_matrix_beta_ao (i,j) -= HF_density_matrix_ao_beta (k,l)*integral
ao_bi_elec_integral_alpha(i,j) -= HF_density_matrix_ao_alpha(k,l)*integral
ao_bi_elec_integral_beta (i,j) -= HF_density_matrix_ao_beta (k,l)*integral
endif
enddo
enddo
Fock_matrix_alpha_ao(j,i) = Fock_matrix_alpha_ao(i,j)
Fock_matrix_beta_ao (j,i) = Fock_matrix_beta_ao (i,j)
ao_bi_elec_integral_alpha(j,i) = ao_bi_elec_integral_alpha(i,j)
ao_bi_elec_integral_beta (j,i) = ao_bi_elec_integral_beta (i,j)
enddo
enddo
!$OMP END DO NOWAIT
@ -130,16 +149,16 @@ END_PROVIDER
else
!$OMP PARALLEL DEFAULT(NONE) &
!$OMP PRIVATE(i,j,l,k1,k,integral,ao_ints_val,ao_ints_idx,kmax) &
!$OMP SHARED(ao_num,Fock_matrix_alpha_ao,ao_mono_elec_integral,&
!$OMP ao_num_align,Fock_matrix_beta_ao,HF_density_matrix_ao_alpha, &
!$OMP SHARED(ao_num,ao_bi_elec_integral_alpha,ao_mono_elec_integral,&
!$OMP ao_num_align,ao_bi_elec_integral_beta,HF_density_matrix_ao_alpha, &
!$OMP HF_density_matrix_ao_beta)
allocate(ao_ints_idx(ao_num_align),ao_ints_val(ao_num_align))
!$OMP DO SCHEDULE(GUIDED)
do j=1,ao_num
!DIR$ VECTOR ALIGNED
do i=1,ao_num
Fock_matrix_alpha_ao(i,j) = ao_mono_elec_integral(i,j)
Fock_matrix_beta_ao (i,j) = ao_mono_elec_integral(i,j)
ao_bi_elec_integral_alpha(i,j) = 0.d0
ao_bi_elec_integral_beta (i,j) = 0.d0
enddo
do l=1,ao_num
do i=1,ao_num
@ -148,11 +167,11 @@ END_PROVIDER
do k1=1,kmax
k = ao_ints_idx(k1)
integral = (HF_density_matrix_ao_alpha(k,l)+HF_density_matrix_ao_beta(k,l)) * ao_ints_val(k1)
Fock_matrix_alpha_ao(i,j) += integral
Fock_matrix_beta_ao (i,j) += integral
ao_bi_elec_integral_alpha(i,j) += integral
ao_bi_elec_integral_beta (i,j) += integral
integral = ao_ints_val(k1)
Fock_matrix_alpha_ao(l,j) -= HF_density_matrix_ao_alpha(k,i) * integral
Fock_matrix_beta_ao (l,j) -= HF_density_matrix_ao_beta (k,i) * integral
ao_bi_elec_integral_alpha(l,j) -= HF_density_matrix_ao_alpha(k,i) * integral
ao_bi_elec_integral_beta (l,j) -= HF_density_matrix_ao_beta (k,i) * integral
enddo
enddo
enddo

View File

@ -26,19 +26,25 @@ Documentation
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
`ao_bi_elec_integral_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L102>`_
Alpha Fock matrix in AO basis set
`ao_bi_elec_integral_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L103>`_
Alpha Fock matrix in AO basis set
`fock_matrix_alpha_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L83>`_
Alpha Fock matrix in AO basis set
`fock_matrix_alpha_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L172>`_
`fock_matrix_alpha_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L191>`_
Fock matrix on the MO basis
`fock_matrix_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L220>`_
`fock_matrix_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L239>`_
Fock matrix in AO basis set
`fock_matrix_beta_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L84>`_
Alpha Fock matrix in AO basis set
`fock_matrix_beta_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L192>`_
`fock_matrix_beta_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L211>`_
Fock matrix on the MO basis
`fock_matrix_diag_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L2>`_
@ -71,10 +77,10 @@ Documentation
K = Fb - Fa
.br
`fock_mo_to_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L263>`_
`fock_mo_to_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L282>`_
Undocumented
`hf_energy <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L211>`_
`hf_energy <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L230>`_
Hartree-Fock energy
`hf_density_matrix_ao <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/HF_density_matrix_ao.irp.f#L27>`_
@ -92,6 +98,9 @@ Documentation
`scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L2>`_
Undocumented
`damping_scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/damping_SCF.irp.f#L1>`_
Undocumented
`diagonal_fock_matrix_mo <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/diagonalize_fock.irp.f#L1>`_
Diagonal Fock matrix in the MO basis

View File

@ -83,7 +83,7 @@ subroutine damping_SCF
if ((E_half > E).and.(E_new < E)) then
lambda = 1.d0
exit
else if ((E_half > E).and.(lambda > 1.d-3)) then
else if ((E_half > E).and.(lambda > 5.d-2)) then
lambda = 0.5d0 * lambda
E_new = E_half
else