Esempio n. 1
0
File: EquSys.py Progetto: jksr/beta2
	def __init__(self,ballfn,stickfn):
		self.orientdict = {} # stick orientation dict
		self.typedict = {} # stick type dict

		balldat = IO.read_balls(ballfn)
		stickdat = IO.read_sticks(stickfn)
		ball1s = stickdat['BALL1']
		ball2s = stickdat['BALL2']
		types = stickdat['TYPE']
		# loop over sticks
		for i in range(len(stickdat)):
			# make sure 1st endball id always less than or eq to 2nd endball id
			id1 = min(ball1s[i], ball2s[i])
			id2 = max(ball1s[i], ball2s[i])
			self.typedict[(id1,id2)] = types[i]
			coord1 = balldat[id1].coords # ball1 coord
			coord2 = balldat[id2].coords # ball2 coord
			stick = coord1 - coord2 # stick vector
			so = stick / np.linalg.norm(stick) # stick orientation
			so = so.reshape((1,3))
			# calculate sblock
			# sblock(ijpair)=| ll lm ln |
			#				| lm mm mn |
			#				| ln mn nn |
			self.orientdict[id1, id2] = np.dot(so.T,so)
Esempio n. 2
0
File: EquSys.py Progetto: jksr/beta2
	def __init__(self, extballfn, extstickfn, forcevec, kassigner):
		self.ballfn = extballfn
		self.stickfn = extstickfn
		self.f = forcevec
		self.kassigner = kassigner
		self.balldat = IO.read_balls(extballfn)
		self.ballnum = len(self.balldat['COORDX'])
		self.stickdat = IO.read_sticks(extstickfn)
		self.sticknum = len(self.stickdat['BALL1'])
		self.k_mat = self.__get_k_matrix()