| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_QUANTUMIO_GAMESSUKOUT_H |
| 7 |
#define AVOGADRO_QUANTUMIO_GAMESSUKOUT_H |
| 8 |
|
| 9 |
#include <avogadro/quantum/gaussianset.h> |
| 10 |
|
| 11 |
#include <Eigen/Core> |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
#define BUFF_SIZE 32768 |
| 17 |
|
| 18 |
class QString; |
| 19 |
|
| 20 |
namespace Avogadro { |
| 21 |
namespace QuantumIO { |
| 22 |
|
| 23 |
using Quantum::GaussianSet; |
| 24 |
using Quantum::orbital; |
| 25 |
|
| 26 |
/** |
| 27 |
* This class is used to hold the data parsed from the GAMESS-UK output |
| 28 |
* before we create the Avogadro basis set object |
| 29 |
*/ |
| 30 |
|
| 31 |
class GUKBasisSet |
| 32 |
{ |
| 33 |
public: |
| 34 |
GUKBasisSet() {} |
| 35 |
~GUKBasisSet() {} |
| 36 |
|
| 37 |
void outputCoord(); |
| 38 |
void outputBasis(); |
| 39 |
/** |
| 40 |
* Return true if we have already processed an atom of this label type |
| 41 |
*/ |
| 42 |
bool labelIndex(std::string label); |
| 43 |
|
| 44 |
/** |
| 45 |
* Return the enum from basis.h for the supplied label as a string |
| 46 |
* basisset.h: enum orbital { S, SP, P, D, D5, F, F7, UU }; |
| 47 |
*/ |
| 48 |
orbital shellTypeFromString(std::string label); |
| 49 |
|
| 50 |
std::vector<std::string> |
| 51 |
atomLabels; // ordered list of atom labels mapping to coordinates |
| 52 |
std::vector<Eigen::Vector3d> coordinates; // Coordinates in Bohr |
| 53 |
std::vector<std::string> |
| 54 |
shellLabels; // list of atom labels for the basis functions |
| 55 |
std::vector<std::vector<orbital>> shells; // vector of shell types for each |
| 56 |
// atom (use basisset.h orbital enum |
| 57 |
// here) |
| 58 |
std::vector<std::vector<unsigned int>> gtoIndicies; // Vector of vector of |
| 59 |
// index of where the GTO |
| 60 |
// for a particular shell |
| 61 |
// ends |
| 62 |
std::vector<double> gtoExponents; // list of exponents |
| 63 |
std::vector<double> gtoCoefficients; // list of contraction coefficients |
| 64 |
|
| 65 |
// Need to look at what to do about uhf calculations |
| 66 |
std::vector<double> moEnergies; // list of the energies of the MOs |
| 67 |
std::vector<std::vector<double>> |
| 68 |
moVectors; // list of list of MO vectors in order of moEnergies |
| 69 |
|
| 70 |
// These are read in after the basis is printed and used by readMOVectors - |
| 71 |
// could use to check the basis has been parsed correctly too |
| 72 |
int nShell; |
| 73 |
int nBasisFunctions; |
| 74 |
int nElectrons; |
| 75 |
}; |
| 76 |
|
| 77 |
class GamessukOut |
| 78 |
{ |
| 79 |
public: |
| 80 |
GamessukOut(const QString& filename, GaussianSet* basis); |
| 81 |
~GamessukOut(); |
| 82 |
void GamessukOutNoQt(const std::string& filename, GaussianSet* basis); |
| 83 |
void outputParsedData(); |
| 84 |
|
| 85 |
private: |
| 86 |
bool parseFile(std::ifstream& ifs); |
| 87 |
void readInitialCoordinates(std::ifstream& ifs); |
| 88 |
void readBasisSet(std::ifstream& ifs); |
| 89 |
inline void addSpBasis(std::vector<double> s_coeff, |
| 90 |
std::vector<double> p_coeff, |
| 91 |
std::vector<double> sp_exponents); |
| 92 |
void readOptimisedCoordinates(std::ifstream& ifs); |
| 93 |
void readMOs(std::ifstream& ifs); |
| 94 |
int readMOVectors(std::ifstream& ifs); |
| 95 |
|
| 96 |
void load(GaussianSet* basis); |
| 97 |
|
| 98 |
void addBasisForLabel(unsigned int atomIndex, std::string label, |
| 99 |
GaussianSet* basis); |
| 100 |
|
| 101 |
// This holds the basis data parsed in from the file and which is used to |
| 102 |
// create the BasisSet |
| 103 |
GUKBasisSet gukBasis; |
| 104 |
|
| 105 |
// For parsing the file |
| 106 |
char buffer[BUFF_SIZE]; |
| 107 |
std::string line; |
| 108 |
std::vector<std::string> tokens; |
| 109 |
}; |
| 110 |
|
| 111 |
} // namespace QuantumIO |
| 112 |
} // namespace Avogadro |
| 113 |
|
| 114 |
#endif |