Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. def aminer(fNameIn):
  2.     f=open(fNameIn, 'r')
  3.     c=f.readlines()
  4.     atom=[]
  5.     atomy={}
  6.     print f.read()
  7.     j=0
  8.     k=0
  9.     l=0
  10.     for i in range(0,len(c)-1):
  11.         if c[i][0:16]=='_atom_site_label':
  12.             j=i
  13.             atom.append(['_atom_site_label', 0,''])
  14.         elif c[i][0:22]=='_atom_site_type_symbol':
  15.             atom.append(['_atom_site_type_symbol', i-j, ''])
  16.         elif c[i][0:18]=='_atom_site_fract_x':
  17.             atom.append(['_atom_site_fract_x', i-j, ''])
  18.         elif c[i][0:18]=='_atom_site_fract_y':
  19.             atom.append(['_atom_site_fract_y', i-j, ''])
  20.         elif c[i][0:18]=='_atom_site_fract_y':
  21.             atom.append(['_atom_site_fract_y', i-j, ''])
  22.         elif c[i][0:18]=='_atom_site_fract_z':
  23.             atom.append(['_atom_site_fract_z', i-j, ''])
  24.     print atom
  25.    
  26.     while c[j+k][0]!=' ':
  27.         k+=1
  28.  
  29.     while c[j+k+l][0]==' ':
  30.         for i in range(0,len(atom)):
  31.             atom[i][2]=c[j+k+l].split()[atom[i][1]]
  32.             print atom
  33.         atomy['atom %s' %(l+1)]= atom
  34.         l+=1
  35.        
  36.     print atomy
  37.        
  38. aminer('test.cif')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement