Package gromacs :: Module cbook :: Class Frames
[hide private]
[frames] | no frames]

Class Frames

source code

object --+
         |
        Frames

A iterator that transparently provides frames from a trajectory.

The iterator chops a trajectory into individual frames for analysis tools that only work on separate structures such as gro or pdb files. Instead of turning the whole trajectory immediately into pdb files (and potentially filling the disk), the iterator can be instructed to only provide a fixed number of frames and compute more frames when needed.

Note

Setting a limit on the number of frames on disk can lead to longish waiting times because trjconv must re-seek to the middle of the trajectory and the only way it can do this at the moment is by reading frames sequentially. This might still be preferrable to filling up a disk, though.

Warning

The maxframes option is not implemented yet; use the dt option or similar to keep the number of frames manageable.

Instance Methods [hide private]
 
__init__(self, structure, trj, maxframes=None, format='pdb', **kwargs)
Set up the Frames iterator.
source code
 
extract(self)
Extract frames from the trajectory to the temporary directory.
source code
 
__iter__(self)
Primitive iterator.
source code
 
delete_frames(self)
Delete all frames.
source code
 
cleanup(self)
Clean up all temporary frames (which can be HUGE).
source code
 
__del__(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables [hide private]
  framenumber
Holds the current frame number of the currently extracted batch of frames.
  totalframes
Total number of frames read so far; only important when maxframes > 0 is used.
Properties [hide private]
  all_frames
Unordered list of all frames currently held on disk.
  current_framename

Inherited from object: __class__

Method Details [hide private]

__init__(self, structure, trj, maxframes=None, format='pdb', **kwargs)
(Constructor)

source code 
Set up the Frames iterator.
Parameters:
  • structure - name of a structure file (tpr, pdb, ...)
  • trj - name of the trajectory (xtc, trr, ...)
  • format - output format for the frames, eg "pdb" or "gro" [pdb]
  • maxframes (int) - maximum number of frames that are extracted to disk at one time; set to None to extract the whole trajectory at once. [None]
  • kwargs - All other arguments are passed to class:~gromacs.tools.Trjconv; the only options that cannot be changed are sep and the output file name o.
Overrides: object.__init__

Instance Variable Details [hide private]

framenumber

Holds the current frame number of the currently extracted batch of frames. Increases when iterating.

Property Details [hide private]

all_frames

Unordered list of all frames currently held on disk.
Get Method:
unreachable.all_frames(self) - Unordered list of all frames currently held on disk.

current_framename

Get Method:
unreachable.current_framename(self)