Changeset 2286


Ignore:
Timestamp:
May 22, 2016 3:51:48 PM (6 years ago)
Author:
vondreele
Message:

fix problems in INS importer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2phase_INS.py

    r2285 r2286  
    6868        Compnd = ''
    6969        Atoms = []
     70        aTypes = []
    7071        A = np.zeros(shape=(3,3))
    7172        S = file.readline()
     
    9293                SGData = G2IO.SGData # P 1
    9394                self.warnings += '\nThe space group is not given in an ins file and has been set to "P 1".'
    94                 self.warnings += "Change this in phase's General tab."
     95                self.warnings += "\nChange this in phase's General tab; NB: it might be in the Phase name."
    9596            elif S[:4] in 'SFAC':
    9697                aTypes = S[4:].split()
     98                if 'H' in aTypes:
     99                    self.warnings += '\nHydrogen atoms found; consider replacing them with stereochemically tied ones.'
     100                    self.warnings += "\nDo 'Edit/Insert H atoms' in this phase's Atoms tab after deleting the old ones."
    97101            elif S[0] == 'Q':
    98102                pass
    99             elif np.any(Aindx):   #this will find an atom record!
    100                 iNum = Aindx.index(True)
    101                 Atype = S[:iNum]
     103            elif np.any(Aindx) or S[:4].strip() in aTypes:   #this will find an atom record!
     104                try:
     105                    iNum = Aindx.index(True)
     106                except ValueError:
     107                    iNum = 4
     108                Atype = S[:iNum].strip()
    102109                Aname = S[:4]
    103110                x,y,z = S[9:45].split()
     
    130137        self.errors = 'Error after read complete'
    131138        Phase = G2IO.SetNewPhase(Name='ShelX phase',SGData=SGData,cell=cell+[Volume,])
     139        Phase['General']['Name'] = Title
    132140        Phase['General']['Type'] = 'nuclear'
    133141        Phase['General']['AtomPtrs'] = [3,1,7,9]
Note: See TracChangeset for help on using the changeset viewer.