• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révisiona30645e9f3f3e568d518cc5d87980a1cf67ed3e9 (tree)
l'heure2011-01-06 10:39:30
AuteurMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Message de Log

Principal Axes is calculated.

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

Change Summary

Modification

--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -6,6 +6,7 @@
66 #include<iostream>
77 #include<vector>
88 #include"atoms/Atom.h"
9+#include"../mkl_wrapper/LapackWrapper.h"
910
1011 using namespace std;
1112 using namespace MolDS_base_atoms;
@@ -22,6 +23,8 @@ private:
2223 int totalNumberValenceElectrons;
2324 void CalcInertiaTensor(double** inertiaTensor);
2425 void FreeInertiaTensorMoments(double** inertiaTensor, double* inertiaMoments);
26+ void OutputPrincipalAxes(double** inertiaTensor, double* inertiaMoments);
27+ void OutputInertiaTensorOrigin();
2528 string messageTotalNumberAOs;
2629 string messageTotalNumberAtoms;
2730 string messageTotalNumberValenceElectrons;
@@ -31,6 +34,12 @@ private:
3134 string messageCOM;
3235 string messageCOMTitleAU;
3336 string messageCOMTitleAng;
37+ string messagePrincipalAxes;
38+ string messagePrincipalAxesTitleAU;
39+ string messagePrincipalAxesTitleAng;
40+ string messageInertiaTensorOrigin;
41+ string messageInertiaTensorOriginTitleAU;
42+ string messageInertiaTensorOriginTitleAng;
3443 public:
3544 Molecule();
3645 ~Molecule();
@@ -62,6 +71,12 @@ Molecule::Molecule(){
6271 this->messageCOM = "\tCenter of Mass:\n";
6372 this->messageCOMTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n";
6473 this->messageCOMTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n";
74+ this->messagePrincipalAxes = "\tPrincipal Axes:\n";
75+ this->messagePrincipalAxesTitleAU = "\t\t| inertia moments [a.u.] | x [a.u.] | y[a.u.] | z[a.u.] | (normalized)\n";
76+ this->messagePrincipalAxesTitleAng = "\t\t| inertia moments [g*angust**2/mol] | x [angst.] | y[angst.] | z[angst.] | (not normalized)\n";
77+ this->messageInertiaTensorOrigin = "\tInertia Tensor Origin:\n";
78+ this->messageInertiaTensorOriginTitleAU = "\t\t| x [a.u.] | y[a.u.] | z[a.u.] |\n";
79+ this->messageInertiaTensorOriginTitleAng = "\t\t| x [angst.] | y[angst.] | z[angst.] |\n";
6580 }
6681
6782 Molecule::~Molecule(){
@@ -186,6 +201,49 @@ void Molecule::OutputTotalNumberAtomsAOsValenceelectrons(){
186201 cout << this->messageTotalNumberValenceElectrons << this->totalNumberValenceElectrons << "\n\n";
187202 }
188203
204+void Molecule::OutputPrincipalAxes(double** inertiaTensor, double* inertiaMoments){
205+ double ang2AU = Parameters::GetInstance()->GetAngstrom2AU();
206+ double gMolin2AU = Parameters::GetInstance()->GetGMolin2AU();
207+
208+ cout << this->messagePrincipalAxes;
209+ cout << this->messagePrincipalAxesTitleAng;
210+ for(int i=0; i<3; i++){
211+ printf("\t\t%e\t%e\t%e\t%e\n",inertiaMoments[i]/gMolin2AU,
212+ inertiaTensor[i][0]/ang2AU,
213+ inertiaTensor[i][1]/ang2AU,
214+ inertiaTensor[i][2]/ang2AU);
215+ }
216+ cout << "\n";
217+
218+ cout << this->messagePrincipalAxesTitleAU;
219+ for(int i=0; i<3; i++){
220+ printf("\t\t%e\t%e\t%e\t%e\n",inertiaMoments[i],
221+ inertiaTensor[i][0],
222+ inertiaTensor[i][1],
223+ inertiaTensor[i][2]);
224+ }
225+ cout << "\n";
226+
227+}
228+
229+void Molecule::OutputInertiaTensorOrigin(){
230+ double ang2AU = Parameters::GetInstance()->GetAngstrom2AU();
231+
232+ cout << this->messageInertiaTensorOrigin;
233+ cout << this->messageInertiaTensorOriginTitleAng;
234+ printf("\t\t%e\t%e\t%e\n",this->inertiaTensorOrigin[0]/ang2AU,
235+ this->inertiaTensorOrigin[1]/ang2AU,
236+ this->inertiaTensorOrigin[2]/ang2AU);
237+ cout << "\n";
238+
239+ cout << this->messageInertiaTensorOriginTitleAU;
240+ printf("\t\t%e\t%e\t%e\n",this->inertiaTensorOrigin[0],
241+ this->inertiaTensorOrigin[1],
242+ this->inertiaTensorOrigin[2]);
243+ cout << "\n";
244+
245+}
246+
189247 void Molecule::SetInertiaTensorOrigin(double x, double y, double z){
190248 if(this->inertiaTensorOrigin == NULL){
191249 this->inertiaTensorOrigin = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3);
@@ -209,8 +267,13 @@ void Molecule::CalcPrincipalAxes(){
209267 try{
210268 this->CalcInertiaTensor(inertiaTensor);
211269
212- // ToDo: diagonalization!!!!!!
213-
270+ bool calcEigenVectors = true;
271+ MolDS_mkl_wrapper::LapackWrapper::GetInstance()->Dsyevd(inertiaTensor,
272+ inertiaMoments,
273+ 3,
274+ calcEigenVectors);
275+ this->OutputPrincipalAxes(inertiaTensor, inertiaMoments);
276+ this->OutputInertiaTensorOrigin();
214277 }
215278 catch(MolDSException ex){
216279 this->FreeInertiaTensorMoments(inertiaTensor, inertiaMoments);
--- a/src/input.in
+++ b/src/input.in
@@ -12,7 +12,7 @@ THEORY
1212 THEORY_END
1313
1414 INERTIA
15- origin 1.0 2.0 3.0
15+ //origin 1.0 2.0 3.0
1616 INERTIA_END
1717
1818