Changeset 3433 for trunk/GSASIIspc.py


Ignore:
Timestamp:
Jun 13, 2018 12:58:28 PM (5 years ago)
Author:
vondreele
Message:

objectScanIgnore additions
put in phase fro mag reflections
better checkMagextc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIspc.py

    r3425 r3433  
    2929npcosd = lambda x: np.cos(x*np.pi/180.)
    3030nxs = np.newaxis
     31twopi = 2.0*np.pi
    3132DEBUG = False
    3233   
     
    19791980def checkMagextc(HKL,SGData):
    19801981    Ops = SGData['SGOps']
    1981     Spn = SGData['SpnFlp'][:len(Ops)]
    19821982    OpM = np.array([op[0] for op in Ops])
    19831983    OpT = np.array([op[1] for op in Ops])
     1984    if SGData['SGInv']:
     1985        OpM = np.vstack((OpM,-OpM))
     1986        OpT = np.vstack((OpT,-OpT))%1.
     1987    Spn = SGData['SpnFlp'][:len(OpM)]
    19841988    Mag = np.array([nl.det(opm) for opm in OpM])*Spn
    1985     HKLS = np.array([HKL,-HKL])     #Freidel's Law
    1986     DHKL = np.reshape(np.inner(HKLS,OpM)*Mag[nxs,:,nxs],(-1,3))
    1987     PHKL = np.reshape(np.inner(HKLS,OpT),(-1,))
    1988     for dhkl,phkl in zip(DHKL,PHKL)[1:]:    #skip identity
     1989    DHKL = np.reshape(np.inner(HKL,OpM),(-1,3))
     1990    PHKL = np.reshape(np.cos(twopi*np.inner(HKL,OpT))*Mag,(-1,))[:,nxs,nxs]*OpM
     1991    Ftest = np.random.rand(3)
     1992    Psum = np.zeros(3)
     1993    for dhkl,phkl in zip(DHKL,PHKL):
    19891994        if not np.allclose(dhkl,HKL):
    19901995            continue
    19911996        else:
    1992             print(dhkl,HKL,phkl)
    1993             if phkl%1.:
    1994                 return False
    1995     return True
     1997            Psum += np.inner(Ftest,phkl)
     1998    if np.allclose(Psum,np.zeros(3)):
     1999        return False
     2000    else:
     2001        if np.inner(HKL,Psum):
     2002            return False
     2003        return True
    19962004   
    19972005def checkSSextc(HKL,SSGData):
Note: See TracChangeset for help on using the changeset viewer.