00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #ifndef MOL_FILE_PLUGIN_H
00024 #define MOL_FILE_PLUGIN_H
00025
00026 #include "vmdplugin.h"
00027
00028 #if defined(DESRES_READ_TIMESTEP2)
00029
00030 #include <sys/types.h>
00031 typedef ssize_t molfile_ssize_t;
00032 #endif
00033
00037 #define MOLFILE_PLUGIN_TYPE "mol file reader"
00038
00043 #define MOLFILE_CONVERTER_PLUGIN_TYPE "mol file converter"
00044
00045
00046 #define MOLFILE_SUCCESS 0
00047 #define MOLFILE_EOF -1
00048 #define MOLFILE_ERROR -1
00049 #define MOLFILE_NOSTRUCTUREDATA -2
00051 #define MOLFILE_NUMATOMS_UNKNOWN -1
00052 #define MOLFILE_NUMATOMS_NONE 0
00057 #define MOLFILE_BUFSIZ 81
00058 #define MOLFILE_BIGBUFSIZ 4096
00060 #define MOLFILE_MAXWAVEPERTS 25
00075 #define MOLFILE_DIRECTIO_MIN_BLOCK_SIZE 4096
00076 #define MOLFILE_DIRECTIO_MAX_BLOCK_SIZE 4096
00077
00078
00082 typedef struct {
00083 char database[81];
00084 char accession[81];
00085 char date[81];
00086 char title[81];
00087 int remarklen;
00088 char *remarks;
00089 } molfile_metadata_t;
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00107 typedef struct {
00108
00109 char name[16];
00110 char type[16];
00111 char resname[8];
00112 int resid;
00113 char segid[8];
00114 #if 0 && vmdplugin_ABIVERSION > 10000
00115
00116
00117
00118
00119
00120
00121 char chain[4];
00122 #else
00123 char chain[2];
00124 #endif
00125
00126 char altloc[2];
00127 char insertion[2];
00128 float occupancy;
00129 float bfactor;
00130 float mass;
00131 float charge;
00132 float radius;
00133 int atomicnumber;
00135 #if 0
00136 char complex[16];
00137 char assembly[16];
00138 int qmregion;
00139 int qmregionlink;
00140 int qmlayer;
00141 int qmlayerlink;
00142 int qmfrag;
00143 int qmfraglink;
00144 string qmecp;
00145 int qmadapt;
00146 int qmect;
00147 int qmparam;
00148 int autoparam;
00149 #endif
00150
00151 #if defined(DESRES_CTNUMBER)
00152 int ctnumber;
00153 #endif
00154 } molfile_atom_t;
00155
00158 #define MOLFILE_NOOPTIONS 0x0000
00159 #define MOLFILE_INSERTION 0x0001
00160 #define MOLFILE_OCCUPANCY 0x0002
00161 #define MOLFILE_BFACTOR 0x0004
00162 #define MOLFILE_MASS 0x0008
00163 #define MOLFILE_CHARGE 0x0010
00164 #define MOLFILE_RADIUS 0x0020
00165 #define MOLFILE_ALTLOC 0x0040
00166 #define MOLFILE_ATOMICNUMBER 0x0080
00167 #define MOLFILE_BONDSSPECIAL 0x0100
00168 #if defined(DESRES_CTNUMBER)
00169 #define MOLFILE_CTNUMBER 0x0200
00170 #endif
00171 #define MOLFILE_BADOPTIONS 0xFFFFFFFF
00174
00175
00179 #define MOLFILE_QMTS_NOOPTIONS 0x0000
00180 #define MOLFILE_QMTS_GRADIENT 0x0001
00181 #define MOLFILE_QMTS_SCFITER 0x0002
00182
00184 typedef struct molfile_timestep_metadata {
00185 unsigned int count;
00186 unsigned int avg_bytes_per_timestep;
00187 int has_velocities;
00188 } molfile_timestep_metadata_t;
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 #if 0
00199
00202 typedef struct {
00203 int energyflags;
00204
00205 double total_energy;
00206 double potential_energy;
00207 double kinetic_energy;
00208 double extended_energy;
00209 double force_energy;
00210 double total_pressure;
00211
00212
00213
00214 double lambda;
00215 double temperature;
00216
00217 double deltaU;
00218 double Ulambda;
00219 double Ulambdaprime;
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 } molfile_energies_t;
00231 #endif
00232
00233
00238 typedef struct {
00239 float *coords;
00240 float *velocities;
00251 float A, B, C, alpha, beta, gamma;
00254 double physical_time;
00256 #if defined(DESRES_READ_TIMESTEP2)
00257
00258 double total_energy;
00259 double potential_energy;
00260 double kinetic_energy;
00261 double extended_energy;
00262 double force_energy;
00263 double total_pressure;
00264 #endif
00265
00266 } molfile_timestep_t;
00267
00268
00273 typedef struct {
00274 char dataname[256];
00275 float origin[3];
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286 float xaxis[3];
00287 float yaxis[3];
00288 float zaxis[3];
00290
00291
00292
00293
00294
00295
00296 int xsize;
00297 int ysize;
00298 int zsize;
00300 #if vmdplugin_ABIVERSION > 16
00301 int has_scalar;
00302 int has_gradient;
00303 int has_variance;
00304 #endif
00305 int has_color;
00306 } molfile_volumetric_t;
00307
00308
00309 #if vmdplugin_ABIVERSION > 16
00310
00314 typedef struct {
00315 int setidx;
00316 float *scalar;
00317 float *gradient;
00318 float *variance;
00319 float *rgb3f;
00320 unsigned char *rgb3u;
00321 } molfile_volumetric_readwrite_t;
00322 #endif
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 #define MOLFILE_QMSTATUS_UNKNOWN -1
00335 #define MOLFILE_QMSTATUS_OPT_CONV 0
00336 #define MOLFILE_QMSTATUS_SCF_NOT_CONV 1
00337 #define MOLFILE_QMSTATUS_OPT_NOT_CONV 2
00338 #define MOLFILE_QMSTATUS_FILE_TRUNCATED 3
00339
00340
00341 #define MOLFILE_SCFTYPE_UNKNOWN -1
00342 #define MOLFILE_SCFTYPE_NONE 0
00343 #define MOLFILE_SCFTYPE_RHF 1
00344 #define MOLFILE_SCFTYPE_UHF 2
00345 #define MOLFILE_SCFTYPE_ROHF 3
00346 #define MOLFILE_SCFTYPE_GVB 4
00347 #define MOLFILE_SCFTYPE_MCSCF 5
00348 #define MOLFILE_SCFTYPE_FF 6
00349
00350
00351 #define MOLFILE_RUNTYPE_UNKNOWN 0
00352 #define MOLFILE_RUNTYPE_ENERGY 1
00353 #define MOLFILE_RUNTYPE_OPTIMIZE 2
00354 #define MOLFILE_RUNTYPE_SADPOINT 3
00355 #define MOLFILE_RUNTYPE_HESSIAN 4
00356 #define MOLFILE_RUNTYPE_SURFACE 5
00357 #define MOLFILE_RUNTYPE_GRADIENT 6
00358 #define MOLFILE_RUNTYPE_MEX 7
00359 #define MOLFILE_RUNTYPE_DYNAMICS 8
00360
00361
00362 #define MOLFILE_RUNTYPE_PROPERTIES 9
00363
00364
00365
00371 typedef struct {
00372
00373 int nimag;
00374 int nintcoords;
00375 int ncart;
00377
00378 int num_basis_funcs;
00379 int num_basis_atoms;
00380 int num_shells;
00381 int wavef_size;
00386
00387 int have_sysinfo;
00388 int have_carthessian;
00389 int have_inthessian;
00390 int have_normalmodes;
00391 } molfile_qm_metadata_t;
00392
00393
00397 typedef struct {
00398 int nproc;
00399 int memory;
00400 int runtype;
00401 int scftype;
00402 int status;
00404 int num_electrons;
00405 int totalcharge;
00406 int num_occupied_A;
00407 int num_occupied_B;
00409 double *nuc_charge;
00411 char basis_string[MOLFILE_BUFSIZ];
00412 char runtitle[MOLFILE_BIGBUFSIZ];
00413 char geometry[MOLFILE_BUFSIZ];
00415 char version_string[MOLFILE_BUFSIZ];
00416 } molfile_qm_sysinfo_t;
00417
00418
00422 typedef struct {
00423 int *num_shells_per_atom;
00424 int *num_prim_per_shell;
00426 float *basis;
00431 int *atomic_number;
00432 int *angular_momentum;
00436 int *shell_types;
00437 } molfile_qm_basis_t;
00438
00439
00452 typedef struct {
00453 double *carthessian;
00455 int *imag_modes;
00456 double *inthessian;
00459 float *wavenumbers;
00460 float *intensities;
00461 float *normalmodes;
00462 } molfile_qm_hessian_t;
00463
00464
00468 typedef struct {
00469 molfile_qm_sysinfo_t run;
00470 molfile_qm_basis_t basis;
00471 molfile_qm_hessian_t hess;
00472 } molfile_qm_t;
00473
00474
00475
00503 enum molfile_qm_wavefunc_type {
00504 MOLFILE_WAVE_CANON, MOLFILE_WAVE_GEMINAL,
00505 MOLFILE_WAVE_MCSCFNAT, MOLFILE_WAVE_MCSCFOPT,
00506 MOLFILE_WAVE_CINATUR,
00507 MOLFILE_WAVE_PIPEK, MOLFILE_WAVE_BOYS, MOLFILE_WAVE_RUEDEN,
00508 MOLFILE_WAVE_NAO, MOLFILE_WAVE_PNAO, MOLFILE_WAVE_NHO,
00509 MOLFILE_WAVE_PNHO, MOLFILE_WAVE_NBO, MOLFILE_WAVE_PNBO,
00510 MOLFILE_WAVE_PNLMO, MOLFILE_WAVE_NLMO, MOLFILE_WAVE_MOAO,
00511 MOLFILE_WAVE_NATO, MOLFILE_WAVE_UNKNOWN
00512 };
00513
00514
00519 enum molfile_qm_charge_type {
00520 MOLFILE_QMCHARGE_UNKNOWN,
00521 MOLFILE_QMCHARGE_MULLIKEN, MOLFILE_QMCHARGE_LOWDIN,
00522 MOLFILE_QMCHARGE_ESP, MOLFILE_QMCHARGE_NPA
00523 };
00524
00525
00526
00532 typedef struct molfile_qm_timestep_metadata {
00533 unsigned int count;
00534 unsigned int avg_bytes_per_timestep;
00535 int has_gradient;
00536 int num_scfiter;
00537 int num_orbitals_per_wavef[MOLFILE_MAXWAVEPERTS];
00538 int has_orben_per_wavef[MOLFILE_MAXWAVEPERTS];
00539 int has_occup_per_wavef[MOLFILE_MAXWAVEPERTS];
00540 int num_wavef ;
00541 int wavef_size;
00543 int num_charge_sets;
00544 } molfile_qm_timestep_metadata_t;
00545
00546
00550 typedef struct {
00551 int type;
00552 int spin;
00553 int excitation;
00554 int multiplicity;
00555 char info[MOLFILE_BUFSIZ];
00557 double energy;
00561 float *wave_coeffs;
00563 float *orbital_energies;
00564 float *occupancies;
00565 int *orbital_ids;
00567 } molfile_qm_wavefunction_t;
00568
00569
00574 typedef struct {
00575 molfile_qm_wavefunction_t *wave;
00576 float *gradient;
00578 double *scfenergies;
00579 double *charges;
00580 int *charge_types;
00581 } molfile_qm_timestep_t;
00582
00583
00584
00585
00586
00587
00588
00589
00594 enum molfile_graphics_type {
00595 MOLFILE_POINT, MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS,
00596 MOLFILE_LINE, MOLFILE_CYLINDER, MOLFILE_CAPCYL, MOLFILE_CONE,
00597 MOLFILE_SPHERE, MOLFILE_TEXT, MOLFILE_COLOR, MOLFILE_TRICOLOR
00598 };
00599
00603 typedef struct {
00604 int type;
00605 int style;
00606 float size;
00607 float data[9];
00608 } molfile_graphics_t;
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00640 typedef struct {
00644 vmdplugin_HEAD
00645
00656 const char *filename_extension;
00657
00666 void *(* open_file_read)(const char *filepath, const char *filetype,
00667 int *natoms);
00668
00676 int (*read_structure)(void *, int *optflags, molfile_atom_t *atoms);
00677
00706 int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder,
00707 int **bondtype, int *nbondtypes, char ***bondtypename);
00708
00723 int (* read_next_timestep)(void *, int natoms, molfile_timestep_t *);
00724
00728 void (* close_file_read)(void *);
00729
00736 void *(* open_file_write)(const char *filepath, const char *filetype,
00737 int natoms);
00738
00742 int (* write_structure)(void *, int optflags, const molfile_atom_t *atoms);
00743
00750 int (* write_timestep)(void *, const molfile_timestep_t *);
00751
00755 void (* close_file_write)(void *);
00756
00764 int (* read_volumetric_metadata)(void *, int *nsets,
00765 molfile_volumetric_t **metadata);
00766
00775 int (* read_volumetric_data)(void *, int set, float *datablock,
00776 float *colorblock);
00777 #if vmdplugin_ABIVERSION > 16
00778 int (* read_volumetric_data_ex)(void *, molfile_volumetric_readwrite_t *v);
00779 #endif
00780
00787 int (* read_rawgraphics)(void *, int *nelem, const molfile_graphics_t **data);
00788
00795 int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata);
00796
00819 int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder,
00820 int *bondtype, int nbondtypes, char **bondtypename);
00821
00829 int (* write_volumetric_data)(void *, molfile_volumetric_t *metadata,
00830 float *datablock, float *colorblock);
00831 #if vmdplugin_ABIVERSION > 16
00832 int (* write_volumetric_data_ex)(void *, molfile_volumetric_t *metadata,
00833 molfile_volumetric_readwrite_t *v);
00834 #endif
00835
00840 int (* read_angles)(void *handle, int *numangles, int **angles, int **angletypes,
00841 int *numangletypes, char ***angletypenames, int *numdihedrals,
00842 int **dihedrals, int **dihedraltypes, int *numdihedraltypes,
00843 char ***dihedraltypenames, int *numimpropers, int **impropers,
00844 int **impropertypes, int *numimpropertypes, char ***impropertypenames,
00845 int *numcterms, int **cterms, int *ctermcols, int *ctermrows);
00846
00851 int (* write_angles)(void *handle, int numangles, const int *angles, const int *angletypes,
00852 int numangletypes, const char **angletypenames, int numdihedrals,
00853 const int *dihedrals, const int *dihedraltypes, int numdihedraltypes,
00854 const char **dihedraltypenames, int numimpropers,
00855 const int *impropers, const int *impropertypes, int numimpropertypes,
00856 const char **impropertypenames, int numcterms, const int *cterms,
00857 int ctermcols, int ctermrows);
00858
00859
00871 int (* read_qm_metadata)(void *, molfile_qm_metadata_t *metadata);
00872
00873
00884 int (* read_qm_rundata)(void *, molfile_qm_t *qmdata);
00885
00886
00905 #if vmdplugin_ABIVERSION > 17
00906 int (* read_timestep_pagealign_size)(void *, int *pagealignsize);
00907 #endif
00908
00909
00927 int (* read_timestep)(void *, int natoms, molfile_timestep_t *,
00928 molfile_qm_metadata_t *, molfile_qm_timestep_t *);
00929
00930 int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *);
00931 int (* read_qm_timestep_metadata)(void *, molfile_qm_timestep_metadata_t *);
00932
00933
00934 #if defined(EXPERIMENTAL_DIRECTIO_APIS)
00935
00941 int (* calc_fileoffsets_timestep)(void *,
00942 molfile_ssize_t frameindex,
00943 int firstatom,
00944 int lastatom,
00945 int *firstatom,
00946 int *pageoffset,
00947 molfile_ssize_t *startoffset,
00948 molfile_ssize_t *readlen);
00949 #endif
00950
00951
00952 #if defined(DESRES_READ_TIMESTEP2)
00953
00956 int (* read_timestep2)(void *, molfile_ssize_t index, molfile_timestep_t *);
00957
00962 molfile_ssize_t (* read_times)( void *,
00963 molfile_ssize_t start,
00964 molfile_ssize_t count,
00965 double * times );
00966 #endif
00967
00985 int (* cons_fputs)(const int, const char*);
00986
00987 } molfile_plugin_t;
00988
00989 #endif
00990