Define state2aa properly.
authorDariusz Murakowski <murakdar@mit.edu>
Tue, 23 Jun 2015 06:10:53 +0000 (02:10 -0400)
committerDariusz Murakowski <murakdar@mit.edu>
Tue, 23 Jun 2015 06:10:53 +0000 (02:10 -0400)
ham_ss.cpp

index df392f3..338d454 100644 (file)
@@ -205,9 +205,10 @@ void PottsHamiltonian::getSeq2State(const std::string &FILENAME)
     
     for (size_t i=0; i<Schar.size(); i++) {
         state2aa.push_back(std::vector<aa>(Schar[i].size()));
-        std::vector<aa> last = state2aa.back();
+        std::vector<aa> &last = state2aa.back();
         for (size_t j=0; j<Schar[i].size(); j++) {
-            last.push_back(str2aa.at(Schar[i][j]));
+            last[j] = str2aa.at(Schar[i][j]);
+            // could have used reserve() above and then push_back() here but eh
         }
         // move the first element to last place, because that is how states are ordered
         std::rotate(last.begin(),++last.begin(),last.end());    // could have used std::next() but eh