• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãod611b34fad6f905f0d5b3e182e2157e4d0c8ac17 (tree)
Hora2013-01-23 07:12:45
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Mensagem de Log

Output on/off of DIIS and diisError of Cndo2::DoDIIS for each SCF step. #30554

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1245 1136aad2-a195-0410-b898-f5ea1d11b9d8

Mudança Sumário

Diff

--- a/src/cndo/Cndo2.cpp
+++ b/src/cndo/Cndo2.cpp
@@ -198,9 +198,11 @@ void Cndo2::SetMessages(){
198198 this->messageStartSCF = "********** START: CNDO/2-SCF **********\n";
199199 this->messageDoneSCF = "********** DONE: CNDO/2-SCF **********\n\n\n";
200200 this->messageOmpElapsedTimeSCF = "\tElapsed time(omp) for the SCF = ";
201- this->messageIterSCF = "SCF iter=";
202- this->messageDensityRMS = ": RMS density=";
203- this->messageEnergyMO = "\tEnergy of MO:";
201+ this->messageIterSCF = "\tSCF iter ";
202+ this->messageDensityRMS = ":\tRMS density = ";
203+ this->messageDiisError = "\tDIIS error = ";
204+ this->messageDiisApplied = " (DIIS was applied)";
205+ this->messageEnergyMO = "\tEnergy of MO:";
204206 this->messageEnergyMOTitle = "\t\t\t| i-th | occ/unocc | e[a.u.] | e[eV] | \n";
205207 this->messageOcc = "occ";
206208 this->messageUnOcc = "unocc";
@@ -528,9 +530,11 @@ void Cndo2::DoSCF(bool requiresGuess){
528530 this->CalcTwoElecTwoCore(this->twoElecTwoCore, *this->molecule);
529531
530532 // SCF
531- double rmsDensity;
533+ double rmsDensity=0.0;
532534 int maxIterationsSCF = Parameters::GetInstance()->GetMaxIterationsSCF();
533535 bool isGuess=true;
536+ bool hasAppliedDIIS=false;
537+ double diisError=0.0;
534538 for(int iterationStep=0; iterationStep<maxIterationsSCF; iterationStep++){
535539 this->CalcAtomicElectronPopulation(this->atomicElectronPopulation,
536540 this->orbitalElectronPopulation,
@@ -564,7 +568,9 @@ void Cndo2::DoSCF(bool requiresGuess){
564568 this->orbitalElectronPopulation,
565569 this->molecule->GetTotalNumberAOs(),
566570 &rmsDensity,
567- iterationStep);
571+ iterationStep,
572+ diisError,
573+ hasAppliedDIIS);
568574 if(hasConverged){
569575 this->OutputLog(this->messageSCFMetConvergence);
570576 this->CalcSCFProperties();
@@ -583,6 +589,8 @@ void Cndo2::DoSCF(bool requiresGuess){
583589 diisStoredErrorVect,
584590 diisErrorProducts,
585591 diisErrorCoefficients,
592+ diisError,
593+ hasAppliedDIIS,
586594 Parameters::GetInstance()->GetDiisNumErrorVectSCF(),
587595 *this->molecule,
588596 iterationStep);
@@ -794,11 +802,13 @@ void Cndo2::DoDIIS(double** orbitalElectronPopulation,
794802 double const* const* oldOrbitalElectronPopulation,
795803 double*** diisStoredDensityMatrix,
796804 double*** diisStoredErrorVect,
797- double** diisErrorProducts,
798- double* diisErrorCoefficients,
799- int diisNumErrorVect,
800- const Molecule& molecule,
801- int step) const{
805+ double** diisErrorProducts,
806+ double* diisErrorCoefficients,
807+ double& diisError,
808+ bool& hasAppliedDIIS,
809+ int diisNumErrorVect,
810+ const Molecule& molecule,
811+ int step) const{
802812 int totalNumberAOs = molecule.GetTotalNumberAOs();
803813 double diisStartError = Parameters::GetInstance()->GetDiisStartErrorSCF();
804814 double diisEndError = Parameters::GetInstance()->GetDiisEndErrorSCF();
@@ -881,14 +891,16 @@ void Cndo2::DoDIIS(double** orbitalElectronPopulation,
881891 diisErrorProducts[diisNumErrorVect][diisNumErrorVect] = 0.0;
882892 diisErrorCoefficients[diisNumErrorVect] = -1.0;
883893
884- double eMax = 0;
894+ diisError = 0.0;
885895 for(int j=0; j<totalNumberAOs; j++){
886896 for(int k=0; k<totalNumberAOs; k++){
887- eMax = max(eMax, fabs(diisStoredErrorVect[diisNumErrorVect-1][j][k]));
897+ diisError = max(diisError, fabs(diisStoredErrorVect[diisNumErrorVect-1][j][k]));
888898 }
889899 }
890900
891- if(diisNumErrorVect <= step && diisEndError<eMax && eMax<diisStartError){
901+ hasAppliedDIIS = false;
902+ if(diisNumErrorVect <= step && diisEndError<diisError && diisError<diisStartError){
903+ hasAppliedDIIS = true;
892904 MolDS_wrappers::Lapack::GetInstance()->Dsysv(diisErrorProducts,
893905 diisErrorCoefficients,
894906 diisNumErrorVect+1);
@@ -1299,9 +1311,11 @@ void Cndo2::UpdateOldOrbitalElectronPopulation(double** oldOrbitalElectronPopula
12991311
13001312 bool Cndo2::SatisfyConvergenceCriterion(double const* const * oldOrbitalElectronPopulation,
13011313 double const* const * orbitalElectronPopulation,
1302- int numberAOs,
1314+ int numberAOs,
13031315 double* rmsDensity,
1304- int times) const{
1316+ int times,
1317+ double diisError,
1318+ bool hasAppliedDIIS) const{
13051319 bool satisfy = false;
13061320 double change = 0.0;
13071321 stringstream ompErrors;
@@ -1322,11 +1336,15 @@ bool Cndo2::SatisfyConvergenceCriterion(double const* const * oldOrbitalElectron
13221336 throw MolDSException(ompErrors.str());
13231337 }
13241338 *rmsDensity = sqrt(change);
1325-
1326- this->OutputLog(boost::format("%s%d%s%.15lf\n") % this->messageIterSCF.c_str()
1327- % times
1328- % this->messageDensityRMS.c_str()
1329- % *rmsDensity);
1339+
1340+ string diisOnOff = hasAppliedDIIS ? this->messageDiisApplied : "";
1341+ this->OutputLog(boost::format("%s%d%s%.15lf%s%e%s\n") % this->messageIterSCF.c_str()
1342+ % times
1343+ % this->messageDensityRMS.c_str()
1344+ % *rmsDensity
1345+ % this->messageDiisError.c_str()
1346+ % diisError
1347+ % diisOnOff);
13301348
13311349 if(*rmsDensity < Parameters::GetInstance()->GetThresholdSCF()){
13321350 satisfy = true;
--- a/src/cndo/Cndo2.h
+++ b/src/cndo/Cndo2.h
@@ -256,6 +256,8 @@ private:
256256 std::string errorMessageRhs;
257257 std::string messageIterSCF;
258258 std::string messageDensityRMS;
259+ std::string messageDiisError;
260+ std::string messageDiisApplied;
259261 std::string messageEnergyMO;
260262 std::string messageEnergyMOTitle;
261263 std::string messageElecEnergy;
@@ -322,9 +324,11 @@ private:
322324 double const* const* overlapAOs) const;
323325 bool SatisfyConvergenceCriterion(double const* const* oldOrbitalElectronPopulation,
324326 double const* const* orbitalElectronPopulation,
325- int numberAOs,
327+ int numberAOs,
326328 double* rmsDensity,
327- int times) const;
329+ int times,
330+ double diisErro,
331+ bool hasAppliedDIIS) const;
328332 void UpdateOldOrbitalElectronPopulation(double** oldOrbitalElectronPopulation,
329333 double const* const* orbitalElectronPopulation,
330334 int numberAOs) const;
@@ -420,6 +424,8 @@ private:
420424 double*** diisStoredErrorVect,
421425 double** diisErrorProducts,
422426 double* diisErrorCoefficients,
427+ double& diisError,
428+ bool& hasAppliedDIIS,
423429 int diisNumErrorVect,
424430 const MolDS_base::Molecule& molecule,
425431 int step) const;