Changeset 4487 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Jun 13, 2020 3:50:13 PM (3 years ago)
Author:
toby
Message:

abort on Complete Molecule optional; bypass decode error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4484 r4487  
    79247924        mainSizer = wx.BoxSizer(wx.VERTICAL)
    79257925        mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Molecular completion parameters'),0,WACV)
     7926        mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Pause after: '),0,WACV)
    79267927        topSizer = wx.BoxSizer(wx.HORIZONTAL)
    7927         topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Max # of repetitions: '),0,WACV)
     7928        topSizer.Add((45,-1))
    79287929        choices = [1,2,5,10,50]
    79297930        params = {'maxrep':10, 'maxatm':1000}
    79307931        topSizer.Add(G2G.EnumSelector(dlg,params,'maxrep',
    79317932                        [str(i) for i in choices],choices))
     7933        topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,' repetitions'),0,WACV)
    79327934        mainSizer.Add(topSizer,0,WACV)
    79337935        topSizer = wx.BoxSizer(wx.HORIZONTAL)
    7934         topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Max # of added atoms: '),0,WACV)
     7936        topSizer.Add((45,-1))
    79357937        choices = [100,500,1000,5000,10000]
    79367938        topSizer.Add(G2G.EnumSelector(dlg,params,'maxatm',
    79377939                        [str(i) for i in choices],choices))
     7940        topSizer.Add(wx.StaticText(dlg,wx.ID_ANY,' added atoms'),0,WACV)
    79387941        mainSizer.Add(topSizer,0,WACV)
    79397942        mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY,'Atom types to add:'),0,WACV)
     
    79767979
    79777980        time1 = time.time()
    7978         pgbar = wx.ProgressDialog('Fill molecular coordination',
    7979             'Passes done=0 %0',params['maxrep'],
    7980             parent=G2frame,
    7981             style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT)
    7982         screenSize = wx.ClientDisplayRect()
    7983         Size = pgbar.GetSize()
    7984         if 50 < Size[0] < 500: # sanity check on size, since this fails w/Win & wx3.0
    7985             pgbar.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x
    7986             pgbar.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
    7987         pgbar.Raise()
    7988         wx.Yield()
    79897981        added = 0
    79907982        targets = [item for item in atomTypes if params[item]]
    7991         cx,ct,cs,ci = getAtomPtrs(data,draw=True)     
    7992         for rep in range(params['maxrep']):
     7983        cx,ct,cs,ci = getAtomPtrs(data,draw=True)
     7984        rep = 0
     7985        allrep = 0
     7986        while True:
     7987            if rep == 0:
     7988                pgbar = wx.ProgressDialog('Fill molecular coordination',
     7989                    'Passes done=0 %0',params['maxrep']+1,
     7990                    parent=G2frame,
     7991                    style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT)
     7992                screenSize = wx.ClientDisplayRect()
     7993                Size = pgbar.GetSize()
     7994                if 50 < Size[0] < 500: # sanity check on size, since this fails w/Win & wx3.0
     7995                    pgbar.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x
     7996                    pgbar.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
     7997                pgbar.Raise()
     7998                wx.Yield()
    79937999            startlen = len(data['Drawing']['Atoms'])
    79948000            coordsArray = np.array([a[cx:cx+3] for a in data['Drawing']['Atoms']])
     
    80028008            if not GoOn[0]: break
    80038009            print('pass {} processed {} atoms adding {}; Search time: {:.2f}s'.format(
    8004                 rep+1,len(indx),len(addedAtoms),time.time()-time1))
     8010                allrep+1,len(indx),len(addedAtoms),time.time()-time1))
    80058011            time1 = time.time()           
    8006 
     8012            rep += 1
     8013            allrep += 1
    80078014            if len(addedAtoms) == 0: break
    80088015            added += len(addedAtoms)
    8009             if added > params['maxatm']: break
    80108016            data['Drawing']['Atoms'] += addedAtoms
    80118017            # atoms to search over (omit H)
    8012             indx = [i+startlen for i in range(len(addedAtoms)) if addedAtoms[i][ct] != 'H'] 
     8018            indx = [i+startlen for i in range(len(addedAtoms)) if addedAtoms[i][ct] != 'H']
     8019            if len(indx) == 0: break
     8020            if added > params['maxatm']:
     8021                msg = "Exceeded number added atoms. Continue?"
     8022                dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO)
     8023                if dlg.ShowModal() != wx.ID_YES:
     8024                    dlg.Destroy()
     8025                    break
     8026                dlg.Destroy()
     8027                rep = 0
     8028                added = 1
     8029                pgbar.Destroy()   
     8030            if rep >= params['maxrep']:
     8031                msg = "Exceeded number of repetitions. Continue?"
     8032                dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO)
     8033                if dlg.ShowModal() != wx.ID_YES:
     8034                    dlg.Destroy()
     8035                    break
     8036                dlg.Destroy()
     8037                rep = 0
     8038                added = 1
     8039                pgbar.Destroy()
    80138040            UpdateDrawAtoms()
    80148041            G2plt.PlotStructure(G2frame,data)
     
    99619988                    dlg = wx.MessageDialog(G2frame,msg,caption='Continue?',style=wx.YES_NO|wx.ICON_EXCLAMATION)
    99629989                    if dlg.ShowModal() != wx.ID_YES:
    9963                         #OkBtn.SetLabel('Not Ready')
    9964                         #OkBtn.Enable(False)
     9990                        dlg.Destroy()
    99659991                        return
     9992                    dlg.Destroy()
    99669993                   
    99679994                rbType = data['testRBObj']['rbType']
Note: See TracChangeset for help on using the changeset viewer.