forked from OpenChemistry/avogadrolibs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
obenergy.h
66 lines (48 loc) · 1.84 KB
/
obenergy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
It links to the Open Babel library, which is released under the GNU GPL v2.
******************************************************************************/
#ifndef AVOGADRO_QTPLUGINS_OBENERGY_H
#define AVOGADRO_QTPLUGINS_OBENERGY_H
#include <avogadro/calc/energycalculator.h>
#include <avogadro/core/avogadrocore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QString>
namespace Avogadro {
namespace QtPlugins {
class OBEnergy : public Avogadro::Calc::EnergyCalculator
{
Q_DECLARE_TR_FUNCTIONS(OBEnergy)
public:
OBEnergy(const std::string& method = "");
~OBEnergy() override;
std::string method() const { return m_identifier; }
void setupProcess();
Calc::EnergyCalculator* newInstance() const override;
std::string identifier() const override { return m_identifier; }
std::string name() const override { return m_name; }
std::string description() const override
{
return m_description.toStdString();
}
Core::Molecule::ElementMask elements() const override { return (m_elements); }
// This will check if the molecule is valid for this script
// and then start the external process
void setMolecule(Core::Molecule* mol) override;
// energy
Real value(const Eigen::VectorXd& x) override;
// gradient (which may be unsupported and fall back to numeric)
void gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) override;
private:
class Private;
Core::Molecule* m_molecule;
Private* d;
Core::Molecule::ElementMask m_elements;
std::string m_identifier;
std::string m_name;
QString m_description;
};
} // namespace QtPlugins
} // namespace Avogadro
#endif // AVOGADRO_QTPLUGINS_OBENERGY_H