source: trunk/imports/G2phase.py @ 2858

Last change on this file since 2858 was 2858, checked in by vondreele, 6 years ago

fix Pawley restraint problem
force skip of disordered residues in pdb reader - can't handle them in G2
small cleanup in SVD stuff

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