コード例 #1
0
 def test_xyz(self):
     traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")
     frame = Frame()
     frame.append_xyz(traj[0].xyz)
     aa_eq(frame.xyz, traj[0].xyz)
     aa_eq(frame.xyz.flatten(), traj[0].xyz.flatten())
     aa_eq(np.array(frame._buffer1d), traj[0].xyz.flatten())
コード例 #2
0
 def test_xyz(self):
     traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")
     frame = Frame()
     frame.append_xyz(traj[0].xyz)
     aa_eq(frame.xyz, traj[0].xyz)
     aa_eq(frame.xyz.flatten(), traj[0].xyz.flatten())
     aa_eq(np.array(frame._buffer1d), traj[0].xyz.flatten())
コード例 #3
0
 def test_xyz(self):
     traj = pt.iterload(fn('Tc5b.x'), fn('Tc5b.top'))
     frame = Frame()
     frame.append_xyz(traj[0].xyz)
     aa_eq(frame.xyz, traj[0].xyz)
     aa_eq(frame.xyz.flatten(), traj[0].xyz.flatten())
     aa_eq(np.array(frame._buffer1d), traj[0].xyz.flatten())
コード例 #4
0
ファイル: tools.py プロジェクト: hainm/pytraj
def merge_frames(iterables):
    """merge from frames to a single Frame. Order matters.
    Examples
    --------
    >>> import pytraj as pt
    >>> traj = pt.load_sample_data('tz2')
    >>> traj[0]
    <Frame with 5293 atoms>
    >>> merge_frames(traj(0, 3))
    <Frame with 15879 atoms>
    """
    from pytraj import Frame
    xyz = np.vstack((f.xyz.copy() for f in iterables))
    frame = Frame()
    frame.append_xyz(xyz)
    return frame
コード例 #5
0
ファイル: tools.py プロジェクト: josejames00/pytraj
def merge_frames(iterables):
    """merge from frames to a single Frame. Order matters.
    Examples
    --------
    >>> import pytraj as pt
    >>> traj = pt.load_sample_data('tz2')
    >>> traj[0]
    <Frame with 5293 atoms>
    >>> merge_frames(traj(0, 3))
    <Frame with 15879 atoms>
    """
    from pytraj import Frame
    xyz = np.vstack((f.xyz.copy() for f in iterables))
    frame = Frame()
    frame.append_xyz(xyz)
    return frame
コード例 #6
0
n_frames = traj.n_frames

if rank == 0:
    ref = traj[0]
    ref_xyz = np.asarray(ref.xyz, dtype=np.float64)
else:
    ref = None
    ref_xyz = np.empty((n_atoms, 3), dtype=np.float64)

# broadcast ref_xyz to other cores from master
comm.Bcast([ref_xyz, MPI.DOUBLE])

if rank != 0:
    # need to reconstruct ref
    ref = Frame()
    ref.append_xyz(ref_xyz)

_ref = ref.copy()


def rmsd_mpi(traj, _ref):
    arr0 = pyca.calc_rmsd("@CA", traj, traj.top, _ref)
    return arr0


arr0 = rmsd_mpi(traj, _ref)

if rank == 0:
    data = np.empty(size * traj.n_frames, dtype=np.float64)
else:
    data = None