0
# Molecular Descriptors
1
2
Calculation of 2D molecular descriptors for characterizing chemical properties. RDKit provides 217+ molecular descriptors covering molecular weight, lipophilicity, topological indices, structural features, and pharmacophore properties for quantitative structure-activity relationship (QSAR) analysis and chemical space exploration.
3
4
## Capabilities
5
6
### Basic Descriptors
7
8
Fundamental molecular properties including molecular weight, heavy atom count, and basic structural metrics.
9
10
```python { .api }
11
def MolWt(mol: Mol) -> float:
12
"""
13
Calculate molecular weight.
14
15
Parameters:
16
- mol: Input molecule
17
18
Returns:
19
Molecular weight in Daltons
20
"""
21
22
def ExactMolWt(mol: Mol) -> float:
23
"""
24
Calculate exact molecular weight using isotopic masses.
25
26
Parameters:
27
- mol: Input molecule
28
29
Returns:
30
Exact molecular weight in Daltons
31
"""
32
33
def HeavyAtomCount(mol: Mol) -> int:
34
"""
35
Count heavy (non-hydrogen) atoms.
36
37
Parameters:
38
- mol: Input molecule
39
40
Returns:
41
Number of heavy atoms
42
"""
43
44
def NumHeteroatoms(mol: Mol) -> int:
45
"""
46
Count heteroatoms (non-carbon heavy atoms).
47
48
Parameters:
49
- mol: Input molecule
50
51
Returns:
52
Number of heteroatoms
53
"""
54
```
55
56
### Lipophilicity Descriptors
57
58
Descriptors related to molecular lipophilicity and solubility properties.
59
60
```python { .api }
61
def MolLogP(mol: Mol) -> float:
62
"""
63
Calculate Wildman-Crippen LogP.
64
65
Parameters:
66
- mol: Input molecule
67
68
Returns:
69
Calculated LogP value
70
"""
71
72
def MolMR(mol: Mol) -> float:
73
"""
74
Calculate Wildman-Crippen molar refractivity.
75
76
Parameters:
77
- mol: Input molecule
78
79
Returns:
80
Molar refractivity value
81
"""
82
83
def TPSA(mol: Mol) -> float:
84
"""
85
Calculate topological polar surface area.
86
87
Parameters:
88
- mol: Input molecule
89
90
Returns:
91
TPSA value in Ų
92
"""
93
```
94
95
### Hydrogen Bonding Descriptors
96
97
Descriptors for hydrogen bond donors and acceptors, critical for drug-like property assessment.
98
99
```python { .api }
100
def NumHDonors(mol: Mol) -> int:
101
"""
102
Count hydrogen bond donors.
103
104
Parameters:
105
- mol: Input molecule
106
107
Returns:
108
Number of hydrogen bond donors
109
"""
110
111
def NumHAcceptors(mol: Mol) -> int:
112
"""
113
Count hydrogen bond acceptors.
114
115
Parameters:
116
- mol: Input molecule
117
118
Returns:
119
Number of hydrogen bond acceptors
120
"""
121
```
122
123
### Ring Descriptors
124
125
Descriptors characterizing ring systems and cyclic structures.
126
127
```python { .api }
128
def RingCount(mol: Mol) -> int:
129
"""
130
Count number of rings.
131
132
Parameters:
133
- mol: Input molecule
134
135
Returns:
136
Total number of rings
137
"""
138
139
def NumAromaticRings(mol: Mol) -> int:
140
"""
141
Count aromatic rings.
142
143
Parameters:
144
- mol: Input molecule
145
146
Returns:
147
Number of aromatic rings
148
"""
149
150
def NumAliphaticRings(mol: Mol) -> int:
151
"""
152
Count aliphatic rings.
153
154
Parameters:
155
- mol: Input molecule
156
157
Returns:
158
Number of aliphatic rings
159
"""
160
161
def NumSaturatedRings(mol: Mol) -> int:
162
"""
163
Count saturated rings.
164
165
Parameters:
166
- mol: Input molecule
167
168
Returns:
169
Number of saturated rings
170
"""
171
```
172
173
### Topological Descriptors
174
175
Graph-based descriptors characterizing molecular topology and connectivity.
176
177
```python { .api }
178
def BertzCT(mol: Mol) -> float:
179
"""
180
Calculate Bertz topological complexity.
181
182
Parameters:
183
- mol: Input molecule
184
185
Returns:
186
Bertz complexity index
187
"""
188
189
def Kappa1(mol: Mol) -> float:
190
"""
191
Calculate first kappa shape index.
192
193
Parameters:
194
- mol: Input molecule
195
196
Returns:
197
Kappa1 shape index
198
"""
199
200
def Kappa2(mol: Mol) -> float:
201
"""
202
Calculate second kappa shape index.
203
204
Parameters:
205
- mol: Input molecule
206
207
Returns:
208
Kappa2 shape index
209
"""
210
211
def Kappa3(mol: Mol) -> float:
212
"""
213
Calculate third kappa shape index.
214
215
Parameters:
216
- mol: Input molecule
217
218
Returns:
219
Kappa3 shape index
220
"""
221
```
222
223
### Comprehensive Descriptor Calculation
224
225
Functions for calculating multiple descriptors simultaneously.
226
227
```python { .api }
228
def CalcMolDescriptors(mol: Mol) -> dict:
229
"""
230
Calculate all available molecular descriptors.
231
232
Parameters:
233
- mol: Input molecule
234
235
Returns:
236
Dictionary mapping descriptor names to values
237
"""
238
239
_descList: list
240
"""
241
List of all available descriptor names and functions.
242
Contains 217 descriptor definitions in version 2024.9.6.
243
Each entry is a tuple of (name, function).
244
"""
245
```
246
247
### Fragment Descriptors
248
249
Descriptors based on molecular fragments and substructures.
250
251
```python { .api }
252
def fr_Al_COO(mol: Mol) -> int:
253
"""
254
Count aliphatic carboxylic acid fragments.
255
256
Parameters:
257
- mol: Input molecule
258
259
Returns:
260
Number of aliphatic carboxylic acid groups
261
"""
262
263
def fr_ArN(mol: Mol) -> int:
264
"""
265
Count aromatic nitrogen fragments.
266
267
Parameters:
268
- mol: Input molecule
269
270
Returns:
271
Number of aromatic nitrogens
272
"""
273
274
def fr_benzene(mol: Mol) -> int:
275
"""
276
Count benzene rings.
277
278
Parameters:
279
- mol: Input molecule
280
281
Returns:
282
Number of benzene rings
283
"""
284
```
285
286
## Usage Examples
287
288
### Basic Descriptor Calculations
289
290
```python
291
from rdkit import Chem
292
from rdkit.Chem import Descriptors
293
294
# Calculate basic descriptors
295
mol = Chem.MolFromSmiles('CCO') # Ethanol
296
mw = Descriptors.MolWt(mol)
297
logp = Descriptors.MolLogP(mol)
298
tpsa = Descriptors.TPSA(mol)
299
hbd = Descriptors.NumHDonors(mol)
300
hba = Descriptors.NumHAcceptors(mol)
301
302
print(f"Molecular Weight: {mw:.2f}")
303
print(f"LogP: {logp:.2f}")
304
print(f"TPSA: {tpsa:.2f}")
305
print(f"H-bond Donors: {hbd}")
306
print(f"H-bond Acceptors: {hba}")
307
```
308
309
### Calculate All Descriptors
310
311
```python
312
from rdkit import Chem
313
from rdkit.Chem import Descriptors
314
315
# Calculate all available descriptors
316
mol = Chem.MolFromSmiles('CCO')
317
all_descriptors = Descriptors.CalcMolDescriptors(mol)
318
319
print(f"Total descriptors calculated: {len(all_descriptors)}")
320
for name, value in list(all_descriptors.items())[:10]: # Show first 10
321
print(f"{name}: {value}")
322
```
323
324
### Drug-like Property Assessment
325
326
```python
327
from rdkit import Chem
328
from rdkit.Chem import Descriptors
329
330
def assess_drug_likeness(smiles):
331
"""Assess Lipinski's Rule of Five compliance."""
332
mol = Chem.MolFromSmiles(smiles)
333
if mol is None:
334
return None
335
336
mw = Descriptors.MolWt(mol)
337
logp = Descriptors.MolLogP(mol)
338
hbd = Descriptors.NumHDonors(mol)
339
hba = Descriptors.NumHAcceptors(mol)
340
341
violations = 0
342
if mw > 500: violations += 1
343
if logp > 5: violations += 1
344
if hbd > 5: violations += 1
345
if hba > 10: violations += 1
346
347
return {
348
'MW': mw,
349
'LogP': logp,
350
'HBD': hbd,
351
'HBA': hba,
352
'Violations': violations,
353
'Drug-like': violations <= 1
354
}
355
356
# Test with aspirin
357
result = assess_drug_likeness('CC(=O)OC1=CC=CC=C1C(=O)O')
358
print(result)
359
```
360
361
### Descriptor List Access
362
363
```python
364
from rdkit.Chem import Descriptors
365
366
# Access all available descriptors
367
print(f"Total descriptors available: {len(Descriptors._descList)}")
368
369
# Show first 10 descriptor names
370
for i, (name, func) in enumerate(Descriptors._descList[:10]):
371
print(f"{i+1}: {name}")
372
```