• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisionb1162b09154403db21876430989860ecb4b9d702 (tree)
Zeit2011-09-30 22:29:35
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Center of core is added.

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

Ändern Zusammenfassung

Diff

--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -589,6 +589,7 @@ void InputParser::CalcMolecularBasics(Molecule* molecule){
589589 molecule->CalcTotalNumberAOs();
590590 molecule->CalcTotalNumberValenceElectrons();
591591 molecule->CalcXyzCOM();
592+ molecule->CalcXyzCOC();
592593 molecule->CalcTotalCoreRepulsionEnergy();
593594
594595 }
@@ -638,6 +639,7 @@ void InputParser::OutputMolecularBasics(Molecule* molecule){
638639 molecule->OutputTotalNumberAtomsAOsValenceelectrons();
639640 molecule->OutputConfiguration();
640641 molecule->OutputXyzCOM();
642+ molecule->OutputXyzCOC();
641643 molecule->OutputTotalCoreRepulsionEnergy();
642644 }
643645
--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -19,7 +19,9 @@ public:
1919 ~Molecule();
2020 vector<Atom*>* GetAtomVect();
2121 double* GetXyzCOM();
22+ double* GetXyzCOC();
2223 void CalcXyzCOM();
24+ void CalcXyzCOC();
2325 int GetTotalNumberAOs();
2426 void CalcTotalNumberAOs();
2527 int GetTotalNumberValenceElectrons();
@@ -28,6 +30,7 @@ public:
2830 void CalcTotalCoreRepulsionEnergy();
2931 double GetTotalCoreRepulsionEnergy();
3032 void OutputXyzCOM();
33+ void OutputXyzCOC();
3134 void OutputTotalNumberAtomsAOsValenceelectrons();
3235 void OutputConfiguration();
3336 void OutputTotalCoreRepulsionEnergy();
@@ -38,8 +41,10 @@ public:
3841 double GetDistanceAtoms(Atom* atomA, Atom* atomB);
3942 private:
4043 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;
4246 bool wasCalculatedXyzCOM;
47+ bool wasCalculatedXyzCOC;
4348 int totalNumberAOs;
4449 int totalNumberValenceElectrons;
4550 double totalCoreRepulsionEnergy;
@@ -62,6 +67,7 @@ private:
6267 string messageCoreRepulsion;
6368 string messageCoreRepulsionTitle;
6469 string messageCOM;
70+ string messageCOC;
6571 string messageCOMTitleAU;
6672 string messageCOMTitleAng;
6773 string messageStartPrincipalAxes;
@@ -94,7 +100,9 @@ private:
94100 Molecule::Molecule(){
95101 this->atomVect = new vector<Atom*>;
96102 this->xyzCOM = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3);
103+ this->xyzCOC = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3);
97104 this->wasCalculatedXyzCOM = false;
105+ this->wasCalculatedXyzCOC = false;
98106 this->wasCalculatedTotalCoreRepulsionEnergy = false;
99107 this->messageTotalNumberAOs = "\tTotal number of valence AOs: ";
100108 this->messageTotalNumberAtoms = "\tTotal number of atoms: ";
@@ -105,6 +113,7 @@ Molecule::Molecule(){
105113 this->messageCoreRepulsion = "\tTotal core repulsion energy:\n";
106114 this->messageCoreRepulsionTitle = "\t\t| [a.u.] | [eV] |\n";
107115 this->messageCOM = "\tCenter of Mass:\n";
116+ this->messageCOC = "\tCenter of Core:\n";
108117 this->messageCOMTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n";
109118 this->messageCOMTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n";
110119 this->messageStartPrincipalAxes = "********** START: Principal Axes of Inertia **********\n";
@@ -148,6 +157,10 @@ Molecule::~Molecule(){
148157 MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&this->xyzCOM);
149158 //cout << "xyzCOM deleted\n";
150159 }
160+ if(this->xyzCOC != NULL){
161+ MallocerFreer::GetInstance()->FreeDoubleMatrix1d(&this->xyzCOC);
162+ //cout << "xyzCOC deleted\n";
163+ }
151164 }
152165
153166 vector<Atom*>* Molecule::GetAtomVect(){
@@ -161,11 +174,18 @@ double* Molecule::GetXyzCOM(){
161174 return this->xyzCOM;
162175 }
163176
177+double* Molecule::GetXyzCOC(){
178+ if(!this->wasCalculatedXyzCOC){
179+ this->CalcXyzCOC();
180+ }
181+ return this->xyzCOC;
182+}
183+
164184 void Molecule::CalcXyzCOM(){
165- double totalAtomicMass;
185+ double totalAtomicMass = 0.0;
166186 Atom* atom;
167187 double* atomicXyz;
168- double atomicMass;
188+ double atomicMass = 0.0;
169189
170190 for(int j=0; j<3; j++){
171191 this->xyzCOM[j] = 0.0;
@@ -186,6 +206,31 @@ void Molecule::CalcXyzCOM(){
186206 this->wasCalculatedXyzCOM = true;
187207 }
188208
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+
189234 int Molecule::GetTotalNumberAOs(){
190235 return this->totalNumberAOs;
191236 }
@@ -296,6 +341,23 @@ void Molecule::OutputXyzCOM(){
296341
297342 }
298343
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+
299361 void Molecule::OutputTotalNumberAtomsAOsValenceelectrons(){
300362 cout << this->messageTotalNumberAtoms << this->atomVect->size() << "\n";
301363 cout << this->messageTotalNumberAOs << this->totalNumberAOs << "\n";
@@ -603,9 +665,12 @@ void Molecule::Translate(){
603665
604666 this->wasCalculatedXyzCOM = false;
605667 this->CalcXyzCOM();
668+ this->wasCalculatedXyzCOC = false;
669+ this->CalcXyzCOC();
606670
607671 this->OutputConfiguration();
608672 this->OutputXyzCOM();
673+ this->OutputXyzCOC();
609674
610675 cout << this->messageDoneTranslate;
611676 }
--- a/src/input.in
+++ b/src/input.in
@@ -189,6 +189,13 @@ GEOMETRY_END
189189 // Li 1.994960 0.485175 0.000000
190190 //GEOMETRY_END
191191
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+
192199 // Li2
193200 //GEOMETRY
194201 // Li 0.0 0.0 1.230000