• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisão687c9166f823b296ad27b6e74bb7e35e80eaf2bc (tree)
Hora2011-01-07 11:07:31
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Mensagem de Log

Translate molecule is refactored.

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

Mudança Sumário

Diff

--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -258,7 +258,7 @@ void InputParser::Parse(Molecule* molecule){
258258 double x = atof(inputTerms[j+1].c_str()) * Parameters::GetInstance()->GetAngstrom2AU();
259259 double y = atof(inputTerms[j+2].c_str()) * Parameters::GetInstance()->GetAngstrom2AU();
260260 double z = atof(inputTerms[j+3].c_str()) * Parameters::GetInstance()->GetAngstrom2AU();
261- molecule->SetTranslatingDifference(x, y, z);
261+ Parameters::GetInstance()->SetTranslatingDifference(x, y, z);
262262 j+=3;
263263 }
264264 j++;
--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -36,7 +36,6 @@ public:
3636 void SetRotatingAngle(double angle);
3737 void SetRotatingEularAngles(double alpha, double beta, double gamma);
3838 void SetRotatingType(RotatingType rotatingType);
39- void SetTranslatingDifference(double x, double y, double z);
4039 void Translate();
4140 private:
4241 vector<Atom*>* atomVect;
@@ -45,7 +44,6 @@ private:
4544 double* rotatingOrigin;
4645 double* rotatingAxis;
4746 double rotatingAngle;
48- double* translatingDifference;
4947 EularAngle* rotatingEularAngles;
5048 RotatingType rotatingType;
5149 bool wasCalculatedCOMXyz;
@@ -56,7 +54,7 @@ private:
5654 void OutputPrincipalAxes(double** inertiaTensor, double* inertiaMoments);
5755 void OutputInertiaTensorOrigin();
5856 void OutputRotatingConditions();
59- void OutputTranslatingConditions();
57+ void OutputTranslatingConditions(double* translatingDifference);
6058 string messageTotalNumberAOs;
6159 string messageTotalNumberAtoms;
6260 string messageTotalNumberValenceElectrons;
@@ -174,11 +172,6 @@ Molecule::~Molecule(){
174172 this->rotatingEularAngles = NULL;
175173 //cout << "rotatingEularAngles deleted\n";
176174 }
177- if(this->translatingDifference != NULL){
178- MallocerFreer::GetInstance()->FreeDoubleMatrix1d(this->translatingDifference);
179- this->translatingDifference = NULL;
180- //cout << "translatingDifference deleted\n";
181- }
182175 }
183176
184177 vector<Atom*>* Molecule::GetAtomVect(){
@@ -558,37 +551,23 @@ void Molecule::OutputRotatingConditions(){
558551
559552 }
560553
561-void Molecule::SetTranslatingDifference(double x, double y, double z){
562- if(this->translatingDifference == NULL){
563- this->translatingDifference = MallocerFreer::GetInstance()->MallocDoubleMatrix1d(3);
564- }
565-
566- this->translatingDifference[0] = x;
567- this->translatingDifference[1] = y;
568- this->translatingDifference[2] = z;
569-
570-}
571554
572-/****
573- * Call this->SetTranslatingDifference before calling this-function.
574- ***/
575555 void Molecule::Translate(){
576556
577557 cout << this->messageStartTranslate;
578558
579- if(this->translatingDifference == NULL){
580- this->SetTranslatingDifference(0.0, 0.0, 0.0);
581- }
559+ double x = Parameters::GetInstance()->GetTranslatingDifference()[0];
560+ double y = Parameters::GetInstance()->GetTranslatingDifference()[1];
561+ double z = Parameters::GetInstance()->GetTranslatingDifference()[2];
582562
583-
584- this->OutputTranslatingConditions();
563+ this->OutputTranslatingConditions(Parameters::GetInstance()->GetTranslatingDifference());
585564
586565 Atom* atom;
587566 for(int i=0; i<this->atomVect->size(); i++){
588567 atom = (*this->atomVect)[i];
589- atom->GetXyz()[0] += this->translatingDifference[0];
590- atom->GetXyz()[1] += this->translatingDifference[1];
591- atom->GetXyz()[2] += this->translatingDifference[2];
568+ atom->GetXyz()[0] += x;
569+ atom->GetXyz()[1] += y;
570+ atom->GetXyz()[2] += z;
592571 }
593572
594573 this->wasCalculatedCOMXyz = false;
@@ -600,21 +579,20 @@ void Molecule::Translate(){
600579 cout << this->messageDoneTranslate;
601580 }
602581
603-void Molecule::OutputTranslatingConditions(){
582+void Molecule::OutputTranslatingConditions(double* translatingDifference){
604583
605584 double angst2AU = Parameters::GetInstance()->GetAngstrom2AU();
606585
607- // rotating origin
608586 cout << this->messageTranslatingDifference;
609587 cout << this->messageTranslatingDifferenceTitleAng;
610- printf("\t\t%e\t%e\t%e\n\n",this->translatingDifference[0]/angst2AU,
611- this->translatingDifference[1]/angst2AU,
612- this->translatingDifference[2]/angst2AU);
588+ printf("\t\t%e\t%e\t%e\n\n",translatingDifference[0]/angst2AU,
589+ translatingDifference[1]/angst2AU,
590+ translatingDifference[2]/angst2AU);
613591
614592 cout << this->messageTranslatingDifferenceTitleAU;
615- printf("\t\t%e\t%e\t%e\n\n",this->translatingDifference[0],
616- this->translatingDifference[1],
617- this->translatingDifference[2]);
593+ printf("\t\t%e\t%e\t%e\n\n",translatingDifference[0],
594+ translatingDifference[1],
595+ translatingDifference[2]);
618596
619597 }
620598
--- a/src/base/Parameters.h
+++ b/src/base/Parameters.h
@@ -27,6 +27,8 @@ public:
2727 double GetBondingAdjustParameterK();
2828 TheoryType GetCurrentTheory();
2929 void SetCurrentTheory(TheoryType theory);
30+ void SetTranslatingDifference(double x, double y, double z);
31+ double* GetTranslatingDifference();
3032
3133 private:
3234 static Parameters* parameters;
@@ -45,6 +47,7 @@ private:
4547 double degree2Radian;
4648 double bondingAdjustParameterK; //see (3.79) in J. A. Pople book
4749 TheoryType currentTheory;
50+ double translatingDifference[3];
4851
4952 };
5053 Parameters* Parameters::parameters = NULL;
@@ -79,6 +82,9 @@ void Parameters::SetDefaultValues(){
7982 this->currentTheory = CNDO2;
8083 this->gMolin2AU = pow(10.0,5.0)/(6.0221415*9.1095);
8184 this->degree2Radian = M_PI / 180.0;
85+ this->translatingDifference[0] = 0.0;
86+ this->translatingDifference[1] = 0.0;
87+ this->translatingDifference[2] = 0.0;
8288 }
8389
8490 double Parameters::GetThresholdSCF(){
@@ -129,6 +135,17 @@ void Parameters::SetCurrentTheory(TheoryType theory){
129135 this->currentTheory = theory;
130136 }
131137
138+void Parameters::SetTranslatingDifference(double x, double y, double z){
139+ this->translatingDifference[0] = x;
140+ this->translatingDifference[1] = y;
141+ this->translatingDifference[2] = z;
142+}
143+
144+double* Parameters::GetTranslatingDifference(){
145+ return this->translatingDifference;
146+}
147+
148+
132149 }
133150 #endif
134151