Changeset 2955 for branches

Show
Ignore:
Timestamp:
09/29/10 16:20:35 (20 months ago)
Author:
farhi
Message:

Single_crystal: fix definition of a,b,c vectrors when giving norms and angles: swaped XZ coordinates and AB vectors to cope with McStas coordinate frame.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/mcstas-1.x/lib/samples/Single_crystal.comp

    r2895 r2955  
    8686*           ax=3.0282, by=3.0282, cz=3.0282/2) 
    8787* 
    88 * %BUGS: 
    89 * The component is known not to work properly as a Bragg monochromator. The  
    90 * reason is likely to relate to the internal definition of reciprocal space  
    91 * orientation. Investigation undergoing.  
    92 * 
    9388* Also, always use a non-zero value of delta_d_d. 
    9489* 
     
    10398* zthick:    Thickness of crystal (no extinction simulated) [m] 
    10499* geometry:   Name of an Object File Format (OFF) file for complex geometry.  
    105 *               The OFF file may be generated from XYZ coordinates using qhull/powercrust [str] 
     100*               The OFF file may be generated from XYZ coordinates using  
     101*            qhull/powercrust [str] 
    106102* delta_d_d: Lattice spacing variance, gaussian RMS [1] 
    107 * mosaic:    Crystal mosaic (isotropic), gaussian RMS. Puts the crystal in the isotropic mosaic model state, thus disregarding other mosaicity parameters. [arc minutes] 
    108 * mosaic_a:  Horizontal (rotation around lattice vector a) mosaic (anisotropic), gaussian RMS.  
     103* mosaic:    Crystal mosaic (isotropic), gaussian RMS. Puts the crystal in the  
     104*            isotropic mosaic model state, thus disregarding other mosaicity  
     105*            parameters. [arc minutes] 
     106* mosaic_a:  Horizontal (rotation around lattice vector a) mosaic (anisotropic),  
     107*            gaussian RMS.  
    109108* Put the crystal in the anisotropic crystal vector state. I.e. model mosaicity 
    110109* through rotation around the crystal lattice vectors. Has precedence over 
    111110* in-plane mosaic model. [arc minutes] 
    112 * mosaic_b:  Vertical (rotation around lattice vector b) mosaic (anisotropic), gaussian RMS. [arc minutes] 
    113 * mosaic_c:  Out-of-plane (Rotation around lattice vector c) mosaic (anisotropic), gaussian RMS [arc minutes] 
    114 * mosaic_AB: In Plane mosaic rotation and plane vectors (anisotropic), mosaic_A, mosaic_B, A_h,A_k,A_l, B_h,B_k,B_l, input as a {}-delimited, 8-element vector. Puts the component in the in-plane mosaic state. Vectors A and B define plane in which the crystal roation is defined, and mosaic_A, mosaic_B, denotes the resp. mosaicities (gaussian RMS) with respect to the the two reflections chosen by A and B (Miller indices). [arc_minutes, arc_minutes,1, 1, 1, 1, 1, 1] 
     111* mosaic_b:  Vertical (rotation around lattice vector b) mosaic (anisotropic),  
     112*            gaussian RMS. [arc minutes] 
     113* mosaic_c:  Out-of-plane (Rotation around lattice vector c) mosaic (anisotropic),  
     114*            gaussian RMS [arc minutes] 
     115* mosaic_AB: In Plane mosaic rotation and plane vectors (anisotropic), mosaic_A, mosaic_B, 
     116*            A_h,A_k,A_l, B_h,B_k,B_l, input as a {}-delimited, 8-element vector.  
     117*            Puts the component in the in-plane mosaic state. Vectors A and B define  
     118*            plane in which the crystal roation is defined, and mosaic_A, mosaic_B,  
     119*            denotes the resp. mosaicities (gaussian RMS) with respect to the the  
     120*            two reflections chosen by A and B (Miller indices).  
     121*            [arc_minutes, arc_minutes,1, 1, 1, 1, 1, 1] 
    115122*  
    116123* recip_cell: Choice of direct/reciprocal (0/1) unit cell definition [1] 
     
    364371 
    365372    /* special cases for the structure definition */ 
    366     if (info->m_ax || info->m_ay || info->m_az) info->m_a=0; 
     373    if (info->m_ax || info->m_ay || info->m_az) info->m_a=0; /* means we specify by hand the vectors */ 
    367374    if (info->m_bx || info->m_by || info->m_bz) info->m_b=0; 
    368375    if (info->m_cx || info->m_cy || info->m_cz) info->m_c=0; 
    369376 
     377    /* compute the norm from vector a if missing */ 
    370378    if (info->m_ax || info->m_ay || info->m_az) { 
    371379      double as=sqrt(info->m_ax*info->m_ax+info->m_ay*info->m_ay+info->m_az*info->m_az); 
     
    373381      if (!info->m_cx && !info->m_cy && !info->m_cz) info->m_a=info->m_c=as; 
    374382    } 
    375  
    376383    if (info->m_a && !info->m_b) info->m_b=info->m_a; 
    377384    if (info->m_b && !info->m_c) info->m_c=info->m_b; 
    378  
     385     
     386    /* compute the lattive angles if not set from data file. Not used when in vector mode. */ 
    379387    if (info->m_a && !info->m_aa) info->m_aa=90; 
    380  
    381388    if (info->m_aa && !info->m_bb) info->m_bb=info->m_aa; 
    382389    if (info->m_bb && !info->m_cc) info->m_cc=info->m_bb; 
    383  
     390     
     391    /* parameters consistency checks */ 
    384392    if (!info->m_ax && !info->m_ay && !info->m_az && !info->m_a) { 
    385393      fprintf(stderr, 
     
    414422      else cs =  sqrt(info->m_cx*info->m_cx+info->m_cy*info->m_cy+info->m_cz*info->m_cz); 
    415423 
    416       info->m_ax = as; info->m_ay = 0; info->m_az = 0; 
    417       info->m_bx = bs*cos(info->m_cc*DEG2RAD); 
    418       info->m_by = bs*sin(info->m_cc*DEG2RAD); 
    419       info->m_bz = 0; 
    420       info->m_cx = cs*cos(info->m_bb*DEG2RAD); 
     424      info->m_bz = as; info->m_by = 0; info->m_bx = 0; 
     425      info->m_az = bs*cos(info->m_cc*DEG2RAD); 
     426      info->m_ay = bs*sin(info->m_cc*DEG2RAD); 
     427      info->m_ax = 0; 
     428      info->m_cz = cs*cos(info->m_bb*DEG2RAD); 
    421429      info->m_cy = cs*(cos(info->m_aa*DEG2RAD)-cos(info->m_cc*DEG2RAD)*cos(info->m_bb*DEG2RAD)) 
    422430                     /sin(info->m_cc*DEG2RAD); 
    423       info->m_cz = sqrt(cs*cs - info->m_cx*info->m_cx - info->m_cy*info->m_cy); 
     431      info->m_cx = sqrt(cs*cs - info->m_cz*info->m_cz - info->m_cy*info->m_cy); 
    424432 
    425433      printf("Single_crystal: %s structure a=%g b=%g c=%g aa=%g bb=%g cc=%g ",