Changeset 951 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Jun 14, 2013 2:38:20 PM (9 years ago)
Author:
vondreele
Message:

more on MC/SA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r939 r951  
    26162616    '''
    26172617
     2618    def FindPeaksBonds(XYZ):
     2619        rFact = drawingData['radiusFactor']
     2620        Bonds = [[] for x in XYZ]
     2621        for i,xyz in enumerate(XYZ):
     2622            Dx = XYZ-xyz
     2623            dist = np.sqrt(np.sum(np.inner(Dx,Amat)**2,axis=1))
     2624            IndB = ma.nonzero(ma.masked_greater(dist,rFact*2.2))
     2625            for j in IndB[0]:
     2626                Bonds[i].append(Dx[j]/2.)
     2627                Bonds[j].append(-Dx[j]/2.)
     2628        return Bonds
     2629
    26182630    ForthirdPI = 4.0*math.pi/3.0
    26192631    generalData = data['General']
     
    26242636    A4mat = np.concatenate((np.concatenate((Amat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
    26252637    B4mat = np.concatenate((np.concatenate((Bmat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0)
     2638    SGData = generalData['SGData']
    26262639    Mydir = generalData['Mydir']
    26272640    atomData = data['Atoms']
     
    26432656    MCSA = data.get('MCSA',{})
    26442657    mcsaModels = MCSA.get('Models',[])
     2658    if mcsaModels:
     2659            mcsaXYZ,atTypes = G2mth.UpdateMCSAxyz(Bmat,MCSA)
     2660            XYZeq = []
     2661            for xyz in mcsaXYZ:
     2662                XYZeq += G2spc.GenAtom(xyz,SGData)[0][1:]       #skip self xyz
     2663           
     2664            mcsaBonds = FindPeaksBonds(mcsaXYZ)       
    26452665    drawAtoms = drawingData.get('Atoms',[])
    26462666    mapData = {}
     
    26732693    ctrlDown = False
    26742694   
    2675     def FindPeaksBonds(XYZ):
    2676         rFact = drawingData['radiusFactor']
    2677         Bonds = [[] for x in XYZ]
    2678         for i,xyz in enumerate(XYZ):
    2679             Dx = XYZ-xyz
    2680             dist = np.sqrt(np.sum(np.inner(Dx,Amat)**2,axis=1))
    2681             IndB = ma.nonzero(ma.masked_greater(dist,rFact*2.2))
    2682             for j in IndB[0]:
    2683                 Bonds[i].append(Dx[j]/2.)
    2684                 Bonds[j].append(-Dx[j]/2.)
    2685         return Bonds
    2686 
    26872695    def OnKeyBox(event):
    26882696        import Image
     
    34963504                RenderLabel(x,y,z,name,0.2,Or)
    34973505        if len(mcsaModels) > 1 and pageName == 'MC/SA':             #skip the default MD entry
    3498             XYZ,atTypes = G2mth.UpdateMCSAxyz(Bmat,MCSA)
    3499             rbBonds = FindPeaksBonds(XYZ)
    3500             for ind,[x,y,z] in enumerate(XYZ):
     3506            for ind,[x,y,z] in enumerate(mcsaXYZ):
    35013507                aType = atTypes[ind]
    35023508                name = '  '+aType+str(ind)
    35033509                color = np.array(MCSA['AtInfo'][aType][1])
    35043510                RenderSphere(x,y,z,0.2,color/255.)
    3505                 RenderBonds(x,y,z,rbBonds[ind],0.03,Gr)
     3511                RenderBonds(x,y,z,mcsaBonds[ind],0.03,Gr)
    35063512                RenderLabel(x,y,z,name,0.2,Or)
    35073513        if Backbones:
Note: See TracChangeset for help on using the changeset viewer.