Ignore:
Timestamp:
Jun 17, 2015 1:12:45 PM (7 years ago)
Author:
vondreele
Message:

Twins & Flack parameter can't exist together - make each exclusive
rename TwinFr?;n as TwinFr:n so constraint will work
Add a "Clear" option for fixed background points
Prevent Add, Move, Del ops. for fixed points when toolbar active

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1891 r1894  
    816816    BLtables = calcControls['BLtables']
    817817    Flack = 1.0
    818     if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType']:
     818    if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] and phfx+'Flack' in parmDict:
    819819        Flack = 1.-2.*parmDict[phfx+'Flack']
    820820    TwinLaw = np.array([[[1,0,0],[0,1,0],[0,0,1]],])
    821821    if 'S' in calcControls[hfx+'histType']:
    822822        TwinLaw = calcControls[phfx+'TwinLaw']
    823         TwinFr = np.array([parmDict[phfx+'TwinFr;'+str(i)] for i in range(len(TwinLaw))])
     823        TwinFr = np.array([parmDict[phfx+'TwinFr:'+str(i)] for i in range(len(TwinLaw))])
    824824        if len(TwinLaw) > 1:
    825825            TwinFr[0] = 1.-np.sum(TwinFr[1:])       
     
    916916    if 'S' in calcControls[hfx+'histType']:
    917917        TwinLaw = calcControls[phfx+'TwinLaw']
    918         TwinFr = np.array([parmDict[phfx+'TwinFr;'+str(i)] for i in range(len(TwinLaw))])
     918        TwinFr = np.array([parmDict[phfx+'TwinFr:'+str(i)] for i in range(len(TwinLaw))])
    919919        if len(TwinLaw) > 1:
    920920            TwinFr[0] = 1.-np.sum(TwinFr[1:])
     
    940940    dFdtw = np.zeros((nRef,nTwin))
    941941    Flack = 1.0
    942     if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType']:
     942    if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] and phfx+'Flack' in parmDict:
    943943        Flack = 1.-2.*parmDict[phfx+'Flack']
    944944    for iref,refl in enumerate(refDict['RefList']):
     
    987987            dfbdfr = np.sum(fb/occ,axis=-2)        #Fdata != 0 avoids /0. problem
    988988            dfbdba = np.sum(-sinp*Tcorr[:,np.newaxis],axis=1)
    989             dfadfl = np.sum(-FPP*Tcorr*sinp)
    990             dfbdfl = np.sum(FPP*Tcorr*cosp)
    991989            dfbdui = np.sum(-SQfactor*fb,axis=-2)
    992990            if len(TwinLaw) > 1:
     
    994992                dfbdua = np.array([np.sum(-Hij[it]*np.swapaxes(fb,-2,-1)[:,it,:,:,np.newaxis],axis=2) for it in range(nTwin)])
    995993            else:
     994                dfadfl = np.sum(-FPP*Tcorr*sinp)
     995                dfbdfl = np.sum(FPP*Tcorr*cosp)
    996996                dfbdx = np.sum(twopi*Uniq*np.swapaxes(fbx,-2,-1)[:,:,:,np.newaxis],axis=2)           
    997997                dfbdua = np.sum(-Hij*np.swapaxes(fb,-2,-1)[:,:,:,np.newaxis],axis=2)
     
    10231023                dFdui[iref] = [SA[it]*(dfadui[0][it]+dfbdui[1][it])+SB[it]*(dfbdui[0][it]+dfadui[1][it]) for it in range(nTwin)]
    10241024                dFdua[iref] = [SA[it]*(dfadua[it][0]+dfbdua[it][1])+SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)]
    1025                 dFdfl[iref] = -SA*dfadfl-SB*dfbdfl
    10261025                dFdtw[iref] = 2.*SA+2.*SB
    10271026            else:
     
    10491048            dFdvDict[pfx+'AU13:'+str(i)] = np.sum(0.5*dFdua.T[4][i]*TwinFr[:,np.newaxis],axis=0)/2.
    10501049            dFdvDict[pfx+'AU23:'+str(i)] = np.sum(0.5*dFdua.T[5][i]*TwinFr[:,np.newaxis],axis=0)/2.
    1051         dFdvDict[phfx+'Flack'] = np.sum(dFdfl*TwinFr,axis=1)    #?
    10521050    else:
    10531051        for i in range(len(Mdata)):
     
    10671065    dFdvDict[phfx+'BabU'] = dFdbab.T[1]
    10681066    if nTwin > 1:
    1069         for i in range(nTwin-1):    #skip the base twin element
    1070             dFdvDict[phfx+'TwinFr;'+str(i+1)] = dFdtw.T[i+1]
     1067        for i in range(nTwin):
     1068            dFdvDict[phfx+'TwinFr:'+str(i)] = dFdtw.T[i]
    10711069    return dFdvDict
    10721070   
Note: See TracChangeset for help on using the changeset viewer.