• 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

Revisionb939902d293d262e2de4a8ee0bd726eabe5d21ce (tree)
Zeit2012-11-16 18:03:52
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Parallelization of calculation of the dipole moment of the ground state is modified to be more efficient for many core machines. #30111

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

Ändern Zusammenfassung

Diff

--- a/src/cndo/Cndo2.cpp
+++ b/src/cndo/Cndo2.cpp
@@ -1660,30 +1660,18 @@ void Cndo2::CalcElectronicDipoleMomentGroundState(double*** electronicTransition
16601660 double const* const* orbitalElectronPopulation,
16611661 double const* const* overlapAOs) const{
16621662 int groundState = 0;
1663- stringstream ompErrors;
1664-#pragma omp parallel for schedule(auto)
16651663 for(int axis=0; axis<CartesianType_end; axis++){
1666- try{
1667- electronicTransitionDipoleMoments[groundState][groundState][axis] = this->GetElectronicTransitionDipoleMoment(
1668- groundState,
1669- groundState,
1670- static_cast<CartesianType>(axis),
1671- NULL,
1672- NULL,
1673- cartesianMatrix,
1674- molecule,
1675- orbitalElectronPopulation,
1676- overlapAOs,
1677- NULL);
1678- }
1679- catch(MolDSException ex){
1680-#pragma omp critical
1681- ompErrors << ex.what() << endl ;
1682- }
1683- }
1684- // Exception throwing for omp-region
1685- if(!ompErrors.str().empty()){
1686- throw MolDSException(ompErrors.str());
1664+ electronicTransitionDipoleMoments[groundState][groundState][axis] = this->GetElectronicTransitionDipoleMoment(
1665+ groundState,
1666+ groundState,
1667+ static_cast<CartesianType>(axis),
1668+ NULL,
1669+ NULL,
1670+ cartesianMatrix,
1671+ molecule,
1672+ orbitalElectronPopulation,
1673+ overlapAOs,
1674+ NULL);
16871675 }
16881676 }
16891677
@@ -1695,16 +1683,31 @@ double Cndo2::GetElectronicTransitionDipoleMoment(int to, int from, CartesianTyp
16951683 double const* const* orbitalElectronPopulation,
16961684 double const* const* overlapAOs,
16971685 double const* groundStateDipole) const{
1698- double value = 0.0;
16991686 int groundState = 0;
17001687 if(from == groundState && to == groundState){
1688+ double value = 0.0;
17011689 int totalAONumber = molecule.GetTotalNumberAOs();
1690+ stringstream ompErrors;
1691+#pragma omp parallel for reduction(+:value) schedule(auto)
17021692 for(int mu=0; mu<totalAONumber; mu++){
1703- for(int nu=0; nu<totalAONumber; nu++){
1704- value -= orbitalElectronPopulation[mu][nu]
1705- *(cartesianMatrix[mu][nu][axis]-molecule.GetXyzCOC()[axis]*overlapAOs[mu][nu]);
1693+ try{
1694+ double threadValue = 0.0;
1695+ for(int nu=0; nu<totalAONumber; nu++){
1696+ threadValue -= orbitalElectronPopulation[mu][nu]
1697+ *(cartesianMatrix[mu][nu][axis]-molecule.GetXyzCOC()[axis]*overlapAOs[mu][nu]);
1698+ }
1699+ value += threadValue;
1700+ }
1701+ catch(MolDSException ex){
1702+#pragma omp critical
1703+ ompErrors << ex.what() << endl ;
17061704 }
17071705 }
1706+ // Exception throwing for omp-region
1707+ if(!ompErrors.str().empty()){
1708+ throw MolDSException(ompErrors.str());
1709+ }
1710+ return value;
17081711 }
17091712 else{
17101713 stringstream ss;
@@ -1714,7 +1717,6 @@ double Cndo2::GetElectronicTransitionDipoleMoment(int to, int from, CartesianTyp
17141717 ss << this->errorMessageCartesianType << CartesianTypeStr(axis) << endl;
17151718 throw MolDSException(ss.str());
17161719 }
1717- return value;
17181720 }
17191721
17201722 // calculate Cartesian matrix between atomic orbitals.