# Script to show the intersection of two maps as surfaces and the parts
# outside the intersection in mesh with each map colored separately.

from chimera import runCommand as r
r('open emdbID:1283 emdbID:1284')
r('volume #0,1 level 0.35 color lightyellow')

# Show surfaces for the intersection of the two maps.
# This has to be done in Python.  No Chimera command currently available.
from Surface import clip
import VolumeViewer as VV
v1, v2 = VV.volume_list()
s1, i1 = clip.volume_surface(v1)
s2, i2 = clip.volume_surface(v2)
clip.clip_surfaces(s1, i1, s2, i2)

# Open two more copies of the maps to show as mesh
r('open emdbID:1283 emdbID:1284')

# Set the contour level slightly higher so it is hidden by interesection.
r('volume #2,3 style mesh level 0.352')

# Color mesh with transparency.
r('volume #2 color 0,1,0,0.5')
r('volume #3 color 1,0,0,0.5')

# Set background color
r('set bg_color dimgray')
