From: Max Date: Mon, 19 Sep 2022 16:43:54 +0000 (+0300) Subject: Fixes fixes fixes X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=d40b615e6cbdcdb620d11be7fcc80213c39bf806;p=alexxy%2Fgromacs-dssp.git Fixes fixes fixes --- diff --git a/src/dssptools.cpp b/src/dssptools.cpp index 5efefe8..2085189 100644 --- a/src/dssptools.cpp +++ b/src/dssptools.cpp @@ -146,19 +146,13 @@ bool secondaryStructures::hasHBondBetween(std::size_t Donor, std::size_t Accepto bool secondaryStructures::NoChainBreaksBetween(std::size_t Resi1, std::size_t Resi2) const{ bool flag{true}; - std::size_t i{}; - if ( Resi1 < Resi2){ - i = Resi1; - } - else if ( Resi1 > Resi2) { - i = Resi2; - } - else{ - return true; + std::size_t i{Resi1}, j[Resi2]; // From i to j + if ( Resi2 < Resi1){ + std::swap(i, j); } - for (; i != Resi2; ++i){ - flag = !(SecondaryStructuresStatusMap[i].isBreakPartnerWith(&SecondaryStructuresStatusMap[i + 1]) || SecondaryStructuresStatusMap[i + 1].isBreakPartnerWith(&SecondaryStructuresStatusMap[i])); + for (; i != j; ++i){ + flag = !(SecondaryStructuresStatusMap[i].isBreakPartnerWith(&SecondaryStructuresStatusMap[i + 1]) && SecondaryStructuresStatusMap[i + 1].isBreakPartnerWith(&SecondaryStructuresStatusMap[i])); } if (!flag){ @@ -260,7 +254,7 @@ void secondaryStructures::analyzeBridgesAndLaddersPatterns(){ void secondaryStructures::analyzeTurnsAndHelicesPatterns(){ for(const turnsTypes &i : { turnsTypes::Turn_4, turnsTypes::Turn_3, turnsTypes::Turn_5 }){ - std::cout << "Testing Helix_" << static_cast(i) << std::endl; + std::cout << "Testing Helix_" << static_cast(i) + 3 << std::endl; std::size_t stride {static_cast(i) + 3}; for(std::size_t j {0}; j + static_cast(i) < SecondaryStructuresStatusMap.size(); ++j){ std::cout << "Testing " << j << " and " << j + stride << std::endl;