From aa0bd50affd74488f0faa676b7562698c714d14c Mon Sep 17 00:00:00 2001 From: Olaf Date: Wed, 27 Mar 2019 12:04:56 +0100 Subject: [PATCH] Remove trivial comments --- comp/movements.py | 10 +++++----- comp/observables.py | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/comp/movements.py b/comp/movements.py index 6857824..266dead 100644 --- a/comp/movements.py +++ b/comp/movements.py @@ -74,7 +74,7 @@ def func_position(x0, v0, f, L, h): """ x1 = x0 + h*v0 + ((h**2)/2)*f # New positions based on current positions, velocities and forces - diff = x1 - x0 + diff = x1 - x0 # Distance traveled. Used for diffusion x1 = np.remainder(x1,L) # Account for the periodic boundary conditions # return @@ -107,7 +107,7 @@ def func_velocity(v0, f0, f1, h): """ v1 = v0 + (h/2)*(f1 + f0) # New velocities based on current velocities and forces and new forces ([N,D] matrix) E_kin_array = .5*(np.linalg.norm(v1, axis=1))**2 # New kinetic energy for every particle - E_kin = np.sum(E_kin_array) # Total kinetic energy + E_kin = np.sum(E_kin_array) # return return v1, E_kin @@ -153,9 +153,9 @@ def steps(x0, v0, f0, L, h): D = x0.shape[1] # Number of spatial dimensions N = x0.shape[0] # Number of particles - x1, diff = func_position(x0, v0, f0, L, h) # Positions of all particles at time 1 - f1, U1, dr1 = func_force(x1, L, D, N) # Forces on all particles at time 1 - v1, E = func_velocity(v0, f0, f1, h) # Velocities (v1) and total kinetic energy (E) of all particles at time 1 + x1, diff = func_position(x0, v0, f0, L, h) + f1, U1, dr1 = func_force(x1, L, D, N) + v1, E = func_velocity(v0, f0, f1, h) # return return x1, v1, E, U1, f1, dr1, diff diff --git a/comp/observables.py b/comp/observables.py index fd5d6e4..580c34e 100644 --- a/comp/observables.py +++ b/comp/observables.py @@ -61,12 +61,12 @@ def pressure_scalar(D, L, kbT): Returns ------- - P Time-averaged pressure (natural units) + P : Time-averaged pressure (natural units) """ D += np.eye(D.shape[1]) # Set diagonal elements to 1 dUdr = D**(-7)-2*D**(-13) dUdr += np.eye(D.shape[1]) # Set diagonal elements to 0 - S = np.sum(24*D*dUdr) # also over time + S = np.sum(24*D*dUdr) # Note: also a summation over time P = 1 - (3*D.shape[1]*kbT)**(-1)*0.5*S/D.shape[0] # return @@ -151,24 +151,24 @@ def pair_correlation(L, N, R): dr = L/M r = np.linspace(0,L,L/dr) - n = np.histogram(R,r)[0] # Make histogram + n = np.histogram(R,r)[0] # Make histogram of mutual particle distances n[0] = 0 # Set value at r=0 to zero to avoid "self-correlation" - r = np.delete(r,0) # Delete r = 0 + r = np.delete(r,0) # r[0] = 0 r -= (r[2]-r[1])/2 # Places points r on the middle of each interval dr G = 2*(L**3)/(N*(N-1))*(n/(4*math.pi*r**2*dr)) # Pair correlation function peaks = np.where((G[1:-1] > G[0:-2]) * (G[1:-1] > G[2:]))[0] + 1 # Finds locations of all peaks - G_peak = G[peaks] # Value of pair correlation at peak - r_peak = r[peaks] # Approximate value of mutual distance r at peak + G_peak = G[peaks] + r_peak = r[peaks] A = r_peak*np.ones([r_peak.shape[0], r_peak.shape[0]]) dA = A - A.transpose() # Difference between all positions of all peaks dA = np.tril(dA.transpose(), -1).transpose() # Only keep positive values - dA = dA.reshape(dA.shape[0]*dA.shape[1],) # Change schape into an array - dA = dA[np.where(dA != 0)[0]] # Remove all zeros - dA = np.sort(dA) # Sort all values + dA = dA.reshape(dA.shape[0]*dA.shape[1],) # Change shape into an array + dA = dA[np.where(dA != 0)[0]] + dA = np.sort(dA) else: dA = 0 G = 0 -- 2.24.1