1#
2# Copyright (C) 2016 greg Landrum
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""" Descriptors derived from a molecule's 3D structure
11
12"""
13
14from rdkit.Chem import rdMolDescriptors
15
16
17if hasattr(rdMolDescriptors, 'CalcPMI1'):
18  PMI1 = lambda *x, **y: rdMolDescriptors.CalcPMI1(*x, **y)
19  PMI1.version = rdMolDescriptors._CalcPMI1_version
20  PMI1.__doc__ = """ First (smallest) principal moment of inertia
21
22
23    **Arguments**
24
25      - inMol: a molecule
26
27      - confId: (optional) the conformation ID to use
28
29      - useAtomicMasses: (optional) toggles use of atomic masses in the
30        calculation. Defaults to True
31    """
32
33  PMI2 = lambda *x, **y: rdMolDescriptors.CalcPMI2(*x, **y)
34  PMI2.version = rdMolDescriptors._CalcPMI2_version
35  PMI2.__doc__ = """ Second principal moment of inertia
36
37    **Arguments**
38
39      - inMol: a molecule
40
41      - confId: (optional) the conformation ID to use
42
43      - useAtomicMasses: (optional) toggles use of atomic masses in the
44        calculation. Defaults to True
45    """
46
47  PMI3 = lambda *x, **y: rdMolDescriptors.CalcPMI3(*x, **y)
48  PMI3.version = rdMolDescriptors._CalcPMI3_version
49  PMI3.__doc__ = """ Third (largest) principal moment of inertia
50
51    **Arguments**
52
53      - inMol: a molecule
54
55      - confId: (optional) the conformation ID to use
56
57      - useAtomicMasses: (optional) toggles use of atomic masses in the
58        calculation. Defaults to True
59    """
60
61  NPR1 = lambda *x, **y: rdMolDescriptors.CalcNPR1(*x, **y)
62  NPR1.version = rdMolDescriptors._CalcNPR1_version
63  NPR1.__doc__ = """ Normalized principal moments ratio 1 (=I1/I3)
64
65        from Sauer and Schwarz JCIM 43:987-1003 (2003)
66        https://doi.org/10.1021/ci025599w
67
68
69    **Arguments**
70
71      - inMol: a molecule
72
73      - confId: (optional) the conformation ID to use
74
75      - useAtomicMasses: (optional) toggles use of atomic masses in the
76        calculation. Defaults to True
77    """
78
79  NPR2 = lambda *x, **y: rdMolDescriptors.CalcNPR2(*x, **y)
80  NPR2.version = rdMolDescriptors._CalcNPR2_version
81  NPR2.__doc__ = """ Normalized principal moments ratio 2 (=I2/I3)
82
83        from Sauer and Schwarz JCIM 43:987-1003 (2003)
84        https://doi.org/10.1021/ci025599w
85
86
87    **Arguments**
88
89      - inMol: a molecule
90
91      - confId: (optional) the conformation ID to use
92
93      - useAtomicMasses: (optional) toggles use of atomic masses in the
94        calculation. Defaults to True
95    """
96
97  RadiusOfGyration = lambda *x, **y: rdMolDescriptors.CalcRadiusOfGyration(*x, **y)
98  RadiusOfGyration.version = rdMolDescriptors._CalcRadiusOfGyration_version
99  RadiusOfGyration.__doc__ = """ Radius of gyration
100
101       from Todeschini and Consoni "Descriptors from Molecular Geometry"
102       Handbook of Chemoinformatics
103       https://doi.org/10.1002/9783527618279.ch37
104
105       Definition:
106         for planar molecules: sqrt( sqrt(pm3*pm2)/MW )
107         for nonplanar molecules: sqrt( 2*pi*pow(pm3*pm2*pm1,1/3)/MW )
108
109    **Arguments**
110
111      - inMol: a molecule
112
113      - confId: (optional) the conformation ID to use
114
115      - useAtomicMasses: (optional) toggles use of atomic masses in the
116        calculation. Defaults to True
117    """
118
119  InertialShapeFactor = lambda *x, **y: rdMolDescriptors.CalcInertialShapeFactor(*x, **y)
120  InertialShapeFactor.version = rdMolDescriptors._CalcInertialShapeFactor_version
121  InertialShapeFactor.__doc__ = """ Inertial shape factor
122
123       from Todeschini and Consoni "Descriptors from Molecular Geometry"
124       Handbook of Chemoinformatics
125       https://doi.org/10.1002/9783527618279.ch37
126
127       Definition:
128         pm2 / (pm1*pm3)
129
130    **Arguments**
131
132      - inMol: a molecule
133
134      - confId: (optional) the conformation ID to use
135
136      - useAtomicMasses: (optional) toggles use of atomic masses in the
137        calculation. Defaults to True
138    """
139
140  Eccentricity = lambda *x, **y: rdMolDescriptors.CalcEccentricity(*x, **y)
141  Eccentricity.version = rdMolDescriptors._CalcEccentricity_version
142  Eccentricity.__doc__ = """ molecular eccentricity
143
144       from Todeschini and Consoni "Descriptors from Molecular Geometry"
145       Handbook of Chemoinformatics
146       https://doi.org/10.1002/9783527618279.ch37
147
148       Definition:
149         sqrt(pm3**2 -pm1**2) / pm3**2
150
151    **Arguments**
152
153      - inMol: a molecule
154
155      - confId: (optional) the conformation ID to use
156
157      - useAtomicMasses: (optional) toggles use of atomic masses in the
158        calculation. Defaults to True
159    """
160
161  Asphericity = lambda *x, **y: rdMolDescriptors.CalcAsphericity(*x, **y)
162  Asphericity.version = rdMolDescriptors._CalcAsphericity_version
163  Asphericity.__doc__ = """ molecular asphericity
164
165       from Todeschini and Consoni "Descriptors from Molecular Geometry"
166       Handbook of Chemoinformatics
167       https://doi.org/10.1002/9783527618279.ch37
168
169       Definition:
170         0.5 * ((pm3-pm2)**2 + (pm3-pm1)**2 + (pm2-pm1)**2)/(pm1**2+pm2**2+pm3**2)
171
172    **Arguments**
173
174      - inMol: a molecule
175
176      - confId: (optional) the conformation ID to use
177
178      - useAtomicMasses: (optional) toggles use of atomic masses in the
179        calculation. Defaults to True
180    """
181
182  SpherocityIndex = lambda *x, **y: rdMolDescriptors.CalcSpherocityIndex(*x, **y)
183  SpherocityIndex.version = rdMolDescriptors._CalcSpherocityIndex_version
184  SpherocityIndex.__doc__ = """ Molecular spherocityIndex
185
186       from Todeschini and Consoni "Descriptors from Molecular Geometry"
187       Handbook of Chemoinformatics
188       https://doi.org/10.1002/9783527618279.ch37
189
190       Definition:
191         3 * pm1 / (pm1+pm2+pm3) where the moments are calculated without weights
192
193    **Arguments**
194
195      - inMol: a molecule
196
197      - confId: (optional) the conformation ID to use
198
199    """
200