Debian Codegraph @

avogadro/qtplugins/yaehmop/yaehmop.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_QTPLUGINS_YAEHMOP_H
7 #define AVOGADRO_QTPLUGINS_YAEHMOP_H
8
9 #include "banddialog.h"
10 #include "yaehmopsettings.h"
11
12 #include <avogadro/qtgui/extensionplugin.h>
13
14 #include <avogadro/core/vector.h>
15
16 #include <avogadro/qtgui/chartdialog.h>
17
18 #include <memory>
19
20 // Forward declarations
21 class QByteArray;
22
23 namespace Avogadro::QtPlugins {
24
25 /**
26 * @brief Perform extended Hückel calculations with yaehmop.
27 */
28 class Yaehmop : public Avogadro::QtGui::ExtensionPlugin
29 {
30 Q_OBJECT
31 public:
32 explicit Yaehmop(QObject* parent_ = nullptr);
33 ~Yaehmop() override;
34
35 QString name() const override { return tr("Yaehmop"); }
36 QString description() const override;
37 QList<QAction*> actions() const override;
38 QStringList menuPath(QAction*) const override;
39
40 public slots:
41 void setMolecule(QtGui::Molecule* mol) override;
42
43 void moleculeChanged(unsigned int changes);
44
45 private slots:
46 void updateActions();
47
48 void displayBandDialog();
49
50 private:
51 void readSettings();
52 void writeSettings();
53
54 // This pops up a dialog box with the yaehmop input inside
55 void showYaehmopInput(const QString& input);
56
57 // Get the distance between two k points
58 double kpointDistance(const Avogadro::Vector3& a, const Avogadro::Vector3& b);
59
60 void calculateBandStructure();
61
62 QString createGeometryAndLatticeInput() const;
63
64 // Use QProcess to execute yaehmop
65 // If the YAEHMOP_EXECUTABLE environment variable is set, that will be
66 // used for the executable. Otherwise, it will search for the executable in
67 // some common places and use it if it can be found.
68 bool executeYaehmop(const QByteArray& input, QByteArray& output,
69 QString& err);
70
71 QString m_programPath;
72 QList<QAction*> m_actions;
73 QtGui::Molecule* m_molecule;
74
75 YaehmopSettings m_yaehmopSettings;
76
77 std::unique_ptr<BandDialog> m_bandDialog;
78 std::unique_ptr<QAction> m_displayBandDialogAction;
79 QScopedPointer<QtGui::ChartDialog> m_chartDialog;
80 };
81
82 inline QString Yaehmop::description() const
83 {
84 return tr("Perform extended Hückel calculations with yaehmop.");
85 }
86
87 } // namespace Avogadro::QtPlugins
88
89 #endif // AVOGADRO_QTPLUGINS_YAEHMOPEXTENSION_H