From f4bd75f31366252400c4cf18b300fba77ce3d78a Mon Sep 17 00:00:00 2001 From: Anatoly Date: Thu, 27 Feb 2020 16:52:12 +0300 Subject: [PATCH] supposedly working corrEval class --- src/spacetimecorr.cpp | 67 +++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/src/spacetimecorr.cpp b/src/spacetimecorr.cpp index 509c8c2..9aa34d8 100644 --- a/src/spacetimecorr.cpp +++ b/src/spacetimecorr.cpp @@ -220,9 +220,18 @@ class correlationType { } if ((frame + 1 - trajectory.size()) % tauStep == 0) { correlationEval(); + selections.erase(selections.begin()); } } + void graphEval() { + + } + + void backBoneGraphEval() { + + } + private: std::vector< std::vector< std::vector< float > > > matrixes; std::vector< std::vector< RVec > > trajectory; @@ -284,7 +293,20 @@ class correlationType { } std::fclose(file); } - + if (rwMode == 0) { + file = std::fopen(outputName.c_str(), "r+"); + matrixes.resize(0); matrixes.resize(tau + 1); + for (unsigned int i = 0; i < tau + 1; i++) { + int t0, t1, t2 = std::fscanf(file, "%d %d\n", &t0, &t1); + matrixes[i].resize(0); matrixes[i].resize(index.size()); + for (unsigned int j = 0; j < index.size(); j++) { + matrixes[i][j].resize(index.size()); + for (unsigned int k = 0; k < index.size(); k++) { + t2 = std::fscanf(file, "%f ", &matrixes[i][j][k]); + } + } + } + } } @@ -377,35 +399,6 @@ class correlationType { } }; -const std::vector< std::vector< std::vector< double > > > read_correlation_matrix_file(const char* file_name, unsigned long size, unsigned int length) -{ - FILE *file; - std::vector< std::vector< std::vector< double > > > crrlts; - file = std::fopen(file_name, "r+"); - std::vector< double > c; - c.resize(size, 0); - std::vector< std::vector< double > > b; - b.resize(size, c); - crrlts.resize(length + 1, b); - //char a[100]; - std::cout << "reading correlations from a file:\n"; - for (unsigned int i = 0; i < length + 1; i++) { - int t0 = 0, t1 = std::fscanf(file, "%d\n", &t0); - std::cout << t0 << " | "; - if (i % 100 == 0) { - std::cout << "\n"; - } - for (unsigned int j = 0; j < size; j++) { - for (unsigned int f = 0; f < size; f++) { - int t2 = std::fscanf(file, "%lf ", &crrlts[i][j][f]); - } - } - } - std::fclose(file); - std::cout << "\n"; - return crrlts; -} - template< typename T > unsigned long posSrch(std::vector< T > a, T b) { for (unsigned i01 = 0; i01 < a.size(); i01++) { @@ -816,20 +809,6 @@ void graph_back_bone_evaluation(std::vector< std::vector < std::pair< unsigned i } } -gmx::RVec evaluate_com(std::vector< RVec > frame) { - RVec temp; - temp[0] = 0; - temp[1] = 0; - temp[2] = 0; - for (unsigned int i = 0; i < frame.size(); i++) { - temp += frame[i]; - } - temp[0] /= frame.size(); - temp[1] /= frame.size(); - temp[2] /= frame.size(); - return temp; -} - /*! \brief * \ingroup module_trajectoryanalysis */ -- 2.22.0