Hi Leigh - 

How are you getting the coordinates?  This works for me:

```
import math

# Show more digits for the distance label
set label_distance_digits, 10

# Make an alanine residue
fab A, ala

# Get coordinates from 2 atoms
o = cmd.get_coords("/ala///1/O")[0]
h = cmd.get_coords("/ala///1/H")[0]

# Calculate the distance
dx = h[0] - o[0]
dy = h[1] - o[1]
dz = h[2] - o[2]
d = math.sqrt(dx**2 + dy**2 + dz**2)
print(d)

# Distance from script: 2.3546268062493567
# Distance from wizard: 2.354626655  (label maxes out at 10 digits)
```

Those values seem close enough to me.  Is it possible that in your script 
you're getting the coordinates for the i+1 or i-1 atom instead, or a different 
state?  Or maybe picking the other side of a symmetric side chain (e.g. OD1 vs 
OD2)?  If you could share the relevant portion of the script, you might get 
some more useful feedback; right now all we can do is guess!

Cheers,
Jared


On October 12, 2017 at 2:19:36 PM, Leigh M (leigh.j.man...@gmail.com) wrote:

Anyone know how pymol calculates distance between two atoms? 
I wrote a python script that calculates distance using the distance formula and 
the xyz coordinates in the pdb, and it differs from the wizard by ~40%. Any 
ideas on what might be going on would be helpdul

Thanks!

Leigh
------------------------------------------------------------------------------  
Check out the vibrant tech community on one of the world's most  
engaging tech sites, Slashdot.org! 
http://sdm.link/slashdot_______________________________________________  
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)  
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users  
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to