Changeset 4120 for trunk


Ignore:
Timestamp:
Aug 29, 2019 12:06:10 AM (6 years ago)
Author:
toby
Message:

scripting: add reflection gen; check formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIscriptable.py

    r4119 r4120  
    685685
    686686Note that the parameters must match the object type and method (phase vs. histogram vs. HAP).
     687
    687688=================================
    688689Code Examples
     
    12691270    return output, names
    12701271
     1272def GenerateReflections(spcGrp,cell,Qmax=None,dmin=None,TTmax=None,wave=None):
     1273    import GSASIIlattice as G2lat
     1274    if len(cell) != 6:
     1275        raise G2ScriptException("GenerateReflections: Invalid unit cell:" + str(cell))
     1276    opts = (Qmax is not None) + (dmin is not None) + (TTmax is not None)
     1277    if Qmax:
     1278        dmin = 2 * np.pi / Qmax
     1279        #print('Q,d',Qmax,dmin)
     1280    elif TTmax and wave is None:
     1281        raise G2ScriptException("GenerateReflections: specify a wavelength with TTmax")
     1282    elif TTmax:
     1283        dmin = wave / (2.0 * np.sin(np.pi*TTmax/360.))
     1284        #print('2theta,d',TTmax,dmin)
     1285    if opts != 1:
     1286        raise G2ScriptException("GenerateReflections: specify one Qmax, dmin or TTmax")
     1287    err,SGData = G2spc.SpcGroup(spcGrp)
     1288    if err != 0:
     1289        print('GenerateReflections space group error:',G2spc.SGErrors(err))
     1290        raise G2ScriptException("GenerateReflections: Invalid space group: " + str(spcGrp))
     1291    A = G2lat.cell2A(cell)
     1292    return G2lat.GenHLaue(dmin,SGData,A)
    12711293
    12721294class G2ImportException(Exception):
Note: See TracChangeset for help on using the changeset viewer.