Scine::Sparrow  4.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;
49  void setStructure(const Utils::AtomCollection& structure) final;
53  std::unique_ptr<Utils::AtomCollection> getStructure() const final;
58  void modifyPositions(Utils::PositionCollection newPositions) final;
62  const Utils::PositionCollection& getPositions() const final;
68  void setRequiredProperties(const Utils::PropertyList& requiredProperties) final;
75  Utils::PropertyList possibleProperties() const override;
82  const Utils::Results& calculate(std::string description) final;
87  virtual Utils::DensityMatrix getDensityMatrixGuess() const = 0;
92  Utils::Settings& settings() final;
97  const Utils::Settings& settings() const final;
102  Utils::Results& results() final;
107  const Utils::Results& results() const final;
108 
112  virtual void addElectronicContribution(std::shared_ptr<Utils::AdditiveElectronicContribution> contribution) = 0;
119  bool supportsMethodFamily(const std::string& methodFamily) const final;
120 
122  virtual Utils::LcaoMethod& getLcaoMethod() = 0;
123  virtual const Utils::LcaoMethod& getLcaoMethod() const = 0;
125  std::string getStoNGExpansionPath() const;
127  std::unordered_map<int, Utils::AtomicGtos> getAtomicGtosMap() const;
128  void generateWavefunctionInformation(const std::string& filename) final;
129  void generateWavefunctionInformation(std::ostream& out) final;
130 
131  void loadState(std::shared_ptr<Core::State> state) override;
132  std::shared_ptr<Core::State> getState() const final;
133 
134  protected:
135  std::unique_ptr<Utils::Settings> settings_;
136  Utils::Results results_;
138  virtual void initialize() = 0;
140  Utils::Derivative highestDerivativeRequired() const;
141  virtual void assembleResults(const std::string& description);
142 
143  virtual bool successfulCalculation() const = 0;
144  virtual bool canCalculateAnalyticalHessian() const;
145 
146  void checkBasicSettings();
147 
157  virtual void applySettings();
158  virtual bool getZPVEInclusion() const = 0;
159 
161  virtual void calculateImpl(Utils::Derivative requiredDerivative) = 0;
162 
163  std::unique_ptr<DipoleMomentCalculator> dipoleCalculator_;
164  std::unique_ptr<DipoleMatrixCalculator> dipoleMatrixCalculator_;
165  Utils::PropertyList requiredProperties_;
166 };
167 
168 } /* namespace Sparrow */
169 } /* namespace Scine */
170 
171 #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:126
void modifyPositions(Utils::PositionCollection newPositions) final
Allows to modify the positions of the underlying Utils::AtomCollection.
Definition: GenericMethodWrapper.cpp:110
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:98
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:55
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:47
std::unique_ptr< Utils::AtomCollection > getStructure() const final
Getter for the underlying element types and positions.
Definition: GenericMethodWrapper.cpp:106
Utils::Derivative highestDerivativeRequired() const
Determines the highest derivative type needed based on the property needed for calculation.
Definition: GenericMethodWrapper.cpp:138
const Utils::PositionCollection & getPositions() const final
Getter for the coordinates of the underlying Utils::AtomCollection.
Definition: GenericMethodWrapper.cpp:118
std::string getStoNGExpansionPath() const
Returns a Sto-6G expansion.
Definition: GenericMethodWrapper.cpp:281
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:296
~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:261
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:39
virtual void applySettings()
Function to apply the settings to the actual calculation method. This method is needed in every calcu...
Definition: GenericMethodWrapper.cpp:355
void setRequiredProperties(const Utils::PropertyList &requiredProperties) final
Sets the properties to calculate.
Definition: GenericMethodWrapper.cpp:122