修订版 | 9fc28b3838554ef223e395d3bbd7b789dffd505b (tree) |
---|---|
时间 | 2013-02-07 21:54:28 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
tmp levelshift
@@ -585,6 +585,27 @@ void Cndo2::DoSCF(bool requiresGuess){ | ||
585 | 585 | this->OutputLog(boost::format("SCF Iter=%d: RMS commutator [F,D]=%f\n") % iterationStep |
586 | 586 | % sqrt(normSquaredCommutatorFD)); |
587 | 587 | |
588 | + // Level Shift | |
589 | + double levelShifter = 2.0; | |
590 | + if(iterationStep > 0){ | |
591 | + stringstream ompErrors; | |
592 | +#pragma omp parallel for schedule(auto) | |
593 | + for(int i = 0; i < totalAONumber; i++){ | |
594 | + try{ | |
595 | + for(int j = 0; j < totalAONumber; j++){ | |
596 | + this->fockMatrix[i][j] -= levelShifter * oldOrbitalElectronPopulation[i][j] / 2.0; | |
597 | + } | |
598 | + } | |
599 | + catch(MolDSException ex){ | |
600 | +#pragma omp critical | |
601 | + ompErrors << ex.what() << endl; | |
602 | + } | |
603 | + } | |
604 | + if(!ompErrors.str().empty()){ | |
605 | + throw MolDSException(ompErrors.str()); | |
606 | + } | |
607 | + } | |
608 | + | |
588 | 609 | // diagonalization of the Fock matrix |
589 | 610 | bool calcEigenVectors = true; |
590 | 611 | MolDS_wrappers::Lapack::GetInstance()->Dsyevd(this->fockMatrix, |
@@ -606,6 +627,27 @@ void Cndo2::DoSCF(bool requiresGuess){ | ||
606 | 627 | hasAppliedDIIS); |
607 | 628 | if(hasConverged){ |
608 | 629 | this->OutputLog(this->messageSCFMetConvergence); |
630 | + | |
631 | + // Re-calculate without any level-shift | |
632 | + this->CalcFockMatrix(this->fockMatrix, | |
633 | + *this->molecule, | |
634 | + this->overlapAOs, | |
635 | + this->gammaAB, | |
636 | + this->orbitalElectronPopulation, | |
637 | + this->atomicElectronPopulation, | |
638 | + this->twoElecTwoCore, | |
639 | + isGuess); | |
640 | + | |
641 | + bool calcEigenVectors = true; | |
642 | + MolDS_wrappers::Lapack::GetInstance()->Dsyevd(this->fockMatrix, | |
643 | + this->energiesMO, | |
644 | + this->molecule->GetTotalNumberAOs(), | |
645 | + calcEigenVectors); | |
646 | + | |
647 | + this->CalcOrbitalElectronPopulation(this->orbitalElectronPopulation, | |
648 | + *this->molecule, | |
649 | + this->fockMatrix); | |
650 | + | |
609 | 651 | this->CalcSCFProperties(); |
610 | 652 | this->OutputSCFResults(); |
611 | 653 | break; |