Changeset 3019


Ignore:
Timestamp:
Aug 18, 2017 4:04:04 PM (4 years ago)
Author:
odonnell
Message:

fixed error in refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_CIF.py

    r3011 r3019  
    196196
    197197# Refactored over here to allow access by GSASIIscriptable.py
     198def 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
    198216def FmtAtomType(sym):
    199217    'Reformat a GSAS-II atom type symbol to match CIF rules'
     
    298316    WriteCIFitem(fp,  '_chemical_formula_weight',
    299317                  G2mth.ValEsd(cellmass/Z,-0.09,True))
     318
    300319
    301320class ExportCIF(G2IO.ExportBaseclass):
     
    808827        #          WriteCIFitem(self.fp, s)
    809828
    810         def HillSortElements(elmlist):
    811             '''Sort elements in "Hill" order: C, H, others, (where others
    812             are alphabetical).
    813 
    814             :params list elmlist: a list of element strings
    815 
    816             :returns: a sorted list of element strings
    817             '''
    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)
    825844
    826845        # Factored out to above by Jackson O'Donnell
Note: See TracChangeset for help on using the changeset viewer.