Debian Codegraph @

avogadro/qtplugins/openbabel/obforcefielddialog.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_OBFORCEFIELDDIALOG_H
7 #define AVOGADRO_QTPLUGINS_OBFORCEFIELDDIALOG_H
8
9 #include <QDialog>
10
11 namespace Avogadro {
12 namespace QtPlugins {
13
14 namespace Ui {
15 class OBForceFieldDialog;
16 }
17
18 /**
19 * @brief The OBForceFieldDialog class is used to prompt the user for parameters
20 * to be used in an OpenBabel force field optimization.
21 */
22 class OBForceFieldDialog : public QDialog
23 {
24 Q_OBJECT
25
26 public:
27 /**
28 * Construct a new dialog using the forcefields in @a forceFields.
29 */
30 explicit OBForceFieldDialog(const QStringList& forceFields,
31 QWidget* parent_ = nullptr);
32 ~OBForceFieldDialog() override;
33
34 /**
35 * Construct a new dialog using the forcefields in @a forceFields and
36 * initialize the options to those in @a startingOptions (see setOptions).
37 * If the user chooses the recommended force field, @a recommendedForceField_
38 * will be set. This is useful for preferring a specific force field for a
39 * particular molecule.
40 * When the user closes the dialog, the options they selected are returned. If
41 * the user cancels the dialog, an empty list is returned.
42 */
43 static QStringList prompt(QWidget* parent_, const QStringList& forceFields,
44 const QStringList& startingOptions,
45 const QString& recommendedForceField_ = QString());
46
47 /**
48 * Get/set the options displayed in the dialog. The option format is a list of
49 * strings that may be used directly as arguments in a call to
50 * QProcess::start, with the exception of the `-i<input format>`,
51 * `-o<output format>` and `--minimize` options, which are not used by this
52 * class. See `obabel -L minimize` for a complete listing of available
53 * options.
54 *
55 * Each option (and argument, if applicable) must be a separate string in the
56 * list. For instance, to refer to the options in the call:
57 @code
58 obabel -icml -ocml --minimize --log --crit 1e-05 --ff Ghemical --sd"
59 @endcode
60 *
61 * The option list should contain, in order:
62 * - `--crit`
63 * - `1e-05`
64 * - `--ff`
65 * - `Ghemical`
66 * - `--sd`
67 *
68 * @note The `--log` option is always added in the list returned by
69 * options, and is ignored by the setOptions method.
70 *
71 * @{
72 */
73 QStringList options() const;
74 void setOptions(const QStringList& opts);
75 /**@}*/
76
77 /**
78 * Get/set the recommended forcefield for the current molecule. If an empty
79 * string, the user will not be shown an option to use the recommended
80 * forcefield.
81 * If the string is non-empty (and in the forceFields list passed in the
82 * constructor), the user will have the option of setting the forcefield to
83 * this value.
84 *
85 * @{
86 */
87 QString recommendedForceField() const { return m_recommendedForceField; }
88 void setRecommendedForceField(const QString& rff);
89 /**@}*/
90
91 private slots:
92 void useRecommendedForceFieldToggled(bool state);
93
94 private:
95 void updateRecommendedForceField();
96
97 Ui::OBForceFieldDialog* ui;
98 QString m_recommendedForceField;
99 };
100
101 } // namespace QtPlugins
102 } // namespace Avogadro
103 #endif // AVOGADRO_QTPLUGINS_OBFORCEFIELDDIALOG_H