1
0

method : com shifts

This commit is contained in:
Alex_Hubert
2021-10-22 16:51:28 +02:00
parent 01629896e9
commit 7e0eca5c85

View File

@@ -38,6 +38,20 @@ class System:
coord = coord/self.Mass()
return coord
def COMV(self): #return center of mass velocity in cartesian np_array
coord = np.zeros(3)
for body in self.bodylist:
coord = coord + body.p
coord = coord/self.Mass()
return coord
def COMShift(self): #Shift coordinates of bodies in system to COM frame and set COM at rest
comcoord = self.COM
for body in self.bodylist:
body.q = body.q-self.COM()
body.p = body.p - self.COMV()
return 0
def Lval(self,Lbodylist): #return angular momentum of bodies in bodylist
comcoord = np.zeros(3)
for body in Lbodylist: