PyMOL |
|
The iterate command family gives access to atom data. It executes a Python expression for every atom in a selection. It's a powerful tool for querying and modifying properties.
Example: Print b-factors, along with relevant atom identifiers:
iterate all, print(chain, resn, resi, name, b)
Example: Rename a chain:
alter chain A, chain="C"
Example: Compute molecular weight:
from pymol import stored from chempy import atomic_mass stored.weight = 0.0 stored.atomic_mass = atomic_mass iterate all, stored.weight += stored.atomic_mass[elem] print(stored.weight)
Hint: This should be a 5-line PML script
PDB 1t46 starts the chain with residue number 565. Use alter to make it start at 1.
Notes:
© 2017 Schrödinger, Inc.