Changeset 4865 for trunk


Ignore:
Timestamp:
Mar 24, 2021 1:06:49 PM (2 years ago)
Author:
vondreele
Message:

fixes to monoclinic A,C,I centered cell indexing (still need to do P)
fix bug in bond restraints & add enhancement to atom requests for bonds, angles & planes.
Remove 'U' from open in G2phase.py - deprecated

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIindex.py

    r4862 r4865  
    873873            Lhkl,M20,X20,Aref = refinePeaks(peaks,ibrav,Abeg,ifX20)
    874874            Asave.append([calc_M20(peaks,HKL,ifX20),Aref[:]])
    875             if ibrav in [9,10,11]:                          #C-centered orthorhombic
     875            if ibrav in [9,10,11]:                          #A,B,or C-centered orthorhombic
    876876                for i in range(2):
    877877                    Abeg = rotOrthoA(Abeg[:])
     
    900900    'needs a doc string'
    901901    a,b,c,alp,bet,gam = G2lat.A2cell(A)
     902    print(a,b,c,alp,bet,gam)
     903    if bet < 90.:
     904        bet = 180.-bet     #always want obtuse beta
     905        A = G2lat.cell2A([a,b,c,90.,bet,90.])
    902906    G,g = G2lat.A2Gmat(A)
    903     if ibrav in [13,]:    #I-monoclinic
    904         pass
    905         # u = [-1,0,0]
    906         # v = [1,0,1]
    907         # cnew = math.sqrt(np.dot(np.dot(v,g),v))
    908         # if cnew < c:
    909         #     cang = np.dot(np.dot(u,g),v)/(a*cnew)
    910         #     beta = acosd(-abs(cang))
    911         #     if beta < 90.: beta = 180.-beta
    912         #     A = G2lat.cell2A([a,b,cnew,90,beta,90])
     907    if ibrav in [13,]:    #I-monoclinic - checked OK
     908        u = [-1,0,0]
     909        v = [2,0,1]
     910        cnew = math.sqrt(np.dot(np.dot(v,g),v))
     911        if cnew < c:
     912            cang = np.dot(np.dot(u,g),v)/(a*cnew)
     913            beta = acosd(-abs(cang))
     914            if beta < 90.: beta = 180.-beta     #always want obtuse beta
     915            A = G2lat.cell2A([a,b,cnew,90,beta,90])
    913916    elif ibrav in [14,]:      #A-monoclinic - OK?
    914917        u = [0,0,-1]
     
    918921            cang = np.dot(np.dot(u,g),v)/(anew*c)
    919922            beta = acosd(-abs(cang))
    920             if beta < 90.: beta = 180.-beta
     923            if beta < 90.: beta = 180.-beta     #always want obtuse beta
    921924            A = G2lat.cell2A([anew,b,c,90,beta,90])
    922925    elif ibrav in [15,]:    #C-monoclinic - OK?
     
    927930            cang = np.dot(np.dot(u,g),v)/(a*cnew)
    928931            beta = acosd(-abs(cang))
    929             if beta < 90.: beta = 180.-beta
     932            if beta < 90.: beta = 180.-beta     #always want obtuse beta
    930933            A = G2lat.cell2A([a,b,cnew,90,beta,90])
    931934    return A
  • trunk/GSASIIrestrGUI.py

    r4864 r4865  
    242242        Lists = {'origin':[],'target':[]}
    243243        for listName in ['origin','target']:
    244             dlg = wx.MultiChoiceDialog(G2frame,'Bond restraint '+listName+' for '+General['Name'],
     244            dlg = G2G.G2MultiChoiceDialog(G2frame,'Bond restraint '+listName+' for '+General['Name'],
    245245                    'Select bond restraint '+listName+' atoms',Names)
    246246            if dlg.ShowModal() == wx.ID_OK:
     
    276276                for Tid,Ttype,Tcoord in targAtoms:
    277277                    if 'macro' in General['Type']:
    278                         result = [Tcoord,1,[0,0,0],[]]
     278                        result = [[Tcoord,1,[0,0,0],[]],]
    279279                    else:
    280280                        result = G2spc.GenAtom(Tcoord,SGData,False,Move=False)
     
    369369        Lists = {'A-atom':[],'B-atom':[],'C-atom':[]}
    370370        for listName in ['A-atom','B-atom']:
    371             dlg = wx.MultiChoiceDialog(G2frame,'Select '+listName+' for angle A-B-C for '+General['Name']                                                                           ,
     371            dlg = G2G.G2MultiChoiceDialog(G2frame,'Select '+listName+' for angle A-B-C for '+General['Name']                                                                           ,
    372372                    'Select angle restraint '+listName,Names)
    373373            if dlg.ShowModal() == wx.ID_OK:
     
    521521    def AddPlaneRestraint(restrData):
    522522        ids = []
    523         dlg = wx.MultiChoiceDialog(G2frame,'Select 4 or more atoms for plane in '+General['Name'],
     523        dlg = G2G.G2MultiChoiceDialog(G2frame,'Select 4 or more atoms for plane in '+General['Name'],
    524524                'Select 4+ atoms',Names[iBeg:])
    525525        if dlg.ShowModal() == wx.ID_OK:
     
    812812        ids = []
    813813        factors = []
    814         dlg = wx.MultiChoiceDialog(G2frame,'Select atoms for chemical restraint in '+General['Name'],
     814        dlg = G2G.G2MultiChoiceDialog(G2frame,'Select atoms for chemical restraint in '+General['Name'],
    815815                'Select atoms',Names)
    816816        if dlg.ShowModal() == wx.ID_OK:
  • trunk/imports/G2phase.py

    r4415 r4865  
    7676        EightPiSq = 8.*math.pi**2
    7777        self.errors = 'Error opening file'
    78         file = open(filename, 'Ur')
     78        file = open(filename, 'r')
    7979        Phase = {}
    8080        Title = os.path.basename(filename)
     
    449449        '''
    450450        self.errors = 'Error opening file'
    451         fp = open(filename, 'Ur') #contains only cell & spcgroup
     451        fp = open(filename, 'r') #contains only cell & spcgroup
    452452        Phase = {}
    453453        Title = os.path.basename(filename)
     
    523523        waveTypes = ['Fourier','Sawtooth','ZigZag',]
    524524        filename2 = os.path.splitext(filename)[0]+'.m40'
    525         file2 = open(filename2,'Ur')
     525        file2 = open(filename2,'r')
    526526        S = file2.readline()
    527527        line = 1
Note: See TracChangeset for help on using the changeset viewer.