Ignore:
Timestamp:
Mar 8, 2017 9:23:16 AM (5 years ago)
Author:
vondreele
Message:

fix issues with adding new phase, forgetting to add atoms to it,
and also having a phase unused in histogram
add 'newLeBail':True to add histogram to phase so reflections get generated
also to copy Data parms (but not selected parms)
fix issue with changing atom type - caused crash in LS refinement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2732 r2750  
    667667    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    668668        GetAtomFXU(pfx,calcControls,parmDict)
     669    if not Xdata.size:          #no atoms in phase!
     670        return
    669671    if parmDict[pfx+'isMag']:
    670672        Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
     
    691693    blkSize = 100       #no. of reflections in a block - size seems optimal
    692694    nRef = refDict['RefList'].shape[0]
    693     if not len(refDict['FF']):                #no form factors - 1st time thru StructureFactor
    694         SQ = 1./(2.*refDict['RefList'].T[4])**2
    695         if 'N' in calcControls[hfx+'histType']:
    696             dat = G2el.getBLvalues(BLtables)
    697             refDict['FF']['El'] = dat.keys()
    698             refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
    699             refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
    700             for iel,El in enumerate(refDict['FF']['El']):
    701                 if El in MFtables:
    702                     refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
    703         else:       #'X'
    704             dat = G2el.getFFvalues(FFtables,0.)
    705             refDict['FF']['El'] = dat.keys()
    706             refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
    707             for iel,El in enumerate(refDict['FF']['El']):
    708                 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
     695    SQ = 1./(2.*refDict['RefList'].T[4])**2
     696    if 'N' in calcControls[hfx+'histType']:
     697        dat = G2el.getBLvalues(BLtables)
     698        refDict['FF']['El'] = dat.keys()
     699        refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
     700        refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
     701        for iel,El in enumerate(refDict['FF']['El']):
     702            if El in MFtables:
     703                refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
     704    else:       #'X'
     705        dat = G2el.getFFvalues(FFtables,0.)
     706        refDict['FF']['El'] = dat.keys()
     707        refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
     708        for iel,El in enumerate(refDict['FF']['El']):
     709            refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
    709710#reflection processing begins here - big arrays!
    710711    iBeg = 0
     
    827828    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    828829        GetAtomFXU(pfx,calcControls,parmDict)
     830    if not Xdata.size:          #no atoms in phase!
     831        return {}
    829832    mSize = len(Mdata)
    830833    FF = np.zeros(len(Tdata))
     
    983986    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    984987        GetAtomFXU(pfx,calcControls,parmDict)
     988    if not Xdata.size:          #no atoms in phase!
     989        return {}
    985990    mSize = len(Mdata)
    986991    Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
     
    10501055        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
    10511056        dqmx2 = np.sum(dqmx,axis=1)   #matrix * vector = vector
    1052         dqmx1 = np.swapaxes(np.swapaxes(np.inner(dqdm.T,dGdm.T),0,1),2,3)
     1057#        dqmx1 = np.swapaxes(np.swapaxes(np.inner(dqdm.T,dGdm.T),0,1),2,3)
    10531058        dmx = NQ*Q*dGdM[:,nxs,:,:]-Q*dqmx2                                #*Mag canceled out of dqmx term
    10541059       
     
    11331138    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    11341139        GetAtomFXU(pfx,calcControls,parmDict)
     1140    if not Xdata.size:          #no atoms in phase!
     1141        return {}
    11351142    mSize = len(Mdata)
    11361143    FF = np.zeros(len(Tdata))
     
    12931300    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    12941301        GetAtomFXU(pfx,calcControls,parmDict)
     1302    if not Xdata.size:          #no atoms in phase!
     1303        return
    12951304    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
    12961305    ngl,nWaves,Fmod,Xmod,Umod,glTau,glWt = G2mth.makeWaves(waveTypes,FSSdata,XSSdata,USSdata,Mast)
     
    13061315    blkSize = 32       #no. of reflections in a block
    13071316    nRef = refDict['RefList'].shape[0]
    1308     if not len(refDict['FF']):
    1309         SQ = 1./(2.*refDict['RefList'].T[5])**2
    1310         if 'N' in calcControls[hfx+'histType']:
    1311             dat = G2el.getBLvalues(BLtables)
    1312             refDict['FF']['El'] = dat.keys()
    1313             refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
    1314             refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
    1315             for iel,El in enumerate(refDict['FF']['El']):
    1316                 if El in MFtables:
    1317                     refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
    1318         else:
    1319             dat = G2el.getFFvalues(FFtables,0.)
    1320             refDict['FF']['El'] = dat.keys()
    1321             refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
    1322             for iel,El in enumerate(refDict['FF']['El']):
    1323                 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
     1317    SQ = 1./(2.*refDict['RefList'].T[5])**2
     1318    if 'N' in calcControls[hfx+'histType']:
     1319        dat = G2el.getBLvalues(BLtables)
     1320        refDict['FF']['El'] = dat.keys()
     1321        refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
     1322        refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
     1323        for iel,El in enumerate(refDict['FF']['El']):
     1324            if El in MFtables:
     1325                refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
     1326    else:
     1327        dat = G2el.getFFvalues(FFtables,0.)
     1328        refDict['FF']['El'] = dat.keys()
     1329        refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
     1330        for iel,El in enumerate(refDict['FF']['El']):
     1331            refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
    13241332    time0 = time.time()
    13251333#reflection processing begins here - big arrays!
     
    14201428    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    14211429        GetAtomFXU(pfx,calcControls,parmDict)
     1430    if not Xdata.size:          #no atoms in phase!
     1431        return
    14221432    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
    14231433    ngl,nWaves,Fmod,Xmod,Umod,glTau,glWt = G2mth.makeWaves(waveTypes,FSSdata,XSSdata,USSdata,Mast)
     
    15491559    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    15501560        GetAtomFXU(pfx,calcControls,parmDict)
     1561    if not Xdata.size:          #no atoms in phase!
     1562        return {}
    15511563    mSize = len(Mdata)  #no. atoms
    15521564    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
     
    17611773    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    17621774        GetAtomFXU(pfx,calcControls,parmDict)
     1775    if not Xdata.size:          #no atoms in phase!
     1776        return {}
    17631777    mSize = len(Mdata)  #no. atoms
    17641778    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
     
    19892003    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    19902004        GetAtomFXU(pfx,calcControls,parmDict)
     2005    if not Xdata.size:          #no atoms in phase!
     2006        return {}
    19912007    mSize = len(Mdata)  #no. atoms
    19922008    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
Note: See TracChangeset for help on using the changeset viewer.