00001
00002
00003
00004
00005 #ifndef BALL_FORMAT_GAMESSDATFILE_H
00006 #define BALL_FORMAT_GAMESSDATFILE_H
00007
00008 #ifndef BALL_FORMAT_GENERICMOLFILE_H
00009 # include <BALL/FORMAT/genericMolFile.h>
00010 #endif
00011
00012 #ifndef BALL_DATATYPE_STRINGHASHMAP_H
00013 # include <BALL/DATATYPE/stringHashMap.h>
00014 #endif
00015 namespace BALL
00016 {
00023 class BALL_EXPORT GAMESSDatFile
00024 : public GenericMolFile
00025 {
00026 public:
00027
00029 class block
00030 {
00031 public:
00033 String blockname;
00035 StringHashMap<String> data;
00036
00037 void operator >> (std::ostream& os) const;
00038
00039 };
00040
00042 struct State
00043 {
00044 GAMESSDatFile* current_parser;
00045 };
00046
00050
00053 GAMESSDatFile();
00054
00058 GAMESSDatFile(const String& filename, File::OpenMode open_mode = std::ios::in);
00059
00062 virtual ~GAMESSDatFile();
00063
00065
00068
00073 const GAMESSDatFile& operator = (const GAMESSDatFile& rhs);
00074
00076
00080
00086 virtual bool write(const Molecule& molecule);
00087
00093 virtual bool write(const System& molecule);
00094
00100 virtual Molecule* read();
00101
00107 virtual bool read(System& system);
00108
00110
00114 void newMolecule();
00115
00116 void setMoleculeName(char* name);
00117
00118 void insertAtom(char* element, float charge, float x, float y, float z);
00119
00120 void insertBond(Index a1, Index a2);
00121
00122 void inBlock(const char* blockname);
00123
00124 void insertBlockedData(const char* key, const char* value);
00125
00126 void insertBlockedData(const String& key, const String& value);
00127
00128 String& getBlockedData(const String& block, const String& key);
00129
00130 const String& getBlockedData(const String& block, const String& key) const;
00131
00132 void clearParameters();
00134
00135 static State state;
00136
00137 protected:
00138 virtual void initRead_();
00139
00140 Molecule* molecule_;
00141
00142 String current_block_;
00143 StringHashMap<block> blocks_;
00144 String symmetry_group_;
00145 };
00146 }
00147
00148 #endif // BALL_FORMAT_GAMESSDATFILE_H