"""Cluster based on RMSD between conformations

{{header}}

Meta
----
depends:
  - meta.pandas.pickl
  - trajs
  - top.pdb
"""
import mdtraj as md

from msmbuilder.cluster import MiniBatchKMedoids
from msmbuilder.io import load_meta, itertrajs, save_trajs, preload_top

## Set up parameters
kmed = MiniBatchKMedoids(
    n_clusters=500,
    metric='rmsd',
)

## Load
meta = load_meta()
centroids = md.load("centroids.xtc", top=preload_top(meta))

## Kernel
SIGMA = 0.3  # nm
from msmbuilder.featurizer import RMSDFeaturizer
import numpy as np

featurizer = RMSDFeaturizer(centroids)
lfeats = {}
for i, traj in itertrajs(meta):
    lfeat = featurizer.partial_transform(traj)
    lfeat = np.exp(-lfeat ** 2 / (2 * (SIGMA ** 2)))
    lfeats[i] = lfeat
save_trajs(lfeats, 'ftrajs', meta)

@@ -145,57 +145,8 @@
 md%0A%0A
-from msmbuilder.cluster import MiniBatchKMedoids%0A
 from
@@ -218,97 +218,8 @@
 op%0A%0A
-## Set up parameters%0Akmed = MiniBatchKMedoids(%0A    n_clusters=500,%0A    metric='rmsd',%0A)%0A%0A
 ## L

remove redundant code