Beispiel #1
0
def test_progress_log():
    """test_progress_log: simple test, just to make sure it is runnable
    """
    traj = pt.datafiles.load_tz2()[:10]

    p = ProgressBarTrajectory(traj, style='basic', every=5)
    pt.molsurf(p)

    p = ProgressBarTrajectory(traj, style='bar', every=5)
    pt.molsurf(p)

    p = ProgressBarTrajectory(traj, style='circle', every=5)
    pt.molsurf(p)

    # need to run on Jupyter notebook
    if tqdm is not None:
        p = ProgressBarTrajectory(traj, style='tqdm')
        pt.molsurf(p)

        try:
            p = ProgressBarTrajectory(traj, style=tqdm_notebook)
            pt.molsurf(p)
        except traitlets.traitlets.TraitError:
            pass

    # make sure not loading all coordinates from TrajectoryIterator

    traj2 = pt.iterload(fn('tz2.nc'), fn('tz2.parm7'))
    traj2._size_limit_in_GB = traj2._estimated_GB - 0.001

    with pytest.raises(MemoryError):
        traj2.xyz

    p2 = ProgressBarTrajectory(traj2)
    aa_eq(pt.rmsd(p2), pt.rmsd(traj2))
Beispiel #2
0
def test():
    fname = 'data/nogit/remd/remd.x.000'
    topname = 'data/nogit/remd/myparm.parm7'
    traj = pt.trajectory.Trajectory(fname, top=topname)
    print(traj.xyz.dtype)

    for f in traj:
        pass

    pt.radgyr(traj)
    pt.molsurf(traj, '@CA')
    pt.rmsd(traj, mask='@CA')
    pt.multidihedral(traj)
Beispiel #3
0
def test_2(traj=traj):
    data = []
    for idx, c in enumerate(pt.iterchunk(traj, 100)):
        c.strip_atoms('!@P')
        print(idx, c)
        data.append(pt.molsurf(c))
    return data
    def test_molsurf(self):
        traj = self.traj

        text = '''
        parm {0}
        trajin {1}
        molsurf @CA
        molsurf @CA probe 1.2
        molsurf @CA probe 1.2 offset 0.3
        '''.format(traj.top.filename, traj.filename)

        state = pt.load_cpptraj_state(text)
        state.run()
        cpp_data = state.data[1:].values

        atom_indices = traj.top.select("@CA")

        for mask in [atom_indices, '@CA']:
            aa_eq(pt.molsurf(traj, mask), cpp_data[0])
            aa_eq(pt.molsurf(traj, mask, probe=1.2), cpp_data[1])
            aa_eq(pt.molsurf(traj, mask, probe=1.2, offset=0.3), cpp_data[2])
    def test_0(self):
        traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")

        # TrajectoryIterator
        aa_eq(pt.molsurf([f.copy() for f in traj], top=traj.top),
              pt.molsurf(traj))

        # frame_iter
        aa_eq(pt.molsurf([f.copy() for f in traj()], top=traj.top),
              pt.molsurf(traj))

        aa_eq(pt.molsurf([f.copy() for f in traj.iterchunk(3)], top=traj.top),
              pt.molsurf(traj))
    def test_0(self):
        traj = pt.iterload(fn('Tc5b.x'), fn('Tc5b.top'))

        # TrajectoryIterator
        myiter = WrapBareIterator([f.copy() for f in traj], top=traj.top)
        aa_eq(pt.molsurf(myiter), pt.molsurf(traj))

        # frame_iter
        myiter = WrapBareIterator([f.copy() for f in traj()], top=traj.top)
        aa_eq(pt.molsurf(myiter), pt.molsurf(traj))

        myiter = WrapBareIterator([f.copy() for f in traj.iterchunk(3)],
                                  top=traj.top)
        aa_eq(pt.molsurf(myiter), pt.molsurf(traj))
    def test_0(self):
        traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")

        # TrajectoryIterator
        aa_eq(
            pt.molsurf([f.copy() for f in traj],
                       top=traj.top),
            pt.molsurf(traj))

        # frame_iter
        aa_eq(
            pt.molsurf([f.copy() for f in traj()],
                       top=traj.top),
            pt.molsurf(traj))

        aa_eq(
            pt.molsurf([f.copy() for f in traj.iterchunk(3)],
                       top=traj.top),
            pt.molsurf(traj))
Beispiel #8
0
import unittest  # for travis (you don't need to add this)

# since MD simulations produce huge amount of data (hundreds of GB, few TB
# or enven tens of TB)
# so we always try to use TrajectoryIterator to save memory
# coordinates of specific frames are only loaded if needed

import pytraj as pt
traj = pt.iterload('../tests/data/tz2.ortho.nc',
                   '../tests/data/tz2.ortho.parm7')

# calculate molsurf for frame 0, 2, 4, 6
# start=0, stop=8, stride=2 (just like python's range(0, 8, 2))
print(pt.molsurf(traj(0, 8, 2), '@CA'))

# if we want to load all frames at once, use [] indexing style
# (just like indexing a list/array in python)
print(pt.molsurf(traj[0:8:2], '@CA'))

# we even perform `autoimage`
print(pt.radgyr(traj(0, 8, 2, autoimage=True), '@CA', nomax=True))
 def test_molsurf():
     # OK
     pt.molsurf(traj(stop=-3, stride=2, autoimage=True, rmsfit=0))
Beispiel #10
0
def test(traj=traj):
    return pt.molsurf(traj, '@P')
Beispiel #11
0
from pytraj.utils.progress import ProgressBarTrajectory

# using pdb file
# traj4 = pt.load("1gwd.v5.cif")

# print("Traj4:")
# print(traj4)

#loading in with iter
traj2 = pt.iterload("heat1.mdcrd", "1gwd.v5.cif")
print("Traj2:")
print(traj2)


#prog = ProgressBarTrajectory(traj2, style='circle')
pt.molsurf(traj2, '@C')



# make changes to file (MATH STUFF HAPPENS!??)
# traj3 = traj2[2:8:2, '!@C=']


# print(traj3.topology())


# print("Changed:")
# print(traj3)

# # saving to new file
# basename = "nickysims.pdb"
 def test_molsurf():
     # OK
     pt.molsurf(traj(stop=-3, stride=2, autoimage=True, rmsfit=0))