| 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_GAUSSIANFCHK_H |
| 7 |
#define AVOGADRO_QUANTUMIO_GAUSSIANFCHK_H |
| 8 |
|
| 9 |
#include "avogadroquantumioexport.h" |
| 10 |
|
| 11 |
#include <avogadro/core/array.h> |
| 12 |
#include <avogadro/core/gaussianset.h> |
| 13 |
#include <avogadro/io/fileformat.h> |
| 14 |
|
| 15 |
#include <vector> |
| 16 |
|
| 17 |
namespace Avogadro { |
| 18 |
namespace QuantumIO { |
| 19 |
|
| 20 |
class AVOGADROQUANTUMIO_EXPORT GaussianFchk : public Io::FileFormat |
| 21 |
{ |
| 22 |
public: |
| 23 |
GaussianFchk(); |
| 24 |
~GaussianFchk() override; |
| 25 |
|
| 26 |
Operations supportedOperations() const override |
| 27 |
{ |
| 28 |
return Read | File | Stream | String; |
| 29 |
} |
| 30 |
|
| 31 |
FileFormat* newInstance() const override { return new GaussianFchk; } |
| 32 |
std::string identifier() const override { return "Avogadro: FCHK"; } |
| 33 |
std::string name() const override { return "Gaussian FCHK"; } |
| 34 |
std::string description() const override |
| 35 |
{ |
| 36 |
return "Gaussian formatted checkpoint reader."; |
| 37 |
} |
| 38 |
|
| 39 |
std::string specificationUrl() const override |
| 40 |
{ |
| 41 |
return "https://web.archive.org/web/20161203183148/http://www.gaussian.com/" |
| 42 |
"g_tech/g_ur/f_formchk.htm"; |
| 43 |
// https://gaussian.com/formchk/ |
| 44 |
} |
| 45 |
|
| 46 |
std::vector<std::string> fileExtensions() const override; |
| 47 |
std::vector<std::string> mimeTypes() const override; |
| 48 |
|
| 49 |
[[nodiscard]] bool read(std::istream& in, Core::Molecule& molecule) override; |
| 50 |
[[nodiscard]] bool write(std::ostream&, const Core::Molecule&) override |
| 51 |
{ |
| 52 |
// Empty, as we do not write out Gaussian FCHK files. |
| 53 |
return false; |
| 54 |
} |
| 55 |
|
| 56 |
void outputAll(); |
| 57 |
|
| 58 |
private: |
| 59 |
void processLine(std::istream& in); |
| 60 |
void load(Core::GaussianSet* basis); |
| 61 |
std::vector<int> readArrayI(std::istream& in, unsigned int n); |
| 62 |
std::vector<double> readArrayD(std::istream& in, unsigned int n, |
| 63 |
int width = 0, double factor = 1.0); |
| 64 |
bool readDensityMatrix(std::istream& in, unsigned int n, int width = 0); |
| 65 |
bool readSpinDensityMatrix(std::istream& in, unsigned int n, int width = 0); |
| 66 |
|
| 67 |
/** |
| 68 |
* Use either m_electrons, or m_electronsAlpha and m_electronsBeta. |
| 69 |
* This then carries through to the energy, coefficients etc. |
| 70 |
*/ |
| 71 |
int m_electrons; |
| 72 |
int m_electronsAlpha; |
| 73 |
int m_electronsBeta; |
| 74 |
int m_normalModes; |
| 75 |
int m_numAtoms; |
| 76 |
int m_spin; |
| 77 |
int m_charge; |
| 78 |
unsigned int m_numBasisFunctions; |
| 79 |
std::vector<int> m_aNums; |
| 80 |
std::vector<double> m_aPos; |
| 81 |
std::vector<double> m_mullikenCharges; |
| 82 |
std::vector<int> m_shellTypes; |
| 83 |
std::vector<int> m_shellNums; |
| 84 |
std::vector<int> m_shelltoAtom; |
| 85 |
std::vector<double> m_a; |
| 86 |
std::vector<double> m_c; |
| 87 |
std::vector<double> m_csp; |
| 88 |
std::vector<double> m_orbitalEnergy; |
| 89 |
std::vector<double> m_alphaOrbitalEnergy; |
| 90 |
std::vector<double> m_betaOrbitalEnergy; |
| 91 |
std::vector<double> m_MOcoeffs; |
| 92 |
std::vector<double> m_alphaMOcoeffs; |
| 93 |
std::vector<double> m_betaMOcoeffs; |
| 94 |
MatrixX m_density; /// Total density matrix |
| 95 |
MatrixX m_spinDensity; /// Spin density matrix |
| 96 |
Vector3 m_dipoleMoment = Vector3::Zero(); |
| 97 |
Core::ScfType m_scftype; |
| 98 |
|
| 99 |
Core::Array<double> m_frequencies; |
| 100 |
Core::Array<double> m_IRintensities; |
| 101 |
Core::Array<double> m_RamanIntensities; |
| 102 |
Core::Array<Core::Array<Vector3>> m_vibDisplacements; |
| 103 |
}; |
| 104 |
|
| 105 |
} // namespace QuantumIO |
| 106 |
} // namespace Avogadro |
| 107 |
|
| 108 |
#endif |