source: trunk/imports/G2phase.py @ 2840

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

fix PDB importer & reimport atoms
rework RB GUI - now shows just one residue at a time & structure plot follows selection
also RB parameter changes show on structure drawing
add protein validator - not complete
remove commented out dead code from GSAIIgrid
fix bug if cancel of macro restraints selection

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Revision URL Id
File size: 24.4 KB
Line 
1# -*- coding: utf-8 -*-
2########### SVN repository information ###################
3# $Date: 2017-05-27 16:20:45 +0000 (Sat, 27 May 2017) $
4# $Author: vondreele $
5# $Revision: 2840 $
6# $URL: trunk/imports/G2phase.py $
7# $Id: G2phase.py 2840 2017-05-27 16:20:45Z 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: 2840 $")
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                Atom.append(ran.randint(0,sys.maxint))
133                Atoms.append(Atom)
134            elif 'ANISOU' in S[:6]:
135                Uij = S[30:72].split()
136                Uij = [float(Uij[0])/10000.,float(Uij[1])/10000.,float(Uij[2])/10000.,
137                    float(Uij[3])/10000.,float(Uij[4])/10000.,float(Uij[5])/10000.]
138                Atoms[-1] = Atoms[-1][:14]+Uij
139                Atoms[-1][12] = 'A'
140                Atoms[-1].append(ran.randint(0,sys.maxint))
141            S = file.readline()
142            line += 1
143        file.close()
144        self.errors = 'Error after read complete'
145        if Title:
146            PhaseName = Title
147        elif Compnd:
148            PhaseName = Compnd
149        else:
150            PhaseName = 'None'
151        if not SGData:
152            raise self.ImportException("No space group (CRYST entry) found")
153        if not cell:
154            raise self.ImportException("No cell (CRYST entry) found")
155        Phase = G2obj.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell+[Volume,])
156        Phase['General']['Type'] = 'macromolecular'
157        Phase['General']['AtomPtrs'] = [6,4,10,12]
158        Phase['Atoms'] = Atoms
159        return Phase
160
161class EXP_ReaderClass(G2obj.ImportPhase):
162    'Routine to import Phase information from GSAS .EXP files'
163    def __init__(self):
164        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
165            extensionlist=('.EXP','.exp'),
166            strictExtension=True,
167            formatName = 'GSAS .EXP',
168            longFormatName = 'GSAS Experiment (.EXP file) import'
169            )
170       
171    def ContentsValidator(self, filepointer):
172        'Look for a VERSION tag in 1st line' 
173        if filepointer.read(13) == '     VERSION ':
174            return True
175        self.errors = 'File does not begin with VERSION tag'
176        return False
177
178    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
179        'Read a phase from a GSAS .EXP file using :meth:`ReadEXPPhase`'
180        self.Phase = self.ReadEXPPhase(ParentFrame, filepointer)
181        return True
182
183    def ReadEXPPhase(self, G2frame,filepointer):
184        '''Read a phase from a GSAS .EXP file.
185        '''
186        shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
187        textureData = {'Order':0,'Model':'cylindrical','Sample omega':[False,0.0],
188            'Sample chi':[False,0.0],'Sample phi':[False,0.0],'SH Coeff':[False,{}],
189            'SHShow':False,'PFhkl':[0,0,1],'PFxyz':[0,0,1],'PlotType':'Pole figure'}
190        shNcof = 0
191        S = 1
192        NPhas = []
193        Expr = [{},{},{},{},{},{},{},{},{}] # GSAS can have at most 9 phases
194        for line,S in enumerate(filepointer):
195            self.errors = 'Error reading at line '+str(line+1)
196            if 'EXPR NPHAS' in S[:12]:
197                NPhas = S[12:-1].split()
198            if 'CRS' in S[:3]:
199                N = int(S[3:4])-1
200                Expr[N][S[:12]] = S[12:-1]
201        PNames = []
202        if not NPhas:
203            raise self.ImportException("No EXPR NPHAS record found")
204        self.errors = 'Error interpreting file'
205        for n,N in enumerate(NPhas):
206            if N != '0':
207                result = n
208                key = 'CRS'+str(n+1)+'    PNAM'
209                PNames.append(Expr[n][key])
210        if len(PNames) == 0:
211            raise self.ImportException("No phases found")           
212        elif len(PNames) > 1:
213            dlg = wx.SingleChoiceDialog(G2frame, 'Which phase to read?', 'Read phase data', PNames, wx.CHOICEDLG_STYLE)
214            try:
215                if dlg.ShowModal() == wx.ID_OK:
216                    result = dlg.GetSelection() # I think this breaks is there are skipped phases. Cant this happen?
217            finally:
218                dlg.Destroy()       
219        EXPphase = Expr[result]
220        keyList = EXPphase.keys()
221        keyList.sort()
222        SGData = {}
223        if NPhas[result] == '1':
224            Ptype = 'nuclear'
225        elif NPhas[result] in ['2','3']:
226            Ptype = 'nuclear'
227#            Ptype = 'magnetic'
228#            MagDmin = 1.0
229        elif NPhas[result] == '4':
230            Ptype = 'macromolecular'
231        elif NPhas[result] == '10':
232            Ptype = 'Pawley'
233        else:
234            raise self.ImportException("Phase type not recognized")           
235        for key in keyList:
236            if 'PNAM' in key:
237               PhaseName = EXPphase[key].strip()
238            elif 'ABC   ' in key:
239                abc = [float(EXPphase[key][:10]),float(EXPphase[key][10:20]),float(EXPphase[key][20:30])]                       
240            elif 'ANGLES' in key:
241                angles = [float(EXPphase[key][:10]),float(EXPphase[key][10:20]),float(EXPphase[key][20:30])]                                               
242            elif 'SG SYM' in key:
243                SpGrp = EXPphase[key][:15].strip()
244                E,SGData = G2spc.SpcGroup(SpGrp)
245                if E:
246                    SGData = G2obj.P1SGData # P 1 -- unlikely to need this!
247                    self.warnings += '\nThe GSAS space group was not interpreted(!) and has been set to "P 1".'
248                    self.warnings += "Change this in phase's General tab."                       
249#            elif 'SPNFLP' in key:
250#                SpnFlp = np.array([int(float(s)) for s in EXPphase[key].split()])
251#                SpnFlp = np.where(SpnFlp==0,1,SpnFlp)
252#                if SGData['SpGrp'][0] in ['A','B','C','I','R','F']:
253#                    SpnFlp += [1,1,1,1]
254#            elif 'MXDSTR' in key:
255#                MagDmin = float(EXPphase[key][:10])               
256            elif 'OD    ' in key:
257                SHdata = EXPphase[key].split() # may not have all 9 values
258                SHvals = 9*[0]
259                for i in range(9):
260                    try:
261                        float(SHdata[i])
262                        SHvals[i] = SHdata[i]
263                    except:
264                        pass
265                textureData['Order'] = int(SHvals[0])
266                textureData['Model'] = shModels[int(SHvals[2])]
267                textureData['Sample omega'] = [False,float(SHvals[6])]
268                textureData['Sample chi'] = [False,float(SHvals[7])]
269                textureData['Sample phi'] = [False,float(SHvals[8])]
270                shNcof = int(SHvals[1])
271        Atoms = []
272        if Ptype in ['nuclear','magnetic',]:
273            for key in keyList:
274                if 'AT' in key:
275                    if key[11:] == 'A':
276                        S = EXPphase[key]
277                    elif key[11:] == 'B':
278                        S += EXPphase[key]
279                        Atom = [S[50:58].strip(),S[:10].strip().capitalize(),'',
280                            float(S[10:20]),float(S[20:30]),float(S[30:40]),
281                            float(S[40:50]),'',int(S[60:62]),S[130:131]]
282                        if Atom[9] == 'I':
283                            Atom += [float(S[68:78]),0.,0.,0.,0.,0.,0.]
284                        elif Atom[9] == 'A':
285                            Atom += [0.0,float(S[68:78]),float(S[78:88]),
286                                float(S[88:98]),float(S[98:108]),
287                                float(S[108:118]),float(S[118:128])]
288                        XYZ = Atom[3:6]
289                        Atom[7],Atom[8] = G2spc.SytSym(XYZ,SGData)[:2]
290#                        if Ptype == 'magnetic':
291#                            Atom = Atom[:7]+[0.,0.,0.]+Atom[7:]
292                        Atom.append(ran.randint(0,sys.maxint))
293                        Atoms.append(Atom)
294                    elif key[11:] == 'M' and key[6:8] == 'AT':
295                        S = EXPphase[key]
296                        Atoms[-1] = Atom[:7]+[float(S[:10]),float(S[10:20]),float(S[20:30])]+Atom[7:]
297        elif Ptype == 'macromolecular':
298            for key in keyList:
299                if 'AT' in key[6:8]:
300                    S = EXPphase[key]
301                    Atom = [S[56:60],S[50:54].strip().upper(),S[54:56],
302                        S[46:51].strip(),S[:8].strip().capitalize(),'',
303                        float(S[16:24]),float(S[24:32]),float(S[32:40]),
304                        float(S[8:16]),'1',1,'I',float(S[40:46]),0,0,0,0,0,0]
305                    XYZ = Atom[6:9]
306                    Atom[10],Atom[11] = G2spc.SytSym(XYZ,SGData)[:2]
307                    Atom.append(ran.randint(0,sys.maxint))
308                    Atoms.append(Atom)
309        Volume = G2lat.calc_V(G2lat.cell2A(abc+angles))
310        if shNcof:
311            shCoef = {}
312            nRec = [i+1 for i in range((shNcof-1)/6+1)]
313            for irec in nRec:
314                ODkey = keyList[0][:6]+'OD'+'%3dA'%(irec)
315                indx = EXPphase[ODkey].split()
316                ODkey = ODkey[:-1]+'B'
317                vals = EXPphase[ODkey].split()
318                for i,val in enumerate(vals):
319                    key = 'C(%s,%s,%s)'%(indx[3*i],indx[3*i+1],indx[3*i+2])
320                    shCoef[key] = float(val)
321            textureData['SH Coeff'] = [False,shCoef]
322        if not SGData:
323            raise self.ImportException("No space group found in phase")
324        if not abc:
325            raise self.ImportException("No cell lengths found in phase")
326        if not angles:
327            raise self.ImportException("No cell angles found in phase")
328        if not Atoms:
329            raise self.ImportException("No atoms found in phase")
330        Phase = G2obj.SetNewPhase(Name=PhaseName,SGData=SGData,cell=abc+angles+[Volume,])
331        general = Phase['General']
332        general['Type'] = Ptype
333        if general['Type'] =='macromolecular':
334            general['AtomPtrs'] = [6,4,10,12]
335        elif general['Type'] =='magnetic':
336            general['AtomPtrs'] = [3,1,10,12]
337#            general['SGData']['SGSpin'] = SpnFlp
338#            general['MagDmin'] = MagDmin   
339        else:   #nuclear
340            general['AtomPtrs'] = [3,1,7,9]   
341        general['SH Texture'] = textureData
342        Phase['Atoms'] = Atoms
343        return Phase
344
345class JANA_ReaderClass(G2obj.ImportPhase):
346    'Routine to import Phase information from a JANA2006 file'
347    def __init__(self):
348        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
349            extensionlist=('.m50','.M50'),
350            strictExtension=True,
351            formatName = 'JANA m50',
352            longFormatName = 'JANA2006 phase import'
353            )
354    def ContentsValidator(self, filepointer):
355        '''Taking a stab a validating a .m50 file
356        (look for cell & at least one atom)
357        '''
358        for i,l in enumerate(filepointer):
359            if l.startswith('cell'):
360                break
361        else:
362            self.errors = 'no cell record found'
363            return False
364        for i,l in enumerate(filepointer):
365            if l.startswith('spgroup'):
366                return True
367        self.errors = 'no spgroup record found after cell record'
368        return False
369       
370    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
371        'Read a m50 file using :meth:`ReadJANAPhase`'
372        self.Phase = self.ReadJANAPhase(filename, ParentFrame)
373        return True
374       
375    def ReadJANAPhase(self,filename,parent=None):
376        '''Read a phase from a JANA2006 m50 & m40 files.
377        '''
378        self.errors = 'Error opening file'
379        file = open(filename, 'Ur') #contains only cell & spcgroup
380        Phase = {}
381        Title = os.path.basename(filename)
382        Type = 'nuclear'
383        Atoms = []
384        Atypes = []
385        SuperVec = [[0,0,.1],False,4]
386        S = file.readline()
387        line = 1
388        SGData = None
389        SuperSg = ''
390        cell = None
391        nqi = 0
392        version = '2000'
393        while S:
394            self.errors = 'Error reading at line '+str(line)
395            if 'title' in S and S != 'title\n':
396                Title = S.split()[1]
397            elif 'Jana2006' in S:
398                self.warnings += '\nJana2006 file detected'
399                version = '2006'
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("Ad hoc Supersymmetry centering "+S+" not allowed in GSAS-II")           
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 = G2obj.P1SGData # 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) #silent check of space group symbol
435            elif 'qi' in S[:2]:
436                if nqi:
437                    raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")           
438                vec = S.split()[1:]
439                SuperVec = [[float(vec[i]) for i in range(3)],False,4]
440                nqi += 1
441            elif 'atom' in S[:4]:
442                Atypes.append(S.split()[1])
443            S = file.readline()
444            line += 1
445        file.close()
446        #read atoms from m40 file
447        if not SGData:
448            self.warnings += '\nThe space group was not read before atoms and has been set to "P 1". '
449            self.warnings += "Change this in phase's General tab."
450            SGData = G2obj.P1SGData # P 1
451        waveTypes = ['Fourier','Sawtooth','ZigZag',]
452        filename2 = os.path.splitext(filename)[0]+'.m40'
453        file2 = open(filename2,'Ur')
454        S = file2.readline()
455        line = 1
456        self.errors = 'Error reading at line '+str(line)
457        nAtoms = int(S.split()[0])
458        for i in range(4):
459            S = file2.readline()           
460        for i in range(nAtoms):
461            S1 = file2.readline()
462            S1N = S1.split()[-3:]   # no. occ, no. pos waves, no. ADP waves
463            S1N = [int(i) for i in S1N]
464            S1T = list(S1[60:63])
465            waveType = waveTypes[int(S1T[1])]
466            Spos = []
467            Sadp = []
468            Sfrac = []
469            Smag = []
470            XYZ = [float(S1[27:36]),float(S1[36:45]),float(S1[45:54])]
471            SytSym,Mult = G2spc.SytSym(XYZ,SGData)[:2]
472            aType = Atypes[int(S1[9:11])-1]
473            Name = S1[:8].strip()
474            if S1[11:15].strip() == '1':
475                S2 = file2.readline()
476                Uiso = S2[:9]
477                if version == '2000':
478                    Uiso = R2pisq*float(Uiso)/4.      #Biso -> Uiso
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])] #Uij in Jana2006!
487                if version == '2000':
488                    Uij = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(Uij)/Mast) #these things are betaij in Jana2000! need to convert to Uij
489            for i in range(S1N[0]):
490                if not i:
491                    FS = file2.readline()
492                    Sfrac.append(FS[:9])    #'O' or 'delta' = 'length' for crenel
493                    if int(S1T[0]):  #"", "Legendre" or "Xharm" in 18:27 for "crenel"!
494                        waveType = 'Crenel/Fourier' #all waves 'Fourier' no other choice
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 ['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                vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54]),
525                    float(it[54:63]),float(it[63:72]),float(it[72:81]),float(it[81:90]),float(it[90:99]),float(it[99:108])]
526                #these are betaij modulations in Jana2000! need to convert to Uij modulations
527                if version == '2000':               
528                    vals[:6] = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(vals[:6])/Mast)    #convert sin bij to Uij
529                    vals[6:] = R2pisq*G2lat.UijtoU6(G2lat.U6toUij(vals[6:])/Mast)    #convert cos bij to Uij
530                Sadp[i] = [vals,False]
531            Atom = [Name,aType,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso]
532            Atom += Uij
533            Atom.append(ran.randint(0,sys.maxint))
534            Atom.append([])
535            Atom.append([])
536            Atom.append({'SS1':{'waveType':waveType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}})    #SS2 is for (3+2), etc.
537            Atoms.append(Atom)
538        file2.close()
539        self.errors = 'Error after read complete'
540        if not SGData:
541            raise self.ImportException("No space group (spcgroup entry) found")
542        if not cell:
543            raise self.ImportException("No cell found")
544        Phase = G2obj.SetNewPhase(Name=Title,SGData=SGData,cell=cell+[Volume,])
545        Phase['General']['Type'] = Type
546        Phase['General']['Modulated'] = True
547        Phase['General']['Super'] = nqi
548        Phase['General']['SuperVec'] = SuperVec
549        Phase['General']['SuperSg'] = SuperSg
550        if SuperSg:
551            Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
552        Phase['General']['AtomPtrs'] = [3,1,7,9]
553        Phase['Atoms'] = Atoms
554        return Phase
Note: See TracBrowser for help on using the repository browser.