RDKit
Open-source cheminformatics and machine learning.
Metal.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2018-2021 Susan H. Leung and other RDKit contributors
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 Metal.h
11 
12  \brief Defines the MetalDisconnector class.
13 
14 */
15 #include <RDGeneral/export.h>
16 #ifndef RD_METAL_H
17 #define RD_METAL_H
18 
19 #include <GraphMol/ROMol.h>
20 
21 namespace RDKit {
22 class RWMol;
23 class ROMol;
24 
25 namespace MolStandardize {
26 //! The MetalDisconnector class contains tools for disconnecting metal atoms
27 //! that are defined as covalently bonded to non-metals.
28 /*!
29 
30  <b>Notes:</b>
31  -
32 */
33 
35  bool splitGrignards = false; // Whether to split Grignard-type complexes.
36  bool splitAromaticC = false; // Whether to split metal-aromatic C bonds.
37  bool adjustCharges = true; // Whether to adjust charges on ligand atoms.
38  bool removeHapticDummies =
39  false; // Whether to remove the dummy atoms representing haptic bonds.
40  // Such dummies are bonded to the metal with a bond
41  // that has the _MolFileBondEndPts prop set.
42 };
43 
45  public:
50 
51  ROMol *getMetalNof(); // {return dp_metal_nof;}
52  ROMol *getMetalNon(); // {return dp_metal_non;}
53  void setMetalNof(const ROMol &mol);
54  void setMetalNon(const ROMol &mol);
55 
56  //! Break covalent bonds between metals and organic atoms under certain
57  //! conditions.
58  /*!
59  <b>Notes:</b>
60  The algorithm works as follows:
61 - Disconnect N, O, F from any metal.
62 - Disconnect other non-metals from transition metals + Al (but not Hg, Ga, Ge,
63 In, Sn, As, Tl, Pb, Bi, Po).
64  - For every bond broken, adjust the charges of the begin and end atoms
65 accordingly.
66  */
67  ROMol *disconnect(const ROMol &mol);
68  //! overload
69  /// modifies the molecule in place
70  void disconnect(RWMol &mol);
71 
72  private:
73  struct NonMetal {
74  int cutBonds{0};
75  std::vector<int> boundMetalIndices;
76  };
77  int chargeAdjustment(const Atom *a, int order);
78  ROMOL_SPTR dp_metal_nof;
79  ROMOL_SPTR dp_metal_non;
80  ROMOL_SPTR dp_metalDummy;
81 
82  const MetalDisconnectorOptions d_options;
83 
84  void adjust_charges(RDKit::RWMol &mol, std::map<int, NonMetal> &nonMetals,
85  std::map<int, int> &metalChargeExcess);
86  // Remove any dummy atoms that are bonded to a metal and have the ENDPTS
87  // prop. These are assumed to marking a haptic bond from the aotms in
88  // ENDPTS to the metal, e.g. in ferrocene.
89  void remove_haptic_dummies(RDKit::RWMol &mol);
90 
91 }; // class Metal
92 
93 } // namespace MolStandardize
94 } // namespace RDKit
95 #endif
Defines the primary molecule class ROMol as well as associated typedefs.
The class for representing atoms.
Definition: Atom.h:68
ROMol * disconnect(const ROMol &mol)
MetalDisconnector(const MetalDisconnectorOptions &options=MetalDisconnectorOptions())
MetalDisconnector(const MetalDisconnector &other)
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:32
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition: export.h:321
Std stuff.
Definition: Abbreviations.h:19
boost::shared_ptr< ROMol > ROMOL_SPTR