Scine::Swoose  2.1.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
QmRegionSelector.h
Go to the documentation of this file.
1 
8 #ifndef SWOOSE_QMMM_QMREGIONSELECTOR_H
9 #define SWOOSE_QMMM_QMREGIONSELECTOR_H
10 
14 #include <memory>
15 #include <vector>
16 
17 namespace Scine {
18 
19 namespace Utils {
20 class BondOrderCollection;
21 class Settings;
22 } // namespace Utils
23 
24 namespace Qmmm {
25 
31 struct QmmmModel {
32  Utils::AtomCollection structure;
33  std::vector<int> qmAtomIndices;
34  int molecularCharge;
35  int spinMultiplicity;
36 };
37 
44  public:
52  void setUnderlyingCalculator(std::shared_ptr<Core::Calculator> qmmmCalculator);
57  void generateQmRegion(const Utils::AtomCollection& fullSystem);
58 
63 
67  std::vector<int> getQmRegionIndices() const;
72  std::vector<int> getQmRegionIndicesWithoutLinkAtoms() const;
73 
77  std::pair<int, int> getQmRegionChargeAndMultiplicity() const;
78 
84 
89  const Utils::Settings& settings() const;
90 
95  bool allowsPythonGILRelease() const;
96 
97  private:
98  // Helper function that reads in the system connectivity from the connectivity file specified in the settings.
99  Utils::BondOrderCollection getBondOrders(const Utils::AtomCollection& structure) const;
100  // The settings.
101  std::unique_ptr<Utils::Settings> settings_;
102  // The QM/MM model candidates.
103  std::vector<QmmmModel> qmmmModelCandidates_;
104  // The QM/MM reference models.
105  std::vector<QmmmModel> qmmmReferenceModels_;
106  std::shared_ptr<QmmmCalculator> qmmmCalculator_;
107  // The selected QM region. Initialized as -1, which is the state that no selection has been made yet.
108  int selectedQmRegionIndex_ = -1;
109 };
110 
111 class QmRegionHasNotBeenSelectedException : public std::runtime_error {
112  public:
113  explicit QmRegionHasNotBeenSelectedException() : std::runtime_error("The QM Region has not been generated yet.") {
114  }
115 };
116 
117 } // namespace Qmmm
118 } // namespace Scine
119 
120 #endif // SWOOSE_QMMM_QMREGIONSELECTOR_H
Definition: QmRegionSelector.h:111
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< int > getQmRegionIndices() const
Getter for the indices of the atoms in the generated QM region.
Definition: QmRegionSelector.cpp:62
QmRegionSelector()
Constructor.
Definition: QmRegionSelector.cpp:22
void setUnderlyingCalculator(std::shared_ptr< Core::Calculator > qmmmCalculator)
Sets the underlying calculators.
Definition: QmRegionSelector.cpp:117
Utils::Settings & settings()
Accessor for the settings.
Definition: QmRegionSelector.cpp:95
Automated selection of the QM region given a central atom around which it should be constructed and o...
Definition: QmRegionSelector.h:43
std::pair< int, int > getQmRegionChargeAndMultiplicity() const
Getter for the molecular charge and multiplicity of the generated QM region.
Definition: QmRegionSelector.cpp:88
Utils::AtomCollection getQmRegionStructure() const
Getter for the generated QM region as a Utils::AtomCollection.
Definition: QmRegionSelector.cpp:82
std::vector< int > getQmRegionIndicesWithoutLinkAtoms() const
Get the Qm Region Indices Without Link Atoms. This is required for interactive QM/MM.
Definition: QmRegionSelector.cpp:68
bool allowsPythonGILRelease() const
Returns if the QM Region Selector in its current status allows the release of the Python GIL...
Definition: QmRegionSelector.cpp:103
void generateQmRegion(const Utils::AtomCollection &fullSystem)
Generates the optimal QM region automatically.
Definition: QmRegionSelector.cpp:26