• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révision392f4d8ce533c35aad5ae95de5f027b0b9f2389f (tree)
l'heure2011-07-02 15:53:40
AuteurMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Message de Log

CIS-direct (= without Davidson) is improved.

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

Change Summary

Modification

--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -29,8 +29,6 @@ private:
2929 InputParser(InputParser&);
3030 void operator = (InputParser&);
3131 ~InputParser();
32- string messageYES;
33- string messageNO;
3432 string messageStartParseInput;
3533 string messageDoneParseInput;
3634 string messageTotalNumberAOs;
@@ -50,6 +48,8 @@ private:
5048 string messageCisNumberActiveVir;
5149 string messageCisNumberExcitedStates;
5250 string messageCisDavidson;
51+ string stringYES;
52+ string stringNO;
5353 string stringSpace;
5454 string stringCommentOut;
5555 string stringTheory;
@@ -105,8 +105,6 @@ private:
105105 InputParser* InputParser::inputParser = NULL;
106106
107107 InputParser::InputParser(){
108- this->messageYES = "YES";
109- this->messageNO = "NO";
110108 this->messageStartParseInput = "********** START: Parse input **********\n";
111109 this->messageDoneParseInput = "********** DONE: Parse input ***********\n\n\n";
112110 this->messageTotalNumberAOs = "\tTotal number of valence AOs: ";
@@ -126,6 +124,8 @@ InputParser::InputParser(){
126124 this->messageCisNumberActiveVir = "\t\tNumber of active Vir.: ";
127125 this->messageCisNumberExcitedStates = "\t\tNumber of excited states: ";
128126 this->messageCisDavidson = "\t\tCIS-Davidson: ";
127+ this->stringYES = "yes";
128+ this->stringNO = "no";
129129 this->stringSpace = " ";
130130 this->stringCommentOut = "//";
131131 this->stringTheoryCNDO2 = "cndo/2";
@@ -418,7 +418,7 @@ void InputParser::Parse(Molecule* molecule){
418418 }
419419 // Davidson is used or not
420420 if(inputTerms[j].compare(this->stringCISDavidson) == 0){
421- if(inputTerms[j+1].compare(this->messageYES) == 0){
421+ if(inputTerms[j+1].compare(this->stringYES) == 0){
422422 Parameters::GetInstance()->SetIsDavidsonCIS(true);
423423 }
424424 else{
@@ -509,25 +509,35 @@ void InputParser::CalcMolecularBasics(Molecule* molecule){
509509
510510 void InputParser::CalcCisCondition(Molecule* molecule){
511511
512- int numberOcc = molecule->GetTotalNumberValenceElectrons()/2;
513- int numberVir = molecule->GetTotalNumberAOs() - numberOcc;
514-
515- // check the number of active occupied orbitals.
516- if(numberOcc < Parameters::GetInstance()->GetActiveOccCIS()){
517- Parameters::GetInstance()->SetActiveOccCIS(numberOcc);
518- }
519-
520- // check the number of active virtual orbitals.
521- if(numberVir < Parameters::GetInstance()->GetActiveVirCIS()){
522- Parameters::GetInstance()->SetActiveVirCIS(numberVir);
523- }
524-
525- // check the number of calculated excited states.
526- int numberExcitedStates = Parameters::GetInstance()->GetActiveOccCIS()
527- *Parameters::GetInstance()->GetActiveVirCIS();
528- if(numberExcitedStates < Parameters::GetInstance()->GetNumberExcitedStatesCIS()){
529- Parameters::GetInstance()->SetNumberExcitedStatesCIS(numberExcitedStates);
530- }
512+ if(Parameters::GetInstance()->GetIsDavidsonCIS()){
513+ // Davidson CIS
514+ // ToDo: calc condition for CIS-Davidson
515+ stringstream ss;
516+ ss << "Condition check for CIS-Davidson in InputParser::CalcCisCondition is not implemented yet.\n\n";
517+ throw MolDSException(ss.str());
518+ }
519+ else{
520+ // direct CIS
521+ int numberOcc = molecule->GetTotalNumberValenceElectrons()/2;
522+ int numberVir = molecule->GetTotalNumberAOs() - numberOcc;
523+
524+ // check the number of active occupied orbitals.
525+ if(numberOcc < Parameters::GetInstance()->GetActiveOccCIS()){
526+ Parameters::GetInstance()->SetActiveOccCIS(numberOcc);
527+ }
528+
529+ // check the number of active virtual orbitals.
530+ if(numberVir < Parameters::GetInstance()->GetActiveVirCIS()){
531+ Parameters::GetInstance()->SetActiveVirCIS(numberVir);
532+ }
533+
534+ // check the number of calculated excited states.
535+ int numberExcitedStates = Parameters::GetInstance()->GetActiveOccCIS()
536+ *Parameters::GetInstance()->GetActiveVirCIS();
537+ if(numberExcitedStates < Parameters::GetInstance()->GetNumberExcitedStatesCIS()){
538+ Parameters::GetInstance()->SetNumberExcitedStatesCIS(numberExcitedStates);
539+ }
540+ }
531541
532542 }
533543
@@ -561,10 +571,10 @@ void InputParser::OutputCisConditions(){
561571 printf("%s%d\n",this->messageCisNumberExcitedStates.c_str(),Parameters::GetInstance()->GetNumberExcitedStatesCIS());
562572 printf("%s",this->messageCisDavidson.c_str());
563573 if(Parameters::GetInstance()->GetIsDavidsonCIS()){
564- printf("%s\n",this->messageYES.c_str());
574+ printf("%s\n",this->stringYES.c_str());
565575 }
566576 else{
567- printf("%s\n",this->messageNO.c_str());
577+ printf("%s\n",this->stringNO.c_str());
568578 }
569579
570580 cout << "\n";
--- a/src/input.in
+++ b/src/input.in
@@ -19,7 +19,7 @@ SCF
1919 SCF_END
2020
2121 CIS
22- davidson no
22+ davidson yes
2323 activeOcc 2
2424 activeVir 2
2525 nstates 1000
--- a/src/zindo/ZindoS.h
+++ b/src/zindo/ZindoS.h
@@ -37,6 +37,9 @@ protected:
3737 virtual double GetMolecularIntegralElement(int moI, int moJ, int moK, int moL,
3838 Molecule* molecule, double** fockMatrix, double** gammaAB);
3939 private:
40+ double** matrixCIS;
41+ double* excitedEnergies;
42+ int matrixCISdimension;
4043 double GetCoulombInt(OrbitalType orbital1,
4144 OrbitalType orbital2,
4245 Atom* atom); // Apendix in [BZ_1979]
@@ -45,6 +48,8 @@ private:
4548 Atom* atom); // Apendix in [BZ_1979]
4649 double GetNishimotoMatagaTwoEleInt(Atom* atomA, OrbitalType orbitalA,
4750 Atom* atomB, OrbitalType orbitalB); // ref. [MN_1957] and (5a) in [AEZ_1986]
51+ void DoesCISDirect();
52+ void DoesCISDavidson();
4853 string errorMessageNishimotoMataga;
4954 string messageStartCIS;
5055 string messageDoneCIS;
@@ -54,10 +59,21 @@ ZindoS::ZindoS() : MolDS_cndo::Cndo2(){
5459 this->theory = ZINDOS;
5560 this->SetMessages();
5661 this->SetEnableAtomTypes();
62+ this->matrixCIS = NULL;
63+ this->excitedEnergies = NULL;
64+ this->matrixCISdimension = 0;
5765 //cout << "ZindoS created\n";
5866 }
5967
6068 ZindoS::~ZindoS(){
69+ if(this->matrixCIS != NULL){
70+ MallocerFreer::GetInstance()->FreeDoubleMatrix2d(&this->matrixCIS, this->matrixCISdimension);
71+ //cout << "matrixCIS deleted\n";
72+ }
73+ if(this->excitedEnergies != NULL){
74+ MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&this->excitedEnergies);
75+ //cout << "exceitedEnergies deleted\n";
76+ }
6177 //cout << "ZindoS deleted\n";
6278 }
6379
@@ -601,16 +617,56 @@ double ZindoS::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL,
601617 return value;
602618 }
603619
604-
605620 void ZindoS::DoesCIS(){
606621 cout << this->messageStartCIS;
607622
623+ if(Parameters::GetInstance()->GetIsDavidsonCIS()){
624+ this->DoesCISDavidson();
625+ }
626+ else{
627+ this->DoesCISDirect();
628+ }
629+
630+ // output eigen energies
631+ for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){
632+ printf("%d-th excited energy: %e\n",k+1, this->excitedEnergies[k]);
633+ }
634+ cout << endl;
635+ cout << this->messageDoneCIS;
636+}
637+
638+void ZindoS::DoesCISDavidson(){
639+ // ToDo: CIS-Davidson
640+ stringstream ss;
641+ ss << "CIS-Davidson (ZindoS::DoesCISDavidson()) is not implemented yet.\n\n";
642+ throw MolDSException(ss.str());
643+}
644+
645+void ZindoS::DoesCISDirect(){
646+
608647 int numberOcc = Parameters::GetInstance()->GetActiveOccCIS();
609648 int numberVir = Parameters::GetInstance()->GetActiveVirCIS();
610649 int numberExcitedStates = Parameters::GetInstance()->GetNumberExcitedStatesCIS();
611650
612- double** matrixCIS = MallocerFreer::GetInstance()->MallocDoubleMatrix2d(numberExcitedStates, numberExcitedStates);
613- double* excitedEnergies = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(numberExcitedStates);
651+ // malloc CIS matrix
652+ if(this->matrixCIS == NULL){
653+ this->matrixCISdimension = numberExcitedStates;
654+ this->matrixCIS = MallocerFreer::GetInstance()->MallocDoubleMatrix2d(this->matrixCISdimension,
655+ this->matrixCISdimension);
656+ }
657+ else{
658+ MallocerFreer::GetInstance()->InitializeDoubleMatrix2d(this->matrixCIS,
659+ this->matrixCISdimension,
660+ this->matrixCISdimension);
661+ }
662+
663+ // malloc CIS eigen vector
664+ if(this->excitedEnergies == NULL){
665+ this->excitedEnergies = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(this->matrixCISdimension);
666+ }
667+ else{
668+ MallocerFreer::GetInstance()->InitializeDoubleMatrix1d(this->excitedEnergies, this->matrixCISdimension);
669+ }
614670
615671 double value=0.0;
616672 int moI;
@@ -647,7 +703,7 @@ void ZindoS::DoesCIS(){
647703 this->molecule, this->fockMatrix, NULL);
648704 }
649705
650- matrixCIS[k][l] = value;
706+ this->matrixCIS[k][l] = value;
651707 l++;
652708 }
653709 }
@@ -656,27 +712,11 @@ void ZindoS::DoesCIS(){
656712 }
657713
658714 bool calcEigenVectors = true;
659- MolDS_mkl_wrapper::LapackWrapper::GetInstance()->Dsyevd(matrixCIS,
660- excitedEnergies,
661- numberExcitedStates,
715+ MolDS_mkl_wrapper::LapackWrapper::GetInstance()->Dsyevd(this->matrixCIS,
716+ this->excitedEnergies,
717+ this->matrixCISdimension,
662718 calcEigenVectors);
663719
664- // output eigen energies
665- for(int k=0; k<numberExcitedStates; k++){
666- printf("%d-th excited energy: %e\n",k+1, excitedEnergies[k]);
667- }
668- cout << endl;
669-
670- if(matrixCIS != NULL){
671- MallocerFreer::GetInstance()->FreeDoubleMatrix2d(&matrixCIS, numberExcitedStates);
672- //cout << "matrixCIS deleted\n";
673- }
674- if(excitedEnergies != NULL){
675- MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&excitedEnergies);
676- //cout << "exceitedEnergies deleted\n";
677- }
678-
679- cout << this->messageDoneCIS;
680720 }
681721
682722