User:Karsten Theis/Rigid body interpolation

From Proteopedia

(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
<nowiki>
<nowiki>
-
coordinates = {all}.xyz
+
coordinates = {all}.xyz.all
{all}.xyz = coordinates
{all}.xyz = coordinates
define selection1 1.1 and (912-984) and *:A
define selection1 1.1 and (912-984) and *:A
define selection2 1.2 and (912-984) and *:A
define selection2 1.2 and (912-984) and *:A
-
anchor1 = {1.1 and 984:A.CA}.xyz
+
define anchor1 1.1 and 984:A.CA
-
anchor2 = {1.2 and 984:A.CA}.xyz
+
define anchor2 1.2 and 984:A.CA
fourbyfour = compare({selection1}, {selection2})
fourbyfour = compare({selection1}, {selection2})
total_quat = quaternion(@fourbyfour%1)
total_quat = quaternion(@fourbyfour%1)
Line 16: Line 16:
quat1 = total_quat * progress
quat1 = total_quat * progress
quat2 = total_quat * ssergorp * -1
quat2 = total_quat * ssergorp * -1
 +
anchorpos = {anchor1}.xyz * progress _ {anchor2}.xyz * ssergorp
select selection1
select selection1
rotateselected @quat1 molecular
rotateselected @quat1 molecular
-
rotatedanchor1 = quat1 * anchor1
+
transl1 = anchorpos - {anchor1}.xyz
-
transl1 = -rotatedanchor1
+
translateselected @transl1
translateselected @transl1
select selection2
select selection2
rotateselected @quat2 molecular
rotateselected @quat2 molecular
-
rotatedanchor1 = quat2 * anchor2
+
transl2 = anchorpos - {anchor2}.xyz
-
transl2 = -rotatedanchor2
+
translateselected @transl2
translateselected @transl2

Revision as of 17:15, 6 March 2021

This page shows a way to superpose two rigid bodies so that they both have the same rotation, and they are translated such that a common anchor (center of mass, given atom) is in the same location.

The entire coordinates are copies first so that you can play around with the parameters and then reset the coordinates. The starting point is a structure with two models containing the same atoms in the same order, but with different coordinates.

coordinates = {all}.xyz.all
{all}.xyz = coordinates
define selection1 1.1 and (912-984) and *:A
define selection2 1.2 and (912-984) and *:A
define anchor1 1.1 and 984:A.CA
define anchor2 1.2 and 984:A.CA
fourbyfour = compare({selection1}, {selection2})
total_quat = quaternion(@fourbyfour%1)
progress = 0.5
ssergorp = 1 - progress
quat1 = total_quat * progress
quat2 = total_quat * ssergorp * -1
anchorpos = {anchor1}.xyz * progress _ {anchor2}.xyz * ssergorp

select selection1
rotateselected @quat1 molecular
transl1 = anchorpos - {anchor1}.xyz
translateselected @transl1

select selection2
rotateselected @quat2 molecular
transl2 = anchorpos - {anchor2}.xyz
translateselected @transl2


Drag the structure with the mouse to rotate

Proteopedia Page Contributors and Editors (what is this?)

Karsten Theis

Personal tools