next up previous contents
Next: DrawMolecule Up: Molecule objects Previous: Atom   Contents

Subsections


BaseMolecule

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

Description

BaseMolecule is the second-highest level in the class hierarchy for Molecule objects; it is derived from Animation, and is used to store the static information for the molecule, which is the basic information about the structure and contents of the system which do not change with time. BaseMolecule has no ability to read in this information itself, instead it provides routines which derived classes call in order to add new molecules, bonds, etc. to the molecule. BaseMolecule has no responsibility for graphically displaying the molecule, either; that is left to the DrawMolecule class, which is derived from BaseMolecule and Displayable.

You do not ever create a BaseMolecule instance directly, instead you create an instance of a class derived from Molecule, for which BaseMolecule is a base class (among others). When initially created, a new BaseMolecule is empty, with zero atoms and zero bonds. The derived classes contain the actual code to read in the molecular structure from a file or from a network connection, and they add the components to the internal storage via routines in BaseMolecule. When all the structure is completely read in, then routine are called in BaseMolecule to analyze the structure, and calculate such things as what atoms are in what residues, how many residues there are, what are the backbone bonds, etc. In fact, a molecule contains these structural features which are either directly added to BaseMolecule, or calculated by BaseMolecule after the basic structure is read in:

After the atoms and bonds are added to the BaseMolecule, then the connectivity is analyzed and the names of the atoms are used to find the backbone bonds, the residues in the system, and the fragments. Atoms, bonds, residues, and other components are numbered 0 ... N-1 in their respective lists.

One other item which BaseMolecule stores is the unique molecule ID number, which is assigned when the molecule is created. Each new molecule in VMD gets assigned an integer ID. The assigned ID values increase by one as each new system is loaded. The commands used to affect the molecules use these ID numbers to determine which molecule the command should affect. The name of the molecule displayed in the Molecule on-screen menu form has this ID number appended to the end of it.

Constructors

Enumerations, lists or character name arrays

The MoleculeType enumeration lists the different type of molecules which VMD understands. When the structure is analyzed, the type of molecule is determined. The types are:

Internal data structures

Nonvirtual member functions

Virtual member functions

Method of use

A new molecule is first created by using `new' with the proper subclass of Molecule (Molecule is the `standard' class to use for all molecule objects in VMD; classes derived from Molecule are specialized to read in data from different sources, while classes above the Molecule level only deal with some of the information required to store and display and animate a structure.). Then, after the new instance is assigned to a Molecule pointer, then the create() virtual function should be called. This will actually result in all the action being done, for example data files will be read or network connections will be established. The version of create() in BaseMolecule should be called after the molecule has been read in by the derived classes. It analyzes the structure and finds the backbone bonds, fragments, etc. When create() is finished, the molecule is ready to go. If create() does not return TRUE, however, the creation failed (i.e. the files could not be opened), and the new molecule will still be empty.


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