Scine::Swoose  1.0.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
QmmmDatabaseHelper.h
Go to the documentation of this file.
1 
8 #ifndef SWOOSE_QMMM_QMMMDATABASEHELPER_H
9 #define SWOOSE_QMMM_QMMMDATABASEHELPER_H
10 
11 #include <Database/Manager.h>
12 #include <Utils/IO/Yaml.h>
13 #include <yaml-cpp/yaml.h>
14 #include <Eigen/Dense>
15 #include <memory>
16 #include <vector>
17 
18 namespace Scine {
19 
20 namespace Core {
21 class Log;
22 } // namespace Core
23 
24 namespace Utils {
25 class Settings;
26 class AtomCollection;
27 class BondOrderCollection;
28 } // namespace Utils
29 
30 namespace Database {
31 class ID;
32 class Collection;
33 } // namespace Database
34 
35 namespace Qmmm {
36 struct QmmmModel;
37 struct QmmmData;
38 using ForcesCollection = Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor>;
39 
45  public:
49  QmmmDatabaseHelper(const Utils::Settings& settings, Core::Log& log, const Utils::AtomCollection& structure,
50  const Utils::BondOrderCollection& bondOrders, const std::vector<QmmmModel>& qmmmModelCandidates,
51  const std::vector<QmmmModel>& qmmmReferenceModels, const QmmmData& qmmmData);
52 
57  std::vector<ForcesCollection> calculateForces();
58 
59  private:
60  // Returns the content of the parameters file as a string
61  std::string getParametersAsString() const;
62  // Submit a QM/MM reference calculation
63  bool submitCalculation(const QmmmModel& qmmmModel, const Database::ID& structureID, int qmmmModelIndex,
64  std::shared_ptr<Database::Collection> calculations, double symmetryScore = 0.0,
65  double maxAllowedSymmetryScore = 0.0);
66  // Collect the results and return the results
67  std::vector<ForcesCollection> collectCalculationResults(std::shared_ptr<Database::Collection> calculations,
68  std::shared_ptr<Database::Collection> structures,
69  std::shared_ptr<Database::Collection> properties);
70  // Logger.
71  Core::Log& log_;
72  // The settings.
73  const Utils::Settings& settings_;
74  // The database
75  std::unique_ptr<Database::Manager> database_;
76  // QM/MM model candidates
77  const std::vector<QmmmModel>& qmmmModelCandidates_;
78  // QM/MM reference models
79  const std::vector<QmmmModel>& qmmmReferenceModels_;
80  // Molecular structure of the whole system
81  const Utils::AtomCollection& structure_;
82  // Sleep time in between database operations in seconds
83  int sleepTime_;
84  // The bond orders of the system
85  const Utils::BondOrderCollection& bondOrders_;
86  // The data calculated for the QM/MM candidate and reference models.
87  const QmmmData& qmmmData_;
88 };
89 
90 } // namespace Qmmm
91 } // namespace Scine
92 
93 #endif // SWOOSE_QMMM_QMMMDATABASEHELPER_H
Definition: QmmmReferenceDataManager.h:35
Holds the information about one QM/MM model: its structure, its QM atom indices, and its charge and s...
Definition: QmRegionSelector.h:30
QmmmDatabaseHelper(const Utils::Settings &settings, Core::Log &log, const Utils::AtomCollection &structure, const Utils::BondOrderCollection &bondOrders, const std::vector< QmmmModel > &qmmmModelCandidates, const std::vector< QmmmModel > &qmmmReferenceModels, const QmmmData &qmmmData)
Constructor.
Definition: QmmmDatabaseHelper.cpp:29
std::vector< ForcesCollection > calculateForces()
Calculates the forces for the QM/MM candidate and reference models.
Definition: QmmmDatabaseHelper.cpp:56
This class handles the submission and collection of results for QM/MM calculations via the database...
Definition: QmmmDatabaseHelper.h:44