Revision | b021082780f6838f050c52fb8debd5b9f8af2b26 (tree) |
---|---|
Zeit | 2012-12-03 23:10:35 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
mulliken of excited state is OMP-parallelized.# 28605
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1170 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -1320,34 +1320,46 @@ void ZindoS::CalcOrbitalElectronPopulationCIS(double**** orbitalElectronPopulati | ||
1320 | 1320 | int numberActiveVir = Parameters::GetInstance()->GetActiveVirCIS(); |
1321 | 1321 | for(int k=0; k<elecStates->size(); k++){ |
1322 | 1322 | int excitedStateIndex = (*elecStates)[k]-1; |
1323 | + stringstream ompErrors; | |
1324 | +#pragma omp parallel for schedule(auto) | |
1323 | 1325 | 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); | |
1343 | 1349 | } |
1344 | - value += matrixCIS[excitedStateIndex][slaterDeterminantIndex] | |
1345 | - *(fockMatrix[moA][mu]*tmpVal1 + fockMatrix[moI][nu]*tmpVal2); | |
1346 | 1350 | } |
1351 | + (*orbitalElectronPopulationCIS)[k][mu][nu] = value; | |
1347 | 1352 | } |
1348 | - (*orbitalElectronPopulationCIS)[k][mu][nu] = value; | |
1353 | + } | |
1354 | + catch(MolDSException ex){ | |
1355 | +#pragma omp critical | |
1356 | + ompErrors << ex.what() << endl ; | |
1349 | 1357 | } |
1350 | 1358 | } |
1359 | + // Exception throwing for omp-region | |
1360 | + if(!ompErrors.str().empty()){ | |
1361 | + throw MolDSException(ompErrors.str()); | |
1362 | + } | |
1351 | 1363 | } |
1352 | 1364 | } |
1353 | 1365 |
@@ -1372,12 +1384,24 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC | ||
1372 | 1384 | } |
1373 | 1385 | // clac atomic electron population |
1374 | 1386 | for(int k=0; k<elecStates->size(); k++){ |
1387 | + stringstream ompErrors; | |
1388 | +#pragma omp parallel for schedule(auto) | |
1375 | 1389 | 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 | + } | |
1380 | 1396 | } |
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()); | |
1381 | 1405 | } |
1382 | 1406 | } |
1383 | 1407 | } |