[Chimera-users] Simple distance to .txt scripting question

Eric Pettersen pett at cgl.ucsf.edu
Fri Dec 9 19:34:04 PST 2011

Hi Andrew,
	So, first select the two atoms somehow (e.g. "sel #0:519.A at NZ #:1.Y at O4"), then do this to get the distance into a variable 'd':

import chimera
atoms = chimera.selection.currentAtoms()
d = atoms[0].xformCoord().distance(atoms[1].xformCoord())


	Eric Pettersen
	UCSF Computer Graphics Lab

On Dec 9, 2011, at 5:35 PM, Andrew Hagen wrote:

> Hi everyone,
> I'm trying to write a script that opens a set of .pdbs, measures the distances between certain atoms, and then writes the distance to a text file for later analysis.  It's easy enough to do something like...
> >>> runCommand("distance #0:519.A at NZ #:1.Y at O4")
> ...which executes the command and appends the info to the reply log ("Distance between #0 LYS 519.A NZ and #5 X01 1.Y O4: 2.33").  What I'd like to do is have that actual measured distance (2.33) be stored in a variable that I could then write to a text file (I know how to do this bit).
> Thanks for any thoughts!
> --Andrew
> -- 
> Andrew Hagen
> PhD candidate - Plant and Microbial Biology
> UC Berkeley - Keasling group
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list