コード例 #1
0
ファイル: EquSys.py プロジェクト: 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)
コード例 #2
0
ファイル: EquSys.py プロジェクト: 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()
コード例 #3
0
ファイル: EquSys.py プロジェクト: jksr/beta2
	def __init__(self, ballfn='', stickfn='', dispdifffn='', forcevec = None, ktypeassinger=None):
		self.ballfn = ballfn
		self.stickfn = stickfn
		self.dispdifffn = dispdifffn
		self.f = forcevec
		self.ktypeassinger = ktypeassinger
		self.ba_mat = None
		if ballfn != '':
			self.balldat = IO.read_balls(self.ballfn)
			self.ballnum = len(self.balldat['COORDX'])
			self.ba_mat = self.__get_ba_matrix()
コード例 #4
0
ファイル: Force.py プロジェクト: jksr/beta2
def ForceGen(ballfn, division, forceprofile):
    balldat = IO.read_balls(ballfn)
    freenum = sum(1 for facing in balldat["FACING"] if facing != "SP")
    force = np.zeros((3 * freenum, 1))
    for i in range(freenum):
        secid = -1
        for j in range(len(division)):
            if i in division[j]:
                secid = j
                break
        if secid != -1:
            force[3 * i] = balldat[i].coords[0] * forceprofile[secid]
            force[3 * i + 1] = balldat[i].coords[1] * forceprofile[secid]
    return force
コード例 #5
0
ファイル: Division.py プロジェクト: jksr/beta2
	def __init__(self, ballfn, mempos):
		"""	Divide ball data into different sections according to their z coordinate.
			Based on Wimley's Division. c.f. Jackups' paper
		"""
		self.dict = {0:[], 1:[], 2:[]}
		self.sections = []

		balldat = IO.read_balls(ballfn)
		extra_z, peri_z, offset_z = mempos
		coreupper_z = 6.5-offset_z
		corelower_z = -6.5-offset_z
		self.sections = [[extra_z, coreupper_z],[coreupper_z, corelower_z],[corelower_z, peri_z]]
		for i in range(len(balldat)):
			if balldat[i].facing == 'SP':
				continue
			if peri_z <= balldat[i].coords[2] and balldat[i].coords[2] < corelower_z:
				self.dict[2].append(i)
			elif corelower_z <= balldat[i].coords[2] and balldat[i].coords[2] < coreupper_z:
				self.dict[1].append(i)
			elif coreupper_z <= balldat[i].coords[2] and balldat[i].coords[2] <= extra_z:
				self.dict[0].append(i)
コード例 #6
0
ファイル: Division.py プロジェクト: jksr/beta2
def opm_mempos(opmpdbfn, geofn, ballfn):
	"""	get membrane position from opmdb pdb file
	"""
	geodat = IO.read_geo(geofn)
	# an anchor residue used to find out the offset. it has no meaning
	base_res_id = geodat['startingSNs'][0]
	opmchain = IO.guess_chain(opmpdbfn, geodat)
	for res in opmchain:
		if res.get_id()[1] == base_res_id:
			opm_base_z = res['CA'].get_coord()[2]
			break
	my_base_z = IO.read_balls(ballfn)[0].coords[2]
	# offset from my ball coords to opm pdb coords
	my_z_offset = opm_base_z - my_base_z
	opm_half_thickness = abs( Bio.PDB.PDBParser().get_structure('MyStruct',opmpdbfn)[0]	# structure and model
			.get_list()[-1].get_list()[0]	# last chain and first residue
			.get_list()[0].get_coord()[2] )	# first atom and z coord
	# my extracellular membrane position
	my_extra_z = opm_half_thickness - my_z_offset
	# my periplasm membrane position
	my_peri_z = -opm_half_thickness - my_z_offset
	return my_extra_z, my_peri_z, my_z_offset