9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 05:53:37 +01:00

Printing of components of energy:

This commit is contained in:
Anthony Scemama 2019-06-05 15:38:05 +02:00
parent 453cfa0b65
commit 7c285bddf3
2 changed files with 59 additions and 3 deletions

View File

@ -43,4 +43,57 @@ BEGIN_PROVIDER [ double precision, S2_matrix_all_dets,(N_det,N_det) ]
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
END_PROVIDER END_PROVIDER
subroutine print_energy_components()
implicit none
BEGIN_DOC
! Prints the different components of the energy.
END_DOC
integer, save :: ifirst = 0
double precision :: Vee, Ven, Vnn, Vecp, T, f
integer :: i,j,k
Vnn = nuclear_repulsion
print *, 'Energy components'
print *, '================='
print *, ''
do k=1,N_states
Ven = 0.d0
Vecp = 0.d0
T = 0.d0
do j=1,mo_num
do i=1,mo_num
f = one_e_dm_mo_alpha(i,j,k) + one_e_dm_mo_beta(i,j,k)
Ven = Ven + f * mo_integrals_n_e(i,j)
Vecp = Vecp + f * mo_pseudo_integrals(i,j)
T = T + f * mo_kinetic_integrals(i,j)
enddo
enddo
Vee = psi_energy(k) - Ven - Vecp - T
if (ifirst == 0) then
ifirst = 1
print *, 'Vnn : Nucleus-Nucleus potential energy'
print *, 'Ven : Electron-Nucleus potential energy'
print *, 'Vee : Electron-Electron potential energy'
print *, 'Vecp : Potential energy of the pseudo-potentials'
print *, 'T : Electronic kinetic energy'
print *, ''
endif
print *, 'State ', k
print *, '---------'
print *, ''
print *, 'Vnn = ', Vnn
print *, 'Ven = ', Ven
print *, 'Vee = ', Vee
print *, 'Vecp = ', Vecp
print *, 'T = ', T
print *, ''
enddo
print *, ''
end

View File

@ -31,18 +31,19 @@ subroutine print_summary(e_,pt2_,error_,variance_,norm_,n_det_,n_occ_pattern_,n_
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))'
write(*,fmt) write(*,fmt)
write(fmt,*) '(12X,', N_states_p, '(6X,A7,1X,I6,10X))' write(fmt,*) '(13X,', N_states_p, '(6X,A7,1X,I6,10X))'
write(*,fmt) ('State',k, k=1,N_states_p) write(*,fmt) ('State',k, k=1,N_states_p)
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))'
write(*,fmt) write(*,fmt)
write(fmt,*) '(A12,', N_states_p, '(1X,F14.8,15X))' write(fmt,*) '(A13,', N_states_p, '(1X,F14.8,15X))'
write(*,fmt) '# E ', e_(1:N_states_p) write(*,fmt) '# E ', e_(1:N_states_p)
if (N_states_p > 1) then if (N_states_p > 1) then
write(*,fmt) '# Excit. (au)', e_(1:N_states_p)-e_(1) write(*,fmt) '# Excit. (au)', e_(1:N_states_p)-e_(1)
write(*,fmt) '# Excit. (eV)', (e_(1:N_states_p)-e_(1))*27.211396641308d0 write(*,fmt) '# Excit. (eV)', (e_(1:N_states_p)-e_(1))*27.211396641308d0
endif endif
write(fmt,*) '(A13,', 2*N_states_p, '(1X,F14.8))' write(fmt,*) '(A13,', 2*N_states_p, '(1X,F14.8))'
write(*,fmt) '# PT2'//pt2_string, (pt2_(k), error_(k), k=1,N_states_p) write(*,fmt) '# PT2 '//pt2_string, (pt2_(k), error_(k), k=1,N_states_p)
write(*,fmt) '# rPT2'//pt2_string, (pt2_(k)*f(k), error_(k)*f(k), k=1,N_states_p)
write(*,'(A)') '#' write(*,'(A)') '#'
write(*,fmt) '# E+PT2 ', (e_(k)+pt2_(k),error_(k), k=1,N_states_p) write(*,fmt) '# E+PT2 ', (e_(k)+pt2_(k),error_(k), k=1,N_states_p)
write(*,fmt) '# E+rPT2 ', (e_(k)+pt2_(k)*f(k),error_(k)*f(k), k=1,N_states_p) write(*,fmt) '# E+rPT2 ', (e_(k)+pt2_(k)*f(k),error_(k)*f(k), k=1,N_states_p)
@ -97,5 +98,7 @@ subroutine print_summary(e_,pt2_,error_,variance_,norm_,n_det_,n_occ_pattern_,n_
enddo enddo
endif endif
call print_energy_components()
end subroutine end subroutine