00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 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: MolFilePlugin.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.45 $ $Date: 2019年01月17日 21:21:00 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * VMD interface to 'molfile' plugins. Molfile plugins read coordinate 00019 * files, structure files, volumetric data, and graphics data. The data 00020 * is loaded into a new or potentially preexisting molecule in VMD. 00021 * 00022 * LICENSE: 00023 * UIUC Open Source License 00024 * http://www.ks.uiuc.edu/Research/vmd/plugins/pluginlicense.html 00025 * 00026 ***************************************************************************/ 00027 #ifndef MOL_FILE_PLUGIN_H__ 00028 #define MOL_FILE_PLUGIN_H__ 00029 00030 class Molecule; 00031 class Timestep; 00032 class AtomSel; 00033 class Scene; 00034 class QMData; 00035 00036 #include <stdlib.h> // for NULL 00037 #include "molfile_plugin.h" 00038 00042 class MolFilePlugin { 00043 private: 00044 molfile_plugin_t *plugin; 00045 void *rv; 00046 void *wv; 00047 int numatoms; 00048 char *_filename; 00049 QMData *qm_data; 00050 void close(); 00051 00052 public: 00053 MolFilePlugin(vmdplugin_t *p); 00054 virtual ~MolFilePlugin(); 00055 00056 // test whether the plugin supports various capabilities 00057 const char *name() const { return plugin->name; } 00058 const char *prettyname() const { return plugin->prettyname; } 00059 const char *extension() const { return plugin->filename_extension; } 00060 00061 int can_read_structure() const { return plugin->read_structure != NULL; } 00062 int can_read_bonds() const { return plugin->read_bonds != NULL; } 00063 int can_read_pagealigned_timesteps() const { 00064 #if vmdplugin_ABIVERSION > 17 00065 return plugin->read_timestep_pagealign_size != NULL; 00066 #else 00067 return 0; 00068 #endif 00069 } 00070 int can_read_timesteps() const { return plugin->read_next_timestep != NULL;} 00071 int can_read_graphics() const { return plugin->read_rawgraphics != NULL; } 00072 int can_read_volumetric() const { return plugin->read_volumetric_metadata != NULL; } 00073 int can_read_metadata() const { return plugin->read_molecule_metadata != NULL; } 00074 int can_read_qm() const { return plugin->read_qm_metadata != NULL; } 00075 int can_read_qm_timestep() { return plugin->read_timestep != NULL; } 00076 int can_read_angles() { return plugin->read_angles != NULL; } 00077 int can_read_timestep_metadata() { return plugin->read_timestep_metadata != NULL; } 00078 int can_read_qm_timestep_metadata() { return plugin->read_qm_timestep_metadata != NULL; } 00079 00080 int can_write_structure() const { return plugin->write_structure != NULL; } 00081 int can_write_bonds() const { return plugin->write_bonds != NULL; } 00082 int can_write_timesteps() const { return plugin->write_timestep != NULL; } 00083 int can_write_angles() { return plugin->read_angles != NULL; } 00084 int can_write_volumetric() const { return plugin->write_volumetric_data != NULL; } 00085 00086 int init_read(const char *file); 00087 00088 00089 00090 int natoms() const { return numatoms; } 00091 00092 void set_natoms(int); 00093 00094 00095 00096 int read_structure(Molecule *m, int filebonds, int autobonds); 00097 00098 00099 00100 00105 int read_optional_structure(Molecule *m, int filebonds); 00106 00119 int read_timestep_pagealign_size(void); 00120 00121 Timestep *next(Molecule *m, int ts_pagealign_sz=1); 00122 int skip(Molecule *m); 00123 00125 int read_rawgraphics(Molecule *, Scene *); 00126 00129 int read_volumetric(Molecule *, int nsets, const int *setids); 00130 00132 int read_metadata(Molecule *); 00133 00135 int read_qm_data(Molecule *); 00136 00137 int init_write(const char *file, int natoms); 00138 00143 int write_structure(Molecule *, const int *sel); 00144 int write_timestep(const Timestep *, const int *sel); 00145 00147 int write_volumetric(Molecule *, int set); 00148 00149 }; 00150 00151 #endif 00152