Esempio n. 1
0
		os.system('exec/barrel.out '+pdbfn[:-4]+'.bbin')
		print( '\tFile '+pdbcode+'_origin.balls and .sticks written.\n' )
	ball_data = bbtmio.read_ball_file(ball_ori_fn)
	# temporary file, register for cleaning
	files_to_clean.append(ball_ori_fn)

	################################################
	# recenter balls
	print( '\tRecentering the coordinate matrix in balls file' )
	ball_fn = pdbfn[:-4]+'.balls'
	if os.path.isfile(ball_fn) and not args['overwrite']:
		print( '\tFile '+pdbcode+'.balls exists. Nothing changed.\n' )
	else:
		ball_coord_mat = bbtmio.recenter_coord_mat( bbtmio.get_ball_coords(ball_data), bbin_data)
		ball_data = bbtmio.set_ball_coords(ball_data, ball_coord_mat)
		bbtmio.write_ball_file(ball_data, ball_fn)
		print( '\tFile '+pdbcode+'.balls written.\n' )
	ball_data = bbtmio.read_ball_file(ball_fn)

	################################################
	# recenter pdb balls file
	print( '\tPreparing recentered and aligned pdb balls file' )
	ball_pdb_fn = pdbfn[:-4]+'_pdb.balls'
	if os.path.isfile(ball_pdb_fn) and not args['overwrite']:
		print( '\tFile '+pdbcode+'_pdb.balls exists. Nothing changed.\n' )
	else:
		ball_coord_mat = bbtmio.get_ball_coords( ball_data )
		pdbball_data = bbtmio.read_ball_file(ball_ori_fn)
		# recenter
		pdbball_coord_mat = bbtmio.recenter_coord_mat( bbtmio.get_pdb_coords(structure,bbin_data), bbin_data )
		pdbball_data = bbtmio.set_ball_coords(pdbball_data, pdbball_coord_mat)
Esempio n. 2
0
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)

	dispfn = code+'.displacement.reconstruct'
	bbtmio.write_displacement_file(ballcoords, recballcoords, dispfn)



Esempio n. 3
0
	extstickfn = datapath+code+'.sticks.ext'
	pdbfn = datapath+code+'.pdb'

	memsec = equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, extballfn))
	# force profile
	#memsec =  (memsec[0],[-1, -1, -1])
	memsec =  (memsec[0],[-1, -2, -1])

	f = equtils.ForceGen.get_force_vector( extballfn,memsec, code+'.force' )
	# 3 k type
	equsys = bbtmequs.StiffnessEquSys(extballfn, extstickfn, f, typeutils.ThreeKAssigner )
	equsys.solve()
	disp = equsys.result['u'].reshape(equsys.result['u'].shape[0]/3, 3)

	# resting state not extended
	ballfn = datapath+code+'.balls'
	balldat = bbtmio.read_ball_file(ballfn)
	ballcoords = bbtmio.get_ball_coords(balldat)
	# new coords after deformation
	newballcoords = ballcoords + disp
	newballdat = bbtmio.set_ball_coords(balldat, newballcoords)
	# new balls after deforming from resting state
	newballfn = code+'.balls.deformed'
	bbtmio.write_ball_file(newballdat, newballfn)

	dispfn = code+'.displacement'
	bbtmio.write_displacement_file(ballcoords, newballcoords, dispfn)



Esempio n. 4
0
File: test.py Progetto: jksr/beta
	ks3 = np.array( [ 1.31824322, 0.88899824, 0.9253788 , 0.72740754, 2.81697644, 0.66983903, 0.36771102] )
	ks = np.mean(np.vstack((ks1,ks2,ks3)), axis=0)
	@classmethod
	def get_k(cls, btype, a1type, a2type):
		return 100 if btype=='SP' else 100000000 * np.dot( cls.kta.get_assign_vec(a1type, a2type, btype), cls.ks )





for coden in testset:
	ses = bbtmdsm.StiffnessEquSys('../../../data/testdata/'+coden+'.balls.ideallarge.ext', '../../../data/testdata/'+coden+'.sticks.ideallarge.ext', testkassigner )
	ses.solve()
	u =  ses.u.reshape(ses.u.shape[0]/3, 3)
	ideallargecoords = bbtmio.get_ball_coords( bbtmio.read_ball_file('../../../data/testdata/'+coden+'.balls.ideallarge') )
	pdbcoords = bbtmio.get_ball_coords( bbtmio.read_ball_file('../../../data/'+coden+'_pdb.balls') )

	afteru = ideallargecoords + u



	newafteru = bbtmio.recenter_coord_mat(afteru, bbtmio.read_bbin_file('../../../data/'+coden+'.bbin'))

	bbtmio.write_ball_file( bbtmio.set_ball_coords( bbtmio.read_ball_file('../../../data/testdata/'+coden+'.balls.ideallarge'), newafteru ), coden+'.balls.au')

	dummy,newpdbcoords = bbtmio.align_coordmat(pdbcoords, newafteru)
	disp = newafteru - newpdbcoords
	rmsd = np.mean(np.square(np.linalg.norm(disp, axis=1))) ** 0.5
	print coden, disp.shape[0], rmsd
	#sys.exit(0)
Esempio n. 5
0
import numpy as np
import glob
import sys
import os

sys.path.append(os.path.abspath(os.path.dirname(__file__)) + "/../../../pyscripts/")

import bbtmio

for fn in glob.glob("../../../data/????.balls"):
    bdata = bbtmio.read_ball_file(fn)
    bdata["COORDX"] = bdata["COORDX"] * 1.45
    bdata["COORDY"] = bdata["COORDY"] * 1.45
    bbtmio.write_ball_file(bdata, fn + ".ideallarge")