Changeset 3850


Ignore:
Timestamp:
Mar 11, 2019 3:36:11 PM (3 years ago)
Author:
vondreele
Message:

replace all 0 with 0. in atom insert or add routines
incomm. mag. str fctr. calcs closer.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3848 r3850  
    13641364    if nWaves:
    13651365        modind = np.arange(nWaves)+1.
    1366         MmodA = np.sum(Bm[:,nxs,:,:]*np.cos(twopi*XYZ[:,:,nxs,:]*modind[nxs,nxs,:,nxs]*modQ[nxs,nxs,nxs,:]),axis=2) #natm,Nops,Mxyz
    1367         MmodB = np.sum(Am[:,nxs,:,:]*np.sin(twopi*XYZ[:,:,nxs,:]*modind[nxs,nxs,:,nxs]*modQ[nxs,nxs,nxs,:]),axis=2)
     1366        phase = twopi*XYZ[:,:,nxs,:]*modind[nxs,nxs,:,nxs]*modQ[nxs,nxs,nxs,:]
     1367        MmodA = np.sum(Bm[:,nxs,:,:]*np.cos(phase),axis=2) #natm,Nops,Mxyz
     1368        MmodB = np.sum(Am[:,nxs,:,:]*np.sin(phase),axis=2)
    13681369    return np.swapaxes(MmodA,0,1),np.swapaxes(MmodB,0,1)    #Nops,Natm,Mxyz
    13691370       
  • trunk/GSASIIphsGUI.py

    r3848 r3850  
    31653165        if data['General']['Type'] == 'magnetic':
    31663166            Elem = 'Fe'
    3167         AtomAdd(0,0,0,El=Elem)
     3167        AtomAdd(0.,0.,0.,El=Elem)
    31683168        FillAtomsGrid(Atoms)
    31693169        event.StopPropagation()
     
    31803180            AtomAdd(x,y,z,El=Elem)
    31813181        except:
    3182             AtomAdd(0,0,0,El=Elem)
     3182            AtomAdd(0.,0.,0.,El=Elem)
    31833183        FillAtomsGrid(Atoms)
    31843184        event.StopPropagation()
     
    32203220        indx = GetSelectedAtoms()
    32213221        for a in reversed(sorted(indx)):
    3222             AtomInsert(a,0,0,0)
     3222            AtomInsert(a,0.,0.,0.)
    32233223        event.StopPropagation()
    32243224        FillAtomsGrid(Atoms)
     
    34443444        atId = ran.randint(0,sys.maxsize)
    34453445        if generalData['Type'] == 'macromolecular':
    3446             atomData.insert(indx,[0,Name,'',Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.10,0,0,0,0,0,0,atId])
     3446            atomData.insert(indx,[0,Name,'',Name,El,'',x,y,z,1.,Sytsym,Mult,'I',0.10,0,0,0,0,0,0,atId])
    34473447        elif generalData['Type'] in ['nuclear','faulted',]:
    34483448            if generalData['Modulated']:
    3449                 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[],
     3449                atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,0.,'I',0.01,0,0,0,0,0,0,atId,[],[],
    34503450                    {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}])
    34513451            else:
    3452                 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
     3452                atomData.insert(indx,[Name,El,'',x,y,z,1.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    34533453            SetupGeneral()
    34543454        elif generalData['Type'] == 'magnetic':
    34553455            if generalData['Modulated']:
    3456                 atomData.insert(indx,[Name,El,'',x,y,z,1,0.,0.,0.,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[],
     3456                atomData.insert(indx,[Name,El,'',x,y,z,1.,0.,0.,0.,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[],
    34573457                    {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}])
    34583458            else:
    3459                 atomData.insert(indx,[Name,El,'',x,y,z,1,0.,0.,0.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
     3459                atomData.insert(indx,[Name,El,'',x,y,z,1.,0.,0.,0.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    34603460        data['Drawing']['Atoms'] = []
    34613461        UpdateDrawAtoms()
  • trunk/GSASIIstrMath.py

    r3848 r3850  
    15151515        GSdata = SGData['MagMom'][nxs,:,nxs]*GSdata   #flip vectors according to spin flip * det(opM)
    15161516        GSdata = np.swapaxes(GSdata,0,1)    #Nop,Natm,Mxyz
    1517         GSdata = np.inner(GSdata,uAmat.T)
     1517        GSdata = np.inner(GSdata,uAmat.T)   #--> cartesian
    15181518       
    15191519        mXYZ = np.array([[xyz[0] for xyz in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T])%1. #Natn,Nop,xyz
    1520         MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata)   #Re cos/Im sin,Nops,Natm,Mxyz
    1521         MmodA = np.inner(MmodA,uAmat.T)                   #make cartesian
    1522         MmodB = np.inner(MmodB,uAmat.T)
     1520#        MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata)   #Re cos/Im sin,Nops,Natm,Mxyz
     1521#        MmodA = np.inner(MmodA,uAmat.T)*SGData['SpnFlp']                   #make cartesian
     1522#        MmodB = np.inner(MmodB,uAmat.T)*SGData['SpnFlp']
     1523        MmodA = np.array(MSSdata[3:]).T         #cos Natm,Nwave,Mxyz
     1524        MmodB = np.array(MSSdata[:3]).T         #sin
    15231525       
    15241526
     
    15531555    while iBeg < nRef:
    15541556        iFin = min(iBeg+blkSize,nRef)
     1557        mRef = iFin-iBeg
    15551558        refl = refDict['RefList'][iBeg:iFin]    #array(blkSize,nItems)
    15561559        H = refl.T[:4]                          #array(blkSize,4)
     
    15951598            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/(2*Nops)     #Nref,Natm
    15961599                     
    1597             HM = np.inner(Bmat,HP.T)                             #put into cartesian space
    1598             HM = HM/np.sqrt(np.sum(HM**2,axis=0))               #Gdata = MAGS & HM = UVEC in magstrfc.for both OK
     1600            HM = np.inner(Bmat,HP.T)                            #put into cartesian space
     1601            HM = HM/np.sqrt(np.sum(HM**2,axis=0))               #& normalize
     1602#for fixed moments --> m=0 reflections                       
     1603            fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs]    #Nref,Nops,Natm,Mxyz
     1604            fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]   
    15991605                       
    1600             fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs]    #Nref,Nops,Natm,Mxyz
    1601             fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]
    1602                        
    1603             fam = TMcorr[:,nxs,:,nxs]*SGData['SpnFlp'][nxs,:,nxs,nxs]*(MmodA[nxs,:,:,:]*cosm[:,:,:,nxs]-np.sign(H[3])[:,nxs,nxs,nxs]*MmodB[nxs,:,:,:]*sinm[:,:,:,nxs])/2.
    1604             fbm = TMcorr[:,nxs,:,nxs]*SGData['SpnFlp'][nxs,:,nxs,nxs]*(MmodA[nxs,:,:,:]*sinm[:,:,:,nxs]+np.sign(H[3])[:,nxs,nxs,nxs]*MmodB[nxs,:,:,:]*cosm[:,:,:,nxs])/2.
     1606            famq0 = np.sum(np.sum(fam0,axis=-2),axis=-2)        #Nref,Mxyz; sum ops & atoms
     1607            fbmq0 = np.sum(np.sum(fbm0,axis=-2),axis=-2)
     1608           
     1609            fas0 = np.sum(famq0,axis=-1)**2-np.sum(HM.T*famq0,axis=-1)**2   #mag intensity calc F^2-(e.F)^2
     1610            fbs0 = np.sum(fbmq0,axis=-1)**2-np.sum(HM.T*fbmq0,axis=-1)**2
     1611#for modulated moments --> m != 0 reflections
     1612            M = np.array(np.abs(H[3]),dtype=np.int)-1
     1613            fam = TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(MmodA[nxs,:,M[i],:]*cosm[i,:,:,nxs]-np.sign(H[3])[i,nxs,nxs,nxs]*MmodB[nxs,:,M[i],:]*sinm[i,:,:,nxs]),0.) for i in range(mRef)])
     1614            fbm = TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(MmodA[nxs,:,M[i],:]*sinm[i,:,:,nxs]+np.sign(H[3])[i,nxs,nxs,nxs]*MmodB[nxs,:,M[i],:]*cosm[i,:,:,nxs]),0.) for i in range(mRef)])
    16051615                       
    16061616            famq = np.sum(np.sum(fam,axis=-2),axis=-2)      #Nref,Mxyz; sum ops & atoms
    16071617            fbmq = np.sum(np.sum(fbm,axis=-2),axis=-2)
    16081618           
    1609             famq0 = np.sum(np.sum(fam0,axis=-2),axis=-2)
    1610             fbmq0 = np.sum(np.sum(fbm0,axis=-2),axis=-2)
    1611            
    16121619            fas = np.sum(famq,axis=-1)**2-np.sum(HM.T*famq,axis=-1)**2      #mag intensity calc F^2-(e.F)^2
    16131620            fbs = np.sum(fbmq,axis=-1)**2-np.sum(HM.T*fbmq,axis=-1)**2
    16141621                       
    1615             fas0 = np.sum(famq0,axis=-1)**2-np.sum(HM.T*famq0,axis=-1)**2
    1616             fbs0 = np.sum(fbmq0,axis=-1)**2-np.sum(HM.T*fbmq0,axis=-1)**2
    1617 
    16181622            refl.T[10] = np.where(H[3],fas+fbs,fas0+fbs0)
    16191623            refl.T[11] = np.where(H[3],atan2d(fas,fbs),atan2d(fas0,fbs0))
Note: See TracChangeset for help on using the changeset viewer.