Проверяю исправление расчёта двугранных углов
authorMax <Infinity2573@gmail.com>
Mon, 10 Oct 2022 19:44:57 +0000 (22:44 +0300)
committerMax <Infinity2573@gmail.com>
Mon, 10 Oct 2022 19:44:57 +0000 (22:44 +0300)
src/dssptools.cpp
src/dssptools.h

index bf01cb248922b17953bc63df464e4f3be07a1662..9919b8dbabb9598ec69934ca892dedc3a306abe9 100644 (file)
@@ -83,7 +83,6 @@ void secondaryStructures::initiateSearch(const std::vector<ResInfo> &ResInfoMatr
     std::vector<std::size_t> temp; temp.resize(0),
     PiHelixPreference = PiHelicesPreferencez;
     ResInfoMap = &ResInfoMatrix;
-    pp_stretch = _pp_stretch;
     SecondaryStructuresStatusMap.resize(ResInfoMatrix.size());
     SecondaryStructuresStringLine.resize(ResInfoMatrix.size(), '~');
 }
@@ -262,12 +261,14 @@ void secondaryStructures::analyzeBridgesAndStrandsPatterns(){
                 SecondaryStructuresStatusMap[i].setStatus(secondaryStructureTypes::Bridge);
                 SecondaryStructuresStatusMap[j].setBridge(&(SecondaryStructuresStatusMap[i]), i, bridgeTypes::ParallelBridge);
                 SecondaryStructuresStatusMap[j].setStatus(secondaryStructureTypes::Bridge);
+                break;
             }
             case bridgeTypes::AntiParallelBridge : {
                 SecondaryStructuresStatusMap[i].setBridge(&(SecondaryStructuresStatusMap[j]), j, bridgeTypes::AntiParallelBridge);
                 SecondaryStructuresStatusMap[i].setStatus(secondaryStructureTypes::Bridge);
                 SecondaryStructuresStatusMap[j].setBridge(&(SecondaryStructuresStatusMap[i]), i, bridgeTypes::AntiParallelBridge);
                 SecondaryStructuresStatusMap[j].setStatus(secondaryStructureTypes::Bridge);
+                break;
             }
             default :
                 continue;
@@ -468,35 +469,35 @@ std::string secondaryStructures::patternSearch(){
 //        std::cout << (*ResInfoMap)[i].info->nr << " " << *((*ResInfoMap)[i].info->name) << std::endl;
 //    }
 
-    std::cout.precision(5);
-    for(std::size_t i{0}; i < ResInfoMap->size(); ++i, std::cout << std::endl << std::endl){
-        std::cout << (*ResInfoMap)[i].info->nr << " " << *((*ResInfoMap)[i].info->name) ;
-        if ( (*ResInfoMap)[i].donor[0] != nullptr ){
-            std::cout << " has donor[0] = " << (*ResInfoMap)[i].donor[0]->nr << " " << *((*ResInfoMap)[i].donor[0]->name) << " with E = " << (*ResInfoMap)[i].donorEnergy[0] << " and" ;
-        }
-        else {
-            std::cout << " has no donor[0] and" ;
-        }
-        if ( (*ResInfoMap)[i].acceptor[0] != nullptr ){
-            std::cout << " has acceptor[0] = " << (*ResInfoMap)[i].acceptor[0]->nr << " " << *((*ResInfoMap)[i].acceptor[0]->name) << " with E = " << (*ResInfoMap)[i].acceptorEnergy[0] ;
-        }
-        else {
-            std::cout << " has no acceptor[0]" ;
-        }
-        std::cout << std::endl << "Also, " << (*ResInfoMap)[i].info->nr << " " << *((*ResInfoMap)[i].info->name);
-        if ( (*ResInfoMap)[i].donor[1] != nullptr ){
-            std::cout << " has donor[1] = " << (*ResInfoMap)[i].donor[1]->nr << " " << *((*ResInfoMap)[i].donor[1]->name) << " with E = " << (*ResInfoMap)[i].donorEnergy[1] << " and" ;
-        }
-        else {
-            std::cout << " has no donor[1] and" ;
-        }
-        if ( (*ResInfoMap)[i].acceptor[1] != nullptr ){
-            std::cout << " has acceptor[1] = " << (*ResInfoMap)[i].acceptor[1]->nr << " " << *((*ResInfoMap)[i].acceptor[1]->name) << " with E = " << (*ResInfoMap)[i].acceptorEnergy[1] ;
-        }
-        else {
-            std::cout << " has no acceptor[1]" ;
-        }
-    }
+//    std::cout.precision(5);
+//    for(std::size_t i{0}; i < ResInfoMap->size(); ++i, std::cout << std::endl << std::endl){
+//        std::cout << (*ResInfoMap)[i].info->nr << " " << *((*ResInfoMap)[i].info->name) ;
+//        if ( (*ResInfoMap)[i].donor[0] != nullptr ){
+//            std::cout << " has donor[0] = " << (*ResInfoMap)[i].donor[0]->nr << " " << *((*ResInfoMap)[i].donor[0]->name) << " with E = " << (*ResInfoMap)[i].donorEnergy[0] << " and" ;
+//        }
+//        else {
+//            std::cout << " has no donor[0] and" ;
+//        }
+//        if ( (*ResInfoMap)[i].acceptor[0] != nullptr ){
+//            std::cout << " has acceptor[0] = " << (*ResInfoMap)[i].acceptor[0]->nr << " " << *((*ResInfoMap)[i].acceptor[0]->name) << " with E = " << (*ResInfoMap)[i].acceptorEnergy[0] ;
+//        }
+//        else {
+//            std::cout << " has no acceptor[0]" ;
+//        }
+//        std::cout << std::endl << "Also, " << (*ResInfoMap)[i].info->nr << " " << *((*ResInfoMap)[i].info->name);
+//        if ( (*ResInfoMap)[i].donor[1] != nullptr ){
+//            std::cout << " has donor[1] = " << (*ResInfoMap)[i].donor[1]->nr << " " << *((*ResInfoMap)[i].donor[1]->name) << " with E = " << (*ResInfoMap)[i].donorEnergy[1] << " and" ;
+//        }
+//        else {
+//            std::cout << " has no donor[1] and" ;
+//        }
+//        if ( (*ResInfoMap)[i].acceptor[1] != nullptr ){
+//            std::cout << " has acceptor[1] = " << (*ResInfoMap)[i].acceptor[1]->nr << " " << *((*ResInfoMap)[i].acceptor[1]->name) << " with E = " << (*ResInfoMap)[i].acceptorEnergy[1] ;
+//        }
+//        else {
+//            std::cout << " has no acceptor[1]" ;
+//        }
+//    }
 
     /*Write Data*/
 
@@ -740,7 +741,7 @@ float DsspTool::CalculateDihedralAngle(const int &A, const int &B, const int &C,
         v43[j] *= gmx::c_nm2A;
         z[j] *= gmx::c_nm2A;
     }
-    for(std::size_t i{XX}, j{j + 1}, k{i + 2}; i <= ZZ; ++i, ++j, ++k){
+    for(std::size_t i{XX}, j{i + 1}, k{i + 2}; i <= ZZ; ++i, ++j, ++k){
         if (j > 2){
             j -= 3;
         }
@@ -751,7 +752,7 @@ float DsspTool::CalculateDihedralAngle(const int &A, const int &B, const int &C,
         x[i] = (z[j] * v43[k]) - (z[k] * v43[j]);
 
     }
-    for(std::size_t i{XX}, j{j + 1}, k{i + 2}; i <= ZZ; ++i, ++j, ++k){
+    for(std::size_t i{XX}, j{i + 1}, k{i + 2}; i <= ZZ; ++i, ++j, ++k){
         if (j > 2){
             j -= 3;
         }
@@ -761,27 +762,27 @@ float DsspTool::CalculateDihedralAngle(const int &A, const int &B, const int &C,
         y[i] = (z[j] * x[k]) - (z[k] * x[j]);
     }
 
-//    std::cout << "v12 = " << v12[0] << ", " << v12[1] << ", " << v12[2] << std::endl;
-//    std::cout << "v43 = " << v43[0] << ", " << v43[1] << ", " << v43[2] << std::endl;
-//    std::cout << "z = " << z[0] << ", " << z[1] << ", " << z[2] << std::endl;
-//    std::cout << "p = " << p[0] << ", " << p[1] << ", " << p[2] << std::endl;
-//    std::cout << "x = " << x[0] << ", " << x[1] << ", " << x[2] << std::endl;
-//    std::cout << "y = " << y[0] << ", " << y[1] << ", " << y[2] << std::endl;
+    std::cout << "v12 = " << v12[0] << ", " << v12[1] << ", " << v12[2] << std::endl;
+    std::cout << "v43 = " << v43[0] << ", " << v43[1] << ", " << v43[2] << std::endl;
+    std::cout << "z = " << z[0] << ", " << z[1] << ", " << z[2] << std::endl;
+    std::cout << "p = " << p[0] << ", " << p[1] << ", " << p[2] << std::endl;
+    std::cout << "x = " << x[0] << ", " << x[1] << ", " << x[2] << std::endl;
+    std::cout << "y = " << y[0] << ", " << y[1] << ", " << y[2] << std::endl;
 
     u = (x[XX] * x[XX]) + (x[YY] * x[YY]) + (x[ZZ] * x[ZZ]);
     v = (y[XX] * y[XX]) + (y[YY] * y[YY]) + (y[ZZ] * y[ZZ]);
 
-//    std::cout << "u = " << u << std::endl;
-//    std::cout << "v = " << v << std::endl;
+    std::cout << "u = " << u << std::endl;
+    std::cout << "v = " << v << std::endl;
 
     if (u > 0 and v > 0){
         u = ((p[XX] * x[XX]) + (p[YY] * x[YY]) + (p[ZZ] * x[ZZ])) / std::sqrt(u);
         v = ((p[XX] * y[XX]) + (p[YY] * y[YY]) + (p[ZZ] * y[ZZ])) / std::sqrt(v);
-//        std::cout << "new u = " << u << std::endl;
-//        std::cout << "new v = " << v << std::endl;
+        std::cout << "new u = " << u << std::endl;
+        std::cout << "new v = " << v << std::endl;
         if (u != 0 or v != 0){
             result = std::atan2(v, u) * gmx::c_rad2Deg;
-//            std::cout << "result = " << result << std::endl;
+            std::cout << "result = " << result << std::endl;
         }
     }
     return result;
index f15b9eeb24c97c1dede8bffad7c8b917c262dc0d..b38bcd3bd0de5dc2cc9403cbea9bc4902f4ccc5f 100644 (file)
@@ -198,7 +198,6 @@ private:
     bool            hasHBondBetween(std::size_t resi1, std::size_t resi2) const;
 
     bool            NoChainBreaksBetween(std::size_t ResiStart, std::size_t ResiEnd) const, isLoop(const std::size_t resiIndex) const, PiHelixPreference;
-    int8_t          pp_stretch;
     bridgeTypes     calculateBridge(std::size_t i, std::size_t j) const;
     void            analyzeBridgesAndStrandsPatterns(), analyzeTurnsAndHelicesPatterns(), analyzePPHelicesPatterns();