Scine::Swoose  2.1.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
FragmentAnalyzer.h
Go to the documentation of this file.
1 
8 #ifndef SWOOSEUTILITIES_FRAGMENTANALYZER_H
9 #define SWOOSEUTILITIES_FRAGMENTANALYZER_H
10 
11 #include <map>
12 #include <vector>
13 
14 namespace Scine {
15 
16 namespace Utils {
17 class AtomCollection;
18 } // namespace Utils
19 
20 namespace SwooseUtilities {
21 
23  public:
30  FragmentAnalyzer(const std::map<int, int>& formalCharges, const std::map<int, int>& unpairedElectrons);
40  bool analyzeFragment(const Utils::AtomCollection& fragment, const std::vector<int>& atomIndexMapping = {});
44  int getMolecularCharge() const;
48  int getSpinMultiplicity() const;
49 
50  private:
51  /*
52  * @brief Evaluates the charge of a fragment based on the formal charges map in the ParametrizationData object.
53  */
54  int evaluateChargeOfFragment(const Utils::AtomCollection& fragment, const std::vector<int>& atomIndexMapping);
55  /*
56  * @brief Analyzes the spin multiplicity, updates the corresponding member variable
57  * and returns whether the fragment is valid.
58  */
59  bool analyzeSpinMultiplicity(const Utils::AtomCollection& fragment, int numElectrons, const std::vector<int>& atomIndexMapping);
60  /*
61  * @brief Sums up either the formal charges or the unpaired electrons of all atoms in a given fragment.
62  * The information about which atoms have which values is given through a map.
63  */
64  int sumUpValuesOfAtomsInFragment(const Utils::AtomCollection& fragment, const std::vector<int>& atomIndexMapping,
65  const std::map<int, int>& valuesMap);
66  // The molecular charge of the fragment that was previously analyzed.
67  int molecularCharge_ = 0;
68  // The spin multiplicity of the fragment that was previously analyzed.
69  int spinMultiplicity_ = 1;
70  /*
71  * @brief A map containing the indices of atoms and their formal charge in the full system.
72  */
73  const std::map<int, int>& formalCharges_;
74  /*
75  * @brief A map containing the indices of atoms and the number of unpaired electrons that can
76  * be assigned to that atom.
77  */
78  const std::map<int, int>& unpairedElectrons_;
79 };
80 
81 } // namespace SwooseUtilities
82 } // namespace Scine
83 
84 #endif // SWOOSEUTILITIES_FRAGMENTANALYZER_H
bool analyzeFragment(const Utils::AtomCollection &fragment, const std::vector< int > &atomIndexMapping={})
Determines whether a given fragment is valid and if it is, evaluates the charge and multiplicity of t...
Definition: FragmentAnalyzer.cpp:19
FragmentAnalyzer(const std::map< int, int > &formalCharges, const std::map< int, int > &unpairedElectrons)
Constructor.
Definition: FragmentAnalyzer.cpp:15
int getMolecularCharge() const
Getter for the molecular charge of the fragment that was previously analyzed.
Definition: FragmentAnalyzer.cpp:41
int getSpinMultiplicity() const
Getter for the spin multiplicity of the fragment that was previously analyzed.
Definition: FragmentAnalyzer.cpp:37
Definition: FragmentAnalyzer.h:22