RDKit
Open-source cheminformatics and machine learning.
Charge.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2018 Susan H. Leung
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 /*! \file Charge.h
11 
12  \brief Defines the Reionizer class and Uncharger class.
13 
14 */
15 #include <RDGeneral/export.h>
16 #ifndef __RD_CHARGE_H__
17 #define __RD_CHARGE_H__
18 
19 #include "MolStandardize.h"
20 #include <Catalogs/Catalog.h>
23 
24 namespace RDKit {
25 class RWMol;
26 class ROMol;
27 
28 namespace MolStandardize {
29 
30 RDKIT_MOLSTANDARDIZE_EXPORT extern const CleanupParameters
32 
33 typedef RDCatalog::HierarchCatalog<AcidBaseCatalogEntry, AcidBaseCatalogParams,
34  int>
36 
38  std::string Name;
39  std::string Smarts;
40  int Charge;
41 
42  ChargeCorrection(std::string name, std::string smarts, int charge)
43  : Name(name), Smarts(smarts), Charge(charge) {}
44 };
45 
46 // The default list of ChargeCorrections.
47 RDKIT_MOLSTANDARDIZE_EXPORT extern std::vector<ChargeCorrection>
49 
50 //! The reionizer class to fix charges and reionize a molecule such that the
51 // strongest acids ionize first.
52 /*!
53 
54  <b>Notes:</b>
55  -
56 */
57 
59  public:
60  Reionizer();
61  //! construct a Reionizer with a particular acidbaseFile
62  Reionizer(const std::string acidbaseFile);
63  //! construct a Reionizer with a particular acidbaseFile and charge
64  // corrections
65  Reionizer(const std::string acidbaseFile,
66  const std::vector<ChargeCorrection> ccs);
67  //! making Reionizer objects non-copyable
68  Reionizer(const Reionizer &other) = delete;
69  Reionizer &operator=(Reionizer const &) = delete;
70  ~Reionizer();
71 
72  //! Enforce charges on certain atoms, then perform competitive reionization.
73  ROMol *reionize(const ROMol &mol);
74 
75  private:
76  AcidBaseCatalog *d_abcat;
77  std::vector<ChargeCorrection> d_ccs;
78 
79  std::pair<unsigned int, std::vector<unsigned int>> *strongestProtonated(
80  const ROMol &mol,
81  const std::vector<std::pair<ROMOL_SPTR, ROMOL_SPTR>> &abpairs);
82  std::pair<unsigned int, std::vector<unsigned int>> *weakestIonized(
83  const ROMol &mol,
84  const std::vector<std::pair<ROMOL_SPTR, ROMOL_SPTR>> &abpairs);
85 
86 }; // Reionizer class
87 
88 //! The Uncharger class for neutralizing ionized acids and bases.
89 /*!
90 
91  <b>Notes:</b>
92  - This class uncharges molecules by adding and/or removing hydrogens.
93  - For zwitterions, hydrogens are moved to eliminate charges where
94  possible.
95  - In cases where there is a positive charge that is not neutralizable,
96  an attempt is made to also preserve the corresponding
97  negative charge.
98 
99 */
100 
102  public:
103  Uncharger();
104  Uncharger(const Uncharger &other);
105  ~Uncharger();
106 
107  ROMol *uncharge(const ROMol &mol);
108 
109  private:
110  std::shared_ptr<ROMol> pos_h;
111  std::shared_ptr<ROMol> pos_quat;
112  std::shared_ptr<ROMol> neg;
113  std::shared_ptr<ROMol> neg_acid;
114 }; // Uncharger class
115 
116 } // namespace MolStandardize
117 } // namespace RDKit
118 #endif
RDKIT_MOLSTANDARDIZE_EXPORT const CleanupParameters defaultCleanupParameters
Definition: Fragment.h:25
A Catalog with a hierarchical structure.
Definition: Catalog.h:135
The reionizer class to fix charges and reionize a molecule such that the.
Definition: Charge.h:58
RDKIT_MOLSTANDARDIZE_EXPORT std::vector< ChargeCorrection > CHARGE_CORRECTIONS
RDKIT_MOLSTANDARDIZE_EXPORT RWMol * reionize(const RWMol *mol, const CleanupParameters &params=defaultCleanupParameters)
Works the same as Reionizer().reionize(mol)
RDCatalog::HierarchCatalog< AcidBaseCatalogEntry, AcidBaseCatalogParams, int > AcidBaseCatalog
Definition: Charge.h:35
Std stuff.
Definition: Atom.h:30
The Uncharger class for neutralizing ionized acids and bases.
Definition: Charge.h:101
Defines the CleanupParameters and some convenience functions.
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition: export.h:424
ChargeCorrection(std::string name, std::string smarts, int charge)
Definition: Charge.h:42