vedo.applications.chemistry

chemistry
Atom
A class representing an atom in a molecule, fully wrapping vtkAtom.
Provides access to all methods and properties of vtkAtom as documented in: https://vtk.org/doc/nightly/html/classvtkAtom.html
Source code in vedo/applications/chemistry.py
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 | |
get_atom_id()
Get the ID of this atom.
Returns:
| Type | Description |
|---|---|
|
The atom's ID within the molecule. |
Source code in vedo/applications/chemistry.py
311 312 313 314 315 316 317 | |
get_atomic_number()
Get the atomic number of the atom.
Returns:
| Type | Description |
|---|---|
|
The atomic number. |
Source code in vedo/applications/chemistry.py
275 276 277 278 279 280 281 | |
get_molecule()
Get the molecule this atom belongs to.
Returns:
| Type | Description |
|---|---|
|
The parent molecule. |
Source code in vedo/applications/chemistry.py
319 320 321 322 323 324 325 | |
get_position()
Get the position of the atom as a NumPy array.
Returns:
| Type | Description |
|---|---|
|
Array of shape (3,) with [x, y, z] coordinates. |
Source code in vedo/applications/chemistry.py
292 293 294 295 296 297 298 299 | |
set_atomic_number(atomic_number)
Set the atomic number of the atom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The new atomic number. |
required |
Source code in vedo/applications/chemistry.py
283 284 285 286 287 288 289 290 | |
set_position(position)
Set the position of the atom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
list or ndarray
|
The new [x, y, z] coordinates. |
required |
Source code in vedo/applications/chemistry.py
301 302 303 304 305 306 307 308 309 | |
Molecule
Source code in vedo/applications/chemistry.py
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 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
append_atom(position=None, atomic_number=6)
Add an atom to the molecule with optional position and atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
list or ndarray
|
[x, y, z] coordinates. Defaults to [0, 0, 0]. |
None
|
atomic_number
|
int
|
Atomic number (e.g., 6 for Carbon). Defaults to 6. |
6
|
Returns:
| Type | Description |
|---|---|
|
The added atom object. |
Source code in vedo/applications/chemistry.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
append_bond(atom1, atom2, order=1)
Add a bond between two atoms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atom1
|
Atom or int
|
The first atom or its ID. |
required |
atom2
|
Atom or int
|
The second atom or its ID. |
required |
order
|
int
|
Bond order (1=single, 2=double, 3=triple). |
1
|
Source code in vedo/applications/chemistry.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
get_array(name)
Get a point data array by name.
The following arrays are available:
- atom_type: Atomic number of the atom.
- atom_types: Atomic type of the atom.
- residue: Residue name.
- chain: Chain identifier.
- secondary_structures: Secondary structure type.
- secondary_structures_begin: Start index of the secondary structure.
- secondary_structures_end: End index of the secondary structure.
- ishetatm: Is the atom a heteroatom?
- model: Model number.
- rgb_colors: RGB color of the atom.
- radius: Radius of the atom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the array. |
required |
Returns:
| Type | Description |
|---|---|
|
The array data. |
Source code in vedo/applications/chemistry.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
get_atom(atom_id)
Retrieve an atom by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atom_id
|
int
|
The ID of the atom. |
required |
Returns:
| Type | Description |
|---|---|
|
The atom object. |
Source code in vedo/applications/chemistry.py
421 422 423 424 425 426 427 428 429 430 431 432 433 | |
get_atom_positions()
Get the positions of all atoms.
Returns:
| Type | Description |
|---|---|
|
Array of shape (n_atoms, 3) with [x, y, z] coordinates. |
Source code in vedo/applications/chemistry.py
533 534 535 536 537 538 539 540 541 542 543 544 | |
get_atomic_numbers()
Get the atomic numbers of all atoms.
Returns:
| Type | Description |
|---|---|
|
List of atomic numbers. |
Source code in vedo/applications/chemistry.py
563 564 565 566 567 568 569 570 571 572 573 | |
get_bond(bond_id)
Get bond information by ID (simplified as VTK bond access is limited).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bond_id
|
int
|
The ID of the bond. |
required |
Returns:
| Type | Description |
|---|---|
|
(atom1_id, atom2_id, order). |
Source code in vedo/applications/chemistry.py
518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
get_number_of_atoms()
Get the number of atoms in the molecule.
Returns:
| Type | Description |
|---|---|
|
Number of atoms. |
Source code in vedo/applications/chemistry.py
502 503 504 505 506 507 508 | |
get_number_of_bonds()
Get the number of bonds in the molecule.
Returns:
| Type | Description |
|---|---|
|
Number of bonds. |
Source code in vedo/applications/chemistry.py
510 511 512 513 514 515 516 | |
remove_atom(atom_id)
Remove an atom by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atom_id
|
int
|
The ID of the atom to remove. |
required |
Source code in vedo/applications/chemistry.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
set_atom_positions(positions)
Set the positions of all atoms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
ndarray
|
Array of shape (n_atoms, 3) with [x, y, z] coordinates. |
required |
Source code in vedo/applications/chemistry.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
set_atom_radius_scale(scale)
Set the scale factor for atom radii.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scale
|
float
|
Scaling factor for atom spheres. |
required |
Source code in vedo/applications/chemistry.py
602 603 604 605 606 607 608 609 610 | |
set_atomic_numbers(atomic_numbers)
Set the atomic numbers of all atoms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_numbers
|
list
|
List of atomic numbers. |
required |
Source code in vedo/applications/chemistry.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
set_bond_color(color)
Set a single bond color.
Source code in vedo/applications/chemistry.py
635 636 637 638 639 | |
set_bond_color_mode(mode='discrete')
Set bond coloring mode to either 'discrete' or 'single'.
Source code in vedo/applications/chemistry.py
627 628 629 630 631 632 633 | |
set_bond_radius(radius)
Set the radius of bonds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Bond radius in world units. |
required |
Source code in vedo/applications/chemistry.py
612 613 614 615 616 617 618 619 620 | |
use_ball_and_stick()
Set the molecule to use ball-and-stick representation.
Source code in vedo/applications/chemistry.py
592 593 594 595 | |
use_multi_cylinders_for_bonds(value=True)
Render each bond as one cylinder or as multi-colored half-cylinders.
Source code in vedo/applications/chemistry.py
622 623 624 625 | |
use_space_filling()
Set the molecule to use space-filling (VDW spheres) representation.
Source code in vedo/applications/chemistry.py
597 598 599 600 | |
PeriodicTable
A Vedo-compatible class for accessing periodic table data, wrapping vtkPeriodicTable.
This class provides access to element properties such as atomic numbers, names, symbols, and covalent radii, using VTK's built-in periodic table database.
Attributes:
| Name | Type | Description |
|---|---|---|
periodic_table |
vtkPeriodicTable
|
The underlying VTK periodic table object. |
Source code in vedo/applications/chemistry.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
get_atomic_number(symbol)
Get the atomic number of the element with the given symbol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol of the element. |
required |
Returns:
| Type | Description |
|---|---|
|
The atomic number of the element. |
Source code in vedo/applications/chemistry.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
get_covalent_radius(atomic_number)
Get the covalent radius of the element with the given atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The atomic number of the element. |
required |
Returns:
| Type | Description |
|---|---|
|
The covalent radius of the element. |
Source code in vedo/applications/chemistry.py
74 75 76 77 78 79 80 81 82 83 84 85 | |
get_element_data(atomic_number)
Get all data for the element with the given atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The atomic number of the element. |
required |
Returns:
| Type | Description |
|---|---|
|
A dictionary containing the element's name, symbol, and radii. |
Source code in vedo/applications/chemistry.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
get_element_name(atomic_number)
Get the name of the element with the given atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The atomic number of the element. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The name of the element. |
Source code in vedo/applications/chemistry.py
35 36 37 38 39 40 41 42 43 44 45 46 | |
get_element_symbol(atomic_number)
Get the symbol of the element with the given atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The atomic number of the element. |
required |
Returns:
| Type | Description |
|---|---|
|
The symbol of the element. |
Source code in vedo/applications/chemistry.py
48 49 50 51 52 53 54 55 56 57 58 59 | |
get_number_of_elements()
Get the total number of elements in the periodic table.
Returns:
| Type | Description |
|---|---|
|
The number of elements. |
Source code in vedo/applications/chemistry.py
100 101 102 103 104 105 106 107 | |
get_vdw_radius(atomic_number)
Get the Van der Waals radius of the element with the given atomic number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atomic_number
|
int
|
The atomic number of the element. |
required |
Returns:
| Type | Description |
|---|---|
|
The Van der Waals radius of the element. |
Source code in vedo/applications/chemistry.py
87 88 89 90 91 92 93 94 95 96 97 98 | |
Protein
A Vedo-compatible class for protein ribbon visualization, wrapping vtkProteinRibbonFilter.
This class generates a ribbon representation of protein structures from PDB files, vtkMolecule objects, or vtkPolyData, and integrates with Vedo's rendering system.
Attributes:
| Name | Type | Description |
|---|---|---|
filter |
vtkProteinRibbonFilter
|
The underlying VTK filter for ribbon generation. |
mapper |
vtkPolyDataMapper
|
Maps the filter's output to renderable data. |
actor |
vtkActor
|
The VTK actor for rendering the ribbon. |
Source code in vedo/applications/chemistry.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
set_coil_width(width)
Set the width of the coil regions in the ribbon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
The width of the coil regions. |
required |
Source code in vedo/applications/chemistry.py
721 722 723 724 725 726 727 728 729 730 | |
set_helix_width(width)
Set the width of the helix regions in the ribbon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
The width of the helix regions. |
required |
Source code in vedo/applications/chemistry.py
732 733 734 735 736 737 738 739 740 741 | |
set_sphere_resolution(resolution)
Set the resolution of spheres used in the ribbon representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
The resolution of the spheres. |
required |
Source code in vedo/applications/chemistry.py
743 744 745 746 747 748 749 750 751 752 | |
append_molecules(molecules)
Append multiple molecules into a single molecule.
This function takes a list of Molecule objects and returns a new Molecule object that combines all atoms and bonds from the input molecules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
molecules
|
list of Molecule
|
The molecules to append. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Molecule |
A new Molecule object containing all atoms and bonds from the input molecules. |
Source code in vedo/applications/chemistry.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |