10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 22:53:52 +01:00
QuantumPackage/src/mo_optimization/state_weight_normalization.irp.f

30 lines
739 B
Fortran
Raw Normal View History

2023-04-18 13:56:30 +02:00
subroutine state_weight_normalization
implicit none
BEGIN_DOC
! Renormalization of the state weights or enforcing state average
! weights for orbital optimization
END_DOC
integer :: i
double precision :: normalization_factor
! To normalize the sum of the state weights
normalization_factor = 0d0
do i = 1, N_states
normalization_factor = normalization_factor + state_average_weight(i)
enddo
normalization_factor = 1d0 / normalization_factor
do i = 1, N_states
state_average_weight(i) = state_average_weight(i) * normalization_factor
enddo
TOUCH state_average_weight
print*, 'Number of states:', N_states
print*, 'State average weights:'
print*, state_average_weight(:)
end