Revision | 143e654dcf4f112797a2f8988915cde5d94931ba (tree) |
---|---|
Time | 2013-01-31 00:15:05 |
Author | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Refactoring #30617
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1270 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -21,7 +21,7 @@ CC = icpc | ||
21 | 21 | LIBSBASE = -lmkl_intel_thread -lmkl_core -liomp5 -lpthread |
22 | 22 | LIBS32 = -lmkl_intel $(LIBSBASE) |
23 | 23 | 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 | |
25 | 25 | CFLAGS32 = $(CFLAGSBASE) |
26 | 26 | CFLAGS64 = $(CFLAGSBASE) -DMKL_ILP64 |
27 | 27 | BOOST_TOP_DIR = /usr/local/boost/ |
@@ -114,9 +114,9 @@ Cndo2::~Cndo2(){ | ||
114 | 114 | this->molecule->GetTotalNumberAOs(), |
115 | 115 | this->molecule->GetTotalNumberAOs()); |
116 | 116 | MallocerFreer::GetInstance()->Free<double>(&this->cartesianMatrix, |
117 | + CartesianType_end, | |
117 | 118 | this->molecule->GetTotalNumberAOs(), |
118 | - this->molecule->GetTotalNumberAOs(), | |
119 | - CartesianType_end); | |
119 | + this->molecule->GetTotalNumberAOs()); | |
120 | 120 | int electronicTransitionDipoleMomentsDim = 1; |
121 | 121 | if(Parameters::GetInstance()->RequiresCIS()){ |
122 | 122 | electronicTransitionDipoleMomentsDim += Parameters::GetInstance()->GetNumberExcitedStatesCIS(); |
@@ -278,9 +278,9 @@ void Cndo2::SetMolecule(Molecule* molecule){ | ||
278 | 278 | this->molecule->GetTotalNumberAOs(), |
279 | 279 | this->molecule->GetTotalNumberAOs()); |
280 | 280 | MallocerFreer::GetInstance()->Malloc<double>(&this->cartesianMatrix, |
281 | + CartesianType_end, | |
281 | 282 | this->molecule->GetTotalNumberAOs(), |
282 | - this->molecule->GetTotalNumberAOs(), | |
283 | - CartesianType_end); | |
283 | + this->molecule->GetTotalNumberAOs()); | |
284 | 284 | int electronicTransitionDipoleMomentsDim = 1; |
285 | 285 | if(Parameters::GetInstance()->RequiresCIS()){ |
286 | 286 | electronicTransitionDipoleMomentsDim += Parameters::GetInstance()->GetNumberExcitedStatesCIS(); |
@@ -1690,11 +1690,11 @@ void Cndo2::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment, | ||
1690 | 1690 | double threadValueZ = 0.0; |
1691 | 1691 | for(int nu=0; nu<totalAONumber; nu++){ |
1692 | 1692 | threadValueX -= orbitalElectronPopulation[mu][nu] |
1693 | - *(cartesianMatrix[mu][nu][XAxis]-xyzCOC[XAxis]*overlapAOs[mu][nu]); | |
1693 | + *(cartesianMatrix[XAxis][mu][nu]-xyzCOC[XAxis]*overlapAOs[mu][nu]); | |
1694 | 1694 | threadValueY -= orbitalElectronPopulation[mu][nu] |
1695 | - *(cartesianMatrix[mu][nu][YAxis]-xyzCOC[YAxis]*overlapAOs[mu][nu]); | |
1695 | + *(cartesianMatrix[YAxis][mu][nu]-xyzCOC[YAxis]*overlapAOs[mu][nu]); | |
1696 | 1696 | threadValueZ -= orbitalElectronPopulation[mu][nu] |
1697 | - *(cartesianMatrix[mu][nu][ZAxis]-xyzCOC[ZAxis]*overlapAOs[mu][nu]); | |
1697 | + *(cartesianMatrix[ZAxis][mu][nu]-xyzCOC[ZAxis]*overlapAOs[mu][nu]); | |
1698 | 1698 | } |
1699 | 1699 | valueX += threadValueX; |
1700 | 1700 | valueY += threadValueY; |
@@ -1743,15 +1743,10 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, | ||
1743 | 1743 | for(int b=0; b<atomB.GetValenceSize(); b++){ |
1744 | 1744 | int mu = firstAOIndexAtomA + a; |
1745 | 1745 | 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); | |
1755 | 1750 | } |
1756 | 1751 | } |
1757 | 1752 |
@@ -1766,28 +1761,19 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, | ||
1766 | 1761 | if(!ompErrors.str().empty()){ |
1767 | 1762 | throw MolDSException(ompErrors.str()); |
1768 | 1763 | } |
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 | - */ | |
1782 | 1764 | } |
1783 | 1765 | |
1784 | 1766 | // Calculate elements of Cartesian matrix between atomic orbitals. |
1785 | 1767 | // 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, | |
1787 | 1772 | const Atom& atomB, int valenceIndexB, |
1788 | - CartesianType axis, | |
1789 | 1773 | STOnGType stonG) const{ |
1790 | - double value = 0.0; | |
1774 | + xComponent=0.0; | |
1775 | + yComponent=0.0; | |
1776 | + zComponent=0.0; | |
1791 | 1777 | ShellType shellTypeA = atomA.GetValenceShellType(); |
1792 | 1778 | ShellType shellTypeB = atomB.GetValenceShellType(); |
1793 | 1779 | OrbitalType valenceOrbitalA = atomA.GetValence(valenceIndexA); |
@@ -1803,7 +1789,10 @@ double Cndo2::GetCartesianMatrixElementByGTOExpansion(const Atom& atomA, int val | ||
1803 | 1789 | double Rab = sqrt( pow(atomA.GetXyz()[XAxis]-atomB.GetXyz()[XAxis], 2.0) |
1804 | 1790 | +pow(atomA.GetXyz()[YAxis]-atomB.GetXyz()[YAxis], 2.0) |
1805 | 1791 | +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; | |
1807 | 1796 | for(int i=0; i<=stonG; i++){ |
1808 | 1797 | for(int j=0; j<=stonG; j++){ |
1809 | 1798 | temp = GTOExpansionSTO::GetInstance()->GetCoefficient(stonG, |
@@ -1824,20 +1813,23 @@ double Cndo2::GetCartesianMatrixElementByGTOExpansion(const Atom& atomA, int val | ||
1824 | 1813 | shellTypeB, |
1825 | 1814 | valenceOrbitalB, |
1826 | 1815 | 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(), | |
1835 | 1818 | 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; | |
1838 | 1831 | } |
1839 | 1832 | } |
1840 | - return value; | |
1841 | 1833 | } |
1842 | 1834 | |
1843 | 1835 | // calculate gaussian Caretesian integrals. |
@@ -344,11 +344,13 @@ private: | ||
344 | 344 | void CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, |
345 | 345 | const MolDS_base::Molecule& molecule, |
346 | 346 | 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, | |
348 | 351 | int valenceIndexA, |
349 | 352 | const MolDS_base_atoms::Atom& atomB, |
350 | 353 | int valenceIndexB, |
351 | - MolDS_base::CartesianType axis, | |
352 | 354 | MolDS_base::STOnGType stonG) const; |
353 | 355 | double GetGaussianCartesianMatrix(MolDS_base::AtomType atomTypeA, |
354 | 356 | MolDS_base::OrbitalType valenceOrbitalA, |
@@ -1144,9 +1144,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment | ||
1144 | 1144 | for(int mu=0; mu<totalNumberAOs; mu++){ |
1145 | 1145 | for(int nu=0; nu<totalNumberAOs; nu++){ |
1146 | 1146 | 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]); | |
1150 | 1150 | } |
1151 | 1151 | } |
1152 | 1152 | temp = matrixCIS[from-1][l]*matrixCIS[to-1][l]; |
@@ -1182,9 +1182,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment | ||
1182 | 1182 | for(int mu=0; mu<totalNumberAOs; mu++){ |
1183 | 1183 | for(int nu=0; nu<totalNumberAOs; nu++){ |
1184 | 1184 | 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]); | |
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | temp = this->matrixCIS[to-1][l]*sqrt(2.0); |
@@ -1220,9 +1220,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment | ||
1220 | 1220 | for(int mu=0; mu<totalNumberAOs; mu++){ |
1221 | 1221 | for(int nu=0; nu<totalNumberAOs; nu++){ |
1222 | 1222 | 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]); | |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | temp = matrixCIS[from-1][l]*sqrt(2.0); |
@@ -1260,9 +1260,9 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment | ||
1260 | 1260 | for(int mu=0; mu<totalNumberAOs; mu++){ |
1261 | 1261 | for(int nu=0; nu<totalNumberAOs; nu++){ |
1262 | 1262 | 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]); | |
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | temp = matrixCIS[from-1][l]*matrixCIS[to-1][l]; |