• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版5986b71a186c91d009337547172cc78ee8da5a30 (tree)
时间2011-01-12 11:01:30
作者Mikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Logic for core repulsion is added.

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

更改概述

差异

--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -375,6 +375,7 @@ void InputParser::CalcMolecularBasics(Molecule* molecule){
375375 molecule->CalcTotalNumberAOs();
376376 molecule->CalcTotalNumberValenceElectrons();
377377 molecule->CalcXyzCOM();
378+ molecule->CalcTotalCoreRepulsionEnergy();
378379
379380 }
380381
@@ -383,6 +384,7 @@ void InputParser::OutputMolecularBasics(Molecule* molecule){
383384 molecule->OutputTotalNumberAtomsAOsValenceelectrons();
384385 molecule->OutputConfiguration();
385386 molecule->OutputXyzCOM();
387+ molecule->OutputTotalCoreRepulsionEnergy();
386388 }
387389
388390 void InputParser::OutputScfConditions(){
--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -24,9 +24,11 @@ public:
2424 void CalcTotalNumberAOs();
2525 int GetTotalNumberValenceElectrons();
2626 void CalcTotalNumberValenceElectrons();
27+ void CalcTotalCoreRepulsionEnergy();
2728 void OutputXyzCOM();
2829 void OutputTotalNumberAtomsAOsValenceelectrons();
2930 void OutputConfiguration();
31+ void OutputTotalCoreRepulsionEnergy();
3032 void CalcPrincipalAxes();
3133 void Rotate();
3234 void Translate();
@@ -38,6 +40,8 @@ private:
3840 bool wasCalculatedXyzCOM;
3941 int totalNumberAOs;
4042 int totalNumberValenceElectrons;
43+ double totalCoreRepulsionEnergy;
44+ bool wasCalculatedTotalCoreRepulsionEnergy;
4145 void CalcInertiaTensor(double** inertiaTensor, double* inertiaTensorOrigin);
4246 void FreeInertiaTensorMoments(double** inertiaTensor, double* inertiaMoments);
4347 void Rotate(EularAngle eularAngle, double* rotatingOrigin, RotatedObjectType rotatedObj);
@@ -53,6 +57,8 @@ private:
5357 string messageConfiguration;
5458 string messageConfigurationTitleAU;
5559 string messageConfigurationTitleAng;
60+ string messageCoreRepulsion;
61+ string messageCoreRepulsionTitle;
5662 string messageCOM;
5763 string messageCOMTitleAU;
5864 string messageCOMTitleAng;
@@ -87,12 +93,15 @@ Molecule::Molecule(){
8793 this->atomVect = new vector<Atom*>;
8894 this->xyzCOM = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3);
8995 this->wasCalculatedXyzCOM = false;
96+ this->wasCalculatedTotalCoreRepulsionEnergy = false;
9097 this->messageTotalNumberAOs = "\tTotal number of valence AOs: ";
9198 this->messageTotalNumberAtoms = "\tTotal number of atoms: ";
9299 this->messageTotalNumberValenceElectrons = "\tTotal number of valence electrons: ";
93100 this->messageConfiguration = "\tMolecular configration:\n";
94101 this->messageConfigurationTitleAU = "\t\t| i-th | atom type | x [a.u.] | y[a.u.] | z[a.u.] |\n";
95102 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";
96105 this->messageCOM = "\tCenter of Mass:\n";
97106 this->messageCOMTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n";
98107 this->messageCOMTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n";
@@ -194,6 +203,35 @@ int Molecule::GetTotalNumberValenceElectrons(){
194203 return this->totalNumberValenceElectrons;
195204 }
196205
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+
197235 void Molecule::CalcTotalNumberValenceElectrons(){
198236 this->totalNumberValenceElectrons = 0;
199237 for(int i=0; i<this->atomVect->size(); i++){
--- a/src/input.in
+++ b/src/input.in
@@ -32,10 +32,10 @@ TRANSLATE
3232 TRANSLATE_END
3333
3434 // 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
3939
4040 // s
4141 //GEOMETRY
@@ -49,13 +49,13 @@ GEOMETRY_END
4949 //GEOMETRY_END
5050
5151 //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
5959
6060
6161 // c2