Changeset 93


Ignore:
Timestamp:
Jun 27, 2010 10:30:16 PM (12 years ago)
Author:
toby
Message:

G2lattice: add GetBraviasNum? to interface GenHBravais to G2spc.SpcGroup? output

load test data only when needed

Makefile (etc): reorganize Makefile so that make all build targets where all sources

where all sources are provided

G2path: define a platform-specific path and prepend the bin directory if it exists; bin

is assumed to be locally built, which takes precedence over distributed files

Location:
trunk
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r78 r93  
    204204        return True
    205205                                   
     206def GetBraviasNum(center,system):
     207    '''Determine the Bravais lattice number, as used in GenHBravais
     208         center = one of: P, C, I, F, R (see SGLatt from GSASIIspc.SpcGroup)
     209         lattice = is cubic, hexagonal, tetragonal, orthorhombic, trigonal (R)
     210             monoclinic, triclinic (see SGSys from GSASIIspc.SpcGroup)
     211       Returns a number between 0 and 13
     212          or throws an exception if the setting is non-standard
     213       '''
     214    if center.upper() == 'F' and system.lower() == 'cubic':
     215        return 0
     216    elif center.upper() == 'I' and system.lower() == 'cubic':
     217        return 1
     218    elif center.upper() == 'P' and system.lower() == 'cubic':
     219        return 2
     220    elif center.upper() == 'R' and system.lower() == 'trigonal':
     221        return 3
     222    elif center.upper() == 'P' and system.lower() == 'hexagonal':
     223        return 4
     224    elif center.upper() == 'I' and system.lower() == 'tetragonal':
     225        return 5
     226    elif center.upper() == 'P' and system.lower() == 'tetragonal':
     227        return 6
     228    elif center.upper() == 'F' and system.lower() == 'orthorhombic':
     229        return 7
     230    elif center.upper() == 'I' and system.lower() == 'orthorhombic':
     231        return 8
     232    elif center.upper() == 'C' and system.lower() == 'orthorhombic':
     233        return 9
     234    elif center.upper() == 'P' and system.lower() == 'orthorhombic':
     235        return 10
     236    elif center.upper() == 'C' and system.lower() == 'monoclinic':
     237        return 11
     238    elif center.upper() == 'P' and system.lower() == 'monoclinic':
     239        return 12
     240    elif center.upper() == 'P' and system.lower() == 'triclinic':
     241        return 13
     242    raise ValueError,'non-standard Bravais lattice center=%s, cell=%s' % (center,system)
     243
    206244def GenHBravais(dmin,Bravais,A):
    207245    '''Generate the positionally unique powder diffraction reflections
    208     for a lattice and Bravais type'''
    209 # dmin - minimum d-spacing
    210 # Bravais in range(14) to indicate Bravais lattice; 0-2 cubic, 3,4 - hexagonal/trigonal,
    211 # 5,6 - tetragonal, 7-10 - orthorhombic, 11,12 - monoclinic, 13 - triclinic
     246    input:
     247       dmin is minimum d-space
     248       Bravais is 0-13 to indicate lattice type (see GetBraviasNum)
     249       A is reciprocal cell tensor (see Gmat2A or cell2A)
     250    returns:
     251       a list of tuples containing: h,k,l,d-space,-1   
     252    '''
     253# Bravais in range(14) to indicate Bravais lattice:
     254#   0 F cubic
     255#   1 I cubic
     256#   2 P cubic
     257#   3 R hexagonal (trigonal not rhombohedral)
     258#   4 P hexagonal
     259#   5 I tetragonal
     260#   6 P tetragonal
     261#   7 F orthorhombic
     262#   8 I orthorhombic
     263#   9 C orthorhombic
     264#  10 P orthorhombic
     265#  11 C monoclinic
     266#  12 P monoclinic
     267#  13 P triclinic
    212268# A - as defined in calc_rDsq
    213269# returns HKL = [h,k,l,d,0] sorted so d largest first
     
    401457   
    402458# output from uctbx computed on platform darwin on 2010-05-28
    403 array = np.array
    404 CellTestData = [
     459NeedTestData = True
     460def TestData():
     461    array = np.array
     462    global NeedTestData
     463    NeedTestData = False
     464    global CellTestData
     465    CellTestData = [
    405466# cell, g, G, cell*, V, V*
    406467  [(4, 4, 4, 90, 90, 90),
     
    424485       [  5.44217687e-02,   1.08843537e-01,   3.36690552e-18],
    425486       [  3.36690552e-18,   3.36690552e-18,   2.77777778e-02]]), (0.32991443953692895, 0.32991443953692895, 0.16666666666666669, 90.0, 90.0, 60.000000000000021), 63.652867178156257, 0.015710211406520427],
    426 ]
    427 CoordTestData = [
     487  ]
     488    global CoordTestData
     489    CoordTestData = [
    428490# cell, ((frac, ortho),...)
    429491  ((4,4,4,90,90,90,), [
     
    459521
    460522def test0():
     523    if NeedTestData: TestData()
    461524    msg = 'test cell2Gmat, fillgmat, Gmat2cell'
    462525    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    470533
    471534def test1():
     535    if NeedTestData: TestData()
    472536    msg = 'test cell2A and A2Gmat'
    473537    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    477541
    478542def test2():
     543    if NeedTestData: TestData()
    479544    msg = 'test Gmat2A, A2cell, A2Gmat, Gmat2cell'
    480545    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    484549
    485550def test3():
     551    if NeedTestData: TestData()
    486552    msg = 'test invcell2Gmat'
    487553    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    491557
    492558def test4():
     559    if NeedTestData: TestData()
    493560    msg = 'test calc_rVsq, calc_rV, calc_V'
    494561    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    497564
    498565def test5():
     566    if NeedTestData: TestData()
    499567    msg = 'test A2invcell'
    500568    for (cell, tg, tG, trcell, tV, trV) in CellTestData:
     
    503571
    504572def test6():
     573    if NeedTestData: TestData()
    505574    msg = 'test cell2AB'
    506575    for (cell,coordlist) in CoordTestData:
  • trunk/GSASIIpath.py

    r83 r93  
    44import os.path as ospath
    55import sys
     6bindir = None
    67if sys.platform == "win32":
    78    bindir = 'binwin%d.%d' % sys.version_info[0:2]
    89elif sys.platform == "darwin":
    910    bindir = 'binmac%d.%d' % sys.version_info[0:2]
    10 else:
     11elif sys.platform == "linux2":
     12    bindir = 'binlinux%d.%d' % sys.version_info[0:2]
     13if bindir:
     14    if ospath.exists(ospath.join(sys.path[0],bindir)) and ospath.join(sys.path[0],bindir) not in sys.path:
     15        sys.path.insert(0,ospath.join(sys.path[0],bindir))
     16# is there a bin directory? (created by a local compile), if so put
     17# that at the top of the path
     18if ospath.exists(ospath.join(sys.path[0],'bin')):
    1119    bindir = 'bin'
    12 if ospath.exists(ospath.join(sys.path[0],bindir)) and ospath.join(sys.path[0],bindir) not in sys.path:
    13     sys.path.insert(1,ospath.join(sys.path[0],bindir))
    14    
     20    if ospath.join(sys.path[0],'bin') not in sys.path:
     21        sys.path.insert(0,ospath.join(sys.path[0],bindir))
     22if bindir == None:
     23    print "Warning GSAS-II binary libraries not found, some sections of code will not function"
  • trunk/Makefile

    r57 r93  
    22
    33BIN = bin
    4 LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/pypowder.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX)
     4LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX)
     5LIBSwGSAS = $(BIN)/pypowder.$(SUFFIX)
    56SYMLIB := $(wildcard spsubs/*.for)
    67#----------------------------------------------------------------------
     
    1617GSASlib = /Users/toby/software/work/gsas/2009Aug31/libgsas.a
    1718COMPILER=--fcompiler=gnu95 --f90exec=/usr/local/bin/gfortran
    18 PACKCOPTS=--f77flags="-fno-range-check"
     19#PACKCOPTS=--f77flags="-fno-range-check -static-libgcc"
    1920SUFFIX=so
    2021F2PY=f2py
     
    3233
    3334ask:
     35        @echo ""
    3436        @echo "Use make all or choose a target: "
    35         @echo " $(LIBS)"
     37        @echo " $(LIBS) $(LIBSwGSAS)"
     38        @echo "   Note: target $(LIBSwGSAS) requires the GSAS object library."
     39        @echo "     This is not built with make all. You will need to edit the"
     40        @echo "     Makefile to set GSASlib to point to the correct location."
    3641
    3742all:: $(BIN) $(LIBS)
  • trunk/testinp/gensgtbx.py

    r57 r93  
    1 #!/Users/toby/build/cctbx_build/bin/python
     1#!/usr/bin/env /Users/toby/build/cctbx_build/bin/python
    22'''
    33Generate symmetry operations in cctbx.sgtbx for use in testing the
Note: See TracChangeset for help on using the changeset viewer.