User:Karsten Theis/Linear interpolation
From Proteopedia
< User:Karsten Theis(Difference between revisions)
(New page: This is a Jmol script that does linear interpolation. You need two sets of atoms that contain the same structure in the same order (but in a different conformation or position). Here, I am...) |
|||
(2 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
This is a Jmol script that does linear interpolation. You need two sets of atoms that contain the same structure in the same order (but in a different conformation or position). Here, I am using residues 5 and 6 of 1BNA. | This is a Jmol script that does linear interpolation. You need two sets of atoms that contain the same structure in the same order (but in a different conformation or position). Here, I am using residues 5 and 6 of 1BNA. | ||
- | <nowiki> | + | <nowiki> |
load =1BNA | load =1BNA | ||
- | + | display 5 or 6 | |
five = {5}.xyz.all | five = {5}.xyz.all | ||
six = {6}.xyz.all | six = {6}.xyz.all | ||
+ | interp = six | ||
progress = 0.5 | progress = 0.5 | ||
ssergorp = 1 - progress | ssergorp = 1 - progress | ||
- | for (var i FROM [1,21]) { | + | for (var i FROM [1,21]) {interp[i] = (five[i] * progress + six[i] * ssergorp)} |
- | {6}.xyz = @ | + | {6}.xyz = @interp |
</nowiki> | </nowiki> | ||
==Try it== | ==Try it== | ||
<StructureSection load='1bna' size='350' side='right' caption='' scene=''> | <StructureSection load='1bna' size='350' side='right' caption='' scene=''> | ||
+ | |||
+ | To try it, right-click in the Jmol window to open the console, and then copy and paste commands from above into the console input. | ||
The coordinates of base six will be changed to show an interpolation between five and six. Depending on the variable "progress", the resulting coordinates will be closer to the original coordinates or those of five. | The coordinates of base six will be changed to show an interpolation between five and six. Depending on the variable "progress", the resulting coordinates will be closer to the original coordinates or those of five. | ||
</StructureSection> | </StructureSection> |
Current revision
This is a Jmol script that does linear interpolation. You need two sets of atoms that contain the same structure in the same order (but in a different conformation or position). Here, I am using residues 5 and 6 of 1BNA.
load =1BNA display 5 or 6 five = {5}.xyz.all six = {6}.xyz.all interp = six progress = 0.5 ssergorp = 1 - progress for (var i FROM [1,21]) {interp[i] = (five[i] * progress + six[i] * ssergorp)} {6}.xyz = @interp
Try it
|