From 87108df552c51563291d4291937c95dec2deb0ad Mon Sep 17 00:00:00 2001 From: Thibault Barnouin Date: Fri, 15 Oct 2021 18:42:43 +0200 Subject: [PATCH] debugg integrator --- lib/integrator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 lib/integrator.py diff --git a/lib/integrator.py b/lib/integrator.py old mode 100644 new mode 100755 index 20c80e1..21052ec --- a/lib/integrator.py +++ b/lib/integrator.py @@ -12,14 +12,14 @@ def dp_dt(m_array, q_array): Time derivative of the momentum, given by the position derivative of the Hamiltonian. dp/dt = -dH/dq """ - dp_array = np.zeros((q_array.shape[0],3)) + dp_array = np.zeros(q_array.shape) for i in range(q_array.shape[0]): - m_j = np.delete(m_array) - q_j = np.delete(q_array) - dp_array[i] = m_array[i]*np.sum(m_j*/(q_j-q_array[i])**2, axis=0) + m_j = np.delete(m_array, i) + q_j = np.delete(q_array, i, 0) + dp_array = m_array[i]*np.sum((m_j/np.sum((q_j-q_array[i])**3, axis=1)).reshape((q_j.shape[0],1))*(q_j-q_array[i]), axis=0) return dp_array -def leapfrog(duration, step, m_array, q_array, p_array): +def frogleap(duration, step, m_array, q_array, p_array): """ Leapfrog integrator for first order partial differential equations. iteration : half-step drift -> full-step kick -> half-step drift