Commit 1ce8d3a0 authored by Éamonn Murray's avatar Éamonn Murray

Clarify some points in lab 3

parent 260955c3
......@@ -50,9 +50,9 @@ additional variables:
is little point in trying to converge to greater accuracy than we are
converging self-consistently.
So now we want to run `pw.x` for each of these input files. Don't forget
So now we want to run `pw.x` for each of these input files. **Don't forget
you'll need to load the espresso module and its dependencies before the
`pw.x` command will work.
`pw.x` command will work.**
It's a little tedious to type out the `pw.x` command for each input file in
turn manually. Instead we can automate this with a small script.
......@@ -75,13 +75,24 @@ pw.x < Si_25.in &> Si_25.out
pw.x < Si_30.in &> Si_30.out
```
Where the first line says what command is used to interpret the script, which
Here the first line says what command is used to interpret the script, which
in this case is bash. Bash is the default shell on the system we're using, so
the same commands you type in a terminal can be used in a bash script. So we
can then follow this with a series of commands as we've been typing directly.
After we save this in a file called say `run_set.sh`, we also need to set the
file as executable using the [`chmod`](../linuxcommands#chmod)
command as `chmod +x run_set.sh`.
After we save this in a file called say `run_set.sh`, (e.g. by copying the
above to whichever text editor you prefer such as `gedit`), we also need to
set the file as executable using the [`chmod`](../linuxcommands#chmod) command
as `chmod +x run_set.sh`. This command sets a flag associated with the file
that tells the system this file is an executable, and can be run like any
other program or command (such as `pw.x` or `gedit` or `ls`). To run the
script, assuming you are in the same directory as the script, you'll need to
write `./run_set.sh`. The preceding `./` tells the shell the path to find the
executable. Recall in the [first lab](../lab01) we discuss the `$PATH`
variable, which has a list of directories the shell looks in for executables.
If the executable is in one of these directories you don't need to specify the
path to it. Our script is not in one of these directories, so we need to
explicitly tell it to run the script called `run_set.sh` that is contained in
the current directory by typing `./run_set.sh`.
There are a number of features available in `bash` to make scripts more
general than an explicit set of commands. For example, let's say we want to
......@@ -103,18 +114,15 @@ files as a variable. Then we loop over those input files, running `pw.x` with
each, and saving the output in a file that has the same name as the input
file but with the extension `.out` instead of `.in`. The part
`${input_file%.*}` returns the value stored in the `$input_file` variable
but with the extension stripped away.
but with the extension stripped away. This lets us make our script much more
general: if we add additional input files, they'll automatically be picked
up and run without us needing to modify our script.
Save this script as `run_all.sh`, make it executable as described earlier,
and run it within the directory with the silicon input files. To run the
script, assuming you are in the same directory as the script, you'll need to
write `./run_all.sh`. The preceding `./` tells the shell the path to find the
executable. Recall in the [first lab](../lab01) we discuss the
`$PATH` variable, which has a list of directories the shell looks in for
executables. If the executable is in one of these directories you don't need
to specify the path to it. Our script is not in one of these directories, so
we need to explicitly tell it to run the script called `run_all.sh` that is
contained in the current directory by typing `./run_all.sh`.
and run it within the directory with the silicon input files. At this point
you should check one of your output files to make sure quantum espresso ran
as expected. If your file contains only an error message, you likely forgot
to load the modules required to use quantum espresso on our server.
Once the calculations have run, we want to see how the total energy changes
with the input plane-wave energy cut-off. We could go through each output
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment