# Path: openpathsampling/integration_tools.py
# def error_if_no(name, package_name, has_package):
# def _chain_import(*packages):
# def error_if_no_simtk_unit(name):
# def error_if_no_mdtraj(name):
# def error_if_to_openmm(name):
#     HAS_SIMTK_UNIT = False
#     HAS_SIMTK_UNIT = True
#     HAS_MDTRAJ = False
#     HAS_MDTRAJ = True
#     HAS_OPENMM = False
#     HAS_OPENMM = True


import numpy as np
import openpathsampling as paths
from openpathsampling.integration_tools import (
    error_if_no_mdtraj, is_simtk_quantity_type, md
)
from openpathsampling.netcdfplus import StorableObject, LoaderProxy
            If not None this topology will be used to construct the mdtraj
            objects otherwise the topology object will be taken from the
            configurations in the trajectory snapshots.

        Returns
        -------
        :class:`mdtraj.Trajectory`
            the trajectory

        Notes
        -----

        If the OPS trajectory is zero-length (has no snapshots), then this
        fails. OPS cannot currently convert zero-length trajectories to
        MDTraj, because an OPS zero-length trajectory cannot determine its
        MDTraj topology.
        """
        error_if_no_mdtraj("Converting to mdtraj")
        try:
            snap = self[0]
        except IndexError:
            raise ValueError("Cannot convert zero-length trajectory "
                             + "to MDTraj")
        if topology is None:
            # TODO: maybe add better error output?
            # if AttributeError here, engine doesn't support mdtraj
            topology = snap.engine.mdtraj_topology

        output = self.xyz


# Path: openpathsampling/integration_tools.py
# def error_if_no(name, package_name, has_package):
# def _chain_import(*packages):
# def error_if_no_simtk_unit(name):
# def error_if_no_mdtraj(name):
# def error_if_to_openmm(name):
#     HAS_SIMTK_UNIT = False
#     HAS_SIMTK_UNIT = True
#     HAS_MDTRAJ = False
#     HAS_MDTRAJ = True
#     HAS_OPENMM = False
#     HAS_OPENMM = True


# Path: openpathsampling/engines/trajectory.py
import numpy as np
import openpathsampling as paths
from openpathsampling.integration_tools import (
    error_if_no_mdtraj, is_simtk_quantity_type, md
)
from openpathsampling.netcdfplus import StorableObject, LoaderProxy

            If not None this topology will be used to construct the mdtraj
            objects otherwise the topology object will be taken from the
            configurations in the trajectory snapshots.

        Returns
        -------
        :class:`mdtraj.Trajectory`
            the trajectory

        Notes
        -----

        If the OPS trajectory is zero-length (has no snapshots), then this
        fails. OPS cannot currently convert zero-length trajectories to
        MDTraj, because an OPS zero-length trajectory cannot determine its
        MDTraj topology.
        """
        error_if_no_mdtraj("Converting to mdtraj")
        try:
            snap = self[0]
        except IndexError:
            raise ValueError("Cannot convert zero-length trajectory "
                             + "to MDTraj")
        if topology is None:
            # TODO: maybe add better error output?
            # if AttributeError here, engine doesn't support mdtraj
            topology = snap.engine.mdtraj_topology

        output = self.xyz


        traj = md.Trajectory(output, topology)