a try to improve fitting speed
[alexxy/gromacs-rcore.git] / src / rcore.cpp
index 3e7b1677b54cc993148a5eabdb06549fcb169986..36b5079e28ec62a92bf561b3161044bfd5113899 100644 (file)
@@ -48,7 +48,8 @@
 #include <gromacs/utility/gmxomp.h>
 
 #include <gromacs/trajectoryanalysis.h>
-#include "new_fit.h"
+//#include "new_fit.h"
+#include "newfit.h"
 
 using namespace gmx;
 
@@ -90,7 +91,7 @@ class AnalysisTemplate : public TrajectoryAnalysisModule
         std::vector< std::vector < RVec > >                 fitting_temp;
         std::vector< long double >                          noise;
         std::vector< int >                                  index;
-        long double                                         epsi = 0.15;
+        long double                                         epsi = 0.1;
         long double                                         fitting_prec = 0.00001;
         int                                                 frames = 0;
         int                                                 iter_count = 0;
@@ -236,7 +237,7 @@ AnalysisTemplate::finishAnalysis(int /*nframes*/)
         iter_count++;
     }
 */
-
+/*
     noise_mid = 9999;
 
     while (noise_mid > epsi) {
@@ -281,34 +282,37 @@ AnalysisTemplate::finishAnalysis(int /*nframes*/)
             fitting_pairs.push_back(std::make_pair (i, i));
         }
     }
+*/
 
 
 
-/*
     std::chrono::time_point<std::chrono::system_clock> start1, end1;
     FILE * pFile;
     pFile = fopen ("/home/toluk/Develop/testing/input.in","w+");
     long double fitting_prec = 1;
     std::vector < RVec > fit_temp;
     long double temp1, temp2;
-    fprintf (pFile, "starting dist %Lf\n",dist(trajectory[0], trajectory[900], fitting_pairs));
+    NewFit objFit;
+    std::cout << objFit.dist(trajectory[0], trajectory[900], fitting_pairs);
+    //fprintf (pFile, "starting dist %Lf\n", objFit.dist(trajectory[0], trajectory[900], fitting_pairs));
     fprintf (pFile, "fitting prec constant    | new dist               | taken time\n");
-    for (int i = 1; i <= 10; i++) {
-        temp1 = fitting_prec / 10;
-        for (int j = 0; j <= 9; j++) {
-            temp2 = fitting_prec - temp1 * j;
+    //for (int i = 1; i <= 10; i++) {
+        temp1 = 0.00001;
+        //for (int j = 0; j <= 9; j++) {
+            //NewFit objFit;
+            //temp2 = fitting_prec - temp1 * j;
             fit_temp.resize(0);
             fit_temp = trajectory[900];
             start1 = std::chrono::system_clock::now();
-            new_fit(trajectory[0], fit_temp, fitting_pairs, index.size(), temp2);
+            objFit.new_fit(trajectory[0], fit_temp, fitting_pairs, index.size(), temp1);
             end1 = std::chrono::system_clock::now();
-            fprintf (pFile, "%25.10Lf %25.10Lf %10ld millisecconds\n", temp2, dist(trajectory[0], fit_temp, fitting_pairs), std::chrono::duration_cast<std::chrono::milliseconds>(end1-start1).count());
-            std::cout << i << " " << j << "\n";
-        }
+            fprintf (pFile, "%25.10Lf %25.10Lf %10ld millisecconds\n", temp2, objFit.dist(trajectory[0], fit_temp, fitting_pairs), std::chrono::duration_cast<std::chrono::milliseconds>(end1-start1).count());
+            //std::cout << i << " " << j << "\n";
+        //}
         fitting_prec /= 10;
-    }
+    //}
     fclose (pFile);
-*/
+
 
     std::cout << "analys finish\n";
 }