Changeset 1055


Ignore:
Timestamp:
Sep 16, 2013 4:23:30 PM (10 years ago)
Author:
vondreele
Message:

working MC/SA

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r1051 r1055  
    429429            RBRes = MCSA['rbData'][model['Type']][model['RBId']]
    430430            Pos = np.array(model['Pos'][0])
    431             Qori = np.array(model['Ori'][0])
     431            Ori = np.array(model['Ori'][0])
     432            Qori = AVdeg2Q(Ori[0],Ori[1:])
    432433            if model['Type'] == 'Vector':
    433434                vecs = RBRes['rbVect']
     
    23562357    iters = 1
    23572358    keepGoing = True
     2359    bestn = 0
    23582360    while keepGoing:
    23592361        retval = 0
     
    23702372                    best_state.x = last_state.x.copy()
    23712373                    best_state.cost = last_state.cost
     2374                    bestn = n
    23722375        if dlg:
    2373             GoOn = dlg.Update(best_state.cost*100,
    2374                 newmsg='%s%8.5f\n%s%8.4f%s'%('Temperature =',schedule.T,'MC/SA Residual =',best_state.cost*100,'%'))[0]
     2376            GoOn = dlg.Update(min(100.,best_state.cost*100),
     2377                newmsg='%s%8.5f, %s%d\n%s%8.4f%s'%('Temperature =',schedule.T, \
     2378                    'Best trial:',bestn,  \
     2379                    'MC/SA Residual:',best_state.cost*100,'%', \
     2380                    ))[0]
    23752381            if not GoOn:
    23762382                best_state.x = last_state.x.copy()
     
    24932499        parmDict[mfx+'RBId'] = item['RBId']
    24942500        pstr = ['Px','Py','Pz']
    2495         ostr = ['Qa','Qi','Qj','Qk']
     2501        ostr = ['Qa','Qi','Qj','Qk']    #angle,vector not quaternion
    24962502        for i in range(3):
    24972503            name = mfx+pstr[i]
     
    25022508                lower.append(limits[0])
    25032509                upper.append(limits[1])
     2510        AV = item['Ori'][0]
     2511        A = AV[0]
     2512        V = AV[1:]
    25042513        for i in range(4):
    25052514            name = mfx+ostr[i]
    2506             parmDict[name] = item['Ori'][0][i]
    2507             if item['Ovar'] == 'AV' and i:
     2515            if i:
     2516                parmDict[name] = V[i-1]
     2517            else:
     2518                parmDict[name] = A
     2519            if item['Ovar'] == 'AV':
    25082520                varyList += [name,]
    25092521                limits = item['Ori'][2][i]
     
    25722584                if parmDict[pfx+'MolCent'][1]:
    25732585                    Cart -= parmDict[pfx+'MolCent'][0]
    2574                 Qori = normQ(np.array([parmDict[pfx+'Qa'],parmDict[pfx+'Qi'],parmDict[pfx+'Qj'],parmDict[pfx+'Qk']]))
     2586                Qori = AVdeg2Q(parmDict[pfx+'Qa'],[parmDict[pfx+'Qi'],parmDict[pfx+'Qj'],parmDict[pfx+'Qk']])
    25752587                Pos = np.array([parmDict[pfx+'Px'],parmDict[pfx+'Py'],parmDict[pfx+'Pz']])
    25762588                for i,x in enumerate(Cart):
     
    26052617        allX = np.reshape(allX,(-1,3))
    26062618        return allX
     2619       
     2620    def normQuaternions(RBdata,parmDict,varyList,values):
     2621        for iObj in range(parmDict['nObj']):
     2622            pfx = str(iObj)+':'
     2623            if parmDict[pfx+'Type'] in ['Vector','Residue']:
     2624                Qori = AVdeg2Q(parmDict[pfx+'Qa'],[parmDict[pfx+'Qi'],parmDict[pfx+'Qj'],parmDict[pfx+'Qk']])
     2625                A,V = Q2AVdeg(Qori)
     2626                for i,name in enumerate(['Qa','Qi','Qj','Qk']):
     2627                    if i:
     2628                        parmDict[pfx+name] = V[i-1]
     2629                    else:
     2630                        parmDict[pfx+name] = A
    26072631       
    26082632    def mcsaCalc(values,refList,rcov,ifInv,allFF,RBdata,varyList,parmDict):
     
    26362660            refList[5] = Aterm+Bterm
    26372661        sumFcsq = np.sum(refList[5])
    2638         scale = (parmDict['sumFosq']/sumFcsq)
     2662        scale = parmDict['sumFosq']/sumFcsq
    26392663        refList[5] *= scale
    2640         Srefs = refList[4]-refList[5]
    2641         M = np.inner(Srefs,np.inner(rcov,Srefs))
     2664        refList[6] = refList[4]-refList[5]
     2665        M = np.inner(refList[6],np.inner(rcov,refList[6]))
    26422666        tsum += (time.time()-t0)
    2643         return M/parmDict['sumFosq']**2
     2667#        print M,parmDict['sumFosq'],np.sum(refList[6]**2),np.sum(refList[4]**2)
     2668#        print np.sum(refList[6]**2)/np.sum(refList[4]**2)
     2669        return M/np.sum(refList[4]**2)
    26442670
    26452671    sq8ln2 = np.sqrt(8*np.log(2))
     
    27202746        Rnorm = np.outer(Rdiag,Rdiag)
    27212747        rcov /= Rnorm
    2722     elif 'Pawley' in reflName:
     2748    elif 'Pawley' in reflName:  #need a bail out if Pawley cov matrix doesn't exist.
    27232749        covMatrix = covData['covMatrix']
    27242750        vList = covData['varyList']
     
    27762802        quench=MCSA['fast parms'][0], m=MCSA['fast parms'][1], n=MCSA['fast parms'][2],
    27772803        lower=lower, upper=upper, slope=MCSA['log slope'],ranStart=MCSA.get('ranStart',True),dlg=pgbar)
     2804    M = mcsaCalc(results[0],refs,rcov,ifInv,allFF,RBdata,varyList,parmDict)
     2805#    for ref in refs.T:
     2806#        print ' %4d %4d %4d %10.3f %10.3f %10.3f'%(int(ref[0]),int(ref[1]),int(ref[2]),ref[4],ref[5],ref[6])
     2807#    print np.sqrt((np.sum(refs[6]**2)/np.sum(refs[4]**2)))
    27782808    Result = [False,False,results[1],results[2],]+list(results[0])
    27792809    Result.append(varyList)
     
    28622892    if d:
    28632893        V /= d
     2894        p = A/2.
     2895        Q[0] = np.cos(p)
     2896        Q[1:4] = V*np.sin(p)
    28642897    else:
    2865         V = np.array([0.,0.,1.])
    2866     p = A/2.
    2867     Q[0] = np.cos(p)
    2868     Q[1:4] = V*np.sin(p)
     2898        Q[3] = 1.
    28692899    return Q
    28702900   
     
    28772907    if d:
    28782908        V /= d
     2909        p = A/2.
     2910        Q[0] = cosd(p)
     2911        Q[1:4] = V*sind(p)
    28792912    else:
    2880         V = np.array([0.,0.,1.])
    2881     p = A/2.
    2882     Q[0] = cosd(p)
    2883     Q[1:4] = V*sind(p)
     2913        Q[3] = 1.
    28842914    return Q
    28852915   
     
    28902920    A = 2.*acosd(Q[0])
    28912921    V = np.array(Q[1:])
    2892     d = np.sqrt(np.sum(V**2))
    2893     if d:
    2894         V /= d
    2895     else:
    2896         A = 0.
    2897         V = np.array([0.,0.,0.])
     2922    V /= sind(A/2.)
    28982923    return A,V
    28992924   
     
    29042929    A = 2.*np.arccos(Q[0])
    29052930    V = np.array(Q[1:])
    2906     d = np.sqrt(np.sum(V**2))
    2907     if d:
    2908         V /= d
    2909     else:
    2910         A = 0.
    2911         V = np.array([0.,0.,0.])
     2931    V /= np.sin(A/2.)
    29122932    return A,V
    29132933   
  • trunk/GSASIIphsGUI.py

    r1052 r1055  
    206206        Map = generalData['Map']
    207207        Flip = generalData['Flip']
    208         MCSA = generalData['MCSA controls'] 
     208        MCSAdata = generalData['MCSA controls'] 
    209209        PWDR = any(['PWDR' in item for item in data['Histograms'].keys()])
    210210        # UpdateGeneral execution continues below
     
    655655           
    656656            def OnRefList(event):
    657                 MCSA['Data source'] = refList.GetValue()
     657                MCSAdata['Data source'] = refList.GetValue()
    658658           
    659659            def OnDmin(event):
     
    661661                    val = float(dmin.GetValue())
    662662                    if 1.0 <= val < 5.0:
    663                         MCSA['dmin'] = val
     663                        MCSAdata['dmin'] = val
    664664                except ValueError:
    665665                    pass
    666                 dmin.SetValue("%.3f"%(MCSA['dmin']))          #reset in case of error
     666                dmin.SetValue("%.3f"%(MCSAdata['dmin']))          #reset in case of error
    667667
    668668            def OnCycles(event):
    669                 MCSA['Cycles'] = int(cycles.GetValue())
     669                MCSAdata['Cycles'] = int(cycles.GetValue())
    670670                               
    671671            def OnAlist(event):
    672                 MCSA['Algorithm'] = Alist.GetValue()
     672                MCSAdata['Algorithm'] = Alist.GetValue()
    673673                wx.CallAfter(UpdateGeneral)
    674674               
     
    677677                    val = float(slope.GetValue())
    678678                    if .25 <= val < 1.0:
    679                         MCSA['log slope'] = val
     679                        MCSAdata['log slope'] = val
    680680                except ValueError:
    681681                    pass
    682                 slope.SetValue("%.3f"%(MCSA['log slope']))          #reset in case of error               
     682                slope.SetValue("%.3f"%(MCSAdata['log slope']))          #reset in case of error               
    683683           
    684684            def OnAjump(event):
     
    688688                    val = float(Obj.GetValue())
    689689                    if .0 <= val <= 1.0:
    690                         MCSA[name][ind] = val
     690                        MCSAdata[name][ind] = val
    691691                except ValueError:
    692692                    pass
    693                 Obj.SetValue("%.3f"%(MCSA[name][ind]))
     693                Obj.SetValue("%.3f"%(MCSAdata[name][ind]))
    694694               
    695695            def OnRanStart(event):
    696                 MCSA['ranStart'] = ranStart.GetValue()
     696                MCSAdata['ranStart'] = ranStart.GetValue()
    697697           
    698698            def OnAnneal(event):
     
    703703                        val = int(Obj.GetValue())
    704704                        if 1 <= val:
    705                             MCSA['Annealing'][ind] = val
     705                            MCSAdata['Annealing'][ind] = val
    706706                    except ValueError:
    707                         Obj.SetValue(fmt%(MCSA['Annealing'][ind]))
     707                        Obj.SetValue(fmt%(MCSAdata['Annealing'][ind]))
    708708                else:
    709709                    try:
    710710                        val = float(Obj.GetValue())
    711711                        if .0 <= val:
    712                             MCSA['Annealing'][ind] = val
    713                         Obj.SetValue(fmt%(MCSA['Annealing'][ind]))
     712                            MCSAdata['Annealing'][ind] = val
     713                        Obj.SetValue(fmt%(MCSAdata['Annealing'][ind]))
    714714                    except ValueError:
    715                         MCSA['Annealing'][ind] = None                   
    716                         Obj.SetValue(str(MCSA['Annealing'][ind]))
     715                        MCSAdata['Annealing'][ind] = None                   
     716                        Obj.SetValue(str(MCSAdata['Annealing'][ind]))
    717717                       
    718718            refList = []
     
    725725            lineSizer = wx.BoxSizer(wx.HORIZONTAL)
    726726            lineSizer.Add(wx.StaticText(General,label=' Monte Carlo/Simulated Annealing controls: Reflection set from: '),0,wx.ALIGN_CENTER_VERTICAL)
    727             refList = wx.ComboBox(General,-1,value=MCSA['Data source'],choices=refList,
     727            refList = wx.ComboBox(General,-1,value=MCSAdata['Data source'],choices=refList,
    728728                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    729729            refList.Bind(wx.EVT_COMBOBOX,OnRefList)
    730730            lineSizer.Add(refList,0,wx.ALIGN_CENTER_VERTICAL)
    731731            lineSizer.Add(wx.StaticText(General,label=' d-min: '),0,wx.ALIGN_CENTER_VERTICAL)
    732             dmin = wx.TextCtrl(General,-1,value='%.3f'%(MCSA['dmin']),style=wx.TE_PROCESS_ENTER)
     732            dmin = wx.TextCtrl(General,-1,value='%.3f'%(MCSAdata['dmin']),style=wx.TE_PROCESS_ENTER)
    733733            dmin.Bind(wx.EVT_TEXT_ENTER,OnDmin)       
    734734            dmin.Bind(wx.EVT_KILL_FOCUS,OnDmin)
     
    739739            line2Sizer.Add(wx.StaticText(General,label=' MC/SA runs: '),0,wx.ALIGN_CENTER_VERTICAL)
    740740            Cchoice = ['1','2','3','6','10','20','30','60','100']
    741             cycles = wx.ComboBox(General,-1,value=str(MCSA.get('Cycles',1)),choices=Cchoice,
     741            cycles = wx.ComboBox(General,-1,value=str(MCSAdata.get('Cycles',1)),choices=Cchoice,
    742742                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    743743            cycles.Bind(wx.EVT_COMBOBOX,OnCycles)       
     
    746746            ranStart = wx.CheckBox(General,-1,label=' Random start? (ignored if Start temp = None)')
    747747            ranStart.Bind(wx.EVT_CHECKBOX, OnRanStart)
    748             ranStart.SetValue(MCSA.get('ranStart',True))
     748            ranStart.SetValue(MCSAdata.get('ranStart',True))
    749749            line2Sizer.Add(ranStart,0,wx.ALIGN_CENTER_VERTICAL)           
    750750            mcsaSizer.Add(line2Sizer)
     
    754754#            Achoice = ['log','fast','cauchy','boltzmann','Tremayne']
    755755            line3Sizer.Add(wx.StaticText(General,label=' MC/SA schedule: '),0,wx.ALIGN_CENTER_VERTICAL)
    756             Alist = wx.ComboBox(General,-1,value=MCSA['Algorithm'],choices=Achoice,
     756            Alist = wx.ComboBox(General,-1,value=MCSAdata['Algorithm'],choices=Achoice,
    757757                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    758758            Alist.Bind(wx.EVT_COMBOBOX,OnAlist)
    759759            line3Sizer.Add(Alist,0,wx.ALIGN_CENTER_VERTICAL)
    760             if MCSA['Algorithm'] in ['Tremayne','fast','boltzmann','cauchy']:
     760            if MCSAdata['Algorithm'] in ['Tremayne','fast','boltzmann','cauchy']:
    761761                Names = [' A-jump: ',' B-jump: ']
    762762                parms = 'Jump coeff'
    763                 if MCSA['Algorithm'] in ['boltzmann','cauchy']:
     763                if MCSAdata['Algorithm'] in ['boltzmann','cauchy']:
    764764                    Names = [' A-jump: ']
    765                 elif 'fast' in MCSA['Algorithm']:
     765                elif 'fast' in MCSAdata['Algorithm']:
    766766                    Names = [' quench: ',' m-factor: ',' n-factor: ']
    767767                    parms = 'fast parms'
    768768                for i,name in enumerate(Names):
    769769                    line3Sizer.Add(wx.StaticText(General,label=name),0,wx.ALIGN_CENTER_VERTICAL)
    770                     Ajump =  wx.TextCtrl(General,-1,value='%.3f'%(MCSA[parms][i]),style=wx.TE_PROCESS_ENTER)
     770                    Ajump =  wx.TextCtrl(General,-1,value='%.3f'%(MCSAdata[parms][i]),style=wx.TE_PROCESS_ENTER)
    771771                    Ajump.Bind(wx.EVT_TEXT_ENTER,OnAjump)       
    772772                    Ajump.Bind(wx.EVT_KILL_FOCUS,OnAjump)
    773773                    Indx[Ajump.GetId()] = [parms,i]
    774774                    line3Sizer.Add(Ajump,0,wx.ALIGN_CENTER_VERTICAL)
    775             elif 'log' in MCSA['Algorithm']:
     775            elif 'log' in MCSAdata['Algorithm']:
    776776                line3Sizer.Add(wx.StaticText(General,label=' slope: '),0,wx.ALIGN_CENTER_VERTICAL)
    777                 slope =  wx.TextCtrl(General,-1,value='%.3f'%(MCSA['log slope']),style=wx.TE_PROCESS_ENTER)
     777                slope =  wx.TextCtrl(General,-1,value='%.3f'%(MCSAdata['log slope']),style=wx.TE_PROCESS_ENTER)
    778778                slope.Bind(wx.EVT_TEXT_ENTER,OnSlope)       
    779779                slope.Bind(wx.EVT_KILL_FOCUS,OnSlope)
     
    786786            fmts = ['%.1f','%.5f','%d']
    787787            for i,[name,fmt] in enumerate(zip(names,fmts)):
    788                 if MCSA['Annealing'][i]:
    789                     text = fmt%(MCSA['Annealing'][i])
     788                if MCSAdata['Annealing'][i]:
     789                    text = fmt%(MCSAdata['Annealing'][i])
    790790                else:
    791791                    text = 'None'
     
    40514051            def OnOriVal(event):
    40524052                Obj = event.GetEventObject()
    4053                 model,ix = Indx[Obj.GetId()]
     4053                model,ix,ObjA,ObjV = Indx[Obj.GetId()]
    40544054                A,V = G2mth.Q2AVdeg(model['Ori'][0])
    40554055                if ix:
    40564056                    Anew = A
    4057                     Vec = Obj.GetValue().split()
     4057                    Vec = ObjV.GetValue().split()
    40584058                    try:
    40594059                        Vnew = [float(Vec[i]) for i in range(3)]
     
    40634063                    Vnew = V
    40644064                    try:
    4065                         Anew = float(Obj.GetValue())
     4065                        Anew = float(ObjA.GetValue())
    40664066                    except ValueError:
    40674067                        Anew = A
    40684068                model['Ori'][0] = G2mth.AVdeg2Q(Anew,Vnew)
     4069                A,V = G2mth.Q2AVdeg(model['Ori'][0])
     4070                if ix:
     4071                    ObjV.SetValue('%.3f %.3f %.3f'%(V[0],V[1],V[2]))
     4072                else:
     4073                    ObjA.SetValue('%.5f'%(A))
    40694074                G2plt.PlotStructure(G2frame,data)
    40704075                UpdateMCSA()
     
    41074112               
    41084113            rbsizer2 = wx.FlexGridSizer(1,6,5,5)
    4109             Orien,OrienV = G2mth.Q2AVdeg(model['Ori'][0])
    4110             Ori = [Orien,]+list(OrienV)
     4114            Ori = model['Ori'][0]
    41114115            rbsizer2.Add(wx.StaticText(MCSA,-1,'Oa: '),0,wx.ALIGN_CENTER_VERTICAL)
    41124116            angVal = wx.TextCtrl(MCSA,-1,'%.5f'%(Ori[0]),style=wx.TE_PROCESS_ENTER)
    41134117            angVal.Bind(wx.EVT_TEXT_ENTER,OnOriVal)
    41144118            angVal.Bind(wx.EVT_KILL_FOCUS,OnOriVal)
    4115             Indx[angVal.GetId()] = [model,0]
    41164119            rbsizer2.Add(angVal,0,wx.ALIGN_CENTER_VERTICAL)
    41174120            rbsizer2.Add(wx.StaticText(MCSA,-1,'Oi,Oj,Ok: '),0,wx.ALIGN_CENTER_VERTICAL)
     
    41194122            vecVal.Bind(wx.EVT_TEXT_ENTER,OnOriVal)
    41204123            vecVal.Bind(wx.EVT_KILL_FOCUS,OnOriVal)
    4121             Indx[vecVal.GetId()] = [model,1]
     4124            Indx[angVal.GetId()] = [model,0,angVal,vecVal]
     4125            Indx[vecVal.GetId()] = [model,1,angVal,vecVal]
    41224126            rbsizer2.Add(vecVal,0,wx.ALIGN_CENTER_VERTICAL)
    41234127            rbsizer2.Add(wx.StaticText(MCSA,-1,' Vary? '),0,wx.ALIGN_CENTER_VERTICAL)
     
    41464150            rbsizer.Add(rbsizer2)   
    41474151            if model['Type'] == 'Residue':
     4152                atNames = RBData['Residue'][model['RBId']]['atNames']
     4153                rbsizer.Add(wx.StaticText(MCSA,-1,'Torsions:'),0,wx.ALIGN_CENTER_VERTICAL)
    41484154                rbsizer3 = wx.FlexGridSizer(1,8,5,5)
    41494155                for it,tor in enumerate(model['Tor'][0]):
    4150                     name = 'Tor('+str(it)+')'
     4156                    iBeg,iFin = RBData['Residue'][model['RBId']]['rbSeq'][it][:2]
     4157                    name = atNames[iBeg]+'-'+atNames[iFin]
    41514158                    torRef = wx.CheckBox(MCSA,-1,label=' %s: '%(name))
    41524159                    torRef.SetValue(model['Tor'][1][it])
     
    42374244                r,c = event.GetRow(),event.GetCol()
    42384245                if c == 0:
    4239                     Models = data['MCSA']['Models']
    42404246                    for row in range(resultsGrid.GetNumberRows()):
    42414247                        resultsTable.SetValue(row,c,False)
    42424248                        Results[row][0] = False
    42434249                    Results[r][0] = True
    4244                     resultsGrid.ForceRefresh()
    42454250                    result = Results[r]
    4246                     for key,val in zip(result[-1],result[4:-1]):
    4247                         vals = key.split(':')
    4248                         nObj,name = int(vals[0]),vals[1]
    4249                         if 'A' in name:
    4250                             ind = ['Ax','Ay','Az'].index(name)
    4251                             Models[nObj]['Pos'][0][ind] = val                           
    4252                         elif 'Q' in name:
    4253                             Q = Models[nObj]['Ori'][0]
    4254                             A,V = G2mth.Q2AVdeg(Q)
    4255                             ind = ['Qa','Qi','Qj','Qk'].index(name)
    4256                             if ind:
    4257                                 V[ind-1] = val
    4258                             else:
    4259                                 A = val
    4260                             Q = G2mth.AVdeg2Q(A,V)
    4261                             Models[nObj]['Ori'][0] = Q                           
    4262                         elif 'P' in name:
    4263                             ind = ['Px','Py','Pz'].index(name)
    4264                             Models[nObj]['Pos'][0][ind] = val                           
    4265                         elif 'T' in name:
    4266                             tnum = int(name.split('Tor')[1])
    4267                             Models[nObj]['Tor'][0][tnum] = val                                                       
    4268                         else:       #March Dollase
    4269                             Models[0]['Coef'][0] = val
     4251                    Models = data['MCSA']['Models']
     4252                    SetSolution(result,Models)
    42704253                    wx.CallAfter(UpdateMCSA,MCSA.GetScrollPos(wx.VERTICAL))
    42714254                    G2plt.PlotStructure(G2frame,data)
     
    42934276            resultsGrid = G2gd.GSGrid(MCSA)
    42944277            resultsGrid.SetTable(resultsTable, True)
    4295             resultsGrid.Bind(wg.EVT_GRID_SELECT_CELL, OnCellChange)
     4278            resultsGrid.Bind(wg.EVT_GRID_CELL_LEFT_CLICK, OnCellChange)
    42964279            resultsGrid.AutoSizeColumns(True)
    42974280            for r in range(resultsGrid.GetNumberRows()):
     
    43064289       
    43074290        # UpdateMCSA executable code starts here
     4291        MCSA.DestroyChildren()
    43084292        general = data['General']
    43094293        Amat,Bmat = G2lat.cell2AB(general['Cell'][1:7])
     
    43444328            Results = data['MCSA']['Results']
    43454329            mainSizer.Add(ResultsSizer(Results))
    4346 
     4330           
     4331        mainSizer.Layout()
    43474332        SetPhaseWindow(G2frame.dataFrame,MCSA,mainSizer)
    43484333        MCSA.Scroll(0,Scroll)
     4334       
     4335    def SetSolution(result,Models):
     4336        for key,val in zip(result[-1],result[4:-1]):
     4337            vals = key.split(':')
     4338            nObj,name = int(vals[0]),vals[1]
     4339            if 'A' in name:
     4340                ind = ['Ax','Ay','Az'].index(name)
     4341                Models[nObj]['Pos'][0][ind] = val                           
     4342            elif 'Q' in name:
     4343                ind = ['Qa','Qi','Qj','Qk'].index(name)
     4344                Models[nObj]['Ori'][0][ind] = val
     4345            elif 'P' in name:
     4346                ind = ['Px','Py','Pz'].index(name)
     4347                Models[nObj]['Pos'][0][ind] = val                           
     4348            elif 'T' in name:
     4349                tnum = int(name.split('Tor')[1])
     4350                Models[nObj]['Tor'][0][tnum] = val                                                       
     4351            else:       #March Dollase
     4352                Models[0]['Coef'][0] = val
    43494353           
    43504354    def OnRunMultiMCSA(event):
     
    44184422                pgbar.Destroy()
    44194423        MCSAdata['Results'] = G2mth.sortArray(MCSAdata['Results'],2,reverse=False)
     4424        MCSAdata['Results'][0][0] = True
     4425        SetSolution(MCSAdata['Results'][0],data['MCSA']['Models'])
    44204426        G2frame.dataDisplay.SetFocus()
    44214427        Page = G2frame.dataDisplay.FindPage('MC/SA')
     
    44604466        body = {'name':RB['RBname']+'('+str(len(data['MCSA']['Models']))+')','RBId':rbId,'Type':rbType,
    44614467            'Pos':[[0.,0.,0.],[False,False,False],[[0.,1.],[0.,1.],[0.,1.]]],'Ovar':'','MolCent':[[0.,0.,0.],False],
    4462             'Ori':[[1.,0.,0.,0.],[False,False,False,False],[[-180.,180.],[-1.,1.],[-1.,1.],[-1.,1.]]]}
     4468            'Ori':[[180.,0.,0.,1.],[False,False,False,False],[[0.,360.],[-1.,1.],[-1.,1.],[-1.,1.]]]}
    44634469        if rbType == 'Residue':
    44644470            body['Tor'] = [[],[],[]]
Note: See TracChangeset for help on using the changeset viewer.