• 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

Revision980ca2b2113838f3f9ab94c1c88630b0680f6ae3 (tree)
Time2012-11-02 19:35:07
AuthorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Cndo2 & ZindoS::CalcOverlapESsWithAnotherElectronicStructure is implemented. #28791

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

Change Summary

Incremental Difference

--- a/src/base/ElectronicStructure.h
+++ b/src/base/ElectronicStructure.h
@@ -45,6 +45,9 @@ public:
4545 const MolDS_base::ElectronicStructure& lhsElectronicStructure) const = 0;
4646 virtual void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs,
4747 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;
4851
4952 };
5053
--- a/src/cndo/Cndo2.cpp
+++ b/src/cndo/Cndo2.cpp
@@ -3625,6 +3625,20 @@ void Cndo2::CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlap
36253625 throw MolDSException(ss.str());
36263626 }
36273627
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+
36283642 // calculate OverlapAOs matrix. E.g. S_{\mu\nu} in (3.74) in J. A. Pople book.
36293643 void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{
36303644 int totalAONumber = molecule.GetTotalNumberAOs();
--- a/src/cndo/Cndo2.h
+++ b/src/cndo/Cndo2.h
@@ -48,6 +48,9 @@ public:
4848 const MolDS_base::ElectronicStructure& lhsElectronicStructure) const;
4949 virtual void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs,
5050 double const* const* overlapMOs) const;
51+ virtual void CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs,
52+ double const* const* overlapSingletSDs,
53+ const MolDS_base::ElectronicStructure& lhsElectronicStructure) const;
5154 MolDS_base::TheoryType GetTheoryType() const;
5255 protected:
5356 std::string errorMessageAtomA;
--- a/src/nasco/NASCO.cpp
+++ b/src/nasco/NASCO.cpp
@@ -142,7 +142,7 @@ void NASCO::DoNASCO(Molecule& molecule){
142142 // update momenta
143143 this->UpdateMomenta(molecule, matrixForce, dt);
144144
145- // calculate overlaps
145+ // calculate overlaps
146146 currentES->CalcOverlapAOsWithAnotherConfiguration(overlapAOs, tmpMolecule);
147147 cout << "overlapAOs" << endl;
148148 for(int i=0; i<molecule.GetTotalNumberAOs(); i++){
@@ -164,18 +164,28 @@ void NASCO::DoNASCO(Molecule& molecule){
164164 cout << endl;
165165
166166 currentES->CalcOverlapSingletSDsWithAnotherElectronicStructure(overlapSingletSDs, overlapMOs);
167- int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS()
167+ int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS()
168168 *Parameters::GetInstance()->GetActiveOccCIS()
169169 +1;
170170 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++){
173173 printf("%e\t",overlapSingletSDs[i][j]);
174174 }
175175 cout << endl;
176176 }
177177 cout << endl;
178178
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;
179189
180190 // Synchronous molecular configuration and electronic states
181191 this->SynchronousMolecularConfiguration(molecule, tmpMolecule);
@@ -326,14 +336,14 @@ void NASCO::MallocOverlapsDifferentMolecules(double*** overlapAOs,
326336 const Molecule& molecule) const{
327337 int dimOverlapAOs = molecule.GetTotalNumberAOs();
328338 int dimOverlapMOs = dimOverlapAOs;
329- int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS()
339+ int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS()
330340 *Parameters::GetInstance()->GetActiveVirCIS()
331341 +1;
332342 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);
337347 }
338348
339349 void NASCO::FreeOverlapsDifferentMolecules(double*** overlapAOs,
@@ -343,14 +353,14 @@ void NASCO::FreeOverlapsDifferentMolecules(double*** overlapAOs,
343353 const MolDS_base::Molecule& molecule) const{
344354 int dimOverlapAOs = molecule.GetTotalNumberAOs();
345355 int dimOverlapMOs = dimOverlapAOs;
346- int dimOverlapSingleSDs = Parameters::GetInstance()->GetActiveOccCIS()
356+ int dimOverlapSingletSDs = Parameters::GetInstance()->GetActiveOccCIS()
347357 *Parameters::GetInstance()->GetActiveVirCIS()
348358 +1;
349359 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);
354364 }
355365
356366 }
--- a/src/zindo/ZindoS.cpp
+++ b/src/zindo/ZindoS.cpp
@@ -30,6 +30,7 @@
3030 #include"../base/PrintController.h"
3131 #include"../base/MolDSException.h"
3232 #include"../base/Uncopyable.h"
33+#include"../wrappers/Blas.h"
3334 #include"../wrappers/Lapack.h"
3435 #include"../base/Enums.h"
3536 #include"../base/MathUtilities.h"
@@ -763,6 +764,58 @@ void ZindoS::CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overla
763764 MallocerFreer::GetInstance()->Free<double>(&tmpMatrix3, numberOcc, numberOcc);
764765 }
765766
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+
766819 // The order of mol, moJ, moK, moL is consistent with Eq. (9) in [RZ_1973]
767820 double ZindoS::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL,
768821 const Molecule& molecule,
--- a/src/zindo/ZindoS.h
+++ b/src/zindo/ZindoS.h
@@ -31,6 +31,9 @@ public:
3131 void OutputCISResults() const;
3232 void CalcOverlapSingletSDsWithAnotherElectronicStructure(double** overlapSingletSDs,
3333 double const* const* overlapMOs) const;
34+ void CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs,
35+ double const* const* overlapSingletSDs,
36+ const MolDS_base::ElectronicStructure& lhsElectronicStructure) const;
3437 protected:
3538 std::string errorMessageDavidsonNotConverged;
3639 std::string errorMessageCalcCISMatrix;