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 (
cms.Cms) – This must be consistent with the trajectorytrand created fromtopo.read_cms.selector (
stror a callable) – If the value is astr, it must a valid ASL expression consistent withcms_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 (
listoftraj.Frameobjects) – Trajectoryformat (
str) – Currently, we support only “maestro” (or “mae” in short) andNone. If it’s “maestro”, this function will return aschrodinger.structure.Structureobject for the subsystem, or it will return atraj.Frameobject 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_subsystemfunction.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.Structureobject ifformat="maestro", or atraj.Frameobject ifformat=NoneThe second element is the corresponding aids. If no atoms are selected for a frame, the first element isNoneand the second element is an empty list.
- exception schrodinger.application.desmond.packages.traj_util.TrajectoryUnreadableError¶
Bases:
Exception- __init__(*args, **kwargs)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- schrodinger.application.desmond.packages.traj_util.read_traj(cms_model, cms_file)¶
Read the trajectory associated with cms_model, and return it.
- Parameters
cms_model (cms.Cms) – cms.Cms object.
cms_file (str) – CMS file path.
- Returns
list of frames.
- Return type
list of traj.Frame
- Raises
TrajectoryUnreadableError – If there is an error reading the files.
- 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.
- schrodinger.application.desmond.packages.traj_util.find_trajectories(fname_pattern='*', *, recursive=False) List[str]¶
Finds all trajectory files that match the specified file name pattern (
fname_pattern), and returns a list of names of the found trajectory files.fname_patternfollows theglobsyntax. If the pattern doesn’t contain a supported trajectory extension name, it will be treated as the pattern of the base name.recursivewill lead to searching into all subdirectories iffname_patterncontains the**/pattern.To find all trajectories that have a specified base name in only the current directory, simply call this function:
find_trajectories(<basename>).This function returns an empty list if no matches found.
- schrodinger.application.desmond.packages.traj_util.pretty_filesize(size_in_byte)¶