Scine::Sparrow  5.0.0
Library for fast and agile quantum chemical calculations with semiempirical methods.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
GenericMethodWrapper.h
Go to the documentation of this file.
1 
7 #ifndef SPARROW_GENERICMETHODWRAPPER_H
8 #define SPARROW_GENERICMETHODWRAPPER_H
9 
10 /* External Includes */
11 
14 #include <Utils/CalculatorBasics.h>
16 #include <Utils/Settings.h>
18 #include <string>
19 #include <unordered_map>
20 
21 namespace Scine {
22 namespace Utils {
23 class LcaoMethod;
24 class DensityMatrix;
25 class DipoleMatrix;
26 class AdditiveElectronicContribution;
27 enum class Derivative;
28 } // namespace Utils
29 namespace Sparrow {
30 
31 class DipoleMatrixCalculator;
32 class DipoleMomentCalculator;
33 
38 class GenericMethodWrapper : public Utils::CloneInterface<Utils::Abstract<GenericMethodWrapper>, Core::Calculator>,
40  public:
44  ~GenericMethodWrapper() override;
51  void setStructure(const Utils::AtomCollection& structure) final;
55  std::unique_ptr<Utils::AtomCollection> getStructure() const final;
60  void modifyPositions(Utils::PositionCollection newPositions) final;
64  const Utils::PositionCollection& getPositions() const final;
70  void setRequiredProperties(const Utils::PropertyList& requiredProperties) final;
77  Utils::PropertyList possibleProperties() const override;
84  const Utils::Results& calculate(std::string description) final;
89  virtual Utils::DensityMatrix getDensityMatrixGuess() const = 0;
94  Utils::Settings& settings() final;
99  const Utils::Settings& settings() const final;
104  Utils::Results& results() final;
109  const Utils::Results& results() const final;
110 
114  virtual void addElectronicContribution(std::shared_ptr<Utils::AdditiveElectronicContribution> contribution) = 0;
121  bool supportsMethodFamily(const std::string& methodFamily) const final;
122 
124  virtual Utils::LcaoMethod& getLcaoMethod() = 0;
125  virtual const Utils::LcaoMethod& getLcaoMethod() const = 0;
127  std::string getStoNGExpansionPath() const;
129  std::unordered_map<int, Utils::AtomicGtos> getAtomicGtosMap() const;
130  void generateWavefunctionInformation(const std::string& filename) final;
131  void generateWavefunctionInformation(std::ostream& out) final;
132 
133  void loadState(std::shared_ptr<Core::State> state) override;
134  std::shared_ptr<Core::State> getState() const final;
135 
136  protected:
137  std::unique_ptr<Utils::Settings> settings_;
138  Utils::Results results_;
140  virtual void initialize() = 0;
142  Utils::Derivative highestDerivativeRequired() const;
143  virtual void assembleResults(const std::string& description);
144 
145  virtual bool successfulCalculation() const = 0;
146  virtual bool canCalculateAnalyticalHessian() const;
147 
148  void checkBasicSettings();
149 
159  virtual void applySettings();
160  virtual bool getZPVEInclusion() const = 0;
161 
163  virtual void calculateImpl(Utils::Derivative requiredDerivative) = 0;
164 
165  std::unique_ptr<DipoleMomentCalculator> dipoleCalculator_;
166  std::unique_ptr<DipoleMatrixCalculator> dipoleMatrixCalculator_;
167  Utils::PropertyList requiredProperties_;
168 };
169 
170 } /* namespace Sparrow */
171 } /* namespace Scine */
172 
173 #endif /* SPARROW_GENERICMETHODWRAPPER_H */
virtual void initialize()=0
Initializes a method with the parameter file present in the settings.
GenericMethodWrapper()
Default Constructor.
A MethodWrapper running Generic calculations.
Definition: GenericMethodWrapper.h:38
Utils::PropertyList getRequiredProperties() const final
Gets the properties to calculate.
Definition: GenericMethodWrapper.cpp:129
void modifyPositions(Utils::PositionCollection newPositions) final
Allows to modify the positions of the underlying Utils::AtomCollection.
Definition: GenericMethodWrapper.cpp:113
void setStructure(const Utils::AtomCollection &structure) final
Sets new structure and initializes the underlying method with the parameter given in the settings...
Definition: GenericMethodWrapper.cpp:101
virtual void calculateImpl(Utils::Derivative requiredDerivative)=0
Method-dependent implementation of the calculate member function.
virtual void addElectronicContribution(std::shared_ptr< Utils::AdditiveElectronicContribution > contribution)=0
Interface method to add an electronic contribution to the Hamiltonian.
const Utils::Results & calculate(std::string description) final
The main function running calculations (dummy).
Definition: GenericMethodWrapper.cpp:58
virtual Utils::DensityMatrix getDensityMatrixGuess() const =0
Getter for the initial density matrix guess.
Utils::Results & results() final
Accessor for the Results stored in this method wrapper.
Definition: GenericMethodWrapper.cpp:50
std::unique_ptr< Utils::AtomCollection > getStructure() const final
Getter for the underlying element types and positions.
Definition: GenericMethodWrapper.cpp:109
Utils::Derivative highestDerivativeRequired() const
Determines the highest derivative type needed based on the property needed for calculation.
Definition: GenericMethodWrapper.cpp:141
const Utils::PositionCollection & getPositions() const final
Getter for the coordinates of the underlying Utils::AtomCollection.
Definition: GenericMethodWrapper.cpp:121
std::string getStoNGExpansionPath() const
Returns a Sto-6G expansion.
Definition: GenericMethodWrapper.cpp:284
std::unordered_map< int, Utils::AtomicGtos > getAtomicGtosMap() const
get map of GTOs of each element in the calculated structure with Z as key
Definition: GenericMethodWrapper.cpp:299
~GenericMethodWrapper() override
Default Destructor.
bool supportsMethodFamily(const std::string &methodFamily) const final
Whether the calculator supports a method family In this library, every calculator supports just one &quot;...
Definition: GenericMethodWrapper.cpp:264
virtual Utils::LcaoMethod & getLcaoMethod()=0
Get the underlying LcaoMethod.
Utils::Settings & settings() final
Accessor for the Settings used in this method wrapper.
Definition: GenericMethodWrapper.cpp:42
virtual void applySettings()
Function to apply the settings to the actual calculation method. This method is needed in every calcu...
Definition: GenericMethodWrapper.cpp:358
void setRequiredProperties(const Utils::PropertyList &requiredProperties) final
Sets the properties to calculate.
Definition: GenericMethodWrapper.cpp:125