Changeset 1918


Ignore:
Timestamp:
Jul 2, 2015 12:30:08 PM (8 years ago)
Author:
vondreele
Message:

further mods on twins

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1917 r1918  
    839839                            UseList[histoName]['Twins'].append([False,0.0])
    840840                        else:
    841                             UseList[histoName]['Twins'].append([np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]])
     841                            UseList[histoName]['Twins'].append([np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,reflData['TwMax'][0]]])
    842842                else:   #no nonmerohedral twins
    843                     UseList[histoName]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]
     843                    UseList[histoName]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,0]],]
    844844                for iref,ref in enumerate(reflData['RefList']):
    845845                    hkl = ref[:3]
  • trunk/GSASIIddataGUI.py

    r1915 r1918  
    783783            twinVal = 0.0
    784784            UseList[G2frame.hist]['Twins'].append([twinMat,twinVal])
     785            nNonM = UseList[G2frame.hist]['Twins'][0][1][2]
     786            for i in range(nNonM):
     787                UseList[G2frame.hist]['Twins'].append([False,0.0])
    785788            addtwin.SetValue(False)
    786789            wx.CallLater(100,RepaintHistogramInfo)
     
    826829            Obj = event.GetEventObject()
    827830            it = Indx[Obj.GetId()]
     831            nNonM = UseList[G2frame.hist]['Twins'][0][1][2]
     832            for i in range(nNonM):
     833                del UseList[G2frame.hist]['Twins'][1+i+it]
    828834            del UseList[G2frame.hist]['Twins'][it]
    829835            sumTw = 0.
     
    836842            wx.CallLater(100,RepaintHistogramInfo)           
    837843           
     844        nTwin = len(UseList[G2frame.hist]['Twins'])
    838845        twinsizer = wx.BoxSizer(wx.VERTICAL)
    839846        topsizer = wx.BoxSizer(wx.HORIZONTAL)         
    840847        topsizer.Add(wx.StaticText(DData,wx.ID_ANY,' Merohedral twins: '),0,WACV)
    841         addtwin = wx.CheckBox(DData,wx.ID_ANY,label=' Add Twin Law')
    842         addtwin.Bind(wx.EVT_CHECKBOX, OnAddTwin)
    843         topsizer.Add(addtwin,0,WACV)
     848        #temporary - add twin not allowed if nonmerohedral twins present
     849        if nTwin == 1 or 'bool' not in str(type(UseList[G2frame.hist]['Twins'][1][0])):
     850            addtwin = wx.CheckBox(DData,wx.ID_ANY,label=' Add Twin Law')
     851            addtwin.Bind(wx.EVT_CHECKBOX, OnAddTwin)
     852            topsizer.Add(addtwin,0,WACV)
    844853        twinsizer.Add(topsizer)
    845854        Indx = {}
    846         nTwin = len(UseList[G2frame.hist]['Twins'])
    847855        if nTwin > 1:
    848856            for it,Twin in enumerate(UseList[G2frame.hist]['Twins']):
  • trunk/GSASIIphsGUI.py

    r1917 r1918  
    39123912                'Extinction':['Lorentzian','None',
    39133913                {'Tbar':0.1,'Cos2TM':0.955,'Eg':[1.e-7,False],'Es':[1.e-7,False],'Ep':[1.e-7,False]},],
    3914                 'Flack':[0.0,False],'Twins':[[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]}                       
     3914                'Flack':[0.0,False],'Twins':[[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,0]],]}                       
    39153915            if 'TwMax' in reflData:     #nonmerohedral twins present
    39163916                UseList[histoName]['Twins'] = []
    3917                 for iT in range(reflData['TwMax'][0]):
     3917                for iT in range(reflData['TwMax'][0]+1):
    39183918                    if iT in reflData['TwMax'][1]:
    39193919                        UseList[histoName]['Twins'].append([False,0.0])
    39203920                    else:
    3921                         UseList[histoName]['Twins'].append([np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]])
     3921                        UseList[histoName]['Twins'].append([np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,reflData['TwMax'][0]]])
    39223922            else:   #no nonmerohedral twins
    3923                 UseList[histoName]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]
     3923                UseList[histoName]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,0]],]
    39243924            UpdateHKLFdata(histoName)
    39253925            data['Histograms'] = UseList
  • trunk/GSASIIstrIO.py

    r1917 r1918  
    22582258                    if hapData['Babinet'][bab][1]:
    22592259                        hapVary.append(pfx+bab)
    2260                 Twins = hapData.get('Twins',[[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],])
     2260                Twins = hapData.get('Twins',[[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False,0]],])
    22612261                if len(Twins) == 1:
    22622262                    hapDict[pfx+'Flack'] = hapData.get('Flack',[0.,False])[0]
  • trunk/GSASIIstrMath.py

    r1917 r1918  
    856856        H = np.squeeze(np.inner(H.T,TwinLaw))   #maybe array(blkSize,nTwins,3) or (blkSize,3)
    857857        TwMask = np.any(H,axis=-1)
    858         if TwinLaw.shape[0] > 1 and TwDict:
     858        if TwinLaw.shape[0] > 1 and TwDict: #need np.inner(TwinLaw[?],TwDict[iref][i])*TwinInv[i]
    859859            for ir in range(blkSize):
    860860                iref = ir+iBeg
     
    10371037                dFdua[iref] = TwMask[:,np.newaxis,np.newaxis]*[SA[it]*(dfadua[it][0]+dfbdua[it][1])+SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)]
    10381038                dFdtw[iref] = TwMask*np.sum(fas,axis=0)**2+np.sum(fbs,axis=0)**2
    1039             else:
     1039            else:   #these are good for no twin single crystals
    10401040                dFdfr[iref] = 2.*SA*(dfadfr[0]+dfbdfr[1])*Mdata/len(Uniq)+ \
    10411041                    2.*SB*(dfbdfr[0]+dfadfr[1])*Mdata/len(Uniq)
Note: See TracChangeset for help on using the changeset viewer.