Package schrodinger :: Package application :: Package desmond :: Package packages :: Module traj :: Class Frame
[hide private]
[frames] | no frames]

Class Frame

object --+
         |
        Frame


This class, as its name suggests, represents a single trajectory frame.
So far, we allow a frame to be mutated in the following ways:
- Assign a new chemical time
- Reduce to a subset of particles
- Coordinates of all particles are translated

We call changes generally as ``decorations''. They might not make into
the frame data, or at least not immediately. Why? This avoids making
multiple expensive copies of the data.

Instance Methods [hide private]
 
__init__(self, source, index)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__str__(self)
str(x)
 
__deepcopy__(self, memo={})
 
_frame(self)
Return the raw frame object where decorations haven't be solidified.
 
_mapped_index(self, i)
 
_copy_and_decorate(self, obj, indices)
Makes a copy of the native trajectory-frame object and decorates the copied object if necessary.
 
_get_native_object(self, indices=None)
 
_make(self, force=False)
Solidifies decorations.
 
source(self)
 
copy(self)
Return a copy of this Frame object.
 
natoms(self)
 
pos(self, i=None)
Return the position vector(s).
 
vel(self, i=None)
Return the velocity vector(s).
 
_getTime(self)
 
_setTime(self, value)
 
box(self)
 
reduce(self, indices, is_sorted=False, copy=True)
Keep only the atoms specified by indices, the other atoms will be deleted from this frame.
 
moveby(self, x, y, z)
Translate all positions by the given x, y, and z.
 
write(self, writer)
Write out this frame using the given writer.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  time = property(_getTime, _setTime)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, source, index)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

_copy_and_decorate(self, obj, indices)

 

Makes a copy of the native trajectory-frame object and decorates the copied object if necessary.

Parameters:
  • obj (A native frame type, e.g., molfile.Frame) - A native frame

_make(self, force=False)

 

Solidifies decorations. If there are decorations or force == True, this function might make a copy of the frame data.

copy(self)

 

Return a copy of this Frame object. The position and velocity arrays will be copied.

natoms(self)

 
Decorators:
  • @property

pos(self, i=None)

 

Return the position vector(s).

@type i: Any of the following types:
         C{None}: Return the whole position-vector array;
         C{int} : C{i} should be a GID, and this function return
                  position vector of the particle C{i}.
         C{Iterable}: C{i} should be a "list" of GIDs, and this function
                  returns a NEW numpy array of position-vectors of the
                  specified particles.

vel(self, i=None)

 

Return the velocity vector(s).
This method may throw if this frame doesn't have velocity data.

@type i: Any of the following types:
         C{None}: Return the whole velocity-vector array;
         C{int} : C{i} should be a GID, and this function return
                  velocity vector of the particle C{i}.
         C{Iterable}: C{i} should be a "list" of GIDs, and this function
                  returns a NEW numpy array of position-vectors of the
                  specified particles.

box(self)

 
Decorators:
  • @property

reduce(self, indices, is_sorted=False, copy=True)

 

Keep only the atoms specified by indices, the other atoms will be deleted from this frame.

Parameters:
  • is_sorted - Is indices sorted? If so, this function will NOT have to sort it again.
  • copy - If true, this function will make a copy of this frame and reduce atoms in this copy, and finally return the copy.