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)
import numpy as np import sys import os sys.path.append(os.path.abspath(os.path.dirname(__file__))+'/../../../pyscripts/') import bbtmequs import typeutils import equtils ballfn = '../../../datamac/1BXW.balls.ext' pdbfn = '../../../datamac/1BXW.pdb' # one k memsec = equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, ballfn)) memsec1 = memsec[0],[-10, -10, -10] memsec2 = memsec[0],[-30, -10, -30] memsec3 = memsec[0],[-30, -10, -90] f1 = equtils.ForceGen.get_force_vector( ballfn,memsec1 ) f2 = equtils.ForceGen.get_force_vector( ballfn,memsec2 ) f3 = equtils.ForceGen.get_force_vector( ballfn,memsec3 ) ses1 = bbtmequs.StiffnessEquSys(ballfn, '../../../datamac/1BXW.sticks.ext', f1, typeutils.KAssigner ) ses2 = bbtmequs.StiffnessEquSys(ballfn, '../../../datamac/1BXW.sticks.ext', f2, typeutils.KAssigner ) ses3 = bbtmequs.StiffnessEquSys(ballfn, '../../../datamac/1BXW.sticks.ext', f3, typeutils.KAssigner ) ses1.solve() ses2.solve() ses3.solve() disp1 = ses1.result['u'].reshape(ses1.result['u'].shape[0]/3, 3) disp2 = ses2.result['u'].reshape(ses2.result['u'].shape[0]/3, 3) disp3 = ses3.result['u'].reshape(ses3.result['u'].shape[0]/3, 3) np.savetxt('1BXW.dsm1_1k.displacement',disp1,delimiter='\t') np.savetxt('1BXW.dsm2_1k.displacement',disp2,delimiter='\t') np.savetxt('1BXW.dsm3_1k.displacement',disp3,delimiter='\t')
import numpy as np import sys import os sys.path.append(os.path.abspath(os.path.dirname(__file__))+'/../../../pyscripts/') import bbtmequs import typeutils import equtils ballfn = '../../../datamac/1BXW.balls.ext' pdbfn = '../../../datamac/1BXW.pdb' # one k f = equtils.ForceGen.get_force_vector( ballfn, equtils.wimley_section_divide(equtils.opm_mempos(pdbfn, ballfn)) ) ses = bbtmequs.StiffnessEquSys(ballfn, '../../../datamac/1BXW.sticks.ext', f, typeutils.KAssigner ) ses.solve() disp = ses.result['u'].reshape(ses.result['u'].shape[0]/3, 3) np.savetxt('1BXW.dsm_1k.displacement',disp,delimiter='\t') # three k ses = bbtmequs.StiffnessEquSys(ballfn, '../../../datamac/1BXW.sticks.ext', f, typeutils.ThreeKAssigner ) ses.solve() disp = ses.result['u'].reshape(ses.result['u'].shape[0]/3, 3) np.savetxt('1BXW.dsm_3k.displacement',disp,delimiter='\t')