Changeset 242
- Timestamp:
- Jan 26, 2011 9:38:41 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r230 r242 19 19 [ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, wxID_ATOMSEDITDELETE, wxID_ATOMSREFINE, 20 20 wxID_ATOMSMODIFY, wxID_ATOMSTRANSFORM, wxID_ATOMSTESTADD, wxID_ATONTESTINSERT, 21 ] = [wx.NewId() for _init_coll_Atom_Items in range(8)] 21 wxID_RELOADDRAWATOMS, 22 ] = [wx.NewId() for _init_coll_Atom_Items in range(9)] 22 23 23 24 [ wxID_PWDRADD, wxID_HKLFADD, wxID_DATADELETE, … … 104 105 parent.Append(id=wxID_ATOMSTRANSFORM, kind=wx.ITEM_NORMAL,text='Transform atoms', 105 106 help='Select atoms to transform first') 107 parent.Append(id=wxID_RELOADDRAWATOMS, kind=wx.ITEM_NORMAL,text='Reload draw atoms', 108 help='Reload atom drawing list') 106 109 107 110 def _init_coll_Data_Items(self,parent): -
trunk/GSASIIphsGUI.py
r230 r242 926 926 else: 927 927 Atoms.ForceRefresh() 928 929 #Structure drawing GUI stuff 928 930 929 931 def SetupDrawingData(): … … 980 982 else: 981 983 atomInfo = [atom[:2]+atom[3:6]+['1',]+['vdW balls',]+ 982 ['',]+[[255,255,255],]+atom[9:]+[[] ]][0]984 ['',]+[[255,255,255],]+atom[9:]+[[],[]]][0] 983 985 ct,cs = [1,8] #type & color 984 986 elif generalData['Type'] == 'macromolecular': … … 989 991 atomInfo = [[atom[1].strip()+atom[0],]+ 990 992 [AA1letter[oneLetter]+atom[0],]+atom[2:5]+ 991 atom[6:9]+['1',]+['sticks',]+['',]+[[255,255,255],]+atom[12:]+[[] ]][0]993 atom[6:9]+['1',]+['sticks',]+['',]+[[255,255,255],]+atom[12:]+[[],[]]][0] 992 994 ct,cs = [4,11] #type & color 993 995 elif generalData['Type'] == 'magnetic': … … 995 997 atomInfo = [atom[:2]+oldatom[3:]][0] 996 998 else: 997 atomInfo = [atom[:2]+atom[3:6]+['vdW balls',]+['',]+atom[9:]+[[] ]][0]999 atomInfo = [atom[:2]+atom[3:6]+['vdW balls',]+['',]+atom[9:]+[[],[]]][0] 998 1000 ct,cs = [1,8] #type & color 999 1001 # elif generalData['Type'] == 'modulated': … … 1553 1555 pass 1554 1556 for atom in atomData: 1555 atom[-1] = [] #clear out old bonds 1557 atom[-2] = [] #clear out old bonds/polyhedra 1558 atom[-1] = [] 1556 1559 Indx = range(len(atomData)) 1557 1560 Atoms = [] … … 1580 1583 for j in IndB[0]: 1581 1584 if Styles[i] == 'polyhedra': 1582 atomData[i][- 1].append(np.inner(Amat,Dx[j]))1585 atomData[i][-2].append(np.inner(Amat,Dx[j])) 1583 1586 elif Styles[j] != 'polyhedra' and j > i: 1584 atomData[i][-1].append(Dx[j]*Radii[i]/sumR[j]) 1585 atomData[j][-1].append(-Dx[j]*Radii[j]/sumR[j]) 1586 1587 atomData[i][-2].append(Dx[j]*Radii[i]/sumR[j]) 1588 atomData[j][-2].append(-Dx[j]*Radii[j]/sumR[j]) 1589 if Styles[i] == 'polyhedra': 1590 Bonds = atomData[i][-2] 1591 Faces = [] 1592 if len(Bonds) > 2: 1593 FaceGen = G2lat.uniqueCombinations(Bonds,3) #N.B. this is a generator 1594 for face in FaceGen: 1595 vol = nl.det(face) 1596 if abs(vol) > 1. or len(Bonds) == 3: 1597 if vol < 0.: 1598 face = [face[0],face[2],face[1]] 1599 face = np.array(face) 1600 if not np.array([np.array(nl.det(face-bond))+0.0001 < 0 for bond in Bonds]).any(): 1601 norm = np.cross(face[1]-face[0],face[2]-face[0]) 1602 norm /= np.sqrt(np.sum(norm**2)) 1603 Faces.append([face,norm]) 1604 atomData[i][-1] = Faces 1605 1587 1606 def DrawAtomsDelete(event): 1588 1607 indx = drawAtoms.GetSelectedRows() … … 1596 1615 drawAtoms.ClearSelection() 1597 1616 G2plt.PlotStructure(self,data) 1617 event.StopPropagation() 1618 1619 def OnReloadDrawAtoms(event): 1620 data['Drawing']['Atoms'] = [] 1621 UpdateDrawAtoms() 1622 drawAtoms.ClearSelection() 1623 G2plt.PlotStructure(self,data) 1598 1624 event.StopPropagation() 1599 1625 … … 2403 2429 self.dataFrame.Bind(wx.EVT_MENU, AtomModify, id=G2gd.wxID_ATOMSMODIFY) 2404 2430 self.dataFrame.Bind(wx.EVT_MENU, AtomTransform, id=G2gd.wxID_ATOMSTRANSFORM) 2431 self.dataFrame.Bind(wx.EVT_MENU, OnReloadDrawAtoms, id=G2gd.wxID_RELOADDRAWATOMS) 2405 2432 FillAtomsGrid() 2406 2433 elif text == 'General': -
trunk/GSASIIplot.py
r240 r242 1769 1769 for iat,atom in enumerate(drawingData['Atoms']): 1770 1770 x,y,z = atom[cx:cx+3] 1771 Bonds = atom[-1] 1771 Bonds = atom[-2] 1772 Faces = atom[-1] 1772 1773 try: 1773 1774 atNum = generalData['AtomTypes'].index(atom[ct]) … … 1780 1781 radius = 0.5 1781 1782 if atom[cs] != '': 1782 glLoadName(atom[- 2])1783 glLoadName(atom[-3]) 1783 1784 if 'balls' in atom[cs]: 1784 1785 vdwScale = drawingData['vdwScale'] … … 1829 1830 RenderBonds(x,y,z,Bonds,bondR,color) 1830 1831 elif atom[cs] == 'polyhedra': 1831 if len(Bonds) > 2: 1832 FaceGen = G2lat.uniqueCombinations(Bonds,3) #N.B. this is a generator 1833 Faces = [] 1834 for face in FaceGen: 1835 vol = nl.det(face) 1836 if abs(vol) > 1. or len(Bonds) == 3: 1837 if vol < 0.: 1838 face = [face[0],face[2],face[1]] 1839 norm = np.cross(face[1]-face[0],face[2]-face[0]) 1840 norm /= np.sqrt(np.sum(norm**2)) 1841 Faces.append([face,norm]) 1842 RenderPolyhedra(x,y,z,Faces,color) 1832 RenderPolyhedra(x,y,z,Faces,color) 1843 1833 elif atom[cs] == 'backbone': 1844 1834 if atom[ct-1].split()[0] in ['C','N']:
Note: See TracChangeset
for help on using the changeset viewer.