Changeset 951 for trunk/GSASIIplot.py
- Timestamp:
- Jun 14, 2013 2:38:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r939 r951 2616 2616 ''' 2617 2617 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 2618 2630 ForthirdPI = 4.0*math.pi/3.0 2619 2631 generalData = data['General'] … … 2624 2636 A4mat = np.concatenate((np.concatenate((Amat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0) 2625 2637 B4mat = np.concatenate((np.concatenate((Bmat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0) 2638 SGData = generalData['SGData'] 2626 2639 Mydir = generalData['Mydir'] 2627 2640 atomData = data['Atoms'] … … 2643 2656 MCSA = data.get('MCSA',{}) 2644 2657 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) 2645 2665 drawAtoms = drawingData.get('Atoms',[]) 2646 2666 mapData = {} … … 2673 2693 ctrlDown = False 2674 2694 2675 def FindPeaksBonds(XYZ):2676 rFact = drawingData['radiusFactor']2677 Bonds = [[] for x in XYZ]2678 for i,xyz in enumerate(XYZ):2679 Dx = XYZ-xyz2680 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 Bonds2686 2687 2695 def OnKeyBox(event): 2688 2696 import Image … … 3496 3504 RenderLabel(x,y,z,name,0.2,Or) 3497 3505 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): 3501 3507 aType = atTypes[ind] 3502 3508 name = ' '+aType+str(ind) 3503 3509 color = np.array(MCSA['AtInfo'][aType][1]) 3504 3510 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) 3506 3512 RenderLabel(x,y,z,name,0.2,Or) 3507 3513 if Backbones:
Note: See TracChangeset
for help on using the changeset viewer.