Changeset 3790


Ignore:
Timestamp:
Jan 19, 2019 9:42:46 PM (3 years ago)
Author:
toby
Message:

make sure off-diagonal terms that must compute as 0 are fixed

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r3789 r3790  
    14111411           
    14121412        #how do I do Uij's for most Trans?
    1413        
     1413
     1414    # constraints on lattice parameters between phases
    14141415    T = nl.inv(Trans).T
    14151416    conMat = [
     
    14371438    # Gnew = (Tr.T*G)*Tr
    14381439   
     1440    #print('old A',G2lat.cell2A(oldPhase['General']['Cell'][1:7]))
     1441    #print('new A',G2lat.cell2A(newPhase['General']['Cell'][1:7]))
    14391442    for iAnew,Asi in enumerate(['A0','A1','A2','A3','A4','A5']): # loop through A[i] for new cell
    14401443        Nparm = str(npId) + '::' + Asi
    1441         if Nparm != SetUniqAj(npId,iAnew,nSGData): continue # skip if already constrainted
     1444        if Nparm != SetUniqAj(npId,iAnew,nSGData):
     1445            continue # skip: Ai constrained from Aj or must be zero
    14421446        multDict = {}
    14431447        for iAorg in range(6):
     
    14451449            if abs(cA) < 1.e-8: continue
    14461450            parm = SetUniqAj(opId,iAorg,oSGData) # translate to unique A[i] in original cell
    1447             if not parm: continue
     1451            if not parm: continue # must be zero
    14481452            # sum coeff
    14491453            if parm in multDict:
     
    14551459        for i in multDict:
    14561460            maxMult = max(maxMult,abs(multDict[i]))
    1457         if maxMult <= 0: continue
    1458            
    1459         # create constraint (if needed) or equivalence
    1460         if len(multDict) == 1:
     1461        if maxMult <= 0:  # Nparm computes as zero; Fix this parameter
     1462            constraints['Phase'] += [[
     1463                [0.0,G2obj.G2VarObj(Nparm)],
     1464                None,None,'h']]
     1465        elif len(multDict) == 1:        # create equivalence
    14611466            key = list(multDict.keys())[0]
    1462             constr = [
     1467            constraints['Phase'] += [[
    14631468                [1.0,G2obj.G2VarObj(key)],
    14641469                [multDict[key],G2obj.G2VarObj(Nparm)],
    1465                 None,None,'e']
    1466         else:
     1470                None,None,'e']]
     1471        else:                           # create constraint
    14671472            constr = [[-1.0,G2obj.G2VarObj(Nparm)]]
    14681473            for key in multDict:
    14691474                constr += [[multDict[key],G2obj.G2VarObj(key)]]
    14701475            constr += [0.0,None,'c']
    1471         constraints['Phase'] += [constr]
     1476            constraints['Phase'] += [constr]
    14721477   
    14731478    # constraints on HAP Scale, etc.
  • trunk/GSASIIdataGUI.py

    r3783 r3790  
    38363836        self.HKL = []
    38373837        item, cookie = self.GPXtree.GetFirstChild(self.root)
    3838         while item and not Id:
     3838        while item:
    38393839            name = self.GPXtree.GetItemText(item)
    38403840            if name[:4] in ['PWDR','HKLF','IMG ','PDF ','SASD','REFD']:
    3841                 Id = item
     3841                if not Id: Id = item
    38423842            elif name == "Phases":
    38433843                phaseId = item
Note: See TracChangeset for help on using the changeset viewer.