bbtmio.write_ball_file(pdbball_data, ball_pdb_fn) print( '\tFile '+pdbcode+'_pdb.balls written.\n' ) ball_pdb_data = bbtmio.read_ball_file(ball_pdb_fn) ################################################ # calculate displacement from ideal barrel print( '\tCalculate displacement from ideal to real' ) dfn = pdbfn[:-4]+'.displacement' if os.path.isfile(dfn) and not args['overwrite']: print( '\tFile '+pdbcode+'.displacement exists. Nothing changed.\n' ) else: #ball_data = bbtmio.read_ball_file(ball_fn) #ball82_data = bbtmio.read_ball_file(ball_fn+'82') bbtmio.write_displacement_file(bbtmio.get_ball_coords(ball_data), bbtmio.get_ball_coords(ball_pdb_data), dfn) print( '\tFile '+pdbcode+'.displacement written.\n' ) ################################################ # write extended ball and stick including supporting balls and sticks print( '\tPreparing extended ball and stick files for DSM analysis' ) extballfn = pdbfn[:-4]+'.balls.ext' extstickfn = pdbfn[:-4]+'.sticks.ext' if os.path.isfile(extballfn) and os.path.isfile(extstickfn) and not args['overwrite']: print( '\tFile '+pdbcode+'.balls.ext and '+pdbcode+'.sticks.ext exists. Nothing changed.\n' ) else: bbtmio.write_extended_files(ball_fn, stick_fn, extballfn, extstickfn) #bbtmio.write_extended_files(pdbfn[:-4]+'.balls', pdbfn[:-4]+'.sticks', extballfn, extstickfn) print( '\tFile '+pdbcode+'.balls.ext and '+pdbcode+'.sticks.ext written.\n' )
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)