exercises:2021_uzh_acpc2:ex01
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
exercises:2021_uzh_acpc2:ex01 [2021/04/21 10:48] – [Lennard-Jones liquids] jglan | exercises:2021_uzh_acpc2:ex01 [2021/05/17 11:35] (current) – [Part III: Radial distribution function] Fix type mrossmannek | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Lennard-Jones liquids ====== | ====== Lennard-Jones liquids ====== | ||
- | In this exercise, you will simulate a fluid of monoatomic particles that interact with a Lennard-Jones potential. The method to be used is molecular dynamics (MD) with periodic boundary conditions using CP2K. The aim is to explore the method, calculate the | + | In this exercise, you will simulate a fluid of monoatomic particles that interact with a Lennard-Jones potential. The method to be used is molecular dynamics (MD) with periodic boundary conditions using CP2K. The aim is to explore the method, calculate the radial distribution function g(r) |
- | radial distribution function g(r) | + | |
You are expected to hand in the short report via OLAT, ONLY in PDF format. | You are expected to hand in the short report via OLAT, ONLY in PDF format. | ||
Line 11: | Line 10: | ||
The [[https:// | The [[https:// | ||
- | To get you started, we will do a simple exercise using Molecular Mechanics (that is: a classical approach). The point is to get familiar with the options, | + | To get you started, we will do a simple exercise using Molecular Mechanics (that is: a classical approach). The point is to get familiar with the options, |
====== Background ====== | ====== Background ====== | ||
You are expected to carry out an MD simulation of Lennard-Jones (L-J) fluid containing mono-atomic | You are expected to carry out an MD simulation of Lennard-Jones (L-J) fluid containing mono-atomic | ||
- | particles. The [[https:// | + | particles. The [[https:// |
U(x)=4ϵ[(σrij)12−(σrij)6] | U(x)=4ϵ[(σrij)12−(σrij)6] | ||
- | where is ϵ the well depth, | + | where ϵ |
- | distance between atoms i and j. | + | |
- | [[https:// | + | [[https:// |
- | function, (or pair correlation function) g(r) in a system of particles (atoms, molecules, colloids, | + | The radial distribution |
- | etc.), describes how density varies as a function of distance from a reference particle. | + | |
===== Part I: Set up MD simulation | ===== Part I: Set up MD simulation | ||
- | In this section, | + | In this section, |
- | Comments are added, | + | Extensive comments have been added to the file, which start with a has symbol |
=== 1. Step === | === 1. Step === | ||
- | Load the CP2K module as shown before, create a directory '' | + | Load the CP2K module as explained in Exercise 0, create a directory '' |
< | < | ||
Line 44: | Line 41: | ||
<code - argon.inp> | <code - argon.inp> | ||
- | ## It's highly recommended to go | + | ## It's highly recommended to go to |
## https:// | ## https:// | ||
- | ## and learn how to set up CP2K | + | ## and learn how to set up a CP2K |
- | ## calculation correctly using manual. | + | ## calculation correctly, using the manual. |
&GLOBAL | &GLOBAL | ||
Line 223: | Line 220: | ||
< | < | ||
*Run the calculation and visualize the trajectories using VMD | *Run the calculation and visualize the trajectories using VMD | ||
- | *Run calculations with different timesteps (0.5 2 5fs), different temperatures(84, | + | *Run calculations with different timesteps (0.5, 2, 5fs), different temperatures(84, |
</ | </ | ||
===== Part II: Force Field Parameter | ===== Part II: Force Field Parameter | ||
- | You need to modify | + | In this section we investigate |
& | & | ||
| | ||
Line 252: | Line 250: | ||
&END SUBSYS | &END SUBSYS | ||
- | + | In order to investigate the effect of the force-field parameters on the L-J potential you need to vary multiple parameters of your calculation: | |
- | any times you will have to run the same simulation with different | + | |
+ | - you need to run each calculation at different distances between | ||
A simple way to generate the different input files is using shell scripting in combination with '' | A simple way to generate the different input files is using shell scripting in combination with '' | ||
Line 259: | Line 258: | ||
< | < | ||
for d in $(seq 2 0.1 4); do | for d in $(seq 2 0.1 4); do | ||
- | sed -e "s|4 0 0|${d} 0 0|" | + | sed -e "s|4 0 0|${d} 0 0|" |
cp2k.popt -i energy_{d}A.inp -o energy_{d}A.out | cp2k.popt -i energy_{d}A.inp -o energy_{d}A.out | ||
awk '/ | awk '/ | ||
Line 269: | Line 268: | ||
* '' | * '' | ||
* ... and using ''> | * ... and using ''> | ||
- | * Then we run '' | + | * Then we run '' |
- | * Using '' | + | * Using '' |
| | ||
< | < | ||
**TASK** | **TASK** | ||
- | *Plot the Lennard-Jones potential against Ar-Ar distance r (2-4 Å) using different \epsilon and \sigma. | + | *Plot the Lennard-Jones potential against |
- | *Repeat the L-J MD calculation with different \epsilon and \sigma, | + | *Repeat the L-J MD calculation with different \epsilon and \sigma, compare the potential energy |
</ | </ | ||
- | ===== Part III: Radial distribution | + | ===== Part III: Radial distribution |
+ | In this section we analyze the dependence of the radial distribution function (rdf), g(r), on the temperature of the system. To do so, you should plot g(r) against various temperatures and examine the effects. | ||
+ | You can use VMD (as explained below) or write your own program (Fortran, C, C++, Python etc.) to calculate the rdf. | ||
- | Use VMD or write your own program (Fortran, C, C++, Python etc.) to calculate radial distribution g(r). Plot g(r), and against various the temperatures to examine the effects. | + | VMD comes with an extension for exactly this purpose: In the VMD Main window open “Extensions → Analysis” click on “Radial Pair Distribution function g(r)“. In the appearing window use “Utilities → Set unit cell dimensions” to tell VMD the size of the simulation box you used. After that use Selection 1 and 2 to define the atomic types that you want to calculate the rdf for, for example “element Ar”. In the plot window, use the " |
- | VMD comes with an extension for exactly this purpose: In the VMD Main window open “Extensions → Analysis” click on “Radial Pair Distribution function g(r). In the appearing window use “Utilities → Set unit cell dimensions” to let VMD know the simulation box you used. After that use Selection 1 and 2 to define the atomic types that you want to calculate the rdf for, for example “element Ar”. In the plot window, use " | + | |
< | < | ||
* Plot g(r) at 84, 300 and 400 K into the same graph. | * Plot g(r) at 84, 300 and 400 K into the same graph. | ||
- | * What are the differences in the height of the first peak, and why does temperature contribute to the differences? | + | * What are the differences in the height of the first peak, and why/how does the temperature contribute to the differences? |
- | * Compared | + | * Compare your results |
</ | </ | ||
<code - exp_gr.dat> | <code - exp_gr.dat> | ||
Line 442: | Line 442: | ||
10.2150 | 10.2150 | ||
10.2831 | 10.2831 | ||
- | 10.3512 | + | 10.3512 |
10.4193 | 10.4193 | ||
10.4874 | 10.4874 | ||
Line 455: | Line 455: | ||
</ | </ | ||
- | ===== Part IV: Ensembles | + | ===== Part IV: Other Ensembles |
- | In previous | + | In the previous |
- | Step up NVT calculation, | + | To set up an NVT calculation, |
Line 476: | Line 476: | ||
| | ||
| | ||
- | Step up NPT calculation, | + | To set up an NPT calculation, |
& | & | ||
Line 503: | Line 503: | ||
< | < | ||
**TASK** | **TASK** | ||
- | *Run calculation using NVT at 300K, check the temperature, and energy of the whole system, and compare the result to NVE (300K), and rationalize | + | |
- | *Run calculation using NVT (300K) until the system is equilibrated then run NVE, check the temperature, and energy of the whole system, and compare to previous NVE simulation. | + | |
- | | + | |
+ | </ | ||
+ | |||
+ | <note tip> | ||
+ | You have multiple options on how to restart a CP2K calculation off of a previous one. What all approaches have in common, is that you need to make use of the RESTART-files which are automatically written by CP2K (unless you explicitly disable them). | ||
+ | For the purposes of this example, you should see a file called '' | ||
+ | These files are nothing but another input file. However, their parameters are set such that they continue a CP2K calculation from the last step of the simulation which generated the RESTART file. | ||
+ | Here are two options for how you can use these RESTART-files: | ||
+ | 1. Directly using the RESTART as an input. | ||
+ | - You can copy the RESTART file to a new input file: < | ||
+ | - Now you can change the input to your liking (e.g. change the ensemble, etc.) | ||
+ | - And finally simply run CP2K with the new input file: < | ||
+ | 2. You can also tell CP2K to load a specific RESTART-file. | ||
+ | - Write a new input file as usual: < | ||
+ | - Add an [[https:// | ||
+ | < | ||
+ | & | ||
+ | RESTART_FILE_NAME ar108-1.restart | ||
+ | &END EXT_RESTART</ | ||
+ | - And now, again, simply run CP2K: < | ||
</ | </ |
exercises/2021_uzh_acpc2/ex01.1619002099.txt.gz · Last modified: 2021/04/21 10:48 by jglan