Changeset 2206


Ignore:
Timestamp:
Apr 11, 2016 4:27:22 PM (7 years ago)
Author:
vondreele
Message:

find errors in stacking fortran - replace both binwin directories
principal problem - transition probability matrix transposed in G2pwd
& HW needed to be sqrt(HW)
setup a debug mode for stacking fault stuff
G2plot - comment if page.Context lines - caused problems

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2205 r2206  
    29792979       
    29802980    def OnSimulate(event):
     2981        debug = False
     2982        idebug = 0
     2983        if debug: idebug = 1
    29812984        ctrls = ''
    29822985        dlg = G2gd.DIFFaXcontrols(G2frame,ctrls)
     
    30163019                return           
    30173020            profile = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1]
    3018             ctrls = '0\n0\n3\n'
    3019             G2pwd.StackSim(data['Layers'],ctrls,scale,background,limits,inst,profile)
    3020             test1 = np.copy(profile[3])
    3021             test1 = np.where(test1,test1,1.0)
    3022             G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile)
    3023             test2 = np.copy(profile[3])
    3024             rat = (test1-test2)/test1
    3025             XY = np.vstack((profile[0],rat))
    3026             G2plt.PlotXY(G2frame,[XY,],XY2=[],labelX=r'$\mathsf{2\theta}$',
    3027                 labelY='ratio',newPlot=True,Title='DIFFaX vs GSASII',lines=True)
     3021            G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile,debug)
     3022            if debug:
     3023                ctrls = '0\n%d\n3\n'%(idebug)
     3024                G2pwd.StackSim(data['Layers'],ctrls,scale,background,limits,inst,profile)
     3025                test1 = np.copy(profile[3])
     3026                test1 = np.where(test1,test1,1.0)
     3027                G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile,debug)
     3028                test2 = np.copy(profile[3])
     3029                rat = test1-test2
     3030                XY = np.vstack((profile[0],rat))
     3031                G2plt.PlotXY(G2frame,[XY,],XY2=[],labelX=r'$\mathsf{2\theta}$',
     3032                    labelY='ratio',newPlot=True,Title='DIFFaX vs GSASII',lines=True)
    30283033#            GSASIIpath.IPyBreak()
    30293034            G2plt.PlotPatterns(G2frame,plotType='PWDR')
     
    30343039            planeChoice = ['h0l','0kl','hhl','h-hl',]
    30353040            lmaxChoice = [str(i+1) for i in range(6)]
    3036             ctrls = '0\n0\n4\n1\n%d\n1\n16\n1\n%d\n0\nend\n'%    \
    3037                 (planeChoice.index(simCodes[1])+1,lmaxChoice.index(simCodes[2])+1)
     3041            ctrls = '0\n%d\n4\n1\n%d\n%d\n16\n1\n1\n0\nend\n'%    \
     3042                (idebug,planeChoice.index(simCodes[1])+1,lmaxChoice.index(simCodes[2])+1)
    30383043            G2pwd.StackSim(data['Layers'],ctrls)
    3039             G2pwd.CalcStackingSADP(data['Layers'])
     3044            G2pwd.CalcStackingSADP(data['Layers'],debug)
    30403045        wx.CallAfter(UpdateLayerData)
    30413046       
  • trunk/GSASIIplot.py

    r2205 r2206  
    11131113        RenderDots(HKL,RC)
    11141114        time0 = time.time()
    1115         if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
     1115#        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    11161116        Page.canvas.SwapBuffers()
    11171117
     
    56255625                RenderBackbone(Backbone,BackboneColor,bondR)
    56265626#        print time.time()-time0
    5627         if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
     5627#        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    56285628        Page.canvas.SwapBuffers()
    56295629       
     
    59325932            RenderBonds(x,y,z,Bonds[iat],0.05,color)
    59335933            RenderLabel(x,y,z,'  '+atNames[iat],matRot)
    5934         if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
     5934#        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    59355935        Page.canvas.SwapBuffers()
    59365936
     
    63166316            if Page.labels:
    63176317                RenderLabel(x,y,z,'  '+AtNames[iat],matRot)
    6318         if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
     6318#        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    63196319        Page.canvas.SwapBuffers()
    63206320
  • trunk/GSASIIpwd.py

    r2197 r2206  
    18161816    #make DIFFaX control.dif file - future use GUI to set some of these flags
    18171817    cf = open('control.dif','w')
    1818     if ctrls == '0\n0\n3\n':
     1818    if ctrls == '0\n0\n3\n' or ctrls == '0\n1\n3\n':
    18191819        x0 = profile[0]
    18201820        iBeg = np.searchsorted(x0,limits[0])
     
    18361836    elif 'N' in inst['Type'][0]:
    18371837        df.write('NEUTRON\n')
    1838     if ctrls == '0\n0\n3\n':
     1838    if ctrls == '0\n0\n3\n' or ctrls == '0\n1\n3\n':
    18391839        df.write('%.4f\n'%(G2mth.getMeanWave(inst)))
    18401840        U = ateln2*inst['U'][1]/10000.
     
    19631963    return iFin-iBeg
    19641964       
    1965 def SetStackingSF(Layers):
     1965def SetStackingSF(Layers,debug):
    19661966# Load scattering factors into DIFFaX arrays
    19671967    import atmdata
     
    19831983        SFdat.append(SF)
    19841984    SFdat = np.array(SFdat)
    1985     pyx.pyloadscf(len(atTypes),aTypes,SFdat.T)
     1985    pyx.pyloadscf(len(atTypes),aTypes,SFdat.T,debug)
    19861986   
    19871987def SetStackingClay(Layers,Type):
     
    20632063        TransP.append([trans[0] for trans in Ytrans])   #get just the numbers
    20642064        TransX.append([trans[1:4] for trans in Ytrans])   #get just the numbers
    2065     TransP = np.array(TransP,dtype='float')
     2065    TransP = np.array(TransP,dtype='float').T
    20662066    TransX = np.array(TransX,dtype='float')
     2067#    GSASIIpath.IPyBreak()
    20672068    pyx.pygettrans(Nlayers,TransP,TransX)
    20682069   
    2069 def CalcStackingPWDR(Layers,scale,background,limits,inst,profile):
     2070def CalcStackingPWDR(Layers,scale,background,limits,inst,profile,debug):
    20702071# Scattering factors
    2071     SetStackingSF(Layers)
     2072    SetStackingSF(Layers,debug)
    20722073# Controls & sequences
    20732074    laueId,controls = SetStackingClay(Layers,'PWDR')
     
    20942095    W = ateln2*inst['W'][1]/10000.
    20952096    HWHM = U*nptand(x0[iBeg:iFin]/2.)**2+V*nptand(x0[iBeg:iFin]/2.)+W
    2096     HW = np.mean(HWHM)
     2097    HW = np.sqrt(np.mean(HWHM))
    20972098    BrdSpec = np.zeros(Nsteps)
    20982099    if 'Mean' in Layers['selInst']:
     
    21172118    print ' Broadening time = %.2fs'%(time.time()-time0)
    21182119   
    2119    
    2120 #    GSASIIpath.IPyBreak()
    2121    
    2122 def CalcStackingSADP(Layers):
     2120def CalcStackingSADP(Layers,debug):
    21232121   
    21242122# Scattering factors
    2125     SetStackingSF(Layers)
     2123    SetStackingSF(Layers,debug)
    21262124# Controls & sequences
    21272125    laueId,controls = SetStackingClay(Layers,'SADP')
  • trunk/fsource/pydiffax.for

    r2197 r2206  
    1       SUBROUTINE PYLOADSCF(NATP,ATYPES,SFDAT)
     1      SUBROUTINE PYLOADSCF(NATP,ATYPES,SFDAT,DEBG)
    22       
    33Cf2py intent(in) NATP
     
    55Cf2py intent(in) SFDAT
    66cf2py depend(NATP) ATYPES,SFDAT
     7cf2py intent(in) DEBG
    78           
    89      INCLUDE 'DIFFaXsubs/DIFFaX.par'
     
    1213      CHARACTER*4 ATYPES(NATP)
    1314      REAL*4  SFDAT(9,NATP)
     15      LOGICAL DEBG
    1416               
    1517C fill common x-ray scattering factors
    16       debug = .FALSE.
     18      debug = DEBG
    1719      DO J=1,NATP
    1820        WRITE(atom_l(J),'(A4)') ATYPES(J)
     
    195197          l_alpha(J,I) = TRP(I,J)
    196198          DO K=1,3
    197             l_r(K,J,I) = TRX(I,J,K)
     199            l_r(K,J,I) = TRX(J,I,K)
    198200          END DO
    199201        END DO
     
    218220      EXTERNAL AGLQ16,GETSPC
    219221
    220 
    221 C      print *,n_actual,(l_n_atoms(i),i=1,n_actual)
    222 C      do j=1,n_actual
    223 C        do i=1,l_n_atoms(j)
    224 C          print *,a_name(i,j),(a_pos(k,i,j),k=1,3)
    225 C        end do
    226 C      end do
    227 c      print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror
    228 C      do i=1,n_layers
    229 C      print *,' layer',i
    230 C         do j=1,n_layers
    231 C            print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3)
    232 C         end do
    233 C      end do
    234 c      print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo
    235 c      DoSymDump = .TRUE.
     222      DoSymDump = .FALSE.
    236223   
    237224      ok = .TRUE.
     
    239226      CALL DETUN()
    240227      CALL OPTIMZ('GSAS-II',ok)
     228      If (debug) then
     229        print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo
     230        DoSymDump = .TRUE.
     231        print *,n_actual,(l_n_atoms(i),i=1,n_actual)
     232        do j=1,n_actual
     233          do i=1,l_n_atoms(j)
     234            print *,a_name(i,j),(a_pos(k,i,j),k=1,3)
     235          end do
     236        end do
     237        do i=1,n_layers
     238        print *,' layer',i
     239           do j=1,n_layers
     240              print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3)
     241           end do
     242        end do
     243        print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror
     244      end if
    241245       
    242246C      print *,lambda,max_angle,h_bnd,k_bnd,l_bnd,no_trials,
     
    314318      i_plane = CNTRLS(2)
    315319      l_upper = CNTRLS(3)
    316 C      print *,n_actual,(l_n_atoms(i),i=1,n_actual)
    317 C      do j=1,n_actual
    318 C        do i=1,l_n_atoms(j)
    319 C          print *,a_name(i,j),(a_pos(k,i,j),k=1,3)
    320 C        end do
    321 C      end do
    322 c      print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror
    323 C      do i=1,n_layers
    324 C      print *,' layer',i
    325 C         do j=1,n_layers
    326 C            print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3)
    327 C         end do
    328 C      end do
     320      DoSymDump = .FALSE.
     321      if (debug) then
     322          print *,cell_a,cell_b,cell_c,cell_gamma
     323          print *,pnt_grp,SymGrpNo
     324          DoSymDump = .TRUE.
     325          print *,n_actual,(l_n_atoms(i),i=1,n_actual)
     326          do j=1,n_actual
     327            do i=1,l_n_atoms(j)
     328              print *,a_name(i,j),(a_pos(k,i,j),k=1,3)
     329            end do
     330          end do
     331          do i=1,n_layers
     332          print *,' layer',i
     333             do j=1,n_layers
     334                print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3)
     335             end do
     336          end do
     337          print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror
     338      end if
    329339      ok = .TRUE.
    330340       
    331 c      print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo
    332 c      DoSymDump = .TRUE.
    333341      CALL SPHCST()
    334342      CALL DETUN()
Note: See TracChangeset for help on using the changeset viewer.