pett at cgl.ucsf.edu
Fri Jul 10 13:44:45 PDT 2020
Mostly yes. The function is chimera.StructMeasure.axis(). There is a doc string for the function describing its arguments and return values. In its simplest form it takes a numpy array of xyz values and returns a Point (centroid) instance and a Vector (unit direction vector) instance. To get a length you would also have to supply the findBounds=True keyword argument, in which case it will return two additional floating-point values, the scale factors to apply to the unit vector to get it to the approximate bounds of the axis in each direction (so one of the scale factors will be negative).
If you have a list of Atom instances, the easiest way to generate the numpy xyz array is with numpyArrayFromAtoms, e.g.:
xyzs = chimera.numpyArrayForAtoms(atoms)
If you only really have an atom spec, let me know and I can help with how to generate a list of Atoms from that.
UCSF Computer Graphics Lab
> On Jul 10, 2020, at 11:54 AM, Hernando J Sosa <hernando.sosa at einsteinmed.org> wrote:
> Dear Chimera,
> Is there a way to run a command within a python script equivalent to the chimera command 'define axis' to be able to retrieve the results (length,center, direction) ? Something like:
> (length,center,direction) = mydefineaxis(atomspec)
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chimera-users