[chimerax-users] Set atom coordinates by command?

Eric Pettersen pett at cgl.ucsf.edu
Fri Oct 23 08:56:05 PDT 2020


Hi Gunnar,
	The setattr command can't do this.  It would not be too hard to add it to setattr, but it doesn't seem to be something anyone would commonly want to do, though I'm willing to listen to arguments otherwise.
	This is pretty easy to do in ChimeraX's Python shell though (Tools→General→Shell).  The following code (typed/pasted) to the shell  would set all selected atoms' coordinates to 1,2,3:

from chimerax.atomic import selected_atoms as sel_atoms

for a in sel_atoms(session):
    a.coord = (1, 2, 3)

If you're not familiar with Python, indentation is significant, so that last line needs to be indented as shown.

--Eric

	Eric Pettersen
	UCSF Computer Graphics Lab

> On Oct 23, 2020, at 12:52 AM, Jeschke Gunnar <gunnar.jeschke at phys.chem.ethz.ch> wrote:
> 
> Hi all,
> 
> is there a way to set atom coordinates by a command?
> 
> setattr spec atoms coord value
> 
> appears to accept only one double argument and sets x, y, and z to this number. Neither space-separated nor comma-separate lists of three values appear to work.
> 
> Kind regards
> 
> Gunnar 
> 
> ---
> 
> Prof. Dr. Gunnar Jeschke
> ETH Zurich
> Department of Chemistry and Applied Biosciences
> Vladimir-Prelog-Weg 2
> CH-8093 Zurich Switzerland
> 
> www.epr.ethz.ch
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20201023/d979e634/attachment.html>


More information about the ChimeraX-users mailing list