Changeset 418


Ignore:
Timestamp:
Nov 16, 2011 4:18:11 PM (10 years ago)
Author:
toby
Message:

fix compute derivs for constrained vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImapvars.py

    r417 r418  
    496496    '''
    497497    global dependentParmList,arrayList,invarrayList,indParmList,invarrayList
    498     for varlist,mapvars,multarr,invmultarr in zip(
    499         dependentParmList,indParmList,arrayList,invarrayList):
     498    for varlist,mapvars,invmultarr in zip(dependentParmList,indParmList,invarrayList):
    500499        for i,name in enumerate(mapvars):
     500            # grouped variables: need to add in the derv. w/r
     501            # dependent variables to the independent ones
    501502            if name not in varyList: continue # if independent var not varied
    502             if multarr is None:
    503                 # grouped variables need to add in the derv. w/r
    504                 # dependent variables to the dependent ones
    505                 for v,m in zip(varlist,invmultarr):
    506                     print 'add derv',v,'/',m[0],'to derv',name
    507                     if m[0] != 1 and m[0] != 0:
    508                         dMdv[varyList.index(name)] += derivDict[v]/m[0]
    509             else:
    510                 for m,v in zip(multarr[i,:],varlist):
    511                     print 'add',m,' * derv',v,'to derv',name
    512                     dMdv[varyList.index(name)] += m * derivDict[v]
     503            for m,v in zip(invmultarr[:,i],varlist):
     504                print 'add derv',v,'*',m,'to derv',name
     505                if m == 0: continue
     506                dMdv[varyList.index(name)] += m * derivDict[v]
    513507
    514508def Map2Dict(parmDict,varyList):
Note: See TracChangeset for help on using the changeset viewer.