Changeset 5062
- Timestamp:
- Nov 1, 2021 11:24:15 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIobj.py
r5041 r5062 1331 1331 import random as ran 1332 1332 import sys 1333 import os.path as ospath1333 import os.path 1334 1334 if '2' in platform.python_version_tuple()[0]: 1335 1335 import cPickle … … 1639 1639 shortname = hist[:11] + ' ('+ hId + ')' 1640 1640 ShortHistNames[hId] = shortname 1641 1642 def AddPhase2Index(rdObj,filename): 1643 '''Add a phase to the index during reading 1644 Used where constraints are generated during import (ISODISTORT CIFs) 1645 ''' 1646 ranId = rdObj.Phase['ranId'] 1647 ph = 'from '+filename # phase is not named yet 1648 if ranId in PhaseRanIdLookup: return 1649 maxph = -1 1650 for r in PhaseRanIdLookup: 1651 maxph = max(maxph,PhaseRanIdLookup[r]) 1652 PhaseRanIdLookup[ranId] = pId = str(maxph + 1) 1653 PhaseIdLookup[pId] = (ph,ranId) 1654 shortname = 'from '+ os.path.splitext((os.path.split(filename))[1])[0] 1655 while shortname in ShortPhaseNames.values(): 1656 shortname = ph[:8] + ' ('+ pId + ')' 1657 ShortPhaseNames[pId] = shortname 1658 AtomIdLookup[pId] = {} 1659 AtomRanIdLookup[pId] = {} 1660 for iatm,at in enumerate(rdObj.Phase['Atoms']): 1661 ranId = at[-1] 1662 while ranId in AtomRanIdLookup[pId]: # check for dups 1663 print ("\n\n*** Phase "+str(ph)+" atom "+str(iatm)+" has repeated ranId. Fixing.\n") 1664 at[-1] = ranId = ran.randint(0,sys.maxsize) 1665 AtomRanIdLookup[pId][ranId] = str(iatm) 1666 #if Phases[ph]['General']['Type'] == 'macromolecular': 1667 # label = '%s_%s_%s_%s'%(at[ct-1],at[ct-3],at[ct-4],at[ct-2]) 1668 #else: 1669 # label = at[ct-1] 1670 label = at[0] 1671 AtomIdLookup[pId][str(iatm)] = (label,ranId) 1641 1672 1642 1673 def LookupAtomId(pId,ranId): … … 2509 2540 ''' 2510 2541 if filename: 2511 ext = os path.splitext(filename)[1]2542 ext = os.path.splitext(filename)[1] 2512 2543 if not ext and self.strictExtension: return False 2513 2544 for ext in self.extensionlist: -
trunk/GSASIIphsGUI.py
r5061 r5062 6689 6689 topSizer = wx.BoxSizer(wx.VERTICAL) 6690 6690 bottomSizer = wx.BoxSizer(wx.VERTICAL) 6691 topSizer.Add(wx.StaticText(ISODIST,label=' ISODISTORT distortion modes for %s:'%data['General']['Name'])) 6692 topSizer.Add(wx.StaticText(ISODIST,label=''' 6693 For use of ISODISTORT, please cite: 6691 topSizer.Add(wx.StaticText(ISODIST, 6692 label=''' For use of ISODISTORT, please cite: 6694 6693 H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISODISTORT, ISOTROPY Software Suite, iso.byu.edu. 6695 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions."6696 J. Appl. Cryst. 39, 607-614 (2006).6694 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for 6695 Exploring Structural Distortions." J. Appl. Cryst. 39, 607-614 (2006). 6697 6696 ''')) 6697 topSizer.Add(wx.StaticText(ISODIST,label=' ISODISTORT distortion modes for %s\n:'%data['General']['Name'])) 6698 6698 lineSizer = wx.BoxSizer(wx.HORIZONTAL) 6699 6699 lineSizer.Add(wx.StaticText(ISODIST,label=' Adjust magnitude of distortion modes (-0.1 to +0.1): '),0,WACV) … … 6733 6733 For use of ISODISTORT, please cite: 6734 6734 H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISODISTORT, ISOTROPY Software Suite, iso.byu.edu. 6735 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions."6736 J. Appl. Cryst. 39, 607-614 (2006).6735 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for 6736 Exploring Structural Distortions." J. Appl. Cryst. 39, 607-614 (2006). 6737 6737 ''')) 6738 6738 topSizer.Add(wx.StaticText(ISODIST,label=' Subset selection if desired:')) -
trunk/GSASIIplot.py
r5052 r5062 890 890 page.canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) 891 891 892 def PlotFPAconvolutors(G2frame,NISTpk ):892 def PlotFPAconvolutors(G2frame,NISTpk,conv2T=None,convI=None,convList=None): 893 893 '''Plot the convolutions used for the current peak computed with 894 894 :func:`GSASIIfpaGUI.doFPAcalc` … … 907 907 #GSASIIpath.IPyBreak() 908 908 i = -1 909 for conv in NISTpk.convolvers: 909 if convList is None: 910 convList = NISTpk.convolvers 911 for conv in convList: 910 912 if 'smoother' in conv: continue 911 913 if 'crystallite_size' in conv: continue … … 922 924 color = refColors[i%len(refColors)] 923 925 Plot.plot(ttArr,FFT,color,label=conv[5:]) 926 if conv2T is not None and convI is not None: 927 color = refColors[(i+1)%len(refColors)] 928 Plot.plot(conv2T,convI,color,label='Convolution') 924 929 legend = Plot.legend(loc='best') 925 930 SetupLegendPick(legend,new) -
trunk/imports/G2phase_CIF.py
r5058 r5062 651 651 else: 652 652 self.errors = "Error while processing ISODISTORT constraints" 653 self.ISODISTORT_proc(blk,atomlbllist,ranIdlookup )653 self.ISODISTORT_proc(blk,atomlbllist,ranIdlookup,filename) 654 654 self.errors = "" 655 655 returnstat = True … … 667 667 return False 668 668 669 def ISODISTORT_proc(self,blk,atomlbllist,ranIdlookup ):669 def ISODISTORT_proc(self,blk,atomlbllist,ranIdlookup,filename): 670 670 '''Process ISODISTORT items to create constraints etc. 671 671 Constraints are generated from information extracted from … … 685 685 self.Constraints = [] 686 686 explaination = {} 687 G2obj.AddPhase2Index(self,filename) # put phase info into Var index 687 688 #---------------------------------------------------------------------- 688 689 # read in the ISODISTORT displacement modes … … 722 723 error = True 723 724 continue 724 else:725 anum = atomlbllist.index(albl)725 # else: 726 # anum = atomlbllist.index(albl) 726 727 var = varLookup.get(vlbl) 727 728 if not var: … … 865 866 error = True 866 867 continue 867 else:868 anum = atomlbllist.index(albl)868 # else: 869 # anum = atomlbllist.index(albl) 869 870 var = varLookup.get(vlbl) 870 871 if not var: … … 985 986 print( 70*'=') 986 987 print('\nVar2ModeMatrix' ,'IsoVarList' ) 988 def fmtConstr(i,head,l,var,k): 989 if len(head) + len(l) > 65: 990 print(head+l) 991 head = 20*' ' 992 l = '' 993 if k == 0: return 994 if k < 0 and i > 0: 995 l += ' - ' 996 k = -k 997 elif i > 0: 998 l += ' + ' 999 if k == 1: 1000 l += '%s ' % str(var) 1001 else: 1002 l += '%.3f * %s' % (k,str(var)) 1003 return head,l 987 1004 for i,row in enumerate(displacivemodeInvmatrix): 988 l = '' 1005 head = str(i) + ': ' + str(modeVarList[i]) + ' = ' 1006 line = '' 989 1007 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 990 if k == 0: continue 991 if l: l += ' + ' 992 #l += lbl+' * '+str(k) 993 l += str(G2varObj[j])+' * '+str(k) 994 print( str(i) + ': '+str(modeVarList[i])+' = '+l) 1008 head,line = fmtConstr(j,head,line,G2varObj[j],k) 1009 print(head+line) 995 1010 996 1011 # Get the ISODISTORT offset values … … 1010 1025 # compute the mode values from the reported coordinate deltas 1011 1026 for i,(row,n) in enumerate(zip(displacivemodeInvmatrix,normlist)): 1012 l = ''1013 for lbl,k in zip(coordVarLbl,row):1014 if k == 0: continue1015 if l: l += ' + '1016 l += lbl+' * '+str(k)1017 print('a'+str(i)+' = '+str(modeVarList[i])+' = ('+l+')/'+str(n))1027 line = '' 1028 head = 'a'+str(i)+': '+str(modeVarList[i])+' = (' 1029 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 1030 head,line = fmtConstr(j,head,line,lbl,k) 1031 print(head+line+') / '+('%.3f'%n)) 1032 breakpoint() 1018 1033 print('\nCalculation checks\n') 1019 1034 for i,(row,n) in enumerate(zip(displacivemodeInvmatrix,normlist)):
Note: See TracChangeset
for help on using the changeset viewer.