Révision | 82f9cbd8ff2b6cfe0642b380a6348ce7caaf9454 (tree) |
---|---|
l'heure | 2013-12-31 17:19:34 |
Auteur | mikiya_fujii <mikiya_fujii@1136...> |
Commiter | mikiya_fujii |
Refactring of access to Molecule::atomVect and Molecule::epcVect #32752
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1605 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -140,8 +140,8 @@ double Am1::GetDiatomCoreRepulsionEnergy(int indexAtomA, int indexAtomB) const{ | ||
140 | 140 | double mndoTerm = Mndo::GetDiatomCoreRepulsionEnergy(indexAtomA, indexAtomB); |
141 | 141 | |
142 | 142 | // additional term, Eq. (4) in [S_1989]. |
143 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
144 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
143 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
144 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
145 | 145 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
146 | 146 | double ang2AU = Parameters::GetInstance()->GetAngstrom2AU(); |
147 | 147 | double alphaA = atomA.GetNddoAlpha(this->theory); |
@@ -174,8 +174,8 @@ double Am1::GetDiatomCoreRepulsion1stDerivative(int indexAtomA, | ||
174 | 174 | |
175 | 175 | // additional term, first derivative of eq. (4) in [S_1989] |
176 | 176 | double ang2AU = Parameters::GetInstance()->GetAngstrom2AU(); |
177 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
178 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
177 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
178 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
179 | 179 | double alphaA = atomA.GetNddoAlpha(this->theory); |
180 | 180 | double alphaB = atomB.GetNddoAlpha(this->theory); |
181 | 181 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
@@ -215,8 +215,8 @@ double Am1::GetDiatomCoreRepulsion2ndDerivative(int indexAtomA, | ||
215 | 215 | |
216 | 216 | // additional term, first derivative of eq. (4) in [S_1989] |
217 | 217 | double ang2AU = Parameters::GetInstance()->GetAngstrom2AU(); |
218 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
219 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
218 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
219 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
220 | 220 | double alphaA = atomA.GetNddoAlpha(this->theory); |
221 | 221 | double alphaB = atomB.GetNddoAlpha(this->theory); |
222 | 222 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
@@ -487,7 +487,7 @@ int InputParser::ParseMolecularGeometry(Molecule* molecule, vector<string>* inpu | ||
487 | 487 | else if((*inputTerms)[parseIndex] == "s"){ |
488 | 488 | atomType = S; |
489 | 489 | } |
490 | - int index = molecule->GetNumberAtoms(); | |
490 | + int index = molecule->GetAtomVect().size(); | |
491 | 491 | Atom* atom = AtomFactory::Create(atomType, index, x, y, z); |
492 | 492 | molecule->AddAtom(atom); |
493 | 493 | parseIndex += 4; |
@@ -508,7 +508,7 @@ int InputParser::ParseEpcsConfiguration(Molecule* molecule, vector<string>* inpu | ||
508 | 508 | parseIndex += 2; |
509 | 509 | } |
510 | 510 | AtomType atomType = EPC; |
511 | - int index = molecule->GetNumberEpcs(); | |
511 | + int index = molecule->GetEpcVect().size(); | |
512 | 512 | Atom* atom = AtomFactory::Create(atomType, index, x, y, z, charge); |
513 | 513 | molecule->AddEpc(atom); |
514 | 514 | } |
@@ -1360,7 +1360,7 @@ void InputParser::ValidateVdWConditions() const{ | ||
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | void InputParser::ValidateEpcConditions(const Molecule& molecule) const{ |
1363 | - if(molecule.GetNumberEpcs()<=0){return;} | |
1363 | + if(molecule.GetEpcVect().empty()){return;} | |
1364 | 1364 | TheoryType theory = Parameters::GetInstance()->GetCurrentTheory(); |
1365 | 1365 | // Validate theory |
1366 | 1366 | if(theory == MNDO || |
@@ -223,12 +223,10 @@ void Molecule::Finalize(vector<Atom*>** atomVect, | ||
223 | 223 | } |
224 | 224 | |
225 | 225 | void Molecule::SetMessages(){ |
226 | - this->errorMessageGetAtomNull = "Error in base::Molecule::GetAtom: atomVect is NULL.\n"; | |
227 | - this->errorMessageGetEPCNull = "Error in base::Molecule::GetEnviromentalPointCharge: enviromentalPointChargeVect is NULL.\n"; | |
226 | + this->errorMessageGetAtomVectNull = "Error in base::Molecule::GetAtomVect: atomVect is NULL.\n"; | |
227 | + this->errorMessageGetEPCVectNull = "Error in base::Molecule::GetEpcVect: epcVect is NULL.\n"; | |
228 | 228 | this->errorMessageAddAtomNull = "Error in base::Molecule::AddAtom: atomVect is NULL.\n"; |
229 | - this->errorMessageAddEPCNull = "Error in base::Molecule::AddEnviromentalPointCharge: enviromentalPointChargeVect is NULL.\n"; | |
230 | - this->errorMessageGetNumberAtomsNull = "Error in base::Molecule::GetNumberAtoms: atomVect is NULL.\n"; | |
231 | - this->errorMessageGetNumberEPCsNull = "Error in base::Molecule::GetNumberEnviromentalPointChargess: epcVect is NULL.\n"; | |
229 | + this->errorMessageAddEPCNull = "Error in base::Molecule::AddEnviromentalPointCharge: epcVect is NULL.\n"; | |
232 | 230 | this->errorMessageGetXyzCOMNull = "Error in base::Molecule::GetXyzCOM: xyzCOM is NULL.\n"; |
233 | 231 | this->errorMessageGetXyzCOCNull = "Error in base::Molecule::GetXyzCOC: xyzCOC is NULL.\n"; |
234 | 232 | this->errorMessageCalcXyzCOMNull = "Error in base::Molecule::CalcXyzCOM: xyzCOM is NULL.\n"; |
@@ -832,9 +830,9 @@ void Molecule::OutputTranslatingConditions(double const* translatingDifference) | ||
832 | 830 | } |
833 | 831 | |
834 | 832 | void Molecule::SynchronizeConfigurationTo(const Molecule& ref){ |
835 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
836 | - Atom& atom = *this->GetAtom(a); | |
837 | - const Atom& refAtom = *ref.GetAtom(a); | |
833 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
834 | + Atom& atom = *this->GetAtomVect()[a]; | |
835 | + const Atom& refAtom = *ref.GetAtomVect()[a]; | |
838 | 836 | for(int i=0; i<CartesianType_end; i++){ |
839 | 837 | atom.GetXyz()[i] = refAtom.GetXyz()[i]; |
840 | 838 | } |
@@ -843,9 +841,9 @@ void Molecule::SynchronizeConfigurationTo(const Molecule& ref){ | ||
843 | 841 | } |
844 | 842 | |
845 | 843 | void Molecule::SynchronizeMomentaTo(const Molecule& ref){ |
846 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
847 | - Atom& atom = *this->GetAtom(a); | |
848 | - const Atom& refAtom = *ref.GetAtom(a); | |
844 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
845 | + Atom& atom = *this->GetAtomVect()[a]; | |
846 | + const Atom& refAtom = *ref.GetAtomVect()[a]; | |
849 | 847 | for(int i=0; i<CartesianType_end; i++){ |
850 | 848 | atom.GetPxyz()[i] = refAtom.GetPxyz()[i]; |
851 | 849 | } |
@@ -853,9 +851,9 @@ void Molecule::SynchronizeMomentaTo(const Molecule& ref){ | ||
853 | 851 | } |
854 | 852 | |
855 | 853 | void Molecule::SynchronizePhaseSpacePointTo(const Molecule& ref){ |
856 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
857 | - Atom& atom = *this->GetAtom(a); | |
858 | - const Atom& refAtom = *ref.GetAtom(a); | |
854 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
855 | + Atom& atom = *this->GetAtomVect()[a]; | |
856 | + const Atom& refAtom = *ref.GetAtomVect()[a]; | |
859 | 857 | for(int i=0; i<CartesianType_end; i++){ |
860 | 858 | atom.GetXyz() [i] = refAtom.GetXyz() [i]; |
861 | 859 | atom.GetPxyz()[i] = refAtom.GetPxyz()[i]; |
@@ -865,19 +863,19 @@ void Molecule::SynchronizePhaseSpacePointTo(const Molecule& ref){ | ||
865 | 863 | } |
866 | 864 | |
867 | 865 | void Molecule::BroadcastConfigurationToAllProcesses(int root) const{ |
868 | - int numTransported = this->GetNumberAtoms()*CartesianType_end; | |
866 | + int numTransported = this->GetAtomVect().size()*CartesianType_end; | |
869 | 867 | double* tmp=NULL; |
870 | 868 | try{ |
871 | 869 | MolDS_base::MallocerFreer::GetInstance()->Malloc<double>(&tmp, numTransported); |
872 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
873 | - Atom& atom = *this->GetAtom(a); | |
870 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
871 | + Atom& atom = *this->GetAtomVect()[a]; | |
874 | 872 | for(int i=0; i<CartesianType_end; i++){ |
875 | 873 | tmp[a*CartesianType_end+i] = atom.GetXyz()[i]; |
876 | 874 | } |
877 | 875 | } |
878 | 876 | MolDS_mpi::MpiProcess::GetInstance()->Broadcast(tmp, numTransported, root); |
879 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
880 | - Atom& atom = *this->GetAtom(a); | |
877 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
878 | + Atom& atom = *this->GetAtomVect()[a]; | |
881 | 879 | for(int i=0; i<CartesianType_end; i++){ |
882 | 880 | atom.GetXyz()[i] = tmp[a*CartesianType_end+i]; |
883 | 881 | } |
@@ -891,19 +889,19 @@ void Molecule::BroadcastConfigurationToAllProcesses(int root) const{ | ||
891 | 889 | } |
892 | 890 | |
893 | 891 | void Molecule::BroadcastMomentaToAllProcesses(int root) const{ |
894 | - int numTransported = this->GetNumberAtoms()*CartesianType_end; | |
892 | + int numTransported = this->GetAtomVect().size()*CartesianType_end; | |
895 | 893 | double* tmp=NULL; |
896 | 894 | try{ |
897 | 895 | MolDS_base::MallocerFreer::GetInstance()->Malloc<double>(&tmp, numTransported); |
898 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
899 | - Atom& atom = *this->GetAtom(a); | |
896 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
897 | + Atom& atom = *this->GetAtomVect()[a]; | |
900 | 898 | for(int i=0; i<CartesianType_end; i++){ |
901 | 899 | tmp[a*CartesianType_end+i] = atom.GetPxyz()[i]; |
902 | 900 | } |
903 | 901 | } |
904 | 902 | MolDS_mpi::MpiProcess::GetInstance()->Broadcast(tmp, numTransported, root); |
905 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
906 | - Atom& atom = *this->GetAtom(a); | |
903 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
904 | + Atom& atom = *this->GetAtomVect()[a]; | |
907 | 905 | for(int i=0; i<CartesianType_end; i++){ |
908 | 906 | atom.GetPxyz()[i] = tmp[a*CartesianType_end+i]; |
909 | 907 | } |
@@ -917,12 +915,12 @@ void Molecule::BroadcastMomentaToAllProcesses(int root) const{ | ||
917 | 915 | } |
918 | 916 | |
919 | 917 | void Molecule::BroadcastPhaseSpacePointToAllProcesses(int root) const{ |
920 | - int numTransported = 2*this->GetNumberAtoms()*CartesianType_end; | |
918 | + int numTransported = 2*this->GetAtomVect().size()*CartesianType_end; | |
921 | 919 | double* tmp=NULL; |
922 | 920 | try{ |
923 | 921 | MolDS_base::MallocerFreer::GetInstance()->Malloc<double>(&tmp, numTransported); |
924 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
925 | - Atom& atom = *this->GetAtom(a); | |
922 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
923 | + Atom& atom = *this->GetAtomVect()[a]; | |
926 | 924 | for(int i=0; i<CartesianType_end; i++){ |
927 | 925 | int k = a*CartesianType_end+i; |
928 | 926 | tmp[2*k ] = atom.GetXyz() [i]; |
@@ -930,8 +928,8 @@ void Molecule::BroadcastPhaseSpacePointToAllProcesses(int root) const{ | ||
930 | 928 | } |
931 | 929 | } |
932 | 930 | MolDS_mpi::MpiProcess::GetInstance()->Broadcast(tmp, numTransported, root); |
933 | - for(int a=0; a<this->GetNumberAtoms(); a++){ | |
934 | - Atom& atom = *this->GetAtom(a); | |
931 | + for(int a=0; a<this->GetAtomVect().size(); a++){ | |
932 | + Atom& atom = *this->GetAtomVect()[a]; | |
935 | 933 | for(int i=0; i<CartesianType_end; i++){ |
936 | 934 | int k = a*CartesianType_end+i; |
937 | 935 | atom.GetXyz() [i] = tmp[2*k ]; |
@@ -26,29 +26,17 @@ public: | ||
26 | 26 | explicit Molecule(const Molecule& rhs); |
27 | 27 | Molecule& operator=(const Molecule& rhs); |
28 | 28 | ~Molecule(); |
29 | - inline int GetNumberAtoms() const{ | |
29 | + inline const std::vector<MolDS_base_atoms::Atom*>& GetAtomVect() const{ | |
30 | 30 | #ifdef MOLDS_DBG |
31 | - if(this->atomVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetNumberAtomsNull); | |
31 | + if(this->atomVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetAtomVectNull); | |
32 | 32 | #endif |
33 | - return this->atomVect->size(); | |
33 | + return *this->atomVect; | |
34 | 34 | } |
35 | - inline MolDS_base_atoms::Atom* GetAtom(int atomIndex) const{ | |
35 | + inline const std::vector<MolDS_base_atoms::Atom*>& GetEpcVect() const{ | |
36 | 36 | #ifdef MOLDS_DBG |
37 | - if(this->atomVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetAtomNull); | |
37 | + if(this->epcVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetEpcVectNull); | |
38 | 38 | #endif |
39 | - return (*this->atomVect)[atomIndex]; | |
40 | - } | |
41 | - inline int GetNumberEpcs() const{ | |
42 | -#ifdef MOLDS_DBG | |
43 | - if(this->epcVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetNumberEPCsNull); | |
44 | -#endif | |
45 | - return this->epcVect->size(); | |
46 | - } | |
47 | - inline MolDS_base_atoms::Atom* GetEpc(int epcIndex) const{ | |
48 | -#ifdef MOLDS_DBG | |
49 | - if(this->epcVect==NULL) throw MolDS_base::MolDSException(this->errorMessageGetEPCNull); | |
50 | -#endif | |
51 | - return (*this->epcVect)[epcIndex]; | |
39 | + return *this->epcVect; | |
52 | 40 | } |
53 | 41 | void AddAtom(MolDS_base_atoms::Atom* atom); |
54 | 42 | void AddEpc(MolDS_base_atoms::Atom* epc); |
@@ -128,12 +116,10 @@ private: | ||
128 | 116 | double rotatingAngle, |
129 | 117 | MolDS_base::EularAngle rotatingEularAngles)const; |
130 | 118 | void OutputTranslatingConditions(double const* translatingDifference) const; |
131 | - std::string errorMessageGetAtomNull; | |
132 | - std::string errorMessageGetEPCNull; | |
119 | + std::string errorMessageGetAtomVectNull; | |
120 | + std::string errorMessageGetEPCVectNull; | |
133 | 121 | std::string errorMessageAddAtomNull; |
134 | 122 | std::string errorMessageAddEPCNull; |
135 | - std::string errorMessageGetNumberAtomsNull; | |
136 | - std::string errorMessageGetNumberEPCsNull; | |
137 | 123 | std::string errorMessageGetXyzCOMNull; |
138 | 124 | std::string errorMessageGetXyzCOCNull; |
139 | 125 | std::string errorMessageCalcXyzCOMNull; |
@@ -257,8 +257,8 @@ double DensityLogger::GetMOValue(int moIndex, | ||
257 | 257 | double const* const* forckMatrix, |
258 | 258 | double x, double y, double z) const{ |
259 | 259 | double moValue = 0.0; |
260 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
261 | - Atom* atomA = this->molecule->GetAtom(a); | |
260 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
261 | + Atom* atomA = this->molecule->GetAtomVect()[a]; | |
262 | 262 | int firstAOIndexA = atomA->GetFirstAOIndex(); |
263 | 263 | int numberAOsA = atomA->GetValenceSize(); |
264 | 264 | for(int mu=firstAOIndexA; mu<firstAOIndexA+numberAOsA; mu++){ |
@@ -281,10 +281,10 @@ void DensityLogger::OutputHeaderToFile(ofstream& ofs, double const* origin, doub | ||
281 | 281 | // output header to the cube file |
282 | 282 | ofs << this->messageCubeHeaderComment1; |
283 | 283 | ofs << this->messageCubeHeaderComment2; |
284 | - sprintf(data,"\t%d\t%e\t%e\t%e\n", this->molecule->GetNumberAtoms(), | |
285 | - origin[XAxis], | |
286 | - origin[YAxis], | |
287 | - origin[ZAxis]); | |
284 | + sprintf(data,"\t%ld\t%e\t%e\t%e\n", this->molecule->GetAtomVect().size(), | |
285 | + origin[XAxis], | |
286 | + origin[YAxis], | |
287 | + origin[ZAxis]); | |
288 | 288 | ofs << string(data); |
289 | 289 | memset(data,0,sizeof(data)); |
290 | 290 | sprintf(data,"\t%d\t%e\t%e\t%e\n", gridNumber[XAxis], dx, 0.0, 0.0); |
@@ -300,8 +300,8 @@ void DensityLogger::OutputHeaderToFile(ofstream& ofs, double const* origin, doub | ||
300 | 300 | void DensityLogger::OutputMoleculeToFile(ofstream& ofs, const Molecule& molecule) const{ |
301 | 301 | char data[1000] = ""; |
302 | 302 | // output molecule to the cube file |
303 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
304 | - const Atom& atomA = *molecule.GetAtom(a); | |
303 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
304 | + const Atom& atomA = *molecule.GetAtomVect()[a]; | |
305 | 305 | memset(data,0,sizeof(data)); |
306 | 306 | sprintf(data,"\t%d\t%d\t%e\t%e\t%e\n", atomA.GetAtomType()+1, |
307 | 307 | atomA.GetNumberValenceElectrons(), |
@@ -165,10 +165,10 @@ void MOLogger::OutputHeaderToFile(ofstream& ofs, double const* origin, double dx | ||
165 | 165 | // output header to the cube file |
166 | 166 | ofs << this->messageCubeHeaderComment1; |
167 | 167 | ofs << this->messageCubeHeaderComment2; |
168 | - sprintf(data,"\t%d\t%e\t%e\t%e\n", this->molecule->GetNumberAtoms(), | |
169 | - origin[XAxis], | |
170 | - origin[YAxis], | |
171 | - origin[ZAxis]); | |
168 | + sprintf(data,"\t%ld\t%e\t%e\t%e\n", this->molecule->GetAtomVect().size(), | |
169 | + origin[XAxis], | |
170 | + origin[YAxis], | |
171 | + origin[ZAxis]); | |
172 | 172 | ofs << string(data); |
173 | 173 | memset(data,0,sizeof(data)); |
174 | 174 | sprintf(data,"\t%d\t%e\t%e\t%e\n", gridNumber[XAxis], dx, 0.0, 0.0); |
@@ -184,8 +184,8 @@ void MOLogger::OutputHeaderToFile(ofstream& ofs, double const* origin, double dx | ||
184 | 184 | void MOLogger::OutputMoleculeToFile(ofstream& ofs, const Molecule& molecule) const{ |
185 | 185 | char data[1000] = ""; |
186 | 186 | // output molecule to the cube file |
187 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
188 | - Atom* atomA = molecule.GetAtom(a); | |
187 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
188 | + Atom* atomA = molecule.GetAtomVect()[a]; | |
189 | 189 | memset(data,0,sizeof(data)); |
190 | 190 | sprintf(data,"\t%d\t%d\t%e\t%e\t%e\n", atomA->GetAtomType()+1, |
191 | 191 | atomA->GetNumberValenceElectrons(), |
@@ -228,8 +228,8 @@ double MOLogger::GetMoValue(int moIndex, | ||
228 | 228 | double y, |
229 | 229 | double z) const{ |
230 | 230 | double moValue = 0.0; |
231 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
232 | - Atom* atomA = molecule.GetAtom(a); | |
231 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
232 | + Atom* atomA = molecule.GetAtomVect()[a]; | |
233 | 233 | int firstAOIndexA = atomA->GetFirstAOIndex(); |
234 | 234 | int numberAOsA = atomA->GetValenceSize(); |
235 | 235 | for(int mu=firstAOIndexA; mu<firstAOIndexA+numberAOsA; mu++){ |
@@ -117,7 +117,7 @@ Cndo2::~Cndo2(){ | ||
117 | 117 | this->molecule->GetTotalNumberAOs(), |
118 | 118 | this->molecule->GetTotalNumberAOs()); |
119 | 119 | MallocerFreer::GetInstance()->Free<double>(&this->atomicElectronPopulation, |
120 | - this->molecule->GetNumberAtoms()); | |
120 | + this->molecule->GetAtomVect().size()); | |
121 | 121 | MallocerFreer::GetInstance()->Free<double>(&this->overlapAOs, |
122 | 122 | this->molecule->GetTotalNumberAOs(), |
123 | 123 | this->molecule->GetTotalNumberAOs()); |
@@ -136,8 +136,8 @@ Cndo2::~Cndo2(){ | ||
136 | 136 | MallocerFreer::GetInstance()->Free<double>(&this->coreDipoleMoment, |
137 | 137 | CartesianType_end); |
138 | 138 | MallocerFreer::GetInstance()->Free<double>(&this->gammaAB, |
139 | - this->molecule->GetNumberAtoms(), | |
140 | - this->molecule->GetNumberAtoms()); | |
139 | + this->molecule->GetAtomVect().size(), | |
140 | + this->molecule->GetAtomVect().size()); | |
141 | 141 | //this->OutputLog("cndo deleted\n"); |
142 | 142 | } |
143 | 143 |
@@ -293,7 +293,7 @@ void Cndo2::SetMolecule(Molecule* molecule){ | ||
293 | 293 | this->molecule->GetTotalNumberAOs(), |
294 | 294 | this->molecule->GetTotalNumberAOs()); |
295 | 295 | MallocerFreer::GetInstance()->Malloc<double>(&this->atomicElectronPopulation, |
296 | - this->molecule->GetNumberAtoms()); | |
296 | + this->molecule->GetAtomVect().size()); | |
297 | 297 | MallocerFreer::GetInstance()->Malloc<double>(&this->overlapAOs, |
298 | 298 | this->molecule->GetTotalNumberAOs(), |
299 | 299 | this->molecule->GetTotalNumberAOs()); |
@@ -313,8 +313,8 @@ void Cndo2::SetMolecule(Molecule* molecule){ | ||
313 | 313 | CartesianType_end); |
314 | 314 | if(this->theory == CNDO2 || this->theory == INDO){ |
315 | 315 | MallocerFreer::GetInstance()->Malloc<double>(&this->gammaAB, |
316 | - this->molecule->GetNumberAtoms(), | |
317 | - this->molecule->GetNumberAtoms()); | |
316 | + this->molecule->GetAtomVect().size(), | |
317 | + this->molecule->GetAtomVect().size()); | |
318 | 318 | } |
319 | 319 | } |
320 | 320 |
@@ -327,8 +327,8 @@ void Cndo2::CheckNumberValenceElectrons(const Molecule& molecule) const{ | ||
327 | 327 | } |
328 | 328 | |
329 | 329 | void Cndo2::CheckEnableAtomType(const Molecule& molecule) const{ |
330 | - for(int i=0; i<molecule.GetNumberAtoms(); i++){ | |
331 | - AtomType atomType = molecule.GetAtom(i)->GetAtomType(); | |
330 | + for(int i=0; i<molecule.GetAtomVect().size(); i++){ | |
331 | + AtomType atomType = molecule.GetAtomVect()[i]->GetAtomType(); | |
332 | 332 | bool enable = false; |
333 | 333 | for(int j=0; j<this->enableAtomTypes.size(); j++){ |
334 | 334 | if(atomType == this->enableAtomTypes[j]){ |
@@ -348,18 +348,18 @@ void Cndo2::CheckEnableAtomType(const Molecule& molecule) const{ | ||
348 | 348 | void Cndo2::CalcCoreRepulsionEnergy(){ |
349 | 349 | // interaction between atoms |
350 | 350 | double energy = 0.0; |
351 | - for(int i=0; i<this->molecule->GetNumberAtoms(); i++){ | |
352 | - for(int j=i+1; j<this->molecule->GetNumberAtoms(); j++){ | |
351 | + for(int i=0; i<this->molecule->GetAtomVect().size(); i++){ | |
352 | + for(int j=i+1; j<this->molecule->GetAtomVect().size(); j++){ | |
353 | 353 | energy += this->GetDiatomCoreRepulsionEnergy(i, j); |
354 | 354 | } |
355 | 355 | } |
356 | 356 | this->coreRepulsionEnergy = energy; |
357 | 357 | |
358 | 358 | // interaction between atoms and epcs |
359 | - if(this->molecule->GetNumberEpcs()<=0){return;} | |
359 | + if(this->molecule->GetEpcVect().empty()){return;} | |
360 | 360 | energy = 0.0; |
361 | - for(int i=0; i<this->molecule->GetNumberAtoms(); i++){ | |
362 | - for(int j=0; j<this->molecule->GetNumberEpcs(); j++){ | |
361 | + for(int i=0; i<this->molecule->GetAtomVect().size(); i++){ | |
362 | + for(int j=0; j<this->molecule->GetEpcVect().size(); j++){ | |
363 | 363 | energy += this->GetAtomCoreEpcCoulombEnergy(i, j); |
364 | 364 | } |
365 | 365 | } |
@@ -368,8 +368,8 @@ void Cndo2::CalcCoreRepulsionEnergy(){ | ||
368 | 368 | } |
369 | 369 | |
370 | 370 | double Cndo2::GetDiatomCoreRepulsionEnergy(int indexAtomA, int indexAtomB) const{ |
371 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
372 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
371 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
372 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
373 | 373 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
374 | 374 | return atomA.GetCoreCharge()*atomB.GetCoreCharge()/distance; |
375 | 375 | } |
@@ -384,8 +384,8 @@ double Cndo2::GetAtomCoreEpcCoulombEnergy(int indexAtom, int indexEpc) const{ | ||
384 | 384 | double Cndo2::GetDiatomCoreRepulsion1stDerivative(int indexAtomA, int indexAtomB, |
385 | 385 | CartesianType axisA) const{ |
386 | 386 | double value=0.0; |
387 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
388 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
387 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
388 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
389 | 389 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
390 | 390 | value = atomA.GetCoreCharge()*atomB.GetCoreCharge(); |
391 | 391 | value *= (atomA.GetXyz()[axisA] - atomB.GetXyz()[axisA])/distance; |
@@ -407,8 +407,8 @@ double Cndo2::GetDiatomCoreRepulsion2ndDerivative(int indexAtomA, | ||
407 | 407 | // See (2) in [G_2004] ((11) in [G_2006]) |
408 | 408 | void Cndo2::CalcVdWCorrectionEnergy(){ |
409 | 409 | double value = 0.0; |
410 | - for(int i=0; i<this->molecule->GetNumberAtoms(); i++){ | |
411 | - for(int j=i+1; j<this->molecule->GetNumberAtoms(); j++){ | |
410 | + for(int i=0; i<this->molecule->GetAtomVect().size(); i++){ | |
411 | + for(int j=i+1; j<this->molecule->GetAtomVect().size(); j++){ | |
412 | 412 | value += this->GetDiatomVdWCorrectionEnergy(i, j); |
413 | 413 | } |
414 | 414 | } |
@@ -442,8 +442,8 @@ double Cndo2::GetVdwDampingValue2ndDerivative(double vdWDistance, double distanc | ||
442 | 442 | |
443 | 443 | // See (2) in [G_2004] ((11) in [G_2006]) |
444 | 444 | double Cndo2::GetDiatomVdWCorrectionEnergy(int indexAtomA, int indexAtomB) const{ |
445 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
446 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
445 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
446 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
447 | 447 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
448 | 448 | double vdWDistance = atomA.GetVdWRadii() + atomB.GetVdWRadii(); |
449 | 449 | double vdWCoefficients = 2.0*atomA.GetVdWCoefficient()*atomB.GetVdWCoefficient() |
@@ -458,8 +458,8 @@ double Cndo2::GetDiatomVdWCorrectionEnergy(int indexAtomA, int indexAtomB) const | ||
458 | 458 | // See (2) in [G_2004] ((11) in [G_2006]). |
459 | 459 | double Cndo2::GetDiatomVdWCorrection1stDerivative(int indexAtomA, int indexAtomB, |
460 | 460 | CartesianType axisA) const{ |
461 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
462 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
461 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
462 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
463 | 463 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
464 | 464 | double vdWDistance = atomA.GetVdWRadii() + atomB.GetVdWRadii(); |
465 | 465 | double vdWCoefficients = 2.0*atomA.GetVdWCoefficient()*atomB.GetVdWCoefficient() |
@@ -484,8 +484,8 @@ double Cndo2::GetDiatomVdWCorrection2ndDerivative(int indexAtomA, | ||
484 | 484 | int indexAtomB, |
485 | 485 | CartesianType axisA1, |
486 | 486 | CartesianType axisA2) const{ |
487 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
488 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
487 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
488 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
489 | 489 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
490 | 490 | double dCartesian1 = atomA.GetXyz()[axisA1] - atomB.GetXyz()[axisA1]; |
491 | 491 | double dCartesian2 = atomA.GetXyz()[axisA2] - atomB.GetXyz()[axisA2]; |
@@ -1013,13 +1013,13 @@ void Cndo2::OutputSCFEnergies() const{ | ||
1013 | 1013 | this->OutputLog(boost::format("%s\t%e\t%e\n") % this->messageElecEnergy |
1014 | 1014 | % this->elecSCFEnergy |
1015 | 1015 | % (this->elecSCFEnergy/eV2AU)); |
1016 | - if(Parameters::GetInstance()->RequiresVdWSCF() && this->molecule->GetNumberEpcs()<=0){ | |
1016 | + if(Parameters::GetInstance()->RequiresVdWSCF() && this->molecule->GetEpcVect().empty()){ | |
1017 | 1017 | this->OutputLog(this->messageNoteElecEnergyVdW); |
1018 | 1018 | } |
1019 | - else if(Parameters::GetInstance()->RequiresVdWSCF() && 0<this->molecule->GetNumberEpcs()){ | |
1019 | + else if(Parameters::GetInstance()->RequiresVdWSCF() && !this->molecule->GetEpcVect().empty()){ | |
1020 | 1020 | this->OutputLog(this->messageNoteElecEnergyEpcVdW); |
1021 | 1021 | } |
1022 | - else if(!Parameters::GetInstance()->RequiresVdWSCF() && 0<this->molecule->GetNumberEpcs()){ | |
1022 | + else if(!Parameters::GetInstance()->RequiresVdWSCF() && !this->molecule->GetEpcVect().empty()){ | |
1023 | 1023 | this->OutputLog(this->messageNoteElecEnergyEpc); |
1024 | 1024 | } |
1025 | 1025 | else{ |
@@ -1033,7 +1033,7 @@ void Cndo2::OutputSCFEnergies() const{ | ||
1033 | 1033 | % (this->coreRepulsionEnergy/eV2AU)); |
1034 | 1034 | |
1035 | 1035 | // output coulomb interaction between atoms and epcs |
1036 | - if(0<this->molecule->GetNumberEpcs()){ | |
1036 | + if(!this->molecule->GetEpcVect().empty()){ | |
1037 | 1037 | this->OutputLog(this->messageCoreEpcCoulombTitle); |
1038 | 1038 | this->OutputLog(boost::format("%s\t%e\t%e\n\n") % this->messageCoreEpcCoulomb |
1039 | 1039 | % this->coreEpcCoulombEnergy |
@@ -1113,8 +1113,8 @@ void Cndo2::OutputSCFDipole() const{ | ||
1113 | 1113 | void Cndo2::OutputSCFMulliken() const{ |
1114 | 1114 | int groundState = 0; |
1115 | 1115 | this->OutputLog(this->messageMullikenAtomsTitle); |
1116 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
1117 | - Atom* atom = this->molecule->GetAtom(a); | |
1116 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
1117 | + Atom* atom = this->molecule->GetAtomVect()[a]; | |
1118 | 1118 | this->OutputLog(boost::format("%s\t%d\t%d\t%s\t%e\t%e\n") % this->messageMullikenAtomsSCF |
1119 | 1119 | % groundState |
1120 | 1120 | % a |
@@ -1129,7 +1129,7 @@ void Cndo2::OutputNormalModes(double const* const* normalModes, | ||
1129 | 1129 | double const* normalForceConstants, |
1130 | 1130 | const Molecule& molecule) const{ |
1131 | 1131 | |
1132 | - int hessianDim = CartesianType_end*molecule.GetNumberAtoms(); | |
1132 | + int hessianDim = CartesianType_end*molecule.GetAtomVect().size(); | |
1133 | 1133 | double ang2AU = Parameters::GetInstance()->GetAngstrom2AU(); |
1134 | 1134 | double kayser2AU = Parameters::GetInstance()->GetKayser2AU(); |
1135 | 1135 |
@@ -1149,8 +1149,8 @@ void Cndo2::OutputNormalModes(double const* const* normalModes, | ||
1149 | 1149 | % sqrt(fabs(normalForceConstants[i])) |
1150 | 1150 | % (sqrt(fabs(normalForceConstants[i]))/kayser2AU)); |
1151 | 1151 | // normal modes |
1152 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
1153 | - const double sqrtCoreMass = sqrt(molecule.GetAtom(a)->GetCoreMass()); | |
1152 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
1153 | + const double sqrtCoreMass = sqrt(molecule.GetAtomVect()[a]->GetCoreMass()); | |
1154 | 1154 | for(int j=XAxis; j<CartesianType_end; j++){ |
1155 | 1155 | int hessianIndex = CartesianType_end*a+j; |
1156 | 1156 | this->OutputLog(boost::format("\t%e") % normalModes[i][hessianIndex]); |
@@ -1178,8 +1178,8 @@ void Cndo2::OutputNormalModes(double const* const* normalModes, | ||
1178 | 1178 | % (sqrt(fabs(normalForceConstants[i]))/kayser2AU)); |
1179 | 1179 | |
1180 | 1180 | double normSquare=0.0; |
1181 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
1182 | - const double sqrtCoreMass = sqrt(molecule.GetAtom(a)->GetCoreMass()); | |
1181 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
1182 | + const double sqrtCoreMass = sqrt(molecule.GetAtomVect()[a]->GetCoreMass()); | |
1183 | 1183 | for(int j=XAxis; j<CartesianType_end; j++){ |
1184 | 1184 | int hessianIndex = CartesianType_end*a+j; |
1185 | 1185 | normSquare += pow(normalModes[i][hessianIndex]/(sqrtCoreMass*ang2AU),2.0); |
@@ -1188,8 +1188,8 @@ void Cndo2::OutputNormalModes(double const* const* normalModes, | ||
1188 | 1188 | double norm = sqrt(normSquare); |
1189 | 1189 | |
1190 | 1190 | // normal modes |
1191 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
1192 | - const double sqrtCoreMass = sqrt(molecule.GetAtom(a)->GetCoreMass()); | |
1191 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
1192 | + const double sqrtCoreMass = sqrt(molecule.GetAtomVect()[a]->GetCoreMass()); | |
1193 | 1193 | for(int j=XAxis; j<CartesianType_end; j++){ |
1194 | 1194 | int hessianIndex = CartesianType_end*a+j; |
1195 | 1195 | this->OutputLog(boost::format("\t%e") % (normalModes[i][hessianIndex]/(sqrtCoreMass*ang2AU*norm))); |
@@ -1248,7 +1248,7 @@ void Cndo2::CalcElecSCFEnergy(double* elecSCFEnergy, | ||
1248 | 1248 | totalNumberAOs, |
1249 | 1249 | totalNumberAOs); |
1250 | 1250 | MallocerFreer::GetInstance()->Malloc<double>(&dammyAtomicElectronPopulation, |
1251 | - molecule.GetNumberAtoms()); | |
1251 | + molecule.GetAtomVect().size()); | |
1252 | 1252 | bool isGuess = false; |
1253 | 1253 | this->CalcFockMatrix(fMatrix, |
1254 | 1254 | molecule, |
@@ -1328,7 +1328,7 @@ void Cndo2::FreeElecEnergyMatrices(double*** fMatrix, | ||
1328 | 1328 | totalNumberAOs, |
1329 | 1329 | totalNumberAOs); |
1330 | 1330 | MallocerFreer::GetInstance()->Free<double>(dammyAtomicElectronPopulation, |
1331 | - this->molecule->GetNumberAtoms()); | |
1331 | + this->molecule->GetAtomVect().size()); | |
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | // The order of moI, moJ, moK, moL is consistent with Eq. (9) in [RZ_1973] |
@@ -1337,13 +1337,13 @@ double Cndo2::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
1337 | 1337 | double const* const* fockMatrix, |
1338 | 1338 | double const* const* gammaAB) const{ |
1339 | 1339 | double value = 0.0; |
1340 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
1341 | - const Atom& atomA = *molecule.GetAtom(A); | |
1340 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
1341 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
1342 | 1342 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1343 | 1343 | int lastAOIndexA = atomA.GetLastAOIndex(); |
1344 | 1344 | |
1345 | - for(int B=0; B<molecule.GetNumberAtoms(); B++){ | |
1346 | - const Atom& atomB = *molecule.GetAtom(B); | |
1345 | + for(int B=0; B<molecule.GetAtomVect().size(); B++){ | |
1346 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
1347 | 1347 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
1348 | 1348 | int lastAOIndexB = atomB.GetLastAOIndex(); |
1349 | 1349 | double gamma = gammaAB[A][B]; |
@@ -1434,7 +1434,7 @@ void Cndo2::CalcFockMatrix(double** fockMatrix, | ||
1434 | 1434 | double const* const* const* const* const* const* twoElecsTwoAtomCores, |
1435 | 1435 | bool isGuess) const{ |
1436 | 1436 | int totalNumberAOs = molecule.GetTotalNumberAOs(); |
1437 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
1437 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
1438 | 1438 | MallocerFreer::GetInstance()->Initialize<double>(fockMatrix, totalNumberAOs, totalNumberAOs); |
1439 | 1439 | |
1440 | 1440 | // MPI setting of each rank |
@@ -1446,7 +1446,7 @@ void Cndo2::CalcFockMatrix(double** fockMatrix, | ||
1446 | 1446 | boost::thread communicationThread( boost::bind(&MolDS_mpi::AsyncCommunicator::Run<double>, &asyncCommunicator) ); |
1447 | 1447 | |
1448 | 1448 | for(int A=0; A<totalNumberAtoms; A++){ |
1449 | - const Atom& atomA = *molecule.GetAtom(A); | |
1449 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
1450 | 1450 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1451 | 1451 | int lastAOIndexA = atomA.GetLastAOIndex(); |
1452 | 1452 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -1455,7 +1455,7 @@ void Cndo2::CalcFockMatrix(double** fockMatrix, | ||
1455 | 1455 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1456 | 1456 | for(int B=A; B<totalNumberAtoms; B++){ |
1457 | 1457 | try{ |
1458 | - const Atom& atomB = *molecule.GetAtom(B); | |
1458 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
1459 | 1459 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
1460 | 1460 | int lastAOIndexB = atomB.GetLastAOIndex(); |
1461 | 1461 | for(int nu=firstAOIndexB; nu<=lastAOIndexB; nu++){ |
@@ -1553,9 +1553,9 @@ double Cndo2::GetFockDiagElement(const Atom& atomA, | ||
1553 | 1553 | value += temp*gammaAB[indexAtomA][indexAtomA]; |
1554 | 1554 | |
1555 | 1555 | temp = 0.0; |
1556 | - for(int BB=0; BB<molecule.GetNumberAtoms(); BB++){ | |
1556 | + for(int BB=0; BB<molecule.GetAtomVect().size(); BB++){ | |
1557 | 1557 | if(BB != indexAtomA){ |
1558 | - const Atom& atomBB = *molecule.GetAtom(BB); | |
1558 | + const Atom& atomBB = *molecule.GetAtomVect()[BB]; | |
1559 | 1559 | temp += ( atomicElectronPopulation[BB] - atomBB.GetCoreCharge() ) |
1560 | 1560 | *gammaAB[indexAtomA][BB]; |
1561 | 1561 | } |
@@ -1631,12 +1631,12 @@ void Cndo2::CalcOrbitalElectronPopulation(double** orbitalElectronPopulation, | ||
1631 | 1631 | void Cndo2::CalcAtomicElectronPopulation(double* atomicElectronPopulation, |
1632 | 1632 | double const* const* orbitalElectronPopulation, |
1633 | 1633 | const Molecule& molecule) const{ |
1634 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
1634 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
1635 | 1635 | MallocerFreer::GetInstance()->Initialize<double>(atomicElectronPopulation, totalNumberAtoms); |
1636 | 1636 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1637 | 1637 | for(int A=0; A<totalNumberAtoms; A++){ |
1638 | - int firstAOIndex = molecule.GetAtom(A)->GetFirstAOIndex(); | |
1639 | - int numberAOs = molecule.GetAtom(A)->GetValenceSize(); | |
1638 | + int firstAOIndex = molecule.GetAtomVect()[A]->GetFirstAOIndex(); | |
1639 | + int numberAOs = molecule.GetAtomVect()[A]->GetValenceSize(); | |
1640 | 1640 | for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){ |
1641 | 1641 | atomicElectronPopulation[A] += orbitalElectronPopulation[i][i]; |
1642 | 1642 | } |
@@ -1646,7 +1646,7 @@ void Cndo2::CalcAtomicElectronPopulation(double* atomicElectronPopulation, | ||
1646 | 1646 | |
1647 | 1647 | // calculate gammaAB matrix. (B.56) and (B.62) in J. A. Pople book. |
1648 | 1648 | void Cndo2::CalcGammaAB(double** gammaAB, const Molecule& molecule) const{ |
1649 | - int totalAtomNumber = molecule.GetNumberAtoms(); | |
1649 | + int totalAtomNumber = molecule.GetAtomVect().size(); | |
1650 | 1650 | |
1651 | 1651 | // MPI setting of each rank |
1652 | 1652 | int mpiRank = MolDS_mpi::MpiProcess::GetInstance()->GetRank(); |
@@ -1659,14 +1659,14 @@ void Cndo2::CalcGammaAB(double** gammaAB, const Molecule& molecule) const{ | ||
1659 | 1659 | for(int A=0; A<totalAtomNumber; A++){ |
1660 | 1660 | int calcRank = A%mpiSize; |
1661 | 1661 | if(mpiRank == calcRank){ |
1662 | - const Atom& atomA = *molecule.GetAtom(A); | |
1662 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
1663 | 1663 | int na = atomA.GetValenceShellType() + 1; |
1664 | 1664 | double orbitalExponentA = atomA.GetOrbitalExponent( |
1665 | 1665 | atomA.GetValenceShellType(), s, this->theory); |
1666 | 1666 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1667 | 1667 | for(int B=A; B<totalAtomNumber; B++){ |
1668 | 1668 | try{ |
1669 | - const Atom& atomB = *molecule.GetAtom(B); | |
1669 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
1670 | 1670 | int nb = atomB.GetValenceShellType() + 1; |
1671 | 1671 | double orbitalExponentB = atomB.GetOrbitalExponent( |
1672 | 1672 | atomB.GetValenceShellType(), s, this->theory); |
@@ -1768,9 +1768,9 @@ void Cndo2::CalcCoreDipoleMoment(double* coreDipoleMoment, | ||
1768 | 1768 | |
1769 | 1769 | for(int i=0; i<CartesianType_end; i++){ |
1770 | 1770 | coreDipoleMoment[i] = 0.0; |
1771 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
1772 | - coreDipoleMoment[i] += molecule.GetAtom(A)->GetCoreCharge() | |
1773 | - *(molecule.GetAtom(A)->GetXyz()[i] - molecule.GetXyzCOC()[i]); | |
1771 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
1772 | + coreDipoleMoment[i] += molecule.GetAtomVect()[A]->GetCoreCharge() | |
1773 | + *(molecule.GetAtomVect()[A]->GetXyz()[i] - molecule.GetXyzCOC()[i]); | |
1774 | 1774 | } |
1775 | 1775 | } |
1776 | 1776 | } |
@@ -1841,7 +1841,7 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, | ||
1841 | 1841 | const Molecule& molecule, |
1842 | 1842 | STOnGType stonG) const{ |
1843 | 1843 | int totalAONumber = molecule.GetTotalNumberAOs(); |
1844 | - int totalAtomNumber = molecule.GetNumberAtoms(); | |
1844 | + int totalAtomNumber = molecule.GetAtomVect().size(); | |
1845 | 1845 | |
1846 | 1846 | // MPI setting of each rank |
1847 | 1847 | int mpiRank = MolDS_mpi::MpiProcess::GetInstance()->GetRank(); |
@@ -1852,7 +1852,7 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, | ||
1852 | 1852 | boost::thread communicationThread( boost::bind(&MolDS_mpi::AsyncCommunicator::Run<double>, &asyncCommunicator) ); |
1853 | 1853 | |
1854 | 1854 | for(int A=0; A<totalAtomNumber; A++){ |
1855 | - const Atom& atomA = *molecule.GetAtom(A); | |
1855 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
1856 | 1856 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1857 | 1857 | int numValenceAOsA = atomA.GetValenceSize(); |
1858 | 1858 | int calcRank = A%mpiSize; |
@@ -1862,7 +1862,7 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix, | ||
1862 | 1862 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1863 | 1863 | for(int B=0; B<totalAtomNumber; B++){ |
1864 | 1864 | try{ |
1865 | - const Atom& atomB = *molecule.GetAtom(B); | |
1865 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
1866 | 1866 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
1867 | 1867 | int numValenceAOsB = atomB.GetValenceSize(); |
1868 | 1868 | for(int b=0; b<numValenceAOsB; b++){ |
@@ -3804,11 +3804,11 @@ void Cndo2::CalcOverlapAOsWithAnotherConfiguration(double** overlapAOs, | ||
3804 | 3804 | ss << this->errorMessageRhs << rhsMolecule->GetTotalNumberAOs() << endl; |
3805 | 3805 | throw MolDSException(ss.str()); |
3806 | 3806 | } |
3807 | - if(lhsMolecule.GetNumberAtoms() != rhsMolecule->GetNumberAtoms()){ | |
3807 | + if(lhsMolecule.GetAtomVect().size() != rhsMolecule->GetAtomVect().size()){ | |
3808 | 3808 | stringstream ss; |
3809 | 3809 | ss << this->errorMessageCalcOverlapAOsDifferentConfigurationsDiffAtoms; |
3810 | - ss << this->errorMessageLhs << lhsMolecule.GetNumberAtoms() << endl; | |
3811 | - ss << this->errorMessageRhs << rhsMolecule->GetNumberAtoms() << endl; | |
3810 | + ss << this->errorMessageLhs << lhsMolecule.GetAtomVect().size() << endl; | |
3811 | + ss << this->errorMessageRhs << rhsMolecule->GetAtomVect().size() << endl; | |
3812 | 3812 | throw MolDSException(ss.str()); |
3813 | 3813 | } |
3814 | 3814 | #ifdef MOLDS_DBG |
@@ -3818,7 +3818,7 @@ void Cndo2::CalcOverlapAOsWithAnotherConfiguration(double** overlapAOs, | ||
3818 | 3818 | #endif |
3819 | 3819 | |
3820 | 3820 | int totalAONumber = lhsMolecule.GetTotalNumberAOs(); |
3821 | - int totalAtomNumber = lhsMolecule.GetNumberAtoms(); | |
3821 | + int totalAtomNumber = lhsMolecule.GetAtomVect().size(); | |
3822 | 3822 | MallocerFreer::GetInstance()->Initialize<double>(overlapAOs, totalAONumber, totalAONumber); |
3823 | 3823 | |
3824 | 3824 | stringstream ompErrors; |
@@ -3841,8 +3841,8 @@ void Cndo2::CalcOverlapAOsWithAnotherConfiguration(double** overlapAOs, | ||
3841 | 3841 | bool isSymmetricOverlapAOs = false; |
3842 | 3842 | #pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
3843 | 3843 | for(int A=0; A<totalAtomNumber; A++){ |
3844 | - const Atom& lhsAtom = *lhsMolecule.GetAtom(A); | |
3845 | - const Atom& rhsAtom = *rhsMolecule->GetAtom(A); | |
3844 | + const Atom& lhsAtom = *lhsMolecule.GetAtomVect()[A]; | |
3845 | + const Atom& rhsAtom = *rhsMolecule->GetAtomVect()[A]; | |
3846 | 3846 | int firstAOIndexLhsAtom = lhsAtom.GetFirstAOIndex(); |
3847 | 3847 | int firstAOIndexRhsAtom = rhsAtom.GetFirstAOIndex(); |
3848 | 3848 | for(int i=0; i<lhsAtom.GetValenceSize(); i++){ |
@@ -3939,7 +3939,7 @@ void Cndo2::CalcOverlapESsWithAnotherElectronicStructure(double** overlapESs, | ||
3939 | 3939 | // calculate OverlapAOs matrix. E.g. S_{\mu\nu} in (3.74) in J. A. Pople book. |
3940 | 3940 | void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{ |
3941 | 3941 | int totalAONumber = molecule.GetTotalNumberAOs(); |
3942 | - int totalAtomNumber = molecule.GetNumberAtoms(); | |
3942 | + int totalAtomNumber = molecule.GetAtomVect().size(); | |
3943 | 3943 | MallocerFreer::GetInstance()->Initialize<double>(overlapAOs, totalAONumber, totalAONumber); |
3944 | 3944 | |
3945 | 3945 | // MPI setting of each rank |
@@ -3951,7 +3951,7 @@ void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{ | ||
3951 | 3951 | boost::thread communicationThread( boost::bind(&MolDS_mpi::AsyncCommunicator::Run<double>, &asyncCommunicator) ); |
3952 | 3952 | |
3953 | 3953 | for(int A=0; A<totalAtomNumber; A++){ |
3954 | - const Atom& atomA = *molecule.GetAtom(A); | |
3954 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
3955 | 3955 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3956 | 3956 | int numValenceAOs = atomA.GetValenceSize(); |
3957 | 3957 | int calcRank = A%mpiSize; |
@@ -3985,7 +3985,7 @@ void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{ | ||
3985 | 3985 | bool symmetrize = false; |
3986 | 3986 | #pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
3987 | 3987 | for(int B=A+1; B<totalAtomNumber; B++){ |
3988 | - const Atom& atomB = *molecule.GetAtom(B); | |
3988 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
3989 | 3989 | this->CalcDiatomicOverlapAOsInDiatomicFrame(diatomicOverlapAOs, atomA, atomB); |
3990 | 3990 | this->CalcRotatingMatrix(rotatingMatrix, atomA, atomB); |
3991 | 3991 | this->RotateDiatmicOverlapAOsToSpaceFrame(diatomicOverlapAOs, rotatingMatrix, tmpDiatomicOverlapAOs, tmpOldDiatomicOverlapAOs, tmpMatrixBC, tmpVectorBC); |
@@ -4189,8 +4189,8 @@ void Cndo2::CalcDiatomicOverlapAOs1stDerivatives(double*** diatomicOverlapAOs1st | ||
4189 | 4189 | tmpRotatedDiatomicOverlapVec, |
4190 | 4190 | tmpMatrixBC, |
4191 | 4191 | tmpVectorBC, |
4192 | - *this->molecule->GetAtom(indexAtomA), | |
4193 | - *this->molecule->GetAtom(indexAtomB)); | |
4192 | + *this->molecule->GetAtomVect()[indexAtomA], | |
4193 | + *this->molecule->GetAtomVect()[indexAtomB]); | |
4194 | 4194 | } |
4195 | 4195 | |
4196 | 4196 | // Second derivative of diatomic overlapAOs integrals between AOs in space fixed flame. |
@@ -4330,8 +4330,8 @@ void Cndo2::CalcDiatomicOverlapAOs2ndDerivatives(double**** diatomicOverlapAOs2n | ||
4330 | 4330 | tmpRotMat, |
4331 | 4331 | tmpRotMat1stDerivs, |
4332 | 4332 | tmpRotMat2ndDerivs, |
4333 | - *this->molecule->GetAtom(indexAtomA), | |
4334 | - *this->molecule->GetAtom(indexAtomB)); | |
4333 | + *this->molecule->GetAtomVect()[indexAtomA], | |
4334 | + *this->molecule->GetAtomVect()[indexAtomB]); | |
4335 | 4335 | } |
4336 | 4336 | |
4337 | 4337 | double Cndo2::Get2ndDerivativeElementFromDistanceDerivatives(double firstDistanceDeri, |
@@ -4358,8 +4358,8 @@ double Cndo2::Get2ndDerivativeElementFromDistanceDerivatives(double firstDistanc | ||
4358 | 4358 | void Cndo2::CalcOverlapAOsByGTOExpansion(double** overlapAOs, |
4359 | 4359 | const Molecule& molecule, |
4360 | 4360 | STOnGType stonG) const{ |
4361 | - int totalAONumber = molecule.GetTotalNumberAOs(); | |
4362 | - int totalAtomNumber = molecule.GetNumberAtoms(); | |
4361 | + int totalAONumber = molecule.GetTotalNumberAOs(); | |
4362 | + int totalAtomNumber = molecule.GetAtomVect().size(); | |
4363 | 4363 | |
4364 | 4364 | // calculation overlapAOs matrix |
4365 | 4365 | for(int mu=0; mu<totalAONumber; mu++){ |
@@ -4370,10 +4370,10 @@ void Cndo2::CalcOverlapAOsByGTOExpansion(double** overlapAOs, | ||
4370 | 4370 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
4371 | 4371 | for(int A=0; A<totalAtomNumber; A++){ |
4372 | 4372 | try{ |
4373 | - const Atom& atomA = *molecule.GetAtom(A); | |
4373 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
4374 | 4374 | int firstAOIndexAtomA = atomA.GetFirstAOIndex(); |
4375 | 4375 | for(int B=A+1; B<totalAtomNumber; B++){ |
4376 | - const Atom& atomB = *molecule.GetAtom(B); | |
4376 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
4377 | 4377 | int firstAOIndexAtomB = atomB.GetFirstAOIndex(); |
4378 | 4378 | for(int a=0; a<atomA.GetValenceSize(); a++){ |
4379 | 4379 | for(int b=0; b<atomB.GetValenceSize(); b++){ |
@@ -137,9 +137,9 @@ double Indo::GetFockDiagElement(const Atom& atomA, | ||
137 | 137 | value += temp; |
138 | 138 | |
139 | 139 | temp = 0.0; |
140 | - for(int B=0; B<molecule.GetNumberAtoms(); B++){ | |
140 | + for(int B=0; B<molecule.GetAtomVect().size(); B++){ | |
141 | 141 | if(B != indexAtomA){ |
142 | - const Atom& atomB = *molecule.GetAtom(B); | |
142 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
143 | 143 | temp += ( atomicElectronPopulation[B] - atomB.GetCoreCharge() ) |
144 | 144 | *gammaAB[indexAtomA][B]; |
145 | 145 | } |
@@ -207,8 +207,8 @@ double Indo::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
207 | 207 | value = Cndo2::GetMolecularIntegralElement(moI, moJ, moK, moL, molecule, fockMatrix, gammaAB); |
208 | 208 | |
209 | 209 | // Aditional terms for INDO, see Eq. (10) in [RZ_1973] |
210 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
211 | - const Atom& atomA = *molecule.GetAtom(A); | |
210 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
211 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
212 | 212 | firstAOIndexA = atomA.GetFirstAOIndex(); |
213 | 213 | numberAOsA = atomA.GetValenceSize(); |
214 | 214 |
@@ -161,9 +161,9 @@ void MC::CreateTrialConfiguration(Molecule* trial, | ||
161 | 161 | > (*realRand), |
162 | 162 | double stepWidth) const{ |
163 | 163 | // disturb an atom in trial molecule |
164 | - int movedAtomIndex = static_cast<int>((*realRand)()*this->molecule->GetNumberAtoms()); | |
165 | - const Atom& reffAtom = *current.GetAtom(movedAtomIndex); | |
166 | - Atom* trialAtom = trial->GetAtom(movedAtomIndex); | |
164 | + int movedAtomIndex = static_cast<int>((*realRand)()*this->molecule->GetAtomVect().size()); | |
165 | + const Atom& reffAtom = *current.GetAtomVect()[movedAtomIndex]; | |
166 | + Atom* trialAtom = trial->GetAtomVect()[movedAtomIndex]; | |
167 | 167 | double dr[CartesianType_end] = {0.0, 0.0, 0.0}; |
168 | 168 | for(int i=0; i<CartesianType_end; i++){ |
169 | 169 | dr[i] = stepWidth*(2.0*(*realRand)() -1.0); |
@@ -177,8 +177,8 @@ void MC::CreateTrialConfiguration(Molecule* trial, | ||
177 | 177 | for(int i=0; i<CartesianType_end; i++){ |
178 | 178 | coreCenterShift[i] = dr[i]*trialAtomCoreMass/totalCoreMass; |
179 | 179 | } |
180 | - for(int a=0; a<current.GetNumberAtoms(); a++){ | |
181 | - Atom* trialAtom = trial->GetAtom(a); | |
180 | + for(int a=0; a<current.GetAtomVect().size(); a++){ | |
181 | + Atom* trialAtom = trial->GetAtomVect()[a]; | |
182 | 182 | for(int i=0; i<CartesianType_end; i++){ |
183 | 183 | trialAtom->GetXyz()[i] -= coreCenterShift[i]; |
184 | 184 | } |
@@ -138,8 +138,8 @@ void MD::DoMD(){ | ||
138 | 138 | |
139 | 139 | void MD::UpdateMomenta(const Molecule& molecule, double const* const* matrixForce, double dt) const{ |
140 | 140 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
141 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
142 | - Atom* atom = molecule.GetAtom(a); | |
141 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
142 | + Atom* atom = molecule.GetAtomVect()[a]; | |
143 | 143 | for(int i=0; i<CartesianType_end; i++){ |
144 | 144 | atom->GetPxyz()[i] += 0.5*dt*(matrixForce[a][i]); |
145 | 145 | } |
@@ -148,8 +148,8 @@ void MD::UpdateMomenta(const Molecule& molecule, double const* const* matrixForc | ||
148 | 148 | |
149 | 149 | void MD::UpdateCoordinates(Molecule& molecule, double dt) const{ |
150 | 150 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
151 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
152 | - Atom* atom = molecule.GetAtom(a); | |
151 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
152 | + Atom* atom = molecule.GetAtomVect()[a]; | |
153 | 153 | double coreMass = atom->GetCoreMass(); |
154 | 154 | for(int i=0; i<CartesianType_end; i++){ |
155 | 155 | atom->GetXyz()[i] += dt*atom->GetPxyz()[i]/coreMass; |
@@ -183,8 +183,8 @@ double MD::OutputEnergies(boost::shared_ptr<ElectronicStructure> electronicStruc | ||
183 | 183 | int elecState = Parameters::GetInstance()->GetElectronicStateIndexMD(); |
184 | 184 | double eV2AU = Parameters::GetInstance()->GetEV2AU(); |
185 | 185 | double coreKineticEnergy = 0.0; |
186 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
187 | - Atom* atom = this->molecule->GetAtom(a); | |
186 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
187 | + Atom* atom = this->molecule->GetAtomVect()[a]; | |
188 | 188 | double coreMass = atom->GetCoreMass(); |
189 | 189 | for(int i=0; i<CartesianType_end; i++){ |
190 | 190 | coreKineticEnergy += 0.5*pow(atom->GetPxyz()[i],2.0)/coreMass; |
@@ -78,70 +78,70 @@ Mndo::Mndo() : MolDS_zindo::ZindoS(){ | ||
78 | 78 | Mndo::~Mndo(){ |
79 | 79 | OrbitalType twoElecLimit = dxy; |
80 | 80 | MallocerFreer::GetInstance()->Free<double>(&this->twoElecsTwoAtomCores, |
81 | - this->molecule->GetNumberAtoms(), | |
82 | - this->molecule->GetNumberAtoms(), | |
81 | + this->molecule->GetAtomVect().size(), | |
82 | + this->molecule->GetAtomVect().size(), | |
83 | 83 | twoElecLimit, |
84 | 84 | twoElecLimit, |
85 | 85 | twoElecLimit, |
86 | 86 | twoElecLimit); |
87 | 87 | MallocerFreer::GetInstance()->Free<double>(&this->twoElecsAtomEpcCores, |
88 | - this->molecule->GetNumberAtoms(), | |
89 | - this->molecule->GetNumberEpcs(), | |
88 | + this->molecule->GetAtomVect().size(), | |
89 | + this->molecule->GetEpcVect().size(), | |
90 | 90 | twoElecLimit, |
91 | 91 | twoElecLimit, |
92 | 92 | twoElecLimit, |
93 | 93 | twoElecLimit); |
94 | 94 | int numBuff = (twoElecLimit+1)*twoElecLimit/2; |
95 | 95 | MallocerFreer::GetInstance()->Free<double>(&this->twoElecsTwoAtomCoresMpiBuff, |
96 | - this->molecule->GetNumberAtoms(), | |
97 | - this->molecule->GetNumberAtoms(), | |
96 | + this->molecule->GetAtomVect().size(), | |
97 | + this->molecule->GetAtomVect().size(), | |
98 | 98 | numBuff, |
99 | 99 | numBuff); |
100 | 100 | MallocerFreer::GetInstance()->Free<double>(&this->twoElecsAtomEpcCoresMpiBuff, |
101 | - this->molecule->GetNumberAtoms(), | |
102 | - this->molecule->GetNumberEpcs(), | |
101 | + this->molecule->GetAtomVect().size(), | |
102 | + this->molecule->GetEpcVect().size(), | |
103 | 103 | numBuff, |
104 | 104 | numBuff); |
105 | 105 | MallocerFreer::GetInstance()->Free<double>(&this->normalForceConstants, |
106 | - CartesianType_end*molecule->GetNumberAtoms()); | |
106 | + CartesianType_end*molecule->GetAtomVect().size()); | |
107 | 107 | MallocerFreer::GetInstance()->Free<double>(&this->normalModes, |
108 | - CartesianType_end*molecule->GetNumberAtoms(), | |
109 | - CartesianType_end*molecule->GetNumberAtoms()); | |
108 | + CartesianType_end*molecule->GetAtomVect().size(), | |
109 | + CartesianType_end*molecule->GetAtomVect().size()); | |
110 | 110 | } |
111 | 111 | |
112 | 112 | void Mndo::SetMolecule(Molecule* molecule){ |
113 | 113 | ZindoS::SetMolecule(molecule); |
114 | 114 | OrbitalType twoElecLimit = dxy; |
115 | 115 | MallocerFreer::GetInstance()->Malloc<double>(&this->twoElecsTwoAtomCores, |
116 | - molecule->GetNumberAtoms(), | |
117 | - molecule->GetNumberAtoms(), | |
116 | + molecule->GetAtomVect().size(), | |
117 | + molecule->GetAtomVect().size(), | |
118 | 118 | twoElecLimit, |
119 | 119 | twoElecLimit, |
120 | 120 | twoElecLimit, |
121 | 121 | twoElecLimit); |
122 | 122 | MallocerFreer::GetInstance()->Malloc<double>(&this->twoElecsAtomEpcCores, |
123 | - molecule->GetNumberAtoms(), | |
124 | - molecule->GetNumberEpcs(), | |
123 | + molecule->GetAtomVect().size(), | |
124 | + molecule->GetEpcVect().size(), | |
125 | 125 | twoElecLimit, |
126 | 126 | twoElecLimit, |
127 | 127 | twoElecLimit, |
128 | 128 | twoElecLimit); |
129 | 129 | int numBuff = (twoElecLimit+1)*twoElecLimit/2; |
130 | 130 | MallocerFreer::GetInstance()->Malloc<double>(&this->twoElecsTwoAtomCoresMpiBuff, |
131 | - this->molecule->GetNumberAtoms(), | |
132 | - this->molecule->GetNumberAtoms(), | |
131 | + this->molecule->GetAtomVect().size(), | |
132 | + this->molecule->GetAtomVect().size(), | |
133 | 133 | numBuff, |
134 | 134 | numBuff); |
135 | 135 | MallocerFreer::GetInstance()->Malloc<double>(&this->twoElecsAtomEpcCoresMpiBuff, |
136 | - this->molecule->GetNumberAtoms(), | |
137 | - this->molecule->GetNumberEpcs(), | |
136 | + this->molecule->GetAtomVect().size(), | |
137 | + this->molecule->GetEpcVect().size(), | |
138 | 138 | numBuff, |
139 | 139 | numBuff); |
140 | 140 | MallocerFreer::GetInstance()->Malloc<double>(&this->normalForceConstants, |
141 | - CartesianType_end*molecule->GetNumberAtoms()); | |
141 | + CartesianType_end*molecule->GetAtomVect().size()); | |
142 | 142 | MallocerFreer::GetInstance()->Malloc<double>(&this->normalModes, |
143 | - CartesianType_end*molecule->GetNumberAtoms(), | |
144 | - CartesianType_end*molecule->GetNumberAtoms()); | |
143 | + CartesianType_end*molecule->GetAtomVect().size(), | |
144 | + CartesianType_end*molecule->GetAtomVect().size()); | |
145 | 145 | } |
146 | 146 | void Mndo::SetMessages(){ |
147 | 147 | this->errorMessageSCFNotConverged |
@@ -315,8 +315,8 @@ double Mndo::GetAuxiliaryDiatomCoreRepulsionEnergy2ndDerivative(const Atom& atom | ||
315 | 315 | } |
316 | 316 | |
317 | 317 | double Mndo::GetDiatomCoreRepulsionEnergy(int indexAtomA, int indexAtomB) const{ |
318 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
319 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
318 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
319 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
320 | 320 | double tmp = this->GetAuxiliaryDiatomCoreRepulsionEnergy(atomA, |
321 | 321 | atomB, |
322 | 322 | this->molecule->GetDistanceAtoms(atomA, atomB)); |
@@ -327,8 +327,8 @@ double Mndo::GetDiatomCoreRepulsionEnergy(int indexAtomA, int indexAtomB) const{ | ||
327 | 327 | } |
328 | 328 | |
329 | 329 | double Mndo::GetAtomCoreEpcCoulombEnergy(int indexAtom, int indexEpc) const{ |
330 | - const Atom& atom = *this->molecule->GetAtom(indexAtom); | |
331 | - const Atom& epc = *this->molecule->GetAtom(indexEpc); | |
330 | + const Atom& atom = *this->molecule->GetAtomVect()[indexAtom]; | |
331 | + const Atom& epc = *this->molecule->GetAtomVect()[indexEpc]; | |
332 | 332 | double distance = this->molecule->GetDistanceAtomEpc(indexAtom, indexEpc); |
333 | 333 | return atom.GetCoreCharge()*epc.GetCoreCharge()/distance; |
334 | 334 | } |
@@ -339,8 +339,8 @@ double Mndo::GetDiatomCoreRepulsion1stDerivative(int indexAtomA, | ||
339 | 339 | int indexAtomB, |
340 | 340 | CartesianType axisA) const{ |
341 | 341 | double value =0.0; |
342 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
343 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
342 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
343 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
344 | 344 | double distanceAB = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
345 | 345 | double twoElecInt = this->twoElecsTwoAtomCores[indexAtomA][indexAtomB][s][s][s][s]; |
346 | 346 | double twoElecInt1stDeriv = this->GetNddoRepulsionIntegral1stDerivative( |
@@ -359,8 +359,8 @@ double Mndo::GetDiatomCoreRepulsion2ndDerivative(int indexAtomA, | ||
359 | 359 | CartesianType axisA1, |
360 | 360 | CartesianType axisA2) const{ |
361 | 361 | double value =0.0; |
362 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
363 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
362 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
363 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
364 | 364 | double distanceAB = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
365 | 365 | double twoElecInt = this->twoElecsTwoAtomCores[indexAtomA][indexAtomB][s][s][s][s]; |
366 | 366 | double twoElecInt1stDeriv1 = this->GetNddoRepulsionIntegral1stDerivative(atomA, s, s, |
@@ -403,8 +403,8 @@ void Mndo::CalcHeatsFormation(double* heatsFormation, | ||
403 | 403 | const Molecule& molecule) const{ |
404 | 404 | int groundState = 0; |
405 | 405 | *heatsFormation = this->GetElectronicEnergy(groundState); |
406 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
407 | - const Atom& atom = *molecule.GetAtom(A); | |
406 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
407 | + const Atom& atom = *molecule.GetAtomVect()[A]; | |
408 | 408 | *heatsFormation -= atom.GetMndoElecEnergyAtom(); |
409 | 409 | *heatsFormation += atom.GetMndoHeatsFormAtom(); |
410 | 410 | } |
@@ -420,7 +420,7 @@ void Mndo::CalcNormalModes(double** normalModes, double* normalForceConstants, c | ||
420 | 420 | bool isMassWeighted = true; |
421 | 421 | this->CalcHessianSCF(normalModes, isMassWeighted); |
422 | 422 | bool calcEigenVectors = true; |
423 | - int hessianDim = CartesianType_end*molecule.GetNumberAtoms(); | |
423 | + int hessianDim = CartesianType_end*molecule.GetAtomVect().size(); | |
424 | 424 | MolDS_wrappers::Lapack::GetInstance()->Dsyevd(normalModes, |
425 | 425 | normalForceConstants, |
426 | 426 | hessianDim, |
@@ -464,10 +464,10 @@ double Mndo::GetFockDiagElement(const Atom& atomA, | ||
464 | 464 | value += temp; |
465 | 465 | |
466 | 466 | temp = 0.0; |
467 | - int totalNumberAtoms=molecule.GetNumberAtoms(); | |
467 | + int totalNumberAtoms=molecule.GetAtomVect().size(); | |
468 | 468 | for(int B=0; B<totalNumberAtoms; B++){ |
469 | 469 | if(B != indexAtomA){ |
470 | - const Atom& atomB = *molecule.GetAtom(B); | |
470 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
471 | 471 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
472 | 472 | int valenceSizeB = atomB.GetValenceSize(); |
473 | 473 | for(int lambda=0; lambda<valenceSizeB; lambda++){ |
@@ -492,11 +492,11 @@ double Mndo::GetFockDiagElement(const Atom& atomA, | ||
492 | 492 | value += temp; |
493 | 493 | |
494 | 494 | // coulomb repulsion with point charge * |
495 | - int numEpcs = molecule.GetNumberEpcs(); | |
495 | + int numEpcs = molecule.GetEpcVect().size(); | |
496 | 496 | if(0<numEpcs){ |
497 | 497 | double elecCharge = -1.0; |
498 | 498 | for(int i=0; i<numEpcs; i++){ |
499 | - double epcCharge = molecule.GetEpc(i)->GetCoreCharge(); | |
499 | + double epcCharge = molecule.GetEpcVect()[i]->GetCoreCharge(); | |
500 | 500 | value += elecCharge*epcCharge*twoElecsAtomEpcCores[indexAtomA][i][mu][mu][s][s]; |
501 | 501 | } |
502 | 502 | } |
@@ -538,10 +538,10 @@ double Mndo::GetFockOffDiagElement(const Atom& atomA, | ||
538 | 538 | exchange = this->GetExchangeInt(orbitalMu, orbitalNu, atomA); |
539 | 539 | temp = (1.5*exchange - 0.5*coulomb) |
540 | 540 | *orbitalElectronPopulation[mu+firstAOIndexA][nu+firstAOIndexB]; |
541 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
541 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
542 | 542 | for(int BB=0; BB<totalNumberAtoms; BB++){ |
543 | 543 | if(BB != indexAtomA){ |
544 | - const Atom& atomBB = *molecule.GetAtom(BB); | |
544 | + const Atom& atomBB = *molecule.GetAtomVect()[BB]; | |
545 | 545 | int firstAOIndexBB = atomBB.GetFirstAOIndex(); |
546 | 546 | int valenceSizeBB = atomBB.GetValenceSize(); |
547 | 547 | for(int lambda=0; lambda<valenceSizeBB; lambda++){ |
@@ -564,11 +564,11 @@ double Mndo::GetFockOffDiagElement(const Atom& atomA, | ||
564 | 564 | } |
565 | 565 | } |
566 | 566 | // coulomb repulsion with point charge * |
567 | - int numEpcs = molecule.GetNumberEpcs(); | |
567 | + int numEpcs = molecule.GetEpcVect().size(); | |
568 | 568 | if(0<numEpcs){ |
569 | 569 | double elecCharge = -1.0; |
570 | 570 | for(int i=0; i<numEpcs; i++){ |
571 | - double epcCharge = molecule.GetEpc(i)->GetCoreCharge(); | |
571 | + double epcCharge = molecule.GetEpcVect()[i]->GetCoreCharge(); | |
572 | 572 | value += elecCharge*epcCharge*twoElecsAtomEpcCores[indexAtomA][i][mu][nu][s][s]; |
573 | 573 | } |
574 | 574 | } |
@@ -663,7 +663,7 @@ double Mndo::GetElectronCoreAttraction(int indexAtomA, | ||
663 | 663 | int mu, |
664 | 664 | int nu, |
665 | 665 | double const* const* const* const* const* const* twoElecsTwoAtomCores) const{ |
666 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
666 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
667 | 667 | return -1.0*atomB.GetCoreCharge()*twoElecsTwoAtomCores[indexAtomA][indexAtomB][mu][nu][s][s]; |
668 | 668 | } |
669 | 669 |
@@ -677,7 +677,7 @@ double Mndo::GetElectronCoreAttraction1stDerivative(int indexAtomA, | ||
677 | 677 | int nu, |
678 | 678 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivatives, |
679 | 679 | CartesianType axisA) const{ |
680 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
680 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
681 | 681 | double value = -1.0*atomB.GetCoreCharge() |
682 | 682 | *diatomicTwoElecsTwoCores1stDerivatives[mu][nu][s][s][axisA]; |
683 | 683 | return value; |
@@ -711,13 +711,13 @@ double Mndo::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
711 | 711 | double const* const* fockMatrix, |
712 | 712 | double const* const* gammaAB) const{ |
713 | 713 | double value = 0.0; |
714 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
715 | - const Atom& atomA = *molecule.GetAtom(A); | |
714 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
715 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
716 | 716 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
717 | 717 | int lastAOIndexA = atomA.GetLastAOIndex(); |
718 | 718 | |
719 | - for(int B=A; B<molecule.GetNumberAtoms(); B++){ | |
720 | - const Atom& atomB = *molecule.GetAtom(B); | |
719 | + for(int B=A; B<molecule.GetAtomVect().size(); B++){ | |
720 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
721 | 721 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
722 | 722 | int lastAOIndexB = atomB.GetLastAOIndex(); |
723 | 723 |
@@ -834,13 +834,13 @@ void Mndo::CalcCISMatrix(double** matrixCIS) const{ | ||
834 | 834 | |
835 | 835 | // Fast algorith, but this is not easy to read. |
836 | 836 | // Slow algorithm is alos written below. |
837 | - for(int A=0; A<molecule->GetNumberAtoms(); A++){ | |
838 | - const Atom& atomA = *molecule->GetAtom(A); | |
837 | + for(int A=0; A<molecule->GetAtomVect().size(); A++){ | |
838 | + const Atom& atomA = *molecule->GetAtomVect()[A]; | |
839 | 839 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
840 | 840 | int lastAOIndexA = atomA.GetLastAOIndex(); |
841 | 841 | |
842 | - for(int B=A; B<molecule->GetNumberAtoms(); B++){ | |
843 | - const Atom& atomB = *molecule->GetAtom(B); | |
842 | + for(int B=A; B<molecule->GetAtomVect().size(); B++){ | |
843 | + const Atom& atomB = *molecule->GetAtomVect()[B]; | |
844 | 844 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
845 | 845 | int lastAOIndexB = atomB.GetLastAOIndex(); |
846 | 846 |
@@ -1073,25 +1073,25 @@ void Mndo::MallocTempMatricesEachThreadCalcHessianSCF(double***** diatomicOve | ||
1073 | 1073 | double*** tmpMatrixBC, |
1074 | 1074 | double** tmpVectorBC) const{ |
1075 | 1075 | MallocerFreer::GetInstance()->Malloc<double>(diatomicOverlapAOs1stDerivs, |
1076 | - this->molecule->GetNumberAtoms(), | |
1076 | + this->molecule->GetAtomVect().size(), | |
1077 | 1077 | OrbitalType_end, |
1078 | 1078 | OrbitalType_end, |
1079 | 1079 | CartesianType_end); |
1080 | 1080 | MallocerFreer::GetInstance()->Malloc<double>(diatomicOverlapAOs2ndDerivs, |
1081 | - this->molecule->GetNumberAtoms(), | |
1081 | + this->molecule->GetAtomVect().size(), | |
1082 | 1082 | OrbitalType_end, |
1083 | 1083 | OrbitalType_end, |
1084 | 1084 | CartesianType_end, |
1085 | 1085 | CartesianType_end); |
1086 | 1086 | MallocerFreer::GetInstance()->Malloc<double>(diatomicTwoElecsTwoCores1stDerivs, |
1087 | - this->molecule->GetNumberAtoms(), | |
1087 | + this->molecule->GetAtomVect().size(), | |
1088 | 1088 | dxy, |
1089 | 1089 | dxy, |
1090 | 1090 | dxy, |
1091 | 1091 | dxy, |
1092 | 1092 | CartesianType_end); |
1093 | 1093 | MallocerFreer::GetInstance()->Malloc<double>(diatomicTwoElecsTwoCores2ndDerivs, |
1094 | - this->molecule->GetNumberAtoms(), | |
1094 | + this->molecule->GetAtomVect().size(), | |
1095 | 1095 | dxy, |
1096 | 1096 | dxy, |
1097 | 1097 | dxy, |
@@ -1173,25 +1173,25 @@ void Mndo::FreeTempMatricesEachThreadCalcHessianSCF(double***** diatomicOverl | ||
1173 | 1173 | double*** tmpMatrixBC, |
1174 | 1174 | double** tmpVectorBC) const{ |
1175 | 1175 | MallocerFreer::GetInstance()->Free<double>(diatomicOverlapAOs1stDerivs, |
1176 | - this->molecule->GetNumberAtoms(), | |
1176 | + this->molecule->GetAtomVect().size(), | |
1177 | 1177 | OrbitalType_end, |
1178 | 1178 | OrbitalType_end, |
1179 | 1179 | CartesianType_end); |
1180 | 1180 | MallocerFreer::GetInstance()->Free<double>(diatomicOverlapAOs2ndDerivs, |
1181 | - this->molecule->GetNumberAtoms(), | |
1181 | + this->molecule->GetAtomVect().size(), | |
1182 | 1182 | OrbitalType_end, |
1183 | 1183 | OrbitalType_end, |
1184 | 1184 | CartesianType_end, |
1185 | 1185 | CartesianType_end); |
1186 | 1186 | MallocerFreer::GetInstance()->Free<double>(diatomicTwoElecsTwoCores1stDerivs, |
1187 | - this->molecule->GetNumberAtoms(), | |
1187 | + this->molecule->GetAtomVect().size(), | |
1188 | 1188 | dxy, |
1189 | 1189 | dxy, |
1190 | 1190 | dxy, |
1191 | 1191 | dxy, |
1192 | 1192 | CartesianType_end); |
1193 | 1193 | MallocerFreer::GetInstance()->Free<double>(diatomicTwoElecsTwoCores2ndDerivs, |
1194 | - this->molecule->GetNumberAtoms(), | |
1194 | + this->molecule->GetAtomVect().size(), | |
1195 | 1195 | dxy, |
1196 | 1196 | dxy, |
1197 | 1197 | dxy, |
@@ -1265,8 +1265,8 @@ double Mndo::GetAuxiliaryHessianElement1(int mu, | ||
1265 | 1265 | CartesianType axisA2, |
1266 | 1266 | double const* const* orbitalElectronPopulation, |
1267 | 1267 | double const* const* const* const* const* const* diatomicTwoElecsTwoCores2ndDerivs) const{ |
1268 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1269 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1268 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1269 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1270 | 1270 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1271 | 1271 | double value = orbitalElectronPopulation[mu] |
1272 | 1272 | [nu] |
@@ -1291,8 +1291,8 @@ double Mndo::GetAuxiliaryHessianElement2(int mu, | ||
1291 | 1291 | CartesianType axisB, |
1292 | 1292 | double const* const* const* const* orbitalElectronPopulation1stDerivs, |
1293 | 1293 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
1294 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1295 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1294 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1295 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1296 | 1296 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1297 | 1297 | double value = orbitalElectronPopulation1stDerivs[mu] |
1298 | 1298 | [nu] |
@@ -1317,8 +1317,8 @@ double Mndo::GetAuxiliaryHessianElement3(int lambda, | ||
1317 | 1317 | CartesianType axisA2, |
1318 | 1318 | double const* const* orbitalElectronPopulation, |
1319 | 1319 | double const* const* const* const* const* const* diatomicTwoElecsTwoCores2ndDerivs) const{ |
1320 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1321 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1320 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1321 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1322 | 1322 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1323 | 1323 | double value = orbitalElectronPopulation[lambda] |
1324 | 1324 | [sigma] |
@@ -1343,8 +1343,8 @@ double Mndo::GetAuxiliaryHessianElement4(int lambda, | ||
1343 | 1343 | CartesianType axisB, |
1344 | 1344 | double const* const* const* const* orbitalElectronPopulation1stDerivs, |
1345 | 1345 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
1346 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1347 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1346 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1347 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1348 | 1348 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1349 | 1349 | double value = orbitalElectronPopulation1stDerivs[lambda] |
1350 | 1350 | [sigma] |
@@ -1369,8 +1369,8 @@ double Mndo::GetAuxiliaryHessianElement5(int mu, | ||
1369 | 1369 | CartesianType axisA2, |
1370 | 1370 | double const* const* orbitalElectronPopulation, |
1371 | 1371 | double const* const* const* const* diatomicOverlapAOs2ndDerivs) const{ |
1372 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
1373 | - const Atom& atomC = *molecule->GetAtom(indexAtomC); | |
1372 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
1373 | + const Atom& atomC = *molecule->GetAtomVect()[indexAtomC]; | |
1374 | 1374 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1375 | 1375 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1376 | 1376 | double bondParameterA = atomA.GetBondingParameter(this->theory, atomA.GetValence(mu-firstAOIndexA)); |
@@ -1397,8 +1397,8 @@ double Mndo::GetAuxiliaryHessianElement6(int mu, | ||
1397 | 1397 | CartesianType axisB, |
1398 | 1398 | double const* const* const* const* orbitalElectronPopulation1stDerivs, |
1399 | 1399 | double const* const* const* diatomicOverlapAOs1stDerivs) const{ |
1400 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
1401 | - const Atom& atomC = *molecule->GetAtom(indexAtomC); | |
1400 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
1401 | + const Atom& atomC = *molecule->GetAtomVect()[indexAtomC]; | |
1402 | 1402 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1403 | 1403 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1404 | 1404 | double bondParameterA = atomA.GetBondingParameter(this->theory, atomA.GetValence(mu-firstAOIndexA)); |
@@ -1428,8 +1428,8 @@ double Mndo::GetAuxiliaryHessianElement7(int mu, | ||
1428 | 1428 | CartesianType axisA2, |
1429 | 1429 | double const* const* orbitalElectronPopulation, |
1430 | 1430 | double const* const* const* const* const* const* diatomicTwoElecsTwoCores2ndDerivs) const{ |
1431 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
1432 | - const Atom& atomC = *molecule->GetAtom(indexAtomC); | |
1431 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
1432 | + const Atom& atomC = *molecule->GetAtomVect()[indexAtomC]; | |
1433 | 1433 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1434 | 1434 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1435 | 1435 | double temp1 = orbitalElectronPopulation[mu][nu]*orbitalElectronPopulation[lambda][sigma]; |
@@ -1459,8 +1459,8 @@ double Mndo::GetAuxiliaryHessianElement8(int mu, | ||
1459 | 1459 | double const* const* orbitalElectronPopulation, |
1460 | 1460 | double const* const* const* const* orbitalElectronPopulation1stDerivs, |
1461 | 1461 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
1462 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
1463 | - const Atom& atomC = *molecule->GetAtom(indexAtomC); | |
1462 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
1463 | + const Atom& atomC = *molecule->GetAtomVect()[indexAtomC]; | |
1464 | 1464 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1465 | 1465 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1466 | 1466 | double temp1 = orbitalElectronPopulation1stDerivs[mu][nu] [indexAtomB][axisB] |
@@ -1494,12 +1494,12 @@ double Mndo::GetHessianElementSameAtomsSCF(int indexAtomA, | ||
1494 | 1494 | double const* const* const* const* const* const* const* diatomicTwoElecsTwoCores2ndDerivs) const{ |
1495 | 1495 | double value=0.0; |
1496 | 1496 | int indexAtomB = indexAtomA; |
1497 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1497 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1498 | 1498 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1499 | 1499 | int lastAOIndexA = atomA.GetLastAOIndex(); |
1500 | - for(int indexAtomC=0; indexAtomC<this->molecule->GetNumberAtoms(); indexAtomC++){ | |
1500 | + for(int indexAtomC=0; indexAtomC<this->molecule->GetAtomVect().size(); indexAtomC++){ | |
1501 | 1501 | if(indexAtomA != indexAtomC){ |
1502 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1502 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1503 | 1503 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1504 | 1504 | int numberAOsC = atomC.GetValenceSize(); |
1505 | 1505 |
@@ -1630,8 +1630,8 @@ double Mndo::GetHessianElementDifferentAtomsSCF(int indexAtomA, | ||
1630 | 1630 | double const* const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs, |
1631 | 1631 | double const* const* const* const* const* const* const* diatomicTwoElecsTwoCores2ndDerivs) const{ |
1632 | 1632 | double value=0.0; |
1633 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1634 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
1633 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1634 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
1635 | 1635 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1636 | 1636 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
1637 | 1637 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -1693,9 +1693,9 @@ double Mndo::GetHessianElementDifferentAtomsSCF(int indexAtomA, | ||
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | |
1696 | - for(int indexAtomC=0; indexAtomC<this->molecule->GetNumberAtoms(); indexAtomC++){ | |
1696 | + for(int indexAtomC=0; indexAtomC<this->molecule->GetAtomVect().size(); indexAtomC++){ | |
1697 | 1697 | if(indexAtomA != indexAtomC){ |
1698 | - const Atom& atomC = *this->molecule->GetAtom(indexAtomC); | |
1698 | + const Atom& atomC = *this->molecule->GetAtomVect()[indexAtomC]; | |
1699 | 1699 | int firstAOIndexC = atomC.GetFirstAOIndex(); |
1700 | 1700 | int numberAOsC = atomC.GetValenceSize(); |
1701 | 1701 |
@@ -1786,7 +1786,7 @@ void Mndo::CalcHessianSCF(double** hessianSCF, bool isMassWeighted) const{ | ||
1786 | 1786 | MallocerFreer::GetInstance()->Malloc<double>(&orbitalElectronPopulation1stDerivs, |
1787 | 1787 | totalNumberAOs, |
1788 | 1788 | totalNumberAOs, |
1789 | - this->molecule->GetNumberAtoms(), | |
1789 | + this->molecule->GetAtomVect().size(), | |
1790 | 1790 | CartesianType_end); |
1791 | 1791 | this->CalcOrbitalElectronPopulation1stDerivatives(orbitalElectronPopulation1stDerivs); |
1792 | 1792 |
@@ -1834,14 +1834,14 @@ void Mndo::CalcHessianSCF(double** hessianSCF, bool isMassWeighted) const{ | ||
1834 | 1834 | &tmpMatrixBC, |
1835 | 1835 | &tmpVectorBC); |
1836 | 1836 | #pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1837 | - for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){ | |
1838 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
1837 | + for(int indexAtomA=0; indexAtomA<this->molecule->GetAtomVect().size(); indexAtomA++){ | |
1838 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
1839 | 1839 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
1840 | 1840 | int lastAOIndexA = atomA.GetLastAOIndex(); |
1841 | 1841 | for(int axisA = XAxis; axisA<CartesianType_end; axisA++){ |
1842 | 1842 | |
1843 | 1843 | // calculation of derivatives of the overlapAOss and two electron integrals |
1844 | - for(int indexAtomB=0; indexAtomB<this->molecule->GetNumberAtoms(); indexAtomB++){ | |
1844 | + for(int indexAtomB=0; indexAtomB<this->molecule->GetAtomVect().size(); indexAtomB++){ | |
1845 | 1845 | if(indexAtomA != indexAtomB){ |
1846 | 1846 | this->CalcDiatomicOverlapAOs1stDerivatives(diatomicOverlapAOs1stDerivs[indexAtomB], |
1847 | 1847 | tmpDiaOverlapAOsInDiaFrame, |
@@ -1885,10 +1885,10 @@ void Mndo::CalcHessianSCF(double** hessianSCF, bool isMassWeighted) const{ | ||
1885 | 1885 | |
1886 | 1886 | // calculation of each hessian element |
1887 | 1887 | int k = indexAtomA*CartesianType_end + axisA; // hessian index, i.e. hessian[k][l] |
1888 | - for(int indexAtomB=indexAtomA; indexAtomB<this->molecule->GetNumberAtoms(); indexAtomB++){ | |
1888 | + for(int indexAtomB=indexAtomA; indexAtomB<this->molecule->GetAtomVect().size(); indexAtomB++){ | |
1889 | 1889 | // hessian element (atomA != atomB) |
1890 | 1890 | if(indexAtomA!=indexAtomB){ |
1891 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
1891 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
1892 | 1892 | for(int axisB = XAxis; axisB<CartesianType_end; axisB++){ |
1893 | 1893 | int l = indexAtomB*CartesianType_end + axisB; // hessian index, i.e. hessian[k][l] |
1894 | 1894 | hessianSCF[k][l] = this->GetHessianElementDifferentAtomsSCF(indexAtomA, |
@@ -1963,23 +1963,23 @@ void Mndo::CalcHessianSCF(double** hessianSCF, bool isMassWeighted) const{ | ||
1963 | 1963 | MallocerFreer::GetInstance()->Free<double>(&orbitalElectronPopulation1stDerivs, |
1964 | 1964 | totalNumberAOs, |
1965 | 1965 | totalNumberAOs, |
1966 | - this->molecule->GetNumberAtoms(), | |
1966 | + this->molecule->GetAtomVect().size(), | |
1967 | 1967 | CartesianType_end); |
1968 | 1968 | throw ex; |
1969 | 1969 | } |
1970 | 1970 | MallocerFreer::GetInstance()->Free<double>(&orbitalElectronPopulation1stDerivs, |
1971 | 1971 | totalNumberAOs, |
1972 | 1972 | totalNumberAOs, |
1973 | - this->molecule->GetNumberAtoms(), | |
1973 | + this->molecule->GetAtomVect().size(), | |
1974 | 1974 | CartesianType_end); |
1975 | - int hessianDim = this->molecule->GetNumberAtoms()*CartesianType_end; | |
1975 | + int hessianDim = this->molecule->GetAtomVect().size()*CartesianType_end; | |
1976 | 1976 | for(int k=0; k<hessianDim; k++){ |
1977 | 1977 | for(int l=k; l<hessianDim; l++){ |
1978 | 1978 | hessianSCF[l][k] = hessianSCF[k][l]; |
1979 | 1979 | } |
1980 | 1980 | } |
1981 | 1981 | /* |
1982 | - int hessianDim = this->molecule->GetNumberAtoms()*CartesianType_end; | |
1982 | + int hessianDim = this->molecule->GetAtomVect().size()*CartesianType_end; | |
1983 | 1983 | for(int i=0; i<hessianDim; i++){ |
1984 | 1984 | for(int j=0; j<hessianDim; j++){ |
1985 | 1985 | printf("hess elem: %d %d %e\n",i,j,hessianSCF[i][j]); |
@@ -1999,7 +1999,7 @@ void Mndo::CalcOrbitalElectronPopulation1stDerivatives(double**** orbitalElectro | ||
1999 | 1999 | vector<MoIndexPair> redundantQIndeces; |
2000 | 2000 | this->CalcActiveSetVariablesQ(&nonRedundantQIndeces, &redundantQIndeces, numberOcc, numberVir); |
2001 | 2001 | int dimensionCPHF = nonRedundantQIndeces.size() + redundantQIndeces.size(); |
2002 | - int numberCPHFs = this->molecule->GetNumberAtoms()*CartesianType_end; | |
2002 | + int numberCPHFs = this->molecule->GetAtomVect().size()*CartesianType_end; | |
2003 | 2003 | double** solutionsCPHF = NULL; // solutions of CPHF |
2004 | 2004 | double** transposedFockMatrix = NULL; // transposed Fock matrix |
2005 | 2005 | try{ |
@@ -2012,7 +2012,7 @@ void Mndo::CalcOrbitalElectronPopulation1stDerivatives(double**** orbitalElectro | ||
2012 | 2012 | for(int mu=0; mu<totalNumberAOs; mu++){ |
2013 | 2013 | try{ |
2014 | 2014 | for(int nu=0; nu<totalNumberAOs; nu++){ |
2015 | - for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){ | |
2015 | + for(int indexAtomA=0; indexAtomA<this->molecule->GetAtomVect().size(); indexAtomA++){ | |
2016 | 2016 | for(int axis=XAxis; axis<CartesianType_end; axis++){ |
2017 | 2017 | |
2018 | 2018 | int moI, moJ; |
@@ -2047,7 +2047,7 @@ void Mndo::CalcOrbitalElectronPopulation1stDerivatives(double**** orbitalElectro | ||
2047 | 2047 | |
2048 | 2048 | /* |
2049 | 2049 | // check the CPHF's solutions |
2050 | - for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){ | |
2050 | + for(int indexAtomA=0; indexAtomA<this->molecule->GetAtomVect().size(); indexAtomA++){ | |
2051 | 2051 | for(int axis=XAxis; axis<CartesianType_end; axis++){ |
2052 | 2052 | double temp=0.0; |
2053 | 2053 | printf("cphf: atom:%d axis:%s start\n ",indexAtomA,CartesianTypeStr(axis)); |
@@ -2077,7 +2077,7 @@ void Mndo::SolveCPHF(double** solutionsCPHF, | ||
2077 | 2077 | const vector<MoIndexPair>& nonRedundantQIndeces, |
2078 | 2078 | const vector<MoIndexPair>& redundantQIndeces) const{ |
2079 | 2079 | int dimensionCPHF = nonRedundantQIndeces.size() + redundantQIndeces.size(); |
2080 | - int numberCPHFs = this->molecule->GetNumberAtoms()*CartesianType_end; | |
2080 | + int numberCPHFs = this->molecule->GetAtomVect().size()*CartesianType_end; | |
2081 | 2081 | double** matrixCPHF = NULL; // (Gmamma - K matrix)N, see (40) - (46) to slove (34) in [PT_1996]. |
2082 | 2082 | try{ |
2083 | 2083 | this->MallocTempMatricesSolveCPHF(&matrixCPHF, dimensionCPHF); |
@@ -2100,7 +2100,7 @@ void Mndo::CalcStaticFirstOrderFocks(double** staticFirstOrderFocks, | ||
2100 | 2100 | const vector<MoIndexPair>& redundantQIndeces) const{ |
2101 | 2101 | stringstream ompErrors; |
2102 | 2102 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
2103 | - for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){ | |
2103 | + for(int indexAtomA=0; indexAtomA<this->molecule->GetAtomVect().size(); indexAtomA++){ | |
2104 | 2104 | try{ |
2105 | 2105 | for(int axisA=XAxis; axisA<CartesianType_end; axisA++){ |
2106 | 2106 | int k=indexAtomA*CartesianType_end + axisA; |
@@ -2158,13 +2158,13 @@ void Mndo::CalcStaticFirstOrderFock(double* staticFirstOrderFock, | ||
2158 | 2158 | MallocerFreer::GetInstance()->Malloc<double>(&tmpRotatedDiatomicOverlapVec, OrbitalType_end*OrbitalType_end); |
2159 | 2159 | MallocerFreer::GetInstance()->Malloc<double>(&tmpMatrixBC, OrbitalType_end, OrbitalType_end); |
2160 | 2160 | MallocerFreer::GetInstance()->Malloc<double>(&tmpVectorBC, OrbitalType_end*OrbitalType_end); |
2161 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
2161 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
2162 | 2162 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2163 | 2163 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2164 | 2164 | int coreChargeA = atomA.GetCoreCharge(); |
2165 | - for(int indexAtomB=0; indexAtomB<this->molecule->GetNumberAtoms(); indexAtomB++){ | |
2165 | + for(int indexAtomB=0; indexAtomB<this->molecule->GetAtomVect().size(); indexAtomB++){ | |
2166 | 2166 | if(indexAtomA != indexAtomB){ |
2167 | - const Atom& atomB = *molecule->GetAtom(indexAtomB); | |
2167 | + const Atom& atomB = *molecule->GetAtomVect()[indexAtomB]; | |
2168 | 2168 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2169 | 2169 | int lastAOIndexB = atomB.GetLastAOIndex(); |
2170 | 2170 | int coreChargeB = atomB.GetCoreCharge(); |
@@ -2468,7 +2468,7 @@ void Mndo::CalcForceSCFElecCoreAttractionPart(double* force, | ||
2468 | 2468 | int indexAtomA, |
2469 | 2469 | int indexAtomB, |
2470 | 2470 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
2471 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2471 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2472 | 2472 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2473 | 2473 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2474 | 2474 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -2491,8 +2491,8 @@ void Mndo::CalcForceSCFOverlapAOsPart(double* force, | ||
2491 | 2491 | int indexAtomA, |
2492 | 2492 | int indexAtomB, |
2493 | 2493 | double const* const* const* diatomicOverlapAOs1stDerivs) const{ |
2494 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2495 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
2494 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2495 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
2496 | 2496 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2497 | 2497 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2498 | 2498 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -2520,8 +2520,8 @@ void Mndo::CalcForceSCFTwoElecPart(double* force, | ||
2520 | 2520 | int indexAtomA, |
2521 | 2521 | int indexAtomB, |
2522 | 2522 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
2523 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2524 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
2523 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2524 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
2525 | 2525 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2526 | 2526 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2527 | 2527 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -2559,8 +2559,8 @@ void Mndo::CalcForceExcitedStaticPart(double* force, | ||
2559 | 2559 | int indexAtomA, |
2560 | 2560 | int indexAtomB, |
2561 | 2561 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
2562 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2563 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
2562 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2563 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
2564 | 2564 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2565 | 2565 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2566 | 2566 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -2592,7 +2592,7 @@ void Mndo::CalcForceExcitedElecCoreAttractionPart(double* force, | ||
2592 | 2592 | int indexAtomA, |
2593 | 2593 | int indexAtomB, |
2594 | 2594 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
2595 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2595 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2596 | 2596 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2597 | 2597 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2598 | 2598 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -2616,8 +2616,8 @@ void Mndo::CalcForceExcitedTwoElecPart(double* force, | ||
2616 | 2616 | int indexAtomA, |
2617 | 2617 | int indexAtomB, |
2618 | 2618 | double const* const* const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
2619 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
2620 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
2619 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
2620 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
2621 | 2621 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2622 | 2622 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2623 | 2623 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -2661,9 +2661,9 @@ void Mndo::CalcForce(const vector<int>& elecStates){ | ||
2661 | 2661 | } |
2662 | 2662 | |
2663 | 2663 | // this loop is MPI-parallelized |
2664 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
2664 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
2665 | 2665 | if(a%mpiSize != mpiRank){continue;} |
2666 | - const Atom& atomA = *molecule->GetAtom(a); | |
2666 | + const Atom& atomA = *molecule->GetAtomVect()[a]; | |
2667 | 2667 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2668 | 2668 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2669 | 2669 | stringstream ompErrors; |
@@ -2697,9 +2697,9 @@ void Mndo::CalcForce(const vector<int>& elecStates){ | ||
2697 | 2697 | &tmpDiatomicTwoElecsTwoCores); |
2698 | 2698 | |
2699 | 2699 | #pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
2700 | - for(int b=0; b<this->molecule->GetNumberAtoms(); b++){ | |
2700 | + for(int b=0; b<this->molecule->GetAtomVect().size(); b++){ | |
2701 | 2701 | if(a == b){continue;} |
2702 | - const Atom& atomB = *molecule->GetAtom(b); | |
2702 | + const Atom& atomB = *molecule->GetAtomVect()[b]; | |
2703 | 2703 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2704 | 2704 | int lastAOIndexB = atomB.GetLastAOIndex(); |
2705 | 2705 |
@@ -2848,7 +2848,7 @@ void Mndo::CalcForce(const vector<int>& elecStates){ | ||
2848 | 2848 | }// end of for(int a) with MPI parallelization |
2849 | 2849 | |
2850 | 2850 | // communication to reduce thsi->matrixForce on all node (namely, all_reduce) |
2851 | - int numTransported = elecStates.size()*this->molecule->GetNumberAtoms()*CartesianType_end; | |
2851 | + int numTransported = elecStates.size()*this->molecule->GetAtomVect().size()*CartesianType_end; | |
2852 | 2852 | MolDS_mpi::MpiProcess::GetInstance()->AllReduce(&this->matrixForce[0][0][0], numTransported, std::plus<double>()); |
2853 | 2853 | } |
2854 | 2854 |
@@ -2972,13 +2972,13 @@ double Mndo::GetSmallQElement(int moI, | ||
2972 | 2972 | int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2; |
2973 | 2973 | bool isMoPOcc = moP<numberOcc ? true : false; |
2974 | 2974 | |
2975 | - for(int A=0; A<molecule->GetNumberAtoms(); A++){ | |
2976 | - const Atom& atomA = *molecule->GetAtom(A); | |
2975 | + for(int A=0; A<molecule->GetAtomVect().size(); A++){ | |
2976 | + const Atom& atomA = *molecule->GetAtomVect()[A]; | |
2977 | 2977 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2978 | 2978 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2979 | 2979 | |
2980 | - for(int B=A; B<molecule->GetNumberAtoms(); B++){ | |
2981 | - const Atom& atomB = *molecule->GetAtom(B); | |
2980 | + for(int B=A; B<molecule->GetAtomVect().size(); B++){ | |
2981 | + const Atom& atomB = *molecule->GetAtomVect()[B]; | |
2982 | 2982 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2983 | 2983 | int lastAOIndexB = atomB.GetLastAOIndex(); |
2984 | 2984 |
@@ -3153,8 +3153,8 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3153 | 3153 | |
3154 | 3154 | // Fast algorith, but this is not easy to read. |
3155 | 3155 | // Slow algorithm is alos written below. |
3156 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3157 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3156 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3157 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3158 | 3158 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3159 | 3159 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3160 | 3160 |
@@ -3197,8 +3197,8 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3197 | 3197 | *this->fockMatrix[moK][mu]; |
3198 | 3198 | } |
3199 | 3199 | |
3200 | - for(int B=A; B<this->molecule->GetNumberAtoms(); B++){ | |
3201 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3200 | + for(int B=A; B<this->molecule->GetAtomVect().size(); B++){ | |
3201 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3202 | 3202 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3203 | 3203 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3204 | 3204 |
@@ -3301,16 +3301,16 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3301 | 3301 | double* twiceMoJK = NULL; |
3302 | 3302 | double* tmpVector = NULL; |
3303 | 3303 | int numAOs = this->molecule->GetTotalNumberAOs(); |
3304 | - MallocerFreer::GetInstance()->Malloc<double>(&twoElec, this->molecule->GetNumberAtoms()*dxy*dxy, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3305 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIJ, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3306 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3307 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3308 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoKL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3309 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoJL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3310 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoJK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3311 | - MallocerFreer::GetInstance()->Malloc<double>(&tmpVector, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3312 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3313 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3304 | + MallocerFreer::GetInstance()->Malloc<double>(&twoElec, this->molecule->GetAtomVect().size()*dxy*dxy, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3305 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIJ, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3306 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3307 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3308 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoKL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3309 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoJL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3310 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoJK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3311 | + MallocerFreer::GetInstance()->Malloc<double>(&tmpVector, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3312 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3313 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3314 | 3314 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3315 | 3315 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3316 | 3316 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -3322,8 +3322,8 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3322 | 3322 | } |
3323 | 3323 | } |
3324 | 3324 | |
3325 | - for(int B=0; B<this->molecule->GetNumberAtoms(); B++){ | |
3326 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3325 | + for(int B=0; B<this->molecule->GetAtomVect().size(); B++){ | |
3326 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3327 | 3327 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3328 | 3328 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3329 | 3329 | for(int lambda=firstAOIndexB; lambda<=lastAOIndexB; lambda++){ |
@@ -3335,12 +3335,12 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3335 | 3335 | } |
3336 | 3336 | } |
3337 | 3337 | |
3338 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3339 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3338 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3339 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3340 | 3340 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3341 | 3341 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3342 | - for(int B=A; B<this->molecule->GetNumberAtoms(); B++){ | |
3343 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3342 | + for(int B=A; B<this->molecule->GetAtomVect().size(); B++){ | |
3343 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3344 | 3344 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3345 | 3345 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3346 | 3346 | double gamma = 0.0; |
@@ -3389,29 +3389,29 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3389 | 3389 | } |
3390 | 3390 | } |
3391 | 3391 | } |
3392 | - MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetNumberAtoms()*dxy*dxy, | |
3392 | + MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetAtomVect().size()*dxy*dxy, | |
3393 | 3393 | twoElec, |
3394 | 3394 | twiceMoKL, |
3395 | 3395 | tmpVector); |
3396 | - value = 4.0*MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIJ, tmpVector); | |
3397 | - MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetNumberAtoms()*dxy*dxy, | |
3396 | + value = 4.0*MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIJ, tmpVector); | |
3397 | + MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetAtomVect().size()*dxy*dxy, | |
3398 | 3398 | twoElec, |
3399 | 3399 | twiceMoJL, |
3400 | 3400 | tmpVector); |
3401 | - value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIK, tmpVector); | |
3402 | - MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetNumberAtoms()*dxy*dxy, | |
3401 | + value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIK, tmpVector); | |
3402 | + MolDS_wrappers::Blas::GetInstance()->Dsymv(this->molecule->GetAtomVect().size()*dxy*dxy, | |
3403 | 3403 | twoElec, |
3404 | 3404 | twiceMoJK, |
3405 | 3405 | tmpVector); |
3406 | - value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIL, tmpVector); | |
3407 | - MallocerFreer::GetInstance()->Free<double>(&twoElec, this->molecule->GetNumberAtoms()*dxy*dxy, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3408 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIJ, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3409 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3410 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3411 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoKL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3412 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoJL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3413 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoJK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3414 | - MallocerFreer::GetInstance()->Free<double>(&tmpVector, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3406 | + value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIL, tmpVector); | |
3407 | + MallocerFreer::GetInstance()->Free<double>(&twoElec, this->molecule->GetAtomVect().size()*dxy*dxy, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3408 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIJ, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3409 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3410 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3411 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoKL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3412 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoJL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3413 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoJK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3414 | + MallocerFreer::GetInstance()->Free<double>(&tmpVector, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3415 | 3415 | // End of algorithm using blas |
3416 | 3416 | */ |
3417 | 3417 |
@@ -3425,14 +3425,14 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3425 | 3425 | double** twiceMoB = NULL; |
3426 | 3426 | double** tmpMatrix = NULL; |
3427 | 3427 | int numAOs = this->molecule->GetTotalNumberAOs(); |
3428 | - MallocerFreer::GetInstance()->Malloc<double>(&twoElec, this->molecule->GetNumberAtoms()*dxy*dxy, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3429 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIJ, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3430 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3431 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3432 | - MallocerFreer::GetInstance()->Malloc<double>(&twiceMoB, 3, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3433 | - MallocerFreer::GetInstance()->Malloc<double>(&tmpMatrix,3, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3434 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3435 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3428 | + MallocerFreer::GetInstance()->Malloc<double>(&twoElec, this->molecule->GetAtomVect().size()*dxy*dxy, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3429 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIJ, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3430 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3431 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoIL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3432 | + MallocerFreer::GetInstance()->Malloc<double>(&twiceMoB, 3, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3433 | + MallocerFreer::GetInstance()->Malloc<double>(&tmpMatrix,3, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3434 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3435 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3436 | 3436 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3437 | 3437 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3438 | 3438 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -3444,8 +3444,8 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3444 | 3444 | } |
3445 | 3445 | } |
3446 | 3446 | |
3447 | - for(int B=0; B<this->molecule->GetNumberAtoms(); B++){ | |
3448 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3447 | + for(int B=0; B<this->molecule->GetAtomVect().size(); B++){ | |
3448 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3449 | 3449 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3450 | 3450 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3451 | 3451 | for(int lambda=firstAOIndexB; lambda<=lastAOIndexB; lambda++){ |
@@ -3457,12 +3457,12 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3457 | 3457 | } |
3458 | 3458 | } |
3459 | 3459 | |
3460 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3461 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3460 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3461 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3462 | 3462 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3463 | 3463 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3464 | - for(int B=0; B<this->molecule->GetNumberAtoms(); B++){ | |
3465 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3464 | + for(int B=0; B<this->molecule->GetAtomVect().size(); B++){ | |
3465 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3466 | 3466 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3467 | 3467 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3468 | 3468 | double gamma = 0.0; |
@@ -3513,23 +3513,23 @@ double Mndo::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) const{ | ||
3513 | 3513 | } |
3514 | 3514 | |
3515 | 3515 | MolDS_wrappers::Blas::GetInstance()->Dgemm(false, true, true, |
3516 | - this->molecule->GetNumberAtoms()*dxy*dxy, | |
3516 | + this->molecule->GetAtomVect().size()*dxy*dxy, | |
3517 | 3517 | 3, |
3518 | - this->molecule->GetNumberAtoms()*dxy*dxy, | |
3518 | + this->molecule->GetAtomVect().size()*dxy*dxy, | |
3519 | 3519 | 1.0, |
3520 | 3520 | twoElec, |
3521 | 3521 | twiceMoB, |
3522 | 3522 | 0.0, |
3523 | 3523 | tmpMatrix); |
3524 | - value = 4.0*MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIJ, &tmpMatrix[0][0]); | |
3525 | - value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIK, &tmpMatrix[1][0]); | |
3526 | - value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetNumberAtoms()*dxy*dxy,twiceMoIL, &tmpMatrix[2][0]); | |
3527 | - MallocerFreer::GetInstance()->Free<double>(&twoElec, this->molecule->GetNumberAtoms()*dxy*dxy, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3528 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIJ, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3529 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIK, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3530 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoIL, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3531 | - MallocerFreer::GetInstance()->Free<double>(&twiceMoB, 3, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3532 | - MallocerFreer::GetInstance()->Free<double>(&tmpMatrix,3, this->molecule->GetNumberAtoms()*dxy*dxy); | |
3524 | + value = 4.0*MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIJ, &tmpMatrix[0][0]); | |
3525 | + value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIK, &tmpMatrix[1][0]); | |
3526 | + value -= MolDS_wrappers::Blas::GetInstance()->Ddot(this->molecule->GetAtomVect().size()*dxy*dxy,twiceMoIL, &tmpMatrix[2][0]); | |
3527 | + MallocerFreer::GetInstance()->Free<double>(&twoElec, this->molecule->GetAtomVect().size()*dxy*dxy, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3528 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIJ, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3529 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIK, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3530 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoIL, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3531 | + MallocerFreer::GetInstance()->Free<double>(&twiceMoB, 3, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3532 | + MallocerFreer::GetInstance()->Free<double>(&tmpMatrix,3, this->molecule->GetAtomVect().size()*dxy*dxy); | |
3533 | 3533 | // End of second algorithm using blas |
3534 | 3534 | */ |
3535 | 3535 |
@@ -3562,7 +3562,7 @@ void Mndo::CalcTwoElecsTwoAtomCores(double****** twoElecsTwoAtomCores, | ||
3562 | 3562 | throw MolDSException(this->errorMessageCalcTwoElecsTwoAtomCoresNullMatrix); |
3563 | 3563 | } |
3564 | 3564 | #endif |
3565 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
3565 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
3566 | 3566 | MallocerFreer::GetInstance()->Initialize<double>(twoElecsTwoAtomCores, |
3567 | 3567 | totalNumberAtoms, |
3568 | 3568 | totalNumberAtoms, |
@@ -3674,14 +3674,14 @@ void Mndo::CalcTwoElecsTwoAtomCores(double****** twoElecsTwoAtomCores, | ||
3674 | 3674 | |
3675 | 3675 | void Mndo::CalcTwoElecsAtomEpcCores(double****** twoElecsAtomEpcCores, |
3676 | 3676 | const Molecule& molecule) const{ |
3677 | - if(molecule.GetNumberEpcs()<=0){return;} | |
3677 | + if(molecule.GetEpcVect().empty()){return;} | |
3678 | 3678 | #ifdef MOLDS_DBG |
3679 | 3679 | if(twoElecsAtomEpcCores == NULL){ |
3680 | 3680 | throw MolDSException(this->errorMessageCalcTwoElecsAtomEpcCoresNullMatrix); |
3681 | 3681 | } |
3682 | 3682 | #endif |
3683 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
3684 | - int totalNumberEpcs = molecule.GetNumberEpcs(); | |
3683 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
3684 | + int totalNumberEpcs = molecule.GetEpcVect().size(); | |
3685 | 3685 | MallocerFreer::GetInstance()->Initialize<double>(twoElecsAtomEpcCores, |
3686 | 3686 | totalNumberAtoms, |
3687 | 3687 | totalNumberEpcs, |
@@ -3705,7 +3705,7 @@ void Mndo::CalcTwoElecsAtomEpcCores(double****** twoElecsAtomEpcCores, | ||
3705 | 3705 | double** tmpRotMat = NULL; |
3706 | 3706 | double** tmpMatrixBC = NULL; |
3707 | 3707 | double* tmpVectorBC = NULL; |
3708 | - const Atom& atom = *molecule.GetAtom(a); | |
3708 | + const Atom& atom = *molecule.GetAtomVect()[a]; | |
3709 | 3709 | try{ |
3710 | 3710 | MallocerFreer::GetInstance()->Malloc<double>(&diatomicTwoElecsTwoCores, dxy, dxy, dxy, dxy); |
3711 | 3711 | MallocerFreer::GetInstance()->Malloc<double>(&tmpDiatomicTwoElecsTwoCores, dxy*dxy*dxy*dxy); |
@@ -3715,7 +3715,7 @@ void Mndo::CalcTwoElecsAtomEpcCores(double****** twoElecsAtomEpcCores, | ||
3715 | 3715 | // note that terms with condition a==b are not needed to calculate. |
3716 | 3716 | //#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
3717 | 3717 | for(int b=0; b<totalNumberEpcs; b++){ |
3718 | - const Atom& epc = *molecule.GetEpc(b); | |
3718 | + const Atom& epc = *molecule.GetEpcVect()[b]; | |
3719 | 3719 | this->CalcDiatomicTwoElecsTwoCores(diatomicTwoElecsTwoCores, |
3720 | 3720 | tmpDiatomicTwoElecsTwoCores, |
3721 | 3721 | tmpRotMat, |
@@ -3883,8 +3883,8 @@ void Mndo::CalcDiatomicTwoElecsTwoCores(double**** matrix, | ||
3883 | 3883 | double* tmpVectorBC, |
3884 | 3884 | int indexAtomA, |
3885 | 3885 | int indexAtomB) const{ |
3886 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
3887 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
3886 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
3887 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
3888 | 3888 | this->CalcDiatomicTwoElecsTwoCores(matrix, |
3889 | 3889 | tmpVec, |
3890 | 3890 | tmpRotMat, |
@@ -3908,8 +3908,8 @@ void Mndo::CalcDiatomicTwoElecsTwoCores1stDerivatives(double***** matrix, | ||
3908 | 3908 | double**** tmpDiatomicTwoElecsTwoCores, |
3909 | 3909 | int indexAtomA, |
3910 | 3910 | int indexAtomB) const{ |
3911 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
3912 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
3911 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
3912 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
3913 | 3913 | if(indexAtomA == indexAtomB){ |
3914 | 3914 | stringstream ss; |
3915 | 3915 | ss << this->errorMessageCalcDiatomicTwoElecsTwoCores1stDerivativesSameAtoms; |
@@ -3992,8 +3992,8 @@ void Mndo::CalcDiatomicTwoElecsTwoCores2ndDerivatives(double****** matrix, | ||
3992 | 3992 | double***** tmpDiatomicTwoElecsTwoCores1stDerivs, |
3993 | 3993 | int indexAtomA, |
3994 | 3994 | int indexAtomB) const{ |
3995 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
3996 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
3995 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
3996 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
3997 | 3997 | if(indexAtomA == indexAtomB){ |
3998 | 3998 | stringstream ss; |
3999 | 3999 | ss << this->errorMessageCalcDiatomicTwoElecsTwoCores2ndDerivativesSameAtoms; |
@@ -177,8 +177,8 @@ void NASCO::DoNASCO(Molecule& molecule){ | ||
177 | 177 | void NASCO::UpdateMomenta(Molecule& molecule, |
178 | 178 | double const* const* matrixForce, |
179 | 179 | const double dt) const{ |
180 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
181 | - Atom* atom = molecule.GetAtom(a); | |
180 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
181 | + Atom* atom = molecule.GetAtomVect()[a]; | |
182 | 182 | for(int i=0; i<CartesianType_end; i++){ |
183 | 183 | atom->GetPxyz()[i] += 0.5*dt*(matrixForce[a][i]); |
184 | 184 | } |
@@ -188,9 +188,9 @@ void NASCO::UpdateMomenta(Molecule& molecule, | ||
188 | 188 | void NASCO::UpdateCoordinates(Molecule& tmpMolecule, |
189 | 189 | const Molecule& molecule, |
190 | 190 | const double dt) const{ |
191 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
192 | - Atom* atom = molecule.GetAtom(a); | |
193 | - Atom* tmpAtom = tmpMolecule.GetAtom(a); | |
191 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
192 | + Atom* atom = molecule.GetAtomVect()[a]; | |
193 | + Atom* tmpAtom = tmpMolecule.GetAtomVect()[a]; | |
194 | 194 | double coreMass = tmpAtom->GetCoreMass(); |
195 | 195 | for(int i=0; i<CartesianType_end; i++){ |
196 | 196 | tmpAtom->GetXyz()[i] = atom->GetXyz()[i] + dt*atom->GetPxyz()[i]/coreMass; |
@@ -253,8 +253,8 @@ double NASCO::OutputEnergies(const ElectronicStructure& electronicStructure, | ||
253 | 253 | int elecState) const{ |
254 | 254 | double eV2AU = Parameters::GetInstance()->GetEV2AU(); |
255 | 255 | double coreKineticEnergy = 0.0; |
256 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
257 | - Atom* atom = molecule.GetAtom(a); | |
256 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
257 | + Atom* atom = molecule.GetAtomVect()[a]; | |
258 | 258 | double coreMass = atom->GetCoreMass(); |
259 | 259 | for(int i=0; i<CartesianType_end; i++){ |
260 | 260 | coreKineticEnergy += 0.5*pow(atom->GetPxyz()[i],2.0)/coreMass; |
@@ -114,7 +114,7 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct | ||
114 | 114 | double lineSearchInitialEnergy = 0.0; |
115 | 115 | double const* const* matrixForce = NULL; |
116 | 116 | double const* vectorForce = NULL; |
117 | - const int dimension = molecule.GetNumberAtoms()*CartesianType_end; | |
117 | + const int dimension = molecule.GetAtomVect().size()*CartesianType_end; | |
118 | 118 | double** matrixHessian = NULL; |
119 | 119 | double* vectorOldForce = NULL; |
120 | 120 | double* vectorStep = NULL; |
@@ -156,7 +156,7 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct | ||
156 | 156 | trustRadius=min(trustRadius,maxNormStep); |
157 | 157 | |
158 | 158 | //Calculate RFO step |
159 | - MallocerFreer::GetInstance()->Malloc(&matrixStep, molecule.GetNumberAtoms(), CartesianType_end); | |
159 | + MallocerFreer::GetInstance()->Malloc(&matrixStep, molecule.GetAtomVect().size(), CartesianType_end); | |
160 | 160 | vectorStep = &matrixStep[0][0]; |
161 | 161 | this->CalcRFOStep(vectorStep, matrixHessian, vectorForce, trustRadius, dimension); |
162 | 162 |
@@ -215,16 +215,16 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct | ||
215 | 215 | catch(MolDSException ex){ |
216 | 216 | MallocerFreer::GetInstance()->Free(&matrixHessian, dimension, dimension); |
217 | 217 | MallocerFreer::GetInstance()->Free(&vectorOldForce, dimension); |
218 | - MallocerFreer::GetInstance()->Free(&matrixStep, molecule.GetNumberAtoms(), CartesianType_end); | |
219 | - MallocerFreer::GetInstance()->Free(&matrixDisplacement, molecule.GetNumberAtoms(), CartesianType_end); | |
220 | - MallocerFreer::GetInstance()->Free(&matrixOldCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
218 | + MallocerFreer::GetInstance()->Free(&matrixStep, molecule.GetAtomVect().size(), CartesianType_end); | |
219 | + MallocerFreer::GetInstance()->Free(&matrixDisplacement, molecule.GetAtomVect().size(), CartesianType_end); | |
220 | + MallocerFreer::GetInstance()->Free(&matrixOldCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
221 | 221 | throw ex; |
222 | 222 | } |
223 | 223 | MallocerFreer::GetInstance()->Free(&matrixHessian, dimension, dimension); |
224 | 224 | MallocerFreer::GetInstance()->Free(&vectorOldForce, dimension); |
225 | - MallocerFreer::GetInstance()->Free(&matrixStep, molecule.GetNumberAtoms(), CartesianType_end); | |
226 | - MallocerFreer::GetInstance()->Free(&matrixDisplacement, molecule.GetNumberAtoms(), CartesianType_end); | |
227 | - MallocerFreer::GetInstance()->Free(&matrixOldCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
225 | + MallocerFreer::GetInstance()->Free(&matrixStep, molecule.GetAtomVect().size(), CartesianType_end); | |
226 | + MallocerFreer::GetInstance()->Free(&matrixDisplacement, molecule.GetAtomVect().size(), CartesianType_end); | |
227 | + MallocerFreer::GetInstance()->Free(&matrixOldCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
228 | 228 | } |
229 | 229 | |
230 | 230 | void BFGS::CalcRFOStep(double* vectorStep, |
@@ -356,7 +356,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian, | ||
356 | 356 | const Molecule& molecule) const{ |
357 | 357 | const double one = 1; |
358 | 358 | const double largeEigenvalue = 1.0e3; |
359 | - const int numAtoms = molecule.GetNumberAtoms(); | |
359 | + const int numAtoms = molecule.GetAtomVect().size(); | |
360 | 360 | const int dimension = numAtoms *CartesianType_end; |
361 | 361 | const int numTranslationalModes = 3; |
362 | 362 | const int numRotationalModes = 3; |
@@ -397,7 +397,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian, | ||
397 | 397 | for(int c=0; c<numRotationalModes;c++){ |
398 | 398 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
399 | 399 | for(int n=0;n<numAtoms;n++){ |
400 | - const double* xyz = molecule.GetAtom(n)->GetXyz(); | |
400 | + const double* xyz = molecule.GetAtomVect()[n]->GetXyz(); | |
401 | 401 | for(int d=0;d<CartesianType_end;d++){ |
402 | 402 | matrixesRedundantModes[c+numTranslationalModes][n][d] = 0.0; |
403 | 403 | for(int e=0;e<CartesianType_end;e++){ |
@@ -548,8 +548,8 @@ void BFGS::RollbackMolecularGeometry(MolDS_base::Molecule& molecule, | ||
548 | 548 | bool tempCanOutputLogs = molecule.CanOutputLogs(); |
549 | 549 | bool rollbackCanOutputLogs = true; |
550 | 550 | molecule.SetCanOutputLogs(rollbackCanOutputLogs); |
551 | - for(int i=0;i<molecule.GetNumberAtoms();i++){ | |
552 | - const Atom* atom = molecule.GetAtom(i); | |
551 | + for(int i=0;i<molecule.GetAtomVect().size();i++){ | |
552 | + const Atom* atom = molecule.GetAtomVect()[i]; | |
553 | 553 | double* xyz = atom->GetXyz(); |
554 | 554 | for(int j=0;j<CartesianType_end;j++){ |
555 | 555 | xyz[j] = matrixOldCoordinates[i][j]; |
@@ -562,9 +562,9 @@ void BFGS::CalcDisplacement(double * *& matrixDisplacement, | ||
562 | 562 | double const* const* matrixOldCoordinates, |
563 | 563 | const MolDS_base::Molecule& molecule)const{ |
564 | 564 | //Calculate displacement (K_k at Eq. (15) in [SJTO_1983]) |
565 | - MallocerFreer::GetInstance()->Malloc(&matrixDisplacement, molecule.GetNumberAtoms(), CartesianType_end); | |
566 | - for(int i=0;i<molecule.GetNumberAtoms();i++){ | |
567 | - const Atom* atom = molecule.GetAtom(i); | |
565 | + MallocerFreer::GetInstance()->Malloc(&matrixDisplacement, molecule.GetAtomVect().size(), CartesianType_end); | |
566 | + for(int i=0;i<molecule.GetAtomVect().size();i++){ | |
567 | + const Atom* atom = molecule.GetAtomVect()[i]; | |
568 | 568 | const double* xyz = atom->GetXyz(); |
569 | 569 | for(int j=0;j<CartesianType_end;j++){ |
570 | 570 | matrixDisplacement[i][j] = xyz[j] - matrixOldCoordinates[i][j]; |
@@ -575,9 +575,9 @@ void BFGS::CalcDisplacement(double * *& matrixDisplacement, | ||
575 | 575 | void BFGS::StoreMolecularGeometry(double **& matrixCoordinates, |
576 | 576 | const MolDS_base::Molecule& molecule)const{ |
577 | 577 | //Store old coordinates |
578 | - MallocerFreer::GetInstance()->Malloc(&matrixCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
579 | - for(int i=0;i<molecule.GetNumberAtoms();i++){ | |
580 | - const Atom* atom = molecule.GetAtom(i); | |
578 | + MallocerFreer::GetInstance()->Malloc(&matrixCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
579 | + for(int i=0;i<molecule.GetAtomVect().size();i++){ | |
580 | + const Atom* atom = molecule.GetAtomVect()[i]; | |
581 | 581 | const double* xyz = atom->GetXyz(); |
582 | 582 | for(int j=0;j<CartesianType_end;j++){ |
583 | 583 | matrixCoordinates[i][j] = xyz[j]; |
@@ -88,9 +88,9 @@ void ConjugateGradient::SearchMinimum(boost::shared_ptr<ElectronicStructure> ele | ||
88 | 88 | requireGuess = false; |
89 | 89 | matrixForce = electronicStructure->GetForce(elecState); |
90 | 90 | try{ |
91 | - MallocerFreer::GetInstance()->Malloc<double>(&oldMatrixForce, molecule.GetNumberAtoms(), CartesianType_end); | |
92 | - MallocerFreer::GetInstance()->Malloc<double>(&matrixSearchDirection, molecule.GetNumberAtoms(), CartesianType_end); | |
93 | - for(int a=0;a<molecule.GetNumberAtoms();a++){ | |
91 | + MallocerFreer::GetInstance()->Malloc<double>(&oldMatrixForce, molecule.GetAtomVect().size(), CartesianType_end); | |
92 | + MallocerFreer::GetInstance()->Malloc<double>(&matrixSearchDirection, molecule.GetAtomVect().size(), CartesianType_end); | |
93 | + for(int a=0;a<molecule.GetAtomVect().size();a++){ | |
94 | 94 | for(int i=0; i<CartesianType_end; i++){ |
95 | 95 | matrixSearchDirection[a][i] = matrixForce[a][i]; |
96 | 96 | } |
@@ -120,12 +120,12 @@ void ConjugateGradient::SearchMinimum(boost::shared_ptr<ElectronicStructure> ele | ||
120 | 120 | } |
121 | 121 | } |
122 | 122 | catch(MolDSException ex){ |
123 | - MallocerFreer::GetInstance()->Free<double>(&oldMatrixForce, molecule.GetNumberAtoms(), CartesianType_end); | |
124 | - MallocerFreer::GetInstance()->Free<double>(&matrixSearchDirection, molecule.GetNumberAtoms(), CartesianType_end); | |
123 | + MallocerFreer::GetInstance()->Free<double>(&oldMatrixForce, molecule.GetAtomVect().size(), CartesianType_end); | |
124 | + MallocerFreer::GetInstance()->Free<double>(&matrixSearchDirection, molecule.GetAtomVect().size(), CartesianType_end); | |
125 | 125 | throw ex; |
126 | 126 | } |
127 | - MallocerFreer::GetInstance()->Free<double>(&oldMatrixForce, molecule.GetNumberAtoms(), CartesianType_end); | |
128 | - MallocerFreer::GetInstance()->Free<double>(&matrixSearchDirection, molecule.GetNumberAtoms(), CartesianType_end); | |
127 | + MallocerFreer::GetInstance()->Free<double>(&oldMatrixForce, molecule.GetAtomVect().size(), CartesianType_end); | |
128 | + MallocerFreer::GetInstance()->Free<double>(&matrixSearchDirection, molecule.GetAtomVect().size(), CartesianType_end); | |
129 | 129 | *lineSearchedEnergy = lineSearchCurrentEnergy; |
130 | 130 | } |
131 | 131 |
@@ -135,7 +135,7 @@ void ConjugateGradient::UpdateSearchDirection(double const* const** matrixForce, | ||
135 | 135 | boost::shared_ptr<ElectronicStructure> electronicStructure, |
136 | 136 | const MolDS_base::Molecule& molecule, |
137 | 137 | int elecState) const{ |
138 | - for(int a=0;a<molecule.GetNumberAtoms();a++){ | |
138 | + for(int a=0;a<molecule.GetAtomVect().size();a++){ | |
139 | 139 | for(int i=0; i<CartesianType_end; i++){ |
140 | 140 | oldMatrixForce[a][i] = (*matrixForce)[a][i]; |
141 | 141 | } |
@@ -143,14 +143,14 @@ void ConjugateGradient::UpdateSearchDirection(double const* const** matrixForce, | ||
143 | 143 | *matrixForce = electronicStructure->GetForce(elecState); |
144 | 144 | double beta=0.0; |
145 | 145 | double temp=0.0; |
146 | - for(int a=0;a<molecule.GetNumberAtoms();a++){ | |
146 | + for(int a=0;a<molecule.GetAtomVect().size();a++){ | |
147 | 147 | for(int i=0; i<CartesianType_end; i++){ |
148 | 148 | temp += pow(oldMatrixForce[a][i],2.0); |
149 | 149 | beta += ((*matrixForce)[a][i] - oldMatrixForce[a][i])*(*matrixForce)[a][i]; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | beta /= temp; |
153 | - for(int a=0;a<molecule.GetNumberAtoms();a++){ | |
153 | + for(int a=0;a<molecule.GetAtomVect().size();a++){ | |
154 | 154 | for(int i=0; i<CartesianType_end; i++){ |
155 | 155 | matrixSearchDirection[a][i] *= beta; |
156 | 156 | matrixSearchDirection[a][i] += (*matrixForce)[a][i]; |
@@ -89,7 +89,7 @@ void GEDIIS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStru | ||
89 | 89 | double lineSearchInitialEnergy = 0.0; |
90 | 90 | double const* const* matrixForce = NULL; |
91 | 91 | double const* vectorForce = NULL; |
92 | - const int dimension = molecule.GetNumberAtoms()*CartesianType_end; | |
92 | + const int dimension = molecule.GetAtomVect().size()*CartesianType_end; | |
93 | 93 | double** matrixHessian = NULL; |
94 | 94 | double* vectorOldForce = NULL; |
95 | 95 | double* vectorStep = NULL; |
@@ -137,8 +137,8 @@ void GEDIIS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStru | ||
137 | 137 | lineSearchInitialEnergy = lineSearchCurrentEnergy; |
138 | 138 | double preRFOEnergy = lineSearchInitialEnergy; |
139 | 139 | |
140 | - MallocerFreer::GetInstance()->Malloc(&matrixGEDIISCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
141 | - MallocerFreer::GetInstance()->Malloc(&matrixGEDIISForce, molecule.GetNumberAtoms(), CartesianType_end); | |
140 | + MallocerFreer::GetInstance()->Malloc(&matrixGEDIISCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
141 | + MallocerFreer::GetInstance()->Malloc(&matrixGEDIISForce, molecule.GetAtomVect().size(), CartesianType_end); | |
142 | 142 | try{ |
143 | 143 | history.SolveGEDIISEquation(&preRFOEnergy, matrixGEDIISCoordinates, matrixGEDIISForce); |
144 | 144 |
@@ -176,7 +176,7 @@ void GEDIIS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStru | ||
176 | 176 | this->ShiftHessianRedundantMode(matrixHessian, molecule); |
177 | 177 | |
178 | 178 | //Calculate RFO step |
179 | - MallocerFreer::GetInstance()->Malloc(&matrixStep, molecule.GetNumberAtoms(), CartesianType_end); | |
179 | + MallocerFreer::GetInstance()->Malloc(&matrixStep, molecule.GetAtomVect().size(), CartesianType_end); | |
180 | 180 | vectorStep = &matrixStep[0][0]; |
181 | 181 | this->CalcRFOStep(vectorStep, matrixHessian, vectorForce, trustRadius, dimension); |
182 | 182 |
@@ -237,20 +237,20 @@ void GEDIIS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStru | ||
237 | 237 | catch(MolDSException ex){ |
238 | 238 | MallocerFreer::GetInstance()->Free(&matrixHessian, dimension, dimension); |
239 | 239 | MallocerFreer::GetInstance()->Free(&vectorOldForce, dimension); |
240 | - MallocerFreer::GetInstance()->Free(&matrixStep , molecule.GetNumberAtoms(), CartesianType_end); | |
241 | - MallocerFreer::GetInstance()->Free(&matrixDisplacement , molecule.GetNumberAtoms(), CartesianType_end); | |
242 | - MallocerFreer::GetInstance()->Free(&matrixOldCoordinates , molecule.GetNumberAtoms(), CartesianType_end); | |
243 | - MallocerFreer::GetInstance()->Free(&matrixGEDIISCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
244 | - MallocerFreer::GetInstance()->Free(&matrixGEDIISForce , molecule.GetNumberAtoms(), CartesianType_end); | |
240 | + MallocerFreer::GetInstance()->Free(&matrixStep , molecule.GetAtomVect().size(), CartesianType_end); | |
241 | + MallocerFreer::GetInstance()->Free(&matrixDisplacement , molecule.GetAtomVect().size(), CartesianType_end); | |
242 | + MallocerFreer::GetInstance()->Free(&matrixOldCoordinates , molecule.GetAtomVect().size(), CartesianType_end); | |
243 | + MallocerFreer::GetInstance()->Free(&matrixGEDIISCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
244 | + MallocerFreer::GetInstance()->Free(&matrixGEDIISForce , molecule.GetAtomVect().size(), CartesianType_end); | |
245 | 245 | throw ex; |
246 | 246 | } |
247 | 247 | MallocerFreer::GetInstance()->Free(&matrixHessian, dimension, dimension); |
248 | 248 | MallocerFreer::GetInstance()->Free(&vectorOldForce, dimension); |
249 | - MallocerFreer::GetInstance()->Free(&matrixStep , molecule.GetNumberAtoms(), CartesianType_end); | |
250 | - MallocerFreer::GetInstance()->Free(&matrixDisplacement , molecule.GetNumberAtoms(), CartesianType_end); | |
251 | - MallocerFreer::GetInstance()->Free(&matrixOldCoordinates , molecule.GetNumberAtoms(), CartesianType_end); | |
252 | - MallocerFreer::GetInstance()->Free(&matrixGEDIISCoordinates, molecule.GetNumberAtoms(), CartesianType_end); | |
253 | - MallocerFreer::GetInstance()->Free(&matrixGEDIISForce , molecule.GetNumberAtoms(), CartesianType_end); | |
249 | + MallocerFreer::GetInstance()->Free(&matrixStep , molecule.GetAtomVect().size(), CartesianType_end); | |
250 | + MallocerFreer::GetInstance()->Free(&matrixDisplacement , molecule.GetAtomVect().size(), CartesianType_end); | |
251 | + MallocerFreer::GetInstance()->Free(&matrixOldCoordinates , molecule.GetAtomVect().size(), CartesianType_end); | |
252 | + MallocerFreer::GetInstance()->Free(&matrixGEDIISCoordinates, molecule.GetAtomVect().size(), CartesianType_end); | |
253 | + MallocerFreer::GetInstance()->Free(&matrixGEDIISForce , molecule.GetAtomVect().size(), CartesianType_end); | |
254 | 254 | } |
255 | 255 | |
256 | 256 | GEDIIS::GEDIISHistory::GEDIISHistory():maxEntryCount(5){ |
@@ -287,12 +287,12 @@ void GEDIIS::GEDIISHistory::DiscardEntries(){ | ||
287 | 287 | GEDIIS::GEDIISHistory::Entry::Entry(double energy, |
288 | 288 | const MolDS_base::Molecule& molecule, |
289 | 289 | double const* const* matrixForce): |
290 | - energy(energy),numAtoms(molecule.GetNumberAtoms()),matrixCoordinate(NULL),matrixForce(NULL) { | |
290 | + energy(energy),numAtoms(molecule.GetAtomVect().size()),matrixCoordinate(NULL),matrixForce(NULL) { | |
291 | 291 | MallocerFreer::GetInstance()->Malloc(&this->matrixCoordinate, this->numAtoms, CartesianType_end); |
292 | 292 | MallocerFreer::GetInstance()->Malloc(&this->matrixForce, this->numAtoms, CartesianType_end); |
293 | 293 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
294 | 294 | for(int i = 0; i < this->numAtoms; i++){ |
295 | - const Atom* atom = molecule.GetAtom(i); | |
295 | + const Atom* atom = molecule.GetAtomVect()[i]; | |
296 | 296 | const double* xyz = atom->GetXyz(); |
297 | 297 | for(int j = 0; j < CartesianType_end; j++){ |
298 | 298 | this->matrixCoordinate[i][j] = xyz[j]; |
@@ -131,16 +131,16 @@ void Optimizer::CheckEnableTheoryType(TheoryType theoryType) const{ | ||
131 | 131 | |
132 | 132 | void Optimizer::ClearMolecularMomenta(Molecule& molecule) const{ |
133 | 133 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
134 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
135 | - const Atom* atom = molecule.GetAtom(a); | |
134 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
135 | + const Atom* atom = molecule.GetAtomVect()[a]; | |
136 | 136 | atom->SetPxyz(0.0, 0.0, 0.0); |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* const* matrixForce, double dt) const{ |
141 | 141 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
142 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
143 | - const Atom* atom = molecule.GetAtom(a); | |
142 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
143 | + const Atom* atom = molecule.GetAtomVect()[a]; | |
144 | 144 | double coreMass = atom->GetCoreMass(); |
145 | 145 | for(int i=0; i<CartesianType_end; i++){ |
146 | 146 | atom->GetXyz()[i] += dt*matrixForce[a][i]/coreMass; |
@@ -151,8 +151,8 @@ void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* con | ||
151 | 151 | |
152 | 152 | void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* const* matrixForce) const{ |
153 | 153 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
154 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
155 | - const Atom* atom = molecule.GetAtom(a); | |
154 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
155 | + const Atom* atom = molecule.GetAtomVect()[a]; | |
156 | 156 | for(int i=0; i<CartesianType_end; i++){ |
157 | 157 | atom->GetXyz()[i] += matrixForce[a][i]; |
158 | 158 | } |
@@ -233,7 +233,7 @@ bool Optimizer::SatisfiesConvergenceCriterion(double const* const* matrixForce, | ||
233 | 233 | double maxGradient = 0.0; |
234 | 234 | double sumSqureGradient = 0.0; |
235 | 235 | double energyDifference = currentEnergy - oldEnergy; |
236 | - for(int a=0; a<molecule.GetNumberAtoms(); a++){ | |
236 | + for(int a=0; a<molecule.GetAtomVect().size(); a++){ | |
237 | 237 | for(int i=0; i<CartesianType_end; i++){ |
238 | 238 | if(maxGradient<fabs(matrixForce[a][i])){ |
239 | 239 | maxGradient = fabs(matrixForce[a][i]); |
@@ -241,7 +241,7 @@ bool Optimizer::SatisfiesConvergenceCriterion(double const* const* matrixForce, | ||
241 | 241 | sumSqureGradient += pow(matrixForce[a][i],2.0); |
242 | 242 | } |
243 | 243 | } |
244 | - sumSqureGradient /= static_cast<double>(molecule.GetNumberAtoms()*CartesianType_end); | |
244 | + sumSqureGradient /= static_cast<double>(molecule.GetAtomVect().size()*CartesianType_end); | |
245 | 245 | double rmsGradient = sqrt(sumSqureGradient); |
246 | 246 | |
247 | 247 | // output logs |
@@ -143,8 +143,8 @@ double Pm3Pddg::GetDiatomCoreRepulsionEnergy(int indexAtomA, int indexAtomB) con | ||
143 | 143 | double pm3Term = Pm3::GetDiatomCoreRepulsionEnergy(indexAtomA, indexAtomB); |
144 | 144 | |
145 | 145 | // pddg additional term, eq. (4) in [RCJ_2002] |
146 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
147 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
146 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
147 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
148 | 148 | int na = atomA.GetNumberValenceElectrons(); |
149 | 149 | int nb = atomB.GetNumberValenceElectrons(); |
150 | 150 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
@@ -172,8 +172,8 @@ double Pm3Pddg::GetDiatomCoreRepulsion1stDerivative(int indexAtomA, | ||
172 | 172 | double pm3Term = Pm3::GetDiatomCoreRepulsion1stDerivative(indexAtomA, indexAtomB, axisA); |
173 | 173 | |
174 | 174 | // pddg additional term, first derivative of eq. (4) in [RCJ_2002] |
175 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
176 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
175 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
176 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
177 | 177 | int na = atomA.GetNumberValenceElectrons(); |
178 | 178 | int nb = atomB.GetNumberValenceElectrons(); |
179 | 179 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
@@ -203,8 +203,8 @@ double Pm3Pddg::GetDiatomCoreRepulsion2ndDerivative(int indexAtomA, | ||
203 | 203 | double pm3Term = Pm3::GetDiatomCoreRepulsion2ndDerivative(indexAtomA, indexAtomB, axisA1, axisA2); |
204 | 204 | |
205 | 205 | // pddg additional term, first derivative of eq. (4) in [RCJ_2002] |
206 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
207 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
206 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
207 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
208 | 208 | double distance = this->molecule->GetDistanceAtoms(indexAtomA, indexAtomB); |
209 | 209 | double dCartesian1 = (atomA.GetXyz()[axisA1] - atomB.GetXyz()[axisA1]); |
210 | 210 | double dCartesian2 = (atomA.GetXyz()[axisA2] - atomB.GetXyz()[axisA2]); |
@@ -94,16 +94,16 @@ void RPMD::UpdateMomenta(const vector<boost::shared_ptr<Molecule> >& molecularBe | ||
94 | 94 | double temperature){ |
95 | 95 | double kB = Parameters::GetInstance()->GetBoltzmann(); |
96 | 96 | int numBeads = molecularBeads.size(); |
97 | - int numAtom = molecularBeads[0]->GetNumberAtoms(); | |
97 | + int numAtom = molecularBeads[0]->GetAtomVect().size(); | |
98 | 98 | for(int b=0; b<numBeads; b++){ |
99 | 99 | int preB = b==0 ? numBeads-1 : b-1; |
100 | 100 | int postB = b==numBeads-1 ? 0 : b+1; |
101 | 101 | double const* const* electronicForceMatrix |
102 | 102 | = electronicStructureBeads[b]->GetForce(elecState);; |
103 | 103 | for(int a=0; a<numAtom; a++){ |
104 | - Atom* atom = molecularBeads[b]->GetAtom(a); | |
105 | - Atom* preAtom = molecularBeads[preB]->GetAtom(a); | |
106 | - Atom* postAtom = molecularBeads[postB]->GetAtom(a); | |
104 | + Atom* atom = molecularBeads[b]->GetAtomVect()[a]; | |
105 | + Atom* preAtom = molecularBeads[preB]->GetAtomVect()[a]; | |
106 | + Atom* postAtom = molecularBeads[postB]->GetAtomVect()[a]; | |
107 | 107 | double coreMass = atom->GetCoreMass(); |
108 | 108 | for(int i=0; i<CartesianType_end; i++){ |
109 | 109 | double beadsForce = -1.0*coreMass*pow(kB*temperature*static_cast<double>(numBeads),2.0) |
@@ -118,10 +118,10 @@ void RPMD::UpdateMomenta(const vector<boost::shared_ptr<Molecule> >& molecularBe | ||
118 | 118 | void RPMD::UpdateCoordinates(const vector<boost::shared_ptr<Molecule> >& molecularBeads, |
119 | 119 | double dt){ |
120 | 120 | int numBeads = molecularBeads.size(); |
121 | - int numAtom = molecularBeads[0]->GetNumberAtoms(); | |
121 | + int numAtom = molecularBeads[0]->GetAtomVect().size(); | |
122 | 122 | for(int b=0; b<numBeads; b++){ |
123 | 123 | for(int a=0; a<numAtom; a++){ |
124 | - Atom* atom = molecularBeads[b]->GetAtom(a); | |
124 | + Atom* atom = molecularBeads[b]->GetAtomVect()[a]; | |
125 | 125 | double coreMass = atom->GetCoreMass(); |
126 | 126 | for(int i=0; i<CartesianType_end; i++){ |
127 | 127 | atom->GetXyz()[i] += dt*atom->GetPxyz()[i]/coreMass; |
@@ -150,7 +150,7 @@ void RPMD::FluctuateBeads(const vector<boost::shared_ptr<Molecule> >& molecularB | ||
150 | 150 | molecule->SetCanOutputLogs(false); |
151 | 151 | mc->SetMolecule(molecule); |
152 | 152 | mc->SetCanOutputLogs(false); |
153 | - mc->DoMC(molecule->GetNumberAtoms(), elecState, temperature, stepWidth, seed+b); | |
153 | + mc->DoMC(molecule->GetAtomVect().size(), elecState, temperature, stepWidth, seed+b); | |
154 | 154 | } |
155 | 155 | } |
156 | 156 |
@@ -168,7 +168,7 @@ void RPMD::DoRPMD(const Molecule& refferenceMolecule){ | ||
168 | 168 | double dt = Parameters::GetInstance()->GetTimeWidthRPMD(); |
169 | 169 | double kB = Parameters::GetInstance()->GetBoltzmann(); |
170 | 170 | int numBeads = Parameters::GetInstance()->GetNumberBeadsRPMD(); |
171 | - int numAtom = refferenceMolecule.GetNumberAtoms(); | |
171 | + int numAtom = refferenceMolecule.GetAtomVect().size(); | |
172 | 172 | |
173 | 173 | // create Beads |
174 | 174 | vector<boost::shared_ptr<Molecule> > molecularBeads; |
@@ -249,12 +249,12 @@ double RPMD::OutputEnergies(const vector<boost::shared_ptr<Molecule> >& molecula | ||
249 | 249 | int elecState, |
250 | 250 | double temperature){ |
251 | 251 | int numBeads = molecularBeads.size(); |
252 | - int numAtom = molecularBeads[0]->GetNumberAtoms(); | |
252 | + int numAtom = molecularBeads[0]->GetAtomVect().size(); | |
253 | 253 | double beadsKineticEnergy = 0.0;; |
254 | 254 | for(int b=0; b<numBeads; b++){ |
255 | 255 | double coreKineticEnergy = 0.0; |
256 | 256 | for(int a=0; a<numAtom; a++){ |
257 | - Atom* atom = molecularBeads[b]->GetAtom(a); | |
257 | + Atom* atom = molecularBeads[b]->GetAtomVect()[a]; | |
258 | 258 | double coreMass = atom->GetCoreMass(); |
259 | 259 | for(int i=0; i<CartesianType_end; i++){ |
260 | 260 | coreKineticEnergy += 0.5*pow(atom->GetPxyz()[i],2.0)/coreMass; |
@@ -269,8 +269,8 @@ double RPMD::OutputEnergies(const vector<boost::shared_ptr<Molecule> >& molecula | ||
269 | 269 | double harmonicEnergy = 0.0; |
270 | 270 | int preB = b==0 ? numBeads-1 : b-1; |
271 | 271 | for(int a=0; a<numAtom; a++){ |
272 | - Atom* atom = molecularBeads[b]->GetAtom(a); | |
273 | - Atom* preAtom = molecularBeads[preB]->GetAtom(a); | |
272 | + Atom* atom = molecularBeads[b]->GetAtomVect()[a]; | |
273 | + Atom* preAtom = molecularBeads[preB]->GetAtomVect()[a]; | |
274 | 274 | double coreMass = atom->GetCoreMass(); |
275 | 275 | double dx = atom->GetXyz()[XAxis] - preAtom->GetXyz()[XAxis]; |
276 | 276 | double dy = atom->GetXyz()[YAxis] - preAtom->GetXyz()[YAxis]; |
@@ -91,9 +91,9 @@ ZindoS::ZindoS() : MolDS_cndo::Cndo2(){ | ||
91 | 91 | ZindoS::~ZindoS(){ |
92 | 92 | if(this->theory==ZINDOS){ |
93 | 93 | MallocerFreer::GetInstance()->Free<double>(&this->nishimotoMatagaMatrix, |
94 | - this->molecule->GetNumberAtoms(), | |
94 | + this->molecule->GetAtomVect().size(), | |
95 | 95 | OrbitalType_end, |
96 | - this->molecule->GetNumberAtoms(), | |
96 | + this->molecule->GetAtomVect().size(), | |
97 | 97 | OrbitalType_end); |
98 | 98 | } |
99 | 99 | MallocerFreer::GetInstance()->Free<double>(&this->matrixCIS, |
@@ -105,7 +105,7 @@ ZindoS::~ZindoS(){ | ||
105 | 105 | this->matrixCISdimension); |
106 | 106 | MallocerFreer::GetInstance()->Free<double>(&this->matrixForce, |
107 | 107 | this->matrixForceElecStatesNum, |
108 | - this->molecule->GetNumberAtoms(), | |
108 | + this->molecule->GetAtomVect().size(), | |
109 | 109 | CartesianType_end); |
110 | 110 | MallocerFreer::GetInstance()->Free<double>(&this->zMatrixForce, |
111 | 111 | this->zMatrixForceElecStatesNum, |
@@ -123,11 +123,11 @@ ZindoS::~ZindoS(){ | ||
123 | 123 | this->molecule->GetTotalNumberAOs()); |
124 | 124 | MallocerFreer::GetInstance()->Free<double>(&this->atomicElectronPopulationCIS, |
125 | 125 | elecStates->size(), |
126 | - this->molecule->GetNumberAtoms()); | |
126 | + this->molecule->GetAtomVect().size()); | |
127 | 127 | if(Parameters::GetInstance()->RequiresUnpairedPopCIS()){ |
128 | 128 | MallocerFreer::GetInstance()->Free<double>(&this->atomicUnpairedPopulationCIS, |
129 | 129 | elecStates->size(), |
130 | - this->molecule->GetNumberAtoms()); | |
130 | + this->molecule->GetAtomVect().size()); | |
131 | 131 | } |
132 | 132 | } |
133 | 133 | //this->OutputLog("ZindoS deleted\n"); |
@@ -137,9 +137,9 @@ void ZindoS::SetMolecule(Molecule* molecule){ | ||
137 | 137 | Cndo2::SetMolecule(molecule); |
138 | 138 | if(this->theory==ZINDOS){ |
139 | 139 | MallocerFreer::GetInstance()->Malloc<double>(&this->nishimotoMatagaMatrix, |
140 | - this->molecule->GetNumberAtoms(), | |
140 | + this->molecule->GetAtomVect().size(), | |
141 | 141 | OrbitalType_end, |
142 | - this->molecule->GetNumberAtoms(), | |
142 | + this->molecule->GetAtomVect().size(), | |
143 | 143 | OrbitalType_end); |
144 | 144 | } |
145 | 145 | } |
@@ -255,10 +255,10 @@ double ZindoS::GetFockDiagElement(const Atom& atomA, | ||
255 | 255 | value += temp; |
256 | 256 | |
257 | 257 | temp = 0.0; |
258 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
258 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
259 | 259 | for(int B=0; B<totalNumberAtoms; B++){ |
260 | 260 | if(B != indexAtomA){ |
261 | - const Atom& atomB = *molecule.GetAtom(B); | |
261 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
262 | 262 | OrbitalType orbitalSigma; |
263 | 263 | int sigma; |
264 | 264 | int atomBNumberValence = atomB.GetValenceSize(); |
@@ -732,18 +732,18 @@ double ZindoS::GetNishimotoMatagaTwoEleInt1stDerivative(const Atom& atomA, | ||
732 | 732 | } |
733 | 733 | |
734 | 734 | void ZindoS::CalcNishimotoMatagaMatrix(double**** nishimotoMatagaMatrix, const Molecule& molecule) const{ |
735 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
735 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
736 | 736 | stringstream ompErrors; |
737 | 737 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
738 | 738 | for(int A=0; A<totalNumberAtoms; A++){ |
739 | 739 | try{ |
740 | - const Atom& atomA = *molecule.GetAtom(A); | |
740 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
741 | 741 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
742 | 742 | int lastAOIndexA = atomA.GetLastAOIndex(); |
743 | 743 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
744 | 744 | OrbitalType orbitalMu = atomA.GetValence(mu-firstAOIndexA); |
745 | 745 | for(int B=A; B<totalNumberAtoms; B++){ |
746 | - const Atom& atomB = *molecule.GetAtom(B); | |
746 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
747 | 747 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
748 | 748 | int lastAOIndexB = atomB.GetLastAOIndex(); |
749 | 749 | double rAB = molecule.GetDistanceAtoms(atomA, atomB); |
@@ -956,8 +956,8 @@ double ZindoS::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
956 | 956 | double gamma; |
957 | 957 | double exchange; |
958 | 958 | double coulomb; |
959 | - for(int A=0; A<molecule.GetNumberAtoms(); A++){ | |
960 | - const Atom& atomA = *molecule.GetAtom(A); | |
959 | + for(int A=0; A<molecule.GetAtomVect().size(); A++){ | |
960 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
961 | 961 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
962 | 962 | int lastAOIndexA = atomA.GetLastAOIndex(); |
963 | 963 |
@@ -965,8 +965,8 @@ double ZindoS::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
965 | 965 | OrbitalType orbitalMu = atomA.GetValence(mu-firstAOIndexA); |
966 | 966 | |
967 | 967 | // CNDO term |
968 | - for(int B=A; B<molecule.GetNumberAtoms(); B++){ | |
969 | - const Atom& atomB = *molecule.GetAtom(B); | |
968 | + for(int B=A; B<molecule.GetAtomVect().size(); B++){ | |
969 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
970 | 970 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
971 | 971 | int lastAOIndexB = atomB.GetLastAOIndex(); |
972 | 972 |
@@ -1700,7 +1700,7 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC | ||
1700 | 1700 | if(!Parameters::GetInstance()->RequiresMullikenCIS()){ |
1701 | 1701 | return; |
1702 | 1702 | } |
1703 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
1703 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
1704 | 1704 | vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); |
1705 | 1705 | // malloc or initialize free exciton energies |
1706 | 1706 | if(*atomicElectronPopulationCIS == NULL){ |
@@ -1719,8 +1719,8 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC | ||
1719 | 1719 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1720 | 1720 | for(int a=0; a<totalNumberAtoms; a++){ |
1721 | 1721 | try{ |
1722 | - int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex(); | |
1723 | - int numberAOs = molecule.GetAtom(a)->GetValenceSize(); | |
1722 | + int firstAOIndex = molecule.GetAtomVect()[a]->GetFirstAOIndex(); | |
1723 | + int numberAOs = molecule.GetAtomVect()[a]->GetValenceSize(); | |
1724 | 1724 | for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){ |
1725 | 1725 | (*atomicElectronPopulationCIS)[k][a] += orbitalElectronPopulationCIS[k][i][i]; |
1726 | 1726 | } |
@@ -1746,7 +1746,7 @@ void ZindoS::CalcAtomicUnpairedPopulationCIS(double*** atomicUnpairedPopulationC | ||
1746 | 1746 | if(!Parameters::GetInstance()->RequiresUnpairedPopCIS()){ |
1747 | 1747 | return; |
1748 | 1748 | } |
1749 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
1749 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
1750 | 1750 | vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); |
1751 | 1751 | // malloc or initialize free exciton energies |
1752 | 1752 | if(*atomicUnpairedPopulationCIS == NULL){ |
@@ -1765,8 +1765,8 @@ void ZindoS::CalcAtomicUnpairedPopulationCIS(double*** atomicUnpairedPopulationC | ||
1765 | 1765 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
1766 | 1766 | for(int a=0; a<totalNumberAtoms; a++){ |
1767 | 1767 | try{ |
1768 | - int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex(); | |
1769 | - int numberAOs = molecule.GetAtom(a)->GetValenceSize(); | |
1768 | + int firstAOIndex = molecule.GetAtomVect()[a]->GetFirstAOIndex(); | |
1769 | + int numberAOs = molecule.GetAtomVect()[a]->GetValenceSize(); | |
1770 | 1770 | (*atomicUnpairedPopulationCIS)[k][a] = 0.0; |
1771 | 1771 | for(int i=firstAOIndex; i<firstAOIndex+numberAOs; i++){ |
1772 | 1772 | double orbitalSquarePopulation = 0.0; |
@@ -1957,12 +1957,12 @@ void ZindoS::OutputCISMulliken() const{ | ||
1957 | 1957 | if(!Parameters::GetInstance()->RequiresMullikenCIS()){ |
1958 | 1958 | return; |
1959 | 1959 | } |
1960 | - int totalNumberAtoms = this->molecule->GetNumberAtoms(); | |
1960 | + int totalNumberAtoms = this->molecule->GetAtomVect().size(); | |
1961 | 1961 | this->OutputLog(this->messageMullikenAtomsTitle); |
1962 | 1962 | vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); |
1963 | 1963 | for(int k=0; k<elecStates->size(); k++){ |
1964 | 1964 | for(int a=0; a<totalNumberAtoms; a++){ |
1965 | - const Atom& atom = *this->molecule->GetAtom(a); | |
1965 | + const Atom& atom = *this->molecule->GetAtomVect()[a]; | |
1966 | 1966 | this->OutputLog(boost::format("%s\t%d\t%d\t%s\t%e\t%e\n") % this->messageMullikenAtoms |
1967 | 1967 | % (*elecStates)[k] |
1968 | 1968 | % a |
@@ -1981,12 +1981,12 @@ void ZindoS::OutputCISUnpairedPop() const{ | ||
1981 | 1981 | if(!Parameters::GetInstance()->RequiresUnpairedPopCIS()){ |
1982 | 1982 | return; |
1983 | 1983 | } |
1984 | - int totalNumberAtoms = this->molecule->GetNumberAtoms(); | |
1984 | + int totalNumberAtoms = this->molecule->GetAtomVect().size(); | |
1985 | 1985 | this->OutputLog(this->messageUnpairedAtomsTitle); |
1986 | 1986 | vector<int>* elecStates = Parameters::GetInstance()->GetElectronicStateIndecesMullikenCIS(); |
1987 | 1987 | for(int k=0; k<elecStates->size(); k++){ |
1988 | 1988 | for(int a=0; a<totalNumberAtoms; a++){ |
1989 | - const Atom& atom = *this->molecule->GetAtom(a); | |
1989 | + const Atom& atom = *this->molecule->GetAtomVect()[a]; | |
1990 | 1990 | this->OutputLog(boost::format("%s\t%d\t%d\t%s\t%e\n") % this->messageUnpairedAtoms |
1991 | 1991 | % (*elecStates)[k] |
1992 | 1992 | % a |
@@ -2447,9 +2447,9 @@ double ZindoS::GetCISDiagElement(double const* energiesMO, | ||
2447 | 2447 | double gamma = 0.0; |
2448 | 2448 | double exchange = 0.0; |
2449 | 2449 | double coulomb = 0.0; |
2450 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
2450 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
2451 | 2451 | for(int A=0; A<totalNumberAtoms; A++){ |
2452 | - const Atom& atomA = *molecule.GetAtom(A); | |
2452 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
2453 | 2453 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2454 | 2454 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2455 | 2455 |
@@ -2461,7 +2461,7 @@ double ZindoS::GetCISDiagElement(double const* energiesMO, | ||
2461 | 2461 | |
2462 | 2462 | // CNDO term |
2463 | 2463 | for(int B=A; B<totalNumberAtoms; B++){ |
2464 | - const Atom& atomB = *molecule.GetAtom(B); | |
2464 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
2465 | 2465 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2466 | 2466 | int lastAOIndexB = atomB.GetLastAOIndex(); |
2467 | 2467 |
@@ -2540,9 +2540,9 @@ double ZindoS::GetCISOffDiagElement(double const* const* const* const* nishimoto | ||
2540 | 2540 | double gamma = 0.0; |
2541 | 2541 | double exchange = 0.0; |
2542 | 2542 | double coulomb = 0.0; |
2543 | - int totalNumberAtoms = molecule.GetNumberAtoms(); | |
2543 | + int totalNumberAtoms = molecule.GetAtomVect().size(); | |
2544 | 2544 | for(int A=0; A<totalNumberAtoms; A++){ |
2545 | - const Atom& atomA = *molecule.GetAtom(A); | |
2545 | + const Atom& atomA = *molecule.GetAtomVect()[A]; | |
2546 | 2546 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
2547 | 2547 | int lastAOIndexA = atomA.GetLastAOIndex(); |
2548 | 2548 |
@@ -2555,7 +2555,7 @@ double ZindoS::GetCISOffDiagElement(double const* const* const* const* nishimoto | ||
2555 | 2555 | |
2556 | 2556 | // CNDO term |
2557 | 2557 | for(int B=A; B<totalNumberAtoms; B++){ |
2558 | - const Atom& atomB = *molecule.GetAtom(B); | |
2558 | + const Atom& atomB = *molecule.GetAtomVect()[B]; | |
2559 | 2559 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
2560 | 2560 | int lastAOIndexB = atomB.GetLastAOIndex(); |
2561 | 2561 | for(int nu=firstAOIndexB; nu<=lastAOIndexB; nu++){ |
@@ -2636,7 +2636,7 @@ void ZindoS::CheckMatrixForce(const vector<int>& elecStates){ | ||
2636 | 2636 | if(this->matrixForce == NULL){ |
2637 | 2637 | MallocerFreer::GetInstance()->Malloc<double>(&this->matrixForce, |
2638 | 2638 | elecStates.size(), |
2639 | - this->molecule->GetNumberAtoms(), | |
2639 | + this->molecule->GetAtomVect().size(), | |
2640 | 2640 | CartesianType_end); |
2641 | 2641 | this->matrixForceElecStatesNum = elecStates.size(); |
2642 | 2642 | } |
@@ -2644,7 +2644,7 @@ void ZindoS::CheckMatrixForce(const vector<int>& elecStates){ | ||
2644 | 2644 | MallocerFreer::GetInstance()-> |
2645 | 2645 | Initialize<double>(this->matrixForce, |
2646 | 2646 | elecStates.size(), |
2647 | - this->molecule->GetNumberAtoms(), | |
2647 | + this->molecule->GetAtomVect().size(), | |
2648 | 2648 | CartesianType_end); |
2649 | 2649 | } |
2650 | 2650 | } |
@@ -3121,13 +3121,13 @@ double ZindoS::GetSmallQElement(int moI, | ||
3121 | 3121 | int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2; |
3122 | 3122 | bool isMoPOcc = moP<numberOcc ? true : false; |
3123 | 3123 | |
3124 | - for(int A=0; A<molecule->GetNumberAtoms(); A++){ | |
3125 | - const Atom& atomA = *molecule->GetAtom(A); | |
3124 | + for(int A=0; A<molecule->GetAtomVect().size(); A++){ | |
3125 | + const Atom& atomA = *molecule->GetAtomVect()[A]; | |
3126 | 3126 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3127 | 3127 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3128 | 3128 | |
3129 | - for(int B=A; B<molecule->GetNumberAtoms(); B++){ | |
3130 | - const Atom& atomB = *molecule->GetAtom(B); | |
3129 | + for(int B=A; B<molecule->GetAtomVect().size(); B++){ | |
3130 | + const Atom& atomB = *molecule->GetAtomVect()[B]; | |
3131 | 3131 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3132 | 3132 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3133 | 3133 |
@@ -3518,8 +3518,8 @@ double ZindoS::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) cons | ||
3518 | 3518 | |
3519 | 3519 | // Fast algorith, but this is not easy to read. |
3520 | 3520 | // Slow algorithm is alos written below. |
3521 | - for(int A=0; A<this->molecule->GetNumberAtoms(); A++){ | |
3522 | - const Atom& atomA = *this->molecule->GetAtom(A); | |
3521 | + for(int A=0; A<this->molecule->GetAtomVect().size(); A++){ | |
3522 | + const Atom& atomA = *this->molecule->GetAtomVect()[A]; | |
3523 | 3523 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3524 | 3524 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3525 | 3525 |
@@ -3566,8 +3566,8 @@ double ZindoS::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) cons | ||
3566 | 3566 | } |
3567 | 3567 | |
3568 | 3568 | // (A==B || A!=B) && (mu==nu && lambda==sigma for (mu nu|lamba sigma)) |
3569 | - for(int B=A; B<this->molecule->GetNumberAtoms(); B++){ | |
3570 | - const Atom& atomB = *this->molecule->GetAtom(B); | |
3569 | + for(int B=A; B<this->molecule->GetAtomVect().size(); B++){ | |
3570 | + const Atom& atomB = *this->molecule->GetAtomVect()[B]; | |
3571 | 3571 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3572 | 3572 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3573 | 3573 |
@@ -3624,10 +3624,10 @@ double ZindoS::GetAuxiliaryKNRKRElement(int moI, int moJ, int moK, int moL) cons | ||
3624 | 3624 | void ZindoS::CalcDiatomicTwoElecsTwoCores1stDerivatives(double*** matrix, |
3625 | 3625 | int indexAtomA, |
3626 | 3626 | int indexAtomB) const{ |
3627 | - const Atom& atomA = *molecule->GetAtom(indexAtomA); | |
3627 | + const Atom& atomA = *molecule->GetAtomVect()[indexAtomA]; | |
3628 | 3628 | const int firstAOIndexA = atomA.GetFirstAOIndex(); |
3629 | 3629 | const int lastAOIndexA = atomA.GetLastAOIndex(); |
3630 | - const Atom& atomB = *molecule->GetAtom(indexAtomB); | |
3630 | + const Atom& atomB = *molecule->GetAtomVect()[indexAtomB]; | |
3631 | 3631 | const int firstAOIndexB = atomB.GetFirstAOIndex(); |
3632 | 3632 | const int lastAOIndexB = atomB.GetLastAOIndex(); |
3633 | 3633 | const double rAB = this->molecule->GetDistanceAtoms(atomA, atomB); |
@@ -3657,9 +3657,9 @@ void ZindoS::CalcForce(const vector<int>& elecStates){ | ||
3657 | 3657 | } |
3658 | 3658 | |
3659 | 3659 | // this loop is MPI-parallelized |
3660 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
3660 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
3661 | 3661 | if(a%mpiSize != mpiRank){continue;} |
3662 | - const Atom& atomA = *molecule->GetAtom(a); | |
3662 | + const Atom& atomA = *molecule->GetAtomVect()[a]; | |
3663 | 3663 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3664 | 3664 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3665 | 3665 | stringstream ompErrors; |
@@ -3689,9 +3689,9 @@ void ZindoS::CalcForce(const vector<int>& elecStates){ | ||
3689 | 3689 | &tmpMatrixBC, |
3690 | 3690 | &tmpVectorBC); |
3691 | 3691 | #pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
3692 | - for(int b=0; b<this->molecule->GetNumberAtoms(); b++){ | |
3692 | + for(int b=0; b<this->molecule->GetAtomVect().size(); b++){ | |
3693 | 3693 | if(a == b){continue;} |
3694 | - const Atom& atomB = *molecule->GetAtom(b); | |
3694 | + const Atom& atomB = *molecule->GetAtomVect()[b]; | |
3695 | 3695 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3696 | 3696 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3697 | 3697 | double rAB = this->molecule->GetDistanceAtoms(atomA, atomB); |
@@ -3839,7 +3839,7 @@ void ZindoS::CalcForce(const vector<int>& elecStates){ | ||
3839 | 3839 | } // end of for(int a) with MPI parallelization |
3840 | 3840 | |
3841 | 3841 | // communication to reduce thsi->matrixForce on all node (namely, all_reduce) |
3842 | - int numTransported = elecStates.size()*this->molecule->GetNumberAtoms()*CartesianType_end; | |
3842 | + int numTransported = elecStates.size()*this->molecule->GetAtomVect().size()*CartesianType_end; | |
3843 | 3843 | MolDS_mpi::MpiProcess::GetInstance()->AllReduce(&this->matrixForce[0][0][0], numTransported, std::plus<double>()); |
3844 | 3844 | |
3845 | 3845 | /* |
@@ -3848,9 +3848,9 @@ void ZindoS::CalcForce(const vector<int>& elecStates){ | ||
3848 | 3848 | // calculated with GTO expansion technique. |
3849 | 3849 | stringstream ompErrors; |
3850 | 3850 | #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) |
3851 | - for(int a=0; a<this->molecule->GetNumberAtoms(); a++){ | |
3851 | + for(int a=0; a<this->molecule->GetAtomVect().size(); a++){ | |
3852 | 3852 | try{ |
3853 | - const Atom& atomA = *molecule->GetAtom(a); | |
3853 | + const Atom& atomA = *molecule->GetAtomVect()[a]; | |
3854 | 3854 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3855 | 3855 | int lastAOIndexA = atomA.GetLastAOIndex(); |
3856 | 3856 | for(int i=0; i<CartesianType_end; i++){ |
@@ -3859,9 +3859,9 @@ void ZindoS::CalcForce(const vector<int>& elecStates){ | ||
3859 | 3859 | double forceElecCoreAttPart = 0.0; |
3860 | 3860 | double forceOverlapAOsPart = 0.0; |
3861 | 3861 | double forceTwoElecPart = 0.0; |
3862 | - for(int b=0; b<this->molecule->GetNumberAtoms(); b++){ | |
3862 | + for(int b=0; b<this->molecule->GetAtomVect().size(); b++){ | |
3863 | 3863 | if(a != b){ |
3864 | - const Atom& atomB = *molecule->GetAtom(b); | |
3864 | + const Atom& atomB = *molecule->GetAtomVect()[b]; | |
3865 | 3865 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3866 | 3866 | int lastAOIndexB = atomB.GetLastAOIndex(); |
3867 | 3867 |
@@ -3978,8 +3978,8 @@ void ZindoS::CalcForceExcitedStaticPart(double* force, | ||
3978 | 3978 | int indexAtomA, |
3979 | 3979 | int indexAtomB, |
3980 | 3980 | double const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
3981 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
3982 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
3981 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
3982 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
3983 | 3983 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
3984 | 3984 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
3985 | 3985 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -4005,8 +4005,8 @@ void ZindoS::CalcForceExcitedElecCoreAttractionPart(double* force, | ||
4005 | 4005 | int indexAtomA, |
4006 | 4006 | int indexAtomB, |
4007 | 4007 | double const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
4008 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
4009 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
4008 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
4009 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
4010 | 4010 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
4011 | 4011 | int lastAOIndexA = atomA.GetLastAOIndex(); |
4012 | 4012 | for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){ |
@@ -4023,8 +4023,8 @@ void ZindoS::CalcForceExcitedOverlapAOsPart(double* force, | ||
4023 | 4023 | int indexAtomA, |
4024 | 4024 | int indexAtomB, |
4025 | 4025 | double const* const* const* diatomicOverlapAOs1stDerivs) const{ |
4026 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
4027 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
4026 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
4027 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
4028 | 4028 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
4029 | 4029 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
4030 | 4030 | int lastAOIndexA = atomA.GetLastAOIndex(); |
@@ -4053,8 +4053,8 @@ void ZindoS::CalcForceExcitedTwoElecPart(double* force, | ||
4053 | 4053 | int indexAtomA, |
4054 | 4054 | int indexAtomB, |
4055 | 4055 | double const* const* const* diatomicTwoElecsTwoCores1stDerivs) const{ |
4056 | - const Atom& atomA = *this->molecule->GetAtom(indexAtomA); | |
4057 | - const Atom& atomB = *this->molecule->GetAtom(indexAtomB); | |
4056 | + const Atom& atomA = *this->molecule->GetAtomVect()[indexAtomA]; | |
4057 | + const Atom& atomB = *this->molecule->GetAtomVect()[indexAtomB]; | |
4058 | 4058 | int firstAOIndexA = atomA.GetFirstAOIndex(); |
4059 | 4059 | int firstAOIndexB = atomB.GetFirstAOIndex(); |
4060 | 4060 | int lastAOIndexA = atomA.GetLastAOIndex(); |