source: trunk/imports/G2phase.py @ 2038

Last change on this file since 2038 was 2038, checked in by vondreele, 8 years ago

add betaij2Uij to G2lattice
revisions to SS structure factor calcs. Use hklt proj to hkl is several places
fxn works for thiourea derivs OK except X,Y,Zcos modulations; no Uijsin/cos derivatives yet
adj scaling of 4D charge flip maps
convert betaij vals from Jana2K files to Uij
start on SS read phase from cif
added a hklt F import (might vanish)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Revision URL Id
File size: 23.9 KB
Line 
1# -*- coding: utf-8 -*-
2########### SVN repository information ###################
3# $Date: 2015-10-30 21:02:02 +0000 (Fri, 30 Oct 2015) $
4# $Author: vondreele $
5# $Revision: 2038 $
6# $URL: trunk/imports/G2phase.py $
7# $Id: G2phase.py 2038 2015-10-30 21:02:02Z vondreele $
8########### SVN repository information ###################
9#
10'''
11*Module G2phase: PDB, .EXP & JANA m40,m50*
12-------------------------------------------
13
14A set of short routines to read in phases using routines that were
15previously implemented in GSAS-II: PDB, GSAS .EXP and JANA m40-m50 file formats
16
17'''
18
19import sys
20import os.path
21import math
22import random as ran
23import traceback
24import numpy as np
25import wx
26import GSASIIIO as G2IO
27import GSASIIspc as G2spc
28import GSASIIlattice as G2lat
29import GSASIIpath
30GSASIIpath.SetVersionNumber("$Revision: 2038 $")
31R2pisq = 1./(2.*np.pi**2)
32
33class PDB_ReaderClass(G2IO.ImportPhase):
34    'Routine to import Phase information from a PDB file'
35    def __init__(self):
36        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
37            extensionlist=('.pdb','.ent','.PDB','.ENT'),
38            strictExtension=True,
39            formatName = 'PDB',
40            longFormatName = 'Original Protein Data Bank (.pdb file) import'
41            )
42    def ContentsValidator(self, filepointer):
43        '''Taking a stab a validating a PDB file
44        (look for cell & at least one atom)
45        '''
46        for i,l in enumerate(filepointer):
47            if l.startswith('CRYST1'):
48                break
49        else:
50            self.errors = 'no CRYST1 record found'
51            return False
52        for i,l in enumerate(filepointer):
53            if l.startswith('ATOM'):
54                return True
55        self.errors = 'no ATOM records found after CRYST1 record'
56        return False
57
58    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
59        'Read a PDF file using :meth:`ReadPDBPhase`'
60        try:
61            self.Phase = self.ReadPDBPhase(filename, ParentFrame)
62            return True
63        except Exception as detail:
64            self.errors += '\n  '+str(detail)
65            print 'PDB read error:',detail # for testing
66            traceback.print_exc(file=sys.stdout)
67            return False
68       
69    def ReadPDBPhase(self,filename,parent=None):
70        '''Read a phase from a PDB file.
71        '''
72        EightPiSq = 8.*math.pi**2
73        self.errors = 'Error opening file'
74        file = open(filename, 'Ur')
75        Phase = {}
76        Title = ''
77        Compnd = ''
78        Atoms = []
79        A = np.zeros(shape=(3,3))
80        S = file.readline()
81        line = 1
82        SGData = None
83        cell = None
84        while S:
85            self.errors = 'Error reading at line '+str(line)
86            Atom = []
87            if 'TITLE' in S[:5]:
88                Title = S[10:72].strip()
89            elif 'COMPND    ' in S[:10]:
90                Compnd = S[10:72].strip()
91            elif 'CRYST' in S[:5]:
92                abc = S[7:34].split()
93                angles = S[34:55].split()
94                cell=[float(abc[0]),float(abc[1]),float(abc[2]),
95                    float(angles[0]),float(angles[1]),float(angles[2])]
96                Volume = G2lat.calc_V(G2lat.cell2A(cell))
97                AA,AB = G2lat.cell2AB(cell)
98                SpGrp = S[55:65]
99                E,SGData = G2spc.SpcGroup(SpGrp)
100                # space group processing failed, try to look up name in table
101                if E:
102                    SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
103                    if SpGrpNorm:
104                        E,SGData = G2spc.SpcGroup(SpGrpNorm)
105                while E:
106                    print G2spc.SGErrors(E)
107                    dlg = wx.TextEntryDialog(parent,
108                        SpGrp[:-1]+' is invalid \nN.B.: make sure spaces separate axial fields in symbol',
109                        'ERROR in space group symbol','',style=wx.OK)
110                    if dlg.ShowModal() == wx.ID_OK:
111                        SpGrp = dlg.GetValue()
112                        E,SGData = G2spc.SpcGroup(SpGrp)
113                    else:
114                        SGData = G2IO.SGData # P 1
115                        self.warnings += '\nThe space group was not interpreted and has been set to "P 1".'
116                        self.warnings += "Change this in phase's General tab."           
117                    dlg.Destroy()
118                SGlines = G2spc.SGPrint(SGData)
119                for l in SGlines: print l
120            elif 'SCALE' in S[:5]:
121                V = S[10:41].split()
122                A[int(S[5])-1] = [float(V[0]),float(V[1]),float(V[2])]
123            elif 'ATOM' in S[:4] or 'HETATM' in S[:6]:
124                if not SGData:
125                    self.warnings += '\nThe space group was not read before atoms and has been set to "P 1". '
126                    self.warnings += "Change this in phase's General tab."
127                    SGData = G2IO.SGData # P 1
128                XYZ = [float(S[31:39]),float(S[39:47]),float(S[47:55])]
129                XYZ = np.inner(AB,XYZ)
130                XYZ = np.where(abs(XYZ)<0.00001,0,XYZ)
131                SytSym,Mult = G2spc.SytSym(XYZ,SGData)
132                Uiso = float(S[61:67])/EightPiSq
133                Type = S[12:14].lower()
134                if Type[0] in '123456789':
135                    Type = Type[1:]
136                Atom = [S[22:27].strip(),S[17:20].upper(),S[20:22],
137                    S[12:17].strip(),Type.strip().capitalize(),'',XYZ[0],XYZ[1],XYZ[2],
138                    float(S[55:61]),SytSym,Mult,'I',Uiso,0,0,0,0,0,0]
139                S = file.readline()
140                line += 1
141                if 'ANISOU' in S[:6]:
142                    Uij = S[30:72].split()
143                    Uij = [float(Uij[0])/10000.,float(Uij[1])/10000.,float(Uij[2])/10000.,
144                        float(Uij[3])/10000.,float(Uij[4])/10000.,float(Uij[5])/10000.]
145                    Atom = Atom[:14]+Uij
146                    Atom[12] = 'A'
147                Atom.append(ran.randint(0,sys.maxint))
148                Atoms.append(Atom)
149            S = file.readline()
150            line += 1
151        file.close()
152        self.errors = 'Error after read complete'
153        if Title:
154            PhaseName = Title
155        elif Compnd:
156            PhaseName = Compnd
157        else:
158            PhaseName = 'None'
159        if not SGData:
160            raise self.ImportException("No space group (CRYST entry) found")
161        if not cell:
162            raise self.ImportException("No cell (CRYST entry) found")
163        Phase = G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell+[Volume,])
164        Phase['General']['Type'] = 'macromolecular'
165        Phase['General']['AtomPtrs'] = [6,4,10,12]
166        Phase['Atoms'] = Atoms
167        return Phase
168
169class EXP_ReaderClass(G2IO.ImportPhase):
170    'Routine to import Phase information from GSAS .EXP files'
171    def __init__(self):
172        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
173            extensionlist=('.EXP','.exp'),
174            strictExtension=True,
175            formatName = 'GSAS .EXP',
176            longFormatName = 'GSAS Experiment (.EXP file) import'
177            )
178       
179    def ContentsValidator(self, filepointer):
180        'Look for a VERSION tag in 1st line' 
181        if filepointer.read(13) == '     VERSION ':
182            return True
183        self.errors = 'File does not begin with VERSION tag'
184        return False
185
186    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
187        'Read a phase from a GSAS .EXP file using :meth:`ReadEXPPhase`'
188        try:
189            self.Phase = self.ReadEXPPhase(ParentFrame, filepointer)
190            return True
191        except Exception as detail:
192            self.errors += '\n  '+str(detail)
193            print 'GSAS .EXP read error:',detail # for testing
194            traceback.print_exc(file=sys.stdout)
195            return False
196
197    def ReadEXPPhase(self, G2frame,filepointer):
198        '''Read a phase from a GSAS .EXP file.
199        '''
200        shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
201        textureData = {'Order':0,'Model':'cylindrical','Sample omega':[False,0.0],
202            'Sample chi':[False,0.0],'Sample phi':[False,0.0],'SH Coeff':[False,{}],
203            'SHShow':False,'PFhkl':[0,0,1],'PFxyz':[0,0,1],'PlotType':'Pole figure'}
204        shNcof = 0
205        S = 1
206        NPhas = []
207        Expr = [{},{},{},{},{},{},{},{},{}] # GSAS can have at most 9 phases
208        for line,S in enumerate(filepointer):
209            self.errors = 'Error reading at line '+str(line+1)
210            if 'EXPR NPHAS' in S[:12]:
211                Num = S[12:-1].count('0')
212                NPhas = S[12:-1].split()
213            if 'CRS' in S[:3]:
214                N = int(S[3:4])-1
215                Expr[N][S[:12]] = S[12:-1]
216        PNames = []
217        if not NPhas:
218            raise self.ImportException("No EXPR NPHAS record found")
219        self.errors = 'Error interpreting file'
220        for n,N in enumerate(NPhas):
221            if N != '0':
222                result = n
223                key = 'CRS'+str(n+1)+'    PNAM'
224                PNames.append(Expr[n][key])
225        if len(PNames) == 0:
226            raise self.ImportException("No phases found")           
227        elif len(PNames) > 1:
228            dlg = wx.SingleChoiceDialog(G2frame, 'Which phase to read?', 'Read phase data', PNames, wx.CHOICEDLG_STYLE)
229            try:
230                if dlg.ShowModal() == wx.ID_OK:
231                    result = dlg.GetSelection() # I think this breaks is there are skipped phases. Cant this happen?
232            finally:
233                dlg.Destroy()       
234        EXPphase = Expr[result]
235        keyList = EXPphase.keys()
236        keyList.sort()
237        SGData = {}
238        if NPhas[result] == '1':
239            Ptype = 'nuclear'
240        elif NPhas[result] in ['2','3']:
241            Ptype = 'magnetic'
242        elif NPhas[result] == '4':
243            Ptype = 'macromolecular'
244        elif NPhas[result] == '10':
245            Ptype = 'Pawley'
246        else:
247            raise self.ImportException("Phase type not recognized")           
248        for key in keyList:
249            if 'PNAM' in key:
250               PhaseName = EXPphase[key].strip()
251            elif 'ABC   ' in key:
252                abc = [float(EXPphase[key][:10]),float(EXPphase[key][10:20]),float(EXPphase[key][20:30])]                       
253            elif 'ANGLES' in key:
254                angles = [float(EXPphase[key][:10]),float(EXPphase[key][10:20]),float(EXPphase[key][20:30])]                                               
255            elif 'SG SYM' in key:
256                SpGrp = EXPphase[key][:15].strip()
257                E,SGData = G2spc.SpcGroup(SpGrp)
258                if E:
259                    SGData = G2IO.SGData # P 1 -- unlikely to need this!
260                    self.warnings += '\nThe GSAS space group was not interpreted(!) and has been set to "P 1".'
261                    self.warnings += "Change this in phase's General tab."                       
262            elif 'OD    ' in key:
263                SHdata = EXPphase[key].split() # may not have all 9 values
264                SHvals = 9*[0]
265                for i in range(9):
266                    try:
267                        float(SHdata[i])
268                        SHvals[i] = SHdata[i]
269                    except:
270                        pass
271                textureData['Order'] = int(SHvals[0])
272                textureData['Model'] = shModels[int(SHvals[2])]
273                textureData['Sample omega'] = [False,float(SHvals[6])]
274                textureData['Sample chi'] = [False,float(SHvals[7])]
275                textureData['Sample phi'] = [False,float(SHvals[8])]
276                shNcof = int(SHvals[1])
277        Atoms = []
278        if Ptype == 'nuclear':
279            for key in keyList:
280                if 'AT' in key:
281                    if key[11:] == 'A':
282                        S = EXPphase[key]
283                    elif key[11:] == 'B':
284                        S += EXPphase[key]
285                        Atom = [S[50:58].strip(),S[:10].strip().capitalize(),'',
286                            float(S[10:20]),float(S[20:30]),float(S[30:40]),
287                            float(S[40:50]),'',int(S[60:62]),S[130:131]]
288                        if Atom[9] == 'I':
289                            Atom += [float(S[68:78]),0.,0.,0.,0.,0.,0.]
290                        elif Atom[9] == 'A':
291                            Atom += [0.0,float(S[68:78]),float(S[78:88]),
292                                float(S[88:98]),float(S[98:108]),
293                                float(S[108:118]),float(S[118:128])]
294                        XYZ = Atom[3:6]
295                        Atom[7],Atom[8] = G2spc.SytSym(XYZ,SGData)
296                        Atom.append(ran.randint(0,sys.maxint))
297                        Atoms.append(Atom)
298        elif Ptype == 'macromolecular':
299            for key in keyList:
300                if 'AT' in key[6:8]:
301                    S = EXPphase[key]
302                    Atom = [S[56:60],S[50:54].strip().upper(),S[54:56],
303                        S[46:51].strip(),S[:8].strip().capitalize(),'',
304                        float(S[16:24]),float(S[24:32]),float(S[32:40]),
305                        float(S[8:16]),'1',1,'I',float(S[40:46]),0,0,0,0,0,0]
306                    XYZ = Atom[6:9]
307                    Atom[10],Atom[11] = G2spc.SytSym(XYZ,SGData)
308                    Atom.append(ran.randint(0,sys.maxint))
309                    Atoms.append(Atom)
310        Volume = G2lat.calc_V(G2lat.cell2A(abc+angles))
311        if shNcof:
312            shCoef = {}
313            nRec = [i+1 for i in range((shNcof-1)/6+1)]
314            for irec in nRec:
315                ODkey = keyList[0][:6]+'OD'+'%3dA'%(irec)
316                indx = EXPphase[ODkey].split()
317                ODkey = ODkey[:-1]+'B'
318                vals = EXPphase[ODkey].split()
319                for i,val in enumerate(vals):
320                    key = 'C(%s,%s,%s)'%(indx[3*i],indx[3*i+1],indx[3*i+2])
321                    shCoef[key] = float(val)
322            textureData['SH Coeff'] = [False,shCoef]
323        if not SGData:
324            raise self.ImportException("No space group found in phase")
325        if not abc:
326            raise self.ImportException("No cell lengths found in phase")
327        if not angles:
328            raise self.ImportException("No cell angles found in phase")
329        if not Atoms:
330            raise self.ImportException("No atoms found in phase")
331        Phase = G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=abc+angles+[Volume,])
332        general = Phase['General']
333        general['Type'] = Ptype
334        if general['Type'] =='macromolecular':
335            general['AtomPtrs'] = [6,4,10,12]
336        else:
337            general['AtomPtrs'] = [3,1,7,9]   
338        general['SH Texture'] = textureData
339        Phase['Atoms'] = Atoms
340        return Phase
341
342class JANA_ReaderClass(G2IO.ImportPhase):
343    'Routine to import Phase information from a JANA2006 file'
344    def __init__(self):
345        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
346            extensionlist=('.m50','.M50'),
347            strictExtension=True,
348            formatName = 'JANA m50',
349            longFormatName = 'JANA2006 phase import'
350            )
351    def ContentsValidator(self, filepointer):
352        '''Taking a stab a validating a .m50 file
353        (look for cell & at least one atom)
354        '''
355        for i,l in enumerate(filepointer):
356            if l.startswith('cell'):
357                break
358        else:
359            self.errors = 'no cell record found'
360            return False
361        for i,l in enumerate(filepointer):
362            if l.startswith('spgroup'):
363                return True
364        self.errors = 'no spgroup record found after cell record'
365        return False
366       
367    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
368        'Read a m50 file using :meth:`ReadJANAPhase`'
369        try:
370            self.Phase = self.ReadJANAPhase(filename, ParentFrame)
371            return True
372        except Exception as detail:
373            self.errors += '\n  '+str(detail)
374            print 'JANA read error:',detail # for testing
375            traceback.print_exc(file=sys.stdout)
376            return False
377       
378    def ReadJANAPhase(self,filename,parent=None):
379        '''Read a phase from a JANA2006 m50 & m40 files.
380        '''
381        self.errors = 'Error opening file'
382        file = open(filename, 'Ur') #contains only cell & spcgroup
383        Phase = {}
384        Title = os.path.basename(filename)
385        Compnd = ''
386        Type = 'nuclear'
387        Atoms = []
388        Atypes = []
389        SuperVec = [[0,0,.1],False,4]
390        S = file.readline()
391        line = 1
392        SGData = None
393        SuperSg = ''
394        cell = None
395        nqi = 0
396        while S:
397            self.errors = 'Error reading at line '+str(line)
398            if 'title' in S and S != 'title\n':
399                Title = S.split()[1]
400            elif 'cell' in S[:4]:
401                cell = S[5:].split()
402                cell=[float(cell[0]),float(cell[1]),float(cell[2]),
403                    float(cell[3]),float(cell[4]),float(cell[5])]
404                Volume = G2lat.calc_V(G2lat.cell2A(cell))
405                G,g = G2lat.cell2Gmat(cell)
406                ast = np.sqrt(np.diag(G))
407                Mast = np.multiply.outer(ast,ast)   
408               
409            elif 'spgroup' in S:
410                if 'X' in S:
411                    raise self.ImportException("Supersymmetry "+S+" too high; GSAS-II limited to (3+1) supersymmetry")           
412                SpGrp = S.split()[1]
413                SuperSg = ''
414                if '(' in SpGrp:    #supercell symmetry - split in 2
415                    SuperStr = SpGrp.split('(')
416                    SpGrp = SuperStr[0]
417                    SuperSg = '('+SuperStr[1]
418                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
419                E,SGData = G2spc.SpcGroup(SpGrpNorm)
420                # space group processing failed, try to look up name in table
421                while E:
422                    print G2spc.SGErrors(E)
423                    dlg = wx.TextEntryDialog(parent,
424                        SpGrp[:-1]+' is invalid \nN.B.: make sure spaces separate axial fields in symbol',
425                        'ERROR in space group symbol','',style=wx.OK)
426                    if dlg.ShowModal() == wx.ID_OK:
427                        SpGrp = dlg.GetValue()
428                        E,SGData = G2spc.SpcGroup(SpGrp)
429                    else:
430                        SGData = G2IO.SGData # P 1
431                        self.warnings += '\nThe space group was not interpreted and has been set to "P 1".'
432                        self.warnings += "Change this in phase's General tab."           
433                    dlg.Destroy()
434                SGlines = G2spc.SGPrint(SGData)
435            elif 'qi' in S[:2]:
436                if nqi:
437                    raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")           
438                Type = 'modulated'
439                vec = S.split()[1:]
440                SuperVec = [[float(vec[i]) for i in range(3)],False,4]
441                nqi += 1
442            elif 'atom' in S[:4]:
443                Atypes.append(S.split()[1])
444            S = file.readline()
445            line += 1
446        file.close()
447        #read atoms from m40 file
448        if not SGData:
449            self.warnings += '\nThe space group was not read before atoms and has been set to "P 1". '
450            self.warnings += "Change this in phase's General tab."
451            SGData = G2IO.SGData # P 1
452        waveTypes = ['Fourier','Sawtooth','ZigZag',]
453        filename2 = os.path.splitext(filename)[0]+'.m40'
454        file2 = open(filename2,'Ur')
455        S = file2.readline()
456        line = 1
457        self.errors = 'Error reading at line '+str(line)
458        nAtoms = int(S.split()[0])
459        for i in range(4):
460            S = file2.readline()           
461        for i in range(nAtoms):
462            S1 = file2.readline()
463            S1N = S1.split()[-3:]   # no. occ, no. pos waves, no. ADP waves
464            S1N = [int(i) for i in S1N]
465            S1T = list(S1[60:63])
466            waveType = waveTypes[int(S1T[1])]
467            crenelType = ''
468            Spos = []
469            Sadp = []
470            Sfrac = []
471            Smag = []
472            XYZ = [float(S1[27:36]),float(S1[36:45]),float(S1[45:54])]
473            SytSym,Mult = G2spc.SytSym(XYZ,SGData)
474            aType = Atypes[int(S1[9:11])-1]
475            Name = S1[:8].strip()
476            if S1[11:15].strip() == '1':
477                S2 = file2.readline()
478                Uiso = float(S2[:9])
479                Uij = [0,0,0,0,0,0]
480                IA = 'I'
481            elif S1[11:15].strip() == '2':
482                S2 = file2.readline()
483                IA = 'A'
484                Uiso = 0.
485                Uij = [float(S2[:9]),float(S2[9:18]),float(S2[18:27]),
486                    float(S2[27:36]),float(S2[36:45]),float(S2[45:54])] #these things are betaij! need to convert to Uij
487                Uij = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(Uij)/Mast)
488            for i in range(S1N[0]):
489                if not i:
490                    FS = file2.readline()
491                    Sfrac.append(FS[:9])    #'O' or 'delta' = 'length' for crenel
492                    if int(S1T[0]):  #"", "Legendre" or "Xharm" in 18:27 for "crenel"!
493                        waveType = 'Crenel/Fourier' #all waves 'Fourier' no other choice
494                        crenelType = FS[18:27]
495                Sfrac.append(file2.readline()[:18]) #if not crenel = Osin & Ocos
496                # else Osin & Ocos except last one is X40 = 'Center'
497            for i in range(S1N[1]): 
498                Spos.append(file2.readline()[:54])
499            for i in range(S1N[2]):
500                Sadp.append(file2.readline()[:54]+file2.readline())
501            if sum(S1N):    #if any waves: skip mystery line?
502                file2.readline()
503            for i,it in enumerate(Sfrac):
504                print i,it
505                if not i:
506                    if 'Crenel' in waveType:
507                        vals = [float(it),float(Sfrac[-1][:9])]
508                    else:
509                        vals = [float(it),]
510                else:
511                    vals = [float(it[:9]),float(it[9:18])]
512                if 'Crenel' in waveType and i == len(Sfrac)-1:
513                    del Sfrac[-1]
514                    break               
515                Sfrac[i] = [vals,False]
516                print Sfrac[i]
517            for i,it in enumerate(Spos):
518                if waveType in ['ZigZag','Sawtooth'] and not i:
519                    vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36])]
520                else:
521                    vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54])]
522                Spos[i] = [vals,False]
523            for i,it in enumerate(Sadp):
524                #these are betaij modulations! need to convert to Uij modulations
525                vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54]),
526                    float(it[54:63]),float(it[63:72]),float(it[72:81]),float(it[81:90]),float(it[90:99]),float(it[99:108])]               
527                vals[:6] = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(vals[:6])/Mast)    #convert sin bij to Uij
528                vals[6:] = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(vals[6:])/Mast)    #convert cos bij to Uij
529                Sadp[i] = [vals,False]
530            Atom = [Name,aType,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso]
531            Atom += Uij
532            Atom.append(ran.randint(0,sys.maxint))
533            Atom.append([])
534            Atom.append([])
535            Atom.append({'SS1':{'waveType':waveType,'crenelType':crenelType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}})    #SS2 is for (3+2), etc.
536            Atoms.append(Atom)
537        file2.close()
538        self.errors = 'Error after read complete'
539        if not SGData:
540            raise self.ImportException("No space group (spcgroup entry) found")
541        if not cell:
542            raise self.ImportException("No cell found")
543        Phase = G2IO.SetNewPhase(Name=Title,SGData=SGData,cell=cell+[Volume,])
544        Phase['General']['Type'] = Type
545        Phase['General']['Super'] = nqi
546        Phase['General']['SuperVec'] = SuperVec
547        Phase['General']['SuperSg'] = SuperSg
548        if SuperSg:
549            Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
550        Phase['General']['AtomPtrs'] = [3,1,7,9]
551        Phase['Atoms'] = Atoms
552        return Phase
Note: See TracBrowser for help on using the repository browser.