• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisionb021082780f6838f050c52fb8debd5b9f8af2b26 (tree)
Zeit2012-12-03 23:10:35
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

mulliken of excited state is OMP-parallelized.# 28605

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

Ändern Zusammenfassung

Diff

--- a/src/zindo/ZindoS.cpp
+++ b/src/zindo/ZindoS.cpp
@@ -1320,34 +1320,46 @@ void ZindoS::CalcOrbitalElectronPopulationCIS(double**** orbitalElectronPopulati
13201320 int numberActiveVir = Parameters::GetInstance()->GetActiveVirCIS();
13211321 for(int k=0; k<elecStates->size(); k++){
13221322 int excitedStateIndex = (*elecStates)[k]-1;
1323+ stringstream ompErrors;
1324+#pragma omp parallel for schedule(auto)
13231325 for(int mu=0; mu<molecule.GetTotalNumberAOs(); mu++){
1324- for(int nu=0; nu<molecule.GetTotalNumberAOs(); nu++){
1325- double value = orbitalElectronPopulation[mu][nu];
1326- for(int moI=0; moI<numberActiveOcc; moI++){
1327- for(int moA=numberOcc; moA<numberOcc+numberActiveVir; moA++){
1328- int slaterDeterminantIndex = this->GetSlaterDeterminantIndex(moI,moA);
1329- value += pow(matrixCIS[excitedStateIndex][slaterDeterminantIndex],2.0)
1330- *(-fockMatrix[moI][mu]*fockMatrix[moI][nu]
1331- +fockMatrix[moA][mu]*fockMatrix[moA][nu]);
1332- double tmpVal1=0.0;
1333- for(int moB=numberOcc; moB<numberOcc+numberActiveVir; moB++){
1334- if(moB==moA) continue;
1335- int tmpSDIndex = this->GetSlaterDeterminantIndex(moI,moB);
1336- tmpVal1 += matrixCIS[excitedStateIndex][tmpSDIndex]*fockMatrix[moB][nu];
1337- }
1338- double tmpVal2=0.0;
1339- for(int moJ=0; moJ<numberActiveOcc; moJ++){
1340- if(moJ==moI) continue;
1341- int tmpSDIndex = this->GetSlaterDeterminantIndex(moJ,moA);
1342- tmpVal2 += matrixCIS[excitedStateIndex][tmpSDIndex]*fockMatrix[moJ][mu];
1326+ try{
1327+ for(int nu=0; nu<molecule.GetTotalNumberAOs(); nu++){
1328+ double value = orbitalElectronPopulation[mu][nu];
1329+ for(int moI=0; moI<numberActiveOcc; moI++){
1330+ for(int moA=numberOcc; moA<numberOcc+numberActiveVir; moA++){
1331+ int slaterDeterminantIndex = this->GetSlaterDeterminantIndex(moI,moA);
1332+ value += pow(matrixCIS[excitedStateIndex][slaterDeterminantIndex],2.0)
1333+ *(-fockMatrix[moI][mu]*fockMatrix[moI][nu]
1334+ +fockMatrix[moA][mu]*fockMatrix[moA][nu]);
1335+ double tmpVal1=0.0;
1336+ for(int moB=numberOcc; moB<numberOcc+numberActiveVir; moB++){
1337+ if(moB==moA) continue;
1338+ int tmpSDIndex = this->GetSlaterDeterminantIndex(moI,moB);
1339+ tmpVal1 += matrixCIS[excitedStateIndex][tmpSDIndex]*fockMatrix[moB][nu];
1340+ }
1341+ double tmpVal2=0.0;
1342+ for(int moJ=0; moJ<numberActiveOcc; moJ++){
1343+ if(moJ==moI) continue;
1344+ int tmpSDIndex = this->GetSlaterDeterminantIndex(moJ,moA);
1345+ tmpVal2 += matrixCIS[excitedStateIndex][tmpSDIndex]*fockMatrix[moJ][mu];
1346+ }
1347+ value += matrixCIS[excitedStateIndex][slaterDeterminantIndex]
1348+ *(fockMatrix[moA][mu]*tmpVal1 + fockMatrix[moI][nu]*tmpVal2);
13431349 }
1344- value += matrixCIS[excitedStateIndex][slaterDeterminantIndex]
1345- *(fockMatrix[moA][mu]*tmpVal1 + fockMatrix[moI][nu]*tmpVal2);
13461350 }
1351+ (*orbitalElectronPopulationCIS)[k][mu][nu] = value;
13471352 }
1348- (*orbitalElectronPopulationCIS)[k][mu][nu] = value;
1353+ }
1354+ catch(MolDSException ex){
1355+#pragma omp critical
1356+ ompErrors << ex.what() << endl ;
13491357 }
13501358 }
1359+ // Exception throwing for omp-region
1360+ if(!ompErrors.str().empty()){
1361+ throw MolDSException(ompErrors.str());
1362+ }
13511363 }
13521364 }
13531365
@@ -1372,12 +1384,24 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC
13721384 }
13731385 // clac atomic electron population
13741386 for(int k=0; k<elecStates->size(); k++){
1387+ stringstream ompErrors;
1388+#pragma omp parallel for schedule(auto)
13751389 for(int a=0; a<totalNumberAtoms; a++){
1376- int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex();
1377- int numberAOs = molecule.GetAtom(a)->GetValenceSize();
1378- for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){
1379- (*atomicElectronPopulationCIS)[k][a] += orbitalElectronPopulationCIS[k][i][i];
1390+ try{
1391+ int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex();
1392+ int numberAOs = molecule.GetAtom(a)->GetValenceSize();
1393+ for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){
1394+ (*atomicElectronPopulationCIS)[k][a] += orbitalElectronPopulationCIS[k][i][i];
1395+ }
13801396 }
1397+ catch(MolDSException ex){
1398+#pragma omp critical
1399+ ompErrors << ex.what() << endl ;
1400+ }
1401+ }
1402+ // Exception throwing for omp-region
1403+ if(!ompErrors.str().empty()){
1404+ throw MolDSException(ompErrors.str());
13811405 }
13821406 }
13831407 }