Changeset 5475


Ignore:
Timestamp:
Jan 16, 2023 10:08:28 AM (11 months ago)
Author:
vondreele
Message:

spin rb changes - now define polar axis direction

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r5464 r5475  
    39043904        Size[1] = max(Size[1],450) + 20
    39053905        ResidueRB.SetSize(Size)
    3906         #ResidueRB.SetScrollbars(10,10,int(Size[0]/10-4),int(Size[1]/10-1)) # dataframe already scrolls
     3906        ResidueRB.SetScrollbars(10,10,int(Size[0]/10-4),int(Size[1]/10-1)) # dataframe already scrolls
    39073907        G2frame.dataWindow.SendSizeEvent()
    39083908       
  • trunk/GSASIIlattice.py

    r5472 r5475  
    21202120    '''
    21212121    if M <= L:
    2122         if sytsym == '23':   #cubics use different Fourier expansion than those below       
     2122        if sytsym == '53m':
     2123            if not L%2 and M > 0:
     2124                if L in [6,10,12,16,18]:
     2125                    if L%12 == 2:
     2126                        if M <= L//12: return True,1.0
     2127                    else:
     2128                        if M <= L//12+1: return True,1.0           
     2129        elif sytsym == '23':   #cubics use different Fourier expansion than those below       
    21232130            if 2 < L < 11 and [L,M] in [[3,1],[4,1],[6,1],[6,2],[7,1],[8,1],[9,1],[9,2],[10,1],[10,2]]:
    21242131                return True,1.0
     
    22322239    return False,0.
    22332240   
    2234 def RBsymChk(RBsym,cubic,coefNames):
     2241def RBsymChk(RBsym,cubic,coefNames,L=18):
    22352242    '''imposes rigid body symmetry on spherical harmonics terms
    22362243    Key problem is noncubic RB symmetries in cubic site symmetries & vice versa.
     
    22742281                        newSgns.append(sgn)
    22752282    else:
    2276         for name in coefNames:
    2277             LM = eval(name[1:])
    2278             if RBsym in ['m3m','-43m']:
    2279                 cubNames,sgns = GenShCoeff(RBsym,LM[0])
    2280                 print(name,LM[0],cubNames)
    2281                 M = []
    2282                 for cname in cubNames:
    2283                     LMc = eval(cname[1:-1])
    2284                     if (LMc[0]+LMc[1])%2:     #even L odd M or vv
    2285                         if LMc[0]%2:
    2286                             M += [4*m for m in range(LMc[0]//2)[1:] if 4*m <= LMc[0]]
    2287                         else:
    2288                             M += [4*m for m in range(LMc[0]//2) if 4*m <= LMc[0]]
    2289                     else:       #both even or both odd
    2290                         M += [4*m+2 for m in range(LMc[0]//2) if 4*m+2 <= LMc[0]]
    2291                     for m in M:
    2292                         rbChk,sgn = RBChk(RBsym,LM[0],m)
    2293                         if rbChk:
    2294                             newname = 'C(%d,%d)'%(LM[0],m)
    2295                             if newname not in newNames:
    2296                                 newNames.append(newname)
    2297                                 newSgns.append(sgn)
    2298                 print(name,cubNames,M)
    2299             else:
     2283        if RBsym in ['m3m','-43m','53m']:   #force mol. sym. here
     2284            for L in range(L+1):
     2285                cubNames,cubSgns = GenShCoeff(RBsym,L)
     2286                newNames += cubNames
     2287                newSgns += cubSgns
     2288        else:
     2289            for name in coefNames:
     2290                LM = eval(name[1:])
    23002291                rbChk,sgn = RBChk(RBsym,LM[0],LM[1])
    23012292                if rbChk:
     
    23252316    if RBsym == '1':
    23262317        return coefNames,coefSgns
    2327     newNames,newSgns = RBsymChk(RBsym,cubic,coefNames)
     2318    newNames,newSgns = RBsymChk(RBsym,cubic,coefNames,L)
    23282319    return newNames,newSgns
    23292320
     
    23322323    coefSgns = []
    23332324    cubic = False
    2334     if sytsym in ['23','m3','432','-43m','m3m']:
     2325    if sytsym in ['23','m3','432','-43m','m3m','53m']:
    23352326        cubic = True
    23362327    for n in range(L+1):
     
    23422333                coefNames.append('C(%d,%d)'%(L,n))
    23432334            coefSgns.append(sgn)
    2344     newNames,newSgns = RBsymChk(sytsym,cubic,coefNames)
     2335    newNames,newSgns = RBsymChk(sytsym,cubic,coefNames,L)
    23452336    return newNames,newSgns
    23462337
  • trunk/GSASIIphsGUI.py

    r5472 r5475  
    1133611336        wx.CallAfter(G2ddG.UpdateDData,G2frame,DData,data)
    1133711337
    11338 ##### Rigid bodies ################################################################################
     11338#### Rigid bodies ################################################################################
    1133911339    def FillRigidBodyGrid(refresh=True,vecId=None,resId=None,spnId=None):
    1134011340        '''Fill the Rigid Body Phase information tab page.
     
    1143411434                data['Atoms'] = G2lat.RBsymCheck(data['Atoms'],ct,cx,cs,AtLookUp,Amat,RBObj['Ids'],SGData)
    1143511435                data['Drawing']['Atoms'] = []
    11436                 UpdateDrawAtoms(atomStyle)
     11436                UpdateDrawAtoms()
    1143711437                G2plt.PlotStructure(G2frame,data)
    1143811438               
     
    1145811458                    data['Atoms'] = G2lat.RBsymCheck(data['Atoms'],ct,cx,cs,AtLookUp,Amat,RBObj['Ids'],SGData)
    1145911459                    data['Drawing']['Atoms'] = []
    11460                     UpdateDrawAtoms(atomStyle)
     11460                    UpdateDrawAtoms()
    1146111461                    G2plt.PlotStructure(G2frame,data)
    1146211462                except ValueError:
     
    1152411524                wx.CallAfter(FillRigidBodyGrid,True)
    1152511525               
     11526            def OnSymRadioSet(event):
     11527                '''Set the polar axis for the sp. harm. as
     11528                RBdata['Spin'][RBId]['symAxis']. This may never be
     11529                set, so use RBdata['Spin'][RBId].get('symAxis') to
     11530                access this so the default value is [0,0,1].
     11531                '''
     11532                Obj = event.GetEventObject()
     11533                axis = ([1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1])[Obj.GetSelection()]
     11534                RBObj['symAxis'] = axis
     11535                G2plt.PlotStructure(G2frame,data)
     11536               
    1152611537            def OnAddShell(event):
    1152711538                RBId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, 'Rigid bodies')
     
    1155311564                    for name in ['atColor','atType','Natoms','nSH','radius','RBname','RBsym']:
    1155411565                        data['RBModels']['Spin'][-1][name].append(rbData[name])
     11566                    G2plt.PlotStructure(G2frame,data)
    1155511567                    wx.CallAfter(FillRigidBodyGrid,True,spnId=rbId)
    1155611568               
     
    1165011662            sprbSizer.Add(topLine)
    1165111663            sprbSizer.Add(LocationSizer(RBObj,'Spin'))
     11664            choices = [' x ',' y ',' z ','x+y','x+y+z']
     11665            RBObj['symAxis'] = RBObj.get('symAxis',[0,0,1])   #set default as 'z'
     11666            symax = dict(zip([str(x) for x in [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1]]],choices))[str(RBObj['symAxis'])]
     11667            symRadioSet = wx.RadioBox(RigidBodies,choices=choices,label='Sp harm polar axis is aligned along:')
     11668            symRadioSet.SetStringSelection(symax)
     11669            symRadioSet.Bind(wx.EVT_RADIOBOX, OnSymRadioSet)
     11670            Indx[symRadioSet.GetId()] = rbId
     11671            sprbSizer.Add(symRadioSet)
    1165211672            sprbSizer.Add(SHsizer())
    1165311673            return sprbSizer
     
    1191311933            nobody = False
    1191411934            resSizer = wx.BoxSizer(wx.VERTICAL)
    11915             resSizer.Add(wx.StaticText(RigidBodies,label='Residue rigid bodies:'))
     11935            resSizer.Add(wx.StaticText(RigidBodies,label='Residue RBs:'))
    1191611936            RBnames = []
    1191711937            resVarLookup = []
     
    1194411964        if 'Vector' in data['RBModels'] and len(data['RBModels']['Vector']):
    1194511965            vecSizer = wx.BoxSizer(wx.VERTICAL)
    11946             vecSizer.Add(wx.StaticText(RigidBodies,label='Vector rigid bodies:'))
     11966            vecSizer.Add(wx.StaticText(RigidBodies,label='Vector RBs:'))
    1194711967            nobody = False
    1194811968            RBnames = []
     
    1197311993        if 'Spin' in data['RBModels'] and len(data['RBModels']['Spin']):
    1197411994            spnSizer = wx.BoxSizer(wx.VERTICAL)
    11975             spnSizer.Add(wx.StaticText(RigidBodies,label='Spinning rigid bodies:'))
     11995            spnSizer.Add(wx.StaticText(RigidBodies,label='Spinning RBs:'))
    1197611996            nobody = False
    1197711997            RBnames = []
  • trunk/GSASIIplot.py

    r5471 r5475  
    1031310313                        radius = SpnData['radius']
    1031410314                        atColor = SpnData['atColor']
    10315                         Q = G2mth.invQ(SpnData['Orient'][0])
     10315                        symAxis = np.array(SpnData.get('symAxis',[0,0,1]))
     10316                        QA = G2mth.invQ(SpnData['Orient'][0])
     10317                        QB = G2mth.make2Quat(np.array([0,0,1.]),symAxis)[0]
     10318                        Q = G2mth.prodQQ(QB,QA)
    1031610319                        Npsi,Ngam = 60,30       #seems acceptable - don't use smaller!
    1031710320                        PSI,GAM = np.mgrid[0:Npsi,0:Ngam]   #[azm,pol]
Note: See TracChangeset for help on using the changeset viewer.