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-2006 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.48 $       $Date: 2008/06/25 04:46:44 $
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   
00051 #define MOLFILE_BUFSIZ           81   
00057 typedef struct {
00058   char database[81];   
00059   char accession[81];  
00060   char date[81];       
00061   char title[81];      
00062   int remarklen;       
00063   char *remarks;       
00064 } molfile_metadata_t;
00065 
00066 
00067 /* 
00068  * Struct for specifying atoms in a molecular structure.  The first 
00069  * six components are required, the rest are optional and their presence is 
00070  * indicating by setting the corresponding bit in optsflag.  When omitted,
00071  * the application (for read_structure) or plugin (for write_structure) 
00072  * must be able to supply default values if the missing parameters are 
00073  * part of its internal data structure.
00074  * Note that it is not possible to specify coordinates with this structure.
00075  * This is intentional; all coordinate I/O is done with the read_timestep and 
00076  * write_timestep functions. 
00077  */
00078 
00082 typedef struct {
00083   /* these fields absolutely must be set or initialized to empty */
00084   char name[16];      
00085   char type[16];      
00086   char resname[8];    
00087   int resid;          
00088   char segid[8];      
00089   char chain[2];      
00091   /* rest are optional; use optflags to specify what's present   */
00092   char altloc[2];     
00093   char insertion[2];  
00094   float occupancy;    
00095   float bfactor;      
00096   float mass;         
00097   float charge;       
00098   float radius;       
00099   int atomicnumber;   
00100 } molfile_atom_t;
00101 
00104 #define MOLFILE_NOOPTIONS     0x0000 
00105 #define MOLFILE_INSERTION     0x0001 
00106 #define MOLFILE_OCCUPANCY     0x0002 
00107 #define MOLFILE_BFACTOR       0x0004 
00108 #define MOLFILE_MASS          0x0008 
00109 #define MOLFILE_CHARGE        0x0010 
00110 #define MOLFILE_RADIUS        0x0020 
00111 #define MOLFILE_ALTLOC        0x0040 
00112 #define MOLFILE_ATOMICNUMBER  0x0080 
00113 #define MOLFILE_BONDSSPECIAL  0x0100 
00114 #define MOLFILE_BADOPTIONS    0xFFFFFFFF 
00117 
00118 #if vmdplugin_ABIVERSION > 10
00119 typedef struct molfile_timestep_metadata {
00120   unsigned count;      
00121   unsigned avg_bytes_per_timestep; 
00122   int has_velocities;  
00124 } molfile_timestep_metadata_t;
00125 #endif
00126 
00127 /*
00128  * Per-timestep atom coordinates and periodic cell information
00129  */ 
00130 typedef struct {
00131   float *coords;  
00132   float *velocities; 
00142   float A, B, C, alpha, beta, gamma; 
00145   double physical_time; 
00146 } molfile_timestep_t;
00147 
00148 
00153 typedef struct {
00154   char dataname[256]; 
00156   float origin[3];    
00158   /*
00159    * x/y/z axis:
00160    * These the three cell sides, providing both direction and length
00161    * (not unit vectors) for the x, y, and z axes.  In the simplest
00162    * case, these would be <size,0,0> <0,size,0> and <0,0,size) for 
00163    * an orthogonal cubic volume set.  For other cell shapes these
00164    * axes can be oriented non-orthogonally, and the parallelpiped
00165    * may have different side lengths, not just a cube/rhombus.
00166    */
00167   float xaxis[3];     
00168   float yaxis[3];     
00169   float zaxis[3];     
00171   /*
00172    * x/y/z size: 
00173    * Number of grid cells along each axis.  This is _not_ the
00174    * physical size of the box, this is the number of voxels in each
00175    * direction, independent of the shape of the volume set. 
00176    */
00177   int xsize;          
00178   int ysize;          
00179   int zsize;          
00181   int has_color;      
00182 } molfile_volumetric_t;
00183 
00184 
00185 /* XXX disabled until next major plugin ABI rev */
00186 #if vmdplugin_ABIVERSION > 9
00187 
00192 typedef struct {
00193   /* hessian data */
00194   unsigned int nimag;            /* number of imaginary modes */
00195   unsigned int nintcoords;       /* number of internal coordinates */
00196   unsigned int ncart;            /* number of cartesian coordinates */
00197 
00198   /* orbital data */
00199   unsigned int num_basis_funcs;  /* number of uncontracted basis functions in basis array */
00200   unsigned int num_shells;       /* total number of atomic shells */
00201   unsigned int orbital_counter;  /* counts the number of orbitals present in the output file */
00202 
00203   /* everything else */
00204   unsigned int num_traj_points;  /* number of trajectory points, 1 for single point runs */
00205   unsigned int have_trajectory;  /* flag indicating trajectory data */
00206 } molfile_qm_metadata_t;
00207 
00208 
00213 typedef struct {
00214   double *carthessian;      /* hessian matrix in cartesian coordinates (ncart)*(ncart) as a single array of doubles (row(1), ...,row(natoms)) */
00215   int *imag_modes;          /* list(nimag) of imaginary modes */
00216   double *inthessian;       /* hessian matrix in internal coordinates (nintcoords*nintcoords) as a single array of doubles (row(1), ...,row(nintcoords)) */
00217   double *wavenumbers;      /* array(ncart) of wavenumbers of normal modes */
00218   double *intensities;      /* array(ncart) of intensities of normal modes */
00219   double *normalmodes;      /* matrix(ncart*ncart) of normal modes  */
00220 } molfile_qm_hessian_t;
00221 
00222 
00227 typedef struct {
00228   unsigned int *basis_counter;    /* array holding the number of basis function per atom i */
00229   unsigned int *atomic_shells;    /* number of shells per atom i */
00230   unsigned int *shell_primitives; /* number of shell primitives shell i */
00231   unsigned int homo_index;        /* index "pointing" to the HOMO */
00232 
00233   float *basis;                   /* array holding the contraction coeffients and exponents for the basis functions in the form { exp(1), c-coeff(1), exp(2), c-coeff(2), ....}; of size 2*num_basis_funcs */
00234   char *orbital_symmetry;         /* symmetry type (S, L, P, ..) per (exp(),c-coeff()) pair in basis */
00235 } molfile_qm_orbital_t;
00236 
00237 
00241 typedef struct {
00242   unsigned int runtyp;                  /* runtyp for internal use */
00243   unsigned int nproc;                   /* number of processors used */
00244   unsigned int num_gauss_basis_funcs;   /* number of gaussian basis functions */
00245   unsigned int num_electrons;           /* number of electrons */
00246   unsigned int totalcharge;             /* total charge of system */
00247   unsigned int multiplicity;            /* multiplicity of system */
00248   unsigned int num_orbitals_A;          /* number of alpha orbitals */
00249   unsigned int num_orbitals_B;          /* number of beta orbitals */
00250   unsigned int scftyp;                  /* scftyp for internal use */
00251   unsigned int ngauss;                  /* number of gaussian basis functions */
00252   unsigned int npfunc;                  /* number of p polarization functions: 0 ..3 */
00253   unsigned int ndfunc;                  /* number of d polarization functions: 0 ..3 */
00254   unsigned int nffunc;                  /* number of f polarization functions: 0 or 1 */
00255   unsigned int diffs;                   /* number of diffuse s functions: 0 or 1 */
00256   unsigned int diffsp;                  /* number of diffuse sp functions: 0 or 1 */
00257   double *nuc_charge;                   /* array(natom) containing the nuclear charge of atom i */
00258 
00259   char runtyp_string[MOLFILE_BUFSIZ];   /* runtyp as string for punching */
00260   char scftyp_string[MOLFILE_BUFSIZ];   /* scftyp as string for punching */
00261   char basis_string[MOLFILE_BUFSIZ];    /* basis name as "nice" string for punch
00262 ing */
00263   char memory[MOLFILE_BUFSIZ];          /* amount of memory used, e.g. 1Gb */
00264   char gbasis[MOLFILE_BUFSIZ];          /* type of gbasis used, e.g. N21, N31, N
00265 311, ... */
00266   char runtitle[MOLFILE_BUFSIZ];        /* title of run */
00267   char guess[MOLFILE_BUFSIZ];           /* guess option used */
00268   char geometry[MOLFILE_BUFSIZ];        /* typ of provided geometry, e.g. UNIQUE
00269 , ZMT, CART, ... */
00270   char version_string[MOLFILE_BUFSIZ];  /* QM code version information */
00271 } molfile_qm_sysinfo_t;
00272 
00273 
00277 typedef struct {
00278   float *wave_function;     /* expansion coefficients for wavefunction in the form {orbital1(c1),orbital1(c2),.....,orbi talM(cN)} */
00279 #if vmdplugin_ABIVERSION > 11
00280   int   scfiter;            /* number of SCF iterations */
00281 #endif
00282   double *scfenergies;      /* scfenergies per trajectory point */
00283   double *mulliken_charges; /* per-atom Mulliken charges */
00284   double *lowdin_charges;   /* per-atom Lowdin charges */
00285   double *esp_charges;      /* per-atom esp charges */
00286   double *npa_charges;      /* per-atom npa charges */
00287 } molfile_qm_timestep_t;
00288 
00289 
00293 typedef struct {
00294   molfile_qm_hessian_t hess;            /* hessian info */
00295   molfile_qm_orbital_t orb;             /* orbital info */
00296   molfile_qm_sysinfo_t run;             /* system info  */
00297 } molfile_qm_t;
00298 
00299 
00300 #endif
00301 
00302 
00307 enum molfile_graphics_type {
00308   MOLFILE_POINT,  MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, 
00309   MOLFILE_LINE,   MOLFILE_CYLINDER, MOLFILE_CAPCYL,  MOLFILE_CONE,    
00310   MOLFILE_SPHERE, MOLFILE_TEXT,     MOLFILE_COLOR,   MOLFILE_TRICOLOR
00311 };
00312 
00316 typedef struct {
00317   int type;             /* One of molfile_graphics_type */
00318   int style;            /* A general style parameter    */
00319   float size;           /* A general size parameter     */
00320   float data[9];        /* All data for the element     */
00321 } molfile_graphics_t;
00322 
00323 
00324 /*
00325  * Types for raw graphics elements stored in files.  Data for each type
00326  * should be stored by the plugin as follows:
00327 
00328 type        data                                     style       size
00329 ----        ----                                     -----       ----
00330 point       x, y, z                                              pixel size
00331 triangle    x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00332 trinorm     x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00333             the next array element must be NORMS
00334 tricolor    x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00335             the next array elements must be NORMS
00336             the following element must be COLOR, with three RGB triples
00337 norms       x1,y1,z1,x2,y2,z2,x3,y3,z3                 
00338 line        x1,y1,z1,x2,y2,z2                        0=solid     pixel width
00339                                                      1=stippled
00340 cylinder    x1,y1,z1,x2,y2,z2                        resolution  radius
00341 capcyl      x1,y1,z1,x2,y2,z2                        resolution  radius
00342 sphere      x1,y1,z1                                 resolution  radius
00343 text        x, y, z, up to 24 bytes of text                      pixel size
00344 color       r, g, b
00345 */
00346 
00347 
00353 typedef struct {
00357   vmdplugin_HEAD
00358 
00369   const char *filename_extension;
00370 
00379   void *(* open_file_read)(const char *filepath, const char *filetype, 
00380       int *natoms);
00381   
00389   int (*read_structure)(void *, int *optflags, molfile_atom_t *atoms);
00390 
00410   int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder);
00411 
00426   int (* read_next_timestep)(void *, int natoms, molfile_timestep_t *);
00427 
00431   void (* close_file_read)(void *);
00432    
00439   void *(* open_file_write)(const char *filepath, const char *filetype, 
00440       int natoms);
00441   
00445   int (* write_structure)(void *, int optflags, const molfile_atom_t *atoms);
00446 
00453   int (* write_timestep)(void *, const molfile_timestep_t *);
00454   
00458   void (* close_file_write)(void *);
00459 
00467   int (* read_volumetric_metadata)(void *, int *nsets, 
00468         molfile_volumetric_t **metadata);
00469 
00478   int (* read_volumetric_data)(void *, int set, float *datablock, 
00479         float *colorblock);
00480 
00487   int (* read_rawgraphics)(void *, int *nelem, const molfile_graphics_t **data);
00488 
00495   int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata);
00496   
00508   int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder);
00509 
00510 /* XXX disabled until next major plugin ABI rev */
00511 #if vmdplugin_ABIVERSION > 9
00512 
00519   int (* write_volumetric_data)(void *, molfile_volumetric_t *metadata,
00520                                 float *datablock, float *colorblock);
00521 
00528   int (* read_angles)(void *,
00529                 int *numangles,    int *angles,    double *angleforces,
00530                 int *numdihedrals, int *dihedrals, double *dihedralforces,
00531                 int *numimpropers, int *impropers, double *improperforces,
00532                 int *numcterms,    int *cterms, 
00533                 int *ctermcols, int *ctermrows, double *ctermforces);
00534 
00541   int (* write_angles)(void *,
00542         int numangles,    const int *angles,    const double *angleforces,
00543         int numdihedrals, const int *dihedrals, const double *dihedralforces,
00544         int numimpropers, const int *impropers, const double *improperforces,
00545         int numcterms,   const int *cterms,    
00546         int ctermcols, int ctermrows, const double *ctermforces);
00547 
00551   int (* read_qm_metadata)(void *, molfile_qm_metadata_t *metadata);
00552 
00556   int (* read_qm_rundata)(void *, molfile_qm_t *qmdata);
00557 
00575   int (* read_timestep)(void *, int natoms, molfile_timestep_t *,
00576                         molfile_qm_metadata_t *, molfile_qm_timestep_t *);
00577 #endif
00578 
00579 #if vmdplugin_ABIVERSION > 10
00580   int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *);
00581 #endif
00582 
00583 } molfile_plugin_t;
00584 
00585 #endif
00586 

Generated on Thu Aug 28 01:40:10 2008 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002