RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
Mancude.h
Go to the documentation of this file.
1//
2//
3// Copyright (C) 2020 Schrödinger, LLC
4//
5// @@ All Rights Reserved @@
6// This file is part of the RDKit.
7// The contents are covered by the terms of the BSD license
8// which is included in the file license.txt, found at the root
9// of the RDKit source tree.
10//
11
12///
13/// Utilities to handle atomic numbers in Mancude (maximum number
14/// of noncumulative double bonds) rings
15///
16/// This guarantees that aromatic rings containing heteroatoms
17/// are always resolved in the same way
18///
19
20#pragma once
21
22#include <vector>
23
25#include <boost/rational.hpp>
27
28namespace RDKit {
29
30namespace CIPLabeler {
31
32class CIPMol;
33
34// boost::rational reduces its numerator and denominator on construction. The
35// unreduced denominator is also significant here: it records that an atomic
36// number was averaged over a Mancude system, even when the average happens to
37// be an integer (for example, 12/3). Keep both the value used for comparison
38// and that metadata.
40 public:
42 : d_numerator{numerator}, d_denominator{denominator} {}
43
44 boost::rational<int> value() const { return {d_numerator, d_denominator}; }
45
46 int numerator() const { return d_numerator; }
47 int denominator() const { return d_denominator; }
48 bool isAveraged() const { return d_denominator > 1; }
49
50 private:
51 int d_numerator = 0;
52 int d_denominator = 0;
53};
54
55/**
56 * Calculate fractional atomic numbers for all atoms in the mol.
57 * Using fractional atomic numbers makes sure that atoms in rings
58 * that have resonant structures are always considered with the same
59 * priority.
60 *
61 */
62std::vector<FractionalAtomicNum> calcFracAtomNums(const CIPMol &mol);
63
64} // namespace CIPLabeler
65} // namespace RDKit
FractionalAtomicNum(int numerator, int denominator)
Definition Mancude.h:41
boost::rational< int > value() const
Definition Mancude.h:44
std::vector< FractionalAtomicNum > calcFracAtomNums(const CIPMol &mol)
Std stuff.