Skip to content
Snippets Groups Projects
Commit 8d6241bd authored by dk2u09's avatar dk2u09
Browse files

Webpage update

parent b647db94
No related branches found
No related tags found
No related merge requests found
exercises
public
......@@ -14,3 +14,24 @@ pw.x cu.scf.in | tee cu.scf.out
```
The first part of that command runs Quantum Espresso and feeds it the `cu.scf.in` input file. The second part deals with the output. `tee` is a little helper program that copies all output into a file. The `|` symbol is called a pipe and connects the output from `pw.x` to `tee`.
> This should not take longer than a few seconds to complete.
DFT codes are quite verbose. They provide lots of information for you, and it is important to find the most relevant data in the output. Quantum Espresso is somewhat helpful by printing an exclamation mark in front of the most important lines. You can filter these using `grep`, another unix command-line tool
```bash
grep ! cu.scf.out
```
In this case, only one line with the *total energy* is returned:
```
! total energy = -213.04983910 Ry
```
Congratulation. This is your first DFT result. The total energy of fcc Cu is `-213.04984 Ry`. There are two thing to consider:
- DFT uses it's own reference frame for energy. Hence, the energy of reference compounds is not automatically zero as we can see here.
- Quantum Espresso uses [Rydberg](https://en.wikipedia.org/wiki/Rydberg_constant) as energy unit.
> 1 Ry = 13.605 eV
---
title: "Structural relaxation"
date: 2018-05-14T14:29:26+01:00
draft: true
position: 10
---
# Structural relaxation
The crystal structure we have used is close to the equilibrium lattice constant, but not exactly. The code allows to automatically **relax** atomic coordinates and lattice constants to obtain an energetic minimum. The total energy is quite sensitive to the geometry, and the equilibrium constant in DFT is generally not the same as seen experimentally (although they should be close).
# Changing the calculation type
We need to change the input file to tell the code that we want to do a structural relaxation (`vc-relax`) instead of a simple self-consistency cylce (`scf`).
- Make sure you have `cu.scf.in` open in the text editor.
- Locate the
```
calculation = 'scf'
```
line in the `&CONTROL` namelist and change it to
```
calculation = 'vc-relax'
```
This will instruct the code to relax the atomic positions and the unit cell (the `vc` part stands for 'variable cell'). But we need to tell it *how* to change them. Two additional `NAMELIST`s provide variables to steer the atomic position and the cell manipulations.
- Add the following below the `&electrons` namelist:
```
&ions
ion_dynamics = 'bfgs'
/
&cell
ion_dynamics = 'bfgs'
/
```
- Save the file as `cu.relax.in`
We told the code to use a `Quasi-Newton algorithm` to find the next local minimum (this is what `bfgs` stands for). We could also have instructed Quantum Espresso to do a molecular dynamics run and other things.
---
title: "Structural relaxation"
date: 2018-05-14T14:29:26+01:00
draft: true
position: 11
---
# Run a relaxation run
Start the calculation with
```bash
pw.x < cu.relax.in | tee cu.relax.out
```
This will take quite a bit longer than the simple scf calculation we have done before. The code does the following:
- Start with the provided geometry
- Calculate the total energy in a scf calculation
- Calculate forces and stresses
- Obtain a new geometry (atomic positions and cell parameters) based on the forces/stresses
- Do another scf calculation
This is repeated until a specified convergence criterium is fulfilled.
# Look at the output
Let's examine the evolution of the **total energy** during the relaxation calculation:
```bash
grep ! cu.relax.out
```
You should see how the energy generally reduces with increasing number of cycles. However, in the last line the energy actually increases again. This is a sign that the algorithm could not find another configuration with even lower energy. It therefore stopped.
The results are
| calculation | energy [eV] | volume [Bohr^3] |
| ----------- | ------------- | --------------- |
| initial | -213.04983910 | 76.2053 |
| relaxed | -213.06077174 | 69.5493 |
### Energy
This might not seem such a large change in energy. But 0.01 Ry are almost 130meV, which is significant. The formation energy of many alloys is of this order of magnitude. The total energy by itself is almost never relevant. Usually, one is interested in energy differences. Hence, one tends to compare fairly large numbers with small changes.
### Volume
You can find the volume using grep as well
```bash
grep volume cu.relax.out
```
The cell has somewhat contracted, which suggests that our initial lattice constant was slightly too large. Take note that the volume is given in *Bohr*.
> 1 Bohr = 0.529 A
You can compare this with the experimental unit-cell volume for FCC copper, which is 47.24 A^3.
---
title: "Copper Nitride"
date: 2018-05-14T14:29:26+01:00
draft: true
position: 20
---
# Input
Let's turn to another compound. You also received a 'ready-to-go' input for CuN within the `CuN_bulk` folder.
Let's change to that directory and examine the input file.
```bash
cd ../CuN_bulk
subl cun.relax.in
```
This file looks fairly similar to the copper input file. But there are some noteworthy differences.
## Geometry
### Namelists
There are changes in the `&system` namelist:
```
ibrav = 1, celldm(1) =7.20, nat= 2, ntyp= 2,
space_group = 221,
```
- The Bravais lattice type has changed to one, which indicates a simple cubic lattice (rather than FCC)
- The number of atoms has increased to two
- The number of atom types is also two now
- The lattice constant is different, and
- There is a new variable `space_group` with a value of 221
### Cards
There are also changes in the cards:
```
ATOMIC_SPECIES
Cu 63.55 Cu.pbe-dn-kjpaw_psl.0.2.UPF
N 14.00 N.pbe-n-kjpaw_psl.0.1.UPF
ATOMIC_POSITIONS crystal_sg
N 0.0 0.0 0.0
Cu 0.5 0.0 0.0
```
- There is a new definition for nitrogen in the `ATOMIC_SPECIES`
- The coordinates of two symmetry in-equivalent atoms are given in `ATOMIC_POSITIONS`
> Also notice the new keyword `crystal_sg`. This instructs the code to take the coordinates relative to the lattice vectors and also consider the space group symmetry operations to find symmetry equivalent atoms in the unit cell.
# Run
The input file is ready for a run. So go ahead and start a relaxation run for CuN:
```bash
pw.x < cun.relax.in | tee cun.relax.output
```
---
title: "What now?"
date: 2018-05-14T14:29:26+01:00
draft: true
position: 90
---
We have covered all that is needed to calculate the equilibrium potential for the reaction
$${\rm Cu_3N} + 3{\rm Na^+} + 3e^- \leftrightarrow {\rm Na_3N} + 3{\rm Cu}$$
We already have energies for CuN and Cu, and can easily follow the same procedure
for sodium and its nitride.
# Your tasks
- Prepare calculations to compute the total energy of Na and Na<sub>3</sub>N
- Calculate the equilibrium potential
# What else you need
## Crystalography
### Na3N
Sodium Nitride has the same crystal structure as Cu3N.
- Experimental lattice constant: 3.814 A
### Na
Sodium crystallises in a BCC structure with an experimental lattice constant of 4.282 A.
> Hint: The ibrav = 3 parameter sets up a BCC crystal.
---
title: "Recap - Part 1"
date: 2018-05-14T15:34:14+01:00
draft: true
position: 9
---
# Recap
Let's recap what we have learned so far:
- Some useful `Unix` commands like `ls, cd, grep, mkdir`
- How to run Quantum Espresso (with `pw.x`)
- How to look at the output and extract some useful information (with `grep`)
Not bad.
......@@ -50,8 +50,5 @@
<div class="workarea">
{{ partial "novnc" }}
</div>
<div class="overview">
Overview area
</div>
</div>
{{ partial "footer_tutorial.html" . }}
......@@ -8,7 +8,6 @@
grid-template-areas:
". workarea ."
". guidance ."
". overview ."
}
}
......@@ -18,10 +17,9 @@
.container {
display: grid;
grid-template-columns: [left] auto [v-div] 640px [right];
grid-template-rows: [top] 512px [h-div] auto [bottom];
grid-template-rows: [top] auto [bottom];
grid-template-areas:
"guidance workarea"
"guidance overview"
}
}
......@@ -31,10 +29,9 @@
.container {
display: grid;
grid-template-columns: [left] auto [v-div] 750px [right];
grid-template-rows: [top] 600px [h-div] auto [bottom];
grid-template-rows: [top] auto [bottom];
grid-template-areas:
"guidance workarea"
"guidance overview"
}
}
......@@ -44,10 +41,9 @@
.container {
display: grid;
grid-template-columns: [left] auto [v-div] 1000px [right];
grid-template-rows: [top] 800px [h-div] auto [bottom];
grid-template-rows: [top] auto [bottom];
grid-template-areas:
"guidance workarea"
"guidance overview"
}
}
......@@ -56,11 +52,10 @@
.container {
display: grid;
grid-template-columns: [left] auto [v-div] 1280px [right];
grid-template-rows: [top] 1024px [h-div] auto [bottom];
grid-template-columns: [left] auto [v-div] 1600px [right];
grid-template-rows: [top] auto [bottom];
grid-template-areas:
"guidance workarea"
"guidance overview"
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment