修訂 | 980ca2b2113838f3f9ab94c1c88630b0680f6ae3 (tree) |
---|---|
時間 | 2012-11-02 19:35:07 |
作者 | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Cndo2 & ZindoS::CalcOverlapESsWithAnotherElectronicStructure is implemented. #28791
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1103 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -45,6 +45,9 @@ public: | ||
45 | 45 | const MolDS_base::ElectronicStructure& lhsElectronicStructure) const = 0; |
46 | 46 | virtual void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs, |
47 | 47 | double const* const* overlapMOs) const = 0; |
48 | + virtual void CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | |
49 | + double const* const* overlapSingletSDs, | |
50 | + const MolDS_base::ElectronicStructure& lhsElectronicStructure) const = 0; | |
48 | 51 | |
49 | 52 | }; |
50 | 53 |
@@ -3625,6 +3625,20 @@ void Cndo2::CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlap | ||
3625 | 3625 | throw MolDSException(ss.str()); |
3626 | 3626 | } |
3627 | 3627 | |
3628 | +// calculate overlapESs (ES means eigenstate) matrix between different electronic-structure, S^{ES}_{ij}. | |
3629 | +// i and j are singlet SDs belonging to left and right hand side electronic-structures, respectively. | |
3630 | +// The index i=0 means the ground state. | |
3631 | +// This overlapESs is calculated from the overlapsingletSDs. | |
3632 | +// Note that rhs-electronic-structure is this electronic-structure | |
3633 | +// and lhs-electronic-structure is another electronic-structure. | |
3634 | +void Cndo2::CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | |
3635 | + double const* const* overlapSingletSDs, | |
3636 | + const MolDS_base::ElectronicStructure& lhsElectronicStructure) const{ | |
3637 | + stringstream ss; | |
3638 | + ss << this->errorMessageNonExcitedStates; | |
3639 | + throw MolDSException(ss.str()); | |
3640 | +} | |
3641 | + | |
3628 | 3642 | // calculate OverlapAOs matrix. E.g. S_{\mu\nu} in (3.74) in J. A. Pople book. |
3629 | 3643 | void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{ |
3630 | 3644 | int totalAONumber = molecule.GetTotalNumberAOs(); |
@@ -48,6 +48,9 @@ public: | ||
48 | 48 | const MolDS_base::ElectronicStructure& lhsElectronicStructure) const; |
49 | 49 | virtual void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs, |
50 | 50 | double const* const* overlapMOs) const; |
51 | + virtual void CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | |
52 | + double const* const* overlapSingletSDs, | |
53 | + const MolDS_base::ElectronicStructure& lhsElectronicStructure) const; | |
51 | 54 | MolDS_base::TheoryType GetTheoryType() const; |
52 | 55 | protected: |
53 | 56 | std::string errorMessageAtomA; |
@@ -142,7 +142,7 @@ void NASCO::DoNASCO(Molecule& molecule){ | ||
142 | 142 | // update momenta |
143 | 143 | this->UpdateMomenta(molecule, matrixForce, dt); |
144 | 144 | |
145 | - // calculate overlaps | |
145 | + // calculate overlaps | |
146 | 146 | currentES->CalcOverlapAOsWithAnotherConfiguration(overlapAOs, tmpMolecule); |
147 | 147 | cout << "overlapAOs" << endl; |
148 | 148 | for(int i=0; i<molecule.GetTotalNumberAOs(); i++){ |
@@ -164,18 +164,28 @@ void NASCO::DoNASCO(Molecule& molecule){ | ||
164 | 164 | cout << endl; |
165 | 165 | |
166 | 166 | currentES->CalcOverlapSingletSDsWithAnotherElectronicStructure(overlapSingletSDs, overlapMOs); |
167 | - int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
167 | + int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
168 | 168 | *Parameters::GetInstance()->GetActiveOccCIS() |
169 | 169 | +1; |
170 | 170 | cout << "overlap singlet slater determinants" << endl; |
171 | - for(int i=0; i<dimOverlapSingleSDs; i++){ | |
172 | - for(int j=0; j<dimOverlapSingleSDs; j++){ | |
171 | + for(int i=0; i<dimOverlapSingletSDs; i++){ | |
172 | + for(int j=0; j<dimOverlapSingletSDs; j++){ | |
173 | 173 | printf("%e\t",overlapSingletSDs[i][j]); |
174 | 174 | } |
175 | 175 | cout << endl; |
176 | 176 | } |
177 | 177 | cout << endl; |
178 | 178 | |
179 | + currentES->CalcOverlapESsWithAnotherElectronicStructure(overlapESs, overlapSingletSDs, *tmpES); | |
180 | + int dimOverlapESs = Parameters::GetInstance()->GetNumberElectronicStatesNASCO(); | |
181 | + cout << "overlapESs" << endl; | |
182 | + for(int i=0; i<dimOverlapESs; i++){ | |
183 | + for(int j=0; j<dimOverlapESs; j++){ | |
184 | + printf("%e\t",overlapESs[i][j]); | |
185 | + } | |
186 | + cout << endl; | |
187 | + } | |
188 | + cout << endl; | |
179 | 189 | |
180 | 190 | // Synchronous molecular configuration and electronic states |
181 | 191 | this->SynchronousMolecularConfiguration(molecule, tmpMolecule); |
@@ -326,14 +336,14 @@ void NASCO::MallocOverlapsDifferentMolecules(double*** overlapAOs, | ||
326 | 336 | const Molecule& molecule) const{ |
327 | 337 | int dimOverlapAOs = molecule.GetTotalNumberAOs(); |
328 | 338 | int dimOverlapMOs = dimOverlapAOs; |
329 | - int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
339 | + int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
330 | 340 | *Parameters::GetInstance()->GetActiveVirCIS() |
331 | 341 | +1; |
332 | 342 | int dimOverlapESs = Parameters::GetInstance()->GetNumberElectronicStatesNASCO(); |
333 | - MallocerFreer::GetInstance()->Malloc<double>(overlapAOs, dimOverlapAOs, dimOverlapAOs); | |
334 | - MallocerFreer::GetInstance()->Malloc<double>(overlapMOs, dimOverlapMOs, dimOverlapMOs); | |
335 | - MallocerFreer::GetInstance()->Malloc<double>(overlapSingletSDs, dimOverlapSingleSDs, dimOverlapSingleSDs); | |
336 | - MallocerFreer::GetInstance()->Malloc<double>(overlapESs, dimOverlapESs, dimOverlapESs); | |
343 | + MallocerFreer::GetInstance()->Malloc<double>(overlapAOs, dimOverlapAOs, dimOverlapAOs); | |
344 | + MallocerFreer::GetInstance()->Malloc<double>(overlapMOs, dimOverlapMOs, dimOverlapMOs); | |
345 | + MallocerFreer::GetInstance()->Malloc<double>(overlapSingletSDs, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
346 | + MallocerFreer::GetInstance()->Malloc<double>(overlapESs, dimOverlapESs, dimOverlapESs); | |
337 | 347 | } |
338 | 348 | |
339 | 349 | void NASCO::FreeOverlapsDifferentMolecules(double*** overlapAOs, |
@@ -343,14 +353,14 @@ void NASCO::FreeOverlapsDifferentMolecules(double*** overlapAOs, | ||
343 | 353 | const MolDS_base::Molecule& molecule) const{ |
344 | 354 | int dimOverlapAOs = molecule.GetTotalNumberAOs(); |
345 | 355 | int dimOverlapMOs = dimOverlapAOs; |
346 | - int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
356 | + int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS() | |
347 | 357 | *Parameters::GetInstance()->GetActiveVirCIS() |
348 | 358 | +1; |
349 | 359 | int dimOverlapESs = Parameters::GetInstance()->GetNumberElectronicStatesNASCO(); |
350 | - MallocerFreer::GetInstance()->Free<double>(overlapAOs, dimOverlapAOs, dimOverlapAOs); | |
351 | - MallocerFreer::GetInstance()->Free<double>(overlapMOs, dimOverlapMOs, dimOverlapMOs); | |
352 | - MallocerFreer::GetInstance()->Free<double>(overlapSingletSDs, dimOverlapSingleSDs, dimOverlapSingleSDs); | |
353 | - MallocerFreer::GetInstance()->Free<double>(overlapESs, dimOverlapESs, dimOverlapESs); | |
360 | + MallocerFreer::GetInstance()->Free<double>(overlapAOs, dimOverlapAOs, dimOverlapAOs); | |
361 | + MallocerFreer::GetInstance()->Free<double>(overlapMOs, dimOverlapMOs, dimOverlapMOs); | |
362 | + MallocerFreer::GetInstance()->Free<double>(overlapSingletSDs, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
363 | + MallocerFreer::GetInstance()->Free<double>(overlapESs, dimOverlapESs, dimOverlapESs); | |
354 | 364 | } |
355 | 365 | |
356 | 366 | } |
@@ -30,6 +30,7 @@ | ||
30 | 30 | #include"../base/PrintController.h" |
31 | 31 | #include"../base/MolDSException.h" |
32 | 32 | #include"../base/Uncopyable.h" |
33 | +#include"../wrappers/Blas.h" | |
33 | 34 | #include"../wrappers/Lapack.h" |
34 | 35 | #include"../base/Enums.h" |
35 | 36 | #include"../base/MathUtilities.h" |
@@ -763,6 +764,58 @@ void ZindoS::CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overla | ||
763 | 764 | MallocerFreer::GetInstance()->Free<double>(&tmpMatrix3, numberOcc, numberOcc); |
764 | 765 | } |
765 | 766 | |
767 | +// calculate overlapESs (ES means eigenstate) matrix between different electronic-structure, S^{ES}_{ij}. | |
768 | +// i and j are singlet SDs belonging to left and right hand side electronic-structures, respectively. | |
769 | +// The index i=0 means the ground state. | |
770 | +// This overlapESs is calculated from the overlapsingletSDs. | |
771 | +// Note that rhs-electronic-structure is this electronic-structure | |
772 | +// and lhs-electronic-structure is another electronic-structure. | |
773 | +void ZindoS::CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | |
774 | + double const* const* overlapSingletSDs, | |
775 | + const MolDS_base::ElectronicStructure& lhsElectronicStructure) const{ | |
776 | + const ElectronicStructure* rhsElectronicStructure = this; | |
777 | + double const* const* rhsMatrixCIS = this->matrixCIS; | |
778 | + double const* const* lhsMatrixCIS = lhsElectronicStructure.GetMatrixCIS(); | |
779 | + int dimOverlapSingletSDs = this->matrixCISdimension + 1; | |
780 | + int dimOverlapESs = Parameters::GetInstance()->GetNumberElectronicStatesNASCO(); | |
781 | + int groundstate = 0; | |
782 | + // extended CIS matrix includes groundstate althoug matrixCIS does not include groundstate. | |
783 | + double** lhsExtendedMatrixCIS=NULL; | |
784 | + double** rhsExtendedMatrixCIS=NULL; | |
785 | + double** tmpMatrix=NULL; | |
786 | + MallocerFreer::GetInstance()->Malloc<double>(&lhsExtendedMatrixCIS, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
787 | + MallocerFreer::GetInstance()->Malloc<double>(&rhsExtendedMatrixCIS, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
788 | + MallocerFreer::GetInstance()->Malloc<double>(&tmpMatrix, dimOverlapSingletSDs, dimOverlapESs); | |
789 | + lhsExtendedMatrixCIS[groundstate][groundstate] = 1.0; | |
790 | + rhsExtendedMatrixCIS[groundstate][groundstate] = 1.0; | |
791 | + for(int i=1; i<dimOverlapESs; i++){ | |
792 | + for(int j=1; j<dimOverlapSingletSDs; j++){ | |
793 | + rhsExtendedMatrixCIS[i][j] = rhsMatrixCIS[i-1][j-1]; | |
794 | + lhsExtendedMatrixCIS[i][j] = lhsMatrixCIS[i-1][j-1]; | |
795 | + } | |
796 | + } | |
797 | + // calc. overlap between eigenstates | |
798 | + bool isColumnMajorOverlapSingletSDs = false; | |
799 | + bool isColumnMajorRhsMatrixCIS = true; | |
800 | + double alpha=1.0; | |
801 | + double beta=0.0; | |
802 | + MolDS_wrappers::Blas::GetInstance()->Dgemm(isColumnMajorOverlapSingletSDs, | |
803 | + isColumnMajorRhsMatrixCIS, | |
804 | + dimOverlapSingletSDs, dimOverlapESs, dimOverlapSingletSDs, | |
805 | + alpha, | |
806 | + overlapSingletSDs, | |
807 | + rhsExtendedMatrixCIS, | |
808 | + beta, | |
809 | + tmpMatrix); | |
810 | + MolDS_wrappers::Blas::GetInstance()->Dgemm(dimOverlapESs, dimOverlapESs, dimOverlapSingletSDs, | |
811 | + lhsExtendedMatrixCIS, | |
812 | + tmpMatrix, | |
813 | + overlapESs); | |
814 | + MallocerFreer::GetInstance()->Free<double>(&lhsExtendedMatrixCIS, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
815 | + MallocerFreer::GetInstance()->Free<double>(&rhsExtendedMatrixCIS, dimOverlapSingletSDs, dimOverlapSingletSDs); | |
816 | + MallocerFreer::GetInstance()->Free<double>(&tmpMatrix, dimOverlapSingletSDs, dimOverlapESs); | |
817 | +} | |
818 | + | |
766 | 819 | // The order of mol, moJ, moK, moL is consistent with Eq. (9) in [RZ_1973] |
767 | 820 | double ZindoS::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, |
768 | 821 | const Molecule& molecule, |
@@ -31,6 +31,9 @@ public: | ||
31 | 31 | void OutputCISResults() const; |
32 | 32 | void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs, |
33 | 33 | double const* const* overlapMOs) const; |
34 | + void CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | |
35 | + double const* const* overlapSingletSDs, | |
36 | + const MolDS_base::ElectronicStructure& lhsElectronicStructure) const; | |
34 | 37 | protected: |
35 | 38 | std::string errorMessageDavidsonNotConverged; |
36 | 39 | std::string errorMessageCalcCISMatrix; |