def test_1(self):
        traj = pt.iterload(fn('Tc5b.x'), fn('Tc5b.top'))
        trajectory_t0 = Trajectory(traj)

        # __iter__
        for f in trajectory_t0:
            pass

        f.xyz[0, 0] = 10.
        assert f.xyz[0, 0] == 10.
        assert trajectory_t0.xyz[-1, 0, 0] == 10.

        # __getitem__
        # make a new copy
        trajectory_t0 = Trajectory(traj)
        f0 = trajectory_t0[0]
        f0.xyz[0, 0] = 200.
        assert trajectory_t0.xyz[0, 0, 0] == 200.

        # translate
        # make a new copy
        trajectory_t0 = Trajectory(traj)
        t0 = traj[:]
        pt.translate(trajectory_t0, 'x 1.2')
        pt.translate(t0, 'x 1.2')
        aa_eq(trajectory_t0.xyz, t0.xyz)

        try:
            pt.rmsd(t0, ref=0)
            pt.rmsd(trajectory_t0, ref=0)
        except ImportError:
            pass

        # test rmsfit
        trajectory_t0.rmsfit(ref=0)
Esempio n. 2
0
    def test_transforming_trajectory(self):
        traj = pt.iterload(fn('tz2.ortho.nc'), fn('tz2.ortho.parm7'))
        t0 = traj[:]

        t0.transform([
            'autoimage', 'center origin', 'rotate x 30', 'scale x 1.2',
            'translate x 1.3'
        ])
        t1 = traj[:].autoimage().center('origin').rotate('x 30').scale(
            'x 1.2').translate('x 1.3')
        aa_eq(t0.xyz, t1.xyz)

        t2 = traj[:]
        pt.transform(t2, [
            'autoimage', 'center origin', 'rotate x 30', 'scale x 1.2',
            'translate x 1.3'
        ])
        aa_eq(t1.xyz, t2.xyz)

        # another way
        t3 = traj[:]
        t3.autoimage().center('origin')
        pt.rotate(t3, 'x 30')
        pt.scale(t3, 'x 1.2')
        pt.translate(t3, 'x 1.3')
        aa_eq(t3.xyz, t2.xyz)
Esempio n. 3
0
    def test_transforming_trajectory(self):
        traj = pt.iterload("./data/tz2.ortho.nc", "./data/tz2.ortho.parm7")
        t0 = traj[:]

        t0.transform(['autoimage', 'center origin', 'rotate x 30',
                      'scale x 1.2', 'translate x 1.3'])
        t1 = traj[:].autoimage().center('origin').rotate('x 30').scale('x 1.2').translate('x 1.3')
        aa_eq(t0.xyz, t1.xyz)

        t2 = traj[:]
        pt.transform(t2, ['autoimage', 'center origin', 'rotate x 30',
                          'scale x 1.2', 'translate x 1.3'])
        aa_eq(t1.xyz, t2.xyz)

        # another way
        t3 = traj[:]
        t3.autoimage().center('origin')
        pt.rotate(t3, 'x 30')
        pt.scale(t3, 'x 1.2')
        pt.translate(t3, 'x 1.3')
        aa_eq(t3.xyz, t2.xyz)
    def test_1(self):
        traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")
        trajectory_t0 = pt.trajectory.Trajectory(traj)

        # __iter__
        for f in trajectory_t0:
            pass

        f.xyz[0, 0] = 10.
        assert f.xyz[0, 0] == 10.
        assert trajectory_t0.xyz[-1, 0, 0] == 10.

        # __getitem__
        # make a new copy
        trajectory_t0 = pt.trajectory.Trajectory(traj)
        f0 = trajectory_t0[0]
        f0.xyz[0, 0] = 200.
        assert trajectory_t0.xyz[0, 0, 0] == 200.

        # translate
        # make a new copy
        trajectory_t0 = pt.trajectory.Trajectory(traj)
        t0 = traj[:]
        pt.translate(trajectory_t0, 'x 1.2')
        pt.translate(t0, 'x 1.2')
        aa_eq(trajectory_t0.xyz, t0.xyz)

        try:
            import mdtraj as md
            pt.rmsd(t0, ref=0)
            pt.rmsd(trajectory_t0, ref=0)
        except ImportError:
            pass

        # test rmsfit
        trajectory_t0.rmsfit(ref=0)
Esempio n. 5
0
 def test_translate_regular():
     # OK
     for frame in traj(stop=400):
         pt.translate(frame, '', top=traj.top)
Esempio n. 6
0
 def test_translate_regular():
     # OK
     for frame in traj(stop=400):
         pt.translate(frame, '', top=traj.top)