Last updated -- 27 March 2002

The "SCTB" Tight-Binding Program: Example III

This page shows how to analyze the output of the eval_virial program of the SCTB package to compute the surface energy and stress of a Si 111 surface 1x1 unit cell. In addition, a comparison of the timing information between the serial and parallel runs is generated. For a description files needed, see the first Setup page.


  1. This is a script that processes the two output files output.parallel.no_SC and output.parallel.SC.
    #!/bin/csh -f
    
    echo "*******************"
    echo "*   Raw results   *"
    echo "*******************"
    echo ""
    
    echo "Raw no charge self-consistency results:"
    echo -n "energy of bulk "
    fgrep Energy output.parallel.no_SC | head -1 | awk '{print $3}'
    echo -n "energy with surface "
    fgrep Energy output.parallel.no_SC | tail -1 | awk '{print $3}'
    echo "bulk virial (xx xy xz yx yy yz zx zy zz)"
    fgrep Virial output.parallel.no_SC | head -1 | sed 's/Virial =[ ]*//'
    echo "surface virial (xx xy xz yx yy yz zx zy zz)"
    fgrep Virial output.parallel.no_SC | tail -1 | sed 's/Virial =[ ]*//'
    
    echo ""
    echo "Raw charge self-consistent results:"
    echo "self-consistency convergence process:"
    egrep ' 0:.*residual' output.parallel.SC
    echo -n "energy of bulk "
    fgrep Energy output.parallel.SC | head -1 | awk '{print $3}'
    echo -n "energy with surface "
    fgrep Energy output.parallel.SC | tail -1 | awk '{print $3}'
    echo "bulk virial (xx xy xz yx yy yz zx zy zz)"
    fgrep Virial output.parallel.SC | head -1 | sed 's/Virial =[ ]*//'
    echo "surface virial (xx xy xz yx yy yz zx zy zz)"
    fgrep Virial output.parallel.SC | tail -1 | sed 's/Virial =[ ]*//'
    
    echo ""
    
    echo "*************************"
    echo "*   Processed results   *"
    echo "*************************"
    echo ""
    
    echo -n "non charge self-consistent surface energy (eV/111 unit cell) "
    set eb = `fgrep Energy output.parallel.no_SC | head -1 | awk '{print $3}'`
    set es = `fgrep Energy output.parallel.no_SC | tail -1 | awk '{print $3}'`
    echo "scale=3; ($es-$eb)/2.0" | bc -l
    echo -n "charge self-consistent surface energy (eV/111 unit cell)     "
    set eb = `fgrep Energy output.parallel.SC | head -1 | awk '{print $3}'`
    set es = `fgrep Energy output.parallel.SC | tail -1 | awk '{print $3}'`
    echo "scale=3; ($es-$eb)/2.0" | bc -l
    echo ""
    
    echo -n "non charge self-consistent surface stress (eV/111 unit cell) "
    set vxxb = `fgrep Virial output.parallel.no_SC | head -1 | awk '{print $3}'`
    set vxxs = `fgrep Virial output.parallel.no_SC | tail -1 | awk '{print $3}'`
    set vyyb = `fgrep Virial output.parallel.no_SC | head -1 | awk '{print $7}'`
    set vyys = `fgrep Virial output.parallel.no_SC | tail -1 | awk '{print $7}'`
    echo -n `echo "scale=3; ($vxxs - $vxxb)/2.0" | bc -l` " "
    echo `echo "scale=3; ($vyys - $vyyb)/2.0" | bc -l`
    
    echo -n "charge self-consistent surface stress (eV/111 unit cell)     "
    set vxxb = `fgrep Virial output.parallel.SC | head -1 | awk '{print $3}'`
    set vxxs = `fgrep Virial output.parallel.SC | tail -1 | awk '{print $3}'`
    set vyyb = `fgrep Virial output.parallel.SC | head -1 | awk '{print $7}'`
    set vyys = `fgrep Virial output.parallel.SC | tail -1 | awk '{print $7}'`
    echo -n `echo "scale=3; ($vxxs - $vxxb)/2.0" | bc -l` " "
    echo `echo "scale=3; ($vyys - $vyyb)/2.0" | bc -l`
    
    
    echo "*************************"
    echo "*        TIMING         *"
    echo "*************************"
    set dt1 = `fgrep 'TOTAL TIME' output.parallel.SC | awk '{print $5}' | sort -k1nr | head -1`
    set dt2 = `fgrep 'TOTAL TIME' output.parallel.no_SC | awk '{print $5}' | sort -k1nr | head -1`
    
    set dt = `echo $dt1 + $dt2 | bc -l`
    
    echo "Running time $dt2 + $dt1 = $dt s"
    
  2. The script uses fgrep, head, tail, sort, bc and awk to isolate the important results from the output. These include the energy of the bulk sample, which is set to the shell variable eb, the energy of the surface sample es, and the in-plane virials of the bulk vxxb and vyyb and the surface vxxs and vyys.
  3. The surface energy is defined as the excess energy of the slab with a surface, minus the energy of a bulk sample with an equal number of atoms, divided by the number of unit cells of surface present. In this case there are two 1x1 unit cells of the 111 surface, one at the top of the slab and one at the bottom.
  4. The surface stress is similarly defined as the excess virial. To be physically meaningful, the virial must not be corrupted by bulk stress caused by an overall strain of the sample. The minimum energy volume for the bulk phase would be calculated, and the comparison carried out with the same lattice constant for the surface sample as well.
  5. The calculations are repeated for the charge-self-consistent output, showing some small but significant results:
    *************************
    *   Processed results   *
    *************************
    
    non charge self-consistent surface energy (eV/111 unit cell) 1.295
    charge self-consistent surface energy (eV/111 unit cell)     1.444
    
    non charge self-consistent surface stress (eV/111 unit cell) -0.960  -0.960
    charge self-consistent surface stress (eV/111 unit cell)     -0.612  -0.612
    
  6. A similar script for the output of the serial code is also available. Results should be the same to within numerical accuracy (i.e. processed output, printed to 3 decimal places, should be identical).

Return to the first setup page

Look at other examples


sctb Home Page   Introduction   About Version 0.80   Installation   List of Files   Usage   Input Files   Output Files   Trouble Shooting   Appendix

Return to the sctb Reference Manual.