RDKit
Open-source cheminformatics and machine learning.
ReCharge.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2016 Novartis Institutes for BioMedical Research
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 #pragma once
11 #include "StructChecker.h"
12 #include "Pattern.h"
13 #include "Utilites.h"
14 
15 namespace RDKit {
16 namespace StructureCheck {
17 /*
18 * Returns the total charge of all atoms in molecule.
19 */
20 int TotalCharge(const ROMol &mol);
21 
22 class ChargeFix {
23  const StructCheckerOptions &Options;
24  RWMol &Mol;
25  std::vector<unsigned> BondColor;
26  std::vector<unsigned> AtomColor;
27  std::vector<double> AtompKaValue;
28  std::vector<double> AtomOldpKaValue;
29 
30  public:
32  : Options(op), Mol(mol) {
33  resetColors();
34  resetValues();
35  }
36  /*
37  * Removes hydrogens from *mp until desired_charge is reached. The
38  * positions for hydrogen removal are selected by "acidity" combined
39  * with a refinement algorithm. It returns TRUE if molecule could be
40  * neutralized and FALSE if any problem were encountered.
41  * *ndeprot and *nrefine are set to the number of deprotonations
42  * and refinement cycles performed.
43  */
44  bool rechargeMolecule(unsigned &ndeprot, unsigned &nrefine);
45 
46  private: // internal helpers:
47  bool setpKaValues();
48  void decrementMarkedCharges();
49  int markMostAcidicAtoms(double &pKa_value, double &gap);
50  int refineAcidicAtoms(std::vector<unsigned> &numbering);
51  void resetColors();
52  void resetValues();
53 };
54 }
55 }
bool rechargeMolecule(unsigned &ndeprot, unsigned &nrefine)
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:30
Contains the public API of the StructChecker.
int TotalCharge(const ROMol &mol)
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
ChargeFix(const StructCheckerOptions &op, RWMol &mol)
Definition: ReCharge.h:31