From 47f7224f0d80ce717cb1745e8f2781c76adec2c2 Mon Sep 17 00:00:00 2001 From: "armindamon.riess" <armindamon.riess@uzh.ch> Date: Wed, 7 Dec 2022 10:36:25 +0100 Subject: [PATCH] corrected leapfrog algorithm --- lib/nBodySim.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nBodySim.cpp b/lib/nBodySim.cpp index 7ed7323..eeb28e3 100644 --- a/lib/nBodySim.cpp +++ b/lib/nBodySim.cpp @@ -159,10 +159,10 @@ void nBodySim::doTimeStep(double dt) { for (unsigned i=0; i < nParticles_; ++i) { for (unsigned j=0; j < 3; ++j) { // TODO - tree_->drift(dt/2); + tree_->kick(dt/2); + tree_->drift(dt); tree_->update(); - tree_->kick(dt); - tree_->drift(dt/2); + tree_->kick(dt/2); } } } -- GitLab