Changeset 1625


Ignore:
Timestamp:
Jan 8, 2015 4:24:32 PM (8 years ago)
Author:
vondreele
Message:

add a parameter to result from G2stIO.GetPhaseData?
add modulation functions to G2Math
add modulation names to G2obj
implement various wave types for modulations
plot position modulation wave function on contour plots
implement shift of modulation plot by +/-/0 keys
temporarily default G2spc.GetSSfxuinel to 1,-1 site symm.
move maxSSwave dict out of parmDict - now in controlDict
implement import of Sawtooth parms from J2K files.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1621 r1625  
    33733373        rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False)
    33743374        rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
    3375         Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable = G2stIO.GetPhaseData(Phases,RestraintDict=None,rbIds=rbIds,Print=False)       
     3375        Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable,maxSSwave = G2stIO.GetPhaseData(Phases,RestraintDict=None,rbIds=rbIds,Print=False)       
    33763376        hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,Histograms,Print=False)
    33773377        histVary,histDict,controlDict = G2stIO.GetHistogramData(Histograms,Print=False)
  • trunk/GSASIIIO.py

    r1619 r1625  
    20572057        self.parmDict.update(rbDict)
    20582058        rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
    2059         Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables =  G2stIO.GetPhaseData(
     2059        Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,maxSSwave =  G2stIO.GetPhaseData(
    20602060            Phases,RestraintDict=None,rbIds=rbIds,Print=False)
    20612061        self.parmDict.update(phaseDict)
  • trunk/GSASIIconstrGUI.py

    r1619 r1625  
    235235
    236236    # create a list of the phase variables
    237     Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable = G2stIO.GetPhaseData(Phases,rbIds=rbIds,Print=False)
     237    Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable,maxSSwave = G2stIO.GetPhaseData(Phases,rbIds=rbIds,Print=False)
    238238    phaseList = []
    239239    for item in phaseDict:
  • trunk/GSASIImath.py

    r1622 r1625  
    4242atand = lambda x: 180.*np.arctan(x)/np.pi
    4343atan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi
     44   
     45################################################################################
     46##### Hessian least-squares Levenberg-Marquardt routine
     47################################################################################
    4448
    4549def HessianLSQ(func,x0,Hess,args=(),ftol=1.49012e-8,xtol=1.49012e-8, maxcyc=0,Print=False):
     
    194198#                    vcov[i1][i2] = 0.0
    195199    return vcov
     200   
     201################################################################################
     202##### Atom manipulations
     203################################################################################
    196204
    197205def FindAtomIndexByIDs(atomData,IDs,Draw=True):
     
    697705    return Xanom
    698706   
     707def posFourier(tau,psin,pcos):
     708    A = np.array([ps[:,np.newaxis]*np.sin(2*np.pi*(i+1)*tau) for i,ps in enumerate(psin)])
     709    B = np.array([pc[:,np.newaxis]*np.cos(2*np.pi*(i+1)*tau) for i,pc in enumerate(pcos)])
     710    return np.sum(A,axis=0)+np.sum(B,axis=0)
     711   
     712def posSawtooth(tau,Toff,slopes):
     713    Tau = (tau-Toff)%1.
     714    A = slopes[:,np.newaxis]*Tau
     715    return A
     716
     717def posZigZag(tau,Toff,slopes):
     718    Tau = (tau-Toff)%1.
     719    A = np.where(Tau <= 0.5,slopes[:,np.newaxis]*Tau,slopes[:,np.newaxis]*(1.-Tau))
     720    return A
     721   
     722def fracCrenel(tau,Toff,Twid):
     723    Tau = (tau-Toff)%1.
     724    A = np.where(Tau<Twid,1.,0.)
     725    return A
     726   
     727def fracFourier(tau,fsin,fcos):
     728    A = np.array([fs[:,np.newaxis]*np.sin(2.*np.pi*(i+1)*tau) for i,fs in enumerate(fsin)])
     729    B = np.array([fc[:,np.newaxis]*np.cos(2.*np.pi*(i+1)*tau) for i,fc in enumerate(fcos)])
     730    return np.sum(A,axis=0)+np.sum(B,axis=0)
    699731   
    700732################################################################################
    701 ##### distance, angle, planes, torsion stuff stuff
     733##### distance, angle, planes, torsion stuff
    702734################################################################################
    703735
  • trunk/GSASIIobj.py

    r1614 r1625  
    12961296        # supersymmetry parameters  p::<var>:a:o 'Flen','Fcent'?
    12971297        'mV([0-2])$' : 'Modulation vector component \\1',
    1298         'Fsin$'  :   'Sin site fraction modulation',
    1299         'Fcos$'  :   'Cos site fraction modulation',
     1298        'Fsin'  :   'Sin site fraction modulation',
     1299        'Fcos'  :   'Cos site fraction modulation',
     1300        'Fzero'  :   'Crenel function offset',
     1301        'Fwid'   :   'Crenel function width',
     1302        'Tzero'  :   'Sawtooth/ZigZag location',
     1303        '([XYZ])slope': 'Sawtooth/ZigZag slope for \\1',
    13001304        '([XYZ])sin'  : 'Sin position wave for \\1',
    13011305        '([XYZ])cos'  : 'Cos position wave for \\1',
  • trunk/GSASIIphsGUI.py

    r1623 r1625  
    20052005    def UpdateWavesData():
    20062006       
     2007        generalData = data['General']
     2008        cx,ct,cs,cia = generalData['AtomPtrs']
     2009       
    20072010        def AtomSizer(SS,atom):
    20082011           
    20092012            def OnWaveType(event):
    20102013                atom[-1][SS]['waveType']=waveType.GetValue()
     2014                atom[-1][SS]['Spos'] = []
     2015                UpdateWavesData()               
    20112016               
    20122017            def OnShowWave(event):
     
    20172022               
    20182023            atomSizer = wx.BoxSizer(wx.HORIZONTAL)
    2019             atomSizer.Add(wx.StaticText(waveData,label=' Modulation data for atom:    '+atom[0]+'    WaveType: '),0,WACV)           
     2024            atomSizer.Add(wx.StaticText(waveData,label=
     2025            ' Modulation data for atom: %s  Site sym: %s  WaveType: '%(atom[0],atom[cs].strip())),0,WACV)           
    20202026            waveType = wx.ComboBox(waveData,value=atom[-1][SS]['waveType'],choices=waveTypes,
    20212027                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     
    20322038            return atomSizer
    20332039           
    2034         def WaveSizer(waveBlk,Stype,typeName,Names,waveCSI):
     2040        def WaveSizer(waveType,waveBlk,Stype,typeName,Names):
    20352041           
    20362042            def OnAddWave(event):
    20372043                Obj = event.GetEventObject()
    20382044                iatm,item = Indx[Obj.GetId()]
    2039                 atomData[iatm][-1][SS][item].append([[0.0 for i in range(numVals[Stype])],False])
     2045                nt = numVals[Stype]
     2046                if not len(atomData[iatm][-1][SS][item]) and waveType in ['ZigZag','Sawtooth'] and Stype == 'Spos':
     2047                    nt = 4
     2048                atomData[iatm][-1][SS][item].append([[0.0 for i in range(nt)],False])
    20402049                UpdateWavesData()
    20412050               
     
    20702079            waveSizer.Add(waveHead)
    20712080            if len(waveBlk):
    2072                 waveSizer.Add(wx.StaticText(waveData,label=' Parameters: '+str(Names).rstrip(']').lstrip('[').replace("'",'')),0,WACV)
    2073                 if Stype == 'Sfrac':
    2074                     Waves = wx.FlexGridSizer(1,4,5,5)
    2075                 else:
    2076                     Waves = wx.FlexGridSizer(1,8,5,5)
     2081                CSI = G2spc.GetSSfxuinel(xyz,uij,SGData,SSGData)
    20772082                for iwave,wave in enumerate(waveBlk):
     2083                    waveName = 'Fourier'
     2084                    if Stype == 'Sfrac':
     2085                        if 'Crenel' in waveType and not iwave:
     2086                            waveName = 'Crenel'
     2087                            names = Names[2:]
     2088                        else:
     2089                            names = Names[:2]
     2090                        Waves = wx.FlexGridSizer(1,4,5,5)
     2091                    elif Stype == 'Spos':
     2092                        if waveType in ['ZigZag','Sawtooth'] and not iwave:
     2093                            names = Names[6:]
     2094                            Waves = wx.FlexGridSizer(1,6,5,5)
     2095                            waveName = waveType
     2096                        else:
     2097                            names = Names[:6]
     2098                            Waves = wx.FlexGridSizer(1,8,5,5)
     2099                    else:
     2100                        names = Names
     2101                        Waves = wx.FlexGridSizer(1,8,5,5)
     2102                    waveSizer.Add(wx.StaticText(waveData,label=' %s  parameters: %s'%(waveName,str(names).rstrip(']').lstrip('[').replace("'",''))),0,WACV)
    20782103                    for ival,val in enumerate(wave[0]):
    2079                         if waveCSI[0][ival] == 0:
     2104                        if CSI[Stype][0][ival] == 0:
    20802105                            waveVal = wx.TextCtrl(waveData,value='%.4f'%(val),style=wx.TE_READONLY)
    20812106                            waveVal.SetBackgroundColour(VERY_LIGHT_GREY)
     
    20942119                    waveRef.Bind(wx.EVT_CHECKBOX, OnRefWave)
    20952120                    Waves.Add(waveRef,0,WACV)
    2096                     waveDel = wx.CheckBox(waveData,label='Delete?')
    2097                     Indx[waveDel.GetId()] = [iatm,Stype,iwave]
    2098                     waveDel.Bind(wx.EVT_CHECKBOX, OnDelWave)
    2099                     Waves.Add(waveDel,0,WACV)               
    2100                 waveSizer.Add(Waves)                   
     2121                    if iwave < len(waveBlk)-1:
     2122                        Waves.Add((5,5),0)               
     2123                    else:
     2124                        waveDel = wx.CheckBox(waveData,label='Delete?')
     2125                        Indx[waveDel.GetId()] = [iatm,Stype,iwave]
     2126                        waveDel.Bind(wx.EVT_CHECKBOX, OnDelWave)
     2127                        Waves.Add(waveDel,0,WACV)
     2128                    waveSizer.Add(Waves)                   
    21012129            return waveSizer
    21022130           
     
    21392167        typeNames = {'Sfrac':' Site fraction','Spos':' Position','Sadp':' Thermal motion','Smag':' Magnetic moment'}
    21402168        numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6}
    2141         posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos']
     2169        posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','Tzero','Xslope','Yslope','Zslope']
    21422170        adpNames = ['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin',
    21432171            'U11cos','U22cos','U33cos','U12cos','U13cos','U23cos']
    21442172        magNames = ['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos']
    2145         fracNames = ['Flen','Fcent','Fsin','Fcos']
     2173        fracNames = ['Fsin','Fcos','Fzero','Fwid']
    21462174        waveTypes = ['Fourier','Sawtooth','ZigZag','Crenel/Fourier']
    21472175        Labels = {'Spos':posNames,'Sfrac':fracNames,'Sadp':adpNames,'Smag':magNames}
     
    21522180                xyz = atom[cx:cx+3]
    21532181                uij = atom[cia+2:cia+8]
    2154                 CSI = G2spc.GetSSfxuinel(xyz,uij,SGData,SSGData)
    21552182                for SS in ['SS1',]:  #future SS2 & SS3 - I doubt it!
    21562183                    G2gd.HorizontalLine(mainSizer,waveData)
     
    21612188                        if generalData['Type'] != 'magnetic' and Stype == 'Smag':
    21622189                            break
    2163                         mainSizer.Add(WaveSizer(atom[-1][SS][Stype],Stype,typeNames[Stype],Labels[Stype],CSI[Stype]))
     2190                        mainSizer.Add(WaveSizer(atom[-1][SS]['waveType'],atom[-1][SS][Stype],Stype,typeNames[Stype],Labels[Stype]))
    21642191                       
    21652192        SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer)
     
    57865813        G2frame.dataFrame.Bind(wx.EVT_MENU, OnIsoDistortCalc, id=G2gd.wxID_ISODISP)
    57875814        for id in G2frame.dataFrame.ReImportMenuId:     #loop over submenu items
    5788             G2frame.dataFrame.Bind(wx.EVT_MENU, OnReImport, id=id)               
     5815            G2frame.dataFrame.Bind(wx.EVT_MENU, OnReImport, id=id)
    57895816        # Wave Data
    57905817        if data['General']['Type'] in ['modulated','magnetic']:
  • trunk/GSASIIplot.py

    r1623 r1625  
    6262npatand = lambda x: 180.*np.arctan(x)/np.pi
    6363npatan2d = lambda x,y: 180.*np.arctan2(x,y)/np.pi
     64GkDelta = unichr(0x0394)
    6465   
    6566class G2PlotMpl(wx.Panel):   
     
    27712772
    27722773################################################################################
    2773 ##### Modulation Plot
     2774##### Plot Modulation
    27742775################################################################################
    27752776
    2776 def ModulationPlot(G2frame,data,atom,Ax):
     2777def ModulationPlot(G2frame,data,atom,ax,off=0):
     2778    global Off,Atom,Ax
     2779    Off = off
     2780    Atom = atom
     2781    Ax = ax
     2782    def OnMotion(event):
     2783        xpos = event.xdata
     2784        if xpos:                                        #avoid out of frame mouse position
     2785            ypos = event.ydata
     2786            Page.canvas.SetCursor(wx.CROSS_CURSOR)
     2787            try:
     2788                G2frame.G2plotNB.status.SetStatusText('t =%9.3f %s =%9.3f'%(xpos,GkDelta+Ax,ypos),1)                   
     2789            except TypeError:
     2790                G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1)
    27772791   
     2792    def OnPlotKeyPress(event):
     2793        global Off,Atom,Ax
     2794        newPlot = False       
     2795        if event.key == '0':
     2796            Off = 0
     2797        elif event.key == '+':
     2798            Off += 1
     2799        elif event.key == '-':
     2800            Off -= 1
     2801        wx.CallAfter(ModulationPlot,G2frame,data,Atom,Ax,Off)
     2802
    27782803    try:
    27792804        plotNum = G2frame.G2plotNB.plotList.index('Modulation')
     
    27872812        plotNum = G2frame.G2plotNB.plotList.index('Modulation')
    27882813        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
    2789 #        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    2790 
     2814        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     2815        Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)
     2816       
     2817    Page.Choice = ['+: shift up','-: shift down','0: reset']
     2818    Page.keyPress = OnPlotKeyPress
     2819    Page.SetFocus()
    27912820    General = data['General']
    27922821    cx,ct,cs,cia = General['AtomPtrs']
     
    27952824    rhoSize = np.array(Map['rho'].shape)
    27962825    atxyz = np.array(atom[cx:cx+3])
     2826    waveType = atom[-1]['SS1']['waveType']
     2827    Spos = atom[-1]['SS1']['Spos']
     2828    tau = np.linspace(0.,2.,101)
     2829    wave = np.zeros((3,101))
     2830    if len(Spos):
     2831        scof = []
     2832        ccof = []
     2833        for i,spos in enumerate(Spos):
     2834            if waveType in ['Sawtooth','ZigZag'] and not i:
     2835                Toff = spos[0][0]
     2836                slopes = np.array(spos[0][1:])
     2837                if waveType == 'Sawtooth':
     2838                    wave = G2mth.posSawtooth(tau,Toff,slopes)
     2839                elif waveType == 'ZigZag':
     2840                    wave = G2mth.posZigZag(tau,Toff,slopes)
     2841            else:
     2842                scof.append(spos[0][:3])
     2843                ccof.append(spos[0][3:])
     2844        wave += G2mth.posFourier(tau,np.array(scof),np.array(ccof))
    27972845    Title = MapType+' modulation map for atom '+atom[0]+    \
    27982846        ' at %.4f %.4f %.4f'%(atxyz[0],atxyz[1],atxyz[2])
     
    28052853    if Ax == 'x':
    28062854        slab = np.sum(np.sum(rho[:,ix[1]-ib:ix[1]+ib,ix[2]-ib:ix[2]+ib,:],axis=2),axis=1)
     2855        Plot.plot(wave[0],tau)
    28072856    elif Ax == 'y':
    28082857        slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,:,ix[2]-ib:ix[2]+ib,:],axis=2),axis=0)
     2858        Plot.plot(wave[1],tau)
    28092859    elif Ax == 'z':
    28102860        slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,ix[1]-ib:ix[1]+ib,:,:],axis=1),axis=0)
     2861        Plot.plot(wave[2],tau)
    28112862    Plot.set_title(Title)
    28122863    Plot.set_xlabel('t')
    28132864    Plot.set_ylabel(r'$\mathsf{\Delta}$%s'%(Ax))
    2814     Slab = np.concatenate((slab,slab),axis=1)
    2815     Plot.contour(Slab,20,extent=(0.,2.,-.5,.5))
     2865    Slab = np.concatenate((slab,slab),axis=1).T
     2866    Plot.contour(Slab,20,extent=(-.5+Off*.005,.5+Off*.005,0.,2.))
     2867   
    28162868    Page.canvas.draw()
    2817     
     2869   
    28182870################################################################################
    28192871##### PlotCovariance
     
    40254077    if 'Flip' in generalData:
    40264078        flipData = generalData['Flip']                       
    4027         flipData['mapRoll'] = [0,0,0]
    40284079    Wt = np.array([255,255,255])
    40294080    Rd = np.array([255,0,0])
  • trunk/GSASIIspc.py

    r1615 r1625  
    14551455        CSI['Spos'][0] = [1,2,3, 0,0,0]
    14561456        CSI['Sadp'][0] = [0,0,0,0,0,0, 1,2,3,4,5,6]
    1457         return CSI       
    1458     print siteSym,OpText,SSOptext   
     1457        return CSI
     1458    return CSI  #for now       
     1459#    print siteSym,OpText,SSOptext   
    14591460    UniqAx = {'a':'a','b':'b','c':'g'}
    14601461    if SGData['SGLaue'] == '2/m':
     
    15321533    csi = np.ones((6),dtype='i')*-1
    15331534    for i,idelt in enumerate(deltx):
    1534         print 'idelt:',idelt
     1535#        print 'idelt:',idelt
    15351536        nxyzt = np.inner(ssop[0],(xyzt+idelt))+ssop[1]
    15361537        nxyzt[3] -= ssop[1][3]
    1537         print 'nxyz',nxyzt
     1538#        print 'nxyz',nxyzt
    15381539        xsin[i] = np.allclose((xyzt-idelt),nxyzt,1.e-6)
    1539         print 'sin ',(xyzt-idelt),xsin[i]
     1540#        print 'sin ',(xyzt-idelt),xsin[i]
    15401541        xcos[i] = np.allclose((xyzt+idelt),nxyzt,1.e-6)
    1541         print 'cos ',(xyzt+idelt),xcos[i]
     1542#        print 'cos ',(xyzt+idelt),xcos[i]
    15421543    n = -1
    15431544    for i,isin in enumerate(xsin):
     
    15491550            n += 1
    15501551            csi[i+3] = n
    1551     print csi
    1552     print CSI['Spos'][0]
    1553     print xsin,xcos
     1552#    print csi
     1553#    print CSI['Spos'][0]
     1554#    print xsin,xcos
    15541555    for i,idelt in enumerate(deltu):
    15551556        nuij = U2Uij(np.inner(sop[0],np.inner(np.abs(Uij2U(uij+idelt)),sop[0])))
    15561557        usin[i] = np.equal(np.abs(uij-idelt),nuij)[i]
    15571558        ucos[i] = np.equal(np.abs(uij+idelt),nuij)[i]
    1558     print CSI['Sadp'][0]
    1559     print usin,ucos
     1559#    print CSI['Sadp'][0]
     1560#    print usin,ucos
    15601561    return CSI
    15611562   
  • trunk/GSASIIstrIO.py

    r1618 r1625  
    189189    rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
    190190    rbVary,rbDict = GetRigidBodyModels(rigidbodyDict,Print=False)
    191     Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables = GetPhaseData(Phases,RestraintDict=None,rbIds=rbIds,Print=False)
     191    Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,maxSSwave = GetPhaseData(Phases,RestraintDict=None,rbIds=rbIds,Print=False)
    192192    hapVary,hapDict,controlDict = GetHistogramPhaseData(Phases,Histograms,Print=False)
    193193    histVary,histDict,controlDict = GetHistogramData(Histograms,Print=False)
     
    859859        cx,ct,cs,cia = General['AtomPtrs']
    860860        print >>pFile,'\n Modulation waves'
    861         names = {'Sfrac':['Fsin','Fcos'],'Spos':['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos'],
     861        names = {'Sfrac':['Fsin','Fcos','Fzero','Fwid'],'Spos':['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','Tzero','Xslope','Yslope','Zslope'],
    862862            'Sadp':['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin','U11cos','U22cos',
    863863            'U33cos','U12cos','U13cos','U23cos'],'Smag':['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos']}
     
    974974    AtMults = {}
    975975    AtIA = {}
     976    maxSSwave = {}
    976977    shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
    977978    SamSym = dict(zip(shModels,['0','-1','2/m','mmm']))
     
    10241025                   
    10251026        Natoms[pfx] = 0
    1026         maxSSwave = {'Sfrac':0,'Spos':0,'Sadp':0,'Smag':0}
     1027        maxSSwave[pfx] = {'Sfrac':0,'Spos':0,'Sadp':0,'Smag':0}
    10271028        if Atoms and not General.get('doPawley'):
    10281029            cx,ct,cs,cia = General['AtomPtrs']
     
    10891090                if General['Type'] in ['modulated','magnetic']:
    10901091                    AtomSS = at[-1]['SS1']
     1092                    waveType = AtomSS['waveType']
     1093                    phaseDict[pfx+'waveType:'+str(i)] = waveType   
    10911094                    CSI = G2spc.GetSSfxuinel(at[cx:cx+3],at[cia+2:cia+8],SGData,SSGData)
    10921095                    for Stype in ['Sfrac','Spos','Sadp','Smag']:
     
    10961099                            stiw = str(i)+':'+str(iw)
    10971100                            if Stype == 'Spos':
    1098                                 names = [pfx+'Xsin:'+stiw,pfx+'Ysin:'+stiw,pfx+'Zsin:'+stiw,
    1099                                     pfx+'Xcos:'+stiw,pfx+'Ycos:'+stiw,pfx+'Zcos:'+stiw]
    1100                                 equivs = [[],[],[], [],[],[]]
     1101                                if waveType in ['ZigZag','Sawtooth'] and not iw:
     1102                                    names = [pfx+'Tzero:'+stiw,pfx+'Xslope:'+stiw,pfx+'Yslope:'+stiw,pfx+'Zslope:'+stiw]
     1103                                    equivs = [[], [],[],[]]
     1104                                else:
     1105                                    names = [pfx+'Xsin:'+stiw,pfx+'Ysin:'+stiw,pfx+'Zsin:'+stiw,
     1106                                        pfx+'Xcos:'+stiw,pfx+'Ycos:'+stiw,pfx+'Zcos:'+stiw]
     1107                                    equivs = [[],[],[], [],[],[]]
    11011108                            elif Stype == 'Sadp':
    11021109                                names = [pfx+'U11sin:'+stiw,pfx+'U22sin:'+stiw,pfx+'U33sin:'+stiw,
     
    11071114                            elif Stype == 'Sfrac':
    11081115                                equivs = [[],[]]
    1109                                 names = [pfx+'Fsin:'+stiw,pfx+'Fcos:'+stiw]
     1116                                if 'Crenel' in waveType and not iw:
     1117                                    names = [pfx+'Fzero:'+stiw,pfx+'Fwid:'+stiw]
     1118                                else:
     1119                                    names = [pfx+'Fsin:'+stiw,pfx+'Fcos:'+stiw]
    11101120                            elif Stype == 'Smag':
    11111121                                equivs = [[],[],[], [],[],[]]
     
    11251135                                            eqv[1] /= coef
    11261136                                        G2mv.StoreEquivalence(name,equiv[1:])
    1127                         maxSSwave['Stype'] = max(maxSSwave['Stype'],iw+1)
    1128             phaseDict[pfx+'maxSSwave'] = maxSSwave   
     1137                            maxSSwave[pfx][Stype] = max(maxSSwave[Stype],iw+1)
    11291138            textureData = General['SH Texture']
    11301139            if textureData['Order']:
     
    12161225            phaseVary += pawleyVary
    12171226               
    1218     return Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables
     1227    return Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,maxSSwave
    12191228   
    12201229def cellFill(pfx,SGData,parmDict,sigDict):
  • trunk/GSASIIstrMain.py

    r1550 r1625  
    147147    rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
    148148    rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,pFile=printFile)
    149     Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables = G2stIO.GetPhaseData(Phases,restraintDict,rbIds,pFile=printFile)
     149    Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,maxSSwave = G2stIO.GetPhaseData(Phases,restraintDict,rbIds,pFile=printFile)
    150150    calcControls['atomIndx'] = atomIndx
    151151    calcControls['Natoms'] = Natoms
    152152    calcControls['FFtables'] = FFtables
    153153    calcControls['BLtables'] = BLtables
     154    calcControls['maxSSwave'] = maxSSwave
    154155    hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,Histograms,pFile=printFile)
    155156    calcControls.update(controlDict)
     
    243244    rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]})
    244245    rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,pFile=printFile)
    245     Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables = G2stIO.GetPhaseData(Phases,restraintDict,rbIds,False,printFile)
     246    Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,maxSSwave = G2stIO.GetPhaseData(Phases,restraintDict,rbIds,False,printFile)
    246247    for item in phaseVary:
    247248        if '::A0' in item:
     
    269270        calcControls['FFtables'] = FFtables
    270271        calcControls['BLtables'] = BLtables
     272        calcControls['maxSSwave'] = maxSSwave
    271273        Histo = {histogram:Histograms[histogram],}
    272274        hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,Histo,Print=False)
  • trunk/GSASIIstrMath.py

    r1622 r1625  
    537537    'Needs a doc string'
    538538    Natoms = calcControls['Natoms'][pfx]
    539     maxSSwave = parmDict[pfx+'maxSSwave']
     539    maxSSwave = calcControls['maxSSwave'][pfx]
    540540    Nwave = {'F':maxSSwave['Sfrac'],'X':maxSSwave['Spos'],'Y':maxSSwave['Spos'],'Z':maxSSwave['Spos'],
    541541        'U':maxSSwave['Sadp'],'M':maxSSwave['Smag']}
     
    544544    USSdata = np.zeros((12,maxSSwave['Sadp'],Natoms))
    545545    MSSdata = np.zeros((6,maxSSwave['Smag'],Natoms))
    546     keys = {'Fsin:':FSSdata[0],'Fcos:':FSSdata[1],
     546    keys = {'Fsin:':FSSdata[0],'Fcos:':FSSdata[1],'Fzero:':FSSdata[0],'Fwid:':FSSdata[1],
     547        'Tzero:':XSSdata[0],'Xslope:':XSSdata[1],'Yslope:':XSSdata[2],'Zslope:':XSSdata[3],
    547548        'Xsin:':XSSdata[0],'Ysin:':XSSdata[1],'Zsin:':XSSdata[2],'Xcos:':XSSdata[3],'Ycos:':XSSdata[4],'Zcos:':XSSdata[5],
    548549        'U11sin:':USSdata[0],'U22sin:':USSdata[1],'U33sin:':USSdata[2],'U12sin:':USSdata[3],'U13sin:':USSdata[4],'U23sin:':USSdata[5],
  • trunk/imports/G2phase.py

    r1606 r1625  
    510510                print Sfrac[i]
    511511            for i,it in enumerate(Spos):
    512                 vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54])]
     512                if waveType in ['ZigZag','Sawtooth'] and not i:
     513                    vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36])]
     514                else:
     515                    vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54])]
    513516                Spos[i] = [vals,False]
    514517            for i,it in enumerate(Sadp):
Note: See TracChangeset for help on using the changeset viewer.