• 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

Revisiondf42b133532c2c06c133905373a759669f8d8f0a (tree)
Zeit2011-09-30 21:42:20
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Molecule::CalcXyzCOM is modified to calculate COM for eveytime when this method is called.

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

Ändern Zusammenfassung

Diff

--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -162,29 +162,27 @@ double* Molecule::GetXyzCOM(){
162162 }
163163
164164 void Molecule::CalcXyzCOM(){
165- if(!this->wasCalculatedXyzCOM){
166- double totalAtomicMass;
167- Atom* atom;
168- double* atomicXyz;
169- double atomicMass;
165+ double totalAtomicMass;
166+ Atom* atom;
167+ double* atomicXyz;
168+ double atomicMass;
170169
171- for(int j=0; j<3; j++){
172- this->xyzCOM[j] = 0.0;
173- }
170+ for(int j=0; j<3; j++){
171+ this->xyzCOM[j] = 0.0;
172+ }
174173
175- for(int i=0; i<this->atomVect->size(); i++){
176- atom = (*this->atomVect)[i];
177- atomicXyz = atom->GetXyz();
178- atomicMass = atom->GetAtomicMass();
179- totalAtomicMass += atomicMass;
180- for(int j=0; j<3; j++){
181- this->xyzCOM[j] += atomicXyz[j] * atomicMass;
182- }
183- }
184- for(int i=0; i<3; i++){
185- this->xyzCOM[i]/=totalAtomicMass;
174+ for(int i=0; i<this->atomVect->size(); i++){
175+ atom = (*this->atomVect)[i];
176+ atomicXyz = atom->GetXyz();
177+ atomicMass = atom->GetAtomicMass();
178+ totalAtomicMass += atomicMass;
179+ for(int j=0; j<3; j++){
180+ this->xyzCOM[j] += atomicXyz[j] * atomicMass;
186181 }
187182 }
183+ for(int i=0; i<3; i++){
184+ this->xyzCOM[i]/=totalAtomicMass;
185+ }
188186 this->wasCalculatedXyzCOM = true;
189187 }
190188