From: Anatoly Date: Wed, 21 Oct 2020 16:16:56 +0000 (+0300) Subject: - output fixes X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=89307ad7fcf99211d67233632753cad804105d83;p=alexxy%2Fgromacs-colorvec.git - output fixes --- diff --git a/src/colorvec.cpp b/src/colorvec.cpp index 4d807ad..9128e67 100644 --- a/src/colorvec.cpp +++ b/src/colorvec.cpp @@ -280,9 +280,6 @@ inline void computeAnglesColorsVsBeta(const gmx::RVec &inputBetaRVec, colorLocal // функция записи в файл значений углов для кадра void anglesFileDump(const int frameNum, const std::string &output, const std::vector< bool > &toPeptide, const std::vector< colorLocalAngles > &colorFormation) { std::ofstream file(output, std::ofstream::app); - int temp = 0; - std::vector< double > betaTemp; - betaTemp.resize(0); file << "frame =" << std::setw(8) << frameNum << std::endl; for (size_t i = 0; i < colorFormation.size(); ++i) { file << "color #" << std::setw(3) << i; @@ -294,17 +291,18 @@ void anglesFileDump(const int frameNum, const std::string &output, const std::ve file << std::setw(8) << std::setprecision(3) << colorFormation[i].a12; file << std::setw(8) << std::setprecision(3) << colorFormation[i].b12; file << std::setw(8) << std::setprecision(3) << colorFormation[i].n12; - temp = colorFormation[i].betaAngles.size() / 6; - if (temp == 0) { + if (colorFormation[i].betaAngles.size() == 0) { file << std::setw(4) << 0; } else { + int temp = colorFormation[i].betaAngles.size() / 6; + std::vector< double > betaTemp; betaTemp.resize(0); betaTemp.resize(6, 0.); // magic number, meh for (size_t j = 0; j < colorFormation[i].betaAngles.size(); ++j) { betaTemp[j % 6] += colorFormation[i].betaAngles[j]; } for (size_t j = 0; j < betaTemp.size(); ++j) { - betaTemp[j] /= temp; + betaTemp[j] /= static_cast< double >(temp); } file << std::setw(4) << temp; for (size_t j = 0; j < betaTemp.size(); ++j) {