Changeset 1819


Ignore:
Timestamp:
Apr 29, 2015 12:22:48 PM (7 years ago)
Author:
toby
Message:

fix constraints for all test cases

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImapvars.py

    r1818 r1819  
    547547    #    and check for repeated uses (repetition of a parameter as an
    548548    #    independent var is OK [A=B; A=C], but chaining: [A=B; B=C] is not good)
    549     indepVarList = []
    550     depVarList = []
    551     multdepVarList = []
     549    dropVarList = []
    552550    translateTable = {} # lookup table for wildcard referenced variables
    553551    for varlist,mapvars,multarr,invmultarr in zip(       # process equivalences
     
    566564                if parmDict is not None and mv not in parmDict:
    567565                    print "Dropping equivalence for variable "+str(mv)+". Not defined in this refinement"
     566                    if mv not in dropVarList: dropVarList.append(mv)
    568567                    #msg += "\nCannot equivalence to variable "+str(mv)+". Not defined in this refinement"
    569568                    #continue
    570                 else:
    571                     if mv not in indepVarList: indepVarList.append(mv)
    572                 for v,m in zip(varlist,invmultarr):
    573                     if parmDict is not None and v not in parmDict:
    574                         print "Dropping equivalence for dep. variable "+str(v)+". Not defined in this refinement"
    575                         continue
    576                     if m == 0: zeromult = True
    577                     if v in varyList:
    578                         varied += 1
    579                     else:
    580                         if notvaried: notvaried += ', '
    581                         notvaried += v
    582                     if v in depVarList:
    583                         multdepVarList.append(v)
    584                     else:
    585                         depVarList.append(v)
     569            for v,m in zip(varlist,invmultarr):
     570                if parmDict is not None and v not in parmDict:
     571                    print "Dropping equivalence for dep. variable "+str(v)+". Not defined in this refinement"
     572                    if v not in dropVarList: dropVarList.append(v)
     573                    continue
     574                if m == 0: zeromult = True
     575                if v in varyList:
     576                    varied += 1
     577                else:
     578                    if notvaried: notvaried += ', '
     579                    notvaried += v
    586580            if varied > 0 and varied != len(varlist)+1:
    587581                msg += "\nNot all variables refined in equivalence:\n\t"
     
    599593                    s += str(v)           
    600594                msg += str(mv) + " => " + s + '\n'
    601     # save the lists of dep. and indep. vars (after dropping unused)
    602     global independentVars
    603     independentVars = indepVarList
    604     #print 'independentVars=',independentVars
    605     equivVarList = list(set(indepVarList).union(set(depVarList)))
    606595
    607596    # scan through parameters in each relationship. Are all varied? If only some are
     
    746735            fixedDict[fixedval] = float(fixedval)
    747736
    748     # make list of dependent variables
     737    # make list of dependent and independent variables (after dropping unused)
    749738    global dependentVars
    750     depVarList = []
    751     for varlist,mapvars,invmultarr in zip(       # process equivalences
    752         dependentParmList,indParmList,invarrayList):
    753         for i,mv in enumerate(varlist):
    754             if mv not in depVarList: depVarList.append(mv)
    755     dependentVars = depVarList
     739    global independentVars
     740    dependentVars = []
     741    independentVars = []
     742    for varlist,mapvars in zip(dependentParmList,indParmList):  # process all constraints
     743        for mv in mapvars:
     744            if mv in dropVarList: continue
     745            if mv not in independentVars: independentVars.append(mv)
     746        for mv in varlist:
     747            if mv in dropVarList: continue
     748            if mv not in dependentVars: dependentVars.append(mv)
    756749    if debug: # on debug, show what is parsed & generated, semi-readable
    757750        print 50*'-'
  • trunk/GSASIIstrMain.py

    r1818 r1819  
    179179        G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict)
    180180        #print G2mv.VarRemapShow(varyList)
     181        #print 'DependentVars',G2mv.GetDependentVars()
     182        #print 'IndependentVars',G2mv.GetIndependentVars()
    181183    except:
    182184        print ' *** ERROR - your constraints are internally inconsistent ***'
Note: See TracChangeset for help on using the changeset viewer.