Changeset 5060


Ignore:
Timestamp:
Oct 31, 2021 8:44:30 AM (2 years ago)
Author:
vondreele
Message:

finish drawing of distortion modes as user adjusted.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r5058 r5060  
    20732073    ''' Applies ISODISTORT mode displacements to drawing atoms
    20742074    '''
    2075     return
    2076     # generalData = data['General']
    2077     # cell = generalData['Cell'][1:7]
    2078     # G,g = G2lat.cell2Gmat(cell)
    2079     # SGData = generalData['SGData']
    2080     # cx,ct,cs,cia = getAtomPtrs(data)
    2081     # drawingData = data['Drawing']
    2082     # dcx,dct,dcs,dci = getAtomPtrs(data,True)
    2083     # atoms = data['Atoms']
    2084     # drawAtoms = drawingData['Atoms']
    2085     # for atom in atoms:
    2086     #     atxyz = np.array(atom[cx:cx+3])
    2087     #     indx = FindAtomIndexByIDs(drawAtoms,dci,[atom[cia+8],],True)
    2088     #     for ind in indx:
    2089     #         drawatom = drawAtoms[ind]
    2090     #         opr = drawatom[dcs-1]           
    2091     #         X = G2spc.ApplyStringOps(opr,SGData,atxyz+wave)
    2092     #         drawatom[dcx:dcx+3] = X
     2075    generalData = data['General']
     2076    Atoms= data['Atoms']
     2077    ISOdata = data['ISODISTORT']
     2078    modeDisp = np.array(ISOdata['modeDispl'])
     2079    mode2var = np.array(ISOdata['Mode2VarMatrix'])
     2080    varDisp = np.sum(mode2var*modeDisp,axis=1)
     2081    vardict = dict(zip(ISOdata['IsoVarList'],varDisp))
     2082    cell = generalData['Cell'][1:7]
     2083    G,g = G2lat.cell2Gmat(cell)
     2084    SGData = generalData['SGData']
     2085    cx,ct,cs,cia = getAtomPtrs(data)
     2086    atNames = [atm[ct-1] for atm in Atoms]
     2087    parNames = [[atName+'_dx',atName+'_dy',atName+'_dz',] for atName in atNames]
     2088    if data['Drawing']:
     2089        drawingData = data['Drawing']
     2090        dcx,dct,dcs,dci = getAtomPtrs(data,True)
     2091        atoms = data['Atoms']
     2092        drawAtoms = drawingData['Atoms']
     2093        for iat,atom in enumerate(atoms):
     2094            atxyz = np.array(atom[cx:cx+3])
     2095            displ = np.zeros(3)
     2096            for ip,parm in enumerate(parNames[iat]):
     2097                if parm in vardict:
     2098                    displ[ip] = vardict[parm]
     2099            indx = FindAtomIndexByIDs(drawAtoms,dci,[atom[cia+8],],True)
     2100            for ind in indx:
     2101                drawatom = drawAtoms[ind]
     2102                opr = drawatom[dcs-1]           
     2103                X = G2spc.ApplyStringOps(opr,SGData,atxyz+displ)
     2104                drawatom[dcx:dcx+3] = X
     2105        return None
     2106    else:
     2107        return 'Draw structure first'
    20932108
    20942109   
  • trunk/GSASIIphsGUI.py

    r5059 r5060  
    66526652            modeDisp[idsp] = (Obj.GetValue()-100)/1000.
    66536653            dispVal.SetValue(modeDisp[idsp])
    6654             G2mth.ApplyModeDisp(data)
     6654            err = G2mth.ApplyModeDisp(data)
     6655            if err:
     6656                G2G.G2MessageBox(G2frame,'Do Draw atoms first')               
    66556657            G2plt.PlotStructure(G2frame,data)
    66566658           
     
    66586660            idsp,displ = Indx[tc.GetId()]
    66596661            displ.SetValue(int(value*1000)+100)
    6660             G2mth.ApplyModeDisp(data)
     6662            err = G2mth.ApplyModeDisp(data)
     6663            if err:
     6664                G2G.G2MessageBox(G2frame,'Do Draw atoms first')               
    66616665            G2plt.PlotStructure(G2frame,data)
    66626666           
    66636667        def OnReset(event):
    66646668            data['ISODISTORT']['modeDispl'] = np.zeros(len(data['ISODISTORT']['G2ModeList']))
    6665             G2mth.ApplyModeDisp(data)
     6669            err = G2mth.ApplyModeDisp(data)
     6670            if err:
     6671                G2G.G2MessageBox(G2frame,'Do Draw atoms first')               
    66666672            G2plt.PlotStructure(G2frame,data)
    66676673            UpdateISODISTORT()                                   
     
    66786684                data['ISODISTORT']['modeDispl'] = np.zeros(len(data['ISODISTORT']['G2ModeList']))
    66796685#end patch
     6686            if ISODIST.GetSizer():
     6687                ISODIST.GetSizer().Clear(True)
    66806688            mainSizer = wx.BoxSizer(wx.VERTICAL)
    66816689            topSizer = wx.BoxSizer(wx.VERTICAL)   
Note: See TracChangeset for help on using the changeset viewer.