[Chimera-users] how to select atom within a rectangular region

Eric Pettersen pett at cgl.ucsf.edu
Tue Nov 1 10:58:30 PDT 2016

	Well, it certainly could be done by a custom Python script, e.g.:

from chimera import openModels, Molecule, selection
sel_atoms = []
for m in openModels.list(modelTypes=[Molecule]):
	for a in m.atoms:
		x, y, z = a.coord().data()
		if x0 <= x <= x1 and y0 <= y <= y1 and z0 <= z <= z1:

This selection is working on the original coordinates, i.e. as provided by the input source.  If you want to include rotations/translations that occurred in Chimera, you would use the .xformCoord() method instead of the .coord() method.
	But perhaps if you described why you need to select atoms within a certain Cartesian box, we could provide better help.


	Eric Pettersen
	UCSF Computer Graphics Lab

> On Oct 31, 2016, at 11:37 AM, Cherry Dons <cherrydons at gmail.com> wrote:
> Hi Chimera Developers,
> This is Dengpan, one of chimera users. I have a question about how to select atoms within a region? For example, I I want to select atoms within a rectangular region  
> x0 to x1,
> y0 to y1,
> z0 to z1.
> Could you please give me a hint how to do it? Thanks.
> Dengpan Dong
> -- 
> Department of Materials Science and Engineering,
> University of Utah
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20161101/ab88c1b2/attachment.html>

More information about the Chimera-users mailing list