= Overview =
This script will convert the real space orthonormal cartesian coordinates of a selection to the fractional coordinates given the loaded cell symmetry.
Example
# load the script
run cart_to_frac.py
# fetch a protein and test
fetch 1rx1, async=0
# get the coordinates for the organic small
# molecule as fractional coordinates
print cart_to_frac("org")
The Code
<source lang="python">
from pymol import cmd
def cart_to_frac(objSel,quiet=0,_self=cmd):
"""
Returns an array of fractional atomic coordinates
for a given object or selection.
PARAMS
objSel -- any object or selection
quiet -- suppress output (default, no)
_self -- core CMD object; or none
RETURNS
Python list of fractional coordinates
NOTES/EXAMPLES
cart_to_frac org
x = cart_to_frac("solvent", quiet=1)
"""
import numpy
from numpy import cos, sin, sqrt
a2r = ..→