• 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

Revision143e654dcf4f112797a2f8988915cde5d94931ba (tree)
Time2013-01-31 00:15:05
AuthorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Refactoring #30617

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

Change Summary

Incremental Difference

--- a/src/Makefile
+++ b/src/Makefile
@@ -21,7 +21,7 @@ CC = icpc
2121 LIBSBASE = -lmkl_intel_thread -lmkl_core -liomp5 -lpthread
2222 LIBS32 = -lmkl_intel $(LIBSBASE)
2323 LIBS64 = -lmkl_intel_ilp64 $(LIBSBASE)
24-CFLAGSBASE = -O0 -openmp -openmp-report2 -DMKL_INT=intptr_t
24+CFLAGSBASE = -O2 -g -openmp -openmp-report2 -DMKL_INT=intptr_t
2525 CFLAGS32 = $(CFLAGSBASE)
2626 CFLAGS64 = $(CFLAGSBASE) -DMKL_ILP64
2727 BOOST_TOP_DIR = /usr/local/boost/
--- a/src/cndo/Cndo2.cpp
+++ b/src/cndo/Cndo2.cpp
@@ -114,9 +114,9 @@ Cndo2::~Cndo2(){
114114 this->molecule->GetTotalNumberAOs(),
115115 this->molecule->GetTotalNumberAOs());
116116 MallocerFreer::GetInstance()->Free<double>(&this->cartesianMatrix,
117+ CartesianType_end,
117118 this->molecule->GetTotalNumberAOs(),
118- this->molecule->GetTotalNumberAOs(),
119- CartesianType_end);
119+ this->molecule->GetTotalNumberAOs());
120120 int electronicTransitionDipoleMomentsDim = 1;
121121 if(Parameters::GetInstance()->RequiresCIS()){
122122 electronicTransitionDipoleMomentsDim += Parameters::GetInstance()->GetNumberExcitedStatesCIS();
@@ -278,9 +278,9 @@ void Cndo2::SetMolecule(Molecule* molecule){
278278 this->molecule->GetTotalNumberAOs(),
279279 this->molecule->GetTotalNumberAOs());
280280 MallocerFreer::GetInstance()->Malloc<double>(&this->cartesianMatrix,
281+ CartesianType_end,
281282 this->molecule->GetTotalNumberAOs(),
282- this->molecule->GetTotalNumberAOs(),
283- CartesianType_end);
283+ this->molecule->GetTotalNumberAOs());
284284 int electronicTransitionDipoleMomentsDim = 1;
285285 if(Parameters::GetInstance()->RequiresCIS()){
286286 electronicTransitionDipoleMomentsDim += Parameters::GetInstance()->GetNumberExcitedStatesCIS();
@@ -1690,11 +1690,11 @@ void Cndo2::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment,
16901690 double threadValueZ = 0.0;
16911691 for(int nu=0; nu<totalAONumber; nu++){
16921692 threadValueX -= orbitalElectronPopulation[mu][nu]
1693- *(cartesianMatrix[mu][nu][XAxis]-xyzCOC[XAxis]*overlapAOs[mu][nu]);
1693+ *(cartesianMatrix[XAxis][mu][nu]-xyzCOC[XAxis]*overlapAOs[mu][nu]);
16941694 threadValueY -= orbitalElectronPopulation[mu][nu]
1695- *(cartesianMatrix[mu][nu][YAxis]-xyzCOC[YAxis]*overlapAOs[mu][nu]);
1695+ *(cartesianMatrix[YAxis][mu][nu]-xyzCOC[YAxis]*overlapAOs[mu][nu]);
16961696 threadValueZ -= orbitalElectronPopulation[mu][nu]
1697- *(cartesianMatrix[mu][nu][ZAxis]-xyzCOC[ZAxis]*overlapAOs[mu][nu]);
1697+ *(cartesianMatrix[ZAxis][mu][nu]-xyzCOC[ZAxis]*overlapAOs[mu][nu]);
16981698 }
16991699 valueX += threadValueX;
17001700 valueY += threadValueY;
@@ -1743,15 +1743,10 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix,
17431743 for(int b=0; b<atomB.GetValenceSize(); b++){
17441744 int mu = firstAOIndexAtomA + a;
17451745 int nu = firstAOIndexAtomB + b;
1746- for(int i=0; i<CartesianType_end; i++){
1747- double value = this->GetCartesianMatrixElementByGTOExpansion(atomA,
1748- a,
1749- atomB,
1750- b,
1751- static_cast<CartesianType>(i),
1752- stonG);
1753- cartesianMatrix[mu][nu][i] = value;
1754- }
1746+ this->CalcCartesianMatrixElementsByGTOExpansion(cartesianMatrix[XAxis][mu][nu],
1747+ cartesianMatrix[YAxis][mu][nu],
1748+ cartesianMatrix[ZAxis][mu][nu],
1749+ atomA, a, atomB, b, stonG);
17551750 }
17561751 }
17571752
@@ -1766,28 +1761,19 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix,
17661761 if(!ompErrors.str().empty()){
17671762 throw MolDSException(ompErrors.str());
17681763 }
1769- /*
1770- this->OutputLog("cartesian matrix\n");
1771- for(int o=0; o<molecule.GetTotalNumberAOs(); o++){
1772- for(int p=0; p<molecule.GetTotalNumberAOs(); p++){
1773- for(int i=0; i<CartesianType_end; i++){
1774- this->OutputLog(boost::format("%lf\t") % cartesianMatrix[o][p][i]);
1775- }
1776- this->OutputLog("\n");
1777- }
1778- this->OutputLog("\n");
1779- }
1780- this->OutputLog("\n");
1781- */
17821764 }
17831765
17841766 // Calculate elements of Cartesian matrix between atomic orbitals.
17851767 // The analytic Cartesian matrix is calculated with Gaussian expansion technique written in [DY_1977]
1786-double Cndo2::GetCartesianMatrixElementByGTOExpansion(const Atom& atomA, int valenceIndexA,
1768+void Cndo2::CalcCartesianMatrixElementsByGTOExpansion(double& xComponent,
1769+ double& yComponent,
1770+ double& zComponent,
1771+ const Atom& atomA, int valenceIndexA,
17871772 const Atom& atomB, int valenceIndexB,
1788- CartesianType axis,
17891773 STOnGType stonG) const{
1790- double value = 0.0;
1774+ xComponent=0.0;
1775+ yComponent=0.0;
1776+ zComponent=0.0;
17911777 ShellType shellTypeA = atomA.GetValenceShellType();
17921778 ShellType shellTypeB = atomB.GetValenceShellType();
17931779 OrbitalType valenceOrbitalA = atomA.GetValence(valenceIndexA);
@@ -1803,7 +1789,10 @@ double Cndo2::GetCartesianMatrixElementByGTOExpansion(const Atom& atomA, int val
18031789 double Rab = sqrt( pow(atomA.GetXyz()[XAxis]-atomB.GetXyz()[XAxis], 2.0)
18041790 +pow(atomA.GetXyz()[YAxis]-atomB.GetXyz()[YAxis], 2.0)
18051791 +pow(atomA.GetXyz()[ZAxis]-atomB.GetXyz()[ZAxis], 2.0) );
1806- double temp = 0.0;
1792+ double temp = 0.0;
1793+ double tempX = 0.0;
1794+ double tempY = 0.0;
1795+ double tempZ = 0.0;
18071796 for(int i=0; i<=stonG; i++){
18081797 for(int j=0; j<=stonG; j++){
18091798 temp = GTOExpansionSTO::GetInstance()->GetCoefficient(stonG,
@@ -1824,20 +1813,23 @@ double Cndo2::GetCartesianMatrixElementByGTOExpansion(const Atom& atomA, int val
18241813 shellTypeB,
18251814 valenceOrbitalB,
18261815 j);
1827- temp *= this->GetGaussianCartesianMatrix(atomA.GetAtomType(),
1828- valenceOrbitalA,
1829- gaussianExponentA,
1830- atomA.GetXyz(),
1831- atomB.GetAtomType(),
1832- valenceOrbitalB,
1833- gaussianExponentB,
1834- atomB.GetXyz(),
1816+ tempX = this->GetGaussianCartesianMatrix(atomA.GetAtomType(), valenceOrbitalA, gaussianExponentA, atomA.GetXyz(),
1817+ atomB.GetAtomType(), valenceOrbitalB, gaussianExponentB, atomB.GetXyz(),
18351818 Rab,
1836- axis);
1837- value += temp;
1819+ XAxis);
1820+ tempY = this->GetGaussianCartesianMatrix(atomA.GetAtomType(), valenceOrbitalA, gaussianExponentA, atomA.GetXyz(),
1821+ atomB.GetAtomType(), valenceOrbitalB, gaussianExponentB, atomB.GetXyz(),
1822+ Rab,
1823+ YAxis);
1824+ tempZ = this->GetGaussianCartesianMatrix(atomA.GetAtomType(), valenceOrbitalA, gaussianExponentA, atomA.GetXyz(),
1825+ atomB.GetAtomType(), valenceOrbitalB, gaussianExponentB, atomB.GetXyz(),
1826+ Rab,
1827+ ZAxis);
1828+ xComponent += temp*tempX;
1829+ yComponent += temp*tempY;
1830+ zComponent += temp*tempZ;
18381831 }
18391832 }
1840- return value;
18411833 }
18421834
18431835 // calculate gaussian Caretesian integrals.
--- a/src/cndo/Cndo2.h
+++ b/src/cndo/Cndo2.h
@@ -344,11 +344,13 @@ private:
344344 void CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix,
345345 const MolDS_base::Molecule& molecule,
346346 MolDS_base::STOnGType stonG) const;
347- double GetCartesianMatrixElementByGTOExpansion(const MolDS_base_atoms::Atom& atomA,
347+ void CalcCartesianMatrixElementsByGTOExpansion(double& xComponent,
348+ double& yComponent,
349+ double& zComponent,
350+ const MolDS_base_atoms::Atom& atomA,
348351 int valenceIndexA,
349352 const MolDS_base_atoms::Atom& atomB,
350353 int valenceIndexB,
351- MolDS_base::CartesianType axis,
352354 MolDS_base::STOnGType stonG) const;
353355 double GetGaussianCartesianMatrix(MolDS_base::AtomType atomTypeA,
354356 MolDS_base::OrbitalType valenceOrbitalA,
--- a/src/zindo/ZindoS.cpp
+++ b/src/zindo/ZindoS.cpp
@@ -1144,9 +1144,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
11441144 for(int mu=0; mu<totalNumberAOs; mu++){
11451145 for(int nu=0; nu<totalNumberAOs; nu++){
11461146 temp = (-1.0*fockMatrix[moI][mu]*fockMatrix[moI][nu] + fockMatrix[moA][mu]*fockMatrix[moA][nu]);
1147- tempX += temp*(cartesianMatrix[mu][nu][XAxis] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1148- tempY += temp*(cartesianMatrix[mu][nu][YAxis] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1149- tempZ += temp*(cartesianMatrix[mu][nu][ZAxis] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
1147+ tempX += temp*(cartesianMatrix[XAxis][mu][nu] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1148+ tempY += temp*(cartesianMatrix[YAxis][mu][nu] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1149+ tempZ += temp*(cartesianMatrix[ZAxis][mu][nu] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
11501150 }
11511151 }
11521152 temp = matrixCIS[from-1][l]*matrixCIS[to-1][l];
@@ -1182,9 +1182,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
11821182 for(int mu=0; mu<totalNumberAOs; mu++){
11831183 for(int nu=0; nu<totalNumberAOs; nu++){
11841184 temp = fockMatrix[moA][mu]*fockMatrix[moI][nu];
1185- tempX += temp*(cartesianMatrix[mu][nu][XAxis] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1186- tempY += temp*(cartesianMatrix[mu][nu][YAxis] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1187- tempZ += temp*(cartesianMatrix[mu][nu][ZAxis] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
1185+ tempX += temp*(cartesianMatrix[XAxis][mu][nu] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1186+ tempY += temp*(cartesianMatrix[YAxis][mu][nu] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1187+ tempZ += temp*(cartesianMatrix[ZAxis][mu][nu] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
11881188 }
11891189 }
11901190 temp = this->matrixCIS[to-1][l]*sqrt(2.0);
@@ -1220,9 +1220,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
12201220 for(int mu=0; mu<totalNumberAOs; mu++){
12211221 for(int nu=0; nu<totalNumberAOs; nu++){
12221222 temp = fockMatrix[moI][mu]*fockMatrix[moA][nu];
1223- tempX += temp*(cartesianMatrix[mu][nu][XAxis] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1224- tempY += temp*(cartesianMatrix[mu][nu][YAxis] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1225- tempZ += temp*(cartesianMatrix[mu][nu][ZAxis] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
1223+ tempX += temp*(cartesianMatrix[XAxis][mu][nu] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1224+ tempY += temp*(cartesianMatrix[YAxis][mu][nu] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1225+ tempZ += temp*(cartesianMatrix[ZAxis][mu][nu] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
12261226 }
12271227 }
12281228 temp = matrixCIS[from-1][l]*sqrt(2.0);
@@ -1260,9 +1260,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
12601260 for(int mu=0; mu<totalNumberAOs; mu++){
12611261 for(int nu=0; nu<totalNumberAOs; nu++){
12621262 temp = (-1.0*fockMatrix[moI][mu]*fockMatrix[moI][nu] + fockMatrix[moA][mu]*fockMatrix[moA][nu]);
1263- tempX += temp*(cartesianMatrix[mu][nu][XAxis] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1264- tempY += temp*(cartesianMatrix[mu][nu][YAxis] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1265- tempZ += temp*(cartesianMatrix[mu][nu][ZAxis] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
1263+ tempX += temp*(cartesianMatrix[XAxis][mu][nu] - xyzCOC[XAxis]*overlapAOs[mu][nu]);
1264+ tempY += temp*(cartesianMatrix[YAxis][mu][nu] - xyzCOC[YAxis]*overlapAOs[mu][nu]);
1265+ tempZ += temp*(cartesianMatrix[ZAxis][mu][nu] - xyzCOC[ZAxis]*overlapAOs[mu][nu]);
12661266 }
12671267 }
12681268 temp = matrixCIS[from-1][l]*matrixCIS[to-1][l];