@@ -2739,36 +2739,48 @@ subroutine Wavefunction_removeOrbitalsBelowEigenThreshold(this)
2739
2739
type (WaveFunction) :: this
2740
2740
2741
2741
integer (8 ) :: numberOfContractions
2742
- real (8 ) :: normCheck
2742
+ type (Vector) :: normCheck, normCheckSorted
2743
+ real (8 ) :: threshold
2743
2744
integer :: i, j, mu, nu, index
2744
2745
2746
+ if (this% removedOrbitals .eq. 0 ) return
2747
+
2745
2748
numberOfContractions = MolecularSystem_getTotalnumberOfContractions(this% species,this% molSys)
2749
+ call Vector_constructor(normCheck, int (numberOfContractions,4 ), 0.0_8 )
2746
2750
2747
- i= 0
2748
- do index = 1 , numberOfContractions
2749
- i= i+1
2750
- normCheck= 0.0
2751
+ do i= 1 , numberOfContractions
2751
2752
do mu = 1 , numberOfContractions
2752
2753
do nu = 1 , numberOfContractions
2753
- normCheck= normCheck+ this% waveFunctionCoefficients% values(mu,i)* &
2754
+ normCheck% values(i) = normCheck% values(i) + this% waveFunctionCoefficients% values(mu,i)* &
2754
2755
this% waveFunctionCoefficients% values(nu,i)* &
2755
2756
this% overlapMatrix% values(mu,nu)
2756
2757
end do
2757
2758
end do
2758
- if ( normCheck .lt. CONTROL_instance% OVERLAP_EIGEN_THRESHOLD) then
2759
- if ( CONTROL_instance% DEBUG_SCFS) &
2760
- print * , " shifting eigenvector no." , i, " with normCheck" , normCheck, " to the end of the coefficients matrix"
2759
+ end do
2760
+
2761
+ normCheckSorted= normCheck
2762
+ call Vector_reverseSortElements(normCheckSorted)
2763
+ threshold= normCheckSorted% values(this% removedOrbitals)
2761
2764
2765
+ i= 0
2766
+ do index = 1 , numberOfContractions
2767
+ i= i+1
2768
+ if ( normCheck% values(i) .le. threshold) then
2769
+ if ( CONTROL_instance% DEBUG_SCFS) &
2770
+ print * , " shifting eigenvector no." , i, " with normCheck" , normCheck% values(i), " to the end of the coefficients matrix"
2762
2771
do j = i , numberOfContractions-1
2763
2772
this% molecularOrbitalsEnergy% values(j)= this% molecularOrbitalsEnergy% values(j+1 )
2764
- this% waveFunctionCoefficients% values(:,j) = this% waveFunctionCoefficients% values(:,j+1 )
2773
+ this% waveFunctionCoefficients% values(1 :numberOfContractions,j) = this% waveFunctionCoefficients% values(1 :numberOfContractions,j+1 )
2774
+ normCheck% values(j)= normCheck% values(j+1 )
2765
2775
end do
2776
+ i= i-1
2766
2777
! Make eigenenergy a very large number
2767
2778
this% molecularOrbitalsEnergy% values(numberOfContractions)= 1.0E+308_8
2768
- this% waveFunctionCoefficients% values(: ,numberOfContractions)= 0.0
2769
- i = i -1
2779
+ this% waveFunctionCoefficients% values(1 :numberOfContractions ,numberOfContractions)= 0.0_8
2780
+ normCheck % values(numberOfContractions) = 1.0E+308_8
2770
2781
end if
2771
2782
end do
2783
+
2772
2784
end subroutine Wavefunction_removeOrbitalsBelowEigenThreshold
2773
2785
2774
2786
0 commit comments