home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / splot122.zip / DEMO / INVISAX.SPT < prev    next >
Text File  |  1994-06-06  |  5KB  |  196 lines

  1. /* This example shows how invisible axes can be used to establish */
  2. /* an alternate coordinate system and still use the drawdata function */
  3. /* to draw the curves */
  4.  
  5. /*draws quantum wells and wave functions */
  6. #include <splot.h>
  7. double *data1;
  8. double *data2;
  9. double *data3;
  10. double *data4;
  11. double *data5;
  12. main() 
  13.    {     
  14.    set(LINECOLOUR,INVIS);
  15.    set(FONTWIDTH,0.6);
  16.    set(FONTASPECT,1.4);
  17.    set(LINEWIDTH,0.02);
  18.    /* read in data generated by Mathematica */
  19.    readdata("demo\cdqw_wfc.dat",data1);
  20.    readdata("demo\cdqw_wfc.da2",data2);
  21.    readdata("demo\cdqw_wfc.da3",data3);
  22.    readdata("demo\cdqw_wfc.da4",data4);
  23.    readdata("demo\cdqw_wfc.da5",data5);
  24.    /* drawing turned out too big so reduce the overall size */
  25.    scale(0.7,0.65);
  26.    gsave();
  27.    axes_box(8,15,-185,0.0,185,188.36);
  28.    set(LINECOLOUR,BLACK);
  29.    translate(-1.25,22.5);
  30.    /* even solns to cdqw */
  31.    /*   norm = 1.0/0.00009134 * 60.0; */ 
  32.    set(YMULT,656886.);
  33.    set(YSHIFT,9.13863);
  34.    drawdata(data1);
  35.    /*   norm = 1/.0002838 * 60.0;  */
  36.    set(YMULT,211416.);
  37.    set(YSHIFT,35.8858);
  38.    drawdata(data1,0,3);
  39.    /*   norm = 1/0.008109 * 60.0;*/
  40.    set(YMULT,7400.);
  41.    set(YSHIFT,77.0532);
  42.    drawdata(data3);
  43.    /* call subroutine to draw quantum well. Also sets coordinate scale to match*/
  44.    s_qw_box();
  45.    /* energy eigenvalues */
  46.    moveto(-190,9.13863);
  47.    lineto(190,9.13863);
  48.    moveto(-190,35.8858);
  49.    lineto(190,35.8858);
  50.    moveto(-190,77.0532);
  51.    lineto(190,77.0532);
  52.    stroke();
  53.    text(205,9.13863,"E_0_");
  54.    text(205,35.8858,"E_2_");
  55.    text(205,77.0532,"E_4_");
  56.    text(0,-15,"a) CDQW, even solutions",CENTER);
  57.    grestore();
  58.    /* odd solns to cdqw */
  59.    set(LINECOLOUR,INVIS);
  60.    gsave();
  61.    axes_box(8,15,-185,0.0,185,188.36);
  62.    set(LINECOLOUR,BLACK);
  63.    translate(11,22.5);
  64.    set(YMULT,656886.);
  65.    set(YSHIFT,9.14186);
  66.    drawdata(data1,0,2);
  67.    set(YMULT,211416.);
  68.    set(YSHIFT,35.9177);
  69.    drawdata(data1,0,4);
  70.    set(YMULT,7400.);
  71.    set(YSHIFT,77.4394);
  72.    drawdata(data3,0,2);
  73.    s_qw_box();
  74.    /* energy eigenvalues */
  75.    moveto(-190,9.14186);
  76.    lineto(190,9.14186);
  77.    moveto(-190,35.9177);
  78.    lineto(190,35.9177);
  79.    moveto(-190,77.4394);
  80.    lineto(190,77.4394);
  81.    stroke();
  82.    text(-227,9.14186,"E_1_");
  83.    text(-227,35.9177,"E_3_");
  84.    text(-227,77.4394,"E_5_");
  85.    text(217.,53.,"107meV",CENTER);
  86.    text(0,120,"9 nm",CENTER);
  87.    text(0,-15,"b) CDQW, odd solutions",CENTER);
  88.    grestore();
  89.    /*asymmetric coupled wells */
  90.    set(LINECOLOUR,INVIS);
  91.    gsave();
  92.    axes_box(8,15,-185,0.0,185,188.36);
  93.    set(LINECOLOUR,BLACK);
  94.    translate(5.5,2.5);
  95.    set(YMULT,1000.);
  96.    set(YSHIFT,90.23);
  97.    set(XSHIFT,-95.);
  98.    drawdata(data4,0,2);
  99.    a_qw_box();
  100.    moveto(-195,90.23);
  101.    lineto(190,90.23);
  102.    stroke();
  103.    text(215,90.23,"E_2_",CENTER);
  104.    text(280,90.23,"Resonance");
  105.    text(-270.,104.,"188 meV",CENTER);
  106.    grestore();   
  107.    set(LINECOLOUR,INVIS);
  108.    gsave();
  109.    axes_box(8,15,-185,0.0,185,188.36);
  110.    set(LINECOLOUR,BLACK);
  111.    translate(5.5,2.5);
  112.    set(XSHIFT,-95.);
  113.    set(YMULT,-80.0);
  114.    set(YSHIFT,10.29);
  115.    drawdata(data5);
  116.    set(YMULT,-80.0);
  117.    set(YSHIFT,40.81);
  118.    drawdata(data5,0,2);
  119.    set(YMULT,-275.0);
  120.    set(YSHIFT,154.16);
  121.    drawdata(data5,0,3);
  122.    set(YSHIFT,116.97);
  123.    set(YMULT,500.0);
  124.    a_qw_box(); 
  125.    moveto(-190,10.29);
  126.    lineto(190,10.29);
  127.    moveto(-190,40.81);
  128.    lineto(190,40.81);
  129.    moveto(-190,154.16);
  130.    lineto(190,154.16);
  131.    stroke();
  132.    text(215,10.29,"E_0_",CENTER);
  133.    text(215,40.81,"E_1_",CENTER);
  134.    text(215,154.16,"E_5_",CENTER);
  135.    text(0,200,"c) Asymmetric CDQW",CENTER);
  136.    grestore();
  137.    set(LINECOLOUR,BLACK);
  138.    set(FONTWIDTH,1.);
  139.    set(FONTASPECT,2.5);
  140.    moveto(20.91,36.9);
  141.    arrowto(20.0,36.9);
  142.    moveto(20.91,36.9);
  143.    arrowto(22.0,36.9);
  144.    moveto(25.5,33.02);
  145.    arrowto(25.5,36.53);
  146.    moveto(25.5,31.79);
  147.    arrowto(25.5,27.95);
  148.    moveto(9.9,16.90);
  149.    arrowto(9.9,23.02);
  150.    moveto(9.9,15.70);
  151.    arrowto(9.9,7.93);
  152.    moveto(21.4,15.14);
  153.    arrowto(20.8,15.14);
  154.    stroke();
  155.    }
  156.  
  157. int s_qw_box()
  158.    {
  159.    set(LINEWIDTH,0.06);
  160.    cmatch();
  161.    /* draw quantum well box */
  162.    moveto(-225.,107.27);
  163.    lineto(-145.,107.27);
  164.    lineto(-145.,0.);
  165.    lineto(-45.,0.);
  166.    lineto(-45.,107.27);
  167.    lineto(45.,107.27);
  168.    lineto(45.,0.);
  169.    lineto(145.,0.);
  170.    lineto(145.,107.27);
  171.    lineto(225.,107.27);
  172.    stroke();
  173.    set(LINEWIDTH,0.02);
  174.    }
  175.  
  176. int a_qw_box()
  177.    {
  178.    set(LINEWIDTH,0.06);
  179.    cmatch();
  180.    /* draw quantum well box */
  181.    moveto(-225.,188.36);
  182.    lineto(-145.,188.36);
  183.    lineto(-145.,0.);
  184.    lineto(-45.,0.);
  185.    lineto(-45.,188.36);
  186.    lineto(45.,188.36);
  187.    /* 188.36-107.27  */
  188.    lineto(45.,81.09);
  189.    lineto(145.,81.09);
  190.    lineto(145.,188.36);
  191.    lineto(225,188.36);
  192.    stroke();
  193.    set(LINEWIDTH,0.02);
  194.    }
  195.  
  196.