mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-10-07 00:25:57 +02:00
30 lines
739 B
Fortran
30 lines
739 B
Fortran
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
|