source: trunk/imports/G2phase_CIF.py @ 1168

Last change on this file since 1168 was 1168, checked in by toby, 10 years ago

update imports to provide error messages

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Revision URL Id
File size: 26.2 KB
Line 
1# -*- coding: utf-8 -*-
2########### SVN repository information ###################
3# $Date: 2013-12-16 16:43:01 +0000 (Mon, 16 Dec 2013) $
4# $Author: toby $
5# $Revision: 1168 $
6# $URL: trunk/imports/G2phase_CIF.py $
7# $Id: G2phase_CIF.py 1168 2013-12-16 16:43:01Z toby $
8########### SVN repository information ###################
9'''
10*Module G2phase_CIF: Coordinates from CIF*
11------------------------------------------
12
13Parses a CIF using  PyCifRW from James Hester and pulls out the
14structural information.
15
16If a CIF generated by ISODISTORT is encountered, extra information is
17added to the phase entry and constraints are generated.
18
19'''
20# Routines to import Phase information from CIF files
21import sys
22import random as ran
23import numpy as np
24import re
25import GSASIIIO as G2IO
26import GSASIIobj as G2obj
27import GSASIIspc as G2spc
28import GSASIIElem as G2elem
29import GSASIIlattice as G2lat
30import GSASIIpy3 as G2p3
31import GSASIIpath
32GSASIIpath.SetVersionNumber("$Revision: 1168 $")
33import CifFile as cif # PyCifRW from James Hester
34
35class CIFPhaseReader(G2IO.ImportPhase):
36    'Implements a phase importer from a possibly multi-block CIF file'
37    def __init__(self):
38        super(self.__class__,self).__init__( # fancy way to say ImportPhase.__init__
39            extensionlist=('.CIF','.cif','.txt'),
40            strictExtension=False,
41            formatName = 'CIF',
42            longFormatName = 'Crystallographic Information File import'
43            )
44       
45    def ContentsValidator(self, filepointer):
46        return self.CIFValidator(filepointer)
47
48    def Reader(self,filename,filepointer, ParentFrame=None, usedRanIdList=[], **unused):
49        self.isodistort_warnings = ''
50        self.Phase = G2IO.SetNewPhase(Name='new phase',SGData=G2IO.P1SGData) # create a new empty phase dict
51        # make sure the ranId is really unique!
52        while self.Phase['ranId'] in usedRanIdList:
53            self.Phase['ranId'] = ran.randint(0,sys.maxint)
54        returnstat = False
55        cellitems = (
56            '_cell_length_a','_cell_length_b','_cell_length_c',
57            '_cell_angle_alpha','_cell_angle_beta','_cell_angle_gamma',)
58        reqitems = (
59             '_atom_site_fract_x',
60             '_atom_site_fract_y',
61             '_atom_site_fract_z',
62            )
63        phasenamefields = (
64            '_chemical_name_common',
65            '_pd_phase_name',
66            '_chemical_formula_sum'
67            )
68        try:
69            self.ShowBusy() # this can take a while
70            try:
71                cf = G2IO.ReadCIF(filename)
72            except Exception as detail:
73                self.errors = "Parse or reading of file failed in pyCifRW; check syntax of file in enCIFer or CheckCIF"
74                return False
75            finally:
76                self.DoneBusy()
77            # scan blocks for structural info
78            self.errors = 'Error during scan of blocks for datasets'
79            str_blklist = []
80            for blk in cf.keys():
81                for r in reqitems+cellitems:
82                    if r not in cf[blk].keys():
83                        break
84                else:
85                    str_blklist.append(blk)
86            if not str_blklist:
87                selblk = None # no block to choose
88            elif len(str_blklist) == 1: # only one choice
89                selblk = 0
90            else:                       # choose from options
91                choice = []
92                for blknm in str_blklist:
93                    choice.append('')
94                    # accumumlate some info about this phase
95                    choice[-1] += blknm + ': '
96                    for i in phasenamefields: # get a name for the phase
97                        name = cf[blknm].get(i).strip()
98                        if name is None or name == '?' or name == '.':
99                            continue
100                        else:
101                            choice[-1] += name.strip()[:20] + ', '
102                            break
103                    na = len(cf[blknm].get("_atom_site_fract_x"))
104                    if na == 1:
105                        choice[-1] += '1 atom'
106                    else:
107                        choice[-1] += ('%d' % nd) + ' atoms'
108                    choice[-1] += ', cell: '
109                    fmt = "%.2f,"
110                    for i,key in enumerate(cellitems):
111                        if i == 3: fmt = "%.f,"
112                        if i == 5: fmt = "%.f"
113                        choice[-1] += fmt % cif.get_number_with_esd(
114                            cf[blknm].get(key))[0]
115                    sg = cf[blknm].get("_symmetry_space_group_name_H-M",'')
116                    if not sg: sg = cf[blknm].get("_space_group_name_H-M_alt",'')
117                    if sg: choice[-1] += ', (' + sg.strip() + ')'
118                selblk = self.PhaseSelector(
119                    choice,
120                    ParentFrame=ParentFrame,
121                    title= 'Select a phase from one the CIF data_ blocks below',
122                    size=(600,100)
123                    )
124            self.errors = 'Error during reading of selected block'
125            if selblk is None:
126                returnstat = False # no block selected or available
127            else:
128                blknm = str_blklist[selblk]
129                blk = cf[str_blklist[selblk]]
130                E = True
131                SpGrp = blk.get("_symmetry_space_group_name_H-M",'')
132                if not SpGrp:
133                    SpGrp = blk.get("_space_group_name_H-M_alt",'')
134                # try normalizing the space group, to see if we can pick the space group out of a table
135                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
136                if SpGrpNorm:
137                    E,SGData = G2spc.SpcGroup(SpGrpNorm)
138                # nope, try the space group "out of the Box"
139                if E and SpGrp:
140                    E,SGData = G2spc.SpcGroup(SpGrp)
141                if E:
142                    if not SpGrp:
143                        self.warnings += 'No space group name was found in the CIF.'
144                        self.warnings += '\nThe space group has been set to "P 1". '
145                        self.warnings += "Change this in phase's General tab."
146                    else:
147                        self.warnings += 'ERROR in space group symbol '+SpGrp
148                        self.warnings += '\nThe space group has been set to "P 1". '
149                        self.warnings += "Change this in phase's General tab."
150                        self.warnings += '\nAre there spaces separating axial fields?\n\nError msg: '
151                        self.warnings += G2spc.SGErrors(E)
152                    SGData = G2IO.SGData # P 1
153                self.Phase['General']['SGData'] = SGData
154                # cell parameters
155                cell = []
156                for lbl in cellitems:
157                    cell.append(cif.get_number_with_esd(blk[lbl])[0])
158                Volume = G2lat.calc_V(G2lat.cell2A(cell))
159                self.Phase['General']['Cell'] = [False,]+cell+[Volume,]
160                # read in atoms
161                self.errors = 'Error during reading of atoms'
162                atomlbllist = [] # table to look up atom IDs
163                atomloop = blk.GetLoop('_atom_site_label')
164                atomkeys = [i.lower() for i in atomloop.keys()]
165                if not blk.get('_atom_site_type_symbol'):
166                    self.isodistort_warnings += '\nlack of atom types prevents ISODISTORT processing'
167                if blk.get('_atom_site_aniso_label'):
168                    anisoloop = blk.GetLoop('_atom_site_aniso_label')
169                    anisokeys = [i.lower() for i in anisoloop.keys()]
170                else:
171                    anisoloop = None
172                    anisokeys = []
173                self.Phase['Atoms'] = []
174                G2AtomDict = {  '_atom_site_type_symbol' : 1,
175                                '_atom_site_label' : 0,
176                                '_atom_site_fract_x' : 3,
177                                '_atom_site_fract_y' : 4,
178                                '_atom_site_fract_z' : 5,
179                                '_atom_site_occupancy' : 6,
180                                '_atom_site_aniso_u_11' : 11,
181                                '_atom_site_aniso_u_22' : 12,
182                                '_atom_site_aniso_u_33' : 13,
183                                '_atom_site_aniso_u_12' : 14,
184                                '_atom_site_aniso_u_13' : 15,
185                                '_atom_site_aniso_u_23' : 16, }
186                ranIdlookup = {}
187                for aitem in atomloop:
188                    atomlist = ['','','',0,0,0,1.0,'',0,'I',0.01,0,0,0,0,0,0,0]
189                    atomlist[-1] = ran.randint(0,sys.maxint) # add a random Id
190                    while atomlist[-1] in ranIdlookup:
191                        atomlist[-1] = ran.randint(0,sys.maxint) # make it unique
192                    for val,key in zip(aitem,atomkeys):
193                        col = G2AtomDict.get(key)
194                        if col >= 3:
195                            atomlist[col] = cif.get_number_with_esd(val)[0]
196                        elif col is not None:
197                            atomlist[col] = val
198                        elif key in ('_atom_site_thermal_displace_type',
199                                   '_atom_site_adp_type'):   #Iso or Aniso?
200                            if val.lower() == 'uani':
201                                atomlist[9] = 'A'
202                        elif key == '_atom_site_u_iso_or_equiv':
203                            atomlist[10] =cif.get_number_with_esd(val)[0]
204                    if not atomlist[1] and atomlist[0]:
205                        for i in range(2,0,-1):
206                            typ = atomlist[0].strip()[:i]
207                            if G2elem.CheckElement(typ):
208                                atomlist[1] = typ
209                            if not atomlist[1]: atomlist[1] = 'Xe'
210                    ulbl = '_atom_site_aniso_label'
211                    if  atomlist[9] == 'A' and atomlist[0] in blk.get(ulbl):
212                        for val,key in zip(anisoloop.GetKeyedPacket(ulbl,atomlist[0]),
213                                           anisokeys):
214                            col = G2AtomDict.get(key)
215                            if col:
216                                atomlist[col] = cif.get_number_with_esd(val)[0]
217                    atomlist[7],atomlist[8] = G2spc.SytSym(atomlist[3:6],SGData)
218                    atomlist[1] = G2elem.FixValence(atomlist[1])
219                    self.Phase['Atoms'].append(atomlist)
220                    ranIdlookup[atomlist[0]] = atomlist[-1]
221                    if atomlist[0] in atomlbllist:
222                        self.warnings += ' ERROR: repeated atom label: '+atomlist[0]
223                    else:
224                        atomlbllist.append(atomlist[0])
225                if len(atomlbllist) != len(self.Phase['Atoms']):
226                    self.isodistort_warnings += '\nRepeated atom labels prevents ISODISTORT decode'
227                for lbl in phasenamefields: # get a name for the phase
228                    name = blk.get(lbl)
229                    if name is None:
230                        continue
231                    name = name.strip()
232                    if name == '?' or name == '.':
233                        continue
234                    else:
235                        break
236                else: # no name found, use block name for lack of a better choice
237                    name = blknm
238                self.Phase['General']['Name'] = name.strip()[:20]
239                if not self.isodistort_warnings:
240                    if blk.get('_iso_displacivemode_label') or blk.get('_iso_occupancymode_label'):
241                        self.errors = "Error while processing ISODISTORT constraints"
242                        self.ISODISTORT_proc(blk,atomlbllist,ranIdlookup)
243                else:
244                    self.warnings += self.isodistort_warnings
245                returnstat = True
246        except Exception as detail:
247            self.errors += '\n  '+str(detail)
248            print 'CIF error:',detail # for testing
249            print sys.exc_info()[0] # for testing
250            import traceback
251            print traceback.format_exc()
252            returnstat = False
253        return returnstat
254
255    def ISODISTORT_proc(self,blk,atomlbllist,ranIdlookup):
256        'Process ISODISTORT items to create constraints etc.'
257        varLookup = {'dx':'dAx','dy':'dAy','dz':'dAz','do':'Afrac'}
258        'Maps ISODISTORT parm names to GSAS-II names'
259        #----------------------------------------------------------------------
260        # read in the ISODISTORT displacement modes
261        #----------------------------------------------------------------------
262        self.Constraints = []
263        explaination = {}
264        if blk.get('_iso_displacivemode_label'):
265            modelist = []
266            shortmodelist = []
267            for lbl in blk.get('_iso_displacivemode_label'):
268                modelist.append(lbl)
269                # assume lbl is of form SSSSS[x,y,z]AAAA(a,b,...)BBBBB
270                # where SSSSS is the parent spacegroup, [x,y,z] is a location
271                regexp = re.match(r'.*?\[.*?\](.*?)\(.*?\)(.*)',lbl)
272                # this extracts the AAAAA and BBBBB parts of the string
273                if regexp:
274                    lbl = regexp.expand(r'\1\2') # parse succeeded, make a short version
275                G2obj.MakeUniqueLabel(lbl,shortmodelist) # make unique and add to list
276            # read in the coordinate offset variables names and map them to G2 names/objects
277            coordVarLbl = []
278            G2varLbl = []
279            G2varObj = []
280            error = False
281            for lbl in blk.get('_iso_deltacoordinate_label'):
282                coordVarLbl.append(lbl)
283                if '_' in lbl:
284                    albl = lbl[:lbl.rfind('_')]
285                    vlbl = lbl[lbl.rfind('_')+1:]
286                else:
287                    self.warnings += ' ERROR: _iso_deltacoordinate_label not parsed: '+lbl
288                    error = True
289                    continue
290                if albl not in atomlbllist:
291                    self.warnings += ' ERROR: _iso_deltacoordinate_label atom not found: '+lbl
292                    error = True
293                    continue
294                else:
295                    anum = atomlbllist.index(albl)
296                var = varLookup.get(vlbl)
297                if not var:
298                    self.warnings += ' ERROR: _iso_deltacoordinate_label variable not found: '+lbl
299                    error = True
300                    continue
301                G2varLbl.append('::'+var+':'+str(anum)) # variable name, less phase ID
302                G2varObj.append(G2obj.G2VarObj(
303                    (self.Phase['ranId'],None,var,ranIdlookup[albl])
304                    ))
305            if error:
306                raise Exception,"Error decoding variable labels"
307
308            if len(G2varObj) != len(modelist):
309                print "non-square input"
310                raise Exception,"Rank of _iso_displacivemode != _iso_deltacoordinate"
311
312            error = False
313            ParentCoordinates = {}
314            for lbl,exp in zip(
315                blk.get('_iso_coordinate_label'),
316                blk.get('_iso_coordinate_formula'),
317                ):
318                if '_' in lbl:
319                    albl = lbl[:lbl.rfind('_')]
320                    vlbl = lbl[lbl.rfind('_')+1:]
321                else:
322                    self.warnings += ' ERROR: _iso_coordinate_label not parsed: '+lbl
323                    error = True
324                    continue
325                if vlbl not in 'xyz' or len(vlbl) != 1:
326                    self.warnings += ' ERROR: _iso_coordinate_label coordinate not parsed: '+lbl
327                    error = True
328                    continue
329                i = 'xyz'.index(vlbl)
330                if not ParentCoordinates.get(albl):
331                    ParentCoordinates[albl] = [None,None,None]
332                if '+' in exp:
333                    val = exp.split('+')[0].strip()
334                    val = G2p3.FormulaEval(val)
335                    if val is None:
336                        self.warnings += ' ERROR: _iso_coordinate_formula coordinate not interpreted: '+lbl
337                        error = True
338                        continue
339                    ParentCoordinates[albl][i] = val
340                else:
341                    ParentCoordinates[albl][i] = G2p3.FormulaEval(exp)
342            if error:
343                print self.warnings
344                raise Exception,"Error decoding variable labels"
345            # get mapping of modes to atomic coordinate displacements
346            displacivemodematrix = np.zeros((len(G2varObj),len(G2varObj)))
347            for row,col,val in zip(
348                blk.get('_iso_displacivemodematrix_row'),
349                blk.get('_iso_displacivemodematrix_col'),
350                blk.get('_iso_displacivemodematrix_value'),):
351                displacivemodematrix[int(row)-1,int(col)-1] = float(val)
352            # Invert to get mapping of atom displacements to modes
353            displacivemodeInvmatrix = np.linalg.inv(displacivemodematrix)
354            # create the constraints
355            for i,row in enumerate(displacivemodeInvmatrix):
356                constraint = []
357                for j,(lbl,k) in enumerate(zip(coordVarLbl,row)):
358                    if k == 0: continue
359                    constraint.append([k,G2varObj[j]])
360                constraint += [shortmodelist[i],False,'f']
361                self.Constraints.append(constraint)
362            #----------------------------------------------------------------------
363            # save the ISODISTORT info for "mode analysis"
364            if 'ISODISTORT' not in self.Phase: self.Phase['ISODISTORT'] = {}
365            self.Phase['ISODISTORT'].update({
366                'IsoModeList' : modelist,
367                'G2ModeList' : shortmodelist,
368                'IsoVarList' : coordVarLbl,
369                'G2VarList' : G2varObj,
370                'ParentStructure' : ParentCoordinates,
371                'Var2ModeMatrix' : displacivemodeInvmatrix,
372                'Mode2VarMatrix' : displacivemodematrix,
373                })
374            # make explaination dictionary
375            for mode,shortmode in zip(modelist,shortmodelist):
376                explaination[shortmode] = "ISODISTORT full name "+str(mode)
377        #----------------------------------------------------------------------
378        # now read in the ISODISTORT occupancy modes
379        #----------------------------------------------------------------------
380        if blk.get('_iso_occupancymode_label'):
381            modelist = []
382            shortmodelist = []
383            for lbl in blk.get('_iso_occupancymode_label'):
384                modelist.append(lbl)
385                # assume lbl is of form SSSSS[x,y,z]AAAA(a,b,...)BBBBB
386                # where SSSSS is the parent spacegroup, [x,y,z] is a location
387                regexp = re.match(r'.*?\[.*?\](.*?)\(.*?\)(.*)',lbl)
388                # this extracts the AAAAA and BBBBB parts of the string
389                if regexp:
390                    lbl = regexp.expand(r'\1\2') # parse succeeded, make a short version
391                lbl = lbl.replace('order','o')
392                G2obj.MakeUniqueLabel(lbl,shortmodelist) # make unique and add to list
393            # read in the coordinate offset variables names and map them to G2 names/objects
394            occVarLbl = []
395            G2varLbl = []
396            G2varObj = []
397            error = False
398            for lbl in blk.get('_iso_deltaoccupancy_label'):
399                occVarLbl.append(lbl)
400                if '_' in lbl:
401                    albl = lbl[:lbl.rfind('_')]
402                    vlbl = lbl[lbl.rfind('_')+1:]
403                else:
404                    self.warnings += ' ERROR: _iso_deltaoccupancy_label not parsed: '+lbl
405                    error = True
406                    continue
407                if albl not in atomlbllist:
408                    self.warnings += ' ERROR: _iso_deltaoccupancy_label atom not found: '+lbl
409                    error = True
410                    continue
411                else:
412                    anum = atomlbllist.index(albl)
413                var = varLookup.get(vlbl)
414                if not var:
415                    self.warnings += ' ERROR: _iso_deltaoccupancy_label variable not found: '+lbl
416                    error = True
417                    continue
418                G2varLbl.append('::'+var+':'+str(anum)) # variable name, less phase ID
419                G2varObj.append(G2obj.G2VarObj(
420                    (self.Phase['ranId'],None,var,ranIdlookup[albl])
421                    ))
422            if error:
423                raise Exception,"Error decoding variable labels"
424
425            if len(G2varObj) != len(modelist):
426                print "non-square input"
427                raise Exception,"Rank of _iso_occupancymode != _iso_deltaoccupancy"
428
429            error = False
430            ParentCoordinates = {}
431            for lbl,exp in zip(
432                blk.get('_iso_occupancy_label'),
433                blk.get('_iso_occupancy_formula'),
434                ):
435                if '_' in lbl:
436                    albl = lbl[:lbl.rfind('_')]
437                    vlbl = lbl[lbl.rfind('_')+1:]
438                else:
439                    self.warnings += ' ERROR: _iso_occupancy_label not parsed: '+lbl
440                    error = True
441                    continue
442                if vlbl != 'occ':
443                    self.warnings += ' ERROR: _iso_occupancy_label coordinate not parsed: '+lbl
444                    error = True
445                    continue
446                if '+' in exp:
447                    val = exp.split('+')[0].strip()
448                    val = G2p3.FormulaEval(val)
449                    if val is None:
450                        self.warnings += ' ERROR: _iso_occupancy_formula coordinate not interpreted: '+lbl
451                        error = True
452                        continue
453                    ParentCoordinates[albl] = val
454            if error:
455                raise Exception,"Error decoding occupancy labels"
456            # get mapping of modes to atomic coordinate displacements
457            occupancymodematrix = np.zeros((len(G2varObj),len(G2varObj)))
458            for row,col,val in zip(
459                blk.get('_iso_occupancymodematrix_row'),
460                blk.get('_iso_occupancymodematrix_col'),
461                blk.get('_iso_occupancymodematrix_value'),):
462                occupancymodematrix[int(row)-1,int(col)-1] = float(val)
463            # Invert to get mapping of atom displacements to modes
464            occupancymodeInvmatrix = np.linalg.inv(occupancymodematrix)
465            # create the constraints
466            for i,row in enumerate(occupancymodeInvmatrix):
467                constraint = []
468                for j,(lbl,k) in enumerate(zip(occVarLbl,row)):
469                    if k == 0: continue
470                    constraint.append([k,G2varObj[j]])
471                constraint += [shortmodelist[i],False,'f']
472                self.Constraints.append(constraint)
473            #----------------------------------------------------------------------
474            # save the ISODISTORT info for "mode analysis"
475            if 'ISODISTORT' not in self.Phase: self.Phase['ISODISTORT'] = {}
476            self.Phase['ISODISTORT'].update({
477                'OccModeList' : modelist,
478                'G2OccModeList' : shortmodelist,
479                'OccVarList' : occVarLbl,
480                'G2OccVarList' : G2varObj,
481                'BaseOcc' : ParentCoordinates,
482                'Var2OccMatrix' : occupancymodeInvmatrix,
483                'Occ2VarMatrix' : occupancymodematrix,
484                })
485            # make explaination dictionary
486            for mode,shortmode in zip(modelist,shortmodelist):
487                explaination[shortmode] = "ISODISTORT full name "+str(mode)
488        #----------------------------------------------------------------------
489        # done with read
490        #----------------------------------------------------------------------
491        if explaination: self.Constraints.append(explaination)
492
493        # # debug: show the mode var to mode relations
494        # for i,row in enumerate(displacivemodeInvmatrix):
495        #     l = ''
496        #     for j,(lbl,k) in enumerate(zip(coordVarLbl,row)):
497        #         if k == 0: continue
498        #         if l: l += ' + '
499        #         #l += lbl+' * '+str(k)
500        #         l += G2varLbl[j]+' * '+str(k)
501        #     print str(i) + ': '+shortmodelist[i]+' = '+l
502        # print 70*'='
503
504        # # debug: Get the ISODISTORT offset values
505        # coordVarDelta = {}
506        # for lbl,val in zip(
507        #     blk.get('_iso_deltacoordinate_label'),
508        #     blk.get('_iso_deltacoordinate_value'),):
509        #     coordVarDelta[lbl] = float(val)
510        # modeVarDelta = {}
511        # for lbl,val in zip(
512        #     blk.get('_iso_displacivemode_label'),
513        #     blk.get('_iso_displacivemode_value'),):
514        #     modeVarDelta[lbl] = cif.get_number_with_esd(val)[0]
515
516        # print 70*'='
517        # # compute the mode values from the reported coordinate deltas
518        # for i,row in enumerate(displacivemodeInvmatrix):
519        #     l = ''
520        #     sl = ''
521        #     s = 0.
522        #     for lbl,k in zip(coordVarLbl,row):
523        #         if k == 0: continue
524        #         if l: l += ' + '
525        #         l += lbl+' * '+str(k)
526        #         if sl: sl += ' + '
527        #         sl += str(coordVarDelta[lbl])+' * '+str(k)
528        #         s += coordVarDelta[lbl] * k
529        #     print 'a'+str(i)+' = '+l
530        #     print '\t= '+sl
531        #     print  modelist[i],shortmodelist[i],modeVarDelta[modelist[i]],s
532        #     print
533
534        # print 70*'='
535        # # compute the coordinate displacements from the reported mode values
536        # for i,lbl,row in zip(range(len(coordVarLbl)),coordVarLbl,displacivemodematrix):
537        #     l = ''
538        #     sl = ''
539        #     s = 0.0
540        #     for j,k in enumerate(row):
541        #         if k == 0: continue
542        #         if l: l += ' + '
543        #         l += 'a'+str(j+1)+' * '+str(k)
544        #         if sl: sl += ' + '
545        #         sl += str(shortmodelist[j]) +' = '+ str(modeVarDelta[modelist[j]]) + ' * '+str(k)
546        #         s += modeVarDelta[modelist[j]] * k
547        #     print lbl+' = '+l
548        #     print '\t= '+sl
549        #     print lbl,G2varLbl[i],coordVarDelta[lbl],s
550        #     print
551
552        # determine the coordinate delta values from deviations from the parent structure
553        # for atmline in self.Phase['Atoms']:
554        #     lbl = atmline[0]
555        #     x,y,z = atmline[3:6]
556        #     if lbl not in ParentCoordinates:
557        #         print lbl,x,y,z
558        #         continue
559        #     px,py,pz = ParentCoordinates[lbl]
560        #     print lbl,x,y,z,x-px,y-py,z-pz
Note: See TracBrowser for help on using the repository browser.