1
|
|
|
#! /usr/bin/env python |
2
|
|
|
# |
3
|
|
|
# Copyright (C) 2015-2016 Rich Lewis <[email protected]> |
4
|
|
|
# License: 3-clause BSD |
5
|
|
|
|
6
|
|
|
|
7
|
1 |
|
""" |
8
|
|
|
## skchem.core.atom |
9
|
|
|
|
10
|
|
|
Defining atoms in scikit-chem. |
11
|
|
|
""" |
12
|
|
|
|
13
|
1 |
|
import numpy as np |
|
|
|
|
14
|
1 |
|
import pandas as pd |
|
|
|
|
15
|
|
|
|
16
|
1 |
|
from rdkit import Chem |
|
|
|
|
17
|
1 |
|
from rdkit.Chem.rdchem import GetPeriodicTable |
|
|
|
|
18
|
1 |
|
from rdkit.Chem.AtomPairs.Utils import NumPiElectrons |
|
|
|
|
19
|
|
|
|
20
|
1 |
|
from .base import ChemicalObject, PropertyView, ChemicalObjectView |
21
|
1 |
|
from ..resource import PERIODIC_TABLE |
22
|
|
|
|
23
|
|
|
|
24
|
1 |
|
RD_PT = GetPeriodicTable() |
25
|
|
|
|
26
|
|
|
|
27
|
1 |
|
class Atom(Chem.rdchem.Atom, ChemicalObject): |
|
|
|
|
28
|
|
|
|
29
|
|
|
""" Object representing an Atom in scikit-chem. """ |
30
|
|
|
|
31
|
1 |
|
@property |
32
|
|
|
def owner(self): |
33
|
|
|
|
34
|
|
|
""" skchem.Mol: the owning molecule. |
35
|
|
|
|
36
|
|
|
Warnings: |
37
|
|
|
This will seg fault if the atom is created manually. |
38
|
|
|
""" |
39
|
1 |
|
from .mol import Mol |
40
|
1 |
|
return Mol.from_super(self.GetOwningMol()) |
|
|
|
|
41
|
|
|
|
42
|
1 |
|
@property |
43
|
|
|
def bonds(self): |
44
|
|
|
|
45
|
|
|
""" tuple<skchem.Bonds>: the bonds to this `Atom`. """ |
46
|
|
|
|
47
|
1 |
|
from .bond import Bond # as bond imports atom, have to do it here |
48
|
1 |
|
return tuple(Bond.from_super(bond) for bond in self.GetBonds()) |
|
|
|
|
49
|
|
|
|
50
|
1 |
|
def neighbours(self): |
51
|
|
|
|
52
|
|
|
""" tuple<Atom>: the neighbours of the atom. """ |
53
|
|
|
|
54
|
1 |
|
return tuple(Atom.from_super(neigh) for neigh in self.GetNeighbors()) |
|
|
|
|
55
|
|
|
|
56
|
1 |
|
@property |
57
|
|
|
def symbol(self): |
58
|
|
|
|
59
|
|
|
""" str: the element symbol of the atom. """ |
60
|
|
|
|
61
|
1 |
|
return self.GetSymbol() |
|
|
|
|
62
|
|
|
|
63
|
1 |
|
@property |
64
|
|
|
def atomic_number(self): |
65
|
|
|
|
66
|
|
|
""" int: the atomic number of the atom. """ |
67
|
|
|
|
68
|
1 |
|
return self.GetAtomicNum() |
|
|
|
|
69
|
|
|
|
70
|
1 |
|
@property |
71
|
|
|
def atomic_mass(self): |
72
|
|
|
|
73
|
|
|
""" float: the atomic mass of the atom in u. """ |
74
|
|
|
|
75
|
1 |
|
return self.GetMass() |
|
|
|
|
76
|
|
|
|
77
|
1 |
|
@property |
78
|
|
|
def formal_charge(self): |
79
|
|
|
|
80
|
|
|
""" int: the formal charge. """ |
81
|
|
|
|
82
|
1 |
|
return int(self.GetFormalCharge()) |
|
|
|
|
83
|
|
|
|
84
|
1 |
|
@property |
85
|
|
|
def degree(self): |
86
|
|
|
|
87
|
|
|
""" int: the degree of the atom. """ |
88
|
|
|
|
89
|
1 |
|
return self.GetDegree() |
|
|
|
|
90
|
|
|
|
91
|
1 |
|
@property |
92
|
|
|
def depleted_degree(self): |
93
|
|
|
|
94
|
|
|
""" int: the degree of the atom in the h depleted molecular graph. """ |
95
|
|
|
|
96
|
1 |
|
return self.degree - self.n_instanced_hs |
97
|
|
|
|
98
|
1 |
|
@property |
99
|
|
|
def full_degree(self): |
100
|
|
|
|
101
|
|
|
""" int: the full degree of the atom in the h full molecular graph. """ |
102
|
|
|
|
103
|
1 |
|
return self.degree + self.n_hs |
104
|
|
|
|
105
|
1 |
|
@property |
106
|
|
|
def valence_degree(self): |
107
|
|
|
|
108
|
|
|
""" int: the valence degree. |
|
|
|
|
109
|
|
|
|
110
|
|
|
$$ \delta_i^v = Z_i^v - h_i $$ |
111
|
|
|
|
112
|
|
|
Where $ Z_i^v $ is the number of valence electrons and $ h_i $ is the |
113
|
|
|
number of hydrogens. |
114
|
|
|
""" |
115
|
|
|
|
116
|
1 |
|
res = self.n_val_electrons - self.n_hs |
117
|
|
|
|
118
|
|
|
# this seems drastic... |
119
|
|
|
#if self.principal_quantum_number > 2: |
120
|
|
|
# res /= self.atomic_number - self.n_val_electrons - 1 |
121
|
|
|
|
122
|
1 |
|
return res |
123
|
|
|
|
124
|
1 |
|
@property |
125
|
|
|
def n_hs(self): |
126
|
|
|
|
127
|
|
|
""" int: the instanced, implicit and explicit number of hydrogens """ |
128
|
|
|
|
129
|
1 |
|
return self.GetTotalNumHs() + self.n_instanced_hs |
|
|
|
|
130
|
|
|
|
131
|
1 |
|
@property |
132
|
|
|
def n_implicit_hs(self): |
133
|
|
|
|
134
|
|
|
""" int: the number of implicit hydrogens. """ |
135
|
|
|
|
136
|
1 |
|
return self.GetNumExplicitHs() |
|
|
|
|
137
|
|
|
|
138
|
1 |
|
@property |
139
|
|
|
def n_explicit_hs(self): |
140
|
|
|
|
141
|
|
|
""" int: the number of explicit hydrogens. """ |
142
|
|
|
|
143
|
1 |
|
return self.GetNumImplicitHs() |
|
|
|
|
144
|
|
|
|
145
|
1 |
|
@property |
146
|
|
|
def n_instanced_hs(self): |
147
|
|
|
|
148
|
|
|
""" int: The number of instanced hydrogens. """ |
149
|
|
|
|
150
|
1 |
|
return sum(a.atomic_number == 1 |
151
|
|
|
for a in self.neighbours()) |
152
|
|
|
|
153
|
1 |
|
@property |
154
|
|
|
def n_total_hs(self): |
155
|
|
|
|
156
|
|
|
""" int: the total number of hydrogens (according to rdkit). """ |
157
|
|
|
|
158
|
1 |
|
return self.GetTotalNumHs() |
|
|
|
|
159
|
|
|
|
160
|
1 |
|
@property |
161
|
|
|
def n_val_electrons(self): |
162
|
|
|
|
163
|
|
|
""" int: the number of valence electrons. """ |
164
|
|
|
|
165
|
1 |
|
return RD_PT.GetNOuterElecs(self.atomic_number) |
166
|
|
|
|
167
|
1 |
|
@property |
168
|
|
|
def n_pi_electrons(self): |
169
|
|
|
|
170
|
|
|
""" int: the number of pi electrons. """ |
171
|
|
|
|
172
|
1 |
|
return NumPiElectrons(self) |
173
|
|
|
|
174
|
1 |
|
@property |
175
|
|
|
def n_lone_pairs(self): |
176
|
|
|
|
177
|
|
|
""" int: the number of lone pairs. """ |
178
|
|
|
|
179
|
1 |
|
return int(0.5 * (self.n_val_electrons - self.full_degree - |
180
|
|
|
self.formal_charge - self.n_pi_electrons)) |
181
|
|
|
|
182
|
1 |
|
@property |
183
|
|
|
def explicit_valence(self): |
184
|
|
|
|
185
|
|
|
""" int: the explicit valence. """ |
186
|
|
|
|
187
|
1 |
|
return self.GetExplicitValence() |
|
|
|
|
188
|
|
|
|
189
|
1 |
|
@property |
190
|
|
|
def implicit_valence(self): |
191
|
|
|
|
192
|
|
|
""" int: the implicit valence. """ |
193
|
|
|
|
194
|
1 |
|
return self.GetImplicitValence() |
|
|
|
|
195
|
|
|
|
196
|
1 |
|
@property |
197
|
|
|
def valence(self): |
198
|
|
|
|
199
|
|
|
""" int: the valence. """ |
200
|
|
|
|
201
|
1 |
|
return self.GetTotalValence() |
|
|
|
|
202
|
|
|
|
203
|
1 |
|
@property |
204
|
|
|
def hybridization_state(self): |
205
|
|
|
|
206
|
|
|
""" str: the hybridization state. """ |
207
|
|
|
|
208
|
1 |
|
return self.GetHybridization().name |
|
|
|
|
209
|
|
|
|
210
|
1 |
|
@property |
211
|
|
|
def chiral_tag(self): |
212
|
|
|
|
213
|
|
|
""" int: the chiral tag. """ |
214
|
|
|
|
215
|
1 |
|
return self.GetChiralTag() |
|
|
|
|
216
|
|
|
|
217
|
1 |
|
@property |
218
|
|
|
def cahn_ingold_prelog(self): |
219
|
|
|
|
220
|
|
|
""" The Cahn Ingold Prelog chirality indicator. """ |
221
|
1 |
|
try: |
222
|
1 |
|
return self.props['_CIPCode'] |
223
|
1 |
|
except KeyError: |
224
|
1 |
|
if self.owner is not None: |
225
|
1 |
|
Chem.FindMolChiralCenters(self.owner) |
226
|
1 |
|
return self.props.get('_CIPCode', None) |
227
|
|
|
|
228
|
1 |
|
@property |
229
|
|
|
def is_terminal(self): |
230
|
|
|
""" bool: whether the atom is terminal. """ |
231
|
|
|
|
232
|
1 |
|
return self.depleted_degree == 1 |
233
|
|
|
|
234
|
1 |
|
@property |
235
|
|
|
def is_aromatic(self): |
236
|
|
|
|
237
|
|
|
""" bool: whether the atom is aromatic. """ |
238
|
|
|
|
239
|
1 |
|
return self.GetIsAromatic() |
|
|
|
|
240
|
|
|
|
241
|
1 |
|
@property |
242
|
|
|
def is_in_ring(self): |
243
|
|
|
|
244
|
|
|
""" bool: whether the atom is in a ring. """ |
245
|
|
|
|
246
|
1 |
|
return any(b.is_in_ring for b in self.bonds) |
247
|
|
|
|
248
|
1 |
|
@property |
249
|
|
|
def van_der_waals_radius(self): |
250
|
|
|
|
251
|
|
|
""" float: the Van der Waals radius in angstroms. """ |
252
|
|
|
|
253
|
1 |
|
return PERIODIC_TABLE.van_der_waals_radius[self.atomic_number] |
254
|
|
|
|
255
|
1 |
|
@property |
256
|
|
|
def van_der_waals_volume(self): |
257
|
|
|
|
258
|
|
|
""" float: the van der waals volume in angstroms^3. |
|
|
|
|
259
|
|
|
|
260
|
|
|
$\frac{4}{3} \pi r_v^3 $ """ |
261
|
|
|
|
262
|
1 |
|
return PERIODIC_TABLE.van_der_waals_volume[self.atomic_number] |
263
|
|
|
|
264
|
1 |
|
_cov_dict = { |
265
|
|
|
6: {'SP': 0.60, 'SP2': 0.67, 'SP3': 0.77}, |
266
|
|
|
7: {'SP': 0.55, 'SP2': 0.62, 'SP3': 0.74}, |
267
|
|
|
8: {'SP2': 0.62, 'SP3': 0.74}, |
268
|
|
|
9: {'SP3': 0.72}, |
269
|
|
|
15: {'SP2': 1.00, 'SP3': 1.10}, |
270
|
|
|
16: {'SP2': 0.97, 'SP3': 1.04}, |
271
|
|
|
17: {'SP3': 0.99}, |
272
|
|
|
35: {'SP3': 1.14}, |
273
|
|
|
55: {'SP3': 1.33} |
274
|
|
|
} |
275
|
|
|
|
276
|
1 |
|
@property |
277
|
|
|
def covalent_radius(self): |
278
|
|
|
|
279
|
|
|
""" float: the covalent radius in angstroms. """ |
280
|
|
|
|
281
|
1 |
|
if self.atomic_number in self._cov_dict.keys(): |
282
|
1 |
|
return self._cov_dict[self.atomic_number][self.hybridization_state] |
283
|
|
|
else: |
284
|
1 |
|
return PERIODIC_TABLE.covalent_radius[self.atomic_number] |
285
|
|
|
|
286
|
1 |
|
@property |
287
|
|
|
def ionisation_energy(self): |
288
|
|
|
|
289
|
|
|
""" float: the first ionisation energy in eV. """ |
290
|
|
|
|
291
|
1 |
|
return PERIODIC_TABLE.first_ionisation_energy[self.atomic_number] |
292
|
|
|
|
293
|
1 |
|
@property |
294
|
|
|
def electron_affinity(self): |
295
|
|
|
|
296
|
|
|
""" float: the first electron affinity in eV. """ |
297
|
|
|
|
298
|
1 |
|
return PERIODIC_TABLE.electron_affinity[self.atomic_number] |
299
|
|
|
|
300
|
1 |
|
@property |
301
|
|
|
def principal_quantum_number(self): |
302
|
|
|
|
303
|
|
|
""" int: the principle quantum number. """ |
304
|
|
|
|
305
|
1 |
|
return np.digitize(self.atomic_number, |
306
|
|
|
np.array([1, 3, 11, 19, 37, 55, 87, 121])) |
307
|
|
|
|
308
|
1 |
|
@property |
309
|
|
|
def polarisability(self): |
310
|
|
|
|
311
|
|
|
""" float: the atomic polarisability in 10^{-20} m^3. """ |
312
|
|
|
|
313
|
1 |
|
return PERIODIC_TABLE.atomic_polarisability[self.atomic_number] |
314
|
|
|
|
315
|
1 |
|
@property |
316
|
|
|
def pauling_electronegativity(self): |
317
|
|
|
|
318
|
|
|
""" float: the pauling electronegativity on Pauling scale. """ |
319
|
|
|
|
320
|
1 |
|
return PERIODIC_TABLE.pauling_electronegativity[self.atomic_number] |
321
|
|
|
|
322
|
1 |
|
@property |
323
|
|
|
def sanderson_electronegativity(self): |
324
|
|
|
|
325
|
|
|
""" float: the sanderson electronegativity on Pauling scale. """ |
326
|
|
|
|
327
|
1 |
|
return PERIODIC_TABLE.sanderson_electronegativity[self.atomic_number] |
328
|
|
|
|
329
|
1 |
|
@property |
330
|
|
|
def kier_hall_electronegativity(self): |
331
|
|
|
|
332
|
|
|
""" float: the hall-keir electronegativity. """ |
333
|
|
|
|
334
|
1 |
|
if self.atomic_number == 1: |
335
|
1 |
|
return -0.2 |
336
|
|
|
else: |
337
|
1 |
|
return (self.valence_degree - self.depleted_degree) / \ |
338
|
|
|
(self.principal_quantum_number ** 2) |
339
|
|
|
|
340
|
1 |
|
@property |
341
|
|
|
def mcgowan_parameter(self): |
342
|
|
|
|
343
|
|
|
""" float: the mcgowan volume parameter""" |
344
|
|
|
|
345
|
1 |
|
return PERIODIC_TABLE.mcgowan_parameter[self.atomic_number] |
346
|
|
|
|
347
|
1 |
|
@property |
348
|
|
|
def kier_hall_alpha_contrib(self): |
349
|
|
|
|
350
|
|
|
""" float: the covalent radius in angstroms. """ |
351
|
|
|
|
352
|
1 |
|
return self.covalent_radius / 0.77 - 1 # 0.77 is sp3 C |
353
|
|
|
|
354
|
1 |
|
@property |
355
|
|
|
def intrinsic_state(self): |
356
|
|
|
|
357
|
|
|
""" float: the intrinsic state of the atom. """ |
358
|
|
|
|
359
|
1 |
|
return ((2 / self.principal_quantum_number) ** 2 * |
360
|
|
|
self.valence_degree + 1) / self.depleted_degree |
361
|
|
|
|
362
|
1 |
|
@property |
363
|
|
|
def hexcode(self): |
364
|
|
|
|
365
|
|
|
""" The hexcode to use as a color for the atom. """ |
366
|
|
|
|
367
|
1 |
|
return PERIODIC_TABLE.hexcode[self.atomic_number] |
368
|
|
|
|
369
|
1 |
|
@property |
370
|
|
|
def props(self): |
371
|
|
|
|
372
|
|
|
""" PropertyView: rdkit properties of the atom. """ |
373
|
|
|
|
374
|
1 |
|
if not hasattr(self, '_props'): |
375
|
1 |
|
self._props = PropertyView(self) |
|
|
|
|
376
|
1 |
|
return PropertyView(self) |
377
|
|
|
|
378
|
1 |
|
def __repr__(self): |
379
|
|
|
|
380
|
1 |
|
return '<{klass} element="{symbol}" at {address}>'.format( |
381
|
|
|
klass=self.__class__.__name__, |
382
|
|
|
symbol=self.symbol, |
383
|
|
|
address=hex(id(self)) |
384
|
|
|
) |
385
|
|
|
|
386
|
1 |
|
def __str__(self): |
387
|
|
|
|
388
|
1 |
|
return self.symbol |
389
|
|
|
|
390
|
|
|
|
391
|
1 |
|
class AtomView(ChemicalObjectView): |
|
|
|
|
392
|
|
|
|
393
|
1 |
|
def __getitem__(self, index): |
394
|
1 |
|
res = super(AtomView, self).__getitem__(index) |
395
|
1 |
|
if res is None: |
396
|
1 |
|
if np.abs(index) >= len(self): |
397
|
1 |
|
msg = 'Index {} out of range for molecule with' \ |
398
|
|
|
'{} atoms.'.format(index, len(self)) |
399
|
1 |
|
raise IndexError(msg) |
400
|
|
|
|
401
|
|
|
# index is negative, so adding gives desired indexing from back |
402
|
1 |
|
if index < 0: |
403
|
1 |
|
index += len(self) |
404
|
|
|
|
405
|
1 |
|
return Atom.from_super(self.owner.GetAtomWithIdx(index)) |
406
|
|
|
|
407
|
|
|
else: |
408
|
1 |
|
return res |
409
|
|
|
|
410
|
1 |
|
def __len__(self): |
411
|
1 |
|
return self.owner.GetNumAtoms() |
412
|
|
|
|
413
|
1 |
|
@property |
414
|
|
|
def symbol(self): |
415
|
|
|
|
416
|
|
|
""" np.array<str>: the symbols of the atoms in view """ |
417
|
|
|
|
418
|
1 |
|
return np.array([atom.symbol for atom in self], dtype=(np.str_, 3)) |
419
|
|
|
|
420
|
1 |
|
@property |
421
|
|
|
def atomic_number(self): |
422
|
|
|
|
423
|
|
|
""" np.array<int>: the atomic number of the atoms in view """ |
424
|
|
|
|
425
|
1 |
|
return np.array([atom.atomic_number for atom in self]) |
426
|
|
|
|
427
|
1 |
|
@property |
428
|
|
|
def atomic_mass(self): |
429
|
|
|
|
430
|
|
|
""" np.array<float>: the atomic mass of the atoms in view """ |
431
|
|
|
|
432
|
1 |
|
return np.array([atom.atomic_mass for atom in self]) |
433
|
|
|
|
434
|
1 |
|
@property |
435
|
|
|
def formal_charge(self): |
436
|
|
|
|
437
|
|
|
""" np.array<int>: the formal charge on the atoms in view """ |
438
|
|
|
|
439
|
1 |
|
return np.array([atom.formal_charge for atom in self]) |
440
|
|
|
|
441
|
1 |
|
@property |
442
|
|
|
def degree(self): |
443
|
|
|
|
444
|
|
|
""" np.array<int>: the degree of the atoms in view, according to |
445
|
|
|
rdkit. """ |
446
|
|
|
|
447
|
1 |
|
return np.array([atom.degree for atom in self]) |
448
|
|
|
|
449
|
1 |
|
@property |
450
|
|
|
def depleted_degree(self): |
451
|
|
|
|
452
|
|
|
""" np.array<int>: the degree of the atoms in the view in the |
453
|
|
|
h-depleted molecular graph. """ |
454
|
|
|
|
455
|
1 |
|
return np.array([atom.depleted_degree for atom in self]) |
456
|
|
|
|
457
|
1 |
|
@property |
458
|
|
|
def full_degree(self): |
459
|
|
|
|
460
|
|
|
""" np.array<int>: the degree of the atoms in the view in the |
461
|
|
|
h-filled molecular graph. """ |
462
|
|
|
|
463
|
1 |
|
return np.array([atom.full_degree for atom in self]) |
464
|
|
|
|
465
|
1 |
|
@property |
466
|
|
|
def valence_degree(self): |
467
|
|
|
|
468
|
|
|
""" np.array<int>: the valence degree of the atoms in the view.""" |
469
|
|
|
|
470
|
1 |
|
return np.array([atom.valence_degree for atom in self]) |
471
|
|
|
|
472
|
1 |
|
@property |
473
|
|
|
def n_hs(self): |
474
|
|
|
|
475
|
|
|
""" np.array<int>: the number of hydrogens bonded to atoms in view. """ |
476
|
|
|
|
477
|
1 |
|
return np.array([atom.n_hs for atom in self]) |
478
|
|
|
|
479
|
1 |
|
@property |
480
|
|
|
def n_implicit_hs(self): |
481
|
|
|
|
482
|
|
|
""" np.array<int>: the number of implicit hydrogens bonded to atoms |
483
|
|
|
in view, according to rdkit. """ |
484
|
|
|
|
485
|
1 |
|
return np.array([atom.n_implicit_hs for atom in self]) |
486
|
|
|
|
487
|
1 |
|
@property |
488
|
|
|
def n_explicit_hs(self): |
489
|
|
|
|
490
|
|
|
""" np.array<int>: the number of explicit hydrogens bonded to atoms |
491
|
|
|
in view, according to rdkit. """ |
492
|
|
|
|
493
|
1 |
|
return np.array([atom.n_explicit_hs for atom in self]) |
494
|
|
|
|
495
|
1 |
|
@property |
496
|
|
|
def n_instanced_hs(self): |
497
|
|
|
|
498
|
|
|
""" np.array<int>: the number of instanced hydrogens bonded to atoms |
499
|
|
|
in view. |
500
|
|
|
|
501
|
|
|
In this case, instanced means the number hs explicitly initialized as |
502
|
|
|
atoms. """ |
503
|
|
|
|
504
|
1 |
|
return np.array([atom.n_instanced_hs for atom in self]) |
505
|
|
|
|
506
|
1 |
|
@property |
507
|
|
|
def n_total_hs(self): |
508
|
|
|
|
509
|
|
|
""" np.array<int>: the number of total hydrogens bonded to atoms in |
510
|
|
|
view, according to rdkit. """ |
511
|
|
|
|
512
|
1 |
|
return np.array([atom.n_total_hs for atom in self]) |
513
|
|
|
|
514
|
1 |
|
@property |
515
|
|
|
def n_val_electrons(self): |
516
|
|
|
|
517
|
|
|
""" np.array<int>: the number of valence electrons bonded to atoms |
518
|
|
|
in view. """ |
519
|
|
|
|
520
|
1 |
|
return np.array([atom.n_val_electrons for atom in self]) |
521
|
|
|
|
522
|
1 |
|
@property |
523
|
|
|
def n_pi_electrons(self): |
524
|
|
|
|
525
|
|
|
""" np.array<int>: the number of pi electrons on atoms in view. """ |
526
|
|
|
|
527
|
1 |
|
return np.array([atom.n_pi_electrons for atom in self]) |
528
|
|
|
|
529
|
1 |
|
@property |
530
|
|
|
def n_lone_pairs(self): |
531
|
|
|
|
532
|
|
|
""" np.array<int>: the number of lone pairs on atoms in view. """ |
533
|
|
|
|
534
|
1 |
|
return (0.5 * (self.n_val_electrons - self.full_degree - |
535
|
|
|
self.formal_charge - self.n_pi_electrons)).astype(int) |
536
|
|
|
|
537
|
1 |
|
@property |
538
|
|
|
def explicit_valence(self): |
539
|
|
|
|
540
|
|
|
""" np.array<int>: the explicit valence of the atoms in view.. """ |
541
|
|
|
|
542
|
1 |
|
return np.array([atom.explicit_valence for atom in self]) |
543
|
|
|
|
544
|
1 |
|
@property |
545
|
|
|
def implicit_valence(self): |
546
|
|
|
|
547
|
|
|
""" np.array<int>: the explicit valence of the atoms in view. """ |
548
|
|
|
|
549
|
1 |
|
return np.array([atom.implicit_valence for atom in self]) |
550
|
|
|
|
551
|
1 |
|
@property |
552
|
|
|
def valence(self): |
553
|
|
|
|
554
|
|
|
""" np.array<int>: the valence of the atoms in view. """ |
555
|
|
|
|
556
|
1 |
|
return np.array([atom.valence for atom in self]) |
557
|
|
|
|
558
|
1 |
|
@property |
559
|
|
|
def hybridization_state(self): |
560
|
|
|
|
561
|
|
|
""" np.array<str>: the hybridization state of the atoms in view. |
562
|
|
|
|
563
|
|
|
One of 'SP', 'SP2', 'SP3', 'SP3D', 'SP3D2', 'UNSPECIFIED', 'OTHER'""" |
564
|
|
|
|
565
|
1 |
|
return np.array([atom.hybridization_state for atom in self]) |
566
|
|
|
|
567
|
1 |
|
@property |
568
|
|
|
def chiral_tag(self): |
569
|
|
|
|
570
|
|
|
""" np.array<str>: the chiral tag of the atoms in view. """ |
571
|
|
|
|
572
|
1 |
|
return np.array([atom.chiral_tag for atom in self]) |
573
|
|
|
|
574
|
1 |
|
@property |
575
|
|
|
def cahn_ingold_prelog(self): |
576
|
|
|
|
577
|
|
|
""" np.array<str>: the CIP string representation of atoms in view. """ |
578
|
|
|
|
579
|
1 |
|
return np.array([atom.cahn_ingold_prelog for atom in self], |
580
|
|
|
(np.str_, 4)) |
581
|
|
|
|
582
|
1 |
|
@property |
583
|
|
|
def is_terminal(self): |
584
|
|
|
|
585
|
|
|
""" np.array<bool>: whether the atoms in the view are terminal. """ |
586
|
|
|
|
587
|
1 |
|
return self.depleted_degree == 1 |
588
|
|
|
|
589
|
1 |
|
@property |
590
|
|
|
def is_aromatic(self): |
591
|
|
|
|
592
|
|
|
""" np.array<bool>: whether the atoms in the view are aromatic. """ |
593
|
|
|
|
594
|
1 |
|
return np.array([atom.is_aromatic for atom in self]) |
595
|
|
|
|
596
|
1 |
|
@property |
597
|
|
|
def is_in_ring(self): |
598
|
|
|
|
599
|
|
|
""" np.array<bool>: whether the atoms in the view are in a ring.""" |
600
|
|
|
|
601
|
1 |
|
return np.array([atom.is_in_ring for atom in self]) |
602
|
|
|
|
603
|
1 |
|
@property |
604
|
|
|
def van_der_waals_radius(self): |
605
|
|
|
|
606
|
|
|
""" np.array<float>: the Van der Waals radius of the atoms in the |
607
|
|
|
view. """ |
608
|
|
|
|
609
|
1 |
|
return PERIODIC_TABLE.van_der_waals_radius[self.atomic_number].values |
610
|
|
|
|
611
|
1 |
|
@property |
612
|
|
|
def van_der_waals_volume(self): |
613
|
|
|
|
614
|
|
|
""" np.array<float>: the Van der Waals volume of the atoms in the |
615
|
|
|
view. """ |
616
|
|
|
|
617
|
1 |
|
return PERIODIC_TABLE.van_der_waals_volume[self.atomic_number].values |
618
|
|
|
|
619
|
1 |
|
@property |
620
|
|
|
def covalent_radius(self): |
621
|
|
|
|
622
|
|
|
""" np.array<float>: the covalent radius of the atoms in the view. """ |
623
|
|
|
|
624
|
1 |
|
return np.array([atom.covalent_radius for atom in self]) |
625
|
|
|
|
626
|
1 |
|
@property |
627
|
|
|
def ionisation_energy(self): |
628
|
|
|
|
629
|
|
|
""" np.array<float>: the first ionisation energy of the atoms in the |
630
|
|
|
view. """ |
631
|
|
|
|
632
|
1 |
|
return PERIODIC_TABLE.first_ionisation_energy[ |
633
|
|
|
self.atomic_number].values |
634
|
|
|
|
635
|
1 |
|
@property |
636
|
|
|
def electron_affinity(self): |
637
|
|
|
|
638
|
|
|
""" np.array<float>: the electron affinity of the atoms in the |
639
|
|
|
view. """ |
640
|
|
|
|
641
|
1 |
|
return PERIODIC_TABLE.electron_affinity[self.atomic_number].values |
642
|
|
|
|
643
|
1 |
|
@property |
644
|
|
|
def principal_quantum_number(self): |
645
|
|
|
|
646
|
|
|
""" np.array<float>: the principal quantum number of the atoms in the |
647
|
|
|
view. """ |
648
|
|
|
|
649
|
1 |
|
return np.digitize(self.atomic_number, |
650
|
|
|
np.array([1, 3, 11, 19, 37, 55, 87, 121])) |
651
|
|
|
|
652
|
1 |
|
@property |
653
|
|
|
def polarisability(self): |
654
|
|
|
|
655
|
|
|
""" np.array<float>: the atomic polarisability of the atoms in the |
656
|
|
|
view. """ |
657
|
|
|
|
658
|
1 |
|
return PERIODIC_TABLE.atomic_polarisability[self.atomic_number].values |
659
|
|
|
|
660
|
1 |
|
@property |
661
|
|
|
def pauling_electronegativity(self): |
662
|
|
|
|
663
|
|
|
""" np.array<float>: the pauling electronegativity of the atoms in the |
664
|
|
|
view. """ |
665
|
|
|
|
666
|
1 |
|
return PERIODIC_TABLE.pauling_electronegativity[ |
667
|
|
|
self.atomic_number].values |
668
|
|
|
|
669
|
1 |
|
@property |
670
|
|
|
def sanderson_electronegativity(self): |
671
|
|
|
|
672
|
|
|
""" np.array<float>: the sanderson electronegativity of the atoms in |
673
|
|
|
the view. """ |
674
|
|
|
|
675
|
1 |
|
return PERIODIC_TABLE.sanderson_electronegativity[ |
676
|
|
|
self.atomic_number].values |
677
|
|
|
|
678
|
1 |
|
@property |
679
|
|
|
def kier_hall_electronegativity(self): |
680
|
|
|
|
681
|
|
|
""" np.array<float>: the hall kier electronegativity of the atoms in |
682
|
|
|
the view.""" |
683
|
|
|
|
684
|
1 |
|
return np.array([atom.kier_hall_electronegativity for atom in self]) |
685
|
|
|
|
686
|
1 |
|
@property |
687
|
|
|
def mcgowan_parameter(self): |
688
|
|
|
|
689
|
|
|
""" np.array<float>: the mcgowan parameter of the atoms in the |
690
|
|
|
iew. """ |
691
|
|
|
|
692
|
1 |
|
return PERIODIC_TABLE.mcgowan_parameter[self.atomic_number].values |
693
|
|
|
|
694
|
1 |
|
@property |
695
|
|
|
def kier_hall_alpha_contrib(self): |
696
|
|
|
|
697
|
|
|
""" np.array<float>: the contribution to the kier hall alpha for each |
698
|
|
|
atom in the view. """ |
699
|
|
|
|
700
|
1 |
|
return self.covalent_radius / 0.77 - 1 |
701
|
|
|
|
702
|
1 |
|
@property |
703
|
|
|
def intrinsic_state(self): |
704
|
|
|
|
705
|
|
|
""" np.ndarray<float>: the intrinsic state of the atoms in the |
706
|
|
|
view. """ |
707
|
|
|
|
708
|
1 |
|
return ((2 / self.principal_quantum_number) ** 2 * |
709
|
|
|
self.valence_degree + 1) / self.depleted_degree |
710
|
|
|
|
711
|
1 |
|
@property |
712
|
|
|
def hexcode(self): |
713
|
|
|
|
714
|
|
|
""" The hexcode to use as a color for the atoms in the view. """ |
715
|
|
|
|
716
|
1 |
|
return PERIODIC_TABLE.hexcode[self.atomic_number].values |
717
|
1 |
|
@property |
718
|
|
|
def index(self): |
719
|
|
|
|
720
|
|
|
""" pd.Index: an index for the atoms in the view. """ |
721
|
|
|
|
722
|
|
|
return pd.RangeIndex(len(self), name='atom_idx') |
723
|
|
|
|
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.