def testTwoTrajTypes(self): '''test different metrics with different traj objects ''' funclist = [pt.iterload, pt.load] txt = ''' parm {} trajin {} rms2d @CA metric_holder rmsout tmp.out '''.format(tc5b_top, tc5b_trajin) for func in funclist: traj = func(tc5b_trajin, tc5b_top) for metric in ['rms', 'nofit', 'dme']: d0 = pt.pairwise_rmsd(traj(mask='@CA'), metric=metric) d1 = pt.pairwise_rmsd(traj, mask='@CA', metric=metric) d2 = pt.pairwise_rmsd(traj(), mask='@CA', metric=metric) txt0 = txt.replace('metric_holder', metric) state = pt.load_cpptraj_state(txt0) with tempfolder(): state.run() d3 = state.data[-1].values aa_eq(d0, d1) aa_eq(d0, d2) aa_eq(d0, d3)
def testTwoTrajTypes(self): '''test different metrics with different traj objects ''' funclist = [pt.iterload, pt.load] txt = ''' parm ./data/Tc5b.top trajin ./data/Tc5b.x rms2d @CA metric_holder rmsout tmp.out ''' for func in funclist: traj = func("./data/Tc5b.x", "./data/Tc5b.top") for metric in ['rms', 'nofit', 'dme']: d0 = pt.pairwise_rmsd(traj(mask='@CA'), metric=metric) d1 = pt.pairwise_rmsd(traj, mask='@CA', metric=metric) d2 = pt.pairwise_rmsd(traj(), mask='@CA', metric=metric) txt0 = txt.replace('metric_holder', metric) state = pt.datafiles.load_cpptraj_output(txt0, dtype='state') d3 = state.datasetlist[-1].values aa_eq(d0, d1) aa_eq(d0, d2) aa_eq(d0, d3)
import pytraj as pt traj = pt.iterload('../tests/data/Tc5b.x', '../tests/data/Tc5b.top') mat = pt.pairwise_rmsd(traj, '@CA') print(mat)
def get_ca_rmsd( traj, mask, metric ): ca_rmsd = pt.pairwise_rmsd(traj, mask=mask, metric=metric) #ca_rmsd = pt.pmap_mpi(pt.rmsd, traj, mask='@CA') return ca_rmsd;
def calc_pretty(traj, mask='!:WAT', mat_type='cpptraj'): return pt.pairwise_rmsd(traj, mask=mask, mat_type=mat_type)
def test_pairwise_rmsd(): pt.pairwise_rmsd(traj(stop=1000), mask='@CA')