/****************************************************************************** This source file is part of the Avogadro project. This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #ifndef AVOGADRO_QUANTUMIO_GAMESSUKOUT_H #define AVOGADRO_QUANTUMIO_GAMESSUKOUT_H #include #include #include #include #define BUFF_SIZE 32768 class QString; namespace Avogadro { namespace QuantumIO { using Quantum::GaussianSet; using Quantum::orbital; /** * This class is used to hold the data parsed from the GAMESS-UK output * before we create the Avogadro basis set object */ class GUKBasisSet { public: GUKBasisSet() {} ~GUKBasisSet() {} void outputCoord(); void outputBasis(); /** * Return true if we have already processed an atom of this label type */ bool labelIndex(std::string label); /** * Return the enum from basis.h for the supplied label as a string * basisset.h: enum orbital { S, SP, P, D, D5, F, F7, UU }; */ orbital shellTypeFromString(std::string label); std::vector atomLabels; // ordered list of atom labels mapping to coordinates std::vector coordinates; // Coordinates in Bohr std::vector shellLabels; // list of atom labels for the basis functions std::vector> shells; // vector of shell types for each // atom (use basisset.h orbital enum // here) std::vector> gtoIndicies; // Vector of vector of // index of where the GTO // for a particular shell // ends std::vector gtoExponents; // list of exponents std::vector gtoCoefficients; // list of contraction coefficients // Need to look at what to do about uhf calculations std::vector moEnergies; // list of the energies of the MOs std::vector> moVectors; // list of list of MO vectors in order of moEnergies // These are read in after the basis is printed and used by readMOVectors - // could use to check the basis has been parsed correctly too int nShell; int nBasisFunctions; int nElectrons; }; class GamessukOut { public: GamessukOut(const QString& filename, GaussianSet* basis); ~GamessukOut(); void GamessukOutNoQt(const std::string& filename, GaussianSet* basis); void outputParsedData(); private: bool parseFile(std::ifstream& ifs); void readInitialCoordinates(std::ifstream& ifs); void readBasisSet(std::ifstream& ifs); inline void addSpBasis(std::vector s_coeff, std::vector p_coeff, std::vector sp_exponents); void readOptimisedCoordinates(std::ifstream& ifs); void readMOs(std::ifstream& ifs); int readMOVectors(std::ifstream& ifs); void load(GaussianSet* basis); void addBasisForLabel(unsigned int atomIndex, std::string label, GaussianSet* basis); // This holds the basis data parsed in from the file and which is used to // create the BasisSet GUKBasisSet gukBasis; // For parsing the file char buffer[BUFF_SIZE]; std::string line; std::vector tokens; }; } // namespace QuantumIO } // namespace Avogadro #endif