修订版 | 03a53ba3358a419e44799fb3fcec35f75b1cff6d (tree) |
---|---|
时间 | 2013-01-22 05:19:07 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Merge trunk into automake. #28588
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/automake@1241 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -311,6 +311,7 @@ void InputParser::SetMessages(){ | ||
311 | 311 | this->stringCISAllTransitionDipoleMoments = "all_transition_dipole_moments"; |
312 | 312 | this->stringCISNumPrintCoefficients = "num_print_coefficients"; |
313 | 313 | this->stringCISMulliken = "mulliken"; |
314 | + this->stringCISUnpairedPop = "unpaired_electron_population"; | |
314 | 315 | |
315 | 316 | // Memory |
316 | 317 | this->stringMemory = "memory"; |
@@ -823,6 +824,16 @@ int InputParser::ParseConditionsCIS(vector<string>* inputTerms, int parseIndex) | ||
823 | 824 | } |
824 | 825 | parseIndex++; |
825 | 826 | } |
827 | + // unpaired electron population | |
828 | + if((*inputTerms)[parseIndex].compare(this->stringCISUnpairedPop) == 0){ | |
829 | + if((*inputTerms)[parseIndex+1].compare(this->stringYES) == 0){ | |
830 | + Parameters::GetInstance()->SetRequiresUnpairedPopCIS(true); | |
831 | + } | |
832 | + else { | |
833 | + Parameters::GetInstance()->SetRequiresUnpairedPopCIS(false); | |
834 | + } | |
835 | + parseIndex++; | |
836 | + } | |
826 | 837 | parseIndex++; |
827 | 838 | } |
828 | 839 | return parseIndex; |
@@ -236,6 +236,7 @@ private: | ||
236 | 236 | std::string stringCISAllTransitionDipoleMoments; |
237 | 237 | std::string stringCISNumPrintCoefficients; |
238 | 238 | std::string stringCISMulliken; |
239 | + std::string stringCISUnpairedPop; | |
239 | 240 | // Memory |
240 | 241 | std::string stringMemory; |
241 | 242 | std::string stringMemoryEnd; |
@@ -100,40 +100,40 @@ template <typename T> T min(T a, T b){ | ||
100 | 100 | } |
101 | 101 | |
102 | 102 | // rotating matrix |
103 | -void CalcRotatingMatrix(double matrix[][3], double sita, CartesianType cartesianType){ | |
103 | +void CalcRotatingMatrix(double matrix[][3], double theta, CartesianType cartesianType){ | |
104 | 104 | if(cartesianType == XAxis){ |
105 | 105 | matrix[0][0] = 1.0; |
106 | 106 | matrix[0][1] = 0.0; |
107 | 107 | matrix[0][2] = 0.0; |
108 | 108 | |
109 | 109 | matrix[1][0] = 0.0; |
110 | - matrix[1][1] = cos(sita); | |
111 | - matrix[1][2] = sin(sita); | |
110 | + matrix[1][1] = cos(theta); | |
111 | + matrix[1][2] = sin(theta); | |
112 | 112 | |
113 | 113 | matrix[2][0] = 0.0; |
114 | - matrix[2][1] = -sin(sita); | |
115 | - matrix[2][2] = cos(sita); | |
114 | + matrix[2][1] = -sin(theta); | |
115 | + matrix[2][2] = cos(theta); | |
116 | 116 | } |
117 | 117 | else if(cartesianType == YAxis){ |
118 | - matrix[0][0] = cos(sita); | |
118 | + matrix[0][0] = cos(theta); | |
119 | 119 | matrix[0][1] = 0.0; |
120 | - matrix[0][2] = -sin(sita); | |
120 | + matrix[0][2] = -sin(theta); | |
121 | 121 | |
122 | 122 | matrix[1][0] = 0.0; |
123 | 123 | matrix[1][1] = 1.0; |
124 | 124 | matrix[1][2] = 0.0; |
125 | 125 | |
126 | - matrix[2][0] = sin(sita); | |
126 | + matrix[2][0] = sin(theta); | |
127 | 127 | matrix[2][1] = 0.0; |
128 | - matrix[2][2] = cos(sita); | |
128 | + matrix[2][2] = cos(theta); | |
129 | 129 | } |
130 | 130 | else if(cartesianType == ZAxis){ |
131 | - matrix[0][0] = cos(sita); | |
132 | - matrix[0][1] = sin(sita); | |
131 | + matrix[0][0] = cos(theta); | |
132 | + matrix[0][1] = sin(theta); | |
133 | 133 | matrix[0][2] = 0.0; |
134 | 134 | |
135 | - matrix[1][0] = -sin(sita); | |
136 | - matrix[1][1] = cos(sita); | |
135 | + matrix[1][0] = -sin(theta); | |
136 | + matrix[1][1] = cos(theta); | |
137 | 137 | matrix[1][2] = 0.0; |
138 | 138 | |
139 | 139 | matrix[2][0] = 0.0; |
@@ -28,7 +28,7 @@ template <typename T> T Max(T a, T b); | ||
28 | 28 | // min |
29 | 29 | template <typename T> T min(T a, T b); |
30 | 30 | // rotating matrix |
31 | -void CalcRotatingMatrix(double matrix[][3], double sita, CartesianType cartesianType); | |
31 | +void CalcRotatingMatrix(double matrix[][3], double theta, CartesianType cartesianType); | |
32 | 32 | // calculate determinant of the matrix. Note taht the matrix will be destroid |
33 | 33 | double GetDeterminant(double** matrix, int dim); |
34 | 34 | } |
@@ -1,6 +1,7 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | 3 | // Copyright (C) 2012-2012 Katsuhiko Nishimra // |
4 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
4 | 5 | // // |
5 | 6 | // This file is part of MolDS. // |
6 | 7 | // // |
@@ -171,6 +172,7 @@ void Parameters::SetDefaultValues(){ | ||
171 | 172 | this->numberPrintCoefficientsCIS = 1; |
172 | 173 | this->requiresExcitonEnergiesCIS = false; |
173 | 174 | this->requiresAllTransitionDipoleMomentsCIS = false; |
175 | + this->requiresUnpairedPopCIS = false; | |
174 | 176 | // Memory |
175 | 177 | this->limitHeapMemory = 256; |
176 | 178 | // MD |
@@ -705,6 +707,14 @@ bool Parameters::RequiresMullikenCIS() const{ | ||
705 | 707 | 0<this->electronicStateIndecesMullikenCIS->size()); |
706 | 708 | } |
707 | 709 | |
710 | +void Parameters::SetRequiresUnpairedPopCIS(bool requiresUnpairedPopCIS){ | |
711 | + this->requiresUnpairedPopCIS = requiresUnpairedPopCIS; | |
712 | +} | |
713 | + | |
714 | +bool Parameters::RequiresUnpairedPopCIS() const{ | |
715 | + return this->requiresUnpairedPopCIS; | |
716 | +} | |
717 | + | |
708 | 718 | // methods for Memory |
709 | 719 | double Parameters::GetLimitHeapMemory() const{ |
710 | 720 | return this->limitHeapMemory; |
@@ -1,6 +1,7 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | 3 | // Copyright (C) 2012-2012 Katsuhiko Nishimra // |
4 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
4 | 5 | // // |
5 | 6 | // This file is part of MolDS. // |
6 | 7 | // // |
@@ -141,6 +142,8 @@ public: | ||
141 | 142 | std::vector<int>* GetElectronicStateIndecesMullikenCIS() const; |
142 | 143 | void AddElectronicStateIndexMullikenCIS(int electronicStateIndex); |
143 | 144 | bool RequiresMullikenCIS() const; |
145 | + void SetRequiresUnpairedPopCIS(bool requiresUnpairedPopCIS); | |
146 | + bool RequiresUnpairedPopCIS() const; | |
144 | 147 | // Memory |
145 | 148 | double GetLimitHeapMemory() const; |
146 | 149 | void SetLimitHeapMemory(double limitHeap); |
@@ -285,6 +288,7 @@ private: | ||
285 | 288 | bool requiresExcitonEnergiesCIS; |
286 | 289 | bool requiresAllTransitionDipoleMomentsCIS; |
287 | 290 | std::vector<int>* electronicStateIndecesMullikenCIS; |
291 | + bool requiresUnpairedPopCIS; | |
288 | 292 | // Memory |
289 | 293 | double limitHeapMemory; |
290 | 294 | // MD |
@@ -1,5 +1,6 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
3 | 4 | // // |
4 | 5 | // This file is part of MolDS. // |
5 | 6 | // // |
@@ -73,6 +74,7 @@ Cndo2::Cndo2(){ | ||
73 | 74 | this->orbitalElectronPopulationCIS = NULL; |
74 | 75 | this->atomicElectronPopulation = NULL; |
75 | 76 | this->atomicElectronPopulationCIS = NULL; |
77 | + this->atomicUnpairedPopulationCIS = NULL; | |
76 | 78 | this->overlapAOs = NULL; |
77 | 79 | this->twoElecTwoCore = NULL; |
78 | 80 | this->cartesianMatrix = NULL; |
@@ -206,6 +208,8 @@ void Cndo2::SetMessages(){ | ||
206 | 208 | this->messageMullikenAtomsSCF = "\tMulliken charge(SCF):"; |
207 | 209 | this->messageMullikenAtoms = "\tMulliken charge:"; |
208 | 210 | this->messageMullikenAtomsTitle = "\t\t\t\t| k-th eigenstate | i-th atom | atom type | core charge[a.u.] | Mulliken charge[a.u.]| \n"; |
211 | + this->messageUnpairedAtoms = "\tUnpaired electron population:"; | |
212 | + this->messageUnpairedAtomsTitle = "\t\t\t\t| k-th eigenstate | i-th atom | atom type | Unpaired electron population[a.u.]| \n"; | |
209 | 213 | this->messageElecEnergy = "\tElectronic energy(SCF):"; |
210 | 214 | this->messageNoteElecEnergy = "\tNote that this electronic energy includes core-repulsions.\n\n"; |
211 | 215 | this->messageNoteElecEnergyVdW = "\tNote that this electronic energy includes core-repulsions and vdW correction.\n\n"; |
@@ -1,5 +1,6 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
3 | 4 | // // |
4 | 5 | // This file is part of MolDS. // |
5 | 6 | // // |
@@ -86,6 +87,8 @@ protected: | ||
86 | 87 | std::string messageOmpElapsedTimeSCF; |
87 | 88 | std::string messageMullikenAtoms; |
88 | 89 | std::string messageMullikenAtomsTitle; |
90 | + std::string messageUnpairedAtoms; | |
91 | + std::string messageUnpairedAtomsTitle; | |
89 | 92 | std::string messageUnitSec; |
90 | 93 | std::vector<MolDS_base::AtomType> enableAtomTypes; |
91 | 94 | MolDS_base::Molecule* molecule; |
@@ -99,6 +102,7 @@ protected: | ||
99 | 102 | double*** orbitalElectronPopulationCIS; |
100 | 103 | double* atomicElectronPopulation; //P_{AB} of (3.21) in J. A. Pople book. |
101 | 104 | double** atomicElectronPopulationCIS; |
105 | + double** atomicUnpairedPopulationCIS; | |
102 | 106 | double** overlapAOs; // overlap integral between AOs |
103 | 107 | double****** twoElecTwoCore; |
104 | 108 | double*** cartesianMatrix; // cartesian matrix represented by AOs |
@@ -1,5 +1,6 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
3 | 4 | // // |
4 | 5 | // This file is part of MolDS. // |
5 | 6 | // // |
@@ -1021,6 +1022,10 @@ void ZindoS::CalcCISProperties(){ | ||
1021 | 1022 | this->CalcAtomicElectronPopulationCIS(&this->atomicElectronPopulationCIS, |
1022 | 1023 | this->orbitalElectronPopulationCIS, |
1023 | 1024 | *this->molecule); |
1025 | + // atomic unpaired electron population | |
1026 | + this->CalcAtomicUnpairedPopulationCIS(&this->atomicUnpairedPopulationCIS, | |
1027 | + this->orbitalElectronPopulationCIS, | |
1028 | + *this->molecule); | |
1024 | 1029 | } |
1025 | 1030 | |
1026 | 1031 | void ZindoS::CalcElectronicDipoleMomentsExcitedState(double*** electronicTransitionDipoleMoments, |
@@ -1407,6 +1412,58 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC | ||
1407 | 1412 | } |
1408 | 1413 | } |
1409 | 1414 | |
1415 | +void ZindoS::CalcAtomicUnpairedPopulationCIS(double*** atomicUnpairedPopulationCIS, | |
1416 | + double const* const* const* orbitalElectronPopulationCIS, | |
1417 | + const Molecule& molecule) const{ | |
1418 | + if(!Parameters::GetInstance()->RequiresMullikenCIS()){ | |
1419 | + return; | |
1420 | + } | |
1421 | + if(!Parameters::GetInstance()->RequiresUnpairedPopCIS()){ | |
1422 | + return; | |
1423 | + } | |
1424 | + int totalNumberAtoms = molecule.GetNumberAtoms(); | |
1425 | + vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); | |
1426 | + // malloc or initialize free exciton energies | |
1427 | + if(*atomicUnpairedPopulationCIS == NULL){ | |
1428 | + MallocerFreer::GetInstance()->Malloc<double>(atomicUnpairedPopulationCIS, | |
1429 | + elecStates->size(), | |
1430 | + totalNumberAtoms); | |
1431 | + } | |
1432 | + else{ | |
1433 | + MallocerFreer::GetInstance()->Initialize<double>(*atomicUnpairedPopulationCIS, | |
1434 | + elecStates->size(), | |
1435 | + totalNumberAtoms); | |
1436 | + } | |
1437 | + // calc atomic electron population | |
1438 | + for(int k=0; k<elecStates->size(); k++){ | |
1439 | + stringstream ompErrors; | |
1440 | +#pragma omp parallel for schedule(auto) | |
1441 | + for(int a=0; a<totalNumberAtoms; a++){ | |
1442 | + try{ | |
1443 | + int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex(); | |
1444 | + int numberAOs = molecule.GetAtom(a)->GetValenceSize(); | |
1445 | + (*atomicUnpairedPopulationCIS)[k][a] = 0.0; | |
1446 | + for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){ | |
1447 | + double orbitalSquarePopulation = 0.0; | |
1448 | + int totalNumberAOs = molecule.GetTotalNumberAOs(); | |
1449 | + for(int j=0; j<totalNumberAOs; j++) { | |
1450 | + orbitalSquarePopulation += orbitalElectronPopulationCIS[k][i][j] * orbitalElectronPopulationCIS[k][j][i]; | |
1451 | + } | |
1452 | + (*atomicUnpairedPopulationCIS)[k][a] += 2.0 * orbitalElectronPopulationCIS[k][i][i] - orbitalSquarePopulation; | |
1453 | + } | |
1454 | + } | |
1455 | + catch(MolDSException ex){ | |
1456 | +#pragma omp critical | |
1457 | + ompErrors << ex.what() << endl ; | |
1458 | + } | |
1459 | + } | |
1460 | + // Exception throwing for omp-region | |
1461 | + if(!ompErrors.str().empty()){ | |
1462 | + throw MolDSException(ompErrors.str()); | |
1463 | + } | |
1464 | + } | |
1465 | +} | |
1466 | + | |
1410 | 1467 | void ZindoS::OutputCISResults() const{ |
1411 | 1468 | int numberActiveOcc = Parameters::GetInstance()->GetActiveOccCIS(); |
1412 | 1469 | int numberActiveVir = Parameters::GetInstance()->GetActiveVirCIS(); |
@@ -1442,6 +1499,9 @@ void ZindoS::OutputCISResults() const{ | ||
1442 | 1499 | // output mulliken population |
1443 | 1500 | this->OutputCISMulliken(); |
1444 | 1501 | |
1502 | + // output unpaired electron population | |
1503 | + this->OutputCISUnpairedPop(); | |
1504 | + | |
1445 | 1505 | // output exciton energies |
1446 | 1506 | if(Parameters::GetInstance()->RequiresExcitonEnergiesCIS()){ |
1447 | 1507 | this->OutputLog(this->messageExcitonEnergiesCIS); |
@@ -1589,6 +1649,29 @@ void ZindoS::OutputCISMulliken() const{ | ||
1589 | 1649 | } |
1590 | 1650 | } |
1591 | 1651 | |
1652 | +void ZindoS::OutputCISUnpairedPop() const{ | |
1653 | + if(!Parameters::GetInstance()->RequiresMullikenCIS()){ | |
1654 | + return; | |
1655 | + } | |
1656 | + if(!Parameters::GetInstance()->RequiresUnpairedPopCIS()){ | |
1657 | + return; | |
1658 | + } | |
1659 | + int totalNumberAtoms = this->molecule->GetNumberAtoms(); | |
1660 | + this->OutputLog(this->messageUnpairedAtomsTitle); | |
1661 | + vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); | |
1662 | + for(int k=0; k<elecStates->size(); k++){ | |
1663 | + for(int a=0; a<totalNumberAtoms; a++){ | |
1664 | + const Atom& atom = *this->molecule->GetAtom(a); | |
1665 | + this->OutputLog(boost::format("%s\t%d\t%d\t%s\t%e\n") % this->messageUnpairedAtoms | |
1666 | + % (*elecStates)[k] | |
1667 | + % a | |
1668 | + % AtomTypeStr(atom.GetAtomType()) | |
1669 | + % this->atomicUnpairedPopulationCIS[k][a]); | |
1670 | + } | |
1671 | + this->OutputLog("\n"); | |
1672 | + } | |
1673 | +} | |
1674 | + | |
1592 | 1675 | void ZindoS::SortCISEigenVectorCoefficients(vector<CISEigenVectorCoefficient>* cisEigenVectorCoefficients, |
1593 | 1676 | double* cisEigenVector) const{ |
1594 | 1677 | for(int l=0; l<this->matrixCISdimension; l++){ |
@@ -1,5 +1,6 @@ | ||
1 | 1 | //************************************************************************// |
2 | 2 | // Copyright (C) 2011-2012 Mikiya Fujii // |
3 | +// Copyright (C) 2012-2013 Michihiro Okuyama | |
3 | 4 | // // |
4 | 5 | // This file is part of MolDS. // |
5 | 6 | // // |
@@ -139,6 +140,7 @@ private: | ||
139 | 140 | void OutputCISDipole() const; |
140 | 141 | void OutputCISTransitionDipole() const; |
141 | 142 | void OutputCISMulliken() const; |
143 | + void OutputCISUnpairedPop() const; | |
142 | 144 | void CalcFreeExcitonEnergies(double** freeExcitonEnergiesCIS, |
143 | 145 | const MolDS_base::Molecule& molecule, |
144 | 146 | double const* energiesMO, |
@@ -152,6 +154,9 @@ private: | ||
152 | 154 | void CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationCIS, |
153 | 155 | double const* const* const* orbitalElectronPopulationCIS, |
154 | 156 | const MolDS_base::Molecule& molecule) const; |
157 | + void CalcAtomicUnpairedPopulationCIS(double*** atomicUnpairedPopulationCIS, | |
158 | + double const* const* const* orbitalElectronPopulationCIS, | |
159 | + const MolDS_base::Molecule& molecule) const; | |
155 | 160 | void CalcElectronicDipoleMomentsExcitedState(double*** electronicTransitionDipoleMoments, |
156 | 161 | double const* const* fockMatrix, |
157 | 162 | double const* const* matrixCIS, |