Changeset 1926 for trunk/GSASIIphsGUI.py
- Timestamp:
- Jul 13, 2015 4:10:42 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r1925 r1926 1558 1558 atomData = data['Atoms'] 1559 1559 AtNames = [atom[ct-1] for atom in atomData] 1560 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]1560 AtLookUp = G2mth.FillAtomLookUp(atomData,cia+8) 1561 1561 Neigh = [] 1562 AddHydIds = [] 1562 1563 for ind in indx: 1563 1564 atom = atomData[ind] … … 1565 1566 continue 1566 1567 neigh = [atom[ct-1],G2mth.FindNeighbors(data,atom[ct-1],AtNames),0] 1567 if len(neigh[1] ) > 3 or (atom[ct] == 'O' and len(neigh[1]) > 1):1568 if len(neigh[1][0]) > 3 or (atom[ct] == 'O' and len(neigh[1][0]) > 1): 1568 1569 continue 1570 nH = 1 #for O atom 1571 if 'C' in neigh[0] or 'N' in neigh[0]: 1572 nH = 4-len(neigh[1][0]) 1573 bonds = dict(neigh[1][0]) 1574 for bond in bonds: 1575 if 'C' in neigh[0]: 1576 if 'C' in bond and bonds[bond] < 1.42: 1577 nH -= 1 1578 break 1579 elif 'O' in bond and bonds[bond] < 1.3: 1580 nH -= 1 1581 break 1582 elif 'O' in neigh[0] and 'C' in bonds and bonds[bond] < 1.3: 1583 nH -= 1 1584 break 1585 neigh[2] = max(0,nH) #set expected no. H's needed 1586 AddHydIds.append(neigh[1][1]) 1569 1587 Neigh.append(neigh) 1570 1588 if Neigh: 1571 1589 dlg = G2gd.AddHatomDialog(G2frame,Neigh,data) 1572 1590 if dlg.ShowModal() == wx.ID_OK: 1591 Nat = len(atomData) 1573 1592 Neigh = dlg.GetData() 1574 for neigh in Neigh: 1575 print neigh 1576 1593 for ineigh,neigh in enumerate(Neigh): 1594 AddHydIds[ineigh].append(neigh[2]) 1595 Hxyz = G2mth.AddHydrogens(AtLookUp,generalData,atomData,AddHydIds[ineigh]) 1596 for X in Hxyz: 1597 Nat += 1 1598 AtomAdd(X[0],X[1],X[2],'H','H(%d)'%(Nat)) 1599 1600 SetupGeneral() 1601 FillAtomsGrid(Atoms) 1577 1602 dlg.Destroy() 1603 G2plt.PlotStructure(G2frame,data) 1578 1604 else: 1579 1605 wx.MessageBox('No candidates found',caption='Add H atom Error',style=wx.ICON_EXCLAMATION)
Note: See TracChangeset
for help on using the changeset viewer.