[Chimera-users] mclip slabs for multiple axes

Greg Couch gregc at cgl.ucsf.edu
Tue Dec 9 11:25:05 PST 2008

On Tue, 9 Dec 2008, David A. C. Beck wrote:

> I would like to be able to setup multiple per model clipping planes on
> different axes at the same time.  As an example, mclip slabs from 0 to 10
> angstroms on each axis simultaneously to reveal just those atoms in the
> 0,0,0 to 10,10,10 space.  Is there a way to do this that I have missed?
> Maybe with another tool or the gui?
> I originally imagined that I would be able to do is something like this
> where mclip leaves any existing mclips until cleared with ~mclip #model.
> # clear all existing clipping planes
> ~mclip #0
> # stack the clipping planes to reveal just the box 0,0,0 ... 10,10,10
> mclip #0 slab true thickness 10 axis x
> mclip #0 slab true thickness 10 axis y
> mclip #0 slab true thickness 10 axis z
> But each successive call to mclip clears the previous per model clipping
> planes.
> Thanks,
>  - David

Chimera supports one orientable clipping plane per-model with an optional 
thickness.  To only show the atoms within an axis-aligned box, you'd need
to write a Python script:

 	import chimera

 	# create bounding box
 	bbox = chimera.BBox()
 	bbox.llf = chimera.Point(0, 0, 0)	# lower left front
 	bbox.urb = chimera.Point(10, 10, 10)	# upper right back

 	# figure out list of molecules to work on
 	models = chimera.openModels.list(id=0, modelTypes=[chimera.Molecule])

 	# only display atom if inside the box
 	for m in models:
 		m.autochain = False
 		for a in m.atoms:
 			a.display = bbox.inside(a.coord())

The difference between the script and clipping is that clipping will
show the clipped bonds.   If you want to see the halfbond stubs to all
displayed atoms, add the line after the autochain line:

 	m.showStubBonds = True

And then use the Report a Bug dialog to get me to fix the extraneous
bond caps.

 	- Greg

More information about the Chimera-users mailing list