Created
May 31, 2018 12:55
-
-
Save kain88-de/1a44037f00f1008c2b88cb5ecb30b207 to your computer and use it in GitHub Desktop.
alignto bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 24, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from MDAnalysisTests.datafiles import PDB, XTC\n", | |
"import MDAnalysis as mda\n", | |
"from MDAnalysis.analysis import align, rms" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"u = mda.Universe(PDB, XTC)\n", | |
"ref = mda.Universe(PDB)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Make the selections for alignment" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"ref_res1 = ref.residues[1].atoms\n", | |
"res1 = u.residues[1].atoms\n", | |
"\n", | |
"res1 = u.residues[1].atoms\n", | |
"res2 = u.residues[2].atoms" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now we establish some the coordiantes before the alignment" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"[53.60167 40.359165 33.607082]\n", | |
"[54.53948 44.632107 27.00737 ]\n", | |
"[55.88809 45.152588 35.58592 ]\n" | |
] | |
} | |
], | |
"source": [ | |
"u.trajectory[8]\n", | |
"print(res1.centroid())\n", | |
"print(res2.centroid())\n", | |
"print(ref_res1.centroid())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(0.7390031832695271, 0.3307034032341618)" | |
] | |
}, | |
"execution_count": 22, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"align.alignto(res1, ref_res1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The centroid of res2 has changed as well. According to the docs these coordinates shouldn't have been updated." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"[56.212128 47.95514 28.18765 ]\n" | |
] | |
} | |
], | |
"source": [ | |
"print(res2.centroid())" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python [default]", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment