element
Module for static information about chemical elements.
Element
Storage class for information about a chemical element.
Examples:
>>> h = Element.from_string("H")
>>> c = Element.from_string("C")
>>> n = Element.from_atomic_number(7)
>>> f = Element.from_string("F")
Element implements an ordering for sorting in e.g. molecular formulae where carbon and hydrogen come first, otherwise elements are sorted in order of atomic number.
Source code in chmpy/core/element.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ball_stick_radius: float
property
The radius of this element in a ball and stick representation.
color
property
The color RGBA color of this element.
covalent_radius: float
property
The covalent radius in angstroms.
vdw_radius: float
property
The van der Waals radius in angstroms.
__eq__(other)
Check if two Elements have the same atomic number.
__hash__()
__init__(atomic_number, name, symbol, cov, vdw, mass)
Initialize an Element from its chemical data.
Source code in chmpy/core/element.py
__lt__(other)
Check which element comes before the other in chemical formulae
Source code in chmpy/core/element.py
__repr__()
from_atomic_number(n)
staticmethod
Create an element from a given atomic number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
the atomic number of the element |
required |
Returns:
Name | Type | Description |
---|---|---|
Element |
Element
|
an Element object if atomic number was valid, otherwise an exception is raised |
Examples:
Source code in chmpy/core/element.py
from_label(label)
staticmethod
Create an element from a label e.g. 'C1', 'H2_F2___i' etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
l
|
str
|
a string representation of an element in the periodic table |
required |
Returns:
Name | Type | Description |
---|---|---|
Element |
Element
|
an Element object if the conversion was successful, otherwise an exception is raised |
Examples:
An ambiguous case, will make this Calcium not Carbon
Source code in chmpy/core/element.py
from_string(s)
staticmethod
Create an element from a given element symbol.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s
|
str
|
a string representation of an element in the periodic table |
required |
Returns:
Name | Type | Description |
---|---|---|
Element |
Element
|
an Element object if the conversion was successful, otherwise an exception is raised |
Examples:
Source code in chmpy/core/element.py
chemical_formula(elements, subscript=False)
Calculate the chemical formula for the given list of elements.
Examples:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elements
|
List[Element or str]
|
a list of elements or element symbols. Note that if a list of strings are provided the order of chemical symbols may not match convention. |
required |
subscript
|
bool
|
toggle to use unicode subscripts for the chemical formula string |
False
|
Returns:
Name | Type | Description |
---|---|---|
str |
the chemical formula |
Source code in chmpy/core/element.py
cov_radii(atomic_numbers)
Return the covalent radii for the given atomic numbers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_numbers
|
array_like
|
the (N,) length integer array of atomic numbers |
required |
Returns:
Type | Description |
---|---|
np.ndarray: (N,) array of floats representing covalent radii |
Source code in chmpy/core/element.py
element_names(atomic_numbers)
Return the element names for the given atomic numbers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_numbers
|
array_like
|
the (N,) length integer array of atomic numbers |
required |
Returns:
Type | Description |
---|---|
List[str]: (N,) list of strings representing element names |
Source code in chmpy/core/element.py
element_symbols(atomic_numbers)
Return the element symbols for the given atomic numbers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_numbers
|
array_like
|
the (N,) length integer array of atomic numbers |
required |
Returns:
Type | Description |
---|---|
List[str]: (N,) list of strings representing element symbols |
Source code in chmpy/core/element.py
vdw_radii(atomic_numbers)
Return the van der Waals radii for the given atomic numbers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_numbers
|
array_like
|
the (N,) length integer array of atomic numbers |
required |
Returns:
Type | Description |
---|---|
np.ndarray: (N,) array of floats representing van der Waals radii |