• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisãod51d744f71173991e4a401f4d94e6f436f3045ec (tree)
Hora2013-08-06 19:14:34
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Mensagem de Log

Refactoring of Mndo::CalcDiatomicTwoElecTwoCore to avoid huge number of calling the critical section in MallocerFreer::AddCurrentMalloced. #31814

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

Mudança Sumário

Diff

--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -3430,13 +3430,15 @@ void Mndo::CalcTwoElecTwoCore(double****** twoElecTwoCore,
34303430 #pragma omp parallel
34313431 {
34323432 double**** diatomicTwoElecTwoCore = NULL;
3433+ double** tmpRotMat = NULL;
34333434 try{
34343435 MallocerFreer::GetInstance()->Malloc<double>(&diatomicTwoElecTwoCore, dxy, dxy, dxy, dxy);
3436+ MallocerFreer::GetInstance()->Malloc<double>(&tmpRotMat, OrbitalType_end, OrbitalType_end);
34353437 // note that terms with condition a==b are not needed to calculate.
34363438 #pragma omp for schedule(auto)
34373439 for(int a=0; a<molecule.GetNumberAtoms(); a++){
34383440 for(int b=a+1; b<molecule.GetNumberAtoms(); b++){
3439- this->CalcDiatomicTwoElecTwoCore(diatomicTwoElecTwoCore, a, b);
3441+ this->CalcDiatomicTwoElecTwoCore(diatomicTwoElecTwoCore, tmpRotMat, a, b);
34403442 for(int mu=0; mu<dxy; mu++){
34413443 for(int nu=mu; nu<dxy; nu++){
34423444 for(int lambda=0; lambda<dxy; lambda++){
@@ -3462,6 +3464,7 @@ void Mndo::CalcTwoElecTwoCore(double****** twoElecTwoCore,
34623464 ex.Serialize(ompErrors);
34633465 }
34643466 MallocerFreer::GetInstance()->Free<double>(&diatomicTwoElecTwoCore, dxy, dxy, dxy, dxy);
3467+ MallocerFreer::GetInstance()->Free<double>(&tmpRotMat, OrbitalType_end, OrbitalType_end);
34653468 }
34663469 // Exception throwing for omp-region
34673470 if(!ompErrors.str().empty()){
@@ -3476,7 +3479,7 @@ void Mndo::CalcTwoElecTwoCore(double****** twoElecTwoCore,
34763479 // Note that atomA != atomB.
34773480 // Note taht d-orbital cannot be treated,
34783481 // that is, matrix[dxy][dxy][dxy][dxy] cannot be treatable.
3479-void Mndo::CalcDiatomicTwoElecTwoCore(double**** matrix, int indexAtomA, int indexAtomB) const{
3482+void Mndo::CalcDiatomicTwoElecTwoCore(double**** matrix, double** tmpRotMat, int indexAtomA, int indexAtomB) const{
34803483 const Atom& atomA = *this->molecule->GetAtom(indexAtomA);
34813484 const Atom& atomB = *this->molecule->GetAtom(indexAtomB);
34823485 if(indexAtomA == indexAtomB){
@@ -3513,20 +3516,9 @@ void Mndo::CalcDiatomicTwoElecTwoCore(double**** matrix, int indexAtomA, int ind
35133516 }
35143517 }
35153518 }
3516-
35173519 // rotate matirix into the space frame
3518- double** rotatingMatrix = NULL;
3519- try{
3520- MallocerFreer::GetInstance()->Malloc<double>(&rotatingMatrix,
3521- OrbitalType_end, OrbitalType_end);
3522- this->CalcRotatingMatrix(rotatingMatrix, atomA, atomB);
3523- this->RotateDiatomicTwoElecTwoCoreToSpaceFrame(matrix, rotatingMatrix);
3524- }
3525- catch(MolDSException ex){
3526- MallocerFreer::GetInstance()->Free<double>(&rotatingMatrix, OrbitalType_end, OrbitalType_end);
3527- throw ex;
3528- }
3529- MallocerFreer::GetInstance()->Free<double>(&rotatingMatrix, OrbitalType_end, OrbitalType_end);
3520+ this->CalcRotatingMatrix(tmpRotMat, atomA, atomB);
3521+ this->RotateDiatomicTwoElecTwoCoreToSpaceFrame(matrix, tmpRotMat);
35303522
35313523 /*
35323524 this->OutputLog("(mu, nu | lambda, sigma) matrix\n");
--- a/src/mndo/Mndo.h
+++ b/src/mndo/Mndo.h
@@ -296,7 +296,10 @@ private:
296296 int nu,
297297 double const* const* const* const* const* diatomicTwoElecTwoCore1stDerivatives,
298298 MolDS_base::CartesianType axisA) const;
299- void CalcDiatomicTwoElecTwoCore(double**** matrix, int indexAtomA, int indexAtomB) const;
299+ void CalcDiatomicTwoElecTwoCore(double**** matrix,
300+ double** tmpRotMat,
301+ int indexAtomA,
302+ int indexAtomB) const;
300303 void CalcDiatomicTwoElecTwoCore1stDerivatives(double***** matrix,
301304 double** tmpRotMat,
302305 double*** tmpRotMat1stDerivs,