Skip to content

Instantly share code, notes, and snippets.

@schwancr
Created July 8, 2014 06:50
Show Gist options
  • Save schwancr/648d2955b2315835234f to your computer and use it in GitHub Desktop.
Save schwancr/648d2955b2315835234f to your computer and use it in GitHub Desktop.
test for lprmsd + mdtraj from msmbuilder
from msmbuilder.metrics import LPRMSD
import mdtraj as md
import numpy as np
import IPython
pdbstring1="""
ATOM 11 CB ALA 2 0.000 0.000 0.000 1.00 0.00
ATOM 12 H1 ALA 2 0.000 10.000 0.000 1.00 0.00
ATOM 13 H2 ALA 2 0.000 20.000 0.000 1.00 0.00
"""
pdbstring2="""
ATOM 11 CB ALA 2 10.000 0.000 0.000 1.00 0.00
ATOM 12 H1 ALA 2 20.000 0.000 0.000 1.00 0.00
ATOM 13 H2 ALA 2 30.000 0.000 0.000 1.00 0.00
"""
with open('temp.pdb', 'w') as fh:
fh.write(pdbstring1)
pdb1 = md.load_pdb('temp.pdb')
pdb1.center_coordinates()
with open('temp.pdb', 'w') as fh:
fh.write(pdbstring2)
pdb2 = md.load_pdb('temp.pdb')
pdb2.center_coordinates()
def test():
print pdb1.xyz
print pdb2.xyz
dist = md.lprmsd(pdb1, pdb2, superpose=False, atom_indices=[0, 1, 2], permute_groups=[[0], [1], [2]])
dist2 = md.lprmsd(pdb1, pdb2, superpose=True, atom_indices=[0, 1, 2], permute_groups=[[0], [1], [2]])
print dist, dist2
print pdb1.xyz
print pdb2.xyz
if __name__ == '__main__':
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment