-
Notifications
You must be signed in to change notification settings - Fork 8
Example Scripts
QWWAD is shipped with a large number of example scripts. These, typically, run one or more of the QWWAD programs to produce a data file that can be plotted using a graph package (such as Xmgrace or ORIGIN).
Generally speaking, each script will generate the data for one or more of the figures in the textbook. You should, therefore, be able to reproduce (almost) everything you see in the book by running an appropriate script!
The examples are installed into a shared folder on your system. On Ubuntu, this will be:
/usr/share/qwwad/examples/
Other operating systems may install them somewhere else, such as:
/usr/local/share/qwwad/examples/
Inside the examples folder, you'll find a list of subfolders - one for each chapter of the textbook:
numerical-solutions/
schroedinger-solutions/
etc...
Note that we haven't numbered these by chapter, in case we decide to add or remove chapters from future editions of the book!
Each folder contains an index
file that states which script generates each figure in the book. For example, schroedinger-solutions/index
contains lines that look like:
...
Fig 2.2: infinite-well-wavefunctions.sh => infinite-well-wavefunctions.dat
Fig 2.3: infinite-well-energy-vs-width.sh => infinite-well-energy-vs-width.dat
...
This means that if we want to reproduce Fig. 2.2 from the book, we need to run the infinite-well-wavefunctions.sh
script and this will produce a data file called infinite-well-wavefunctions.dat
.
We recommend creating a new folder in your home directory to provide a clean environment for running the scripts:
mkdir -p ~/qwwad-examples
cd ~/qwwad-examples
You can run the example script by typing sh
followed by the full name of the script. For example,
sh /usr/share/qwwad/examples/schroedinger-solutions/finite-well-wf.sh
This is a bit of a mouthful, so alternatively, you can copy the script into the folder you created (either by using the cp
command or by using a file browser). You can then run the script using the simpler command:
sh ./finite-well-wf.sh
The script will display a chunk of text containing:
- A brief list of the data file(s) that have been created. In this example,
finite-well-wf.dat
. - An explanation of the data contained in each column of the data file(s).
- A copyright notice
- An address to report bugs (hopefully you won't need it!)
The data files created by the script contain data in the format specified when the script finishes. If we plot the data in the sets contained in finite-well-wf.dat
, it appears as follows:
Note that I have added axis labels and annotations to this figure myself. The data file just contains raw data!
You can check that the data files are correct by inspecting the appropriate figure in the textbook. If you find that your data file doesn't look like the figure, please let us know on our bug-reporting page!
We provide these scripts as starting points for you to investigate the physical systems we discuss in the book. As such, we actively encourage you to edit them, play with the parameters and find their breaking points... what happens if you put a 1 kg particle in a quantum well? What happens if you make the well 1 km wide? Find out!
If you want to edit the script, then make a copy of it in your local folder as discussed previously. Use this as your guinea pig and keep the original script in its original pristine condition. This means that if you break the script you always have a clean copy to return to!