Revisión | 9660892e0aea1d75ff76355c00b404c6687611ed (tree) |
---|---|
Tiempo | 2012-11-20 02:07:23 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
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
@@ -625,7 +625,6 @@ void Molecule::OutputRotatingConditions(RotatingType rotatingType, | ||
625 | 625 | } |
626 | 626 | } |
627 | 627 | |
628 | - | |
629 | 628 | void Molecule::Translate(){ |
630 | 629 | this->OutputLog(this->messageStartTranslate); |
631 | 630 | double x = Parameters::GetInstance()->GetTranslatingDifference()[0]; |
@@ -681,6 +680,41 @@ double Molecule::GetDistanceAtoms(const Atom& atomA, const Atom& atomB) const{ | ||
681 | 680 | |
682 | 681 | } |
683 | 682 | |
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 | + | |
684 | 718 | } |
685 | 719 | |
686 | 720 |
@@ -50,6 +50,9 @@ public: | ||
50 | 50 | double GetDistanceAtoms(int indexAtomA, int indexAtomB) const; |
51 | 51 | double GetDistanceAtoms(const MolDS_base_atoms::Atom& atomA, |
52 | 52 | 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); | |
53 | 56 | private: |
54 | 57 | std::vector<MolDS_base_atoms::Atom*>* atomVect; |
55 | 58 | double* xyzCOM; // x, y, z coordinates of Center of Mass; |
@@ -126,14 +126,14 @@ void MC::DoMC(int totalSteps, int elecState, double temperature, double stepWidt | ||
126 | 126 | |
127 | 127 | // which Electronic Structure is used? |
128 | 128 | if(UsesTrial(*currentES, *trialES, elecState, &realRand, temperature)){ |
129 | - this->SynchronousMolecularConfiguration(this->molecule, trialMolecule); | |
129 | + this->molecule->SynchronizeConfigurationTo(trialMolecule); | |
130 | 130 | swap(currentES, trialES); |
131 | 131 | currentES->SetMolecule(this->molecule); |
132 | 132 | trialES->SetMolecule(&trialMolecule); |
133 | 133 | transitionRate += 1.0; |
134 | 134 | } |
135 | 135 | else{ |
136 | - this->SynchronousMolecularConfiguration(&trialMolecule, *this->molecule); | |
136 | + trialMolecule.SynchronizeConfigurationTo(*this->molecule); | |
137 | 137 | } |
138 | 138 | |
139 | 139 | // output molecular states |
@@ -205,19 +205,6 @@ bool MC::UsesTrial(const ElectronicStructure& currentES, | ||
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
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 | - | |
221 | 208 | void MC::OutputMolecule(const ElectronicStructure& electronicStructure, |
222 | 209 | const Molecule& molecule, |
223 | 210 | int elecState) const{ |
@@ -55,8 +55,6 @@ private: | ||
55 | 55 | boost::uniform_real<> |
56 | 56 | > (*realRand), |
57 | 57 | double dr) const; |
58 | - void SynchronousMolecularConfiguration(MolDS_base::Molecule* target, | |
59 | - const MolDS_base::Molecule& refference) const; | |
60 | 58 | bool UsesTrial(const MolDS_base::ElectronicStructure& currentES, |
61 | 59 | const MolDS_base::ElectronicStructure& trialES, |
62 | 60 | int elecState, |
@@ -145,8 +145,8 @@ void NASCO::DoNASCO(Molecule& molecule){ | ||
145 | 145 | // decide next eigenstates |
146 | 146 | this->DecideNextElecState(&elecState, &nonAdiabaticPhaseIndex, numElecStates, overlapESs, &realRand); |
147 | 147 | |
148 | - // Synchronous molecular configuration and electronic states | |
149 | - this->SynchronousMolecularConfiguration(molecule, tmpMolecule); | |
148 | + // Synchronize molecular configuration and electronic states | |
149 | + molecule.SynchronizeConfigurationTo(tmpMolecule); | |
150 | 150 | swap(currentES, tmpES); |
151 | 151 | currentES->SetMolecule(&molecule); |
152 | 152 | tmpES->SetMolecule(&tmpMolecule); |
@@ -197,19 +197,6 @@ void NASCO::UpdateCoordinates(Molecule& tmpMolecule, | ||
197 | 197 | tmpMolecule.CalcXyzCOC(); |
198 | 198 | } |
199 | 199 | |
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 | - | |
213 | 200 | void NASCO::DecideNextElecState(int* elecState, |
214 | 201 | int* nonAdiabaticPhaseIndex, |
215 | 202 | int numElecStates, |
@@ -58,8 +58,6 @@ private: | ||
58 | 58 | void UpdateCoordinates(MolDS_base::Molecule& tmpMolecule, |
59 | 59 | const MolDS_base::Molecule& molecule, |
60 | 60 | const double dt) const; |
61 | - void SynchronousMolecularConfiguration(MolDS_base::Molecule& target, | |
62 | - const MolDS_base::Molecule& refference) const; | |
63 | 61 | void DecideNextElecState(int* elecState, |
64 | 62 | int* nonAdiabaticPhaseIndex, |
65 | 63 | int numElecStates, |