schrodinger.application.desmond.packages.traj_util module

Advanced utilities for trajectory handling

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.desmond.packages.traj_util.extract_atoms(cms_model, selector, tr, format='maestro', is_subsystem=False)

A generator to extract the specified atoms from the trajectory.

Parameters:
  • cms_model (schrodinger.structure.Structure) – This must be consistent with the trajectory tr and created from topo.read_cms.
  • selector (str or a callable) – If the value is a str, it must a valid ASL expression consistent with cms_model. The expression will be repeatedly applied to each frame, thus the selected atoms may differ from frame to frame. If the value is a callable, it should take a full system CT as the argument and return a list of selected atom indices.
  • tr (list of traj.Frame objects) – Trajectory
  • format (str) – Currently, we support only “maestro” (or “mae” in short) and None. If it’s “maestro”, this function will return a schrodinger.structure.Structure object for the subsystem, or it will return a traj.Frame object for the subsystem.
  • is_subsystem (bool) –
    • If true, this function will extract the specified subsystem from the trajectory. It’s important to understand what we mean by “subsystem”, for this, refer to the docstring of the topo.extract_subsystem function.
    • If false, this function will extract an arbitrary set of atoms as specified by selector.
Return type:

A tuple. The first element is a schrodinger.structure.Structure object if format="maestro", or a traj.Frame object if format=None The second element is the corresponding aids. If no atoms are selected for a frame, the first element is None and the second element is an empty list.

exception schrodinger.application.desmond.packages.traj_util.TrajectoryUnreadableError

Bases: Exception

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.traj_util', '__weakref__': <attribute '__weakref__' of 'TrajectoryUnreadableError' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.traj_util'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

schrodinger.application.desmond.packages.traj_util.read_cms_and_traj(cms_file)

Read the .cms file and the associated trajectory, and return the msys model, the cms model, and the trajectory. The associated trajectory is assumed to be in the same directory as the given .cms file.

Parameters:cms_file (str) – CMS file path.
Returns:msys System, CMS, and list of frames.
Return type:(msys.System, cms.Cms, list of traj.Frame)
Raises:TrajectoryUnreadableError – If there is an error reading the files.