Skip to content

Commit a0c8713

Browse files
committed
New orbital removal routine, to remove the lowest eigenvalues (previously was comparing to OVERLAP_EIGEN_THRESHOLD)
1 parent 2d1fc20 commit a0c8713

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

src/scf/WaveFunction.f90

+24-12
Original file line numberDiff line numberDiff line change
@@ -2739,36 +2739,48 @@ subroutine Wavefunction_removeOrbitalsBelowEigenThreshold(this)
27392739
type(WaveFunction) :: this
27402740

27412741
integer(8) :: numberOfContractions
2742-
real(8) :: normCheck
2742+
type(Vector) :: normCheck, normCheckSorted
2743+
real(8) :: threshold
27432744
integer :: i, j, mu, nu, index
27442745

2746+
if(this%removedOrbitals .eq. 0) return
2747+
27452748
numberOfContractions = MolecularSystem_getTotalnumberOfContractions(this%species,this%molSys)
2749+
call Vector_constructor(normCheck, int(numberOfContractions,4), 0.0_8)
27462750

2747-
i=0
2748-
do index = 1 , numberOfContractions
2749-
i=i+1
2750-
normCheck=0.0
2751+
do i=1, numberOfContractions
27512752
do mu = 1 , numberOfContractions
27522753
do nu = 1 , numberOfContractions
2753-
normCheck=normCheck+this%waveFunctionCoefficients%values(mu,i)*&
2754+
normCheck%values(i)=normCheck%values(i)+this%waveFunctionCoefficients%values(mu,i)*&
27542755
this%waveFunctionCoefficients%values(nu,i)*&
27552756
this%overlapMatrix%values(mu,nu)
27562757
end do
27572758
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)
27612764

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"
27622771
do j = i , numberOfContractions-1
27632772
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)
27652775
end do
2776+
i=i-1
27662777
! Make eigenenergy a very large number
27672778
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
27702781
end if
27712782
end do
2783+
27722784
end subroutine Wavefunction_removeOrbitalsBelowEigenThreshold
27732785

27742786

test/QDO-largeBasis.lowdin

+2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ TASKS
66
method = "UHF"
77
END TASKS
88
CONTROL
9+
readCoefficients=F
910
setQDOenergyZero=T
1011
totalEnergyTolerance=1E-12
1112
overlapEigenThreshold=1E-6
1213
integralStorage="DIRECT"
14+
debugSCFS=F
1315
END CONTROL
1416
BASIS PB6ZQDO
1517
O-POSITIVE qp+ (PB6ZQDO) BASIS TYPE: 2

0 commit comments

Comments
 (0)