Changeset 3587


Ignore:
Timestamp:
Sep 6, 2018 3:01:57 PM (5 years ago)
Author:
vondreele
Message:

further work on magnetic structures:
now proper symmetry processing of Bilbao results
add dialog message about "please cite" when k-SUBGROUPSMAG is used
clean failure (e.g. no crash) if internet not connected
modify UseMagAtomDialog? to offer "Delete" for "un keep" a mag solution

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r3586 r3587  
    422422    phase['SGData'] = G2spc.SpcGroup(SpGrp)[1]
    423423    BNSlatt = phase['SGData']['SGLatt']
     424    phase['SGData']['SGSpin'] = G2spc.GetSGSpin(phase['SGData'],result[0])
     425    phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
    424426    if result[1]:
    425427        BNSlatt += '_'+result[1]
    426         phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
    427428        phase['SGData']['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]]
    428429        G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym'])
    429     else:
    430         phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
     430    phase['SGData']['SpnFlp'] = G2spc.GenMagOps(phase['SGData'])[1]
    431431    phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData'])
    432     phase['SGData']['SpnFlp'] = G2spc.GenMagOps(phase['SGData'])[1]
    433432    return phase
    434433
  • trunk/GSASIIphsGUI.py

    r3586 r3587  
    550550    '''Get user selected magnetic atoms after cell transformation
    551551    '''
    552     def __init__(self,parent,Atoms,atCodes,atMxyz):
     552    def __init__(self,parent,Atoms,atCodes,atMxyz,ifDelete=False):
    553553        wx.Dialog.__init__(self,parent,wx.ID_ANY,'Magnetic atom selection',
    554554            pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE)
     
    557557        self.atCodes = atCodes
    558558        self.atMxyz = atMxyz
     559        self.ifDelete = ifDelete
    559560        self.Use = len(self.Atoms)*[True,]
    560561        self.Draw()
     
    590591        mainSizer.Add(atmSizer)
    591592       
    592         OkBtn = wx.Button(self.panel,-1,"Ok")
    593         OkBtn.Bind(wx.EVT_BUTTON, self.OnOk)
    594         cancelBtn = wx.Button(self.panel,-1,"Cancel")
    595         cancelBtn.Bind(wx.EVT_BUTTON, self.OnCancel)
     593        YesBtn = wx.Button(self.panel,-1,"Yes")
     594        YesBtn.Bind(wx.EVT_BUTTON, self.OnYes)
     595        NoBtn = wx.Button(self.panel,-1,"No")
     596        NoBtn.Bind(wx.EVT_BUTTON, self.OnNo)
    596597        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
    597598        btnSizer.Add((20,20),1)
    598         btnSizer.Add(OkBtn)
     599        btnSizer.Add(YesBtn)
    599600        btnSizer.Add((20,20),1)
    600         btnSizer.Add(cancelBtn)
     601        btnSizer.Add(NoBtn)
     602        if self.ifDelete:
     603            DeleteBtn = wx.Button(self.panel,-1,"Delete")
     604            DeleteBtn.Bind(wx.EVT_BUTTON, self.OnDelete)
     605            btnSizer.Add((20,20),1)
     606            btnSizer.Add(DeleteBtn)
    601607        btnSizer.Add((20,20),1)
    602608       
     
    615621        return useAtoms,useatCodes
    616622
    617     def OnOk(self,event):
     623    def OnYes(self,event):
    618624        parent = self.GetParent()
    619625        parent.Raise()
    620         self.EndModal(wx.ID_OK)
    621 
    622     def OnCancel(self,event):
     626        self.EndModal(wx.ID_YES)
     627
     628    def OnNo(self,event):
    623629        parent = self.GetParent()
    624630        parent.Raise()
    625         self.EndModal(wx.ID_CANCEL)
     631        self.EndModal(wx.ID_NO)
     632           
     633    def OnDelete(self,event):
     634        parent = self.GetParent()
     635        parent.Raise()
     636        self.EndModal(wx.ID_DELETE)
    626637           
    627638               
     
    24052416                        CSI = G2spc.GetCSpqinel(SGData['SpnFlp'],dupDir)
    24062417                        atMxyz.append(CSI[0])
    2407                     dlg = UseMagAtomDialog(G2frame,Atoms,atCodes,atMxyz)
     2418                    dlg = UseMagAtomDialog(G2frame,Atoms,atCodes,atMxyz,ifDelete=False)
    24082419                    try:
    2409                         if dlg.ShowModal() == wx.ID_OK:
     2420                        if dlg.ShowModal() == wx.ID_YES:
    24102421                            newPhase['Atoms'],atCodes = dlg.GetSelection()
    24112422                            generalData['Lande g'] = len(generalData['AtomTypes'])*[2.,]
     
    24382449        magData = G2frame.GPXtree.GetItemPyData(UnitCellsId)[5]
    24392450        magKeep = []
     2451        magIds = []
    24402452        magchoices = []
    2441         for magdata in magData:
     2453        for mid,magdata in enumerate(magData):
    24422454            if magdata['Keep']:
    24432455                trans = G2spc.Trans2Text(magdata['Trans'])
    24442456                vec = G2spc.Latt2text([magdata['Uvec'],])
    24452457                magKeep.append(magdata)
     2458                magIds.append(mid)
    24462459                magchoices.append('%s %s %s'%(magdata['Name'],trans,vec))
    24472460        if not len(magKeep):
     
    24532466            sel = dlg.GetSelection()
    24542467            magchoice = magKeep[sel]
     2468            magId = magIds[sel]
    24552469            phaseName = '%s mag_%d'%(data['General']['Name'],sel)
    24562470            newPhase = copy.deepcopy(data)
     
    24772491                AtCods.append(atCodes[ia])
    24782492                atMxyz.append(CSI[0])
    2479             dlg = UseMagAtomDialog(G2frame,Atms,AtCods,atMxyz)
     2493            dlg = UseMagAtomDialog(G2frame,Atms,AtCods,atMxyz,ifDelete=True)
    24802494            try:
    2481                 if dlg.ShowModal() == wx.ID_OK:
     2495                opt = dlg.ShowModal()
     2496                if  opt == wx.ID_YES:
    24822497                    newPhase['Atoms'],atCodes = dlg.GetSelection()
    24832498                    generalData['Lande g'] = len(generalData['AtomTypes'])*[2.,]
    2484                 else:
     2499                elif opt == wx.ID_DELETE:
     2500                    magData[magId]['Keep'] = False
     2501                    return
     2502                else:   #wx.ID_NO
    24852503                    return
    24862504            finally:
  • trunk/GSASIIpwdGUI.py

    r3586 r3587  
    34533453            magAtms = [atom for atom in controls[14] if atom[1] == atype]
    34543454            wx.BeginBusyCursor()
     3455            wx.MessageBox(''' For use of k-SUBGROUPSMAG, please cite:
     3456      Symmetry-Based Computational Tools for Magnetic Crystallography,
     3457      J.M. Perez-Mato, S.V. Gallego, E.S. Tasci, L. Elcoro, G. de la Flor, and M.I. Aroyo
     3458      Annu. Rev. Mater. Res. 2015. 45,217-48.
     3459      doi: 10.1146/annurev-matsci-070214-021008''',caption='Bilbao k-SUBGROUPSMAG',style=wx.ICON_INFORMATION)
     3460           
    34553461            MAXMAGN = kMAG.GetNonStdSubgroupsmag(SGData,kvec,star,Landau,intermed)
    34563462            wx.EndBusyCursor()
     3463            if MAXMAGN is None:
     3464                wx.MessageBox('Check your internet connection?',caption='Bilbao k-SUBGROUPSMAG error',style=wx.ICON_EXCLAMATION)
     3465                return
    34573466            for result in MAXMAGN:
    34583467                if result[0].strip().endswith("1'"):    #skip gray groups
  • trunk/GSASIIspc.py

    r3585 r3587  
    861861            SGData['SGSpin'].append(-1)
    862862    elif '_S' in BNS:
    863         SGData['SGSpin'][-1] = -1
    864         SGData['SGSpin'] += [-1,-1,-1,]
     863        SGData['SGSpin'] += [1,1,1,]
    865864        Tmat *= 2.0
    866865    else:
Note: See TracChangeset for help on using the changeset viewer.