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

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

File:
1 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.
Note: See TracChangeset for help on using the changeset viewer.