Revision | b1162b09154403db21876430989860ecb4b9d702 (tree) |
---|---|
Zeit | 2011-09-30 22:29:35 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Center of core is added.
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@166 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -589,6 +589,7 @@ void InputParser::CalcMolecularBasics(Molecule* molecule){ | ||
589 | 589 | molecule->CalcTotalNumberAOs(); |
590 | 590 | molecule->CalcTotalNumberValenceElectrons(); |
591 | 591 | molecule->CalcXyzCOM(); |
592 | + molecule->CalcXyzCOC(); | |
592 | 593 | molecule->CalcTotalCoreRepulsionEnergy(); |
593 | 594 | |
594 | 595 | } |
@@ -638,6 +639,7 @@ void InputParser::OutputMolecularBasics(Molecule* molecule){ | ||
638 | 639 | molecule->OutputTotalNumberAtomsAOsValenceelectrons(); |
639 | 640 | molecule->OutputConfiguration(); |
640 | 641 | molecule->OutputXyzCOM(); |
642 | + molecule->OutputXyzCOC(); | |
641 | 643 | molecule->OutputTotalCoreRepulsionEnergy(); |
642 | 644 | } |
643 | 645 |
@@ -19,7 +19,9 @@ public: | ||
19 | 19 | ~Molecule(); |
20 | 20 | vector<Atom*>* GetAtomVect(); |
21 | 21 | double* GetXyzCOM(); |
22 | + double* GetXyzCOC(); | |
22 | 23 | void CalcXyzCOM(); |
24 | + void CalcXyzCOC(); | |
23 | 25 | int GetTotalNumberAOs(); |
24 | 26 | void CalcTotalNumberAOs(); |
25 | 27 | int GetTotalNumberValenceElectrons(); |
@@ -28,6 +30,7 @@ public: | ||
28 | 30 | void CalcTotalCoreRepulsionEnergy(); |
29 | 31 | double GetTotalCoreRepulsionEnergy(); |
30 | 32 | void OutputXyzCOM(); |
33 | + void OutputXyzCOC(); | |
31 | 34 | void OutputTotalNumberAtomsAOsValenceelectrons(); |
32 | 35 | void OutputConfiguration(); |
33 | 36 | void OutputTotalCoreRepulsionEnergy(); |
@@ -38,8 +41,10 @@ public: | ||
38 | 41 | double GetDistanceAtoms(Atom* atomA, Atom* atomB); |
39 | 42 | private: |
40 | 43 | vector<Atom*>* atomVect; |
41 | - double* xyzCOM; | |
44 | + double* xyzCOM; // x, y, z coordinates of Center of Mass; | |
45 | + double* xyzCOC; // x, y, z coordinates of Center of Core; | |
42 | 46 | bool wasCalculatedXyzCOM; |
47 | + bool wasCalculatedXyzCOC; | |
43 | 48 | int totalNumberAOs; |
44 | 49 | int totalNumberValenceElectrons; |
45 | 50 | double totalCoreRepulsionEnergy; |
@@ -62,6 +67,7 @@ private: | ||
62 | 67 | string messageCoreRepulsion; |
63 | 68 | string messageCoreRepulsionTitle; |
64 | 69 | string messageCOM; |
70 | + string messageCOC; | |
65 | 71 | string messageCOMTitleAU; |
66 | 72 | string messageCOMTitleAng; |
67 | 73 | string messageStartPrincipalAxes; |
@@ -94,7 +100,9 @@ private: | ||
94 | 100 | Molecule::Molecule(){ |
95 | 101 | this->atomVect = new vector<Atom*>; |
96 | 102 | this->xyzCOM = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3); |
103 | + this->xyzCOC = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3); | |
97 | 104 | this->wasCalculatedXyzCOM = false; |
105 | + this->wasCalculatedXyzCOC = false; | |
98 | 106 | this->wasCalculatedTotalCoreRepulsionEnergy = false; |
99 | 107 | this->messageTotalNumberAOs = "\tTotal number of valence AOs: "; |
100 | 108 | this->messageTotalNumberAtoms = "\tTotal number of atoms: "; |
@@ -105,6 +113,7 @@ Molecule::Molecule(){ | ||
105 | 113 | this->messageCoreRepulsion = "\tTotal core repulsion energy:\n"; |
106 | 114 | this->messageCoreRepulsionTitle = "\t\t| [a.u.] | [eV] |\n"; |
107 | 115 | this->messageCOM = "\tCenter of Mass:\n"; |
116 | + this->messageCOC = "\tCenter of Core:\n"; | |
108 | 117 | this->messageCOMTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n"; |
109 | 118 | this->messageCOMTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n"; |
110 | 119 | this->messageStartPrincipalAxes = "********** START: Principal Axes of Inertia **********\n"; |
@@ -148,6 +157,10 @@ Molecule::~Molecule(){ | ||
148 | 157 | MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&this->xyzCOM); |
149 | 158 | //cout << "xyzCOM deleted\n"; |
150 | 159 | } |
160 | + if(this->xyzCOC != NULL){ | |
161 | + MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&this->xyzCOC); | |
162 | + //cout << "xyzCOC deleted\n"; | |
163 | + } | |
151 | 164 | } |
152 | 165 | |
153 | 166 | vector<Atom*>* Molecule::GetAtomVect(){ |
@@ -161,11 +174,18 @@ double* Molecule::GetXyzCOM(){ | ||
161 | 174 | return this->xyzCOM; |
162 | 175 | } |
163 | 176 | |
177 | +double* Molecule::GetXyzCOC(){ | |
178 | + if(!this->wasCalculatedXyzCOC){ | |
179 | + this->CalcXyzCOC(); | |
180 | + } | |
181 | + return this->xyzCOC; | |
182 | +} | |
183 | + | |
164 | 184 | void Molecule::CalcXyzCOM(){ |
165 | - double totalAtomicMass; | |
185 | + double totalAtomicMass = 0.0; | |
166 | 186 | Atom* atom; |
167 | 187 | double* atomicXyz; |
168 | - double atomicMass; | |
188 | + double atomicMass = 0.0; | |
169 | 189 | |
170 | 190 | for(int j=0; j<3; j++){ |
171 | 191 | this->xyzCOM[j] = 0.0; |
@@ -186,6 +206,31 @@ void Molecule::CalcXyzCOM(){ | ||
186 | 206 | this->wasCalculatedXyzCOM = true; |
187 | 207 | } |
188 | 208 | |
209 | +void Molecule::CalcXyzCOC(){ | |
210 | + double totalCoreMass = 0.0; | |
211 | + Atom* atom; | |
212 | + double* atomicXyz; | |
213 | + double coreMass = 0.0; | |
214 | + | |
215 | + for(int j=0; j<3; j++){ | |
216 | + this->xyzCOC[j] = 0.0; | |
217 | + } | |
218 | + | |
219 | + for(int i=0; i<this->atomVect->size(); i++){ | |
220 | + atom = (*this->atomVect)[i]; | |
221 | + atomicXyz = atom->GetXyz(); | |
222 | + coreMass = atom->GetAtomicMass() - (double)atom->GetNumberValenceElectrons(); | |
223 | + totalCoreMass += coreMass; | |
224 | + for(int j=0; j<3; j++){ | |
225 | + this->xyzCOC[j] += atomicXyz[j] * coreMass; | |
226 | + } | |
227 | + } | |
228 | + for(int i=0; i<3; i++){ | |
229 | + this->xyzCOC[i]/=totalCoreMass; | |
230 | + } | |
231 | + this->wasCalculatedXyzCOC = true; | |
232 | +} | |
233 | + | |
189 | 234 | int Molecule::GetTotalNumberAOs(){ |
190 | 235 | return this->totalNumberAOs; |
191 | 236 | } |
@@ -296,6 +341,23 @@ void Molecule::OutputXyzCOM(){ | ||
296 | 341 | |
297 | 342 | } |
298 | 343 | |
344 | +void Molecule::OutputXyzCOC(){ | |
345 | + double ang2AU = Parameters::GetInstance()->GetAngstrom2AU(); | |
346 | + cout << this->messageCOC; | |
347 | + cout << this->messageCOMTitleAng; | |
348 | + printf("\t\t%e\t%e\t%e\n",this->xyzCOC[0]/ang2AU, | |
349 | + this->xyzCOC[1]/ang2AU, | |
350 | + this->xyzCOC[2]/ang2AU); | |
351 | + cout << "\n"; | |
352 | + | |
353 | + cout << this->messageCOMTitleAU; | |
354 | + printf("\t\t%e\t%e\t%e\n",this->xyzCOC[0], | |
355 | + this->xyzCOC[1], | |
356 | + this->xyzCOC[2]); | |
357 | + cout << "\n"; | |
358 | + | |
359 | +} | |
360 | + | |
299 | 361 | void Molecule::OutputTotalNumberAtomsAOsValenceelectrons(){ |
300 | 362 | cout << this->messageTotalNumberAtoms << this->atomVect->size() << "\n"; |
301 | 363 | cout << this->messageTotalNumberAOs << this->totalNumberAOs << "\n"; |
@@ -603,9 +665,12 @@ void Molecule::Translate(){ | ||
603 | 665 | |
604 | 666 | this->wasCalculatedXyzCOM = false; |
605 | 667 | this->CalcXyzCOM(); |
668 | + this->wasCalculatedXyzCOC = false; | |
669 | + this->CalcXyzCOC(); | |
606 | 670 | |
607 | 671 | this->OutputConfiguration(); |
608 | 672 | this->OutputXyzCOM(); |
673 | + this->OutputXyzCOC(); | |
609 | 674 | |
610 | 675 | cout << this->messageDoneTranslate; |
611 | 676 | } |
@@ -189,6 +189,13 @@ GEOMETRY_END | ||
189 | 189 | // Li 1.994960 0.485175 0.000000 |
190 | 190 | //GEOMETRY_END |
191 | 191 | |
192 | +// LiH 3 | |
193 | +//GEOMETRY | |
194 | +// H -1.14750 0.0 0.0 | |
195 | +// Li 0.382500 0.0 0.0 | |
196 | +//GEOMETRY_END | |
197 | + | |
198 | + | |
192 | 199 | // Li2 |
193 | 200 | //GEOMETRY |
194 | 201 | // Li 0.0 0.0 1.230000 |