10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-14 18:13:51 +01:00
QuantumPackage/src/tools/sort_by_fock_energies.irp.f

39 lines
1001 B
Fortran
Raw Normal View History

2019-03-08 18:12:15 +01:00
program sort_by_fock_energies
2019-06-15 00:28:29 +02:00
BEGIN_DOC
! Program that saves the current |MOs| ordered by diagonal element of the Fock operator.
!
! Warning : the Fock operator, and therefore its matrix elements, depends on the occupancy.
END_DOC
implicit none
integer :: i,j,k
integer, allocatable :: iorder(:)
double precision, allocatable :: fock_energies_tmp(:), new_mo_coef(:,:)
allocate(iorder(mo_num), fock_energies_tmp(mo_num),new_mo_coef(ao_num,mo_num))
do i = 1, mo_num
fock_energies_tmp(i) = Fock_matrix_diag_mo(i)
print*,'fock_energies_tmp(i) = ',fock_energies_tmp(i)
iorder(i) = i
enddo
print*,''
print*,'Sorting by Fock energies'
print*,''
call dsort(fock_energies_tmp,iorder,mo_num)
do i = 1, mo_num
k = iorder(i)
print*,'fock_energies_new(i) = ',fock_energies_tmp(i)
do j = 1, ao_num
new_mo_coef(j,i) = mo_coef(j,k)
enddo
2019-03-08 18:12:15 +01:00
enddo
2019-06-15 00:28:29 +02:00
mo_coef = new_mo_coef
touch mo_coef
call save_mos
2019-03-08 18:12:15 +01:00
end