next up previous contents
Next: Remote connection objects Up: Molecule objects Previous: Molecule   Contents

Subsections


Timestep

Files: Timestep.h, Timestep.C
Derived from: none
Global instance (if any): none
Used in optional component: Part of main VMD code

Description

The Timestep class is used to hold the dynamic data for a Molecule for a single step in a trajectory. It hold the coordinates, velocities, energies, etc. that vary with time. As each new Timestep is read in from some source (a file, or from a network connection) it is added to the animation list for the associated molecule; this list is maintained by the Animation object, from which each Molecule is derived.

Almost all the items in this class are public, so they may be retrieved quickly by other objects in VMD. This is not such a great design, however; see the notes below about future changes.

Constructors

Enumerations, lists or character name arrays

There are a number of globally defined macros in this class which are used as indices into the data arrays stored by this object. They are:
  1. Energy Data Indices:

  2. Per-Atom Data Indices:

  3. Per-Patch Data Indices:

Internal data structures

Nonvirtual member functions

Method of use

A new Timestep is created each time new coordinate data needs to be added to the end of the animation list. Use the following steps:
  1. Create a new instance:
    Timestep *ts = new Timestep(atoms, dt);

  2. Copy coordinate and energy data into the proper arrays, by accessing the public data items described above.

  3. If there is patch data, first call create_patch_storage with the number of patches (to allocate storage), and then copy the patch data into the array which is returned by the function.

  4. After all data is entered, the last step is to call the init routine. This goes through all the stored quantities (x, y, z position, atoms/patch, etc) and calculates the maximum and minimum values. It also finds the position of the center of volume, and the proper scaling factor.

Suggestions for future changes/additions

This could perhaps benefit from having a NameList store the different quantities, with a specific name associated with each quantity. Then, instead of having to hard-code into Timestep what data is being stored, you could just have a routine to add new items with a given name to the object, and other routines to access data by providing the proper name and index (or maybe just provide the name, and have returned the proper array storing the data).


next up previous contents
Next: Remote connection objects Up: Molecule objects Previous: Molecule   Contents
vmd@ks.uiuc.edu