How to use the openpathsampling.dynamics.trajectory.Trajectory function in openpathsampling

To help you get started, we’ve selected a few openpathsampling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def shared_subtrajectory(self, other):
        """
        Returns a subtrajectory which only contains frames present in other

        Parameters
        ----------
        other : :class:`openpathsampling.trajectory.Trajectory`
            the second trajectory to use

        Returns
        -------
        :class:`openpathsampling.trajectory.Trajectory`
            the shared subtrajectory
        """
        shared = self.shared_configurations(other)
        return Trajectory([snap for snap in self if snap in shared])
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def __getslice__(self, *args, **kwargs):
        ret = list.__getslice__(self, *args, **kwargs)
        if type(ret) is list:
            ret = Trajectory(ret)
            ret.atom_indices = self.atom_indices

        return ret
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def subset(self, atom_indices):
        """
        Reduce the view of the trajectory to a subset of atoms specified.

        This is only a view, no data will be changed or copied.
        
        Returns
        -------        
        :class:`openpathsampling.trajectory.Trajectory`
            the trajectory showing the subsets of atoms
        """

        t = Trajectory(self)
        t.atom_indices = atom_indices
        return t
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def solute(self):
        """
        Reduce the view of the trajectory to a subset of solute atoms
        specified in the associated DynamicsEngine
        
        Returns
        -------        
        :class:`openpathsampling.trajectory.Trajectory`
            the trajectory showing the subsets of solute atoms
        """

        # TODO: To remove the dependency of the dynamics engine we need to get the information
        # TODO: about the solute_indices from somewhere else, preferrably the topology?

        if Trajectory.engine is None:
            raise ValueError("No engine specified to get solute_indices from !")

        return self.subset(Trajectory.engine.solute_indices)
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def __add__(self, other):
        t = Trajectory(self)
        t.extend(other)
        return t
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
if specified, make a deep copy of specified trajectory
        """

        # Initialize list.
        list.__init__(self)
        StorableObject.__init__(self)

        self.path_probability = None  # For future uses

        if trajectory is not None:
            # Try to make a copy out of whatever container we were provided
            if hasattr(trajectory, 'atom_indices'):
                self.atom_indices = trajectory.atom_indices
            else:
                self.atom_indices = None
            if type(trajectory) is Trajectory:
                self.extend(trajectory.iter_proxies())
            else:
                self.extend(trajectory)
        else:
            self.atom_indices = None
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
def reversed(self):
        """
        Returns a reversed (shallow) copy of the trajectory itself. Effectively
        creates a new Trajectory object and then fills it with shallow reversed copies
        of the contained snapshots.

        Returns
        -------
        :class:`openpathsampling.trajectory.Trajectory`
            the reversed trajectory
        """

        return Trajectory([snap for snap in reversed(self)])
github openpathsampling / openpathsampling / openpathsampling / dynamics / trajectory.py View on Github external
Reduce the view of the trajectory to a subset of solute atoms
        specified in the associated DynamicsEngine
        
        Returns
        -------        
        :class:`openpathsampling.trajectory.Trajectory`
            the trajectory showing the subsets of solute atoms
        """

        # TODO: To remove the dependency of the dynamics engine we need to get the information
        # TODO: about the solute_indices from somewhere else, preferrably the topology?

        if Trajectory.engine is None:
            raise ValueError("No engine specified to get solute_indices from !")

        return self.subset(Trajectory.engine.solute_indices)