Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys
  4. import openbabel as ob
  5. import pybel
  6.  
  7. for filename in sys.argv[1:]:
  8. mol = pybel.readfile("g09", filename).next()
  9. nitro = mol.atoms[0]
  10. amine = mol.atoms[0]
  11.  
  12. # Strip off common extensions
  13. filename = filename.split('.',1)[0]
  14. if filename.startswith('line'):
  15. filename = filename[4:]
  16.  
  17. # loop through to find the nitro and amine N atoms
  18. for atom in mol:
  19. if atom.OBAtom.IsNitrogen() and atom.OBAtom.CountFreeOxygens() == 2:
  20. # print "got no2"
  21. nitro = atom
  22. if atom.OBAtom.IsNitrogen() and atom.OBAtom.ExplicitHydrogenCount() == 2:
  23. # print "got nh2"
  24. amine = atom
  25.  
  26. print filename, amine.OBAtom.GetDistance(nitro.OBAtom)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement