修订版 | 5986b71a186c91d009337547172cc78ee8da5a30 (tree) |
---|---|
时间 | 2011-01-12 11:01:30 |
作者 | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Logic for core repulsion is added.
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@54 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -375,6 +375,7 @@ void InputParser::CalcMolecularBasics(Molecule* molecule){ | ||
375 | 375 | molecule->CalcTotalNumberAOs(); |
376 | 376 | molecule->CalcTotalNumberValenceElectrons(); |
377 | 377 | molecule->CalcXyzCOM(); |
378 | + molecule->CalcTotalCoreRepulsionEnergy(); | |
378 | 379 | |
379 | 380 | } |
380 | 381 |
@@ -383,6 +384,7 @@ void InputParser::OutputMolecularBasics(Molecule* molecule){ | ||
383 | 384 | molecule->OutputTotalNumberAtomsAOsValenceelectrons(); |
384 | 385 | molecule->OutputConfiguration(); |
385 | 386 | molecule->OutputXyzCOM(); |
387 | + molecule->OutputTotalCoreRepulsionEnergy(); | |
386 | 388 | } |
387 | 389 | |
388 | 390 | void InputParser::OutputScfConditions(){ |
@@ -24,9 +24,11 @@ public: | ||
24 | 24 | void CalcTotalNumberAOs(); |
25 | 25 | int GetTotalNumberValenceElectrons(); |
26 | 26 | void CalcTotalNumberValenceElectrons(); |
27 | + void CalcTotalCoreRepulsionEnergy(); | |
27 | 28 | void OutputXyzCOM(); |
28 | 29 | void OutputTotalNumberAtomsAOsValenceelectrons(); |
29 | 30 | void OutputConfiguration(); |
31 | + void OutputTotalCoreRepulsionEnergy(); | |
30 | 32 | void CalcPrincipalAxes(); |
31 | 33 | void Rotate(); |
32 | 34 | void Translate(); |
@@ -38,6 +40,8 @@ private: | ||
38 | 40 | bool wasCalculatedXyzCOM; |
39 | 41 | int totalNumberAOs; |
40 | 42 | int totalNumberValenceElectrons; |
43 | + double totalCoreRepulsionEnergy; | |
44 | + bool wasCalculatedTotalCoreRepulsionEnergy; | |
41 | 45 | void CalcInertiaTensor(double** inertiaTensor, double* inertiaTensorOrigin); |
42 | 46 | void FreeInertiaTensorMoments(double** inertiaTensor, double* inertiaMoments); |
43 | 47 | void Rotate(EularAngle eularAngle, double* rotatingOrigin, RotatedObjectType rotatedObj); |
@@ -53,6 +57,8 @@ private: | ||
53 | 57 | string messageConfiguration; |
54 | 58 | string messageConfigurationTitleAU; |
55 | 59 | string messageConfigurationTitleAng; |
60 | + string messageCoreRepulsion; | |
61 | + string messageCoreRepulsionTitle; | |
56 | 62 | string messageCOM; |
57 | 63 | string messageCOMTitleAU; |
58 | 64 | string messageCOMTitleAng; |
@@ -87,12 +93,15 @@ Molecule::Molecule(){ | ||
87 | 93 | this->atomVect = new vector<Atom*>; |
88 | 94 | this->xyzCOM = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3); |
89 | 95 | this->wasCalculatedXyzCOM = false; |
96 | + this->wasCalculatedTotalCoreRepulsionEnergy = false; | |
90 | 97 | this->messageTotalNumberAOs = "\tTotal number of valence AOs: "; |
91 | 98 | this->messageTotalNumberAtoms = "\tTotal number of atoms: "; |
92 | 99 | this->messageTotalNumberValenceElectrons = "\tTotal number of valence electrons: "; |
93 | 100 | this->messageConfiguration = "\tMolecular configration:\n"; |
94 | 101 | this->messageConfigurationTitleAU = "\t\t| i-th | atom type | x [a.u.] | y[a.u.] | z[a.u.] |\n"; |
95 | 102 | this->messageConfigurationTitleAng = "\t\t| i-th | atom type | x [angst.] | y[angst.] | z[angst.] |\n"; |
103 | + this->messageCoreRepulsion = "\tTotal core repulsion energy:\n"; | |
104 | + this->messageCoreRepulsionTitle = "\t\t| [a.u.] | [eV] |\n"; | |
96 | 105 | this->messageCOM = "\tCenter of Mass:\n"; |
97 | 106 | this->messageCOMTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n"; |
98 | 107 | this->messageCOMTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n"; |
@@ -194,6 +203,35 @@ int Molecule::GetTotalNumberValenceElectrons(){ | ||
194 | 203 | return this->totalNumberValenceElectrons; |
195 | 204 | } |
196 | 205 | |
206 | +void Molecule::CalcTotalCoreRepulsionEnergy(){ | |
207 | + double energy = 0.0; | |
208 | + double distance = 0.0; | |
209 | + Atom* atomA = NULL; | |
210 | + Atom* atomB = NULL; | |
211 | + for(int i=0; i<this->atomVect->size(); i++){ | |
212 | + atomA = (*this->atomVect)[i]; | |
213 | + for(int j=i+1; j<this->atomVect->size(); j++){ | |
214 | + atomB = (*this->atomVect)[j]; | |
215 | + distance = this->GetDistanceAtoms(i, j); | |
216 | + energy += atomA->GetCoreCharge()*atomB->GetCoreCharge()/distance; | |
217 | + } | |
218 | + } | |
219 | + this->totalCoreRepulsionEnergy = energy; | |
220 | + this->wasCalculatedTotalCoreRepulsionEnergy = true; | |
221 | +} | |
222 | + | |
223 | +void Molecule::OutputTotalCoreRepulsionEnergy(){ | |
224 | + if(!this->wasCalculatedTotalCoreRepulsionEnergy){ | |
225 | + this->CalcTotalCoreRepulsionEnergy(); | |
226 | + } | |
227 | + | |
228 | + double eV2AU = Parameters::GetInstance()->GetEV2AU(); | |
229 | + cout << this->messageCoreRepulsion; | |
230 | + cout << this->messageCoreRepulsionTitle; | |
231 | + printf("\t\t%e\t%e\n\n",this->totalCoreRepulsionEnergy, this->totalCoreRepulsionEnergy/eV2AU); | |
232 | + | |
233 | +} | |
234 | + | |
197 | 235 | void Molecule::CalcTotalNumberValenceElectrons(){ |
198 | 236 | this->totalNumberValenceElectrons = 0; |
199 | 237 | for(int i=0; i<this->atomVect->size(); i++){ |
@@ -32,10 +32,10 @@ TRANSLATE | ||
32 | 32 | TRANSLATE_END |
33 | 33 | |
34 | 34 | // S2 |
35 | -GEOMETRY | |
36 | - S 0.424528 0.741240 0.000000 | |
37 | - S -1.353072 0.741240 0.000000 | |
38 | -GEOMETRY_END | |
35 | +//GEOMETRY | |
36 | +// S 0.424528 0.741240 0.000000 | |
37 | +// S -1.353072 0.741240 0.000000 | |
38 | +//GEOMETRY_END | |
39 | 39 | |
40 | 40 | // s |
41 | 41 | //GEOMETRY |
@@ -49,13 +49,13 @@ GEOMETRY_END | ||
49 | 49 | //GEOMETRY_END |
50 | 50 | |
51 | 51 | //metane |
52 | -//GEOMETRY | |
53 | -// C 0.647389 0.820131 0.000000 | |
54 | -// H 1.004043 -0.188679 0.000000 | |
55 | -// H 1.004062 1.324529 0.873652 | |
56 | -// H 1.004062 1.324529 -0.873652 | |
57 | -// H -0.422611 0.820144 0.000000 | |
58 | -//GEOMETRY_END | |
52 | +GEOMETRY | |
53 | + C 0.647389 0.820131 0.000000 | |
54 | + H 1.004043 -0.188679 0.000000 | |
55 | + H 1.004062 1.324529 0.873652 | |
56 | + H 1.004062 1.324529 -0.873652 | |
57 | + H -0.422611 0.820144 0.000000 | |
58 | +GEOMETRY_END | |
59 | 59 | |
60 | 60 | |
61 | 61 | // c2 |