Scine::Swoose  2.1.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 struct BondType;
38 struct AngleType;
39 struct DihedralType;
40 struct ImproperDihedralType;
50  : public Utils::CloneInterface<SfamMolecularMechanicsCalculator, MolecularMechanicsCalculator, Core::Calculator> {
51  public:
52  static constexpr const char* model = "SFAM";
56  ~SfamMolecularMechanicsCalculator() override = default;
63  void setStructure(const Utils::AtomCollection& structure) override;
68  void modifyPositions(Utils::PositionCollection newPositions) override;
77  const Utils::Results& calculate(std::string description) override;
82  std::string name() const override;
83 
84  private:
85  // friend class declarations
88  // This function is only used by the friend class in the MM parametrization algorithm.
89  void setListsOfNeighbors(std::vector<std::list<int>> listsOfNeighbors);
90  // Setter for the internal copy of the parameters.
91  void setParameters(SfamParameters parameters);
92  /*
93  * @brief Implementation of a calculation.
94  */
95  const Utils::Results& calculateImpl(std::string description);
96  /*
97  * @brief Apply settings.
98  */
99  void applySettings();
100 
101  // Other private members:
102  std::unique_ptr<BondsEvaluator> bondsEvaluator_;
103  std::unique_ptr<AnglesEvaluator> anglesEvaluator_;
104  std::unique_ptr<DihedralsEvaluator> dihedralsEvaluator_;
105  std::unique_ptr<ImproperDihedralsEvaluator> improperDihedralsEvaluator_;
106  std::unique_ptr<DispersionEvaluator> dispersionEvaluator_;
107  std::unique_ptr<RepulsionEvaluator> repulsionEvaluator_;
108  std::unique_ptr<ElectrostaticEvaluator> electrostaticEvaluator_;
109  std::unique_ptr<HydrogenBondEvaluator> hydrogenBondEvaluator_;
110  IndexedStructuralTopology topology_;
111  AtomTypesHolder atomTypes_;
112  bool printContributionsMolecularMechanics_;
113  bool onlyCalculateBondedContribution_;
114  bool detectBondsWithCovalentRadii_;
115  bool includeHydrogenBonds_;
116  /*
117  * Decides whether the potential terms that correspond to non-bonded interaction beyond the cutoff radius,
118  * are ignored during the initialization stage of the calculator. This can result in a great speed-up, however,
119  * the calculator may has to be re-initialized when the structure changes significantly.
120  */
121  bool applyCutoffDuringInitialization_;
122  double nonCovalentCutoffRadius_;
123  SfamAtomTypeLevel sfamAtomTypeLevel_;
124  std::string connectivityFilePath_;
125  std::string parameterFilePath_;
126  /*
127  * Tracks whether the parameter file path has been recently changed.
128  * This boolean is set to true when the member 'parameterFilePath_' is updated
129  * and it is set back to false when these parameters are parsed and stored in the
130  * 'parameters_' member.
131  */
132  bool parameterFilePathHasBeenChanged_ = false;
133  // Copy of the parameters as a member that is also cloned when the MM calculator is cloned.
134  SfamParameters parameters_;
135  bool parametersHaveBeenSetInternally_ = false;
136  // Whether this calculator is currently calculating a Hessian -> no detailed output printing
137  bool hessianMode_ = false;
138  // Private methods:
139  void initialize();
140  void generatePotentialTerms(const SfamParameters& parameters, const IndexedStructuralTopology& topology,
141  const AtomTypesHolder& atomTypes);
142  void generatePotentialTerms(const std::string& parameterPath);
143  /*
144  * A list of atom indices for which the contributions in the numerical part of the Hessian
145  * calculations are considered. All other atom contributions in this Hessian will be ignored.
146  * This is useful for speeding up the parametrizations of the model.
147  */
148  std::vector<int> atomsToConsiderForHessian_ = {};
149  // Setter for the 'atomsToConsiderForHessian_' member
150  void setAtomsToConsiderForHessian(std::vector<int> atomsToConsiderForHessian);
151 };
152 
153 } // namespace MolecularMechanics
154 } // namespace Scine
155 
156 #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:95
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:112
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:39
~SfamMolecularMechanicsCalculator() override=default
Default Destructor.
Definition: UpdateFunctionManager.h:37
void modifyPositions(Utils::PositionCollection newPositions) override
Allows to modify the positions of the underlying Utils::AtomCollection.
Definition: SfamMolecularMechanicsCalculator.cpp:101
Class containing the parameters for SFAM&#39;s MM model obtained after parsing a SFAM parameter file...
Definition: SfamParameters.h:37