Changeset 3019
- Timestamp:
- Aug 18, 2017 4:04:04 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exports/G2export_CIF.py
r3011 r3019 196 196 197 197 # Refactored over here to allow access by GSASIIscriptable.py 198 def HillSortElements(elmlist): 199 '''Sort elements in "Hill" order: C, H, others, (where others 200 are alphabetical). 201 202 :params list elmlist: a list of element strings 203 204 :returns: a sorted list of element strings 205 ''' 206 newlist = [] 207 oldlist = elmlist[:] 208 for elm in ('C','H'): 209 if elm in elmlist: 210 newlist.append(elm) 211 oldlist.pop(oldlist.index(elm)) 212 return newlist+sorted(oldlist) 213 214 215 # Refactored over here to allow access by GSASIIscriptable.py 198 216 def FmtAtomType(sym): 199 217 'Reformat a GSAS-II atom type symbol to match CIF rules' … … 298 316 WriteCIFitem(fp, '_chemical_formula_weight', 299 317 G2mth.ValEsd(cellmass/Z,-0.09,True)) 318 300 319 301 320 class ExportCIF(G2IO.ExportBaseclass): … … 808 827 # WriteCIFitem(self.fp, s) 809 828 810 def HillSortElements(elmlist):811 '''Sort elements in "Hill" order: C, H, others, (where others812 are alphabetical).813 814 :params list elmlist: a list of element strings815 816 :returns: a sorted list of element strings817 '''818 newlist = []819 oldlist = elmlist[:]820 for elm in ('C','H'):821 if elm in elmlist:822 newlist.append(elm)823 oldlist.pop(oldlist.index(elm))824 return newlist+sorted(oldlist)829 # def HillSortElements(elmlist): 830 # '''Sort elements in "Hill" order: C, H, others, (where others 831 # are alphabetical). 832 833 # :params list elmlist: a list of element strings 834 835 # :returns: a sorted list of element strings 836 # ''' 837 # newlist = [] 838 # oldlist = elmlist[:] 839 # for elm in ('C','H'): 840 # if elm in elmlist: 841 # newlist.append(elm) 842 # oldlist.pop(oldlist.index(elm)) 843 # return newlist+sorted(oldlist) 825 844 826 845 # Factored out to above by Jackson O'Donnell
Note: See TracChangeset
for help on using the changeset viewer.