Changeset 2809


Ignore:
Timestamp:
Apr 26, 2017 9:51:43 AM (7 years ago)
Author:
vondreele
Message:

add new transform option for moving atoms from setting #1 --> #2

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2797 r2809  
    173173    'abc*':np.eye(3), }
    174174commonNames = ['abc','bca','cab','a-cb','ba-c','-cba','P->A','A->P','P->B','B->P','P->C','C->P',
    175     'P->I','I->P','P->F','F->P','H->R','R->H','R->O','O->R','abc*',]
     175    'P->I','I->P','P->F','F->P','H->R','R->H','R->O','O->R','abc*','setting 1->2']          #don't put any new ones after the setting one!
    176176
    177177# Should SGMessageBox, SymOpDialog, DisAglDialog be moved?
     
    554554                self.Phase['General']['SGData'] = SGData
    555555            else:
    556                 self.Trans = commonTrans[self.Common]
    557                 if 'R' == self.Common[-1]:
    558                     self.newSpGrp += ' r'
    559                     SGErr,SGData = G2spc.SpcGroup(self.newSpGrp)
    560                     self.Phase['General']['SGData'] = SGData
    561                     SGTxt.SetValue(self.newSpGrp)
     556                if self.Common == commonNames[-1]:
     557                    self.Vec = G2spc.spg2origins[self.oldSpGrp]
     558                    self.newSpGrp = self.oldSpGrp
     559                else:
     560                    self.Trans = commonTrans[self.Common]
     561                    if 'R' == self.Common[-1]:
     562                        self.newSpGrp += ' r'
     563                        SGErr,SGData = G2spc.SpcGroup(self.newSpGrp)
     564                        self.Phase['General']['SGData'] = SGData
     565                        SGTxt.SetValue(self.newSpGrp)
    562566            OnTest(event)
    563567       
     
    622626        commonSizer = wx.BoxSizer(wx.HORIZONTAL)
    623627        commonSizer.Add(wx.StaticText(self.panel,label=' Common transformations: '),0,WACV)
    624         common = wx.ComboBox(self.panel,value=self.Common,choices=commonNames,
    625             style=wx.CB_READONLY|wx.CB_DROPDOWN)
     628        if self.oldSpGrp not in G2spc.spg2origins:
     629            common = wx.ComboBox(self.panel,value=self.Common,choices=commonNames[-1],
     630                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     631        else:
     632            common = wx.ComboBox(self.panel,value=self.Common,choices=commonNames,
     633                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    626634        common.Bind(wx.EVT_COMBOBOX,OnCommon)
    627635        commonSizer.Add(common,0,WACV)
     
    697705            self.Phase['General']['Name'] += ' %s'%(self.Common)
    698706        self.Phase['General']['Cell'][1:] = G2lat.TransformCell(self.oldCell[:6],self.Trans)           
    699         return self.Phase,self.Trans,self.Vec,self.ifMag,self.ifConstr
     707        return self.Phase,self.Trans,self.Vec,self.ifMag,self.ifConstr,self.Common
    700708
    701709    def OnOk(self,event):
     
    11441152            commonSizer = wx.BoxSizer(wx.HORIZONTAL)
    11451153            commonSizer.Add(wx.StaticText(self.panel,label=' Common transformations: '),0,WACV)
    1146             common = wx.ComboBox(self.panel,value=self.Common,choices=commonNames[:-1], #not the last one!
     1154            common = wx.ComboBox(self.panel,value=self.Common,choices=commonNames[:-2], #not the last two!
    11471155                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    11481156            common.Bind(wx.EVT_COMBOBOX,OnCommon)
  • trunk/GSASIIphsGUI.py

    r2807 r2809  
    14001400        try:
    14011401            if dlg.ShowModal() == wx.ID_OK:
    1402                 newPhase,Trans,Vec,ifMag,ifConstr = dlg.GetSelection()
     1402                newPhase,Trans,Vec,ifMag,ifConstr,Common = dlg.GetSelection()
    14031403            else:
    14041404                return
    14051405        finally:
    14061406            dlg.Destroy()
    1407         phaseName = newPhase['General']['Name']
    1408         newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans,Vec,ifMag)
    1409         detTrans = np.abs(nl.det(Trans))
    1410 
    1411         generalData = newPhase['General']
    1412         SGData = generalData['SGData']
    1413         Atoms = newPhase['Atoms']
    1414         if ifMag:
    1415             dlg = G2gd.UseMagAtomDialog(G2frame,Atoms,atCodes)
    1416             try:
    1417                 if dlg.ShowModal() == wx.ID_OK:
    1418                     newPhase['Atoms'],atCodes = dlg.GetSelection()
    1419             finally:
    1420                 dlg.Destroy()
    1421             SGData['GenSym'],SGData['GenFlg'] = G2spc.GetGenSym(SGData)
    1422             SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
    1423             SGData['OprNames'],SGData['SpnFlp'] = G2spc.GenMagOps(SGData)
    1424             generalData['Lande g'] = len(generalData['AtomTypes'])*[2.,]
    1425            
    1426         NShkl = len(G2spc.MustrainNames(SGData))
    1427         NDij = len(G2spc.HStrainNames(SGData))
    1428         UseList = newPhase['Histograms']
    1429         for hist in UseList:
    1430             UseList[hist]['Scale'] /= detTrans      #scale by 1/volume ratio
    1431             UseList[hist]['Mustrain'][4:6] = [NShkl*[0.01,],NShkl*[False,]]
    1432             UseList[hist]['HStrain'] = [NDij*[0.0,],NDij*[False,]]
    1433         newPhase['General']['Map'] = mapDefault.copy()
    1434         sub = G2frame.PatternTree.AppendItem(parent=
    1435             G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName)
    1436         G2frame.PatternTree.SetItemPyData(sub,newPhase)
    1437         newPhase['Drawing'] = []
     1407        if 'setting' in Common:         #don't make new phase, Just move atoms!
     1408            generalData = data['General']
     1409            cx,ct,cs,cia = generalData['AtomPtrs']
     1410            SGData = generalData['SGData']
    14381411       
    1439         if ifMag and ifConstr:
    1440             G2frame.GetUsedHistogramsAndPhasesfromTree()
    1441             G2cnstG.MagConstraints(G2frame,data,newPhase,Trans,Vec,atCodes)     #data is old phase
    1442         G2frame.PatternTree.SelectItem(sub)
     1412            Atoms = data['Atoms']
     1413            for atom in Atoms:
     1414                for i in range(3):
     1415                    atom[cx+i] += Vec[i]
     1416                atom[cs:cs+2] = G2spc.SytSym(atom[cx:cx+3],SGData)[:2]
     1417            data['Drawing'] = []
     1418        else:
     1419            phaseName = newPhase['General']['Name']
     1420            newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans,Vec,ifMag)
     1421            detTrans = np.abs(nl.det(Trans))
     1422   
     1423            generalData = newPhase['General']
     1424            SGData = generalData['SGData']
     1425            Atoms = newPhase['Atoms']
     1426            if ifMag:
     1427                dlg = G2gd.UseMagAtomDialog(G2frame,Atoms,atCodes)
     1428                try:
     1429                    if dlg.ShowModal() == wx.ID_OK:
     1430                        newPhase['Atoms'],atCodes = dlg.GetSelection()
     1431                finally:
     1432                    dlg.Destroy()
     1433                SGData['GenSym'],SGData['GenFlg'] = G2spc.GetGenSym(SGData)
     1434                SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
     1435                SGData['OprNames'],SGData['SpnFlp'] = G2spc.GenMagOps(SGData)
     1436                generalData['Lande g'] = len(generalData['AtomTypes'])*[2.,]
     1437               
     1438            NShkl = len(G2spc.MustrainNames(SGData))
     1439            NDij = len(G2spc.HStrainNames(SGData))
     1440            UseList = newPhase['Histograms']
     1441            for hist in UseList:
     1442                UseList[hist]['Scale'] /= detTrans      #scale by 1/volume ratio
     1443                UseList[hist]['Mustrain'][4:6] = [NShkl*[0.01,],NShkl*[False,]]
     1444                UseList[hist]['HStrain'] = [NDij*[0.0,],NDij*[False,]]
     1445            newPhase['General']['Map'] = mapDefault.copy()
     1446            sub = G2frame.PatternTree.AppendItem(parent=
     1447                G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName)
     1448            G2frame.PatternTree.SetItemPyData(sub,newPhase)
     1449            newPhase['Drawing'] = []
     1450           
     1451            if ifMag and ifConstr:
     1452                G2frame.GetUsedHistogramsAndPhasesfromTree()
     1453                G2cnstG.MagConstraints(G2frame,data,newPhase,Trans,Vec,atCodes)     #data is old phase
     1454            G2frame.PatternTree.SelectItem(sub)
    14431455       
    14441456################################################################################
  • trunk/GSASIIspc.py

    r2753 r2809  
    29442944        'F -4 3 c','F m -3 m','F m 3 m','F m -3 c','F d -3 m','F d -3 c',),
    29452945}
     2946
     2947spg2origins = {}
     2948''' A dictionary of all space groups with two alternative origin settings.
     2949each entry is symbol: atom transpation vector for setting #1 --> setting #2
     2950'''
     2951spg2origins = {"P n n n":[-.25,-.25,-.25],"P b a n":[-.25,-.25 ,0],     
     2952    "P n c b":[0,-.25,-.25],"P c n a":[-.25,0,-.25],"P m m n":[-.25,-.25 ,0],       
     2953    "P n m m":[0,-.25,-.25],"P m n m":[-.25,0,-.25],"C c c a":[0,-.25,-.25],         
     2954    "C c c b":[-.25,0,-.25],"A b a a":[-.25,0,-.25],"A c a a":[-.25,-.25,0],       
     2955    "B b c b":[-.25,-.25,0],"B b a b":[0,-.25,-.25],"F d d d":[.125,.125,.125],     
     2956    "P 4/n":[.25,-.2, 0],"P 42/n":[.25,.25,.25],"I 41/a":[0,.25,.125],         
     2957    "P 4/n b m":[.25,.25,0],"P 4/n n c":[.25,.25,.25],"P 4/n m m":[.25,-.25,0],         
     2958    "P 4/n c c":[.25,-.25,0],"P 42/n b c":[.25,-.25,.25],"P 42/n n m":[.25,-.25,.25],       
     2959    "P 42/n m c":[.25,-.25,.25],"P 42/n c m":[.25,-.25,.25],       
     2960    "I 41/a m d":[0,-.25,.125],"I 41/a c d":[0,-.25,.125],       
     2961    "P n 3":[.25,.25,.25],"F d 3":[.125,.125,.125],"P n 3 n":[.25,.25,.25],               
     2962    "P n 3 m":[.25,.25,.25],"F d 3 m":[.125,.125,.125],"F d 3 c":[.375,.375,.375],           
     2963    "P n -3":[.25,.25,.25],"F d -3":[.125,.125,.125],"P n -3 n":[.25,.25,.25],               
     2964    "P n -3 m":[.25,.25,.25],"F d -3 m":[.125,.125,.125],"F d -3 c":[.375,.375,.375]}           
    29462965
    29472966ssdict = {}
Note: See TracChangeset for help on using the changeset viewer.