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
24
#include <
RDGeneral/BoostStartInclude.h
>
25
#include <boost/rational.hpp>
26
#include <
RDGeneral/BoostEndInclude.h
>
27
28
namespace
RDKit
{
29
30
namespace
CIPLabeler
{
31
32
class
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.
39
class
FractionalAtomicNum
{
40
public
:
41
FractionalAtomicNum
(
int
numerator
,
int
denominator
)
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
*/
62
std::vector<FractionalAtomicNum>
calcFracAtomNums
(
const
CIPMol
&mol);
63
64
}
// namespace CIPLabeler
65
}
// namespace RDKit
BoostEndInclude.h
BoostStartInclude.h
RDKit::CIPLabeler::CIPMol
Definition
CIPMol.h:66
RDKit::CIPLabeler::FractionalAtomicNum::denominator
int denominator() const
Definition
Mancude.h:47
RDKit::CIPLabeler::FractionalAtomicNum::isAveraged
bool isAveraged() const
Definition
Mancude.h:48
RDKit::CIPLabeler::FractionalAtomicNum::numerator
int numerator() const
Definition
Mancude.h:46
RDKit::CIPLabeler::FractionalAtomicNum::FractionalAtomicNum
FractionalAtomicNum(int numerator, int denominator)
Definition
Mancude.h:41
RDKit::CIPLabeler::FractionalAtomicNum::value
boost::rational< int > value() const
Definition
Mancude.h:44
RDKit::CIPLabeler
Definition
CIPLabeler.h:27
RDKit::CIPLabeler::calcFracAtomNums
std::vector< FractionalAtomicNum > calcFracAtomNums(const CIPMol &mol)
RDKit
Std stuff.
Definition
Abbreviations.h:19
GraphMol
CIPLabeler
Mancude.h
Generated on
for RDKit by
1.15.0