Translate: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
No edit summary
 
m (→‎EXAMPLES: Added example numbers. Moved Example 1 description below its heading.)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
===DESCRIPTION===
'''translate''' can be used to translate the atomic coordinates of a molecular object (move an object).  Behavior differs depending on whether or not the "object" parameter is specified.
 
If object is None, then translate translates atomic coordinates according to the vector provided for the selection and in the state provided.
   
   
  "translate" can be used to translate the atomic coordinates of a
If object is set to an object name, then selection and state are ignored and instead of translating the atomic coordinates, the [[Object_Matrix|object matrix]] is modified. This option is intended for use in animations.
  molecular object.  Behavior differs depending on whether or not the
  "object" parameter is specified.
  If object is None, then translate translates atomic coordinates
  according to the vector provided for the selection and in the state
  provided.  All representation geometries will need to be
  regenerated to reflect the new atomic coordinates.
  If object is set to an object name, then selection and state are
  ignored and instead of translating the atomic coordinates, the
  object's overall representation display matrix is modified. This
  option is for use in animations only.
  The "camera" option controls whether the camera or the model's
  axes are used to interpret the translation vector.
   
   
The "camera" option controls whether the camera or the model's axes are used to interpret the translation vector.  To move the object relative to the camera set '''camera=1''' (which is default), or to move the molecule relative to the model's geometry, set, '''camera=0'''.
===USAGE===
===USAGE===
<source lang="python">
translate vector [,selection [,state [,camera [,object ]]]]
</source>
===ARGUMENTS===
'''vector'''
::float vector: [x, y, z] translation vector
   
   
   translate vector [,selection [,state [,camera [,object ]]]]
'''selection'''
::   string: atoms whose coordinates should be modified {default: all}
   
   
'''state'''
::    state > 0: only the indicated state is modified
::    state = 0: all states are modified
::    state = -1: only current state is modified {default}
'''camera'''
::    0 or 1: is the vector in camera coordinates? {default: 1 (yes)}
'''object'''
::    string: object name (only if rotating object matrix) {default: None}
===PYMOL API===
===PYMOL API===
<source lang="python">
<source lang="python">
  cmd.translate(list vector, string selection = "all", int state = 0,
cmd.translate(list vector, string selection = "all", int state = 0,
                int camera = 1, string object = None)
              int camera = 1, string object = None)
</source>
</source>


===EXAMPLES===
===EXAMPLES===
====Example 1====
  translate [1,0,0], name ca
A simple example; just move the alpha-carbons one Ang. along the X-axis.
   
<source lang="python">
# move the alpha carbons one Ang. on the X-axis
translate [1,0,0], name ca
</source>
 
====Example 2====
A slightly more complicated example. Load two proteins, align them, and then move one away from the other to see their similarities separately.
<source lang="python">
# load 1cll and 1ggz
fetch 1cll 1ggz, async=0
 
# align the two proteins
cealign 1cll, 1ggz
 
# orient the proteins
orient
 
# move 1cll above 1ggz so we can
# see both proteins separately
translate [0, 40, 0], 1cll
</source>
 
===NOTES===
===NOTES===
# if state = 0, then only visible state(s) are affected.
  if state = 0, then only visible state(s) are affected.
# if state = -1, then all states are affected.  
  if state = -1, then all states are affected.  
 
===SEE ALSO===
[[Rotate]], [[Move]], [[Model_Space_and_Camera_Space]]


[[Category:Commands|translate]]
[[Category:Commands|Translate]]
[[Category:States|Translate]]

Latest revision as of 11:12, 19 February 2014

translate can be used to translate the atomic coordinates of a molecular object (move an object). Behavior differs depending on whether or not the "object" parameter is specified.

If object is None, then translate translates atomic coordinates according to the vector provided for the selection and in the state provided.

If object is set to an object name, then selection and state are ignored and instead of translating the atomic coordinates, the object matrix is modified. This option is intended for use in animations.

The "camera" option controls whether the camera or the model's axes are used to interpret the translation vector. To move the object relative to the camera set camera=1 (which is default), or to move the molecule relative to the model's geometry, set, camera=0.

USAGE

translate vector [,selection [,state [,camera [,object ]]]]

ARGUMENTS

vector

float vector: [x, y, z] translation vector

selection

string: atoms whose coordinates should be modified {default: all}

state

state > 0: only the indicated state is modified
state = 0: all states are modified
state = -1: only current state is modified {default}

camera

0 or 1: is the vector in camera coordinates? {default: 1 (yes)}

object

string: object name (only if rotating object matrix) {default: None}

PYMOL API

cmd.translate(list vector, string selection = "all", int state = 0,
              int camera = 1, string object = None)

EXAMPLES

Example 1

A simple example; just move the alpha-carbons one Ang. along the X-axis.

# move the alpha carbons one Ang. on the X-axis
translate [1,0,0], name ca

Example 2

A slightly more complicated example. Load two proteins, align them, and then move one away from the other to see their similarities separately.

# load 1cll and 1ggz
fetch 1cll 1ggz, async=0

# align the two proteins
cealign 1cll, 1ggz

# orient the proteins
orient

# move 1cll above 1ggz so we can 
# see both proteins separately
translate [0, 40, 0], 1cll

NOTES

  1. if state = 0, then only visible state(s) are affected.
  2. if state = -1, then all states are affected.

SEE ALSO

Rotate, Move, Model_Space_and_Camera_Space