Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
170 stars 38 forks source link

Example of passing a trajectory list to pytraj.compute #1473

Closed hainm closed 5 years ago

hainm commented 5 years ago

1461

    >>> class TrajectoryList:
    ...     def __init__(self, trajs):
    ...         self._trajs = trajs
    ...
    ...     @property
    ...     def top(self):
    ...         # assume all trajs have the same topology
    ...         return self._trajs[0].top
    ...
    ...     def __iter__(self):
    ...         for frame in chain(self._trajs):
    ...             yield frame
    >>> data = pt.compute(['rmsd @CA', 'radgyr'], TrajectoryList([traj0, traj1]))