Beispiel #1
0
def solvestiffness(pdbpathlist, ballpathlist, stickpathlist, disppathlist, ktypeassinger, notrelative=False):
	equsysset = []
	for i in range(len(pdbpathlist)):
		pdbfn = pdbpathlist[i]
		ballfn = ballpathlist[i]
		stickfn = stickpathlist[i]
		dispfn = disppathlist[i]
		f = equtils.ForceGen.get_force_vector( ballfn, equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, ballfn)) )
		equsys = bbtmequs.DisplacementEquSys(ballfn, stickfn, dispfn, f, ktypeassinger)
		#seciddict = equtils.section_divide(ballfn, equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, ballfn)) )
		seciddict = equtils.section_divide(ballfn, equtils.uni_section_divide(equtils.opm_mempos(pdbfn, ballfn)) )
		equsys.divide_system(seciddict)
		equsysset.append( equsys )
	totequsys = equsysset[0]
	for i in range(1,len(equsysset)):
		totequsys = totequsys + equsysset[i]
	totequsys.solve(notrelative)
	return totequsys.result
			k = np.dot(cls.ktypeassigner.get_assign_vec(btype, a1type, a2type), cls.kvec)
		return k

datapath = '../../../data/'

#codes = [ '1BXW', '1FEP', '1I78', '1K24', '1KMO', '1NQE', '1P4T' ]
codes = [ '1K24' ]

# generated deformed balls file
for code in codes:
	extballfn = datapath+'testdata/'+code+'.balls.ideallarge.ext'
	extstickfn = datapath+code+'.sticks.ext'
	pdbfn = datapath+code+'.pdb'

	#memsec = equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, extballfn))
	memsec = equtils.uni_section_divide(equtils.opm_mempos(pdbfn, extballfn))

	f = equtils.ForceGen.get_force_vector( extballfn,memsec )
	equsys = bbtmequs.StiffnessEquSys(extballfn, extstickfn, f, TestKAssigner )
	equsys.solve()
	disp = equsys.result['u'].reshape(equsys.result['u'].shape[0]/3, 3)

	ballfn = datapath+'testdata/'+code+'.balls.ideallarge'
	balldat = bbtmio.read_ball_file(ballfn)
	ballcoords = bbtmio.get_ball_coords(balldat)
	# rec means after reconstruction
	recballcoords = ballcoords + disp
	recballdat = bbtmio.set_ball_coords(balldat, recballcoords)
	recballfn = code+'.balls.reconstruct'
	bbtmio.write_ball_file(recballdat, recballfn)