• 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

Revisión9660892e0aea1d75ff76355c00b404c6687611ed (tree)
Tiempo2012-11-20 02:07:23
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

Sync methods for molecular configuration and momenuta are added to Molecule-class. #30153

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

Cambiar Resumen

Diferencia incremental

--- a/src/base/Molecule.cpp
+++ b/src/base/Molecule.cpp
@@ -625,7 +625,6 @@ void Molecule::OutputRotatingConditions(RotatingType rotatingType,
625625 }
626626 }
627627
628-
629628 void Molecule::Translate(){
630629 this->OutputLog(this->messageStartTranslate);
631630 double x = Parameters::GetInstance()->GetTranslatingDifference()[0];
@@ -681,6 +680,41 @@ double Molecule::GetDistanceAtoms(const Atom& atomA, const Atom& atomB) const{
681680
682681 }
683682
683+void Molecule::SynchronizeConfigurationTo(const Molecule& ref){
684+ for(int a=0; a<this->GetNumberAtoms(); a++){
685+ Atom& atom = *this->GetAtom(a);
686+ const Atom& refAtom = *ref.GetAtom(a);
687+ for(int i=0; i<CartesianType_end; i++){
688+ atom.GetXyz()[i] = refAtom.GetXyz()[i];
689+ }
690+ }
691+ this->CalcXyzCOC();
692+ this->CalcXyzCOM();
693+}
694+
695+void Molecule::SynchronizeMomentaTo(const Molecule& ref){
696+ for(int a=0; a<this->GetNumberAtoms(); a++){
697+ Atom& atom = *this->GetAtom(a);
698+ const Atom& refAtom = *ref.GetAtom(a);
699+ for(int i=0; i<CartesianType_end; i++){
700+ atom.GetPxyz()[i] = refAtom.GetPxyz()[i];
701+ }
702+ }
703+}
704+
705+void Molecule::SynchronizePhaseSpacePointTo(const Molecule& ref){
706+ for(int a=0; a<this->GetNumberAtoms(); a++){
707+ Atom& atom = *this->GetAtom(a);
708+ const Atom& refAtom = *ref.GetAtom(a);
709+ for(int i=0; i<CartesianType_end; i++){
710+ atom.GetXyz() [i] = refAtom.GetXyz() [i];
711+ atom.GetPxyz()[i] = refAtom.GetPxyz()[i];
712+ }
713+ }
714+ this->CalcXyzCOC();
715+ this->CalcXyzCOM();
716+}
717+
684718 }
685719
686720
--- a/src/base/Molecule.h
+++ b/src/base/Molecule.h
@@ -50,6 +50,9 @@ public:
5050 double GetDistanceAtoms(int indexAtomA, int indexAtomB) const;
5151 double GetDistanceAtoms(const MolDS_base_atoms::Atom& atomA,
5252 const MolDS_base_atoms::Atom& atomB) const;
53+ void SynchronizeConfigurationTo (const Molecule& ref);
54+ void SynchronizeMomentaTo (const Molecule& ref);
55+ void SynchronizePhaseSpacePointTo(const Molecule& ref);
5356 private:
5457 std::vector<MolDS_base_atoms::Atom*>* atomVect;
5558 double* xyzCOM; // x, y, z coordinates of Center of Mass;
--- a/src/mc/MC.cpp
+++ b/src/mc/MC.cpp
@@ -126,14 +126,14 @@ void MC::DoMC(int totalSteps, int elecState, double temperature, double stepWidt
126126
127127 // which Electronic Structure is used?
128128 if(UsesTrial(*currentES, *trialES, elecState, &realRand, temperature)){
129- this->SynchronousMolecularConfiguration(this->molecule, trialMolecule);
129+ this->molecule->SynchronizeConfigurationTo(trialMolecule);
130130 swap(currentES, trialES);
131131 currentES->SetMolecule(this->molecule);
132132 trialES->SetMolecule(&trialMolecule);
133133 transitionRate += 1.0;
134134 }
135135 else{
136- this->SynchronousMolecularConfiguration(&trialMolecule, *this->molecule);
136+ trialMolecule.SynchronizeConfigurationTo(*this->molecule);
137137 }
138138
139139 // output molecular states
@@ -205,19 +205,6 @@ bool MC::UsesTrial(const ElectronicStructure& currentES,
205205 }
206206 }
207207
208-void MC::SynchronousMolecularConfiguration(Molecule* target,
209- const Molecule& refference) const{
210- for(int a=0; a<target->GetNumberAtoms(); a++){
211- Atom* targetAtom = target->GetAtom(a);
212- const Atom& refferenceAtom = *refference.GetAtom(a);
213- for(int i=0; i<CartesianType_end; i++){
214- targetAtom->GetXyz()[i] = refferenceAtom.GetXyz()[i];
215- }
216- }
217- target->CalcXyzCOC();
218- target->CalcXyzCOM();
219-}
220-
221208 void MC::OutputMolecule(const ElectronicStructure& electronicStructure,
222209 const Molecule& molecule,
223210 int elecState) const{
--- a/src/mc/MC.h
+++ b/src/mc/MC.h
@@ -55,8 +55,6 @@ private:
5555 boost::uniform_real<>
5656 > (*realRand),
5757 double dr) const;
58- void SynchronousMolecularConfiguration(MolDS_base::Molecule* target,
59- const MolDS_base::Molecule& refference) const;
6058 bool UsesTrial(const MolDS_base::ElectronicStructure& currentES,
6159 const MolDS_base::ElectronicStructure& trialES,
6260 int elecState,
--- a/src/nasco/NASCO.cpp
+++ b/src/nasco/NASCO.cpp
@@ -145,8 +145,8 @@ void NASCO::DoNASCO(Molecule& molecule){
145145 // decide next eigenstates
146146 this->DecideNextElecState(&elecState, &nonAdiabaticPhaseIndex, numElecStates, overlapESs, &realRand);
147147
148- // Synchronous molecular configuration and electronic states
149- this->SynchronousMolecularConfiguration(molecule, tmpMolecule);
148+ // Synchronize molecular configuration and electronic states
149+ molecule.SynchronizeConfigurationTo(tmpMolecule);
150150 swap(currentES, tmpES);
151151 currentES->SetMolecule(&molecule);
152152 tmpES->SetMolecule(&tmpMolecule);
@@ -197,19 +197,6 @@ void NASCO::UpdateCoordinates(Molecule& tmpMolecule,
197197 tmpMolecule.CalcXyzCOC();
198198 }
199199
200-void NASCO::SynchronousMolecularConfiguration(Molecule& target,
201- const Molecule& refference) const{
202- for(int a=0; a<target.GetNumberAtoms(); a++){
203- Atom& targetAtom = *target.GetAtom(a);
204- const Atom& refferenceAtom = *refference.GetAtom(a);
205- for(int i=0; i<CartesianType_end; i++){
206- targetAtom.GetXyz()[i] = refferenceAtom.GetXyz()[i];
207- }
208- }
209- target.CalcXyzCOC();
210- target.CalcXyzCOM();
211-}
212-
213200 void NASCO::DecideNextElecState(int* elecState,
214201 int* nonAdiabaticPhaseIndex,
215202 int numElecStates,
--- a/src/nasco/NASCO.h
+++ b/src/nasco/NASCO.h
@@ -58,8 +58,6 @@ private:
5858 void UpdateCoordinates(MolDS_base::Molecule& tmpMolecule,
5959 const MolDS_base::Molecule& molecule,
6060 const double dt) const;
61- void SynchronousMolecularConfiguration(MolDS_base::Molecule& target,
62- const MolDS_base::Molecule& refference) const;
6361 void DecideNextElecState(int* elecState,
6462 int* nonAdiabaticPhaseIndex,
6563 int numElecStates,