Scine::Swoose  2.1.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  const Utils::Settings& calculatorSettings);
53 
58  std::vector<ForcesCollection> calculateForces();
59 
60  private:
61  // Returns the content of the parameters file as a string
62  std::string getParametersAsString() const;
63  // Submit a QM/MM reference calculation
64  bool submitCalculation(const QmmmModel& qmmmModel, const Database::ID& structureID, int qmmmModelIndex,
65  std::shared_ptr<Database::Collection> calculations, double symmetryScore = 0.0,
66  double maxAllowedSymmetryScore = 0.0);
67  // Collect the results and return the results
68  std::vector<ForcesCollection> collectCalculationResults(std::shared_ptr<Database::Collection> calculations,
69  std::shared_ptr<Database::Collection> structures,
70  std::shared_ptr<Database::Collection> properties);
71  // Logger.
72  Core::Log& log_;
73  // The settings.
74  const Utils::Settings& settings_;
75  // The database
76  std::unique_ptr<Database::Manager> database_;
77  // QM/MM model candidates
78  const std::vector<QmmmModel>& qmmmModelCandidates_;
79  // QM/MM reference models
80  const std::vector<QmmmModel>& qmmmReferenceModels_;
81  // Molecular structure of the whole system
82  const Utils::AtomCollection& structure_;
83  // Sleep time in between database operations in seconds
84  int sleepTime_;
85  // The bond orders of the system
86  const Utils::BondOrderCollection& bondOrders_;
87  // The data calculated for the QM/MM candidate and reference models.
88  const QmmmData& qmmmData_;
89  // The settings of the QM/MM calculator
90  const Utils::Settings& calculatorSettings_;
91 };
92 
93 } // namespace Qmmm
94 } // namespace Scine
95 
96 #endif // SWOOSE_QMMM_QMMMDATABASEHELPER_H
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, const Utils::Settings &calculatorSettings)
Constructor.
Definition: QmmmDatabaseHelper.cpp:29
Definition: QmmmReferenceDataManager.h:36
Holds the information about one QM/MM model: its structure, its QM atom indices, and its charge and s...
Definition: QmRegionSelector.h:31
std::vector< ForcesCollection > calculateForces()
Calculates the forces for the QM/MM candidate and reference models.
Definition: QmmmDatabaseHelper.cpp:63
This class handles the submission and collection of results for QM/MM calculations via the database...
Definition: QmmmDatabaseHelper.h:44