Changeset 4882
- Timestamp:
- Apr 13, 2021 7:08:28 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIstrIO.py
r4868 r4882 1899 1899 1900 1900 def getCellEsd(pfx,SGData,A,covData): 1901 'needs a doc string' 1901 '''Compute the standard uncertainty on cell parameters 1902 1903 :param str pfx: prefix of form p:: 1904 :param SGdata: space group information 1905 :param list A: Reciprocal cell Ai terms 1906 :param dict covData: covariance tree item 1907 ''' 1902 1908 rVsq = G2lat.calc_rVsq(A) 1903 1909 G,g = G2lat.A2Gmat(A) #get recip. & real metric tensors … … 1953 1959 CS[3:6] = 0.0 1954 1960 return [CS[0],CS[1],CS[2],CS[5],CS[4],CS[3],sigVol] 1955 1961 1962 def getCellSU(pId,hId,SGData,parmDict,covData): 1963 '''Compute the unit cell parameters and standard uncertainties 1964 where lattice parameters and Hstrain (Dij) may be refined 1965 1966 :param pId: phase index 1967 :param hId: histogram index 1968 :param SGdata: space group information 1969 :param dict parmDict: parameter dict, must have all non-zero Dij and Ai terms 1970 :param dict covData: covariance tree item 1971 ''' 1972 1973 Dnames = ['{}:{}:D{}'.format(pId,hId,i) for i in ['11','22','33','12','13','23']] 1974 Anames = ['{}::A{}'.format(pId,i) for i in range(6)] 1975 Ai = [parmDict[i] for i in Anames] 1976 Dij = [parmDict.get(i,0.) for i in Dnames] 1977 A = np.array(Ai) + np.array(Dij) 1978 cell = list(G2lat.A2cell(A)) + [G2lat.calc_V(A)] 1979 rVsq = G2lat.calc_rVsq(A) 1980 G,g = G2lat.A2Gmat(A) #get recip. & real metric tensors 1981 varyList = covData['varyList'] 1982 covMatrix = covData['covMatrix'] 1983 if len(covMatrix): 1984 vcov = G2mth.getVCov(Anames+Dnames,varyList,covMatrix) 1985 for i in [0,6]: 1986 for j in [0,6]: 1987 if SGData['SGLaue'] in ['3', '3m1', '31m', '6/m', '6/mmm']: 1988 vcov[1+i,1+j] = vcov[3+i,3+j] = vcov[i,1+j] = vcov[1+i,j] = vcov[i,j] 1989 vcov[1+i,3+j] = vcov[3+i,1+j] = vcov[i,3+j] = vcov[3+i,j] = vcov[i,j] 1990 vcov[1+i,2+j] = vcov[2+i,1+j] = vcov[2+i,3+j] = vcov[3+i,2+j] = vcov[i,2+j] 1991 elif SGData['SGLaue'] in ['m3','m3m']: 1992 vcov[i:3+i,j:3+j] = vcov[i,j] 1993 elif SGData['SGLaue'] in ['4/m', '4/mmm']: 1994 vcov[i:2+i,j:2+j] = vcov[i,j] 1995 vcov[1+i,2+j] = vcov[2+i,1+j] = vcov[i,2+j] 1996 elif SGData['SGLaue'] in ['3R','3mR']: 1997 vcov[i:3+j,i:3+j] = vcov[i,j] 1998 # vcov[4,4] = vcov[5,5] = vcov[3,3] 1999 vcov[3+i:6+i,3+j:6+j] = vcov[3,3+j] 2000 vcov[i:3+i,3+j:6+j] = vcov[i,3+j] 2001 vcov[3+i:6+i,j:3+j] = vcov[3+i,j] 2002 else: 2003 vcov = np.eye(12) 2004 delt = 1.e-9 2005 drVdA = np.zeros(12) 2006 for i in range(12): 2007 A[i%6] += delt 2008 drVdA[i] = G2lat.calc_rVsq(A) 2009 A[i%6] -= 2*delt 2010 drVdA[i] -= G2lat.calc_rVsq(A) 2011 A[i%6] += delt 2012 drVdA /= 2.*delt 2013 srcvlsq = np.inner(drVdA,np.inner(drVdA,vcov)) 2014 Vol = 1/np.sqrt(rVsq) 2015 sigVol = Vol**3*np.sqrt(srcvlsq)/2. #ok - checks with GSAS 2016 2017 dcdA = np.zeros((12,12)) 2018 for i in range(12): 2019 pdcdA =np.zeros(12) 2020 A[i%6] += delt 2021 pdcdA += G2lat.A2cell(A)+G2lat.A2cell(A) 2022 A[i%6] -= 2*delt 2023 pdcdA -= G2lat.A2cell(A)+G2lat.A2cell(A) 2024 A[i%6] += delt 2025 dcdA[i] = pdcdA/(2.*delt) 2026 sigMat = np.inner(dcdA,np.inner(dcdA,vcov)) 2027 var = np.diag(sigMat) 2028 CS = np.where(var>0.,np.sqrt(var),0.) 2029 if SGData['SGLaue'] in ['3', '3m1', '31m', '6/m', '6/mmm','m3','m3m','4/m','4/mmm']: 2030 CS[3:6] = 0.0 2031 return cell,[CS[0],CS[1],CS[2],CS[5],CS[4],CS[3],sigVol] 2032 1956 2033 def SetPhaseData(parmDict,sigDict,Phases,RBIds,covData,RestraintDict=None,pFile=None): 1957 2034 '''Called after a refinement to transfer parameters from the parameter dict to -
trunk/docs/source/index.rst
r4880 r4882 5 5 ================================= 6 6 7 The following documentation is intended for those wishing to code 8 withing the GSAS-II framework, those planning to understand how 7 The documentation here is intended for those wishing to extend the 8 capabilities within the GSAS-II framework, for scientists/students 9 working to understand how 9 10 GSAS-II works, or for people wishing to develop scripting applications 10 using the API (:mod:`GSASIIscriptable`). Note that many data structures11 used in GSAS-II are defined in module :mod:`GSASIIobj`.11 using the GSAS-II Python API (module :mod:`GSASIIscriptable`). Note that many 12 data structures used in GSAS-II are defined in module :mod:`GSASIIobj`. 12 13 13 For information on obtaining or learning to use GSAS-II, please see 14 the information on the GSAS-II home page: 15 https://subversion.xray.aps.anl.gov/trac/pyGSAS 16 and pages referenced there. 17 14 For information on downloading/installing GSAS-II, please see 15 the GSAS-II home page: 16 https://subversion.xray.aps.anl.gov/trac/pyGSAS. To learn how to 17 use GSAS-II, please see the tutorials referenced in the home page. 18 18 19 19 .. toctree::
Note: See TracChangeset
for help on using the changeset viewer.