This is a read-only mirror of pymolwiki.org
Difference between revisions of "Slice"
Jump to navigation
Jump to search
m |
|||
Line 23: | Line 23: | ||
<source lang="python"> | <source lang="python"> | ||
# Create a map slice plane perpendicular to current view | # Create a map slice plane perpendicular to current view | ||
− | + | slice a_new_slice, a_map | |
+ | |||
+ | |||
+ | # A more complicated example that shows how to create multiple slices | ||
+ | # (in this case, 3 slices perpendicular to each other), each colored | ||
+ | # with a different color ramp and different contour levels: | ||
+ | |||
+ | # Reset the view, to align view on XYZ axes | ||
+ | reset | ||
+ | # Create a map slice perpendicular to current view. (Non-tracking by default.) | ||
+ | slice slice_A, apbs_map | ||
+ | # Rotate camera 90 degrees about the vertical axis | ||
+ | turn y, 90 | ||
+ | # Second, perpendicular, slice | ||
+ | slice slice_B, apbs_map | ||
+ | # Rotate again, this time about the horizontal | ||
+ | turn x, 90 | ||
+ | # Third slice | ||
+ | slice slice_C, apbs_map | ||
+ | |||
+ | # Define new color ramps: ramp_name, map_object, list of low/mid/hi values, 3 RGB triplets | ||
+ | ramp_new ramp1010RWB, apbs_map, [-10,0,10], [ [1,0,0], [1,1,1], [0,0,1] ] | ||
+ | ramp_new ramp11RYG, apbs_map, [-1,0,1], [ [1,0,0], [1,1,0], [0,1,0] ] | ||
+ | ramp_new ramp55MltGO, apbs_map, [-5,0,5], [ [0,1,1], [0.5,1,0.5], [1,0.5,0.2] ] | ||
+ | |||
+ | # Color the map slices | ||
+ | color ramp1010RWB, slice_A | ||
+ | color ramp11RYG, slice_B | ||
+ | color ramp55MltGO, slice_C | ||
+ | |||
+ | # The result: | ||
+ | [[File:Example.jpg]] | ||
</source> | </source> | ||
+ | |||
+ | |||
== PYMOL API == | == PYMOL API == | ||
Line 32: | Line 65: | ||
== NOTES == | == NOTES == | ||
− | Occasionally mis-identified as "slice_map" in documentation. [[ | + | Occasionally mis-identified as "slice_map" in documentation. [[slice]] or [[slice|slice_new]] is the correct command. |
== SEE ALSO == | == SEE ALSO == |
Revision as of 17:43, 16 March 2011
slice creates a slice object from a map object.
USAGE
slice_new name, map, [opacity, [resolution, [state, [source_state]]]]
or
slice name, map, [opacity, [resolution, [state, [source_state]]]]
ARGUMENTS
- name = the name for the new slice object (string)
- map = the name of the map object to use for computing the slice (string)
- opacity = opacity of the new slice (default=1 [opaque])
- resolution = the number of pixels per sampling (default=5)
- state = the state into which the object should be loaded (default=1; set state=0 to append new mesh as a new state)
- source_state = the state of the map from which the object should be loaded (default=0)
EXAMPLES
# Create a map slice plane perpendicular to current view
slice a_new_slice, a_map
# A more complicated example that shows how to create multiple slices
# (in this case, 3 slices perpendicular to each other), each colored
# with a different color ramp and different contour levels:
# Reset the view, to align view on XYZ axes
reset
# Create a map slice perpendicular to current view. (Non-tracking by default.)
slice slice_A, apbs_map
# Rotate camera 90 degrees about the vertical axis
turn y, 90
# Second, perpendicular, slice
slice slice_B, apbs_map
# Rotate again, this time about the horizontal
turn x, 90
# Third slice
slice slice_C, apbs_map
# Define new color ramps: ramp_name, map_object, list of low/mid/hi values, 3 RGB triplets
ramp_new ramp1010RWB, apbs_map, [-10,0,10], [ [1,0,0], [1,1,1], [0,0,1] ]
ramp_new ramp11RYG, apbs_map, [-1,0,1], [ [1,0,0], [1,1,0], [0,1,0] ]
ramp_new ramp55MltGO, apbs_map, [-5,0,5], [ [0,1,1], [0.5,1,0.5], [1,0.5,0.2] ]
# Color the map slices
color ramp1010RWB, slice_A
color ramp11RYG, slice_B
color ramp55MltGO, slice_C
# The result:
[[File:Example.jpg]]
PYMOL API
cmd.slice_new(string slice_name, string map_name, integer opacity=1, integer resolution=5, integer state=0, integer source_state=0)
NOTES
Occasionally mis-identified as "slice_map" in documentation. slice or slice_new is the correct command.
SEE ALSO
References
- PyMOL Source code