• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

修订版77ae820d2e0ed5c791276d8946b7d1670009a93e (tree)
时间2011-11-16 07:11:21
作者Mikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

delta in Mndo::CalcZMatrixForce is modified. #26396

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

更改概述

差异

--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -773,19 +773,17 @@ void Mndo::CalcActiveSetVariablesQ(vector<MoIndexPair>* nonRedundantQIndeces,
773773 }
774774 }
775775
776-void Mndo::MallocTempMatrixForZMatrix(double*** delta,
777- double** q,
778- double*** kNR,
779- double*** kRDag,
780- double** y,
781- double** b,
782- int numElecStates,
783- int sizeQNR,
784- int sizeQR){
776+void Mndo::MallocTempMatrixForZMatrix(double** delta,
777+ double** q,
778+ double*** kNR,
779+ double*** kRDag,
780+ double** y,
781+ double** b,
782+ int sizeQNR,
783+ int sizeQR){
785784 int numberActiveMO = Parameters::GetInstance()->GetActiveOccCIS()
786785 +Parameters::GetInstance()->GetActiveVirCIS();
787- *delta = MallocerFreer::GetInstance()->MallocDoubleMatrix2d(
788- numElecStates,
786+ *delta = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(
789787 numberActiveMO);
790788 *q = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(
791789 sizeQNR+sizeQR);
@@ -801,17 +799,16 @@ void Mndo::MallocTempMatrixForZMatrix(double*** delta,
801799 sizeQNR);
802800 }
803801
804-void Mndo::FreeTempMatrixForZMatrix(double*** delta,
802+void Mndo::FreeTempMatrixForZMatrix(double** delta,
805803 double** q,
806804 double*** kNR,
807805 double*** kRDag,
808806 double** y,
809807 double** b,
810- int numElecStates,
811808 int sizeQNR,
812809 int sizeQR){
813810 if(*delta != NULL){
814- MallocerFreer::GetInstance()->FreeDoubleMatrix2d(delta, numElecStates);
811+ MallocerFreer::GetInstance()->FreeDoubleMatrix1d(delta);
815812 //cout << "delta deleted" << endl;
816813 }
817814 if(*q != NULL){
@@ -880,38 +877,36 @@ double Mndo::GetCISCoefficientTwoElecIntegral(int k,
880877 return value;
881878 }
882879
883-void Mndo::CalcDeltaVector(double** delta, vector<int> elecStates){
880+void Mndo::CalcDeltaVector(double* delta, int elecState){
884881 int numberActiveOcc = Parameters::GetInstance()->GetActiveOccCIS();
885882 int numberActiveVir = Parameters::GetInstance()->GetActiveVirCIS();
886883 int numberActiveMO = numberActiveOcc + numberActiveVir;
887- for(int n=0; n<elecStates.size(); n++){
888- for(int r=0; r<numberActiveMO; r++){
889- double value = 0.0;
890- if(r<numberActiveOcc){
891- // r is active occupied MO
892- for(int a=0; a<numberActiveVir; a++){
893- int slaterDeterminantIndex = numberActiveVir*r + a;
894- value -= pow(this->matrixCIS[elecStates[n]][slaterDeterminantIndex],2.0);
895- //c.f. The index of each MO (r and a)is below:
896- //int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2;
897- //int moR = numberOcc - (slaterDeterminantIndex/numberActiveVir) -1;
898- //int moA = numberOcc + (slaterDeterminantIndex%numberActiveVir);
899- }
900-
884+ MallocerFreer::GetInstance()->InitializeDoubleMatrix1d(delta, numberActiveMO);
885+ for(int r=0; r<numberActiveMO; r++){
886+ double value = 0.0;
887+ if(r<numberActiveOcc){
888+ // r is active occupied MO
889+ for(int a=0; a<numberActiveVir; a++){
890+ int slaterDeterminantIndex = numberActiveVir*r + a;
891+ value -= pow(this->matrixCIS[elecState][slaterDeterminantIndex],2.0);
892+ //c.f. The index of each MO (r and a)is below:
893+ //int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2;
894+ //int moR = numberOcc - (slaterDeterminantIndex/numberActiveVir) -1;
895+ //int moA = numberOcc + (slaterDeterminantIndex%numberActiveVir);
901896 }
902- else{
903- // r is active virtual MO
904- for(int i=0; i<numberActiveOcc; i++){
905- int slaterDeterminantIndex = numberActiveVir*i + (r-numberActiveOcc);
906- value += pow(this->matrixCIS[elecStates[n]][slaterDeterminantIndex],2.0);
907- //c.f. The index of each MO (i and r)is below:
908- //int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2;
909- //int moI = numberOcc - (slaterDeterminantIndex/numberActiveVir) -1;
910- //int moR = numberOcc + (slaterDeterminantIndex%numberActiveVir);
911- }
897+ }
898+ else{
899+ // r is active virtual MO
900+ for(int i=0; i<numberActiveOcc; i++){
901+ int slaterDeterminantIndex = numberActiveVir*i + (r-numberActiveOcc);
902+ value += pow(this->matrixCIS[elecState][slaterDeterminantIndex],2.0);
903+ //c.f. The index of each MO (i and r)is below:
904+ //int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2;
905+ //int moI = numberOcc - (slaterDeterminantIndex/numberActiveVir) -1;
906+ //int moR = numberOcc + (slaterDeterminantIndex%numberActiveVir);
912907 }
913- delta[n][r] = value;
914908 }
909+ delta[r] = value;
915910 }
916911 }
917912
@@ -930,7 +925,7 @@ void Mndo::CalcZMatrixForce(vector<int> elecStates){
930925 this->CalcActiveSetVariablesQ(&nonRedundantQIndeces, &redundantQIndeces);
931926
932927 // malloc temporary arraies
933- double** delta = NULL; // Delta matrix, see (9) in [PT_1997]
928+ double* delta = NULL; // Delta matrix, see (9) in [PT_1997]
934929 double* q = NULL; //// Q-vector in (19) in [PT_1997]
935930 double** kNR = NULL; // K_{NR} matrix, see (45) in [PT_1996]
936931 double** kRDag = NULL; // Daggar of K_{R} matrix, see (46) in [PT_1996]
@@ -942,14 +937,14 @@ void Mndo::CalcZMatrixForce(vector<int> elecStates){
942937 &kRDag,
943938 &y,
944939 &b,
945- elecStates.size(),
946940 nonRedundantQIndeces.size(),
947941 redundantQIndeces.size());
948942 try{
949- // delta
950- this->CalcDeltaVector(delta, elecStates);
951-
952-
943+ for(int n=0; n<elecStates.size(); n++){
944+ int elecState = elecStates[n];
945+ // delta
946+ this->CalcDeltaVector(delta, elecState);
947+ }
953948 }
954949 catch(MolDSException ex){
955950 this->FreeTempMatrixForZMatrix(&delta,
@@ -958,7 +953,6 @@ void Mndo::CalcZMatrixForce(vector<int> elecStates){
958953 &kRDag,
959954 &y,
960955 &b,
961- elecStates.size(),
962956 nonRedundantQIndeces.size(),
963957 redundantQIndeces.size());
964958 throw ex;
@@ -969,7 +963,6 @@ void Mndo::CalcZMatrixForce(vector<int> elecStates){
969963 &kRDag,
970964 &y,
971965 &b,
972- elecStates.size(),
973966 nonRedundantQIndeces.size(),
974967 redundantQIndeces.size());
975968 }
--- a/src/mndo/Mndo.h
+++ b/src/mndo/Mndo.h
@@ -88,25 +88,23 @@ private:
8888 double*** zMatrixForce;
8989 int zMatrixForceElecStatesNum;
9090 double heatsFormation;
91- void MallocTempMatrixForZMatrix(double*** delta,
91+ void MallocTempMatrixForZMatrix(double** delta,
9292 double** q,
9393 double*** kNR,
9494 double*** kRDag,
9595 double** y,
9696 double** b,
97- int numElecStates,
9897 int sizeQNR,
9998 int sizeQR);
100- void FreeTempMatrixForZMatrix(double*** delta,
99+ void FreeTempMatrixForZMatrix(double** delta,
101100 double** q,
102101 double*** kNR,
103102 double*** kRDag,
104103 double** y,
105104 double** b,
106- int numElecStates,
107105 int sizeQNR,
108106 int sizeQR);
109- void CalcDeltaVector(double** delta, std::vector<int> elecStates);
107+ void CalcDeltaVector(double* delta, int elecStates);
110108 void CalcZMatrixForce(std::vector<int> elecStates);
111109 double GetCISCoefficientMOEnergy(int k,
112110 int l,