Scine::Swoose  1.0.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
SfamMolecularMechanicsCalculator.h
Go to the documentation of this file.
1 
8 #ifndef SFAMMOLECULARMECHANICSCALCULATOR_H
9 #define SFAMMOLECULARMECHANICSCALCULATOR_H
10 
11 #include "../Interactions/AnglesEvaluator.h"
12 #include "../Interactions/BondsEvaluator.h"
13 #include "../Interactions/DihedralsEvaluator.h"
14 #include "../Interactions/DispersionEvaluator.h"
15 #include "../Interactions/ElectrostaticEvaluator.h"
16 #include "../Interactions/HydrogenBondEvaluator.h"
17 #include "../Interactions/ImproperDihedralsEvaluator.h"
18 #include "../Interactions/RepulsionEvaluator.h"
19 #include "../MolecularMechanicsCalculator.h"
20 #include "../Topology/IndexedStructuralTopology.h"
21 #include "SfamAtomTypeIdentifier.h"
22 #include "SfamParameters.h"
23 
24 namespace Scine {
25 
26 namespace MMParametrization {
27 class UpdateFunctionManager;
28 } // namespace MMParametrization
29 
30 namespace Qmmm {
31 class InteractionTermEliminator;
32 } // namespace Qmmm
33 
34 namespace MolecularMechanics {
35 class SfamParameters;
36 class AtomTypesHolder;
37 class BondType;
38 class AngleType;
39 class DihedralType;
40 class ImproperDihedralType;
50  : public Utils::CloneInterface<SfamMolecularMechanicsCalculator, MolecularMechanicsCalculator> {
51  public:
52  static constexpr const char* model = "SFAM";
56  ~SfamMolecularMechanicsCalculator() override = default;
63  void setStructure(const Utils::AtomCollection& structure) override;
72  const Utils::Results& calculate(std::string description) override;
77  std::string name() const override;
78 
79  private:
80  // friend class declarations
83  // This function is only used by the friend class in the MM parametrization algorithm.
84  void setListsOfNeighbors(std::vector<std::list<int>> listsOfNeighbors);
85  // Setter for the internal copy of the parameters.
86  void setParameters(SfamParameters parameters);
87  /*
88  * @brief Implementation of a calculation.
89  */
90  const Utils::Results& calculateImpl(std::string description);
91  /*
92  * @brief Apply settings.
93  */
94  void applySettings();
95 
96  // Other private members:
97  std::unique_ptr<BondsEvaluator> bondsEvaluator_;
98  std::unique_ptr<AnglesEvaluator> anglesEvaluator_;
99  std::unique_ptr<DihedralsEvaluator> dihedralsEvaluator_;
100  std::unique_ptr<ImproperDihedralsEvaluator> improperDihedralsEvaluator_;
101  std::unique_ptr<DispersionEvaluator> dispersionEvaluator_;
102  std::unique_ptr<RepulsionEvaluator> repulsionEvaluator_;
103  std::unique_ptr<ElectrostaticEvaluator> electrostaticEvaluator_;
104  std::unique_ptr<HydrogenBondEvaluator> hydrogenBondEvaluator_;
105  bool printContributionsMolecularMechanics_;
106  bool onlyCalculateBondedContribution_;
107  bool detectBondsWithCovalentRadii_;
108  bool includeHydrogenBonds_;
109  /*
110  * Decides whether the potential terms that correspond to non-bonded interaction beyond the cutoff radius,
111  * are ignored during the initialization stage of the calculator. This can result in a great speed-up, however,
112  * the calculator may has to be re-initialized when the structure changes significantly.
113  */
114  bool applyCutoffDuringInitialization_;
115  double nonCovalentCutoffRadius_;
116  SfamAtomTypeLevel sfamAtomTypeLevel_;
117  std::string connectivityFilePath_;
118  std::string parameterFilePath_;
119  /*
120  * Tracks whether the parameter file path has been recently changed.
121  * This boolean is set to true when the member 'parameterFilePath_' is updated
122  * and it is set back to false when these parameters are parsed and stored in the
123  * 'parameters_' member.
124  */
125  bool parameterFilePathHasBeenChanged_ = false;
126  // Copy of the parameters as a member that is also cloned when the MM calculator is cloned.
127  SfamParameters parameters_;
128  bool parametersHaveBeenSetInternally_ = false;
129  // Whether this calculator is currently calculating a Hessian -> no detailed output printing
130  bool hessianMode_ = false;
131  // Private methods:
132  void initialize();
133  void generatePotentialTerms(const SfamParameters& parameters, const IndexedStructuralTopology& topology,
134  const AtomTypesHolder& atomTypes);
135  void generatePotentialTerms(const std::string& parameterPath);
136  /*
137  * A list of atom indices for which the contributions in the numerical part of the Hessian
138  * calculations are considered. All other atom contributions in this Hessian will be ignored.
139  * This is useful for speeding up the parametrizations of the model.
140  */
141  std::vector<int> atomsToConsiderForHessian_ = {};
142  // Setter for the 'atomsToConsiderForHessian_' member
143  void setAtomsToConsiderForHessian(std::vector<int> atomsToConsiderForHessian);
144 };
145 
146 } // namespace MolecularMechanics
147 } // namespace Scine
148 
149 #endif // SFAMMOLECULARMECHANICSCALCULATOR_H
std::string name() const override
Getter for the name of the Calculator.
Definition: SfamMolecularMechanicsCalculator.cpp:25
Class containing the structural information about the connectivity of a system.
Definition: IndexedStructuralTopology.h:25
void setStructure(const Utils::AtomCollection &structure) override
Changes the molecular structure to calculate.
Definition: SfamMolecularMechanicsCalculator.cpp:92
SfamMolecularMechanicsCalculator()
Constructor.
Definition: SfamMolecularMechanicsCalculator.cpp:29
Calculator for the SFAM Molecular Mechanics method.
Definition: SfamMolecularMechanicsCalculator.h:49
const Utils::Results & calculate(std::string description) override
The main function running calculations.
Definition: SfamMolecularMechanicsCalculator.cpp:98
Class containing the MM atom types of the atoms in a molecular system.
Definition: AtomTypesHolder.h:21
This class handles the elimination of MM interaction terms, which are already covered by the QM calcu...
Definition: InteractionTermEliminator.h:38
~SfamMolecularMechanicsCalculator() override=default
Default Destructor.
Definition: UpdateFunctionManager.h:37
Class containing the parameters for SFAM&#39;s MM model obtained after parsing a SFAM parameter file...
Definition: SfamParameters.h:37