Revision | 332c5485ee9a3cca6a97b422f2857c9883f72f43 (tree) |
---|---|
Zeit | 2011-11-08 00:39:31 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
ZindoS::CalcForce is modified for secure use.
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@271 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -2,10 +2,10 @@ | ||
2 | 2 | THEORY |
3 | 3 | //cndo/2 |
4 | 4 | //indo |
5 | - //zindo/s | |
5 | + zindo/s | |
6 | 6 | //mndo |
7 | 7 | //am1 |
8 | - pm3 | |
8 | + //pm3 | |
9 | 9 | //none |
10 | 10 | //principal_axes |
11 | 11 | //translate |
@@ -71,6 +71,8 @@ protected: | ||
71 | 71 | virtual void CalcForce(vector<int> elecStates); |
72 | 72 | void CheckMatrixForce(vector<int> elecStates); |
73 | 73 | private: |
74 | + string errorMessageCalcForceNotGroundState; | |
75 | + string errorMessageElecState; | |
74 | 76 | double** matrixCIS; |
75 | 77 | double* excitedEnergies; |
76 | 78 | int matrixCISdimension; |
@@ -179,6 +181,9 @@ void ZindoS::SetMessages(){ | ||
179 | 181 | this->errorMessageDavidsonNotConverged = "Error in zindo::ZindoS::DoesCISDavidson: Davidson did not met convergence criterion. \n"; |
180 | 182 | this->errorMessageDavidsonMaxIter = "Davidson roop reaches max_iter="; |
181 | 183 | this->errorMessageDavidsonMaxDim = "Dimension of the expansion vectors reaches max_dim="; |
184 | + this->errorMessageCalcForceNotGroundState | |
185 | + = "Error in zindo::ZindoS::CalcForce: Only ground state is enable in ZindoS."; | |
186 | + this->errorMessageElecState = "Electronic State = "; | |
182 | 187 | this->messageSCFMetConvergence = "\n\n\n\t\tZINDO/S-SCF met convergence criterion(^^b\n\n\n"; |
183 | 188 | this->messageStartSCF = "********** START: ZINDO/S-SCF **********\n"; |
184 | 189 | this->messageDoneSCF = "********** DONE: ZINDO/S-SCF **********\n\n\n"; |
@@ -1444,6 +1449,15 @@ void ZindoS::CheckMatrixForce(vector<int> elecStates){ | ||
1444 | 1449 | // electronicStates is indeces of the electroinc eigen states. |
1445 | 1450 | // The index = 0 means electronic ground state. |
1446 | 1451 | void ZindoS::CalcForce(vector<int> elecStates){ |
1452 | + int elecState = elecStates[0]; | |
1453 | + int groundState = 0; | |
1454 | + if(elecState != groundState){ | |
1455 | + stringstream ss; | |
1456 | + ss << this->errorMessageCalcForceNotGroundState; | |
1457 | + ss << this->errorMessageElecState << elecState << "\n"; | |
1458 | + throw MolDSException(ss.str()); | |
1459 | + } | |
1460 | + | |
1447 | 1461 | this->CheckMatrixForce(elecStates); |
1448 | 1462 | #pragma omp parallel |
1449 | 1463 | { |
@@ -1501,10 +1515,10 @@ void ZindoS::CalcForce(vector<int> elecStates){ | ||
1501 | 1515 | } |
1502 | 1516 | } |
1503 | 1517 | for(int i=0; i<CartesianType_end; i++){ |
1504 | - this->matrixForce[0][a][i] = -1.0*(coreRepulsion[i] | |
1505 | - -electronicForce1[i] | |
1506 | - +electronicForce2[i] | |
1507 | - +electronicForce3[i]); | |
1518 | + this->matrixForce[elecState][a][i] = -1.0*(coreRepulsion[i] | |
1519 | + -electronicForce1[i] | |
1520 | + +electronicForce2[i] | |
1521 | + +electronicForce3[i]); | |
1508 | 1522 | } |
1509 | 1523 | } |
1510 | 1524 | } |