Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

molfile_plugin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2002 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: molfile_plugin.h,v $
00013  *      $Author: johns $       $Locker:  $             $State: Exp $
00014  *      $Revision: 1.34 $       $Date: 2006/02/16 20:32:40 $
00015  *
00016  ***************************************************************************/
00017 
00023 #ifndef MOL_FILE_PLUGIN_H
00024 #define MOL_FILE_PLUGIN_H
00025 
00026 #include "vmdplugin.h"
00027 
00031 #define MOLFILE_PLUGIN_TYPE "mol file reader"
00032 
00037 #define MOLFILE_CONVERTER_PLUGIN_TYPE "mol file converter"
00038 
00039 /* File plugin symbolic constants for better code readability */
00040 #define MOLFILE_SUCCESS           0   
00041 #define MOLFILE_EOF              -1   
00042 #define MOLFILE_ERROR            -1   
00043 #define MOLFILE_NOSTRUCTUREDATA  -2   
00045 #define MOLFILE_NUMATOMS_UNKNOWN -1   
00046 #define MOLFILE_NUMATOMS_NONE     0   
00052 typedef struct {
00053   char database[81];   
00054   char accession[81];  
00055   char date[81];       
00056   char title[81];      
00057   int remarklen;       
00058   char *remarks;       
00059 } molfile_metadata_t;
00060 
00061 
00062 /* 
00063  * Struct for specifying atoms in a molecular structure.  The first 
00064  * six components are required, the rest are optional and their presence is 
00065  * indicating by setting the corresponding bit in optsflag.  When omitted,
00066  * the application (for read_structure) or plugin (for write_structure) 
00067  * must be able to supply default values if the missing parameters are 
00068  * part of its internal data structure.
00069  * Note that it is not possible to specify coordinates with this structure.
00070  * This is intentional; all coordinate I/O is done with the read_timestep and 
00071  * write_timestep functions. 
00072  */
00073 
00077 typedef struct {
00078   /* these fields absolutely must be set or initialized to empty */
00079   char name[16];      
00080   char type[16];      
00081   char resname[8];    
00082   int resid;          
00083   char segid[8];      
00084   char chain[2];      
00086   /* rest are optional; use optflags to specify what's present   */
00087   char altloc[2];     
00088   char insertion[2];  
00089   float occupancy;    
00090   float bfactor;      
00091   float mass;         
00092   float charge;       
00093   float radius;       
00094   int atomicnumber;   
00095 } molfile_atom_t;
00096 
00099 #define MOLFILE_NOOPTIONS     0x0000 
00100 #define MOLFILE_INSERTION     0x0001 
00101 #define MOLFILE_OCCUPANCY     0x0002 
00102 #define MOLFILE_BFACTOR       0x0004 
00103 #define MOLFILE_MASS          0x0008 
00104 #define MOLFILE_CHARGE        0x0010 
00105 #define MOLFILE_RADIUS        0x0020 
00106 #define MOLFILE_ALTLOC        0x0040 
00107 #define MOLFILE_ATOMICNUMBER  0x0080 
00108 #define MOLFILE_BONDSSPECIAL  0x0100 
00110 
00111 
00112 /*
00113  * Per-timestep atom coordinates and periodic cell information
00114  */ 
00115 typedef struct {
00116   float *coords;  
00126   float A, B, C, alpha, beta, gamma; 
00128 } molfile_timestep_t;
00129 
00130 
00135 typedef struct {
00136   char dataname[256]; 
00138   float origin[3];    
00140   /*
00141    * x/y/z axis:
00142    * These the three cell sides, providing both direction and length
00143    * (not unit vectors) for the x, y, and z axes.  In the simplest
00144    * case, these would be <size,0,0> <0,size,0> and <0,0,size) for 
00145    * an orthogonal cubic volume set.  For other cell shapes these
00146    * axes can be oriented non-orthogonally, and the parallelpiped
00147    * may have different side lengths, not just a cube/rhombus.
00148    */
00149   float xaxis[3];     
00150   float yaxis[3];     
00151   float zaxis[3];     
00153   /*
00154    * x/y/z size: 
00155    * Number of grid cells along each axis.  This is _not_ the
00156    * physical size of the box, this is the number of voxels in each
00157    * direction, independent of the shape of the volume set. 
00158    */
00159   int xsize;          
00160   int ysize;          
00161   int zsize;          
00163   int has_color;      
00164 } molfile_volumetric_t;
00165 
00166 
00171 enum molfile_graphics_type {
00172   MOLFILE_POINT,  MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, 
00173   MOLFILE_LINE,   MOLFILE_CYLINDER, MOLFILE_CAPCYL,  MOLFILE_CONE,    
00174   MOLFILE_SPHERE, MOLFILE_TEXT,     MOLFILE_COLOR,   MOLFILE_TRICOLOR
00175 };
00176 
00180 typedef struct {
00181   int type;             /* One of molfile_graphics_type */
00182   int style;            /* A general style parameter    */
00183   float size;           /* A general size parameter     */
00184   float data[9];        /* All data for the element     */
00185 } molfile_graphics_t;
00186 
00187 
00188 /*
00189  * Types for raw graphics elements stored in files.  Data for each type
00190  * should be stored by the plugin as follows:
00191 
00192 type        data                                     style       size
00193 ----        ----                                     -----       ----
00194 point       x, y, z                                              pixel size
00195 triangle    x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00196 trinorm     x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00197             the next array element must be NORMS
00198 tricolor    x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00199             the next array elements must be NORMS
00200             the following element must be COLOR, with three RGB triples
00201 norms       x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00202 line        x1,y1,z1,x2,y2,z2                        0=solid     pixel width
00203                                                      1=stippled
00204 cylinder    x1,y1,z1,x2,y2,z2                        resolution  radius
00205 capcyl      x1,y1,z1,x2,y2,z2                        resolution  radius
00206 sphere      x1,y1,z1                                 resolution  radius
00207 text        x, y, z, up to 24 bytes of text                      pixel size
00208 color       r, g, b
00209 */
00210 
00211 
00217 typedef struct {
00221   vmdplugin_HEAD
00222 
00232   const char *filename_extension;
00233 
00242   void *(* open_file_read)(const char *filepath, const char *filetype, 
00243       int *natoms);
00244   
00252   int (*read_structure)(void *, int *optflags, molfile_atom_t *atoms);
00253 
00273   int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder);
00274 
00286   int (* read_next_timestep)(void *, int natoms, molfile_timestep_t *);
00287 
00291   void (* close_file_read)(void *);
00292    
00299   void *(* open_file_write)(const char *filepath, const char *filetype, 
00300       int natoms);
00301   
00305   int (* write_structure)(void *, int optflags, const molfile_atom_t *atoms);
00306 
00313   int (* write_timestep)(void *, const molfile_timestep_t *);
00314   
00318   void (* close_file_write)(void *);
00319 
00327   int (* read_volumetric_metadata)(void *, int *nsets, 
00328         molfile_volumetric_t **metadata);
00329 
00338   int (* read_volumetric_data)(void *, int set, float *datablock, 
00339         float *colorblock);
00340 
00347   int (* read_rawgraphics)(void *, int *nelem, const molfile_graphics_t **data);
00348 
00355   int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata);
00356   
00368   int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder);
00369 
00370 } molfile_plugin_t;
00371 
00372 #endif
00373 

Generated on Wed Mar 22 13:15:30 2006 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002