1 /* -*- c++ -*- */ 2 #ifndef TRANSREADER_H 3 #define TRANSREADER_H 4 5 #include "Reader.h" 6 #include "TRANS.h" 7 #include "Array.h" 8 9 namespace ProtoMol { 10 11 //_________________________________________________________________TRANSReader 12 class TRANSReader : public Reader { 13 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 14 // Types and Enums 15 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 private: 17 enum TRANSRecordTypeEnum { 18 UNDEFINED, 19 IDENTITIES, 20 STAGES, 21 IDEAL_GAS_DELTAMU, 22 ATOMTYPE, 23 ATOMCHARGE 24 }; 25 26 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 // Constructors, destructors (both default here), assignment 28 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 public: 30 explicit TRANSReader(); 31 explicit TRANSReader(const std::string& filename); 32 explicit TRANSReader(const char* filename); 33 // Need this implementation, otherwise const char* will be converted to bool or int ... 34 35 virtual ~TRANSReader(); 36 37 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 // From class File 39 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 40 public: open()41 virtual bool open(){return File::open();}; open(const std::string & filename)42 virtual bool open(const std::string& filename){return File::open(filename);}; open(const char * filename)43 virtual bool open(const char* filename){return File::open(filename);} 44 45 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 46 // From class Reader 47 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 48 public: 49 virtual bool tryFormat(); 50 virtual bool read(); 51 52 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 53 // New methods of class TRANS 54 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 public: 56 bool read(TRANS& trans); 57 58 TRANS* orphanTRANS(); 59 60 // stream operator 61 friend TRANSReader& operator>>(TRANSReader& transReader, TRANS& trans); 62 63 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 64 // My data members 65 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 66 private: 67 TRANS* myTRANS; 68 69 // the number of different identities for each atom type 70 int numIdentities; 71 72 // the number of stages to break the molecular transformation into 73 int numStages; 74 75 // the number of different atom types in the system 76 int numTypes; 77 78 // array containing the different atom type names 79 std::vector<std::string> myTypes; 80 81 // flag so we know if the ideal gas chemical potential difference 82 // matrix has been sized 83 bool sized; 84 85 // flag so we know if any alphaLJ parameters have been specified 86 bool got_alphaLJ; 87 }; 88 89 //____________________________________________________________________________INLINES 90 91 } 92 #endif /* TRANSREADER_H */ 93