-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from RuiApostolo/gh-pages
Updates to course
Showing
20 changed files
with
694 additions
and
748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
--- | ||
title: "Understanding the logfile" | ||
teaching: 20 | ||
exercises: 0 | ||
questions: | ||
- "What information does LAMMPS print to screen/logfile?" | ||
- "What does that information mean?" | ||
objectives: | ||
- "Understand the information that LAMMPS prints to screen / writes to the logfile before, during, and after a simulation." | ||
keypoints: | ||
- "Thermodynamic information outputted by LAMMPS can be used to track whether a simulations is running OK." | ||
- "Performance data at the end of a logfile can give us insights into how to make a simulation faster." | ||
--- | ||
|
||
## Log file | ||
|
||
The logfile is where we can find thermodynamic information of interest. | ||
By default, LAMMPS will write to a file called `log.lammps`. | ||
All info output to the terminal is replicated in this file. | ||
We can change the name of the logfile by adding a `log` command to your script: | ||
|
||
``` | ||
log new_file_name.extension | ||
``` | ||
|
||
We can change which file to write to multiple times during a simulation, and even `append` to a file if, for example, | ||
we want the thermodynamic data separate from the logging of other assorted commands. | ||
The thermodynamic data, which we setup with the `thermo` and `thermo_style` command, create the following (truncated) output: | ||
|
||
``` | ||
Step Temp TotEng PotEng KinEng Press Volume Density | ||
0 1 -2.709841 -4.208341 1.4985 -2.6415761 1666.6667 0.6 | ||
500 0.91083091 -2.6743978 -4.0392779 1.3648801 -0.1637597 1666.6667 0.6 | ||
1000 0.96279851 -2.6272603 -4.0700139 1.4427536 -0.14422949 1666.6667 0.6 | ||
1500 0.97878978 -2.6029892 -4.0697057 1.4667165 -0.11813628 1666.6667 0.6 | ||
2000 0.93942595 -2.5817381 -3.9894679 1.4077298 -0.31689463 1666.6667 0.6 | ||
``` | ||
|
||
At the start, we get a header with the column names, and then a line for each time-step that's a multiple of the value we set `thermo` to. | ||
In this example, we're running an NVT simulation, so we've fixed the number of particles, the volume and dimensions of the simulation box, and the temperature | ||
-- we can see from the logfile that `Volume` and `Density` remain constant (but not `Temp`). | ||
This would change if we used a different ensemble. | ||
At the end of each `run` command, we get the analysis of how the simulation time is spent: | ||
|
||
``` | ||
Loop time of 4.2033 on 128 procs for 50000 steps with 1000 atoms | ||
Performance: 5138815.615 tau/day, 11895.407 timesteps/s | ||
99.3% CPU use with 128 MPI tasks x 1 OpenMP threads | ||
MPI task timing breakdown: | ||
Section | min time | avg time | max time |%varavg| %total | ||
--------------------------------------------------------------- | ||
Pair | 0.25206 | 0.29755 | 0.34713 | 4.5 | 7.08 | ||
Neigh | 0.21409 | 0.22675 | 0.23875 | 1.2 | 5.39 | ||
Comm | 2.9381 | 3.097 | 3.2622 | 4.6 | 73.68 | ||
Output | 0.0041445 | 0.0049069 | 0.0052867 | 0.4 | 0.12 | ||
Modify | 0.40665 | 0.53474 | 0.67692 | 10.0 | 12.72 | ||
Other | | 0.04237 | | | 1.01 | ||
Nlocal: 7.8125 ave 12 max 5 min | ||
Histogram: 6 21 22 0 37 29 0 11 1 1 | ||
Nghost: 755.055 ave 770 max 737 min | ||
Histogram: 2 6 4 18 23 20 30 13 7 5 | ||
Neighs: 711.773 ave 1218 max 392 min | ||
Histogram: 8 14 24 15 31 22 11 1 0 2 | ||
Total # of neighbors = 91107 | ||
Ave neighs/atom = 91.107 | ||
Neighbor list builds = 4999 | ||
Dangerous builds = 4996 | ||
Total wall time: 0:00:04 | ||
``` | ||
|
||
The data shown here is very important to understand the computational performance of our simulation, | ||
and we can it to help improve the speed at which our simulations run substantially. | ||
The first line gives us the details of the last `run` command - how many seconds it took, on how many processes it ran on, how many time-steps, and how many atoms. | ||
This can be useful to compare between different systems. | ||
|
||
Then we get some benchmark information: | ||
|
||
``` | ||
Performance: 5138815.615 tau/day, 11895.407 timesteps/s | ||
99.3% CPU use with 128 MPI tasks x 1 OpenMP threads | ||
``` | ||
|
||
This tells us how many time units per day, and how many time-steps per second we are running. | ||
It also tells us how much of the available CPU resources LAMMPS was able to use, and how many MPI tasks and OpenMP threads. | ||
|
||
The next table shows a breakdown of the time spent on each task by the MPI library: | ||
|
||
``` | ||
MPI task timing breakdown: | ||
Section | min time | avg time | max time |%varavg| %total | ||
--------------------------------------------------------------- | ||
Pair | 0.25206 | 0.29755 | 0.34713 | 4.5 | 7.08 | ||
Neigh | 0.21409 | 0.22675 | 0.23875 | 1.2 | 5.39 | ||
Comm | 2.9381 | 3.097 | 3.2622 | 4.6 | 73.68 | ||
Output | 0.0041445 | 0.0049069 | 0.0052867 | 0.4 | 0.12 | ||
Modify | 0.40665 | 0.53474 | 0.67692 | 10.0 | 12.72 | ||
Other | | 0.04237 | | | 1.01 | ||
``` | ||
|
||
There are 8 possible MPI tasks in this breakdown: | ||
|
||
- `Pair` refers to non-bonded force computations | ||
- `Bond` includes all bonded interactions, (so angles, dihedrals, and impropers) | ||
- `Kspace` relates to long-range interactions (Ewald, PPPM or MSM) | ||
- `Neigh` is the construction of neighbour lists | ||
- `Comm` is inter-processor communication (AKA, parallelisation overhead) | ||
- `Output` is the writing of files (log and dump files) | ||
- `Modify` is the fixes and computes invoked by fixes | ||
- `Other` is everything else | ||
|
||
Each category shows a breakdown of the least, average, and most amount of wall time any processor spent on each category | ||
-- large variability in this (calculated as `%varavg`) indicates a load imbalance (which can be caused by the atom distribution between processors not being optimal). | ||
The final column, `%total`, is the percentage of the loop time spent in the category. | ||
|
||
> ## A rule-of-thumb for %total on each category | ||
> - `Pair`: as much as possible. | ||
> - `Neigh`: 10% to 30%. | ||
> - `Kspace`: 10% to 30%. | ||
> - `Comm`: as little as possible. If it's growing large, it's a clear sign that too many computational resources are being assigned to a simulation. | ||
{: .callout} | ||
|
||
The last line on every LAMMPS simulation will be the total wall time for the entire input script, no matter how many `run` commands it has: | ||
|
||
``` | ||
Total wall time: 0:00:04 | ||
``` | ||
|
||
{% include links.md %} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
set selECH [atomselect top {name ECH}] | ||
$selECH set mass 12.011 | ||
$selECH set type ECH | ||
$selECH set charge -0.18 | ||
$selECH set element C | ||
$selECH set radius 1.4 | ||
|
||
set selECO [atomselect top {name ECO}] | ||
$selECO set mass 12.011 | ||
$selECO set type ECO | ||
$selECO set charge 0.145 | ||
$selECO set element C | ||
$selECO set radius 1.4 | ||
|
||
set selEHC [atomselect top {name EHC}] | ||
$selEHC set mass 1.008 | ||
$selEHC set type EHC | ||
$selEHC set charge 0.06 | ||
$selEHC set element H | ||
$selEHC set radius 0.8 | ||
|
||
set selEHA [atomselect top {name EHA}] | ||
$selEHA set mass 1.008 | ||
$selEHA set type EHA | ||
$selEHA set charge 0.06 | ||
$selEHA set element H | ||
$selEHA set radius 0.8 | ||
|
||
set selEHO [atomselect top {name EHO}] | ||
$selEHO set mass 1.008 | ||
$selEHO set type EHO | ||
$selEHO set charge 0.418 | ||
$selEHO set element H | ||
$selEHO set radius 0.8 | ||
|
||
set selEOH [atomselect top {name EOH}] | ||
$selEOH set mass 15.999 | ||
$selEOH set type EOH | ||
$selEOH set charge -0.683 | ||
$selEOH set element O | ||
$selEOH set radius 1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
9 | ||
Ethanol | ||
EHC 1.8853 -0.0401 1.0854 | ||
ECH 1.2699 -0.0477 0.1772 | ||
EHC 1.5840 0.8007 -0.4449 | ||
EHC 1.5089 -0.9636 -0.3791 | ||
ECO -0.2033 0.0282 0.5345 | ||
EHA -0.4993 -0.8287 1.1714 | ||
EHA -0.4235 0.9513 1.1064 | ||
EOH -0.9394 0.0157 -0.6674 | ||
EHO -1.8540 0.0626 -0.4252 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
tolerance 2.0 | ||
|
||
output water_ethanol.xyz | ||
filetype xyz | ||
|
||
structure water.xyz | ||
number 1300 | ||
inside cube 15. 15. 30. 50. | ||
end structure | ||
|
||
structure ethanol.xyz | ||
number 1300 | ||
inside box 1. 1. 1. 79. 79. 109. | ||
outside cube 15. 15. 30. 50. | ||
end structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package require topotools | ||
proc get_total_charge {{molid top}} { | ||
eval "vecadd [[atomselect $molid all] get charge]" | ||
} | ||
mol bondsrecalc all | ||
topo retypebonds | ||
topo guessangles | ||
topo guessdihedrals | ||
|
||
puts "" | ||
puts "Bond type names: " | ||
puts [ topo bondtypenames ] | ||
puts "" | ||
puts "Angle type names: " | ||
puts [ topo angletypenames ] | ||
puts "" | ||
puts "Dihedral type names: " | ||
puts [ topo dihedraltypenames ] | ||
puts "" | ||
puts "" | ||
puts [format "Number of bonds: %s" [topo numbonds] ] | ||
puts [format "Number of bonds types: %s" [topo numbondtypes] ] | ||
puts [format "Number of angles: %s" [topo numangles] ] | ||
puts [format "Number of angles types: %s" [topo numangletypes] ] | ||
puts [format "Number of dihedral: %s" [topo numdihedrals] ] | ||
puts [format "Number of dihedral types: %s" [topo numdihedraltypes] ] | ||
puts [format "Total charge: %s" [get_total_charge] ] | ||
puts "" | ||
topo writelammpsdata data.water_ethanol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set selwo [atomselect top {name WO}] | ||
$selwo set mass 15.999 | ||
$selwo set type WO | ||
$selwo set charge -0.8340 | ||
$selwo set element O | ||
$selwo set radius 1.2 | ||
|
||
set selwh [atomselect top {name WH}] | ||
$selwh set mass 1.008 | ||
$selwh set type WH | ||
$selwh set charge 0.4170 | ||
$selwh set element H | ||
$selwh set radius 0.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
3 | ||
Water molecule | ||
WO 0.00000 0.00000 0.11779 | ||
WH 0.00000 0.75545 -0.47116 | ||
WH 0.00000 -0.75545 -0.47116 |