Changeset 1927 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Jul 14, 2015 3:55:03 PM (8 years ago)
Author:
vondreele
Message:

more hydrogen add work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r1926 r1927  
    15721572                    nH = 4-len(neigh[1][0])
    15731573                bonds = dict(neigh[1][0])
     1574                nextName = ''
     1575                if len(bonds) == 1:
     1576                    nextName = bonds.keys()[0]
    15741577                for bond in bonds:
    15751578                    if 'C' in neigh[0]:
     
    15831586                        nH -= 1
    15841587                        break
     1588                nextneigh = []
     1589                if nextName:
     1590                    nextneigh = G2mth.FindNeighbors(data,nextName,AtNames,notName=neigh[0])
     1591                    neigh[1][1].append(nextneigh[1][1][0])
    15851592                neigh[2] = max(0,nH)  #set expected no. H's needed
    15861593                AddHydIds.append(neigh[1][1])
     
    15911598                    Nat = len(atomData)
    15921599                    Neigh = dlg.GetData()
    1593                     for ineigh,neigh in enumerate(Neigh):
     1600                    mapData = generalData['Map']
     1601                    mapError = False
     1602                    for ineigh,neigh in enumerate(Neigh):                       
    15941603                        AddHydIds[ineigh].append(neigh[2])
     1604                        if 'O' in neigh[0] and not len(mapData['rho']) or not 'delt-F' in mapData['MapType']:
     1605                            mapError = True
     1606                            continue                           
    15951607                        Hxyz = G2mth.AddHydrogens(AtLookUp,generalData,atomData,AddHydIds[ineigh])
    15961608                        for X in Hxyz:
    15971609                            Nat += 1
    15981610                            AtomAdd(X[0],X[1],X[2],'H','H(%d)'%(Nat))
    1599 
     1611                if mapError:
     1612                    G2frame.ErrorDialog('Add H atom error','Adding O-H atoms requires delt-F map')
    16001613                SetupGeneral()
    16011614                FillAtomsGrid(Atoms)
Note: See TracChangeset for help on using the changeset viewer.