Skip to content

Quick start

import dynome as dn

ens = dn.load("protein.pdb")                 # PDB, mmCIF and XYZ are read natively
ens.n_frames, ens.n_atoms, ens.n_residues

Lengths are in nanometres, angles in radians, times in picoseconds, as in MDTraj.

Select atoms

ca = ens.topology.select("protein and name CA")
near = ens.topology.select("resid 10 to 20 and not element H")

Measure

r = dn.rmsd(ens, ens, frame=0, atom_indices=ca)        # (n_frames,)
f = dn.rmsf(ens, ens, atom_indices=ca)                 # (n_atoms,)
d = dn.compute_distances(ens, [[0, 10], [5, 42]])      # (n_frames, n_pairs)
idx, phi = dn.compute_phi(ens)
rg = dn.compute_rg(ens)
dist, pairs = dn.compute_contacts(ens, scheme="closest-heavy")
sasa = dn.shrake_rupley(ens, mode="residue")

Slice, fit and save

sub = ens[::10].atom_slice(ca)
fitted = ens.superpose(ens, frame=0, atom_indices=ca)
dn.save(fitted, "fitted.pdb")
dn.save(ens, "all.dyn.npz")                  # Dynome's own file: keeps weights and annotations

Use a GPU

dn.set_backend("auto")                       # PyTorch on a GPU when one is visible
with dn.use_backend("torch", device="cuda"):
    dn.shrake_rupley(ens)