• 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évision8253f95746f2a27a5a8fa034eba6e8a291c1aa5b (tree)
l'heure2013-08-08 19:43:41
AuteurKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Message de Log

Factor out BFGS::CalcDisplacement. #31856

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

Change Summary

Modification

--- a/src/optimization/BFGS.cpp
+++ b/src/optimization/BFGS.cpp
@@ -205,14 +205,8 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct
205205 }
206206
207207 //Calculate displacement (K_k at Eq. (15) in [SJTO_1983])
208- MallocerFreer::GetInstance()->Malloc(&matrixDisplacement, molecule.GetNumberAtoms(), CartesianType_end);
209- for(int i=0;i<molecule.GetNumberAtoms();i++){
210- const Atom* atom = molecule.GetAtom(i);
211- const double* xyz = atom->GetXyz();
212- for(int j=0;j<CartesianType_end;j++){
213- matrixDisplacement[i][j] = xyz[j] - matrixOldCoordinates[i][j];
214- }
215- }
208+ this->CalcDisplacement(matrixDisplacement, matrixOldCoordinates, molecule);
209+
216210 matrixForce = electronicStructure->GetForce(elecState);
217211 vectorForce = &matrixForce[0][0];
218212
@@ -568,4 +562,18 @@ void BFGS::RollbackMolecularGeometry(MolDS_base::Molecule& molecule,
568562 }
569563 molecule.SetCanOutputLogs(tempCanOutputLogs);
570564 }
565+
566+void BFGS::CalcDisplacement(double * *& matrixDisplacement,
567+ double const* const* matrixOldCoordinates,
568+ const MolDS_base::Molecule& molecule)const{
569+ //Calculate displacement (K_k at Eq. (15) in [SJTO_1983])
570+ MallocerFreer::GetInstance()->Malloc(&matrixDisplacement, molecule.GetNumberAtoms(), CartesianType_end);
571+ for(int i=0;i<molecule.GetNumberAtoms();i++){
572+ const Atom* atom = molecule.GetAtom(i);
573+ const double* xyz = atom->GetXyz();
574+ for(int j=0;j<CartesianType_end;j++){
575+ matrixDisplacement[i][j] = xyz[j] - matrixOldCoordinates[i][j];
576+ }
577+ }
578+}
571579 }
--- a/src/optimization/BFGS.h
+++ b/src/optimization/BFGS.h
@@ -56,6 +56,9 @@ protected:
5656 double const* vectorForce,
5757 const double maxNormStep,
5858 const int dimension) const;
59+ void CalcDisplacement(double * *& matrixDisplacement,
60+ double const* const* matrixOldCoordinates,
61+ const MolDS_base::Molecule& molecule)const;
5962 void UpdateHessian(double** matrixHessian,
6063 const int dimension,
6164 double const* vectorForce,