Skip to content

Commit 4ced0c2

Browse files
committed
Working, but lost documentation.
1 parent 1e44884 commit 4ced0c2

File tree

4 files changed

+87
-175
lines changed

4 files changed

+87
-175
lines changed

rebound/particle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def __init__(self, particle=None, m=None, x=None, y=None, z=None, vx=None, vy=No
186186
raise ValueError("Need to specify simulation when initializing particle with orbital elements.")
187187
if primary is None:
188188
clibrebound.reb_get_com.restype = Particle
189-
primary = clibrebound.reb_get_com(simulation.simulation)
189+
primary = clibrebound.reb_get_com(byref(simulation))
190190
if a is None:
191191
raise ValueError("You need to pass a semi major axis to initialize the particle using orbital elements.")
192192
if anom is None:
@@ -296,7 +296,7 @@ def set_orbit(self,
296296
self.y = primary.y + r*(sO*(co*cf-so*sf) + cO*(so*cf+co*sf)*ci)
297297
self.z = primary.z + r*(so*cf+co*sf)*si
298298

299-
n = math.sqrt(simulation.simulation.contents.G*(primary.m+m)/(a**3))
299+
n = math.sqrt(simulation.G*(primary.m+m)/(a**3))
300300
if e>1.:
301301
v0 = n*a/math.sqrt(-(1.-e**2))
302302
else:
@@ -367,7 +367,7 @@ def calculate_orbit(self, simulation, primary=None, index=None, verbose=False):
367367
dvz = self.vz - primary.vz
368368
v = math.sqrt ( dvx*dvx + dvy*dvy + dvz*dvz )
369369

370-
mu = simulation.simulation.contents.G*(self.m+primary.m)
370+
mu = simulation.G*(self.m+primary.m)
371371
o.a = -mu/( v*v - 2.*mu/o.r ) # semi major axis
372372

373373
h0 = (dy*dvz - dz*dvy) # angular momentum vector

0 commit comments

Comments
 (0)