next up previous contents
Next: User interface objects Up: Program component descriptions Previous: Molecule objects   Contents

Remote connection objects

To create, maintain, and access a connection to a molecular dynamics simulation running on a remote computer (which may just happen to be the same computer running VMD), the objects illustrated in figure 4 are used.

Figure 4: Remote simulation access and control objects used in VMD.

The Remote object is used to encapsulate the functionality for initializing, accessing, and controlling a remote simulation. This object contains all the data necessary to create a new simulation or to attach to an already-running simulation. It also contains member functions for querying whether a simulation may be run on another computer, for retrieving the list of available MD programs or jobs on that computer, for obtaining and modifying parameters necessary to start a new job, and for actually starting, attaching to, or stopping an MD simulation.

There are three phases in the task of displaying a molecule in VMD which is being simulated by a separate MD process; they must be accomplished in this order:

  1. Select a computer for the MD simulation, and connect to it to retrieve the list of running jobs there and the list of available MD simulation packages. When this is done by a Remote object, the lists are stored and may be retrieved by other objects in VMD. If the proper daemon process is not running on the selected computer, this step will fail.
  2. If the user is to connect to a job which is already running, this phase is skipped; if the user wishes to start a new job, this phase is where the parameters for the job are retrieved from the remote computer and modified to the users requirements. This requires first selecting which one of the possible MD simulation programs the user wishes to run, and then having the Remote object retrieve the list of optional and required parameters for that program. This list is stored Remote, which also supplies routines to query and change these settings. Once this is accomplished, a routine in Remote is called to start a new simulation (a similar routine exist to attach to an already-running job). After this is called, the simulation starts, loads its data, and this connection procedure proceeds to the final phase.
  3. Once a connection is made to a running application (as opposed to the state for the earlier phases where a simulation was being initialized), the molecular structure is transferred from the remote process to VMD, and coordinate sets are then sent over as they are calculated. The structure sent via the network is stored in an internal format in the Remote object (basically, as a struct; this data is then given to a MoleculeRemote object (described later) and used to create a Molecule in VMD. The Remote object also has routines for changing the state of the simulation after it is running, and for disconnecting from the simulation (which leaves it running, and in a state where VMD can attach to it again later if preferred) as well as for killing the simulation process.

As mentioned, once the connection is established and the structure sent over the network to VMD, a new Molecule can be created. At the very beginning of the procedure just outlined for creating a connection, an instance of a Remote is created to proceed through the phases. After this is complete and the connection is successful, the Remote instance is given to a new MoleculeRemote object, which uses the data in Remote to construct a new molecule in VMD just as if the data were being read from a file. If another simulation is to be started or attached to, another Remote instance must be created. Any number of simulations may be attached to by VMD during a single session, even all the same time. However, there can only be one Remote object being used to initialize a new connection at any one time. Thus, there is one global instance of a Remote object, referred to by the global variable remote; this is used for setting up a simulation, and if the setup is successful the instance is used to create a new MoleculeRemote, after which a brand new instance of a Remote is created and assigned to remote.

MoleculeRemote acts very much like a MoleculeFile, except structure data is retrieved from the provided Remote instance. It also provides a version of the prepare virtual routine (originally defined in the Displayable class). When prepare is called, the MoleculeRemote checks for and processes any new data is available from the remote connection (i.e., new coordinate sets recently computed by the simulation). It also maintains any special items used for graphical display of the simulation, for example the DrawPatch object. DrawPatch is a Displayable, and is used to graphically depict the shape and status (via different coloring schemes) of the volumes of space in which the molecule moves in the simulation. This acts very much like DrawMolItem, by being a child Displayable to the MoleculeRemote which creates it.

The final object used specifically for remote simulation control is the RemoteList, which functions very much like a MoleculeList but which instead keeps a list of MoleculeRemote pointers. If a molecule is read from just some data files, it is stored by the MoleculeList but not the RemoteList (since it is not from a remote connection). If the molecule is from a remote simulation, the pointer to the molecule is stored by both MoleculeList (as a Molecule * pointer) and RemoteList (as a MoleculeRemote * pointer). This allows VMD to distinguish which molecule is part of a presently or previously active simulation. Even if the simulation is terminated, the reference in RemoteList is maintained since the molecule was at some point part of a simulation.

next up previous contents
Next: User interface objects Up: Program component descriptions Previous: Molecule objects   Contents