Molecular geometry tour¶
A single script that exercises every geometry quantity on the bundled structures: distances, angles, dihedrals, centroid vs centre of mass, radius of gyration, the inertia tensor with its principal moments and axes, Kabsch RMSD, and per-atom RMSF across an NMR ensemble.
uv run python examples/geometry.py
import numpy as np
import molscope as ms
mol = ms.read("examples/data/1fqy.pdb")
# local internal coordinates
mol.distance(0, 10)
mol.angle(0, 10, 20)
mol.dihedral(0, 10, 20, 30)
# centres, size, and shape
mol.centroid, mol.center_of_mass
mol.radius_of_gyration
mol.inertia_tensor(), mol.principal_moments(), mol.principal_axes()
# alignment and ensemble flexibility
models = ms.read_pdb_models("examples/data/1aml.pdb")
models[0].rmsd(models[1], align=True) # Kabsch RMSD
ms.ensemble.rmsf(models) # per-atom fluctuation
ms.rmsd_matrix(models) # pairwise RMSD between models
The figures in the guide are regenerated by
python scripts/render_geometry_images.py. See the full explanations in
Molecular geometry and measurements.