修订版 | f91b082963ada498a9462715519d3d9843802dd6 (tree) |
---|---|
时间 | 2013-07-24 18:41:34 |
作者 | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
const is added to ElectronicStructure::GetForce. #29723
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1418 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -33,8 +33,8 @@ public: | ||
33 | 33 | virtual void OutputCISResults() const = 0; |
34 | 34 | virtual double const* const* GetMatrixCIS() const = 0; |
35 | 35 | virtual double const* GetExcitedEnergies() const = 0; |
36 | - virtual double** GetForce(int elecState) = 0; | |
37 | - virtual double*** GetForce(const std::vector<int>& elecStates) = 0; | |
36 | + virtual double const* const* GetForce(int elecState) = 0; | |
37 | + virtual double const* const* const* GetForce(const std::vector<int>& elecStates) = 0; | |
38 | 38 | virtual double GetElectronicEnergy(int elecState) const = 0; |
39 | 39 | virtual double GetCoreRepulsionEnergy() const = 0; |
40 | 40 | virtual double GetVdWCorrectionEnergy() const = 0; |
@@ -709,12 +709,12 @@ double Cndo2::GetVdWCorrectionEnergy() const{ | ||
709 | 709 | return this->vdWCorrectionEnergy; |
710 | 710 | } |
711 | 711 | |
712 | -double*** Cndo2::GetForce(const vector<int>& elecStates){ | |
712 | +double const* const* const* Cndo2::GetForce(const vector<int>& elecStates){ | |
713 | 713 | this->CalcForce(elecStates); |
714 | 714 | return this->matrixForce; |
715 | 715 | } |
716 | 716 | |
717 | -double** Cndo2::GetForce(int elecState){ | |
717 | +double const* const* Cndo2::GetForce(int elecState){ | |
718 | 718 | vector<int> elecStates; |
719 | 719 | elecStates.push_back(elecState); |
720 | 720 | this->CalcForce(elecStates); |
@@ -37,8 +37,8 @@ public: | ||
37 | 37 | virtual void OutputCISResults() const; |
38 | 38 | double const* const* GetMatrixCIS() const{return this->matrixCIS;}; |
39 | 39 | double const* GetExcitedEnergies() const{return this->excitedEnergies;}; |
40 | - double** GetForce(int elecState); | |
41 | - double*** GetForce(const std::vector<int>& elecStates); | |
40 | + double const* const* GetForce(int elecState); | |
41 | + double const* const* const* GetForce(const std::vector<int>& elecStates); | |
42 | 42 | double GetElectronicEnergy(int elecState) const; |
43 | 43 | double GetCoreRepulsionEnergy() const; |
44 | 44 | double GetVdWCorrectionEnergy() const; |
@@ -76,8 +76,8 @@ void MD::DoMD(){ | ||
76 | 76 | double dt = Parameters::GetInstance()->GetTimeWidthMD(); |
77 | 77 | double time = 0.0; |
78 | 78 | bool requireGuess = false; |
79 | - double** matrixForce = NULL; | |
80 | 79 | double initialEnergy = 0.0; |
80 | + double const* const* matrixForce = NULL; | |
81 | 81 | |
82 | 82 | // initial calculation |
83 | 83 | electronicStructure->DoSCF(); |
@@ -90,8 +90,8 @@ void NASCO::DoNASCO(Molecule& molecule){ | ||
90 | 90 | int nonAdiabaticPhaseIndex = 0; |
91 | 91 | double time = 0.0; |
92 | 92 | bool requireGuess = false; |
93 | - double** matrixForce = NULL; | |
94 | 93 | double initialEnergy = 0.0; |
94 | + double const* const* matrixForce = NULL; | |
95 | 95 | |
96 | 96 | // initial calculation |
97 | 97 | elecState = Parameters::GetInstance()->GetInitialElectronicStateNASCO(); |
@@ -106,10 +106,10 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct | ||
106 | 106 | int totalSteps = Parameters::GetInstance()->GetTotalStepsOptimization(); |
107 | 107 | double maxGradientThreshold = Parameters::GetInstance()->GetMaxGradientOptimization(); |
108 | 108 | double rmsGradientThreshold = Parameters::GetInstance()->GetRmsGradientOptimization(); |
109 | - double lineSearchCurrentEnergy = 0.0; | |
110 | - double lineSearchInitialEnergy = 0.0; | |
111 | - double** matrixForce = NULL; | |
112 | - double* vectorForce = NULL; | |
109 | + double lineSearchCurrentEnergy = 0.0; | |
110 | + double lineSearchInitialEnergy = 0.0; | |
111 | + double const* const* matrixForce = NULL; | |
112 | + double const* vectorForce = NULL; | |
113 | 113 | const int dimension = molecule.GetNumberAtoms()*CartesianType_end; |
114 | 114 | double** matrixHessian = NULL; |
115 | 115 | double* vectorOldForce = NULL; |
@@ -74,7 +74,7 @@ void ConjugateGradient::SearchMinimum(boost::shared_ptr<ElectronicStructure> ele | ||
74 | 74 | double rmsGradientThreshold = Parameters::GetInstance()->GetRmsGradientOptimization(); |
75 | 75 | double lineSearchCurrentEnergy = 0.0; |
76 | 76 | double lineSearchInitialEnergy = 0.0; |
77 | - double** matrixForce = NULL; | |
77 | + double const* const* matrixForce = NULL; | |
78 | 78 | double** oldMatrixForce = NULL; |
79 | 79 | double** matrixSearchDirection = NULL; |
80 | 80 |
@@ -127,7 +127,7 @@ void ConjugateGradient::SearchMinimum(boost::shared_ptr<ElectronicStructure> ele | ||
127 | 127 | *lineSearchedEnergy = lineSearchCurrentEnergy; |
128 | 128 | } |
129 | 129 | |
130 | -void ConjugateGradient::UpdateSearchDirection(double*** matrixForce, | |
130 | +void ConjugateGradient::UpdateSearchDirection(double const* const** matrixForce, | |
131 | 131 | double** oldMatrixForce, |
132 | 132 | double** matrixSearchDirection, |
133 | 133 | boost::shared_ptr<ElectronicStructure> electronicStructure, |
@@ -33,7 +33,7 @@ private: | ||
33 | 33 | MolDS_base::Molecule& molecule, |
34 | 34 | double* lineSearchedEnergy, |
35 | 35 | bool* obainesOptimizedStructure) const; |
36 | - void UpdateSearchDirection(double*** matrixForce, | |
36 | + void UpdateSearchDirection(double const* const** matrixForce, | |
37 | 37 | double** oldMatrixForce, |
38 | 38 | double** matrixSearchDirection, |
39 | 39 | boost::shared_ptr<MolDS_base::ElectronicStructure> electronicStructure, |
@@ -212,7 +212,7 @@ void Optimizer::LineSearch(boost::shared_ptr<ElectronicStructure> electronicStru | ||
212 | 212 | lineSearchCurrentEnergy = electronicStructure->GetElectronicEnergy(elecState); |
213 | 213 | } |
214 | 214 | |
215 | -bool Optimizer::SatisfiesConvergenceCriterion(double** matrixForce, | |
215 | +bool Optimizer::SatisfiesConvergenceCriterion(double const* const* matrixForce, | |
216 | 216 | const MolDS_base::Molecule& molecule, |
217 | 217 | double oldEnergy, |
218 | 218 | double currentEnergy, |
@@ -37,7 +37,7 @@ protected: | ||
37 | 37 | MolDS_base::Molecule& molecule, |
38 | 38 | bool requireGuess, |
39 | 39 | bool printsLogs) const; |
40 | - bool SatisfiesConvergenceCriterion(double** matrixForce, | |
40 | + bool SatisfiesConvergenceCriterion(double const* const* matrixForce, | |
41 | 41 | const MolDS_base::Molecule& molecule, |
42 | 42 | double oldEnergy, |
43 | 43 | double currentEnergy, |
@@ -71,9 +71,9 @@ void SteepestDescent::SearchMinimum(boost::shared_ptr<ElectronicStructure> elect | ||
71 | 71 | int totalSteps = Parameters::GetInstance()->GetTotalStepsOptimization(); |
72 | 72 | double maxGradientThreshold = Parameters::GetInstance()->GetMaxGradientOptimization(); |
73 | 73 | double rmsGradientThreshold = Parameters::GetInstance()->GetRmsGradientOptimization(); |
74 | - double lineSearchCurrentEnergy = 0.0; | |
75 | - double lineSearchInitialEnergy = 0.0; | |
76 | - double** matrixForce = NULL; | |
74 | + double lineSearchCurrentEnergy = 0.0; | |
75 | + double lineSearchInitialEnergy = 0.0; | |
76 | + double const* const* matrixForce = NULL; | |
77 | 77 | |
78 | 78 | // initial calculation |
79 | 79 | bool requireGuess = true; |
@@ -95,7 +95,8 @@ void RPMD::UpdateMomenta(const vector<boost::shared_ptr<Molecule> >& molecularBe | ||
95 | 95 | for(int b=0; b<numBeads; b++){ |
96 | 96 | int preB = b==0 ? numBeads-1 : b-1; |
97 | 97 | int postB = b==numBeads-1 ? 0 : b+1; |
98 | - double** electronicForceMatrix = electronicStructureBeads[b]->GetForce(elecState);; | |
98 | + double const* const* electronicForceMatrix | |
99 | + = electronicStructureBeads[b]->GetForce(elecState);; | |
99 | 100 | for(int a=0; a<numAtom; a++){ |
100 | 101 | Atom* atom = molecularBeads[b]->GetAtom(a); |
101 | 102 | Atom* preAtom = molecularBeads[preB]->GetAtom(a); |