| 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_QTGUI_SLATERSETCONCURRENT_H |
| 7 |
#define AVOGADRO_QTGUI_SLATERSETCONCURRENT_H |
| 8 |
|
| 9 |
#include "avogadroqtguiexport.h" |
| 10 |
|
| 11 |
#include <QtCore/QFuture> |
| 12 |
#include <QtCore/QFutureWatcher> |
| 13 |
#include <QtCore/QObject> |
| 14 |
|
| 15 |
namespace Avogadro { |
| 16 |
|
| 17 |
namespace Core { |
| 18 |
class Cube; |
| 19 |
class Molecule; |
| 20 |
class SlaterSet; |
| 21 |
class SlaterSetTools; |
| 22 |
} // namespace Core |
| 23 |
|
| 24 |
namespace QtGui { |
| 25 |
|
| 26 |
struct SlaterShell; |
| 27 |
|
| 28 |
/** |
| 29 |
* @brief The SlaterSetConcurrent class uses SlaterSetTools to calculate values |
| 30 |
* of electronic structure properties from quantum output read in. |
| 31 |
* @author Marcus D. Hanwell |
| 32 |
*/ |
| 33 |
|
| 34 |
class AVOGADROQTGUI_EXPORT SlaterSetConcurrent : public QObject |
| 35 |
{ |
| 36 |
Q_OBJECT |
| 37 |
|
| 38 |
public: |
| 39 |
explicit SlaterSetConcurrent(QObject* p = nullptr); |
| 40 |
~SlaterSetConcurrent() override; |
| 41 |
|
| 42 |
void setMolecule(Core::Molecule* mol); |
| 43 |
|
| 44 |
bool calculateMolecularOrbital(Core::Cube* cube, unsigned int state); |
| 45 |
bool calculateElectronDensity(Core::Cube* cube); |
| 46 |
bool calculateSpinDensity(Core::Cube* cube); |
| 47 |
|
| 48 |
QFutureWatcher<void>& watcher() { return m_watcher; } |
| 49 |
|
| 50 |
signals: |
| 51 |
/** |
| 52 |
* Emitted when the calculation is complete. |
| 53 |
*/ |
| 54 |
void finished(); |
| 55 |
|
| 56 |
private slots: |
| 57 |
/** |
| 58 |
* Slot to set the cube data once Qt Concurrent is done |
| 59 |
*/ |
| 60 |
void calculationComplete(); |
| 61 |
|
| 62 |
private: |
| 63 |
QFuture<void> m_future; |
| 64 |
QFutureWatcher<void> m_watcher; |
| 65 |
Core::Cube* m_cube; |
| 66 |
QVector<SlaterShell>* m_shells; |
| 67 |
|
| 68 |
Core::SlaterSet* m_set; |
| 69 |
Core::SlaterSetTools* m_tools; |
| 70 |
|
| 71 |
bool setUpCalculation(Core::Cube* cube, unsigned int state, |
| 72 |
void (*func)(SlaterShell&)); |
| 73 |
|
| 74 |
static void processOrbital(SlaterShell& shell); |
| 75 |
static void processDensity(SlaterShell& shell); |
| 76 |
static void processSpinDensity(SlaterShell& shell); |
| 77 |
}; |
| 78 |
} // namespace QtGui |
| 79 |
} // namespace Avogadro |
| 80 |
|
| 81 |
#endif // AVOGADRO_QTGUI_SLATERSETCONCURRENT_H |