From 7af0c17a7d29aa28dad6ed594ab59f408c49c6ce Mon Sep 17 00:00:00 2001
From: "armindamon.riess" <armindamon.riess@uzh.ch>
Date: Thu, 15 Dec 2022 13:37:28 +0100
Subject: [PATCH] max performance

---
 lib/nBodySim.cpp | 6 ++++--
 main.cpp         | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/nBodySim.cpp b/lib/nBodySim.cpp
index c49c230..6e5bda6 100644
--- a/lib/nBodySim.cpp
+++ b/lib/nBodySim.cpp
@@ -1,5 +1,6 @@
 #include "nBodySim.hpp"
 #include "tree.hpp"
+#include "utils.hpp"
 #include <omp.h>
 #include <cmath>
 #include <string>
@@ -74,13 +75,14 @@ void nBodySim::runSimulation(double dt, unsigned nSteps) {
         write2file(positions_, positionsFile, 3, skip);
         energyFile << calculateTotalEnergy() << std::endl;
 
-        Vector COM = getCenterOfMass();
+        // Vector COM = getCenterOfMass();
 
         // Integrate with leapfrog
         auto start = std::chrono::high_resolution_clock::now();
         kick(dt/2.0);
         drift(dt);
         treeUpdateForces();
+        // double dev = verifyForces();
         kick(dt/2.0);
         updateTree();
         auto stop = std::chrono::high_resolution_clock::now();
@@ -88,7 +90,7 @@ void nBodySim::runSimulation(double dt, unsigned nSteps) {
 
         std::cout << std::right << "Step "    << std::setw(5)  << i
                                 // << ": MFM = " << std::setw(12) << calculateMeanForceMagnitude()
-                                // << ", DEV = " << std::setw(12) << verifyForces()
+                                // << ", DEV = " << std::setw(12) << dev
                                 // << ", MCD = " << std::setw(8)  << calculateMeanCenterDistance()
                                 // << ", MID = " << std::setw(8)  << calculateMeanInterparticleDistance()
                                 // << ", COM = " << "(" << COM[0] << ", " << COM[1] << ", " << COM[2] << ")"
diff --git a/main.cpp b/main.cpp
index 407899e..41eb36e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -18,7 +18,7 @@ int main(int argc, char** argv) {
             return 1;
     }
 
-    double dt = 0.000005;
+    double dt = 5e-7;
     unsigned nSteps = 240;
 
     std::cout << "dt = " << dt << std::endl;
-- 
GitLab