Debian Codegraph @

avogadro/quantumio/molden.h

raw
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_MOLDEN_H
7 #define AVOGADRO_QUANTUMIO_MOLDEN_H
8
9 #include "avogadroquantumioexport.h"
10 #include <avogadro/core/array.h>
11 #include <avogadro/core/gaussianset.h>
12 #include <avogadro/io/fileformat.h>
13
14 #include <vector>
15
16 namespace Avogadro {
17 namespace QuantumIO {
18
19 class AVOGADROQUANTUMIO_EXPORT MoldenFile : public Io::FileFormat
20 {
21 public:
22 MoldenFile();
23 ~MoldenFile() override;
24
25 Operations supportedOperations() const override
26 {
27 return Read | Write | File | Stream | String;
28 }
29
30 FileFormat* newInstance() const override { return new MoldenFile; }
31 std::string identifier() const override { return "Avogadro: Molden"; }
32 std::string name() const override { return "Molden"; }
33 std::string description() const override { return "Molden file format."; }
34
35 std::string specificationUrl() const override
36 {
37 return "https://www.theochem.ru.nl/molden/molden_format.html";
38 }
39
40 std::vector<std::string> fileExtensions() const override;
41 std::vector<std::string> mimeTypes() const override;
42
43 [[nodiscard]] bool read(std::istream& in, Core::Molecule& molecule) override;
44 [[nodiscard]] bool write(std::ostream& out,
45 const Core::Molecule& molecule) override;
46
47 private:
48 void outputAll();
49
50 void processLine(std::istream& in);
51 void readAtom(const std::vector<std::string>& list);
52 bool load(Core::GaussianSet* basis, size_t atomCount);
53
54 // Write helper methods
55 void writeAtoms(std::ostream& out, const Core::Molecule& molecule);
56 void writeGTO(std::ostream& out, const Core::GaussianSet* basis);
57 void writeMO(std::ostream& out, const Core::GaussianSet* basis);
58 void writeFrequencies(std::ostream& out, const Core::Molecule& molecule);
59 void writeGeometries(std::ostream& out, const Core::Molecule& molecule);
60
61 bool m_cartesianD = true;
62 bool m_cartesianF = true;
63 bool m_cartesianG = true;
64
65 double m_coordFactor;
66 int m_electrons;
67 unsigned int m_numBasisFunctions;
68 std::vector<int> m_aNums;
69 std::vector<double> m_aPos;
70 std::vector<Core::GaussianSet::orbital> m_shellTypes;
71 std::vector<int> m_shellNums;
72 std::vector<int> m_shelltoAtom;
73 std::vector<double> m_a;
74 std::vector<double> m_c;
75 std::vector<double> m_csp;
76 std::vector<double> m_orbitalEnergy;
77 std::vector<double> m_betaOrbitalEnergy;
78 std::vector<std::string> m_symmetryLabels;
79 std::vector<std::string> m_betaSymmetryLabels;
80 std::vector<double> m_MOcoeffs;
81 std::vector<double> m_betaMOcoeffs;
82
83 Core::Array<double> m_frequencies;
84 Core::Array<double> m_IRintensities;
85 Core::Array<double> m_RamanIntensities;
86 Core::Array<Core::Array<Vector3>> m_vibDisplacements;
87
88 enum Mode
89 {
90 Atoms,
91 GTO,
92 MO,
93 Frequencies,
94 VibrationalModes,
95 Intensities,
96 Unrecognized
97 };
98 Mode m_mode;
99
100 bool m_openShell = false;
101 bool m_currentSpinBeta = false; // Track current spin during MO parsing
102 };
103
104 } // namespace QuantumIO
105 } // namespace Avogadro
106
107 #endif