Changeset 1940


Ignore:
Timestamp:
Jul 21, 2015 10:44:07 AM (8 years ago)
Author:
vondreele
Message:

use atom types in H-atom add; cleanup HydId? dict when H-atoms deleted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r1939 r1940  
    15661566                    continue
    15671567                nH = 1      #for O atom
    1568                 if 'C' in neigh[0] or 'N' in neigh[0]:
     1568                if atom[ct] in ['C','N']:
    15691569                    nH = 4-len(neigh[1][0])
    15701570                bonds = {item[0]:item[1:] for item in neigh[1][0]}
     
    15731573                    nextName = bonds.keys()[0]
    15741574                for bond in bonds:
    1575                     if 'C' in neigh[0]:
     1575                    if 'C' in atom[ct]:
    15761576                        if 'C' in bond and bonds[bond][0] < 1.42:
    15771577                            nH -= 1
     
    15801580                            nH -= 1
    15811581                            break
    1582                     elif 'O' in neigh[0] and 'C' in bonds and bonds[bond][0] < 1.3:
     1582                    elif 'O' in atom[ct] and 'C' in bonds and bonds[bond][0] < 1.3:
    15831583                        nH -= 1
    15841584                        break
     
    17341734    def AtomDelete(event):
    17351735        colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]
     1736        HydIds = data['General']['HydIds']
    17361737        ci = colLabels.index('I/A')
    17371738        indx = Atoms.GetSelectedRows()
     
    17451746                    G2frame.dataFrame.SetStatusText('**** ERROR - atom is in a rigid body and can not be deleted ****')
    17461747                else:
     1748                    if atom[ci+8] in HydIds:    #remove Hs from Hatom update dict
     1749                        del HydIds[atom[ci+8]]
    17471750                    IDs.append(atom[ci+8])
    17481751                    del atomData[ind]
     
    17551758                G2plt.PlotStructure(G2frame,data)
    17561759            SetupGeneral()
     1760            if not len(HydIds):
     1761                G2frame.dataFrame.AtomEdit.Enable(G2gd.wxID_UPDATEHATOM,False)
    17571762        event.StopPropagation()
    17581763
Note: See TracChangeset for help on using the changeset viewer.