Debian Codegraph @

avogadro/qtplugins/plotconformer/plotconformer.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_PLOTCONFORMER_H
7 #define AVOGADRO_QTPLUGINS_PLOTCONFORMER_H
8
9 #include <avogadro/qtgui/extensionplugin.h>
10
11 #include <QDialog>
12 #include <QComboBox>
13
14 #include <memory>
15
16 namespace Avogadro {
17
18 namespace QtGui {
19 class ChartWidget;
20 }
21
22 namespace QtPlugins {
23
24 using DataSeries = std::vector<float>;
25
26 /**
27 * @brief Generate and plot conformer data (RMSD or energy)
28 */
29 class PlotConformer : public Avogadro::QtGui::ExtensionPlugin
30 {
31 Q_OBJECT
32 public:
33 explicit PlotConformer(QObject* parent_ = nullptr);
34 ~PlotConformer() override;
35
36 QString name() const override { return tr("PlotConformer"); }
37 QString description() const override;
38 QList<QAction*> actions() const override;
39 QStringList menuPath(QAction*) const override;
40
41 public slots:
42 void setMolecule(QtGui::Molecule* mol) override;
43
44 void moleculeChanged(unsigned int changes);
45
46 private slots:
47 void updateActions();
48
49 void displayDialog();
50 void updatePlot();
51
52 void clicked(float x, float y, Qt::KeyboardModifiers modifiers);
53
54 private:
55 // Generate RMSD data from a coordinate set
56 // Writes the results to @p x and @p y
57 void generateRmsdCurve(DataSeries& x, DataSeries& y);
58
59 // Generate a relative energy data from a coordinate set
60 void generateEnergyCurve(DataSeries& x, DataSeries& y);
61
62 // Generate a forces data from a coordinate set
63 void generateForcesCurve(DataSeries& x, DataSeries& y);
64
65 // Generate a velocities data from a coordinate set
66 void generateVelocitiesCurve(DataSeries& x, DataSeries& y);
67
68 QList<QAction*> m_actions;
69 QtGui::Molecule* m_molecule;
70
71 QAction* m_displayDialogAction;
72 std::unique_ptr<QDialog> m_dialog;
73 QtGui::ChartWidget* m_chartWidget;
74 QComboBox* m_propertyCombo;
75 QComboBox* m_unitsCombo;
76 QComboBox* m_targetUnitsCombo;
77 int m_currentFrame = 0;
78 };
79
80 inline QString PlotConformer::description() const
81 {
82 return tr("Generate and plot conformer data (RMSD or energy).");
83 }
84
85 } // namespace QtPlugins
86 } // namespace Avogadro
87
88 #endif // AVOGADRO_QTPLUGINS_PLOTCONFORMER_H